Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add New gRPC Options and Add Reconnect Logic for connection Pool #2685

Conversation

kpango
Copy link
Collaborator

@kpango kpango commented Oct 8, 2024

Description

  • New Features

    • Enhanced gRPC server configuration with new parameters for improved performance and resource management, including enable_channelz, max_concurrent_streams, num_stream_workers, shared_write_buffer, and wait_for_handlers.
    • Added new configuration options for gRPC clients, allowing for more flexible control over connection behavior, such as content_subtype, authority, disable_retry, idle_timeout, max_call_attempts, and max_header_list_size.
    • Expanded capabilities of the ValdRelease resource with new fields in the Custom Resource Definition (CRD) for detailed gRPC settings and connection management.
  • Bug Fixes

    • Improved error handling and logging in gRPC client connection management.
  • Documentation

    • Updated comments and documentation to reflect new configuration options and functionalities.
  • Chores

    • Various formatting improvements across multiple Dockerfiles for consistency and adherence to best practices.

Related Issue

Versions

  • Vald Version: v1.7.13
  • Go Version: v1.23.2
  • Rust Version: v1.81.0
  • Docker Version: v27.3.1
  • Kubernetes Version: v1.31.1
  • Helm Version: v3.16.1
  • NGT Version: v2.2.4
  • Faiss Version: v1.8.0

Checklist

Special notes for your reviewer

Summary by CodeRabbit

  • New Features

    • Enhanced gRPC server configuration with new parameters for improved performance and debugging capabilities.
    • Introduced new configuration options for gRPC clients, allowing for more granular control over connection parameters.
    • Added new fields for observability and server configuration in multiple components, including vald-agent, vald-discoverer, and vald-index-correction.
    • Version updates for software components, including updates to FAISS, HELM, and PROMETHEUS_STACK, ensuring compatibility and access to new features.
  • Documentation

    • Updated configuration documentation for vald-agent and vald-discoverer to reflect new server parameters.
  • Bug Fixes

    • Corrected formatting issues in several Dockerfiles by adding newlines at the end.
  • Dependency Updates

    • Updated various dependencies to their latest versions for improved compatibility and features.

@kpango kpango requested review from a team, kmrmt, hlts2 and vankichi and removed request for a team and hlts2 October 8, 2024 23:02
@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Oct 8, 2024

[CHATOPS:HELP] ChatOps commands.

  • 🙆‍♀️ /approve - approve
  • 🍱 /format - format codes and add licenses
  • /gen-test - generate test codes
  • 🏷️ /label - add labels
  • 🔚 2️⃣ 🔚 /label actions/e2e-deploy - run E2E deploy & integration test

Copy link
Contributor

coderabbitai bot commented Oct 8, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request introduces modifications to the CallOption and DialOption structs in the internal/config/grpc.go file, expanding the configuration options available for gRPC clients. A new field, ContentSubtype, is added to the CallOption struct. The DialOption struct is significantly enhanced with multiple new fields that improve the configurability of gRPC connections. Additionally, the Bind method of DialOption and the Opts method of GRPCClient are updated to handle the new fields appropriately.

Changes

File Path Change Summary
internal/config/grpc.go Added new fields to CallOption and DialOption structs for enhanced gRPC configuration. Updated Bind and Opts methods accordingly.
internal/net/grpc/option.go Restructured WithDialOptions and WithCallOptions functions; added new functions for additional gRPC client configuration options. Updated existing functions for better initialization handling.
internal/net/grpc/server.go Added new server configuration functions to enhance gRPC server capabilities.
k8s/agent/ngt/configmap.yaml Updated Kubernetes ConfigMap with new gRPC server configuration options.
k8s/discoverer/configmap.yaml Enhanced ConfigMap for discoverer with new gRPC server configuration options.
k8s/gateway/gateway/lb/configmap.yaml Added new parameters to the ConfigMap for gRPC settings and connection options.
k8s/index/job/correction/configmap.yaml Updated ConfigMap with new gRPC configuration options across various sections.
k8s/index/operator/configmap.yaml Introduced new gRPC configuration options in the operator's ConfigMap.
versions/FAISS_VERSION Updated version number from 1.8.0 to 1.9.0.
versions/PROMETHEUS_STACK_VERSION Updated version number from 65.0.0 to 65.1.1.

Possibly related PRs

Suggested labels

priority/low, size/XXXL

Suggested reviewers

  • hlts2
  • vankichi

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Oct 8, 2024

[WARNING:INTCFG] Changes in interal/config may require you to change Helm charts. Please check.

@vdaas-ci
Copy link
Collaborator

Profile Report

typevald-agent-ngtvald-lb-gatewayvald-discoverervald-manager-index
cpu
heap
other images

@kpango kpango force-pushed the feature/internal-grpc/add-new-options-and-reconnect-when-goaway-received branch from 5a7b055 to efe121d Compare October 10, 2024 07:28
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 13

🧹 Outside diff range and nitpick comments (21)
internal/net/grpc/server.go (2)

127-131: Well-implemented SharedWriteBuffer function with clear documentation

The SharedWriteBuffer function is correctly implemented as a wrapper around grpc.SharedWriteBuffer. The comment effectively explains the purpose and behavior of this option.

Consider adding a brief note about the potential performance implications or use cases for this option to provide more context for users.


139-178: Excellent API reference documentation with minor formatting suggestion

The API references comment block is a valuable addition to the codebase. It provides a comprehensive overview of the gRPC server APIs, categorizing them into Already Implemented, Unnecessary, Experimental, and Deprecated groups. This organization greatly aids in understanding the current state of the package and its future direction.

For consistency, consider adjusting the formatting of the "Unnecessary for this package APIs" section to match the others:

-2. Unnecessary for this package APIs
+2. Unnecessary APIs

This minor change would align with the formatting of the other sections and maintain consistency throughout the comment block.

internal/config/server.go (2)

95-112: Significant changes to GRPC configuration structure

The GRPC struct has undergone substantial modifications:

  1. New fields added for finer control over GRPC server configuration (e.g., EnableChannelz, SharedWriteBuffer, WaitForHandlers).
  2. Removal of Keepalive, ConnectionTimeout, and Interceptors fields.

These changes provide more granular control but may impact existing configurations. Ensure that:

  1. The removal of Keepalive doesn't negatively affect connection management.
  2. The absence of ConnectionTimeout is handled appropriately in the server implementation.
  3. The removal of Interceptors doesn't break any existing middleware or request processing logic.

Consider adding migration guidelines or deprecation notices for removed fields to assist users in updating their configurations.


314-321: Add tests to cover EnableChannelz registration

The changes to the Server.Opts method correctly implement the new GRPC options and include the EnableChannelz option in the admin registration condition. This is a good improvement to the server configuration capabilities.

However, the new functionality for registering the channelz service when EnableChannelz is true is not currently covered by tests. Consider adding test cases to ensure that the channelz service is correctly registered and functions as intended when this option is enabled.

k8s/index/job/correction/configmap.yaml (4)

45-45: Enhance documentation for new gRPC server configuration options

While the new gRPC server options provide more granular control, it's important to document their purpose and potential impacts:

  1. enable_channelz: true (line 45): Document the purpose of channelz and any performance implications.
  2. max_concurrent_streams: 0 (line 60): Explain what this value means (likely unlimited) and when it might need adjustment.
  3. num_stream_workers: 0 (line 64): Clarify if this means auto-configuration and its impact on performance.
  4. shared_write_buffer: false (line 66): Describe scenarios where enabling this might be beneficial.
  5. wait_for_handlers: true (line 67): Explain the implications of this setting on server startup behavior.

Consider adding inline comments for each option, explaining their purpose, default values, and scenarios where they might need adjustment. This will greatly improve the maintainability of the configuration.

Also applies to: 60-60, 64-64, 66-67


274-274: Document and verify consistency of new gRPC client options for the gateway

The new gRPC client options in the corrector.gateway section provide more control but require documentation:

  1. content_subtype: "" (line 274): Explain the purpose and potential values.
  2. authority: "" (line 280): Describe its use in gRPC, especially in complex network setups.
  3. disable_retry: false (line 285): Document the retry behavior and when disabling might be necessary.
  4. idle_timeout: 1h (line 287): Explain the implications of this setting on long-running connections.
  5. max_call_attempts: 0 (line 296): Clarify if this means unlimited attempts and potential impacts.
  6. max_header_list_size: 0 (line 297): Explain what this controls and when it might need adjustment.

For all these options:

  • Add inline comments explaining their purpose, default behavior, and scenarios for tuning.
  • Ensure consistency with similar sections (e.g., discoverer.client) in terms of structure and values.
  • Consider security implications, especially for options like authority and disable_retry.

Also applies to: 280-287, 296-297


363-363: Ensure consistency in gRPC client options for the discoverer

The changes in the discoverer.client section mirror those in the corrector.gateway section, which is good for consistency. To maintain this consistency and clarity:

  1. Ensure that the documentation suggestions made for the gateway section are also applied here.
  2. Verify that the values set for each option are appropriate for the discoverer's specific use case.
  3. If there are any differences in how these options should be used between the gateway and discoverer, clearly document these distinctions.

Consider adding a comment at the beginning of this section explaining why these options are consistent with the gateway configuration, or if they differ, why they differ.

Also applies to: 369-376, 385-386


Line range hint 1-502: Improve overall structure and documentation for maintainability

While the new gRPC options provide enhanced configurability, they also increase the complexity of the configuration. To improve maintainability:

  1. Consider creating a common section for shared gRPC options, which can be referenced by specific components (gateway, discoverer, agent). This would reduce duplication and improve consistency.

  2. Add a high-level comment at the beginning of the file explaining the overall structure and purpose of each major section.

  3. For each major section (server_config, corrector, discoverer), add a brief comment explaining its role in the system and how it interacts with other components.

  4. Standardize the structure of gRPC client options across all sections (gateway, discoverer, agent_client_options) to make it easier to compare and maintain.

  5. Consider using YAML anchors and aliases to reduce duplication of common configuration blocks.

  6. Add a "Configuration Guidelines" section in the project's documentation, explaining the purpose and impact of these gRPC options, especially for tuning performance and security.

These improvements will make the configuration more maintainable, easier to understand, and less prone to inconsistencies as the system evolves.

internal/net/grpc/option.go (6)

398-405: LGTM! Consider simplifying the initialization condition

The change from int to int32 for the size parameter aligns with the gRPC library expectations, which is good. However, the initialization condition for g.dopts can be simplified:

if g.dopts == nil {
    g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}

This simplification applies to all similar initializations throughout the file.


519-530: LGTM! Consider simplifying the initialization condition

The addition of WithAuthority function is a good enhancement for configuring gRPC connections. However, the initialization condition for g.dopts can be simplified:

if g.dopts == nil {
    g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}

This simplification applies to all similar initializations throughout the file.


532-543: LGTM! Consider simplifying the initialization condition

The addition of WithDisableRetry function is a useful option for configuring gRPC connections. However, the initialization condition for g.dopts can be simplified:

if g.dopts == nil {
    g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}

This simplification applies to all similar initializations throughout the file.


545-566: LGTM! Well-implemented with proper error handling

The WithIdleTimeout function is a great addition with proper error handling and validation for the duration. However, the initialization condition for g.dopts can be simplified:

if g.dopts == nil {
    g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}

This simplification applies to all similar initializations throughout the file.


581-592: LGTM! Consider simplifying the initialization condition

The WithMaxHeaderListSize function is a good addition for configuring gRPC connections. The check for size > 0 is appropriate. However, the initialization condition for g.dopts can be simplified:

if g.dopts == nil {
    g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}

This simplification applies to all similar initializations throughout the file.


607-618: LGTM! Consider simplifying the initialization condition

The WithUserAgent function is a good addition for configuring gRPC connections. The check for a non-empty user agent string is appropriate. However, the initialization condition for g.dopts can be simplified:

if g.dopts == nil {
    g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}

This simplification applies to all similar initializations throughout the file.

internal/net/grpc/pool/pool.go (2)

571-598: Improved error handling and reconnection logic.

The changes to the Do method enhance the robustness of the connection pool by adding reconnection logic when a connection is closing. This is a good improvement.

However, there's a potential issue in the error handling:

In the reconnection logic (lines 586-596), if the new connection is successfully established but the subsequent f(conn) call fails, the original error is lost. Consider preserving both errors:

 if errors.Is(err, grpc.ErrClientConnClosing) {
     // ... (existing code for closing and redialing)
     if err == nil && conn != nil && isHealthy(ctx, conn) {
         p.store(idx, &poolConn{
             conn: conn,
             addr: p.addr,
         })
-        if newErr := f(conn); newErr != nil {
-            return errors.Join(err, newErr)
-        }
-        return nil
+        return f(conn)
     }
 }
 return err

This change ensures that both the original ErrClientConnClosing and any new error from the reconnection attempt are reported.


Line range hint 606-651: Enhanced getHealthyConn method with improved tracking

The changes to the getHealthyConn method are well-implemented. Returning the index along with the connection allows for better tracking and management of connections within the pool.

One minor suggestion for improvement:

On line 640, consider including the error in the log message for better debugging:

-log.Warnf("failed to find gRPC connection pool for %s.\tlen(pool): %d,\tretried: %d,\terror: %v", p.addr, pl, cnt, err)
+log.Warnf("failed to find gRPC connection pool for %s.\tlen(pool): %d,\tretried: %d,\terror: %v", p.addr, pl, cnt, err)

This will provide more context when troubleshooting connection issues.

charts/vald/values.yaml (3)

Line range hint 4592-4731: Added read replica management functionality

A new readreplica section has been added to the manager.index configuration, introducing functionality for managing read replicas. Key features include:

  1. A rotator job for managing read replica agents.
  2. Configuration options for the rotator, including image settings, security contexts, and Kubernetes resource management.
  3. Service account, cluster role, and cluster role binding configurations for the rotator.

This addition has the potential to significantly improve read performance and scalability of the Vald system by allowing for the creation and management of read replicas.

However, it's important to note that this feature is marked as "WORK IN PROGRESS" in the comments. While the addition is approved, it should be thoroughly tested before being used in production environments.

Consider adding more detailed documentation about how this feature works and its implications on system performance and resource usage once it's fully implemented.


Line range hint 4732-4929: Added Vald index operator functionality

A new operator section has been added to the manager.index configuration, introducing functionality for managing Vald indexes. Key features include:

  1. Deployment configuration for the index operator, including replicas, security contexts, and resource management.
  2. Observability and server configuration options.
  3. A rotation_job_concurrency setting to control the maximum number of concurrent rotator jobs.

This addition has the potential to significantly simplify and automate index management tasks in the Vald system, improving operational efficiency and reducing manual intervention.

However, it's crucial to note that this feature is marked as "THIS FEATURE IS WIP" (Work In Progress) in the comments. While the addition is approved, it should be thoroughly tested and possibly refined before being used in production environments.

  1. Consider adding more detailed documentation about how this operator works, its responsibilities, and its impact on the overall system once it's fully implemented.
  2. Ensure that appropriate error handling and logging are implemented in the operator to facilitate troubleshooting during the WIP phase and beyond.

Line range hint 1-4929: Overall assessment of changes

The modifications to the values.yaml file introduce substantial improvements to the Vald system's configurability and functionality:

  1. Enhanced gRPC server and client configurations allow for better performance tuning and connection management.
  2. New persistent volume support for agents improves data persistence and reliability.
  3. Introduction of read replica management (WIP) has the potential to enhance read performance and scalability.
  4. The new Vald index operator (WIP) promises to simplify and automate index management tasks.

These changes collectively contribute to a more flexible, performant, and manageable Vald deployment. However, it's important to note that some features (read replica and index operator) are still works in progress and will require further testing and refinement.

As the new features mature, consider updating the documentation to provide comprehensive guidance on configuring and using these new capabilities effectively.

internal/config/grpc.go (1)

155-155: Bind missing fields in CallOption.Bind()

Ensure all string fields in CallOption are bound using GetActualValue. Currently, only ContentSubtype is being bound. If there are other string fields now or added in the future, they should also be bound.

go.mod (1)

441-441: New Indirect Dependency: github.com/blang/semver/v4

The semantic versioning library has been added:

  • github.com/blang/semver/v4v4.0.0

Verify that this addition doesn't conflict with existing versioning implementations.

Ensure consistent usage of semantic versioning libraries throughout the project.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 5a7b055 and efe121d.

⛔ Files ignored due to path filters (21)
  • apis/grpc/v1/agent/core/agent.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/agent/sidecar/sidecar.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/discoverer/discoverer.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/filter/egress/egress_filter.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/filter/ingress/ingress_filter.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/meta/meta.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/mirror/mirror.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/payload/payload.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/rpc/errdetails/error_details.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/filter.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/flush.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/index.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/insert.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/object.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/remove.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/search.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/update.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/upsert.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • example/client/go.sum is excluded by !**/*.sum
  • go.sum is excluded by !**/*.sum
  • rust/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (71)
  • .github/ISSUE_TEMPLATE/bug_report.md (1 hunks)
  • .github/ISSUE_TEMPLATE/security_issue_report.md (1 hunks)
  • .github/PULL_REQUEST_TEMPLATE.md (1 hunks)
  • charts/vald-helm-operator/crds/valdrelease.yaml (94 hunks)
  • charts/vald/values.schema.json (107 hunks)
  • charts/vald/values.yaml (4 hunks)
  • dockers/agent/core/agent/Dockerfile (1 hunks)
  • dockers/agent/core/faiss/Dockerfile (1 hunks)
  • dockers/agent/core/ngt/Dockerfile (1 hunks)
  • dockers/agent/sidecar/Dockerfile (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildbase/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • dockers/buildkit/syft/scanner/Dockerfile (1 hunks)
  • dockers/ci/base/Dockerfile (2 hunks)
  • dockers/dev/Dockerfile (2 hunks)
  • dockers/discoverer/k8s/Dockerfile (1 hunks)
  • dockers/gateway/filter/Dockerfile (1 hunks)
  • dockers/gateway/lb/Dockerfile (1 hunks)
  • dockers/gateway/mirror/Dockerfile (1 hunks)
  • dockers/index/job/correction/Dockerfile (1 hunks)
  • dockers/index/job/creation/Dockerfile (1 hunks)
  • dockers/index/job/readreplica/rotate/Dockerfile (1 hunks)
  • dockers/index/job/save/Dockerfile (1 hunks)
  • dockers/index/operator/Dockerfile (1 hunks)
  • dockers/manager/index/Dockerfile (1 hunks)
  • dockers/operator/helm/Dockerfile (1 hunks)
  • dockers/tools/benchmark/job/Dockerfile (1 hunks)
  • dockers/tools/benchmark/operator/Dockerfile (1 hunks)
  • dockers/tools/cli/loadtest/Dockerfile (1 hunks)
  • example/client/go.mod (3 hunks)
  • go.mod (11 hunks)
  • hack/go.mod.default (1 hunks)
  • internal/config/grpc.go (3 hunks)
  • internal/config/grpc_test.go (4 hunks)
  • internal/config/server.go (2 hunks)
  • internal/config/server_test.go (5 hunks)
  • internal/db/rdb/mysql/dbr/dbr.go (1 hunks)
  • internal/db/rdb/mysql/dbr/session.go (1 hunks)
  • internal/db/rdb/mysql/dbr/tx.go (1 hunks)
  • internal/net/grpc/client.go (1 hunks)
  • internal/net/grpc/health/health.go (1 hunks)
  • internal/net/grpc/health/health_test.go (4 hunks)
  • internal/net/grpc/option.go (7 hunks)
  • internal/net/grpc/pool/pool.go (9 hunks)
  • internal/net/grpc/server.go (1 hunks)
  • internal/servers/server/option.go (1 hunks)
  • internal/servers/server/option_test.go (2 hunks)
  • internal/servers/server/server.go (2 hunks)
  • k8s/agent/ngt/configmap.yaml (2 hunks)
  • k8s/discoverer/configmap.yaml (2 hunks)
  • k8s/discoverer/deployment.yaml (1 hunks)
  • k8s/gateway/gateway/lb/configmap.yaml (8 hunks)
  • k8s/gateway/gateway/lb/deployment.yaml (1 hunks)
  • k8s/gateway/gateway/mirror/configmap.yaml (1 hunks)
  • k8s/gateway/gateway/mirror/deployment.yaml (1 hunks)
  • k8s/index/job/correction/configmap.yaml (9 hunks)
  • k8s/index/job/creation/configmap.yaml (6 hunks)
  • k8s/index/job/save/configmap.yaml (6 hunks)
  • k8s/index/operator/configmap.yaml (1 hunks)
  • k8s/index/operator/deployment.yaml (1 hunks)
  • k8s/manager/index/configmap.yaml (6 hunks)
  • k8s/manager/index/deployment.yaml (1 hunks)
  • k8s/operator/helm/crds/valdrelease.yaml (94 hunks)
  • versions/CMAKE_VERSION (1 hunks)
  • versions/FAISS_VERSION (1 hunks)
  • versions/HELM_VERSION (1 hunks)
  • versions/K3S_VERSION (1 hunks)
  • versions/PROMETHEUS_STACK_VERSION (1 hunks)
  • versions/actions/ACTIONS_CACHE (1 hunks)
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • dockers/buildbase/Dockerfile
  • versions/HELM_VERSION
  • versions/K3S_VERSION
🚧 Files skipped from review as they are similar to previous changes (56)
  • .github/ISSUE_TEMPLATE/bug_report.md
  • .github/ISSUE_TEMPLATE/security_issue_report.md
  • .github/PULL_REQUEST_TEMPLATE.md
  • charts/vald/values.schema.json
  • dockers/agent/core/agent/Dockerfile
  • dockers/agent/core/faiss/Dockerfile
  • dockers/agent/core/ngt/Dockerfile
  • dockers/agent/sidecar/Dockerfile
  • dockers/binfmt/Dockerfile
  • dockers/buildkit/Dockerfile
  • dockers/buildkit/syft/scanner/Dockerfile
  • dockers/ci/base/Dockerfile
  • dockers/dev/Dockerfile
  • dockers/discoverer/k8s/Dockerfile
  • dockers/gateway/filter/Dockerfile
  • dockers/gateway/lb/Dockerfile
  • dockers/gateway/mirror/Dockerfile
  • dockers/index/job/correction/Dockerfile
  • dockers/index/job/creation/Dockerfile
  • dockers/index/job/readreplica/rotate/Dockerfile
  • dockers/index/job/save/Dockerfile
  • dockers/index/operator/Dockerfile
  • dockers/manager/index/Dockerfile
  • dockers/operator/helm/Dockerfile
  • dockers/tools/benchmark/job/Dockerfile
  • dockers/tools/benchmark/operator/Dockerfile
  • dockers/tools/cli/loadtest/Dockerfile
  • example/client/go.mod
  • hack/go.mod.default
  • internal/config/grpc_test.go
  • internal/config/server_test.go
  • internal/db/rdb/mysql/dbr/dbr.go
  • internal/db/rdb/mysql/dbr/session.go
  • internal/db/rdb/mysql/dbr/tx.go
  • internal/net/grpc/client.go
  • internal/net/grpc/health/health.go
  • internal/net/grpc/health/health_test.go
  • internal/servers/server/option_test.go
  • internal/servers/server/server.go
  • k8s/agent/ngt/configmap.yaml
  • k8s/discoverer/configmap.yaml
  • k8s/discoverer/deployment.yaml
  • k8s/gateway/gateway/lb/configmap.yaml
  • k8s/gateway/gateway/lb/deployment.yaml
  • k8s/gateway/gateway/mirror/deployment.yaml
  • k8s/index/job/creation/configmap.yaml
  • k8s/index/job/save/configmap.yaml
  • k8s/index/operator/configmap.yaml
  • k8s/index/operator/deployment.yaml
  • k8s/manager/index/configmap.yaml
  • k8s/manager/index/deployment.yaml
  • versions/CMAKE_VERSION
  • versions/FAISS_VERSION
  • versions/PROMETHEUS_STACK_VERSION
  • versions/actions/ACTIONS_CACHE
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT
🧰 Additional context used
📓 Learnings (1)
internal/config/grpc.go (1)
Learnt from: kpango
PR: vdaas/vald#2685
File: internal/config/grpc.go:244-244
Timestamp: 2024-10-09T05:40:03.660Z
Learning: `grpc.WithIdleTimeout` is a client-side `DialOption` in gRPC and can be used in client configurations.
🔇 Additional comments (41)
internal/net/grpc/server.go (4)

116-119: LGTM: MaxConcurrentStreams function implementation

The MaxConcurrentStreams function is correctly implemented as a wrapper around grpc.MaxConcurrentStreams. The comment accurately describes its purpose, and the implementation is straightforward and correct.


121-125: Excellent implementation and documentation for NumStreamWorkers

The NumStreamWorkers function is well-implemented as a wrapper around grpc.NumStreamWorkers. The accompanying comment is particularly helpful, providing clear information about the function's purpose and the default behavior when set to zero. This level of detail in the documentation is commendable.


133-137: Excellent implementation and comprehensive documentation for WaitForHandlers

The WaitForHandlers function is well-implemented as a wrapper around grpc.WaitForHandlers. The accompanying comment is exemplary, providing a detailed explanation of the function's purpose, its effect on the Stop method, and the default behavior. This level of documentation greatly enhances code maintainability and usability.


115-178: Summary: High-quality additions to gRPC server configuration

The new functions (MaxConcurrentStreams, NumStreamWorkers, SharedWriteBuffer, and WaitForHandlers) are well-implemented wrappers around their gRPC counterparts. The documentation for each function is clear and informative, providing valuable context for users.

The API references comment block is a particularly useful addition, offering a comprehensive overview of available server options and their status.

Overall, these changes enhance the configurability of gRPC servers in the package while maintaining good code quality and documentation standards. The minor suggestions provided in the review comments are aimed at further improving an already solid implementation.

k8s/gateway/gateway/mirror/configmap.yaml (3)

28-28: Clarify max_call_attempts and verify content_subtype impact

  1. max_call_attempts: 0: Please clarify if this is intended to mean unlimited retries. If so, consider setting a reasonable upper limit to prevent potential issues in case of persistent failures.

  2. content_subtype: "": Verify that using an empty string here doesn't negatively impact the client's behavior. It might be using a default value, but it's worth confirming.

To check the usage and impact of these settings, run the following commands:

#!/bin/bash
# Check for max_call_attempts usage
rg "max_call_attempts" --type go

# Check for content_subtype usage
rg "content_subtype" --type go

28-28: Verify usage of user_agent setting

Setting user_agent: Vald-gRPC is a good practice for identification and debugging purposes. However, based on previous review comments, this field might be unused in the codebase.

To confirm whether this setting is being utilized, please run the following command:

#!/bin/bash
# Check for user_agent usage in the codebase
rg "user_agent.*Vald-gRPC" --type go

If the search yields no results, consider removing this unused configuration to keep the config file clean and prevent confusion.


28-28: LGTM with a suggestion for num_stream_workers

The new gRPC server configuration options look good and should improve the server's functionality and debuggability. The enable_channelz option will be particularly useful for monitoring and debugging gRPC internals.

However, I suggest verifying the intended behavior of num_stream_workers: 0. Depending on the gRPC implementation, this might either use a default value or disable stream workers entirely. Please confirm that this aligns with your performance requirements.

To check the impact of num_stream_workers: 0, you can run the following command:

✅ Verification successful

Verified: num_stream_workers Configuration is Handled Correctly

The num_stream_workers: 0 setting is properly managed within the codebase and does not introduce any issues. The configuration falls back to the default behavior as intended, ensuring the gRPC server operates reliably.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any custom handling of num_stream_workers in the codebase
rg "num_stream_workers" --type go

Length of output: 288


Script:

#!/bin/bash
# Search for any custom handling of num_stream_workers in the codebase
rg "num_stream_workers" --type go

Length of output: 184


Script:

#!/bin/bash
# Find all usages of NumStreamWorkers in the codebase
rg "NumStreamWorkers" --type go

Length of output: 865

internal/net/grpc/pool/pool.go (2)

601-603: LGTM: Simplified Get method

The changes to the Get method improve code reuse by leveraging the getHealthyConn method. This promotes consistency and reduces duplication in the codebase.


448-448: Improved error handling and logging

The various minor changes throughout the file, particularly in error handling and logging, contribute to the overall robustness and maintainability of the code. These improvements will aid in debugging and provide better insights into the connection pool's behavior.

Also applies to: 476-476, 486-486, 582-584, 682-685, 689-691

charts/vald/values.yaml (3)

241-265: Improved gRPC server configuration options

The new fields added to the gRPC server configuration provide more fine-grained control over server behavior:

  1. max_concurrent_streams: Allows limiting the number of concurrent streams per connection.
  2. num_stream_workers: Controls the number of workers processing streams.
  3. shared_write_buffer: Enables sharing of the write buffer, which can improve memory usage.
  4. wait_for_handlers: Ensures graceful shutdown by waiting for handlers to complete.
  5. enable_channelz: Activates the channelz service for better observability.

These additions will allow for better tuning of the gRPC server's performance and resource utilization.


756-758: Enhanced gRPC client configuration options

The new fields added to the gRPC client configuration provide more control over client behavior:

  1. content_subtype: Allows specifying the content subtype for gRPC calls.
  2. max_header_list_size: Controls the maximum size of the header list.
  3. max_call_attempts: Limits the number of call attempts.
  4. disable_retry: Provides an option to disable automatic retries.
  5. shared_write_buffer: Enables sharing of the write buffer for potential performance improvements.
  6. authority: Allows overriding the :authority pseudo-header.
  7. idle_timeout: Sets the duration after which an idle connection will be closed.

These additions provide more flexibility in configuring gRPC client behavior, potentially improving performance, error handling, and connection management.

Also applies to: 776-817


Line range hint 2519-2537: Added persistent volume support for agents

A new persistentVolume section has been added to the agent configuration, which includes:

  • enabled: Toggle for enabling PVC (Persistent Volume Claim).
  • accessMode: Specifies the access mode for the storage.
  • mountPropagation: Controls how mounts are propagated from the host to the container.
  • storageClass: Defines the storage class to be used.
  • size: Specifies the size of the persistent volume.

This addition is crucial for maintaining agent state across restarts or rescheduling, especially when the agent's file store functionality is enabled with non-in-memory mode. It enhances the reliability and data persistence of the Vald agents.

charts/vald-helm-operator/crds/valdrelease.yaml (5)

938-939: Approve new gRPC server configuration properties

The addition of new gRPC server configuration properties enhances the flexibility and control over the server's behavior. These new properties include:

  1. enable_channelz: Allows for better debugging and performance analysis
  2. max_concurrent_streams: Controls the number of concurrent streams per connection
  3. num_stream_workers: Manages the number of workers processing streams
  4. shared_write_buffer: Optimizes memory usage for write operations
  5. wait_for_handlers: Ensures all handlers are ready before serving

These additions provide more granular control over the gRPC server's performance and behavior, which is beneficial for fine-tuning the system to specific deployment needs.

Also applies to: 974-975, 982-983, 986-989


2227-2228: Approve new gRPC client configuration properties

The addition of new gRPC client configuration properties enhances the flexibility and control over the client's behavior. These new properties include:

  1. content_subtype: Allows specifying the content subtype for gRPC requests
  2. authority: Enables overriding the :authority pseudo-header in requests
  3. disable_retry: Provides an option to disable automatic retries
  4. idle_timeout: Sets the duration a connection can be idle before closing
  5. max_call_attempts: Limits the number of attempts for a single RPC
  6. max_header_list_size: Controls the maximum size of header list
  7. shared_write_buffer: Optimizes memory usage for write operations
  8. user_agent: Allows setting a custom user agent string

These additions provide more granular control over the gRPC client's behavior, which is beneficial for optimizing performance and handling various network conditions.

Also applies to: 2232-2233, 2242-2243, 2246-2247, 2269-2272, 2334-2335, 2338-2339


5715-5716: Approve new agent configuration properties

The agent configuration section has been updated with new properties that are consistent with the changes made to the gRPC server and client configurations elsewhere in the file. These additions include:

  1. content_subtype
  2. authority
  3. disable_retry
  4. idle_timeout
  5. max_call_attempts
  6. max_header_list_size
  7. shared_write_buffer
  8. user_agent

These changes ensure that the agent component has the same level of configurability as other components in the system, maintaining consistency throughout the ValdRelease resource definition.

Also applies to: 5720-5721, 5730-5731, 5734-5735, 5757-5760, 5822-5823, 5826-5827


6830-6831: Approve consistent configuration updates across components

The new gRPC configuration properties have been consistently added across various components of the system, including:

  1. Gateway
  2. Index Manager
  3. Discoverer
  4. Other related components

These additions include properties such as enable_channelz, max_concurrent_streams, num_stream_workers, shared_write_buffer, and wait_for_handlers for server configurations, as well as corresponding client configuration properties.

This consistent approach ensures that all components of the ValdRelease resource can be fine-tuned with the same level of granularity, providing a uniform configuration experience across the entire system.

Also applies to: 6866-6867, 6874-6875, 6878-6881, 12636-12637, 12672-12673, 12680-12681, 12684-12687


Line range hint 1-14437: Summary of ValdRelease CRD enhancements

The changes made to the ValdRelease Custom Resource Definition significantly enhance the configurability of the Vald system. Key improvements include:

  1. Extended gRPC server configuration options, allowing for better performance tuning and debugging capabilities.
  2. Enhanced gRPC client configuration properties, providing more control over connection handling, retries, and timeouts.
  3. Consistent application of these new properties across all major components (agent, gateway, index manager, discoverer, etc.).

These additions allow for more granular control over the behavior and performance of Vald deployments, enabling users to optimize the system for their specific use cases and infrastructure requirements.

The changes are well-structured and maintain consistency throughout the CRD, which will facilitate easier configuration management and deployment of Vald resources.

k8s/operator/helm/crds/valdrelease.yaml (3)

938-939: Approve new gRPC server configuration options

The addition of new gRPC server configuration options enhances the flexibility and control over the gRPC servers in Vald. These new options include:

  • enable_channelz: Allows for better debugging and observability of gRPC channels.
  • max_concurrent_streams: Controls the number of concurrent streams in a single gRPC connection.
  • num_stream_workers: Manages the number of workers handling gRPC streams.
  • shared_write_buffer: Optimizes memory usage by sharing write buffers.
  • wait_for_handlers: Ensures all handlers are ready before serving requests.

These additions provide more fine-grained control over server behavior, potentially improving performance and observability. The consistent implementation across different components (gateway, manager, agent, etc.) ensures uniformity in configuration.

Also applies to: 974-975, 982-983, 986-989


2227-2228: Approve new gRPC client configuration options

The addition of new gRPC client configuration options enhances the flexibility and control over the gRPC clients in Vald. These new options include:

  • content_subtype: Allows specifying the content subtype for gRPC communication.
  • authority: Provides the ability to set the :authority pseudo-header.
  • disable_retry: Offers control over the retry mechanism.
  • idle_timeout: Manages the duration a connection can be idle before being closed.
  • max_call_attempts: Limits the number of attempts for a single RPC call.
  • max_header_list_size: Controls the maximum size of the header list.
  • shared_write_buffer: Optimizes memory usage by sharing write buffers.
  • user_agent: Allows setting a custom user agent string.

These additions provide more fine-grained control over client behavior, potentially improving connection management, retry logic, and overall performance. The consistent implementation across different components ensures uniformity in configuration.

Also applies to: 2232-2233, 2242-2243, 2246-2247, 2269-2272, 2334-2335, 2338-2339


Line range hint 1-14584: Summary of CRD changes

The modifications to the ValdRelease Custom Resource Definition (CRD) primarily focus on enhancing gRPC server and client configurations. These changes align well with the PR objectives of improving gRPC server configuration and connection management within the Vald project.

Key points:

  1. New gRPC server options provide better control over server behavior and performance.
  2. Additional gRPC client options offer improved connection management and retry logic.
  3. The changes are consistently applied across various components (gateway, manager, agent, etc.).
  4. No significant changes were made to the observability and metrics sections, suggesting that existing configurations in these areas were sufficient.

These enhancements will allow for more fine-tuned deployments of Vald, potentially improving performance, reliability, and debuggability of the system.

internal/config/grpc.go (3)

254-254: Correct usage of grpc.WithReadBufferSize

At line 254, verify that you are correctly setting the read buffer size. Ensure that g.DialOption.ReadBufferSize is intended for grpc.WithReadBufferSize.

Check for any possible mix-ups with write buffer size.


42-46: Ensure CallOption.ContentSubtype is properly utilized

The new field ContentSubtype in CallOption is added, but there is no verification that it's being correctly applied in the gRPC call options elsewhere in the codebase. Make sure that when creating call options, ContentSubtype is used to set the content subtype of the gRPC calls.

To confirm its usage, run the following script:

✅ Verification successful

Verified: ContentSubtype is properly utilized in gRPC call options

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `ContentSubtype` is used in gRPC call options.

# Search for instances where grpc.CallContentSubtype is used
rg --type go 'grpc\.CallContentSubtype' --context 5

Length of output: 711


Script:

#!/bin/bash
# Description: Verify that `ContentSubtype` is utilized in gRPC call options within grpc.go.

# Search for the usage of `ContentSubtype` in internal/config/grpc.go
rg --type go 'ContentSubtype' internal/config/grpc.go --context 5

Length of output: 1415


233-237: Ensure CallOption fields are correctly applied

While ContentSubtype and other call options are included, verify that they are properly used when making gRPC calls in the codebase.

Run the following script to confirm usage:

internal/servers/server/option.go (6)

611-614: Updated parameter type to uint32 in WithGRPCMaxHeaderListSize

The function WithGRPCMaxHeaderListSize now correctly accepts a uint32 type for the size parameter, aligning with the expected type for grpc.MaxHeaderListSize.


620-627: Updated parameter type to uint32 in WithGRPCHeaderTableSize

The function WithGRPCHeaderTableSize now correctly uses a uint32 type for the size parameter, which matches the expected type for grpc.HeaderTableSize.


629-636: Added new function WithGRPCMaxConcurrentStreams

The function WithGRPCMaxConcurrentStreams has been added to allow configuration of the grpc.MaxConcurrentStreams option. This enhances the server's ability to control the number of concurrent streams.


638-645: Added new function WithGRPCNumStreamWorkers

The function WithGRPCNumStreamWorkers has been introduced to set the grpc.NumStreamWorkers option, providing better control over stream handling performance.


647-654: Added new function WithGRPCSharedWriteBuffer

The function WithGRPCSharedWriteBuffer correctly implements the ability to enable or disable the grpc.SharedWriteBuffer option based on the enable parameter.


656-659: Added new function WithGRPCWaitForHandlers

The function WithGRPCWaitForHandlers appropriately adds support for the grpc.WaitForHandlers option, based on the wait parameter, enhancing server shutdown behavior.

go.mod (12)

6-16: Ensure Compatibility with Updated Google Cloud Dependencies

Multiple Google Cloud dependencies have been updated:

  • cloud.google.com/gov0.116.0
  • cloud.google.com/go/pubsubv1.44.0
  • cloud.google.com/go/storagev1.44.0
  • code.cloudfoundry.org/bytefmtv0.12.0

Please verify that these updates are compatible with your codebase and do not introduce any breaking changes.

Consider reviewing the release notes for these packages and running integration tests to ensure all functionalities work as expected.


48-69: Review AWS SDK Updates for Compatibility

The AWS SDK for Go and related packages have been updated:

  • github.com/aws/aws-sdk-go-v2v1.32.2
  • Sub-packages such as aws/protocol/eventstream, config, credentials, imds, manager, and services like kms, s3, sns, sqs, etc., have also been updated.

Ensure that your application remains compatible with these new versions, as there may be API changes or deprecations.

Review the AWS SDK release notes for these versions and update your code if necessary.


157-157: Confirm Compatibility with Updated github.com/google/pprof

The github.com/google/pprof dependency has been updated to:

  • v0.0.0-20241009165004-a3522334989c

Please ensure that this update does not affect your profiling or performance monitoring tools.

Test the profiling functionalities to confirm they work as expected.


195-195: Check for Changes in github.com/klauspost/compress

The github.com/klauspost/compress library has been updated to a newer version:

  • v1.17.11-0.20241008092028-72cd4a92a8b1

Verify that compression and decompression features in your application remain stable.

Run compression-related tests to ensure compatibility.


214-214: Update to github.com/mattn/go-sqlite3

The SQLite driver has been updated:

  • github.com/mattn/go-sqlite3v1.14.24

Ensure that database interactions using SQLite function correctly with this new version.

Test database operations to confirm there are no regressions.


297-299: Assess Updates to golang.org/x Packages

The following packages have been updated:

  • golang.org/x/cryptov0.28.0
  • golang.org/x/expv0.0.0-20241009180824-f66d83c29e7c
  • golang.org/x/exp/typeparamsv0.0.0-20241009180824-f66d83c29e7c

Please review these updates for compatibility, especially if you utilize experimental features.

Examine the changelogs and test any features that rely on these packages.


307-311: Verify System and Text Package Updates

Updates have been made to:

  • golang.org/x/sysv0.26.0
  • golang.org/x/termv0.25.0
  • golang.org/x/textv0.19.0
  • golang.org/x/timev0.7.0

Ensure that system calls, terminal interactions, text processing, and time functionalities are unaffected.

Run relevant system-level tests to confirm stability.


332-337: Validate Compatibility with Updated Kubernetes Dependencies

Kubernetes packages have been updated to v0.31.1:

  • k8s.io/api
  • k8s.io/apiextensions-apiserver
  • k8s.io/apimachinery
  • k8s.io/cli-runtime
  • k8s.io/client-go
  • k8s.io/component-base

Please verify that your Kubernetes integrations are compatible with these updates.

Check for any deprecated APIs and update your code accordingly. Running integration tests against a Kubernetes cluster would be beneficial.


339-340: Note on k8s.io/kube-openapi and k8s.io/kubernetes Updates

The following have been updated:

  • k8s.io/kube-openapiv0.0.0-20241009091222-67ed5848f094
  • k8s.io/kubernetesv0.31.1

Ensure that any OpenAPI specifications and Kubernetes interactions remain consistent with these versions.

Review any changes in the OpenAPI definitions that could affect code generation or API interactions.


344-345: Update of sigs.k8s.io/controller-runtime

The controller-runtime package has been updated:

  • sigs.k8s.io/controller-runtimev0.19.0

Confirm that custom controllers and manager setups are compatible with this version.

Test your operators or controllers thoroughly to detect any issues arising from this update.


425-431: Review Indirect Dependencies Updates

New indirect dependencies have been added:

  • cel.dev/exprv0.16.1
  • cloud.google.com/go/authv0.9.8
  • cloud.google.com/go/auth/oauth2adaptv0.2.4
  • cloud.google.com/go/compute/metadatav0.5.2
  • cloud.google.com/go/iamv1.2.1
  • cloud.google.com/go/monitoringv1.21.1

Ensure these additions do not adversely affect your project's dependency tree.

Use go mod tidy and go mod vendor to manage and verify module dependencies.


435-436: Addition of OpenTelemetry Operations Dependencies

New indirect dependencies related to OpenTelemetry have been added:

  • github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcpv1.24.1
  • github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metricv0.48.1

If you're using OpenTelemetry for monitoring, ensure these additions align with your observability setup.

Validate that metrics and traces are being captured and exported correctly.

internal/config/server.go Show resolved Hide resolved
internal/config/grpc.go Show resolved Hide resolved
internal/config/grpc.go Show resolved Hide resolved
internal/config/grpc.go Show resolved Hide resolved
internal/config/grpc.go Show resolved Hide resolved
internal/config/grpc.go Show resolved Hide resolved
@kpango kpango force-pushed the feature/internal-grpc/add-new-options-and-reconnect-when-goaway-received branch from efe121d to fde558c Compare October 10, 2024 07:55
@kpango kpango force-pushed the feature/internal-grpc/add-new-options-and-reconnect-when-goaway-received branch from fde558c to 7a1be45 Compare October 10, 2024 07:55
@kpango kpango force-pushed the feature/internal-grpc/add-new-options-and-reconnect-when-goaway-received branch from 7a1be45 to b5daaa6 Compare October 10, 2024 07:59
@vankichi vankichi merged commit a4ae440 into main Oct 10, 2024
202 of 205 checks passed
@vankichi vankichi deleted the feature/internal-grpc/add-new-options-and-reconnect-when-goaway-received branch October 10, 2024 08:30
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 14

🧹 Outside diff range and nitpick comments (13)
internal/net/grpc/server.go (2)

127-131: Well-implemented SharedWriteBuffer function with clear documentation

The SharedWriteBuffer function is correctly implemented as a wrapper around grpc.SharedWriteBuffer. The comment effectively explains the purpose and behavior of this option.

Suggestion: Consider adding a brief note about the potential performance implications or use cases for this option to provide more context for users.


139-178: Comprehensive API reference documentation with minor formatting suggestion

The API references comment block is an excellent addition to the codebase. It provides a clear and organized overview of the available server options, categorizing them into implemented, unnecessary, experimental, and deprecated APIs. This documentation is invaluable for developers working on or with this package.

Suggestion: For consistency, consider adjusting the formatting of the "Unnecessary for this package APIs" section to match the others. For example:

-2. Unnecessary for this package APIs
+2. Unnecessary APIs for this package

This minor change would align the formatting with the other section headers.

internal/config/grpc.go (1)

51-73: LGTM: Comprehensive additions to DialOption struct

The new fields added to the DialOption struct significantly enhance the configurability of gRPC dial options. This allows for fine-tuned control over various aspects of gRPC connections, including retries, backoff, timeouts, and keepalive settings.

Consider adding inline documentation (comments) for each new field to explain its purpose and expected values. This would greatly improve the usability of this struct for other developers.

k8s/index/job/creation/configmap.yaml (2)

45-45: Review gRPC server configuration changes

The new gRPC server configuration options enhance debugging capabilities and control over server behavior. However, some settings warrant careful consideration:

  1. enable_channelz: true is good for debugging but may impact performance in production.
  2. max_concurrent_streams: 0 removes the limit on concurrent streams. Consider setting a reasonable limit to prevent resource exhaustion.
  3. num_stream_workers: 0 might rely on Go's default concurrency handling. Evaluate if explicit control is needed based on your use case.
  4. shared_write_buffer: false is generally safe but might affect performance. Test to ensure it meets your requirements.
  5. wait_for_handlers: true is a good practice for ensuring consistency.

Consider load testing with these new configurations to ensure they meet your performance and resource utilization expectations. You may want to adjust max_concurrent_streams and num_stream_workers based on your specific workload and available resources.

Also applies to: 60-60, 64-67


274-274: Review gRPC client configuration changes in creator.discoverer.client

The new gRPC client configuration options provide more control over connection behavior. However, some settings require attention:

  1. content_subtype and authority are empty, which will use default behaviors. Ensure this aligns with your requirements.

  2. disable_retry: false allows automatic retries, which is generally good for reliability.

  3. idle_timeout: 1h is reasonable for long-running connections but monitor its impact on resource usage.

  4. max_call_attempts: 0 might allow unlimited retries. Consider setting a finite limit to prevent potential issues.

  5. max_header_list_size: 0 removes the limit on header list size. This could be a security risk; consider setting a reasonable limit.

  6. shared_write_buffer: false is safer but might affect performance.

  7. user_agent: Vald-gRPC is good for identification in logs and monitoring.

  8. Consider setting a finite max_call_attempts to prevent excessive retries.

  9. Evaluate setting a reasonable max_header_list_size to mitigate potential security risks.

  10. Test the performance impact of shared_write_buffer: false and adjust if necessary.

  11. Monitor the effects of the idle_timeout setting on your connection pool and resource usage.

Also applies to: 280-287, 296-297, 326-328

k8s/index/job/correction/configmap.yaml (2)

45-45: Consider enhancing documentation for new gRPC server configuration options

The new gRPC server configuration options provide more control, but some values might benefit from additional explanation:

  1. enable_channelz: true (line 45): This enables gRPC channelz. Consider adding a comment explaining its purpose and potential performance impact.

  2. max_concurrent_streams: 0 (line 60): A value of 0 typically means "use default". Document what this default is and when it might need adjustment.

  3. num_stream_workers: 0 (line 64): Similar to above, explain the implications of the default value and when it should be changed.

  4. shared_write_buffer: false (line 66): Explain the trade-offs of enabling this option.

  5. wait_for_handlers: true (line 67): Clarify what this option does and its impact on server startup.

Consider adding inline comments for each option to improve maintainability.

Also applies to: 60-60, 64-64, 66-67


274-274: Enhance documentation for new gRPC client options in the gateway section

The new gRPC client options provide more granular control, but some values might benefit from additional explanation:

  1. content_subtype: "" (line 274): Explain the purpose of this option and the implications of an empty string value.

  2. authority: "" (line 280): Clarify when this should be set and the impact of leaving it empty.

  3. disable_retry: false (line 285): Document the default retry behavior and when disabling retries might be beneficial.

  4. idle_timeout: 1h (line 287): Explain the trade-offs of this timeout value and when it might need adjustment.

  5. max_call_attempts: 0 and max_header_list_size: 0 (lines 296-297): Clarify what these zero values mean (likely "use default") and document the actual default values.

  6. shared_write_buffer: false (line 326): Explain the implications of enabling this option.

  7. user_agent: Vald-gRPC (line 328): Consider if this user agent string is sufficiently descriptive or if it should include version information.

Consider adding inline comments for each option to improve maintainability and guide future configuration changes.

Also applies to: 280-287, 296-297, 326-326, 328-328

internal/net/grpc/pool/pool.go (2)

571-598: Improved error handling and reconnection logic.

The changes to the Do method enhance the robustness of the connection pool by adding reconnection logic when a connection is closing. This is a good improvement.

However, there's a potential issue in the error handling:

In the reconnection logic (lines 586-593), if the new connection is successfully established but the subsequent f(conn) call fails, the original error is lost. Consider preserving both errors:

 if errors.Is(err, grpc.ErrClientConnClosing) {
     // ... (existing code for closing and redialing)
     if err == nil && conn != nil && isHealthy(ctx, conn) {
         p.store(idx, &poolConn{
             conn: conn,
             addr: p.addr,
         })
-        if newErr := f(conn); newErr != nil {
-            return errors.Join(err, newErr)
-        }
-        return nil
+        return f(conn)
     }
 }
 return err

This change ensures that both the original ErrClientConnClosing and any new error from the reconnection attempt are reported.


Line range hint 606-651: Enhanced connection handling in getHealthyConn

The changes to the getHealthyConn method significantly improve the connection handling logic, especially for IP connections and retries. The addition of the index return value allows for better tracking of connections within the pool.

One minor suggestion for improvement:

On line 640, consider including the error in the log message for better debugging:

-log.Warnf("failed to find gRPC connection pool for %s.\tlen(pool): %d,\tretried: %d,\terror: %v", p.addr, pl, cnt, err)
+log.Warnf("failed to find gRPC connection pool for %s.\tlen(pool): %d,\tretried: %d,\terror: %v", p.addr, pl, cnt, err)

This will provide more context when troubleshooting connection issues.

Makefile (2)

397-417: New target added to set correct permissions

The new perm target is a useful addition to the Makefile. It sets the correct permissions for directories and files in the project, which is important for security and consistency. Here's a breakdown of what it does:

  1. Sets 755 permissions for all directories (except .git)
  2. Sets 644 permissions for all files (except .git and .gitignore)
  3. Sets specific permissions for the .git directory and its contents
  4. Sets 644 permissions for .gitignore and .gitattributes files

This is a good practice to ensure consistent file permissions across the project.

Consider adding a comment explaining the purpose of this target at the beginning of the implementation for better documentation.


397-417: Overall assessment of Makefile changes

The changes made to the Makefile are well-implemented and add valuable functionality:

  1. The new perm target provides a convenient way to set correct file permissions across the project.
  2. The target is correctly added to the .PHONY list, following Makefile best practices.
  3. The implementation is thorough, covering various file types and special cases (like .git directory).

These changes enhance the project's maintainability and security without affecting existing functionality.

Consider integrating this perm target into your CI/CD pipeline or developer setup scripts to ensure consistent file permissions across different environments and contributors.

internal/net/grpc/client.go (1)

149-151: LGTM! Consider adding test coverage for this new condition.

The addition of default call options to the dial options is a good improvement for flexibility. However, the static analysis tool indicates that these lines are not covered by tests.

Could you add test cases to cover this new condition? This will ensure the behavior is verified and prevent potential regressions in the future.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 149-150: internal/net/grpc/client.go#L149-L150
Added lines #L149 - L150 were not covered by tests

charts/vald-helm-operator/crds/valdrelease.yaml (1)

Line range hint 938-14437: Comprehensive update to gRPC configuration options

This update introduces a significant number of new configuration options for gRPC servers and clients across various components of the Vald system. These changes provide more granular control over gRPC behavior, potentially allowing for better performance tuning and debugging capabilities.

Key areas of enhancement include:

  1. Server-side streaming control (e.g., max_concurrent_streams, num_stream_workers)
  2. Client-side connection management (e.g., idle_timeout, max_call_attempts)
  3. Performance optimization options (e.g., shared_write_buffer)
  4. Debugging and observability features (e.g., enable_channelz)

Consider the following recommendations:

  1. Update the project documentation to reflect these new configuration options, their default values, and best practices for tuning.
  2. Develop guidelines or tools to help users properly configure these options based on their specific use cases and deployment scenarios.
  3. Implement monitoring and alerting for these new configurable parameters to help users identify potential issues or optimization opportunities.
  4. Consider creating predefined configuration profiles (e.g., high-throughput, low-latency) to simplify the configuration process for common use cases.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between efe121d and b5daaa6.

⛔ Files ignored due to path filters (21)
  • apis/grpc/v1/agent/core/agent.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/agent/sidecar/sidecar.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/discoverer/discoverer.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/filter/egress/egress_filter.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/filter/ingress/ingress_filter.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/meta/meta.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/mirror/mirror.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/payload/payload.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/rpc/errdetails/error_details.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/filter.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/flush.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/index.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/insert.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/object.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/remove.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/search.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/update.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/upsert.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • example/client/go.sum is excluded by !**/*.sum
  • go.sum is excluded by !**/*.sum
  • rust/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (72)
  • .github/ISSUE_TEMPLATE/bug_report.md (1 hunks)
  • .github/ISSUE_TEMPLATE/security_issue_report.md (1 hunks)
  • .github/PULL_REQUEST_TEMPLATE.md (1 hunks)
  • Makefile (1 hunks)
  • charts/vald-helm-operator/crds/valdrelease.yaml (94 hunks)
  • charts/vald/values.schema.json (107 hunks)
  • charts/vald/values.yaml (4 hunks)
  • dockers/agent/core/agent/Dockerfile (1 hunks)
  • dockers/agent/core/faiss/Dockerfile (1 hunks)
  • dockers/agent/core/ngt/Dockerfile (1 hunks)
  • dockers/agent/sidecar/Dockerfile (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildbase/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • dockers/buildkit/syft/scanner/Dockerfile (1 hunks)
  • dockers/ci/base/Dockerfile (2 hunks)
  • dockers/dev/Dockerfile (2 hunks)
  • dockers/discoverer/k8s/Dockerfile (1 hunks)
  • dockers/gateway/filter/Dockerfile (1 hunks)
  • dockers/gateway/lb/Dockerfile (1 hunks)
  • dockers/gateway/mirror/Dockerfile (1 hunks)
  • dockers/index/job/correction/Dockerfile (1 hunks)
  • dockers/index/job/creation/Dockerfile (1 hunks)
  • dockers/index/job/readreplica/rotate/Dockerfile (1 hunks)
  • dockers/index/job/save/Dockerfile (1 hunks)
  • dockers/index/operator/Dockerfile (1 hunks)
  • dockers/manager/index/Dockerfile (1 hunks)
  • dockers/operator/helm/Dockerfile (1 hunks)
  • dockers/tools/benchmark/job/Dockerfile (1 hunks)
  • dockers/tools/benchmark/operator/Dockerfile (1 hunks)
  • dockers/tools/cli/loadtest/Dockerfile (1 hunks)
  • example/client/go.mod (3 hunks)
  • go.mod (11 hunks)
  • hack/go.mod.default (1 hunks)
  • internal/config/grpc.go (3 hunks)
  • internal/config/grpc_test.go (4 hunks)
  • internal/config/server.go (2 hunks)
  • internal/config/server_test.go (5 hunks)
  • internal/db/rdb/mysql/dbr/dbr.go (1 hunks)
  • internal/db/rdb/mysql/dbr/session.go (1 hunks)
  • internal/db/rdb/mysql/dbr/tx.go (1 hunks)
  • internal/net/grpc/client.go (1 hunks)
  • internal/net/grpc/health/health.go (1 hunks)
  • internal/net/grpc/health/health_test.go (4 hunks)
  • internal/net/grpc/option.go (7 hunks)
  • internal/net/grpc/pool/pool.go (9 hunks)
  • internal/net/grpc/server.go (1 hunks)
  • internal/servers/server/option.go (1 hunks)
  • internal/servers/server/option_test.go (2 hunks)
  • internal/servers/server/server.go (2 hunks)
  • k8s/agent/ngt/configmap.yaml (2 hunks)
  • k8s/discoverer/configmap.yaml (2 hunks)
  • k8s/discoverer/deployment.yaml (1 hunks)
  • k8s/gateway/gateway/lb/configmap.yaml (8 hunks)
  • k8s/gateway/gateway/lb/deployment.yaml (1 hunks)
  • k8s/gateway/gateway/mirror/configmap.yaml (1 hunks)
  • k8s/gateway/gateway/mirror/deployment.yaml (1 hunks)
  • k8s/index/job/correction/configmap.yaml (9 hunks)
  • k8s/index/job/creation/configmap.yaml (6 hunks)
  • k8s/index/job/save/configmap.yaml (6 hunks)
  • k8s/index/operator/configmap.yaml (1 hunks)
  • k8s/index/operator/deployment.yaml (1 hunks)
  • k8s/manager/index/configmap.yaml (6 hunks)
  • k8s/manager/index/deployment.yaml (1 hunks)
  • k8s/operator/helm/crds/valdrelease.yaml (94 hunks)
  • versions/CMAKE_VERSION (1 hunks)
  • versions/FAISS_VERSION (1 hunks)
  • versions/HELM_VERSION (1 hunks)
  • versions/K3S_VERSION (1 hunks)
  • versions/PROMETHEUS_STACK_VERSION (1 hunks)
  • versions/actions/ACTIONS_CACHE (1 hunks)
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • dockers/buildbase/Dockerfile
🚧 Files skipped from review as they are similar to previous changes (52)
  • .github/ISSUE_TEMPLATE/bug_report.md
  • .github/ISSUE_TEMPLATE/security_issue_report.md
  • .github/PULL_REQUEST_TEMPLATE.md
  • charts/vald/values.schema.json
  • dockers/agent/core/agent/Dockerfile
  • dockers/agent/core/faiss/Dockerfile
  • dockers/agent/core/ngt/Dockerfile
  • dockers/agent/sidecar/Dockerfile
  • dockers/binfmt/Dockerfile
  • dockers/buildkit/Dockerfile
  • dockers/buildkit/syft/scanner/Dockerfile
  • dockers/ci/base/Dockerfile
  • dockers/dev/Dockerfile
  • dockers/discoverer/k8s/Dockerfile
  • dockers/gateway/filter/Dockerfile
  • dockers/gateway/lb/Dockerfile
  • dockers/gateway/mirror/Dockerfile
  • dockers/index/job/correction/Dockerfile
  • dockers/index/job/creation/Dockerfile
  • dockers/index/job/readreplica/rotate/Dockerfile
  • dockers/index/job/save/Dockerfile
  • dockers/index/operator/Dockerfile
  • dockers/manager/index/Dockerfile
  • dockers/operator/helm/Dockerfile
  • dockers/tools/benchmark/job/Dockerfile
  • dockers/tools/benchmark/operator/Dockerfile
  • dockers/tools/cli/loadtest/Dockerfile
  • example/client/go.mod
  • go.mod
  • hack/go.mod.default
  • internal/net/grpc/health/health.go
  • internal/net/grpc/health/health_test.go
  • internal/servers/server/option_test.go
  • internal/servers/server/server.go
  • k8s/agent/ngt/configmap.yaml
  • k8s/discoverer/configmap.yaml
  • k8s/discoverer/deployment.yaml
  • k8s/gateway/gateway/lb/deployment.yaml
  • k8s/gateway/gateway/mirror/configmap.yaml
  • k8s/gateway/gateway/mirror/deployment.yaml
  • k8s/index/job/save/configmap.yaml
  • k8s/index/operator/configmap.yaml
  • k8s/index/operator/deployment.yaml
  • k8s/manager/index/configmap.yaml
  • k8s/manager/index/deployment.yaml
  • versions/CMAKE_VERSION
  • versions/FAISS_VERSION
  • versions/HELM_VERSION
  • versions/K3S_VERSION
  • versions/PROMETHEUS_STACK_VERSION
  • versions/actions/ACTIONS_CACHE
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT
🧰 Additional context used
📓 Learnings (1)
internal/config/grpc.go (1)
Learnt from: kpango
PR: vdaas/vald#2685
File: internal/config/grpc.go:244-244
Timestamp: 2024-10-09T05:40:03.660Z
Learning: `grpc.WithIdleTimeout` is a client-side `DialOption` in gRPC and can be used in client configurations.
🪛 GitHub Check: codecov/patch
internal/db/rdb/mysql/dbr/dbr.go

[warning] 62-65: internal/db/rdb/mysql/dbr/dbr.go#L62-L65
Added lines #L62 - L65 were not covered by tests


[warning] 67-67: internal/db/rdb/mysql/dbr/dbr.go#L67
Added line #L67 was not covered by tests

internal/db/rdb/mysql/dbr/session.go

[warning] 45-45: internal/db/rdb/mysql/dbr/session.go#L45
Added line #L45 was not covered by tests

internal/db/rdb/mysql/dbr/tx.go

[warning] 68-68: internal/db/rdb/mysql/dbr/tx.go#L68
Added line #L68 was not covered by tests

internal/net/grpc/client.go

[warning] 149-150: internal/net/grpc/client.go#L149-L150
Added lines #L149 - L150 were not covered by tests

internal/net/grpc/option.go

[warning] 246-246: internal/net/grpc/option.go#L246
Added line #L246 was not covered by tests


[warning] 248-251: internal/net/grpc/option.go#L248-L251
Added lines #L248 - L251 were not covered by tests


[warning] 256-256: internal/net/grpc/option.go#L256
Added line #L256 was not covered by tests


[warning] 258-259: internal/net/grpc/option.go#L258-L259
Added lines #L258 - L259 were not covered by tests


[warning] 261-261: internal/net/grpc/option.go#L261
Added line #L261 was not covered by tests


[warning] 268-269: internal/net/grpc/option.go#L268-L269
Added lines #L268 - L269 were not covered by tests


[warning] 271-271: internal/net/grpc/option.go#L271
Added line #L271 was not covered by tests


[warning] 279-280: internal/net/grpc/option.go#L279-L280
Added lines #L279 - L280 were not covered by tests


[warning] 282-282: internal/net/grpc/option.go#L282
Added line #L282 was not covered by tests


[warning] 287-291: internal/net/grpc/option.go#L287-L291
Added lines #L287 - L291 were not covered by tests


[warning] 293-293: internal/net/grpc/option.go#L293
Added line #L293 was not covered by tests


[warning] 298-301: internal/net/grpc/option.go#L298-L301
Added lines #L298 - L301 were not covered by tests


[warning] 303-303: internal/net/grpc/option.go#L303
Added line #L303 was not covered by tests


[warning] 362-367: internal/net/grpc/option.go#L362-L367
Added lines #L362 - L367 were not covered by tests


[warning] 375-376: internal/net/grpc/option.go#L375-L376
Added lines #L375 - L376 were not covered by tests


[warning] 388-389: internal/net/grpc/option.go#L388-L389
Added lines #L388 - L389 were not covered by tests


[warning] 398-398: internal/net/grpc/option.go#L398
Added line #L398 was not covered by tests


[warning] 401-402: internal/net/grpc/option.go#L401-L402
Added lines #L401 - L402 were not covered by tests


[warning] 405-405: internal/net/grpc/option.go#L405
Added line #L405 was not covered by tests


[warning] 411-411: internal/net/grpc/option.go#L411
Added line #L411 was not covered by tests


[warning] 414-415: internal/net/grpc/option.go#L414-L415
Added lines #L414 - L415 were not covered by tests


[warning] 418-418: internal/net/grpc/option.go#L418
Added line #L418 was not covered by tests


[warning] 427-428: internal/net/grpc/option.go#L427-L428
Added lines #L427 - L428 were not covered by tests


[warning] 440-441: internal/net/grpc/option.go#L440-L441
Added lines #L440 - L441 were not covered by tests


[warning] 457-457: internal/net/grpc/option.go#L457
Added line #L457 was not covered by tests

🔇 Additional comments (47)
internal/net/grpc/server.go (4)

116-119: LGTM: MaxConcurrentStreams function implementation

The MaxConcurrentStreams function is correctly implemented as a wrapper around grpc.MaxConcurrentStreams. The comment accurately describes its purpose, and the implementation is straightforward and correct.


121-125: Excellent implementation and documentation for NumStreamWorkers

The NumStreamWorkers function is well-implemented as a wrapper around grpc.NumStreamWorkers. The accompanying comment is particularly helpful, providing clear information about the function's purpose and the default behavior when set to zero. This level of detail in the documentation is commendable.


133-137: Excellent implementation and comprehensive documentation for WaitForHandlers

The WaitForHandlers function is well-implemented as a wrapper around grpc.WaitForHandlers. The accompanying comment is exemplary, providing a detailed explanation of the function's purpose, its effect on the Stop method, and the default behavior. This level of documentation greatly enhances the usability and understanding of the function.


115-178: Overall excellent additions to the gRPC server configuration

The new functions (MaxConcurrentStreams, NumStreamWorkers, SharedWriteBuffer, and WaitForHandlers) are well-implemented wrappers around their gRPC counterparts. The documentation for each function is clear and informative, providing valuable context for users.

The API references comment block is a standout feature, offering a comprehensive overview of available server options and their statuses. This addition significantly enhances the package's usability and maintainability.

The code changes demonstrate a strong commitment to good software engineering practices, particularly in terms of documentation and API design. The minor suggestions provided in the individual comments are aimed at further refining what is already high-quality work.

internal/config/grpc.go (5)

46-46: LGTM: New field ContentSubtype added to CallOption

The addition of the ContentSubtype field to the CallOption struct is a good improvement. This allows for more fine-grained control over the content type of gRPC messages, which can be useful in scenarios where specific content subtypes need to be specified.


155-155: LGTM: ContentSubtype field correctly bound in CallOption.Bind()

The Bind() method has been appropriately updated to include the new ContentSubtype field. The use of GetActualValue() ensures that any environment variables or placeholders in this field are properly resolved.


Line range hint 1-307: Overall assessment: Significant improvements with some refinements needed

The changes to this file substantially enhance the configurability of gRPC clients in the Vald project. The additions to CallOption and DialOption structs, along with the updates to Bind() and Opts() methods, provide a more comprehensive set of options for fine-tuning gRPC behavior.

Key points:

  1. The new configuration options align well with advanced gRPC features and best practices.
  2. The structure of the changes is generally consistent and well-organized.
  3. Some refinements are needed to ensure all new fields are properly bound and utilized.
  4. Additional documentation would be beneficial for understanding the purpose and impact of each new option.

These changes represent a significant step forward in gRPC configuration capabilities. With the suggested refinements, this update will provide developers with powerful tools to optimize gRPC performance and behavior in various scenarios.


46-46: ⚠️ Potential issue

Improve overall consistency in handling new configuration options

The additions to CallOption and DialOption structs significantly enhance the configurability of gRPC clients. However, there are some inconsistencies in how these new fields are handled across different methods.

  1. Ensure all new fields in DialOption are properly bound in the Bind() method.
  2. Update the Opts() method to utilize all new fields, providing appropriate gRPC options.
  3. Consider adding comments to explain the purpose and expected values for each new field, especially for less obvious options like BackoffJitter or SharedWriteBuffer.
  4. Review any fields that are added but not used (e.g., BackoffJitter, BackoffMultiplier) to determine if they should be implemented or removed.

To help identify unused fields, run:

#!/bin/bash
# Find struct fields that are not used in the Opts() method
rg --type go -o '`json:"([^"]+)"' internal/config/grpc.go | cut -d'"' -f2 | sort > /tmp/all_fields
rg --type go -o 'g\.DialOption\.(\w+)' internal/config/grpc.go | cut -d'.' -f3 | sort > /tmp/used_fields
echo "Unused fields:"
comm -23 /tmp/all_fields /tmp/used_fields

Also applies to: 51-73, 155-155, 161-168, 233-237, 243-257


233-237: ⚠️ Potential issue

Update Opts() method to utilize all new fields and check for deprecations

The Opts() method has been significantly enhanced to include many of the new gRPC options corresponding to the new fields in CallOption and DialOption. This provides a more comprehensive set of configuration options for gRPC clients.

  1. Some new fields are not being utilized in the Opts() method. Consider adding options for:

    • BackoffJitter
    • BackoffMultiplier
    • BackoffBaseDelay
  2. The grpc.WithMaxMsgSize() option (line 253) might be deprecated. Consider replacing it with separate options for send and receive message sizes:

    grpc.WithDefaultCallOptions(
        grpc.MaxCallRecvMsgSize(g.DialOption.MaxMsgSize),
        grpc.MaxCallSendMsgSize(g.DialOption.MaxMsgSize),
    )
  3. Ensure that all new options are properly documented in the gRPC package you're using, as some might be custom extensions.

To check for potential deprecated options, run:

Also applies to: 243-257

k8s/index/job/creation/configmap.yaml (1)

360-360: Review agent client options in creator.discoverer

The addition of content_subtype: "" in the call_option for agent client options is consistent with the earlier configuration for the discoverer client.

This change maintains consistency across different parts of the configuration. Ensure that using the default content subtype aligns with your agent communication requirements.

internal/config/server.go (3)

301-312: ⚠️ Potential issue

Update GRPC.Bind method to reflect struct changes

The GRPC.Bind method has been partially updated to handle new fields, but there are inconsistencies:

  1. Bindings for new fields like InitialConnWindowSize, InitialWindowSize, etc., have been correctly added.
  2. However, bindings for removed fields (ConnectionTimeout, Interceptors) are still present.

To maintain consistency and prevent potential errors:

  1. Remove the following lines:
    g.ConnectionTimeout = GetActualValue(g.ConnectionTimeout)
    for i, ic := range g.Interceptors {
        g.Interceptors[i] = GetActualValue(ic)
    }
  2. Add bindings for any remaining new fields that aren't currently bound.

This will ensure that the Bind method accurately reflects the current structure of the GRPC struct.

To verify the completeness of the Bind method, run the following script:

#!/bin/bash
# Extract GRPC struct fields and compare with Bind method
echo "GRPC struct fields:"
rg --type go '^\s*type GRPC struct {' -A 30 internal/config/server.go | grep -oP '^\s*\K\w+(?=\s+\w+)'
echo "Fields in Bind method:"
rg --type go '^\s*func \(g \*GRPC\) Bind\(\) \*GRPC {' -A 30 internal/config/server.go | grep -oP 'g\.\K\w+(?=\s*=)'

314-321: New gRPC server options and potential behavior change

  1. The EnableReflection option has been added, which allows for runtime reflection of gRPC services. This is useful for debugging and testing but should be used cautiously in production environments.

  2. The EnableChannelz option has been introduced and combined with the existing EnableAdmin condition. This change allows for more detailed monitoring of gRPC channels.

Please ensure that:

  1. The use of EnableReflection is properly documented and its security implications are understood.
  2. The combined condition EnableAdmin || EnableChannelz doesn't unintentionally enable the admin service when only channelz is required.

Consider adding comments explaining the purpose and implications of these new options.

To verify the impact of these changes, run the following script:

#!/bin/bash
# Search for usages of EnableReflection and EnableChannelz
echo "Searching for EnableReflection usage:"
rg --type go 'EnableReflection' -C 3
echo "Searching for EnableChannelz usage:"
rg --type go 'EnableChannelz' -C 3
echo "Searching for EnableAdmin usage:"
rg --type go 'EnableAdmin' -C 3

95-112: Significant changes to GRPC configuration structure

The GRPC struct has undergone substantial modifications:

  1. New fields added for finer control over GRPC server configuration (e.g., EnableChannelz, SharedWriteBuffer, WaitForHandlers).
  2. Removal of Keepalive, ConnectionTimeout, and Interceptors fields.

These changes provide more granular control but may impact existing configurations. Ensure that:

  1. The removal of Keepalive doesn't negatively affect connection management.
  2. The absence of ConnectionTimeout is handled appropriately in the server implementation.
  3. The removal of Interceptors doesn't break any existing middleware or request processing logic.

Consider adding migration guidelines or deprecation notices for removed fields to assist users in updating their configurations.

To verify the impact of these changes, run the following script:

k8s/index/job/correction/configmap.yaml (2)

363-363: Verify consistency and appropriateness of gRPC client options for the discoverer

The gRPC client options in the discoverer section mirror those in the gateway section, which is good for consistency. However, please ensure that these settings are appropriate for the discoverer's specific use case:

  1. Verify that the timeout values (e.g., idle_timeout: 1h on line 376) are suitable for discoverer operations.

  2. Confirm that the retry settings (disable_retry: false on line 374) align with the expected behavior for discoverer clients.

  3. Check if the max_call_attempts: 0 and max_header_list_size: 0 (lines 385-386) default values are appropriate for discoverer operations.

  4. Ensure that shared_write_buffer: false (line 415) is the correct setting for discoverer clients.

  5. Verify if the user agent string Vald-gRPC (line 417) should be more specific for the discoverer component.

Consider adding comments explaining any differences in configuration between the gateway and discoverer sections, if they exist.

Also applies to: 369-376, 385-386, 415-415, 417-417


Line range hint 1-502: Overall improvement in gRPC configuration, with room for enhanced documentation and consistency

The changes to this ConfigMap significantly enhance the gRPC configuration options for the vald-index-correction component. The additions provide more fine-grained control over both server and client behaviors, which is commendable. However, there are a few areas for improvement:

  1. Documentation: Many new options would benefit from inline comments explaining their purpose, default values, and when they might need adjustment.

  2. Consistency: The agent_client_options section structure differs from the gateway and discoverer sections. Consider aligning these for better maintainability.

  3. Verification: Ensure that the values set for each option, especially timeouts and limits, are appropriate for each specific component (gateway, discoverer, agent).

  4. User Agent: Consider making the user agent string more specific or include version information.

By addressing these points, you'll greatly improve the long-term maintainability and usability of this configuration. Great work on expanding the configuration capabilities!

internal/net/grpc/option.go (4)

457-466: Improved error logging in WithKeepaliveParams

The enhancements to error logging in the WithKeepaliveParams function are beneficial. Adding more context to the error messages, such as including the input values that caused the parsing failure, will make debugging easier in case of issues.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 457-457: internal/net/grpc/option.go#L457
Added line #L457 was not covered by tests


Line range hint 246-618: Improve test coverage for new and modified functions

The static analysis hints indicate that many of the new and modified lines in this file are not covered by tests. To ensure the reliability and maintainability of the code, it's important to have comprehensive test coverage, especially for new functionality.

Consider adding unit tests for the following functions:

  • WithCallOptions
  • WithCallContentSubtype
  • WithMaxRetryRPCBufferSize
  • WithWaitForReady
  • WithDialOptions
  • WithAuthority
  • WithDisableRetry
  • WithIdleTimeout
  • WithMaxCallAttempts
  • WithMaxHeaderListSize
  • WithSharedWriteBuffer
  • WithUserAgent

Ensure that these tests cover different scenarios, including edge cases and error conditions.

Would you like assistance in generating test cases for these functions?

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 246-246: internal/net/grpc/option.go#L246
Added line #L246 was not covered by tests


[warning] 248-251: internal/net/grpc/option.go#L248-L251
Added lines #L248 - L251 were not covered by tests


[warning] 256-256: internal/net/grpc/option.go#L256
Added line #L256 was not covered by tests


[warning] 258-259: internal/net/grpc/option.go#L258-L259
Added lines #L258 - L259 were not covered by tests


[warning] 261-261: internal/net/grpc/option.go#L261
Added line #L261 was not covered by tests


[warning] 268-269: internal/net/grpc/option.go#L268-L269
Added lines #L268 - L269 were not covered by tests


[warning] 271-271: internal/net/grpc/option.go#L271
Added line #L271 was not covered by tests


[warning] 279-280: internal/net/grpc/option.go#L279-L280
Added lines #L279 - L280 were not covered by tests


[warning] 282-282: internal/net/grpc/option.go#L282
Added line #L282 was not covered by tests


[warning] 287-291: internal/net/grpc/option.go#L287-L291
Added lines #L287 - L291 were not covered by tests


[warning] 293-293: internal/net/grpc/option.go#L293
Added line #L293 was not covered by tests


[warning] 298-301: internal/net/grpc/option.go#L298-L301
Added lines #L298 - L301 were not covered by tests


[warning] 303-303: internal/net/grpc/option.go#L303
Added line #L303 was not covered by tests


[warning] 362-367: internal/net/grpc/option.go#L362-L367
Added lines #L362 - L367 were not covered by tests


[warning] 375-376: internal/net/grpc/option.go#L375-L376
Added lines #L375 - L376 were not covered by tests


246-252: 🛠️ Refactor suggestion

Consider using append for consistent behavior

The current implementation directly assigns opts to g.copts when it's empty. This could lead to unexpected behavior if opts is modified elsewhere, as it would affect the internal state of the gRPCClient. Consider using append in both cases for consistency:

func WithCallOptions(opts ...grpc.CallOption) Option {
	return func(g *gRPCClient) {
-		if g.copts != nil && len(g.copts) > 0 {
-			g.copts = append(g.copts, opts...)
-		} else {
-			g.copts = opts
-		}
+		g.copts = append(g.copts, opts...)
	}
}

This ensures that a new slice is always created, preventing potential side effects.

Likely invalid or redundant comment.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 246-246: internal/net/grpc/option.go#L246
Added line #L246 was not covered by tests


[warning] 248-251: internal/net/grpc/option.go#L248-L251
Added lines #L248 - L251 were not covered by tests


594-605: 🛠️ Refactor suggestion

Consider allowing explicit disabling of SharedWriteBuffer

The current implementation of WithSharedWriteBuffer only applies the option when enable is true. However, it might be useful to explicitly set the option to false as well. Consider modifying the function:

func WithSharedWriteBuffer(enable bool) Option {
	return func(g *gRPCClient) {
-		if enable {
			if g.dopts == nil {
				g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
			}
			g.dopts = append(g.dopts,
				grpc.WithSharedWriteBuffer(enable),
			)
-		}
	}
}

This change allows for explicitly enabling or disabling the shared write buffer, providing more control over the gRPC configuration.

Likely invalid or redundant comment.

internal/net/grpc/pool/pool.go (2)

601-603: LGTM: Simplified Get method

The changes to the Get method improve code reuse by leveraging the getHealthyConn method. This promotes consistency and reduces duplication in the codebase.


135-137: Improved error handling and logging

The various changes throughout the file enhance error handling and logging. These improvements contribute to better robustness and easier debugging of the connection pool. Some notable enhancements include:

  1. More thorough error handling when closing connections (e.g., lines 135-137, 150-153, 476-479, 486-491).
  2. Additional logging for connection closure and errors (e.g., lines 582-584, 689-691).

These changes are beneficial for maintaining and troubleshooting the connection pool.

Also applies to: 150-153, 476-479, 486-491, 582-584, 689-691

internal/config/grpc_test.go (2)

507-508: Approve type changes for improved compatibility

The change from int to int32 for InitialWindowSize and InitialConnectionWindowSize is a good improvement. This aligns the types with the gRPC API, which uses int32 for these fields. Using the correct types helps prevent potential issues with type conversions and improves code clarity.


542-543: Approve test case updates for consistency

The test case has been correctly updated to use int32(100) for InitialWindowSize and InitialConnectionWindowSize. This change maintains consistency with the type changes in the DialOption struct and ensures that the test case accurately reflects the expected types for these fields.

Makefile (1)

397-398: Correct addition of perm to .PHONY targets

The perm target has been correctly added to the list of .PHONY targets. This is important because:

  1. It indicates that perm is not a file target.
  2. It ensures that the target will always run, even if a file named perm exists.

This addition is in line with Makefile best practices.

internal/net/grpc/client.go (2)

Line range hint 180-191: Great improvement in error handling and logging!

The enhanced error handling in the StartConnectionMonitor method is a significant improvement. It provides more granular control over how different types of errors are handled and logged, which will greatly aid in debugging and monitoring the connection status.

The use of log.Warn for non-critical errors is particularly appropriate, as it allows for awareness of potential issues without raising unnecessary alarms.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 149-150: internal/net/grpc/client.go#L149-L150
Added lines #L149 - L150 were not covered by tests


Line range hint 1004-1005: Excellent enhancement of logging and error handling in the Connect method!

The addition of detailed logging statements when creating new connection pools and establishing connections significantly improves the observability of the connection process. This will be invaluable for debugging and monitoring in production environments.

The use of log.Warnf for these scenarios is appropriate, as it alerts administrators to potential issues without causing unnecessary panic. Great job on improving the overall robustness of the connection handling!

Also applies to: 1015-1016

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 149-150: internal/net/grpc/client.go#L149-L150
Added lines #L149 - L150 were not covered by tests

charts/vald/values.yaml (5)

241-256: Improved gRPC server configuration options

The new fields added to the gRPC server configuration provide more fine-grained control over server behavior and resource management:

  1. max_concurrent_streams: Allows limiting the number of concurrent streams per connection.
  2. num_stream_workers: Controls the number of workers handling streams.
  3. shared_write_buffer: Enables write buffer sharing for potentially improved performance.
  4. wait_for_handlers: Determines whether to wait for handlers when stopping the server.

These additions enhance the flexibility and performance tuning capabilities of the gRPC server.


756-758: Enhanced gRPC client configuration options

The gRPC client configuration has been expanded with several new options that provide greater control and flexibility:

  1. content_subtype: Allows specifying the content subtype for gRPC calls.
  2. max_header_list_size: Controls the maximum size of the header list.
  3. max_call_attempts: Sets the maximum number of call attempts.
  4. disable_retry: Option to disable retry logic.
  5. shared_write_buffer: Enables write buffer sharing for potential performance improvements.
  6. authority: Allows setting the :authority pseudo-header.
  7. idle_timeout: Specifies the idle timeout for connections.
  8. user_agent: Sets the user agent string for the client.

These additions provide more granular control over the gRPC client's behavior, potentially improving performance and reliability in various network conditions.

Also applies to: 776-781, 800-817


Line range hint 2095-2115: Improved agent configuration with persistent storage and pod management

The agent configuration has been enhanced with two significant additions:

  1. Persistent Volume Support:

    • A new persistentVolume section allows configuring persistent storage for agents.
    • This is particularly useful for maintaining state across restarts or for agents that need to store large amounts of data.
    • The configuration includes options for access mode, mount propagation, storage class, and size.
  2. Pod Management Policy:

    • The new podManagementPolicy field allows control over how pods are created and terminated.
    • This can be set to either "OrderedReady" or "Parallel", providing flexibility in deployment strategies.

These additions significantly improve the deployment options and data persistence capabilities of the agent component.

Also applies to: 2119-2121


Line range hint 3818-4817: Comprehensive enhancements to index management

The index manager configuration has been significantly expanded with several new components:

  1. Corrector:

    • Introduces an index correction job to maintain index integrity.
    • Configurable as a CronJob with customizable schedule and resources.
  2. Creator:

    • Adds an index creation job for generating new indexes.
    • Also configurable as a CronJob with various options for scheduling and resource allocation.
  3. Saver:

    • Implements an index save job for persisting index data.
    • Configurable as a CronJob with options similar to the corrector and creator.
  4. Read Replica Rotator:

    • Introduces a mechanism for managing read replicas of indexes.
    • Includes configuration for a rotation job to update and maintain read replicas.

These additions provide a more robust and flexible index management system, allowing for automated maintenance, creation, and optimization of indexes. The use of CronJobs for these tasks enables scheduled, hands-off management of critical index operations.


Line range hint 4818-5022: Introduction of Kubernetes-native index management with Index Operator

A significant addition to the index management capabilities is the new Index Operator:

  1. Kubernetes-native approach:

    • The operator pattern allows for more declarative and automated management of Vald indexes within Kubernetes.
  2. Comprehensive configuration:

    • Detailed options for deployment, including replicas, security contexts, and resource allocation.
    • Supports both Deployment and DaemonSet kinds for flexible deployment strategies.
  3. Observability and monitoring:

    • Includes configuration for health checks, metrics, and observability integrations.
  4. Scalability and resilience:

    • Configurable rolling updates and topology spread constraints for improved availability.
  5. Rotation job management:

    • Includes a rotation_job_concurrency setting to manage concurrent rotator job executions.

This addition represents a significant step towards more automated, scalable, and resilient index management in Vald. It aligns with Kubernetes best practices and should simplify operations in complex, dynamic environments.

Note: The comment in the code indicates this feature is a work in progress (WIP).

charts/vald-helm-operator/crds/valdrelease.yaml (3)

938-939: New gRPC server configuration option added

The enable_channelz option has been added to the gRPC server configuration. This can be useful for debugging and performance analysis of gRPC services.

Consider documenting the implications and recommended usage of this new option in the project documentation.


974-975: Additional gRPC server configuration options introduced

New options added to the gRPC server configuration:

  • max_concurrent_streams: Controls the maximum number of concurrent streams per gRPC connection.
  • num_stream_workers: Specifies the number of workers handling streams.
  • shared_write_buffer: Enables shared write buffer usage.
  • wait_for_handlers: Determines whether to wait for handlers before serving.

These options provide more fine-grained control over gRPC server behavior and resource utilization.

Ensure that these new options are properly documented, including their default values and potential performance implications.

Also applies to: 982-983, 986-989


2227-2228: New gRPC client configuration options added

Several new options have been introduced for gRPC client configuration:

  • content_subtype: Specifies the content subtype for gRPC communication.
  • authority: Sets the :authority pseudo-header.
  • disable_retry: Option to disable retry logic.
  • idle_timeout: Sets the idle timeout for connections.
  • max_call_attempts: Specifies the maximum number of call attempts.
  • max_header_list_size: Controls the maximum size of the header list.
  • shared_write_buffer: Enables shared write buffer usage.
  • user_agent: Sets the user agent string for the client.

These additions provide more control over gRPC client behavior and performance tuning.

Ensure that these new options are well-documented, including their default values and use cases. Consider providing guidelines for optimal configuration in different scenarios.

Also applies to: 2232-2233, 2242-2243, 2246-2247, 2269-2272, 2334-2335, 2338-2339

k8s/operator/helm/crds/valdrelease.yaml (4)

938-939: Approve: Enhanced gRPC server configuration options

The addition of new gRPC server configuration properties (enable_channelz, max_concurrent_streams, num_stream_workers, shared_write_buffer, and wait_for_handlers) significantly improves the flexibility and performance tuning capabilities of the Vald system. These properties allow for better control over server behavior, resource utilization, and debugging capabilities.

Key benefits:

  1. enable_channelz: Allows for better debugging and monitoring of gRPC channels.
  2. max_concurrent_streams: Provides control over the number of concurrent streams per connection.
  3. num_stream_workers: Enables fine-tuning of worker threads for stream processing.
  4. shared_write_buffer: Optimizes memory usage by allowing buffer sharing.
  5. wait_for_handlers: Improves server startup behavior by waiting for handlers to be ready.

These additions are consistently applied across various components, ensuring uniform configuration capabilities throughout the system.

Also applies to: 974-975, 982-983, 986-989


2227-2228: Approve: Enhanced gRPC client configuration options

The addition of new gRPC client configuration properties (content_subtype, authority, disable_retry, idle_timeout, max_call_attempts, max_header_list_size, shared_write_buffer, and user_agent) significantly improves the flexibility and control over client behavior in the Vald system. These properties allow for better management of client-server interactions, error handling, and performance optimization.

Key benefits:

  1. content_subtype: Allows specification of content subtype for better content negotiation.
  2. authority: Provides control over the :authority pseudo-header in requests.
  3. disable_retry: Offers the option to disable automatic retry logic.
  4. idle_timeout: Enables management of idle connection timeouts.
  5. max_call_attempts: Allows limiting the number of retry attempts for failed calls.
  6. max_header_list_size: Provides control over the maximum size of the header list.
  7. shared_write_buffer: Optimizes memory usage by allowing buffer sharing on the client side.
  8. user_agent: Allows customization of the User-Agent header for client requests.

These additions are consistently applied across various client configurations, ensuring uniform capabilities throughout the system.

Also applies to: 2232-2233, 2242-2243, 2246-2247, 2269-2272, 2334-2335, 2338-2339


Line range hint 938-989: Approve: Consistent application of new properties across components

The new gRPC server and client configuration properties have been consistently added across various components of the Vald system, including gateway, manager, discoverer, and others. This consistent approach to property additions is commendable for several reasons:

  1. Uniformity: It ensures that all components have access to the same configuration options, providing a uniform interface for system administrators.
  2. Maintainability: The consistent structure and naming conventions make the configuration easier to understand and maintain across the entire system.
  3. Reduced Error Potential: By maintaining consistency, the likelihood of configuration errors due to component-specific variations is significantly reduced.
  4. Scalability: As the system grows or new components are added, the consistent structure allows for easier integration of these new elements into the existing configuration schema.

This approach to property additions demonstrates a well-thought-out and systematic enhancement of the Vald configuration capabilities.

Also applies to: 2227-2339, 4409-4521, 5715-5827, 6099-6211, 6767-6879, 7210-7322, 8376-8488, 8767-8879, 9679-9791, 10820-10932, 11011-11123, 12636-12687, 13766-13817


Line range hint 1-14437: Approve: Comprehensive and well-structured Custom Resource Definition

The ValdRelease Custom Resource Definition (CRD) is exceptionally well-crafted, providing a comprehensive and flexible configuration schema for the Vald system. Key strengths of this CRD include:

  1. Extensiveness: The CRD covers a wide range of configuration options, allowing for fine-grained control over various aspects of the Vald system, including gRPC servers and clients, health checks, metrics, and component-specific settings.

  2. Clear Structure: The schema is well-organized with logical hierarchies, making it easier for users to navigate and understand the configuration options available.

  3. Data Type Specification: Each property in the CRD has a clearly defined data type, reducing the potential for type-related configuration errors.

  4. Validation Rules: Where appropriate, the CRD includes validation rules such as minimum and maximum values, enum constraints, and regex patterns. This proactive validation helps prevent misconfigurations.

  5. Consistency: The structure and naming conventions are consistent throughout the CRD, which enhances readability and maintainability.

  6. Flexibility: The CRD allows for detailed configuration of individual components while also providing system-wide defaults, offering both granularity and convenience.

  7. Future-Proofing: The structure of the CRD appears to allow for easy extension in the future, should new configuration options be needed.

This well-designed CRD will significantly contribute to the ease of deployment, configuration, and management of Vald releases in Kubernetes environments.

internal/servers/server/option.go (6)

611-614: Duplicate Comment: Review 'size' parameter handling in WithGRPCMaxHeaderListSize

The previous review comment regarding the handling of zero values for the size parameter is still valid and applicable to this code segment.


620-624: Duplicate Comment: Evaluate the necessity of the condition in WithGRPCHeaderTableSize

The earlier review comment about the conditional check on size remains relevant for this function.


629-633: Duplicate Comment: Confirm zero value handling in WithGRPCMaxConcurrentStreams

The prior review comment concerning the handling of zero values for size is still applicable here.


638-642: Duplicate Comment: Assess size parameter in WithGRPCNumStreamWorkers

The previous feedback about the conditional check on size continues to be pertinent to this code segment.


647-651: Duplicate Comment: Ensure SharedWriteBuffer option is always set

The earlier review comment regarding the consistent setting of the SharedWriteBuffer option is still valid for this function.


656-659: Duplicate Comment: Ensure WaitForHandlers option is always set

The prior feedback about always appending the WaitForHandlers option remains applicable to this code segment.

internal/config/server_test.go (3)

682-683: Confirm Test Variable Types Match Updated Field Types

In the test cases, maxHeaderListSize and headerTableSize are now initialized using uint32(), matching the updated field types. Ensure that all related test assertions and usages reflect this type change, and consider adding test cases for boundary values to enhance test coverage.

Also applies to: 744-745


1372-1372: Duplicate Comment: Avoid Hardcoding Magic Numbers in Test Expectations

The previous review comment regarding hardcoding the expected number of server options is still applicable. Avoid using fixed counts like 31 in tests, as they can make tests fragile when configuration changes occur.

Also applies to: 1427-1427


643-644: Ensure Type Consistency After Changing Field Types to uint32

The fields MaxHeaderListSize and HeaderTableSize have been changed from int to uint32. Please verify that all usages of these fields across the codebase have been updated accordingly to prevent potential type mismatches or compilation errors.

To assist with verification, you can run the following script:

✅ Verification successful

Type Consistency Verified for MaxHeaderListSize and HeaderTableSize

All declarations and usages of MaxHeaderListSize and HeaderTableSize have been successfully updated to uint32. No type mismatches or compilation errors are detected.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all usages of MaxHeaderListSize and HeaderTableSize are updated to uint32.

# Expected: All declarations and usages should reflect the new uint32 type.

# Search for all occurrences of MaxHeaderListSize
rg --type go 'MaxHeaderListSize'

# Search for all occurrences of HeaderTableSize
rg --type go 'HeaderTableSize'

Length of output: 6048


Script:

#!/bin/bash
# Description: Verify that MaxHeaderListSize and HeaderTableSize are declared with type uint32.

# Search for declarations of MaxHeaderListSize with type uint32
rg --type go 'MaxHeaderListSize\s+uint32'

# Search for declarations of HeaderTableSize with type uint32
rg --type go 'HeaderTableSize\s+uint32'

Length of output: 986


Script:

#!/bin/bash
# Description: Check for any assignments or usages of MaxHeaderListSize and HeaderTableSize that do not use uint32.

# Search for assignments to MaxHeaderListSize with types other than uint32
rg --type go 'MaxHeaderListSize\s*:\s*[^u]*int'

# Search for assignments to HeaderTableSize with types other than uint32
rg --type go 'HeaderTableSize\s*:\s*[^u]*int'

# Search for function arguments where these fields are used with incorrect types
rg --type go 'MaxHeaderListSize\s*\(.*\)'
rg --type go 'HeaderTableSize\s*\(.*\)'

Length of output: 2909

Comment on lines +62 to +68
func prepareSelect[T any](a ...T) (b []any) {
b = make([]any, len(a))
for i := range a {
b[i] = a[i]
}
return b
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

⚠️ Potential issue

Confirm Unused Function and Missing Test Coverage

The prepareSelect function in internal/db/rdb/mysql/dbr/dbr.go is confirmed to be unused within the codebase and lacks unit tests.

  • No usage of prepareSelect found outside its definition.
  • No unit tests cover the prepareSelect function.
🔗 Analysis chain

Add documentation and consider renaming the function

The prepareSelect function lacks documentation explaining its purpose and usage. Additionally, the function name might be misleading as it doesn't actually prepare a SELECT statement.

  1. Please add a comment explaining the function's purpose, parameters, and return value.
  2. Consider renaming the function to better reflect its actual functionality, e.g., convertToAnySlice.

Here's a suggested implementation with improved documentation:

// convertToAnySlice converts a slice of any type T to a slice of empty interfaces ([]any).
// This can be useful when preparing data for SQL queries that expect []any.
//
// Parameters:
//   - a: A variadic parameter of any type T
//
// Returns:
//   - A slice of empty interfaces ([]any) containing the same elements as the input
func convertToAnySlice[T any](a ...T) []any {
	b := make([]any, len(a))
	for i, v := range a {
		b[i] = v
	}
	return b
}

To check the usage of this function in the codebase, run the following script:

The function is not covered by tests. Please add unit tests to ensure its correctness and maintainability. Would you like assistance in writing unit tests for this function?

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for usage of prepareSelect function

# Search for function usage
echo "Searching for prepareSelect function usage:"
rg --type go "prepareSelect\[" .

# Search for function definition
echo "Searching for prepareSelect function definition:"
rg --type go "func prepareSelect\[" .

Length of output: 440


Script:

#!/bin/bash
# Description: Check for tests of prepareSelect function

# Search for test functions that might be testing prepareSelect
echo "Searching for test functions related to prepareSelect:"
rg --type go "func Test.*PrepareSelect" .

# Search for usages of prepareSelect within test files
echo "Searching for prepareSelect usage within test files:"
rg --type go "prepareSelect" --glob "*_test.go"

Length of output: 325

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 62-65: internal/db/rdb/mysql/dbr/dbr.go#L62-L65
Added lines #L62 - L65 were not covered by tests


[warning] 67-67: internal/db/rdb/mysql/dbr/dbr.go#L67
Added line #L67 was not covered by tests

@@ -42,7 +42,7 @@
// Select creates and returns the SelectStmt.
func (sess *session) Select(column ...string) SelectStmt {
return &selectStmt{
sess.Session.Select(column...),
sess.Session.Select(prepareSelect(column...)...),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

⚠️ Potential issue

Add comprehensive tests for prepareSelect usage in Select method.

The prepareSelect function is currently used in the Select method within internal/db/rdb/mysql/dbr/session.go and internal/db/rdb/mysql/dbr/tx.go. However, there is no existing test coverage for these changes. It's crucial to implement tests that cover various scenarios, including:

  • Selecting single and multiple columns.
  • Handling empty input.
  • Managing edge cases with special characters or invalid input.

Ensuring comprehensive test coverage will help prevent potential issues and maintain the reliability of the Select method.

🔗 Analysis chain

Verify the impact of prepareSelect and add test coverage.

The addition of prepareSelect to process the input columns is a significant change that could alter the behavior of the Select method. While the change itself looks straightforward, there are a few important points to consider:

  1. The prepareSelect function is not defined in this file. Could you provide more information about its purpose and implementation?

  2. This change lacks test coverage, as indicated by both the static analysis tool and the previous review comment. It's crucial to add tests that cover various scenarios, including:

    • Selecting a single column
    • Selecting multiple columns
    • Selecting with empty input
    • Selecting with potential edge cases (e.g., columns with special characters)
  3. Have you verified that this change doesn't introduce any unexpected behavior in existing code that uses the Select method?

To help assess the impact of this change, let's search for other usages of the Select method and the prepareSelect function:

Based on the results of this search, we can better understand the potential impact of this change and identify areas that may need additional testing or updates.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usages of the Select method and prepareSelect function
echo "Select method usages:"
rg --type go 'Select\(' -A 3
echo "\nprepareSelect function definition and usages:"
rg --type go 'func prepareSelect' -A 10
rg --type go 'prepareSelect\('

Length of output: 7450

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 45-45: internal/db/rdb/mysql/dbr/session.go#L45
Added line #L45 was not covered by tests

@@ -65,7 +65,7 @@
// Select creates a SelectStmt.
func (t *tx) Select(column ...string) SelectStmt {
return &selectStmt{
t.Tx.Select(column...),
t.Tx.Select(prepareSelect(column...)...),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Action Required: Add Test Coverage for prepareSelect

The new invocation of prepareSelect in the Select method is not currently covered by tests. To ensure this change functions as intended and maintains code reliability:

  1. Add Unit Tests:

    • Create test cases that specifically target the prepareSelect function within the Select method.
    • Ensure scenarios cover various inputs and edge cases for prepareSelect.
  2. Verify Existing Tests:

    • Review current test cases using the Select method to confirm whether they implicitly cover prepareSelect.
    • Update existing tests if necessary to include assertions related to prepareSelect behavior.
  3. Run Comprehensive Test Suite:

    • After adding the new tests, execute the entire test suite to ensure no regressions are introduced.

[tag: ]

🔗 Analysis chain

Approved with suggestions for improvement

The modification to the Select method looks good, as it introduces additional processing of the column arguments through the prepareSelect function. This change likely enhances the flexibility or safety of column selections in database queries.

However, I have a few points to address:

  1. Could you provide more information about the prepareSelect function? It's not defined in this file, so it would be helpful to understand its purpose and implementation.

  2. The static analysis tool indicates that this new line is not covered by tests. To ensure the reliability of this change, please add test coverage for this modified Select method.

  3. It's important to verify that this change doesn't negatively impact existing queries. Can you confirm that you've tested this modification with various query scenarios?

To help verify the impact of this change, you can run the following script to find all usages of the Select method within the project:

This will help identify any potential areas that might be affected by the change.

Would you like assistance in generating test cases for this modified Select method?

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find all usages of the Select method in the project

# Search for Select method calls
echo "Searching for Select method calls:"
rg --type go 'Select\(' -A 3

Length of output: 6780

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 68-68: internal/db/rdb/mysql/dbr/tx.go#L68
Added line #L68 was not covered by tests

Comment on lines +161 to +168
d.Authority = GetActualValue(d.Authority)
d.BackoffBaseDelay = GetActualValue(d.BackoffBaseDelay)
d.BackoffMaxDelay = GetActualValue(d.BackoffMaxDelay)
d.Timeout = GetActualValue(d.Timeout)
d.IdleTimeout = GetActualValue(d.IdleTimeout)
d.Interceptors = GetActualValues(d.Interceptors)
d.MinimumConnectionTimeout = GetActualValue(d.MinimumConnectionTimeout)
d.Timeout = GetActualValue(d.Timeout)
d.UserAgent = GetActualValue(d.UserAgent)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Update DialOption.Bind() to include all new fields

The Bind() method has been updated to include several new fields, which is good. However, not all new fields added to the DialOption struct are being bound in this method.

Please update the Bind() method to include bindings for all new fields, such as:

  • BackoffJitter
  • BackoffMultiplier
  • InitialConnectionWindowSize
  • InitialWindowSize
  • MaxHeaderListSize
  • MaxCallAttempts
  • MaxMsgSize
  • ReadBufferSize
  • WriteBufferSize

For numeric fields, you may not need to use GetActualValue(), but for consistency and future-proofing, consider applying it to all fields.

@@ -42,6 +42,7 @@ data:
bidirectional_stream_concurrency: 20
connection_timeout: ""
enable_admin: true
enable_channelz: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Review gRPC server configuration parameters

The new gRPC server configuration parameters introduce both benefits and potential concerns:

  1. enable_channelz: true (line 45): This enables the gRPC channelz service, which is useful for debugging but may have performance implications in production environments.

  2. max_concurrent_streams: 0 (line 60): Setting this to 0 means no limit on concurrent streams. While this provides maximum flexibility, it could lead to resource exhaustion under high load.

  3. num_stream_workers: 0 (line 64): This likely uses the default value, which might not be optimal for all scenarios.

  4. shared_write_buffer: false (line 66): This is generally safer but might impact performance in high-concurrency scenarios.

  5. wait_for_handlers: true (line 67): This ensures all handlers are ready before serving, which is a good practice for system stability.

Consider the following actions:

  1. Document the rationale for enabling channelz in production, if intended.
  2. Set a reasonable limit for max_concurrent_streams based on load testing results.
  3. Explicitly configure num_stream_workers based on performance requirements.
  4. Monitor system performance with these new settings and adjust as necessary.

Also applies to: 60-60, 64-64, 66-67

Comment on lines +217 to +243
/*
API References https://pkg.go.dev/google.golang.org/grpc#CallOption

1. Already Implemented APIs
- func CallContentSubtype(contentSubtype string) CallOption
- func MaxCallRecvMsgSize(bytes int) CallOption
- func MaxCallSendMsgSize(bytes int) CallOption
- func MaxRetryRPCBufferSize(bytes int) CallOption
- func WaitForReady(waitForReady bool) CallOption

2. Unnecessary for this package APIs
- func Header(md *metadata.MD) CallOption
- func Peer(p *peer.Peer) CallOption
- func PerRPCCredentials(creds credentials.PerRPCCredentials) CallOption
- func StaticMethod() CallOption
- func Trailer(md *metadata.MD) CallOption

3. Experimental APIs
- func ForceCodec(codec encoding.Codec) CallOption
- func ForceCodecV2(codec encoding.CodecV2) CallOption
- func OnFinish(onFinish func(err error)) CallOption
- func UseCompressor(name string) CallOption

4. Deprecated APIs
- func CallCustomCodec(codec Codec) CallOption
- func FailFast(failFast bool) CallOption
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider moving API references to external documentation

While the added API reference comments are informative, they significantly increase the file size and may clutter the code. Consider moving these references to external documentation (e.g., a separate markdown file or developer guide) and leaving a brief comment with a link to the full documentation. This approach would improve code readability while still providing access to the detailed information.

Comment on lines +398 to +405
func WithInitialWindowSize(size int32) Option {
return func(g *gRPCClient) {
if size > 1 {
if g.dopts == nil && cap(g.dopts) == 0 {
g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}
g.dopts = append(g.dopts,
grpc.WithInitialWindowSize(int32(size)),
grpc.WithInitialWindowSize(size),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Include valid minimum values for window sizes

In both WithInitialWindowSize and WithInitialConnectionWindowSize, the condition if size > 1 skips valid values like 1. The gRPC documentation states that window sizes should be greater than zero.

Consider updating the conditions to:

func WithInitialWindowSize(size int32) Option {
	return func(g *gRPCClient) {
-		if size > 1 {
+		if size >= 1 {
			// existing code
		}
	}
}

func WithInitialConnectionWindowSize(size int32) Option {
	return func(g *gRPCClient) {
-		if size > 1 {
+		if size >= 1 {
			// existing code
		}
	}
}

This will allow all valid window size values to be set.

Also applies to: 411-418

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 398-398: internal/net/grpc/option.go#L398
Added line #L398 was not covered by tests


[warning] 401-402: internal/net/grpc/option.go#L401-L402
Added lines #L401 - L402 were not covered by tests


[warning] 405-405: internal/net/grpc/option.go#L405
Added line #L405 was not covered by tests

Comment on lines +568 to +579
func WithMaxCallAttempts(n int) Option {
return func(g *gRPCClient) {
if n > 2 {
if g.dopts == nil && cap(g.dopts) == 0 {
g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}
g.dopts = append(g.dopts,
grpc.WithMaxCallAttempts(n),
)
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider adjusting the MaxCallAttempts check

The implementation of WithMaxCallAttempts is generally correct, but the condition if n > 2 might be too restrictive. According to gRPC documentation, the maximum number of attempts should be greater than or equal to 1. Consider modifying the check:

func WithMaxCallAttempts(n int) Option {
	return func(g *gRPCClient) {
-		if n > 2 {
+		if n >= 1 {
			if g.dopts == nil {
				g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
			}
			g.dopts = append(g.dopts,
				grpc.WithMaxCallAttempts(n),
			)
		}
	}
}

This change allows for any valid number of maximum call attempts, aligning with gRPC's expectations.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func WithMaxCallAttempts(n int) Option {
return func(g *gRPCClient) {
if n > 2 {
if g.dopts == nil && cap(g.dopts) == 0 {
g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}
g.dopts = append(g.dopts,
grpc.WithMaxCallAttempts(n),
)
}
}
}
func WithMaxCallAttempts(n int) Option {
return func(g *gRPCClient) {
if n >= 1 {
if g.dopts == nil && cap(g.dopts) == 0 {
g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}
g.dopts = append(g.dopts,
grpc.WithMaxCallAttempts(n),
)
}
}
}

Comment on lines +256 to +261
func WithCallContentSubtype(contentSubtype string) Option {
return func(g *gRPCClient) {
if size > 1 {
g.copts = append(g.copts,
grpc.MaxRetryRPCBufferSize(size),
)
if g.copts == nil && cap(g.copts) == 0 {
g.copts = make([]grpc.CallOption, 0, defaultCallOptionLength)
}
g.copts = append(g.copts, grpc.CallContentSubtype(contentSubtype))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Simplify the condition when initializing g.copts

The condition if g.copts == nil && cap(g.copts) == 0 can be simplified to if g.copts == nil. Since a nil slice has a capacity of zero, the additional check is redundant.

Refactoring the condition improves code readability:

func WithCallContentSubtype(contentSubtype string) Option {
	return func(g *gRPCClient) {
-		if g.copts == nil && cap(g.copts) == 0 {
+		if g.copts == nil {
			g.copts = make([]grpc.CallOption, 0, defaultCallOptionLength)
		}
		g.copts = append(g.copts, grpc.CallContentSubtype(contentSubtype))
	}
}

This change applies to all instances where g.copts is initialized, enhancing consistency across the codebase.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func WithCallContentSubtype(contentSubtype string) Option {
return func(g *gRPCClient) {
if size > 1 {
g.copts = append(g.copts,
grpc.MaxRetryRPCBufferSize(size),
)
if g.copts == nil && cap(g.copts) == 0 {
g.copts = make([]grpc.CallOption, 0, defaultCallOptionLength)
}
g.copts = append(g.copts, grpc.CallContentSubtype(contentSubtype))
func WithCallContentSubtype(contentSubtype string) Option {
return func(g *gRPCClient) {
if g.copts == nil {
g.copts = make([]grpc.CallOption, 0, defaultCallOptionLength)
}
g.copts = append(g.copts, grpc.CallContentSubtype(contentSubtype))
}
}
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 256-256: internal/net/grpc/option.go#L256
Added line #L256 was not covered by tests


[warning] 258-259: internal/net/grpc/option.go#L258-L259
Added lines #L258 - L259 were not covered by tests


[warning] 261-261: internal/net/grpc/option.go#L261
Added line #L261 was not covered by tests

@@ -706,7 +706,7 @@ func TestGRPCClient_Opts(t *testing.T) {
}
tests := []test{
{
name: "return 25 grpc.Option and nil error when all parameters are set",
name: "return 32 grpc.Option and nil error when all parameters are set",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Discrepancy Found in grpc.Options Count

The Opts() method sets 39 grpc.Option instances, whereas the test expects 32. Please verify if the additional options are intentional and update the test accordingly.

🔗 Analysis chain

Verify the increase in gRPC options

The test case has been updated to expect 32 grpc.Option instances instead of 25, and the test name has been changed accordingly. This change likely reflects new features or configuration options added to the gRPC client.

To ensure the accuracy of this change, please verify that all new options are correctly implemented and tested.

Run the following script to check the number of options being set:

Also applies to: 781-781

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Count the number of grpc.Options being set in the Opts() method

# Search for the Opts() method and count the number of times WithXXX() is called
rg --type go -U 'func \(g \*GRPCClient\) Opts\(\).*\{' -A 200 | rg 'With\w+\(' | wc -l

Length of output: 91

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 18

🧹 Outside diff range and nitpick comments (26)
charts/vald/values.schema.json (1)

Line range hint 4765-24776: Approved: Consistent application of new gRPC options across configuration schema

The remaining changes in this file (segments 8-107) consistently apply the same set of new gRPC server and client configuration options across different components or services within the Vald project. This includes:

  1. For gRPC servers:

    • enable_channelz
    • max_concurrent_streams
    • num_stream_workers
    • shared_write_buffer
    • wait_for_handlers
  2. For gRPC clients:

    • content_subtype
    • authority
    • disable_retry
    • idle_timeout
    • max_call_attempts
    • max_header_list_size
    • shared_write_buffer
    • user_agent

This systematic application ensures consistency throughout the configuration schema, allowing uniform configuration capabilities across different parts of the system. It reflects a comprehensive approach to enhancing gRPC-related configurations in the Vald project.

Note: The previously mentioned concern about the content_subtype property (lack of description and integer type) applies to all its occurrences in these repeated sections.

internal/net/grpc/server.go (2)

127-131: LGTM: SharedWriteBuffer implementation with a suggestion

The SharedWriteBuffer function is correctly implemented as a wrapper around grpc.SharedWriteBuffer. The comment effectively explains the purpose and behavior of this option.

Suggestion: Consider adding a brief note about the potential performance implications or use cases for this option to provide more context for users.


139-178: Excellent API reference documentation with a minor suggestion

The API references comment block provides a comprehensive and well-organized overview of the available server options. The categorization into Already Implemented, Unnecessary, Experimental, and Deprecated APIs is particularly helpful for developers working with or maintaining this package.

Suggestion: For consistency, consider adjusting the formatting of the "Unnecessary for this package APIs" section to match the others. For example:

2. Unnecessary for this package APIs
- func ChainStreamInterceptor(interceptors ...StreamServerInterceptor) ServerOption
...
internal/config/grpc.go (2)

51-73: LGTM: Comprehensive additions to DialOption struct

The new fields added to the DialOption struct provide a wide range of configuration options for gRPC dial settings. This allows for more fine-grained control over connection behavior, performance tuning, and error handling.

However, to improve maintainability and ease of use, consider adding documentation comments for each new field, explaining:

  1. The purpose of the field
  2. Expected value ranges or formats
  3. Default values (if any)
  4. Potential impacts on gRPC behavior

This documentation will be particularly helpful for fields like BackoffJitter, BackoffMultiplier, and MaxHeaderListSize, where the implications might not be immediately obvious to all users.


Line range hint 1-307: Overall improvements to gRPC client configuration, with some areas for enhancement

The changes to this file significantly expand the configuration options available for gRPC clients, which is a positive improvement. However, there are a few areas that could be enhanced:

  1. Documentation: Consider adding detailed comments for each new field in the CallOption and DialOption structs, explaining their purpose, expected values, and potential impacts.

  2. Consistency in binding: Ensure all new fields in DialOption are properly bound in the Bind() method.

  3. Utilization of all fields: Make sure all new fields are utilized in the Opts() method, or provide comments explaining why certain fields are not used.

  4. Error handling: Consider adding more robust error handling, especially when parsing string values into durations or other types.

  5. Potential conflicts: Review the usage of DisableRetry and MaxCallAttempts to ensure they don't create conflicting behaviors.

Addressing these points will further improve the robustness and usability of the gRPC client configuration.

k8s/index/job/correction/configmap.yaml (4)

45-45: Consider documenting new gRPC server configuration options

The new gRPC server configuration options provide more control, but some values might need explanation:

  1. enable_channelz: true (line 45): This enables gRPC channelz service. Consider documenting its purpose and potential performance impact.

  2. max_concurrent_streams: 0 (line 60): A value of 0 typically means no limit. Consider documenting this or setting a specific limit based on your requirements.

  3. num_stream_workers: 0 (line 64): This controls the number of workers for handling streams. A value of 0 likely means it will use a default or auto-configured value. Consider documenting the expected behavior.

  4. shared_write_buffer: false (line 66): While this is a reasonable default, it would be helpful to document when one might want to enable this option.

  5. wait_for_handlers: true (line 67): This seems to indicate that the server will wait for handlers to be registered before starting. Consider documenting the implications of this setting.

For all new options, consider adding inline comments explaining their purpose, default values, and when they might need adjustment. This will greatly improve the maintainability of the configuration.

Also applies to: 60-60, 64-64, 66-67


274-274: Review and document new gRPC client options for the gateway

The new gRPC client options provide more control, but some values might need explanation:

  1. content_subtype: "" (line 274): An empty string typically means default behavior. Consider documenting what this default is and when it might need to be changed.

  2. authority: "" (line 280): An empty authority string might use the default authority. Document the implications of this setting, especially in environments with complex networking setups.

  3. disable_retry: false (line 285): This allows for retries, which can improve reliability but may increase load. Consider documenting the retry behavior and when it might be beneficial to disable retries.

  4. idle_timeout: 1h (line 287): This seems reasonable for long-running connections, but consider documenting the trade-offs of longer vs. shorter timeouts.

  5. max_call_attempts: 0 (line 296) and max_header_list_size: 0 (line 297): Zero values often indicate "use default". Document what these defaults are and scenarios where they might need adjustment.

For all these options, consider adding inline comments explaining their purpose, default behavior, and scenarios where they might need tuning. This will help future maintainers understand the configuration choices.

Also applies to: 280-287, 296-297


363-376: Ensure consistency in gRPC client options for the discoverer

The changes in the discoverer.client section mirror those in the corrector.gateway section. To maintain consistency and clarity:

  1. Ensure that the documentation suggestions made for the gateway section are also applied here.
  2. Verify that the values set for each option are appropriate for the discoverer's specific use case.
  3. If there are any differences in how these options should be used between the gateway and discoverer, clearly document these distinctions.

Consider adding a comment at the beginning of this section explaining why these options are consistent with the gateway configuration, or if they differ, why they differ.

Also applies to: 385-386


Line range hint 1-524: Overall review summary and recommendations

The changes to this ConfigMap significantly enhance the configurability of the vald-index-correction component, particularly for gRPC settings. However, there are several areas for improvement:

  1. Documentation: Add inline comments for all new options, explaining their purpose, default values, and scenarios where they might need adjustment.

  2. Consistency: Align the structure of the agent_client_options section with the corrector.gateway and discoverer.client sections for better maintainability.

  3. Default values: Review and document the implications of default values (e.g., zero values) for new options.

  4. Performance considerations: Document any potential performance impacts of the new options, especially for settings like enable_channelz, max_concurrent_streams, and shared_write_buffer.

  5. Error handling: Ensure that the configuration has appropriate error handling for invalid values in the new options.

By addressing these points, you'll greatly improve the maintainability and usability of this configuration file for future developers and operators.

internal/net/grpc/option.go (8)

217-243: Consider moving API references to external documentation

While the added API reference comments are informative, they significantly increase the file size and may clutter the code. Consider moving these references to external documentation (e.g., a separate markdown file or developer guide) and leaving a brief comment with a link to the full documentation. This approach would improve code readability while still providing access to the detailed information.


398-407: LGTM! Consider simplifying the initialization check

The change from int to int32 for the size parameter aligns with the gRPC API expectations, which is good. As mentioned earlier, the initialization check for g.dopts can be simplified to:

if g.dopts == nil {
    g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}

This simplification applies to all similar checks in the file.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 398-398: internal/net/grpc/option.go#L398
Added line #L398 was not covered by tests


[warning] 401-402: internal/net/grpc/option.go#L401-L402
Added lines #L401 - L402 were not covered by tests


[warning] 405-405: internal/net/grpc/option.go#L405
Added line #L405 was not covered by tests


411-420: LGTM! Consider simplifying the initialization check

The change from int to int32 for the size parameter aligns with the gRPC API expectations, which is good. As mentioned earlier, the initialization check for g.dopts can be simplified to:

if g.dopts == nil {
    g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}

This simplification applies to all similar checks in the file.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 411-411: internal/net/grpc/option.go#L411
Added line #L411 was not covered by tests


[warning] 414-415: internal/net/grpc/option.go#L414-L415
Added lines #L414 - L415 were not covered by tests


[warning] 418-418: internal/net/grpc/option.go#L418
Added line #L418 was not covered by tests


519-530: LGTM! Consider simplifying the initialization check

The addition of the WithAuthority function is a good improvement, allowing users to set the :authority pseudo-header for gRPC requests. As mentioned earlier, the initialization check for g.dopts can be simplified to:

if g.dopts == nil {
    g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}

This simplification applies to all similar checks in the file.


532-543: LGTM! Consider simplifying the initialization check

The addition of the WithDisableRetry function is a good improvement, allowing users to disable the retry mechanism for gRPC requests. As mentioned earlier, the initialization check for g.dopts can be simplified to:

if g.dopts == nil {
    g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}

This simplification applies to all similar checks in the file.


545-566: LGTM! Consider simplifying the initialization check

The addition of the WithIdleTimeout function is a valuable improvement, allowing users to set an idle timeout for gRPC connections. The function correctly handles input validation and error logging, which is great. As mentioned earlier, the initialization check for g.dopts can be simplified to:

if g.dopts == nil {
    g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}

This simplification applies to all similar checks in the file.


607-618: LGTM! Consider simplifying the initialization check

The addition of the WithUserAgent function is a good improvement, allowing users to set a custom user agent for gRPC requests. As mentioned earlier, the initialization check for g.dopts can be simplified to:

if g.dopts == nil {
    g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}

This simplification applies to all similar checks in the file.


Line range hint 1-624: Overall improvements with minor refactoring opportunities

The changes to this file significantly enhance the gRPC client options, providing more configuration flexibility and improved error handling. The additions of new options like WithAuthority, WithDisableRetry, WithIdleTimeout, WithMaxCallAttempts, WithMaxHeaderListSize, WithSharedWriteBuffer, and WithUserAgent are valuable improvements.

Key points:

  1. The consistent pattern for option functions is good for maintainability.
  2. Error handling and logging have been improved in several functions.
  3. The change from int to int32 in some functions aligns better with gRPC API expectations.

Suggestions for further improvement:

  1. Simplify the initialization checks for g.copts and g.dopts as mentioned in previous comments.
  2. Consider moving the API reference comments to external documentation.
  3. Adjust the condition in WithMaxCallAttempts to allow all valid values (>= 1).
  4. Allow explicit disabling in WithSharedWriteBuffer.
  5. Use append consistently in WithCallOptions and WithDialOptions.

These changes will further enhance the code quality and consistency of the gRPC client options.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 246-246: internal/net/grpc/option.go#L246
Added line #L246 was not covered by tests


[warning] 248-251: internal/net/grpc/option.go#L248-L251
Added lines #L248 - L251 were not covered by tests


[warning] 256-256: internal/net/grpc/option.go#L256
Added line #L256 was not covered by tests


[warning] 258-259: internal/net/grpc/option.go#L258-L259
Added lines #L258 - L259 were not covered by tests


[warning] 261-261: internal/net/grpc/option.go#L261
Added line #L261 was not covered by tests


[warning] 268-269: internal/net/grpc/option.go#L268-L269
Added lines #L268 - L269 were not covered by tests


[warning] 271-271: internal/net/grpc/option.go#L271
Added line #L271 was not covered by tests


[warning] 279-280: internal/net/grpc/option.go#L279-L280
Added lines #L279 - L280 were not covered by tests


[warning] 282-282: internal/net/grpc/option.go#L282
Added line #L282 was not covered by tests


[warning] 287-291: internal/net/grpc/option.go#L287-L291
Added lines #L287 - L291 were not covered by tests


[warning] 293-293: internal/net/grpc/option.go#L293
Added line #L293 was not covered by tests


[warning] 298-301: internal/net/grpc/option.go#L298-L301
Added lines #L298 - L301 were not covered by tests


[warning] 303-303: internal/net/grpc/option.go#L303
Added line #L303 was not covered by tests


[warning] 362-367: internal/net/grpc/option.go#L362-L367
Added lines #L362 - L367 were not covered by tests


[warning] 375-376: internal/net/grpc/option.go#L375-L376
Added lines #L375 - L376 were not covered by tests

internal/net/grpc/pool/pool.go (1)

Line range hint 606-651: Enhanced getHealthyConn method with improved tracking

The changes to the getHealthyConn method provide better connection tracking and error handling. Returning the index along with the connection is a good improvement for connection management.

Consider adding more context to the error log on line 640:

-log.Warnf("failed to find gRPC connection pool for %s.\tlen(pool): %d,\tretried: %d,\terror: %v", p.addr, pl, cnt, err)
+log.Warnf("failed to find healthy gRPC connection for %s after %d attempts.\tpool size: %d,\terror: %v", p.addr, cnt, pl, err)

This provides clearer information about the nature of the failure and the number of attempts made.

Makefile (1)

397-417: LGTM! Consider adding a comment for clarity.

The new perm target is well-implemented and follows good practices for setting permissions in a Git repository. It correctly sets standard permissions for directories (755) and files (644), while providing special handling for the .git directory and its contents.

Consider adding a brief comment at the beginning of the target to explain its purpose, for example:

.PHONY: perm
## Set correct permissions for dirs and files in the repository
perm:
    # ... (rest of the implementation)

This will improve clarity for other developers who might work on this Makefile in the future.

internal/net/grpc/client.go (3)

149-151: LGTM! Consider adding test coverage and documentation.

The addition of default call options to the dial options is a good improvement. It allows for consistent configuration across all gRPC connections created by this client.

However, there are a couple of points to consider:

  1. These new lines are not covered by tests according to the static analysis. It would be beneficial to add test coverage for this new functionality to ensure it works as expected and to prevent potential regressions in the future.

  2. Consider adding a brief comment explaining the purpose of this addition. This would improve code documentation and make it easier for other developers to understand the intention behind this change.

Would you like assistance in generating test cases or adding documentation for this change?

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 149-150: internal/net/grpc/client.go#L149-L150
Added lines #L149 - L150 were not covered by tests


Line range hint 170-185: Improved error handling and logging. Consider minor refactoring.

The enhancements to error handling in the StartConnectionMonitor function are excellent. The more granular approach to handling different error types and improved logging will greatly aid in diagnosing connection issues.

To further improve the code, consider refactoring the error handling to reduce duplication. You could create a helper function to handle the common error checking and logging pattern.

Here's a suggestion for refactoring:

func (g *gRPCClient) handleConnectionError(err error, addr string) {
    if !errors.Is(err, context.Canceled) &&
        !errors.Is(err, context.DeadlineExceeded) &&
        !errors.Is(err, errors.ErrCircuitBreakerOpenState) &&
        !errors.Is(err, errors.ErrGRPCClientConnNotFound("*")) &&
        !errors.Is(err, errors.ErrGRPCClientConnNotFound(addr)) &&
        !errors.Is(err, errors.ErrGRPCClientNotFound) {
        log.Errorf("failed to initial connection to %s,\terror: %v", addr, err)
        ech <- err
    } else {
        log.Warn(err)
    }
}

// Then in StartConnectionMonitor:
if err != nil {
    g.handleConnectionError(err, addr)
}

This refactoring would make the code more maintainable and easier to read. Would you like me to propose this change as a separate pull request?

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 149-150: internal/net/grpc/client.go#L149-L150
Added lines #L149 - L150 were not covered by tests


Line range hint 1010-1037: Enhanced logging for better observability. Consider consistent error handling.

The improvements to logging in the Connect function are valuable. They provide better visibility into the connection lifecycle, which will be helpful for debugging and monitoring.

One minor suggestion for improvement:

In the error handling after the connection attempt, you're logging the error and then joining it with another potential error from disconnection. Consider logging the combined error at the end for consistency and to ensure all error information is captured in the logs.

Here's a suggestion for more consistent error handling:

if err != nil || conn == nil {
    derr := g.Disconnect(ctx, addr)
    if derr != nil && !errors.Is(derr, errors.ErrGRPCClientConnNotFound(addr)) {
        err = errors.Join(err, derr)
    }
    log.Errorf("failed to connect to %s: %v", addr, err)
    return nil, err
}

This ensures that all error information is logged together. Would you like me to implement this change?

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 149-150: internal/net/grpc/client.go#L149-L150
Added lines #L149 - L150 were not covered by tests

internal/config/server_test.go (1)

Line range hint 1-1472: Overall assessment: Good changes with a minor improvement suggestion

The changes in this file are generally good:

  1. The type changes for MaxHeaderListSize and HeaderTableSize improve type safety and align with gRPC specifications.
  2. Test cases have been updated consistently with these changes.

However, there's still an opportunity for improvement:

  • The tests still use hardcoded counts for the number of server options. Consider refactoring these tests to be more resilient to future changes in the number of options.
charts/vald/values.yaml (2)

Line range hint 4387-4506: New read replica management feature (Work in Progress)

The addition of the readreplica configuration, particularly the rotator job, is a significant new feature:

  1. It aims to improve read scalability and performance by managing read replicas.
  2. The rotator job is configured with its own image, security contexts, and Kubernetes resources (ServiceAccount, ClusterRole, ClusterRoleBinding).
  3. It includes configuration for targeting specific read replicas using annotations.

This feature has the potential to greatly enhance the system's read performance and scalability. However, it's important to note that this feature is marked as "work in progress" (WIP).

Given its WIP status:

  1. Thorough testing should be conducted before using this in production.
  2. Documentation should clearly indicate the experimental nature of this feature.
  3. Consider adding a warning comment in the configuration file itself about the WIP status.

Consider adding a comment at the beginning of this section clearly stating that this feature is a work in progress and may be subject to changes.


Line range hint 4507-4731: New index operator feature (Work in Progress)

The addition of the operator configuration under manager.index introduces a potentially powerful new feature for automated management of Vald indexes:

  1. It's designed as a Kubernetes operator, which can provide more native and automated management of Vald resources within a Kubernetes cluster.
  2. The configuration is comprehensive, covering deployment strategy, security contexts, resource allocation, and more.
  3. It includes its own observability settings, suggesting good integration with monitoring systems.

However, this feature is explicitly marked as "WIP" (Work in Progress), which is an important consideration.

Recommendations:

  1. Add more detailed comments within the configuration explaining the current state of the operator, its limitations, and any known issues.
  2. Consider adding a timeline or roadmap for when this feature is expected to be production-ready.
  3. Ensure that documentation clearly states this is an experimental feature and provides guidance on how users can provide feedback or report issues.
  4. Implement feature flags or clear version checks to prevent accidental use in production environments before it's ready.

Add more extensive comments at the beginning of this section explaining the current state of the operator, its intended use cases, and any limitations in its current implementation.

charts/vald-helm-operator/crds/valdrelease.yaml (1)

Line range hint 1-14437: Summary of CRD enhancements and suggestion for documentation

This update to the ValdRelease CRD introduces significant enhancements to the gRPC configuration capabilities:

  1. New client-side options have been added, including content_subtype, authority, disable_retry, idle_timeout, max_call_attempts, max_header_list_size, shared_write_buffer, and user_agent.
  2. Server-side configurations have been expanded with enable_channelz, max_concurrent_streams, num_stream_workers, shared_write_buffer, and wait_for_handlers.
  3. These new options are consistently replicated across various components (agent, gateway, manager, etc.), ensuring uniform configuration capabilities throughout the system.

The changes provide more granular control over gRPC behavior, potentially improving performance, debugging capabilities, and overall system manageability.

Given the extensive nature of these changes, it's recommended to:

  1. Update the user documentation to explain these new configuration options, their purposes, and potential impacts.
  2. Provide examples or best practices for utilizing these new configurations in different scenarios.
  3. Consider creating a migration guide for users upgrading from previous versions, highlighting any default value changes or new recommended settings.

To support users in leveraging these new capabilities effectively, consider developing comprehensive documentation and potentially creating configuration templates for common use cases.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between efe121d and b5daaa6.

⛔ Files ignored due to path filters (21)
  • apis/grpc/v1/agent/core/agent.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/agent/sidecar/sidecar.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/discoverer/discoverer.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/filter/egress/egress_filter.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/filter/ingress/ingress_filter.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/meta/meta.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/mirror/mirror.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/payload/payload.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/rpc/errdetails/error_details.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/filter.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/flush.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/index.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/insert.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/object.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/remove.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/search.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/update.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • apis/grpc/v1/vald/upsert.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • example/client/go.sum is excluded by !**/*.sum
  • go.sum is excluded by !**/*.sum
  • rust/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (72)
  • .github/ISSUE_TEMPLATE/bug_report.md (1 hunks)
  • .github/ISSUE_TEMPLATE/security_issue_report.md (1 hunks)
  • .github/PULL_REQUEST_TEMPLATE.md (1 hunks)
  • Makefile (1 hunks)
  • charts/vald-helm-operator/crds/valdrelease.yaml (94 hunks)
  • charts/vald/values.schema.json (107 hunks)
  • charts/vald/values.yaml (4 hunks)
  • dockers/agent/core/agent/Dockerfile (1 hunks)
  • dockers/agent/core/faiss/Dockerfile (1 hunks)
  • dockers/agent/core/ngt/Dockerfile (1 hunks)
  • dockers/agent/sidecar/Dockerfile (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildbase/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • dockers/buildkit/syft/scanner/Dockerfile (1 hunks)
  • dockers/ci/base/Dockerfile (2 hunks)
  • dockers/dev/Dockerfile (2 hunks)
  • dockers/discoverer/k8s/Dockerfile (1 hunks)
  • dockers/gateway/filter/Dockerfile (1 hunks)
  • dockers/gateway/lb/Dockerfile (1 hunks)
  • dockers/gateway/mirror/Dockerfile (1 hunks)
  • dockers/index/job/correction/Dockerfile (1 hunks)
  • dockers/index/job/creation/Dockerfile (1 hunks)
  • dockers/index/job/readreplica/rotate/Dockerfile (1 hunks)
  • dockers/index/job/save/Dockerfile (1 hunks)
  • dockers/index/operator/Dockerfile (1 hunks)
  • dockers/manager/index/Dockerfile (1 hunks)
  • dockers/operator/helm/Dockerfile (1 hunks)
  • dockers/tools/benchmark/job/Dockerfile (1 hunks)
  • dockers/tools/benchmark/operator/Dockerfile (1 hunks)
  • dockers/tools/cli/loadtest/Dockerfile (1 hunks)
  • example/client/go.mod (3 hunks)
  • go.mod (11 hunks)
  • hack/go.mod.default (1 hunks)
  • internal/config/grpc.go (3 hunks)
  • internal/config/grpc_test.go (4 hunks)
  • internal/config/server.go (2 hunks)
  • internal/config/server_test.go (5 hunks)
  • internal/db/rdb/mysql/dbr/dbr.go (1 hunks)
  • internal/db/rdb/mysql/dbr/session.go (1 hunks)
  • internal/db/rdb/mysql/dbr/tx.go (1 hunks)
  • internal/net/grpc/client.go (1 hunks)
  • internal/net/grpc/health/health.go (1 hunks)
  • internal/net/grpc/health/health_test.go (4 hunks)
  • internal/net/grpc/option.go (7 hunks)
  • internal/net/grpc/pool/pool.go (9 hunks)
  • internal/net/grpc/server.go (1 hunks)
  • internal/servers/server/option.go (1 hunks)
  • internal/servers/server/option_test.go (2 hunks)
  • internal/servers/server/server.go (2 hunks)
  • k8s/agent/ngt/configmap.yaml (2 hunks)
  • k8s/discoverer/configmap.yaml (2 hunks)
  • k8s/discoverer/deployment.yaml (1 hunks)
  • k8s/gateway/gateway/lb/configmap.yaml (8 hunks)
  • k8s/gateway/gateway/lb/deployment.yaml (1 hunks)
  • k8s/gateway/gateway/mirror/configmap.yaml (1 hunks)
  • k8s/gateway/gateway/mirror/deployment.yaml (1 hunks)
  • k8s/index/job/correction/configmap.yaml (9 hunks)
  • k8s/index/job/creation/configmap.yaml (6 hunks)
  • k8s/index/job/save/configmap.yaml (6 hunks)
  • k8s/index/operator/configmap.yaml (1 hunks)
  • k8s/index/operator/deployment.yaml (1 hunks)
  • k8s/manager/index/configmap.yaml (6 hunks)
  • k8s/manager/index/deployment.yaml (1 hunks)
  • k8s/operator/helm/crds/valdrelease.yaml (94 hunks)
  • versions/CMAKE_VERSION (1 hunks)
  • versions/FAISS_VERSION (1 hunks)
  • versions/HELM_VERSION (1 hunks)
  • versions/K3S_VERSION (1 hunks)
  • versions/PROMETHEUS_STACK_VERSION (1 hunks)
  • versions/actions/ACTIONS_CACHE (1 hunks)
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • dockers/buildbase/Dockerfile
🚧 Files skipped from review as they are similar to previous changes (53)
  • .github/ISSUE_TEMPLATE/bug_report.md
  • .github/ISSUE_TEMPLATE/security_issue_report.md
  • .github/PULL_REQUEST_TEMPLATE.md
  • dockers/agent/core/agent/Dockerfile
  • dockers/agent/core/faiss/Dockerfile
  • dockers/agent/core/ngt/Dockerfile
  • dockers/agent/sidecar/Dockerfile
  • dockers/binfmt/Dockerfile
  • dockers/buildkit/Dockerfile
  • dockers/buildkit/syft/scanner/Dockerfile
  • dockers/ci/base/Dockerfile
  • dockers/dev/Dockerfile
  • dockers/discoverer/k8s/Dockerfile
  • dockers/gateway/filter/Dockerfile
  • dockers/gateway/lb/Dockerfile
  • dockers/gateway/mirror/Dockerfile
  • dockers/index/job/correction/Dockerfile
  • dockers/index/job/creation/Dockerfile
  • dockers/index/job/readreplica/rotate/Dockerfile
  • dockers/index/job/save/Dockerfile
  • dockers/index/operator/Dockerfile
  • dockers/manager/index/Dockerfile
  • dockers/operator/helm/Dockerfile
  • dockers/tools/benchmark/job/Dockerfile
  • dockers/tools/benchmark/operator/Dockerfile
  • dockers/tools/cli/loadtest/Dockerfile
  • example/client/go.mod
  • go.mod
  • hack/go.mod.default
  • internal/config/server.go
  • internal/net/grpc/health/health.go
  • internal/net/grpc/health/health_test.go
  • internal/servers/server/option_test.go
  • internal/servers/server/server.go
  • k8s/agent/ngt/configmap.yaml
  • k8s/discoverer/configmap.yaml
  • k8s/discoverer/deployment.yaml
  • k8s/gateway/gateway/lb/deployment.yaml
  • k8s/gateway/gateway/mirror/configmap.yaml
  • k8s/gateway/gateway/mirror/deployment.yaml
  • k8s/index/job/creation/configmap.yaml
  • k8s/index/job/save/configmap.yaml
  • k8s/index/operator/configmap.yaml
  • k8s/index/operator/deployment.yaml
  • k8s/manager/index/configmap.yaml
  • k8s/manager/index/deployment.yaml
  • versions/CMAKE_VERSION
  • versions/FAISS_VERSION
  • versions/HELM_VERSION
  • versions/K3S_VERSION
  • versions/PROMETHEUS_STACK_VERSION
  • versions/actions/ACTIONS_CACHE
  • versions/actions/ACTIONS_UPLOAD_ARTIFACT
🧰 Additional context used
📓 Learnings (1)
internal/config/grpc.go (1)
Learnt from: kpango
PR: vdaas/vald#2685
File: internal/config/grpc.go:244-244
Timestamp: 2024-10-09T05:40:03.660Z
Learning: `grpc.WithIdleTimeout` is a client-side `DialOption` in gRPC and can be used in client configurations.
🪛 GitHub Check: codecov/patch
internal/db/rdb/mysql/dbr/dbr.go

[warning] 62-65: internal/db/rdb/mysql/dbr/dbr.go#L62-L65
Added lines #L62 - L65 were not covered by tests


[warning] 67-67: internal/db/rdb/mysql/dbr/dbr.go#L67
Added line #L67 was not covered by tests

internal/db/rdb/mysql/dbr/session.go

[warning] 45-45: internal/db/rdb/mysql/dbr/session.go#L45
Added line #L45 was not covered by tests

internal/db/rdb/mysql/dbr/tx.go

[warning] 68-68: internal/db/rdb/mysql/dbr/tx.go#L68
Added line #L68 was not covered by tests

internal/net/grpc/client.go

[warning] 149-150: internal/net/grpc/client.go#L149-L150
Added lines #L149 - L150 were not covered by tests

internal/net/grpc/option.go

[warning] 246-246: internal/net/grpc/option.go#L246
Added line #L246 was not covered by tests


[warning] 248-251: internal/net/grpc/option.go#L248-L251
Added lines #L248 - L251 were not covered by tests


[warning] 256-256: internal/net/grpc/option.go#L256
Added line #L256 was not covered by tests


[warning] 258-259: internal/net/grpc/option.go#L258-L259
Added lines #L258 - L259 were not covered by tests


[warning] 261-261: internal/net/grpc/option.go#L261
Added line #L261 was not covered by tests


[warning] 268-269: internal/net/grpc/option.go#L268-L269
Added lines #L268 - L269 were not covered by tests


[warning] 271-271: internal/net/grpc/option.go#L271
Added line #L271 was not covered by tests


[warning] 279-280: internal/net/grpc/option.go#L279-L280
Added lines #L279 - L280 were not covered by tests


[warning] 282-282: internal/net/grpc/option.go#L282
Added line #L282 was not covered by tests


[warning] 287-291: internal/net/grpc/option.go#L287-L291
Added lines #L287 - L291 were not covered by tests


[warning] 293-293: internal/net/grpc/option.go#L293
Added line #L293 was not covered by tests


[warning] 298-301: internal/net/grpc/option.go#L298-L301
Added lines #L298 - L301 were not covered by tests


[warning] 303-303: internal/net/grpc/option.go#L303
Added line #L303 was not covered by tests


[warning] 362-367: internal/net/grpc/option.go#L362-L367
Added lines #L362 - L367 were not covered by tests


[warning] 375-376: internal/net/grpc/option.go#L375-L376
Added lines #L375 - L376 were not covered by tests


[warning] 388-389: internal/net/grpc/option.go#L388-L389
Added lines #L388 - L389 were not covered by tests


[warning] 398-398: internal/net/grpc/option.go#L398
Added line #L398 was not covered by tests


[warning] 401-402: internal/net/grpc/option.go#L401-L402
Added lines #L401 - L402 were not covered by tests


[warning] 405-405: internal/net/grpc/option.go#L405
Added line #L405 was not covered by tests


[warning] 411-411: internal/net/grpc/option.go#L411
Added line #L411 was not covered by tests


[warning] 414-415: internal/net/grpc/option.go#L414-L415
Added lines #L414 - L415 were not covered by tests


[warning] 418-418: internal/net/grpc/option.go#L418
Added line #L418 was not covered by tests


[warning] 427-428: internal/net/grpc/option.go#L427-L428
Added lines #L427 - L428 were not covered by tests


[warning] 440-441: internal/net/grpc/option.go#L440-L441
Added lines #L440 - L441 were not covered by tests


[warning] 457-457: internal/net/grpc/option.go#L457
Added line #L457 was not covered by tests

🔇 Additional comments (46)
charts/vald/values.schema.json (6)

1419-1422: Approved: New gRPC server configuration option added

The addition of the enable_channelz option enhances the configurability of the gRPC server. This boolean property is well-documented and allows users to enable or disable the gRPC server channelz option.


1485-1488: Approved: New gRPC server concurrent streams limit option

The addition of the max_concurrent_streams option provides more control over server resources and performance. This integer property is well-documented and allows users to set the maximum number of concurrent streams for the gRPC server.


1501-1516: Approved: Enhanced gRPC server configuration options

Three new properties have been added to the gRPC server configuration, providing more fine-grained control:

  1. num_stream_workers: Allows setting the number of stream workers.
  2. shared_write_buffer: Enables or disables write buffer sharing.
  3. wait_for_handlers: Controls whether the server waits for handlers when stopping.

These well-documented options can help in optimizing server performance and resource usage, enhancing the overall flexibility of the gRPC server configuration.


3681-3692: Approved: New gRPC client dial options for improved connection control

Two new properties have been added to the gRPC client dial_option, enhancing connection control:

  1. disable_retry: A boolean option to disable retry behavior.
  2. idle_timeout: A string option to set the idle timeout for connections.

These well-documented options provide more fine-grained control over the gRPC client connection behavior, allowing users to optimize retry strategies and manage connection lifecycles more effectively.


3730-3737: Approved: Enhanced gRPC client call control options

Two new properties have been added to the gRPC client dial_option, providing more control over call behavior and resource usage:

  1. max_call_attempts: An integer option to limit the number of call attempts.
  2. max_header_list_size: An integer option to set the maximum size of the header list.

These well-documented options allow users to fine-tune client-side performance and prevent potential issues related to excessive retries or large headers. They enhance the overall robustness and configurability of the gRPC client.


3855-3866: Approved: New gRPC client options for write buffer and user agent

Two new properties have been added to the gRPC client dial_option, enhancing connection behavior and client identification:

  1. shared_write_buffer: A boolean option to enable or disable write buffer sharing.
  2. user_agent: A string option to set a custom user agent for the client.

These well-documented options provide valuable configuration capabilities:

  • The shared_write_buffer option can potentially optimize memory usage and performance in scenarios with multiple concurrent connections.
  • The user_agent option allows for better identification and tracking of client requests, which can be useful for debugging, analytics, or compliance purposes.

These additions further improve the flexibility and functionality of the gRPC client configuration.

internal/db/rdb/mysql/dbr/tx.go (1)

68-68: Approved with suggestions: Provide context for prepareSelect and improve test coverage

The change to use prepareSelect for processing column arguments looks good, as it likely improves how column names are handled. However, I have a few suggestions to enhance this change:

  1. Could you provide more information about the prepareSelect function? Understanding its purpose and behavior would help in evaluating the full impact of this change.

  2. The static analysis tool indicates that this line is not covered by tests. Given the importance of database operations, it's crucial to have thorough test coverage. Please add unit tests to cover this change and ensure the new behavior is working as expected.

  3. Consider updating the method documentation to reflect the new behavior introduced by prepareSelect. This will help other developers understand the change and its implications.

To verify the usage and implementation of prepareSelect, please run the following script:

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 68-68: internal/db/rdb/mysql/dbr/tx.go#L68
Added line #L68 was not covered by tests

internal/net/grpc/server.go (4)

116-119: LGTM: MaxConcurrentStreams implementation

The MaxConcurrentStreams function is correctly implemented as a wrapper around grpc.MaxConcurrentStreams. The comment accurately describes its purpose, and the implementation is straightforward and correct.


121-125: Excellent implementation and documentation for NumStreamWorkers

The NumStreamWorkers function is well-implemented as a wrapper around grpc.NumStreamWorkers. The accompanying comment is particularly helpful, providing clear information about the function's purpose and the default behavior when set to zero. This level of detail in the documentation is commendable.


133-137: Excellent implementation and documentation for WaitForHandlers

The WaitForHandlers function is well-implemented as a wrapper around grpc.WaitForHandlers. The accompanying comment is particularly commendable, providing a comprehensive explanation of the option's behavior for both true and false cases, as well as the default behavior. This level of detail in the documentation greatly enhances the usability of the function.


115-178: Overall excellent additions to the gRPC server configuration

The new functions (MaxConcurrentStreams, NumStreamWorkers, SharedWriteBuffer, and WaitForHandlers) are well-implemented and thoroughly documented. They provide valuable additional configuration options for gRPC servers.

The API references comment block is a great addition, offering a comprehensive overview of available server options and their status. This will be particularly helpful for developers working with this package.

The code changes demonstrate good software engineering practices, with clear documentation and consistent implementation. The minor suggestions provided in the individual comments can further enhance the already high-quality code.

internal/config/grpc.go (3)

46-46: LGTM: New field ContentSubtype added to CallOption

The addition of the ContentSubtype field to the CallOption struct is a good improvement. This allows for more fine-grained control over the content type of gRPC messages, which can be useful in scenarios where specific content subtypes need to be specified.


155-155: LGTM: ContentSubtype field properly bound

The ContentSubtype field is correctly bound using the GetActualValue() function. This ensures consistency with other field bindings and allows for the resolution of environment variables or placeholders that might be used in the configuration.


233-237: LGTM: CallOption fields correctly used in Opts()

The new ContentSubtype field from CallOption is properly utilized in the Opts() method using grpc.WithCallContentSubtype(). This correctly applies the content subtype configuration to the gRPC options. The usage is consistent with how other CallOption fields are applied.

internal/net/grpc/option.go (4)

287-296: LGTM!

The implementation of WithMaxRetryRPCBufferSize is correct and consistent with other option functions. The simplification suggestion for the initialization of g.copts applies here as well.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 287-291: internal/net/grpc/option.go#L287-L291
Added lines #L287 - L291 were not covered by tests


[warning] 293-293: internal/net/grpc/option.go#L293
Added line #L293 was not covered by tests


298-305: LGTM!

The implementation of WithWaitForReady is correct and consistent with other option functions. The simplification suggestion for the initialization of g.copts applies here as well.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 298-301: internal/net/grpc/option.go#L298-L301
Added lines #L298 - L301 were not covered by tests


[warning] 303-303: internal/net/grpc/option.go#L303
Added line #L303 was not covered by tests


307-359: LGTM!

This API reference comment block provides valuable information about DialOption APIs. As suggested earlier, consider moving these references to external documentation to improve code readability.


457-466: LGTM! Improved error logging

The updates to the error logging messages in the WithKeepaliveParams function provide better context, which is excellent for debugging purposes. These changes will make it easier to identify and resolve issues related to parsing keepalive parameters.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 457-457: internal/net/grpc/option.go#L457
Added line #L457 was not covered by tests

internal/net/grpc/pool/pool.go (2)

601-603: LGTM: Simplified Get method

The changes to the Get method improve code reuse by leveraging the getHealthyConn method. This promotes consistency and reduces duplication.


448-448: Improved error handling and logging

The various minor changes throughout the file, such as improved error handling in the Disconnect, dial, and lookupIPAddr methods, as well as additional logging, enhance the overall robustness and debuggability of the code.

Also applies to: 476-476, 486-486, 582-584, 682-685, 689-691

internal/config/grpc_test.go (3)

507-508: Approve type change for improved consistency with gRPC API

The change from int to int32 for InitialWindowSize and InitialConnectionWindowSize aligns the types with the gRPC API. This improves type consistency and prevents potential issues with type conversion.


542-543: Approve test case update for consistency with struct changes

The test case has been correctly updated to use int32(100) for InitialWindowSize and InitialConnectionWindowSize, maintaining consistency with the type changes in the DialOption struct.


Line range hint 1-1191: Summary of changes in gRPC client configuration tests

The changes in this file improve type consistency with the gRPC API and reflect updates in the gRPC client options. Key points:

  1. InitialWindowSize and InitialConnectionWindowSize types changed from int to int32 for better alignment with the gRPC API.
  2. Test cases have been updated to use the correct types.
  3. The number of expected gRPC options has increased from 25 to 32, suggesting new features or configurations have been added.

These changes appear to be part of a larger update to the gRPC client configuration. While the changes look good overall, it's important to verify that all new options are correctly implemented and tested.

internal/net/grpc/client.go (1)

Line range hint 1-1037: Overall improvements to error handling and logging. LGTM!

The changes in this file significantly enhance the robustness and observability of the gRPC client. The improvements in error handling and logging will make it easier to diagnose and debug issues in production environments. The core functionality and public API remain unchanged, which is good for maintaining compatibility.

Given the nature of these changes, it would be beneficial to run comprehensive integration tests to ensure that the new error handling and logging don't introduce any unexpected behavior in various scenarios.

To verify the impact of these changes, please run the following command:

This will help ensure that the changes work as expected in different scenarios and don't introduce any regressions.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 149-150: internal/net/grpc/client.go#L149-L150
Added lines #L149 - L150 were not covered by tests

internal/config/server_test.go (3)

643-644: LGTM: Type change improves alignment with gRPC specification

The change from int to uint32 for MaxHeaderListSize and HeaderTableSize is a good improvement. It aligns better with the gRPC protocol specification and prevents potential issues with negative values.


682-683: LGTM: Test case updated to match type changes

The test case has been correctly updated to use uint32(5) and uint32(1) for MaxHeaderListSize and HeaderTableSize respectively. This change is consistent with the type changes in the GRPC struct and uses appropriate values for testing.


1372-1372: Acknowledge increase in GRPC server options

The number of server options for GRPC mode has increased from 28 to 31. This change is consistent across the test description and the actual test case, suggesting that new options have been added to the GRPC configuration.

However, as mentioned in a previous review comment, it's recommended to avoid hardcoding the number of options in the test expectations. Consider implementing a more flexible assertion method that doesn't rely on a fixed count of options.

Also applies to: 1427-1427

charts/vald/values.yaml (4)

241-265: Improved gRPC server configuration options

The new fields added to the gRPC server configuration provide more fine-grained control over server behavior:

  1. max_concurrent_streams: Allows limiting the number of concurrent streams per connection.
  2. num_stream_workers: Controls the number of workers processing streams.
  3. shared_write_buffer: Enables sharing of the write buffer, which can improve memory usage.
  4. wait_for_handlers: Ensures graceful shutdown by waiting for handlers to complete.
  5. enable_channelz: Activates the channelz service for better observability.

These additions will allow for better tuning of the gRPC server's performance and resource utilization.


756-758: Enhanced gRPC client configuration options

The new fields added to the gRPC client configuration provide more advanced control over client behavior:

  1. content_subtype: Allows specifying the content subtype for gRPC calls.
  2. max_header_list_size: Controls the maximum size of the header list.
  3. max_call_attempts: Limits the number of retry attempts for a call.
  4. disable_retry: Allows disabling the retry mechanism.
  5. shared_write_buffer: Enables sharing of the write buffer for potential performance improvements.
  6. authority: Specifies the authority header for gRPC calls.
  7. idle_timeout: Sets the duration a connection can be idle before it's closed.

These additions provide more flexibility in configuring gRPC client behavior, potentially improving performance and reliability in various network conditions.

Also applies to: 776-817


Line range hint 2324-2341: New persistent volume configuration for agents

The addition of the persistentVolume configuration for agents is a significant improvement:

  1. enabled: Allows enabling/disabling PVC for agents.
  2. accessMode: Specifies the access mode for the volume (ReadWriteOncePod).
  3. mountPropagation: Controls how mounts are propagated from the host to the container.
  4. storageClass: Defines the storage class to be used.
  5. size: Specifies the size of the persistent volume.

This configuration is crucial for enabling data persistence in non-memory mode, ensuring that index data can survive pod restarts or rescheduling. It's particularly important for maintaining the integrity and consistency of the vector search index across system updates or node failures.


Line range hint 1-4731: Summary of changes and overall impact

This update to the Vald configuration introduces several significant improvements and new features:

  1. Enhanced gRPC server and client configurations, allowing for more fine-grained control over performance and behavior.
  2. Introduction of persistent volume support for agents, enabling better data persistence and reliability.
  3. Addition of read replica management (WIP), potentially improving read scalability and performance.
  4. Introduction of an index operator (WIP), which could provide more automated and Kubernetes-native management of Vald indexes.

These changes collectively aim to improve the performance, scalability, and manageability of Vald deployments. However, it's crucial to note that some features (read replica management and index operator) are still works in progress.

Recommendations:

  1. Thoroughly test the new gRPC configurations and persistent volume features in a staging environment before deploying to production.
  2. Clearly document the WIP status of the read replica and index operator features in user-facing documentation.
  3. Consider adding more inline comments or documentation for the WIP features, explaining their current limitations and expected timelines for completion.
  4. Implement a clear upgrade path and guidelines for users moving from previous versions to this new configuration.

Overall, these changes represent a significant step forward for Vald, but careful consideration and testing should be employed when adopting the new features, especially those marked as WIP.

charts/vald-helm-operator/crds/valdrelease.yaml (7)

938-939: New gRPC configuration option added

The enable_channelz property has been added to the gRPC server configuration. This is a useful feature for debugging and performance analysis of gRPC services.


974-975: New gRPC configuration option added

The max_concurrent_streams property has been added to the gRPC server configuration. This allows for better control over the number of concurrent streams in a single gRPC connection.


982-983: New gRPC configuration option added

The num_stream_workers property has been added to the gRPC server configuration. This can help in managing the number of workers processing streams, potentially improving performance.


986-989: New gRPC configuration options added

Two new properties have been added to the gRPC server configuration:

  1. shared_write_buffer: This can potentially improve performance by sharing write buffers across connections.
  2. wait_for_handlers: This option can ensure that all handlers are ready before the server starts accepting requests.

These additions provide more fine-grained control over the gRPC server behavior.


2227-2228: Enhanced gRPC client configuration options

Several new properties have been added to the gRPC client dial options:

  1. content_subtype: Allows specifying the content subtype for gRPC requests.
  2. authority: Enables overriding the :authority pseudo-header in gRPC requests.
  3. disable_retry: Provides an option to disable automatic retries.
  4. idle_timeout: Sets the duration a connection can be idle before it's closed.
  5. max_call_attempts: Limits the number of call attempts, useful for preventing excessive retries.
  6. max_header_list_size: Controls the maximum size of header list that the client is prepared to accept.
  7. shared_write_buffer: Similar to the server config, this can potentially improve performance.
  8. user_agent: Allows setting a custom user agent string for the client.

These additions provide more granular control over gRPC client behavior, improving flexibility and performance management.

Also applies to: 2232-2233, 2242-2243, 2246-2247, 2269-2272, 2334-2335, 2338-2339


4409-4410: Consistent replication of gRPC configuration options

The new gRPC configuration options (such as content_subtype, authority, disable_retry, idle_timeout, max_call_attempts, max_header_list_size, shared_write_buffer, and user_agent) have been consistently replicated across multiple components in the system, including agent, gateway, manager, and others.

This consistent replication ensures:

  1. Uniform configuration capabilities across all components.
  2. Easier system-wide management and configuration.
  3. Reduced likelihood of configuration discrepancies between components.

This approach aligns with best practices for maintaining a cohesive and manageable system architecture.

Also applies to: 4414-4415, 4424-4425, 4428-4429, 4451-4454, 4516-4517, 4520-4521, 5715-5716, 5720-5721, 5730-5731, 5734-5735, 5757-5760, 5822-5823, 5826-5827, 6099-6100, 6104-6105, 6114-6115, 6118-6119, 6141-6144, 6206-6207, 6210-6211, 6767-6768, 6772-6773, 6782-6783, 6786-6787, 6809-6812, 6874-6875, 6878-6879, 7210-7211, 7215-7216, 7225-7226, 7229-7230, 7252-7255, 7317-7318, 7321-7322, 7906-7907, 7911-7912, 7921-7922, 7925-7926, 7948-7951, 8013-8014, 8017-8018, 8820-8821, 8825-8826, 8835-8836, 8839-8840, 8862-8865, 8927-8928, 8931-8932, 9679-9680, 9684-9685, 9694-9695, 9698-9699, 9721-9724, 9786-9787, 9790-9791, 9870-9871, 9875-9876, 9885-9886, 9889-9890, 9912-9915, 9977-9978, 9981-9982, 10820-10821, 10825-10826, 10835-10836, 10839-10840, 10862-10865, 10927-10928, 10931-10932, 11011-11012, 11016-11017, 11026-11027, 11030-11031, 11053-11056, 11118-11119, 11122-11123, 11134-11135, 11139-11140, 11149-11150, 11153-11154, 11176-11179, 11241-11242, 11245-11246, 12943-12944, 12948-12949, 12958-12959, 12962-12963, 12985-12988, 13050-13051, 13054-13055, 13134-13135, 13139-13140, 13149-13150, 13153-13154, 13176-13179, 13241-13242, 13245-13246


2870-2871: Consistent enhancement of gRPC server configuration

The following gRPC server configuration options have been consistently added across various components:

  1. enable_channelz: Enables the channelz service for debugging.
  2. max_concurrent_streams: Controls the maximum number of concurrent streams per HTTP/2 connection.
  3. num_stream_workers: Sets the number of workers processing streams.
  4. shared_write_buffer: Enables shared write buffer for potential performance improvement.
  5. wait_for_handlers: Ensures all handlers are ready before the server starts accepting requests.

These consistent additions across components provide:

  • Uniform control over gRPC server behavior throughout the system.
  • Potential for system-wide performance tuning and optimization.
  • Improved debugging capabilities with channelz enabled.

This approach ensures that all parts of the application can benefit from these enhanced configuration options, leading to more consistent behavior and easier management of the entire system.

Also applies to: 2906-2907, 2914-2915, 2918-2921, 3831-3832, 3867-3868, 3875-3876, 3879-3882, 5344-5345, 5380-5381, 5388-5389, 5392-5395, 6830-6831, 6866-6867, 6874-6875, 6878-6881, 8004-8005, 8040-8041, 8048-8049, 8052-8055, 9394-9395, 9430-9431, 9438-9439, 9442-9445, 10502-10503, 10538-10539, 10546-10547, 10550-10553, 11872-11873, 11908-11909, 11916-11917, 11920-11923, 13766-13767, 13802-13803, 13810-13811, 13814-13817

k8s/operator/helm/crds/valdrelease.yaml (4)

938-939: Approve new gRPC server configuration options

The addition of new gRPC server configuration options enhances the flexibility and performance tuning capabilities of the Vald system. These new options include:

  1. enable_channelz: Allows for runtime debugging of gRPC services.
  2. max_concurrent_streams: Controls the maximum number of concurrent streams per HTTP/2 connection, helping to manage server load.
  3. num_stream_workers: Likely controls the number of workers handling streams, which can help with concurrency management.
  4. shared_write_buffer: Probably enables a shared buffer for writing, potentially improving performance.
  5. wait_for_handlers: Might make the server wait for handlers to be registered before starting, ensuring all services are ready.

These additions provide more fine-grained control over gRPC server behavior and performance, allowing for better optimization and debugging capabilities.

Also applies to: 974-975, 982-983, 986-989


2227-2228: Approve new gRPC client configuration options

The addition of new gRPC client configuration options provides greater control and flexibility in managing client-side behavior. These new options include:

  1. content_subtype: Allows specifying the content subtype for gRPC calls, enabling more precise content negotiation.
  2. authority: Can be used to override the :authority pseudo-header in gRPC requests, useful for testing or special routing scenarios.
  3. disable_retry: Provides an option to disable automatic retries, which can be beneficial in certain scenarios where retries are not desired.
  4. idle_timeout: Sets a timeout for idle connections, helping to manage resource usage more effectively.
  5. max_call_attempts: Limits the maximum number of attempts for a call, providing better control over retry behavior.
  6. max_header_list_size: Controls the maximum size of the header list, helping to prevent potential DoS attacks or excessive resource usage.
  7. shared_write_buffer: Likely enables a shared buffer for writing, which could improve performance.
  8. user_agent: Allows setting a custom user agent string for the client.

These additions enhance the configurability of gRPC clients in the Vald system, allowing for more fine-tuned control over connection management, retry logic, and resource usage.

Also applies to: 2232-2233, 2242-2243, 2246-2247, 2269-2272, 2334-2335, 2338-2339


Line range hint 938-989: Commend consistent application of gRPC enhancements

It's noteworthy that the new gRPC server and client configuration options have been consistently applied across multiple components of the Vald system, including but not limited to:

  • Gateway
  • Manager
  • Index
  • Discoverer
  • Mirror
  • Compressor
  • Backup

This consistent application of enhancements demonstrates a systematic approach to improving the gRPC capabilities throughout the entire Vald ecosystem. Such consistency offers several benefits:

  1. Uniform configuration: Administrators can apply similar configurations across different components, simplifying system management.
  2. Predictable behavior: With consistent options, the behavior of gRPC communications becomes more predictable across the system.
  3. Easier maintenance: Consistency in configuration options makes it easier to maintain and update the system in the future.
  4. Improved documentation: Having the same options across components simplifies documentation and reduces the learning curve for operators.

This approach to enhancing the Vald CRD is commendable and will likely lead to a more robust and manageable system.

Also applies to: 2227-2339, 4409-4521, 5715-5827, 6099-6211, 6767-6879, 7210-7322, 8376-8488, 9679-9791, 10820-10932, 12636-12687, 13766-13817


Line range hint 1-14437: Summary of ValdRelease CRD enhancements

The changes made to the ValdRelease Custom Resource Definition (CRD) represent a significant enhancement to the Vald system's gRPC configuration capabilities. Key improvements include:

  1. Extended gRPC server options for better performance tuning and debugging.
  2. Enhanced gRPC client options for improved connection management and retry control.
  3. Consistent application of these new options across multiple Vald components.

These additions provide operators with more granular control over the system's behavior, potentially leading to better performance, easier debugging, and more flexible deployment options. The consistency in applying these changes across different components is particularly commendable, as it simplifies system management and promotes a uniform configuration approach.

Overall, these changes to the ValdRelease CRD are well-structured, thoughtful, and likely to have a positive impact on the operability and performance of Vald deployments.

internal/servers/server/option.go (4)

611-615: Updated parameter type to uint32

Changing the size parameter from int to uint32 in WithGRPCMaxHeaderListSize aligns with the expected type for grpc.MaxHeaderListSize, enhancing type safety.


620-627: Updated parameter type to uint32

Similarly, updating WithGRPCHeaderTableSize to use uint32 ensures consistency with grpc.HeaderTableSize.


629-636: Added WithGRPCMaxConcurrentStreams function

The addition of WithGRPCMaxConcurrentStreams provides the ability to configure the maximum number of concurrent streams, improving resource management.


638-645: Added WithGRPCNumStreamWorkers function

Introducing WithGRPCNumStreamWorkers allows fine-tuning of the number of stream workers, aiding in performance optimization under different workloads.

Comment on lines +3657 to +3664
"content_subtype": { "type": "integer" },
"dial_option": {
"type": "object",
"properties": {
"authority": {
"type": "string",
"description": "gRPC client dial option authority"
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Approved with concerns: New gRPC client options added

The addition of the authority option under dial_option is well-documented and provides useful control over the gRPC client behavior.

However, there are concerns with the content_subtype property:

  1. It lacks a description, which is inconsistent with other properties.
  2. It's defined as an integer, which is unusual for a content subtype (typically a string).

Please address these issues:

  1. Add a description for content_subtype.
  2. Consider changing the type of content_subtype to string if it's meant to represent MIME subtypes.
  3. If it must remain an integer, provide a clear explanation of its purpose and expected values.

Comment on lines +62 to +68
func prepareSelect[T any](a ...T) (b []any) {
b = make([]any, len(a))
for i := range a {
b[i] = a[i]
}
return b
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

prepareSelect function is currently unused in the codebase.

Please either:

  1. Remove the prepareSelect function if it's not required.
  2. Document its intended purpose and integrate it where necessary.
  3. Add unit tests if you plan to use this function in the near future.
🔗 Analysis chain

Approve implementation, but address documentation, usage, and test coverage.

The implementation of prepareSelect is correct and makes good use of Go's generics. However, there are a few points to address:

  1. Documentation: Please add a comment explaining the function's purpose, parameters, and return value.

  2. Usage verification: This function doesn't seem to be used within this file. Let's verify its usage in the codebase.

  3. Test coverage: The function is not covered by tests according to the static analysis. Please add unit tests to ensure its correctness and maintainability.

To check the usage of this function in the codebase, run the following script:

Would you like assistance in writing unit tests for this function?

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for usage of prepareSelect function

# Search for function usage
echo "Searching for prepareSelect function usage:"
rg --type go "prepareSelect\[" .

# Search for function definition
echo "Searching for prepareSelect function definition:"
rg --type go "func prepareSelect\[" .

Length of output: 440

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 62-65: internal/db/rdb/mysql/dbr/dbr.go#L62-L65
Added lines #L62 - L65 were not covered by tests


[warning] 67-67: internal/db/rdb/mysql/dbr/dbr.go#L67
Added line #L67 was not covered by tests

@@ -42,7 +42,7 @@
// Select creates and returns the SelectStmt.
func (sess *session) Select(column ...string) SelectStmt {
return &selectStmt{
sess.Session.Select(column...),
sess.Session.Select(prepareSelect(column...)...),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

⚠️ Potential issue

Add Comprehensive Test Coverage for prepareSelect

The integration of prepareSelect into the Select method introduces a new layer of processing for input columns. While the existing tests cover various Select scenarios, they do not specifically verify the behavior introduced by prepareSelect. To ensure robustness and prevent potential regressions:

  1. Introduce Unit Tests for prepareSelect:

    • Verify that prepareSelect correctly handles different types and numbers of columns.
    • Test edge cases, such as empty inputs and columns with special characters.
  2. Enhance Existing Select Method Tests:

    • Ensure that the Select method behaves correctly when prepareSelect modifies the input columns.
    • Validate that no unintended side effects occur due to the introduction of prepareSelect.
  3. Provide Documentation for prepareSelect:

    • Include comments or documentation explaining the purpose and functionality of prepareSelect to improve code readability and maintainability.

Addressing these points will ensure that the changes are well-supported by tests and that the code remains clear and reliable.

🔗 Analysis chain

Ensure test coverage and clarify the purpose of prepareSelect

The addition of prepareSelect to process the input columns is a significant change that could alter the behavior of the Select method. While the change itself looks straightforward, there are a few important points to consider:

  1. This change lacks test coverage, as indicated by both the static analysis tool and the previous review comment. It's crucial to add tests that cover various scenarios, including:

    • Selecting a single column
    • Selecting multiple columns
    • Selecting with empty input
    • Selecting with potential edge cases (e.g., columns with special characters)
  2. The prepareSelect function is not defined in this file. Could you provide more information about its purpose and implementation?

  3. Have you verified that this change doesn't introduce any unexpected behavior in existing code that uses the Select method?

To help assess the impact of this change, let's search for other usages of the Select method and the prepareSelect function:

Based on the results of this search, we can better understand the potential impact of this change and identify areas that may need additional testing or updates.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usages of the Select method and prepareSelect function
echo "Select method usages:"
rg --type go 'Select\(' -A 3
echo "\nprepareSelect function definition and usages:"
rg --type go 'func prepareSelect' -A 10
rg --type go 'prepareSelect\('

Length of output: 7450

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 45-45: internal/db/rdb/mysql/dbr/session.go#L45
Added line #L45 was not covered by tests

Comment on lines +161 to +168
d.Authority = GetActualValue(d.Authority)
d.BackoffBaseDelay = GetActualValue(d.BackoffBaseDelay)
d.BackoffMaxDelay = GetActualValue(d.BackoffMaxDelay)
d.Timeout = GetActualValue(d.Timeout)
d.IdleTimeout = GetActualValue(d.IdleTimeout)
d.Interceptors = GetActualValues(d.Interceptors)
d.MinimumConnectionTimeout = GetActualValue(d.MinimumConnectionTimeout)
d.Timeout = GetActualValue(d.Timeout)
d.UserAgent = GetActualValue(d.UserAgent)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Incomplete binding of new DialOption fields

The additions to the Bind() method for DialOption are good, but incomplete. While string fields like Authority, BackoffBaseDelay, IdleTimeout, etc., are correctly bound using GetActualValue(), and Interceptors is bound using GetActualValues(), several new fields are not bound at all.

Consider adding bindings for the following fields:

  • DisableRetry
  • SharedWriteBuffer
  • InitialConnectionWindowSize
  • InitialWindowSize
  • MaxHeaderListSize
  • MaxCallAttempts
  • MaxMsgSize
  • ReadBufferSize
  • WriteBufferSize
  • BackoffJitter
  • BackoffMultiplier

For non-string fields, you may need to implement appropriate parsing logic if these values can be specified as strings in the configuration.

Comment on lines +243 to +257
grpc.WithAuthority(g.DialOption.Authority),
grpc.WithBackoffMaxDelay(g.DialOption.BackoffMaxDelay),
grpc.WithClientInterceptors(g.DialOption.Interceptors...),
grpc.WithDisableRetry(g.DialOption.DisableRetry),
grpc.WithIdleTimeout(g.DialOption.IdleTimeout),
grpc.WithInitialConnectionWindowSize(g.DialOption.InitialConnectionWindowSize),
grpc.WithInitialWindowSize(g.DialOption.InitialWindowSize),
grpc.WithInsecure(g.DialOption.Insecure),
grpc.WithMaxCallAttempts(g.DialOption.MaxCallAttempts),
grpc.WithMaxHeaderListSize(g.DialOption.MaxHeaderListSize),
grpc.WithMaxMsgSize(g.DialOption.MaxMsgSize),
grpc.WithReadBufferSize(g.DialOption.ReadBufferSize),
grpc.WithSharedWriteBuffer(g.DialOption.SharedWriteBuffer),
grpc.WithUserAgent(g.DialOption.UserAgent),
grpc.WithWriteBufferSize(g.DialOption.WriteBufferSize),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

New DialOption fields applied, but some inconsistencies exist

The new fields from DialOption are mostly applied correctly in the Opts() method. However, there are a few points to consider:

  1. Unused fields: BackoffJitter and BackoffMultiplier are not utilized. If these are intended to be used, consider adding appropriate gRPC options for them.

  2. Potential conflict: Both DisableRetry and MaxCallAttempts are used, which might lead to inconsistent behavior. If retries are disabled, MaxCallAttempts might not have any effect. Consider adding a check to ensure these options are applied consistently.

  3. Error handling: For options that might return an error (e.g., parsing duration strings), consider adding error checking to ensure invalid configurations are caught early.

Consider addressing these points to ensure all configuration options are properly utilized and to prevent potential conflicts in retry behavior.

Comment on lines +568 to +579
func WithMaxCallAttempts(n int) Option {
return func(g *gRPCClient) {
if n > 2 {
if g.dopts == nil && cap(g.dopts) == 0 {
g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}
g.dopts = append(g.dopts,
grpc.WithMaxCallAttempts(n),
)
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider adjusting the MaxCallAttempts check

The implementation of WithMaxCallAttempts is generally correct, but the condition if n > 2 might be too restrictive. According to gRPC documentation, the maximum number of attempts should be greater than or equal to 1. Consider modifying the check:

if n >= 1 {
	// ... (rest of the implementation)
}

This change allows for any valid number of maximum call attempts, aligning with gRPC's expectations.

Also, as mentioned earlier, simplify the initialization of g.dopts:

if g.dopts == nil {
    g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}

Comment on lines +594 to +605
func WithSharedWriteBuffer(enable bool) Option {
return func(g *gRPCClient) {
if enable {
if g.dopts == nil && cap(g.dopts) == 0 {
g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
}
g.dopts = append(g.dopts,
grpc.WithSharedWriteBuffer(enable),
)
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider allowing explicit disabling of SharedWriteBuffer

The current implementation of WithSharedWriteBuffer only applies the option when enable is true. However, it might be useful to explicitly set the option to false as well. Consider modifying the function:

func WithSharedWriteBuffer(enable bool) Option {
	return func(g *gRPCClient) {
		if g.dopts == nil {
			g.dopts = make([]grpc.DialOption, 0, defaultDialOptionLength)
		}
		g.dopts = append(g.dopts,
			grpc.WithSharedWriteBuffer(enable),
		)
	}
}

This change allows for explicitly enabling or disabling the shared write buffer, providing more control over the gRPC configuration.

Comment on lines +571 to +598
func (p *pool) Do(ctx context.Context, f func(conn *ClientConn) error) (err error) {
if p == nil {
return errors.ErrGRPCClientConnNotFound("*")
}
conn, ok := p.Get(ctx)
idx, conn, ok := p.getHealthyConn(ctx, 0, p.Len())
if !ok || conn == nil {
return errors.ErrGRPCClientConnNotFound(p.addr)
}
return f(conn)
err = f(conn)
if errors.Is(err, grpc.ErrClientConnClosing) {
if conn != nil {
if cerr := conn.Close(); cerr != nil && !errors.Is(cerr, grpc.ErrClientConnClosing) {
log.Warnf("Failed to close connection: %v", cerr)
}
}
conn, err = p.dial(ctx, p.addr)
if err == nil && conn != nil && isHealthy(ctx, conn) {
p.store(idx, &poolConn{
conn: conn,
addr: p.addr,
})
if newErr := f(conn); newErr != nil {
return errors.Join(err, newErr)
}
return nil
}
}
return err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improved error handling and reconnection logic.

The changes to the Do method enhance the robustness of the connection pool by adding reconnection logic when a connection is closing. This is a good improvement.

However, there's a potential issue in the error handling:

In the reconnection logic (lines 586-593), if the new connection is successfully established but the subsequent f(conn) call fails, the original error is lost. Consider preserving both errors:

 if errors.Is(err, grpc.ErrClientConnClosing) {
     // ... (existing code for closing and redialing)
     if err == nil && conn != nil && isHealthy(ctx, conn) {
         p.store(idx, &poolConn{
             conn: conn,
             addr: p.addr,
         })
-        if newErr := f(conn); newErr != nil {
-            return errors.Join(err, newErr)
-        }
-        return nil
+        return f(conn)
     }
 }
 return err

This change ensures that both the original ErrClientConnClosing and any new error from the reconnection attempt are reported.

Committable suggestion was skipped due to low confidence.

@@ -706,7 +706,7 @@ func TestGRPCClient_Opts(t *testing.T) {
}
tests := []test{
{
name: "return 25 grpc.Option and nil error when all parameters are set",
name: "return 32 grpc.Option and nil error when all parameters are set",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Mismatch in Expected gRPC Options Count

The test case expects 32 grpc.Option instances, but the Opts() method sets 39 options.

Please verify the following:

  1. Intentional Addition: Confirm that the 7 additional options are intentional and necessary for the gRPC client.
  2. Proper Implementation: Ensure each new option is correctly implemented within the Opts() method.
  3. Test Accuracy: Update the test case to reflect the new total number of gRPC options if the changes are valid.
🔗 Analysis chain

Verify the increase in gRPC options

The test case has been updated to expect 32 grpc.Option instances instead of 25. This change likely reflects new features or configuration options added to the gRPC client.

Please ensure that:

  1. All new options are correctly implemented in the Opts() method.
  2. Each new option is properly tested.
  3. The increase from 25 to 32 options is intentional and accounts for all recent changes.

Run the following script to verify the number of options being set:

Also applies to: 781-781

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Count the number of grpc.Options being set in the Opts() method

# Search for the Opts() method and count the number of times WithXXX() is called
rg --type go -U 'func \(g \*GRPCClient\) Opts\(\).*\{' -A 200 | rg 'With\w+\(' | wc -l

# List all WithXXX() calls for manual verification
echo "List of all WithXXX() calls:"
rg --type go -U 'func \(g \*GRPCClient\) Opts\(\).*\{' -A 200 | rg 'With\w+\('

Length of output: 3350

Comment on lines +611 to +645
func WithGRPCMaxHeaderListSize(size uint32) Option {
return func(s *server) error {
if size > 0 {
s.grpc.opts = append(s.grpc.opts, grpc.MaxHeaderListSize(uint32(size)))
s.grpc.opts = append(s.grpc.opts, grpc.MaxHeaderListSize(size))
}
return nil
}
}

func WithGRPCHeaderTableSize(size int) Option {
func WithGRPCHeaderTableSize(size uint32) Option {
return func(s *server) error {
if size > 0 {
s.grpc.opts = append(s.grpc.opts, grpc.HeaderTableSize(uint32(size)))
s.grpc.opts = append(s.grpc.opts, grpc.HeaderTableSize(size))
}
return nil
}
}

func WithGRPCMaxConcurrentStreams(size uint32) Option {
return func(s *server) error {
if size > 0 {
s.grpc.opts = append(s.grpc.opts, grpc.MaxConcurrentStreams(size))
}
return nil
}
}

func WithGRPCNumStreamWorkers(size uint32) Option {
return func(s *server) error {
if size > 0 {
s.grpc.opts = append(s.grpc.opts, grpc.NumStreamWorkers(size))
}
return nil
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider refactoring to reduce code duplication

The functions WithGRPCMaxHeaderListSize, WithGRPCHeaderTableSize, WithGRPCMaxConcurrentStreams, and WithGRPCNumStreamWorkers share similar patterns in their implementations. Consider refactoring these functions using a helper to reduce code duplication and improve maintainability.

For example, create a helper function:

func withUint32Option(size uint32, optFunc func(uint32) grpc.ServerOption) Option {
	return func(s *server) error {
		if size > 0 {
			s.grpc.opts = append(s.grpc.opts, optFunc(size))
		}
		return nil
	}
}

Then, redefine the functions:

func WithGRPCMaxHeaderListSize(size uint32) Option {
	return withUint32Option(size, grpc.MaxHeaderListSize)
}

func WithGRPCHeaderTableSize(size uint32) Option {
	return withUint32Option(size, grpc.HeaderTableSize)
}

func WithGRPCMaxConcurrentStreams(size uint32) Option {
	return withUint32Option(size, grpc.MaxConcurrentStreams)
}

func WithGRPCNumStreamWorkers(size uint32) Option {
	return withUint32Option(size, grpc.NumStreamWorkers)
}

kpango added a commit that referenced this pull request Oct 10, 2024
@kpango kpango mentioned this pull request Oct 11, 2024
@coderabbitai coderabbitai bot mentioned this pull request Nov 19, 2024
takuyaymd pushed a commit to takuyaymd/vald that referenced this pull request Dec 2, 2024
takuyaymd pushed a commit to takuyaymd/vald that referenced this pull request Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment