-
Notifications
You must be signed in to change notification settings - Fork 72
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
Refactor index manager service #2505
base: main
Are you sure you want to change the base?
Conversation
Deploying vald with
|
Latest commit: |
63df5f1
|
Status: | ✅ Deploy successful! |
Preview URL: | https://35e8d4fe.vald.pages.dev |
Branch Preview URL: | https://refactor-manager-index-small.vald.pages.dev |
Important Review skippedMore than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review. 22 files out of 79 files are above the max files limit of 50. Please upgrade to Pro plan to get higher limits. You can disable this status message by setting the WalkthroughThe recent changes encompass a variety of updates across multiple files, focusing on dependency upgrades, enhancements to Docker build caching, improvements to Go package management, and modifications to observability and tracing mechanisms. Key updates include upgrading GitHub release actions, adding new RPC methods for index details, updating Go module dependencies, and refining internal structures for better performance and observability. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant GitHubActions
participant Docker
participant GoModules
participant IndexService
User->>GitHubActions: Trigger Release
GitHubActions->>Docker: Build with Cache
Docker->>GoModules: Install Dependencies
User->>IndexService: Request Index Detail
IndexService->>User: Return Index Information
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
[CHATOPS:HELP] ChatOps commands.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2505 +/- ##
==========================================
+ Coverage 18.92% 19.95% +1.03%
==========================================
Files 565 424 -141
Lines 65221 44782 -20439
==========================================
- Hits 12342 8937 -3405
+ Misses 52080 35436 -16644
+ Partials 799 409 -390 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Outside diff range and nitpick comments (2)
apis/proto/v1/payload/payload.proto (1)
526-534
: Add documentation for the new fields in theDetail
message to enhance clarity.apis/docs/v1/docs.md (1)
26-27
: Add a brief description for the new section "Info.Index.Detail".It would enhance the documentation to provide a brief description of what "Info.Index.Detail" covers, similar to other sections.
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (10)
apis/grpc/v1/manager/index/index_manager.pb.go
is excluded by!**/*.pb.go
,!**/*.pb.go
apis/grpc/v1/manager/index/index_manager_vtproto.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/payload/payload.pb.json.go
is excluded by!**/*.pb.json.go
apis/grpc/v1/payload/payload_vtproto.pb.go
is excluded by!**/*.pb.go
,!**/*.pb.go
example/client/go.mod
is excluded by!**/*.mod
example/client/go.sum
is excluded by!**/*.sum
go.mod
is excluded by!**/*.mod
go.sum
is excluded by!**/*.sum
rust/Cargo.lock
is excluded by!**/*.lock
Files selected for processing (42)
- .github/ISSUE_TEMPLATE/bug_report.md (1 hunks)
- .github/ISSUE_TEMPLATE/security_issue_report.md (1 hunks)
- .github/PULL_REQUEST_TEMPLATE.md (1 hunks)
- .github/workflows/release.yml (1 hunks)
- Makefile.d/dependencies.mk (1 hunks)
- Makefile.d/functions.mk (1 hunks)
- apis/docs/v1/docs.md (3 hunks)
- apis/proto/v1/manager/index/index_manager.proto (1 hunks)
- apis/proto/v1/payload/payload.proto (1 hunks)
- apis/swagger/v1/manager/index/index_manager.swagger.json (2 hunks)
- hack/go.mod.default (2 hunks)
- internal/info/info.go (5 hunks)
- internal/net/grpc/errdetails/errdetails.go (2 hunks)
- internal/net/http/metrics/pprof.go (2 hunks)
- internal/observability/trace/status.go (1 hunks)
- pkg/agent/core/faiss/handler/grpc/insert.go (1 hunks)
- pkg/agent/core/faiss/handler/grpc/remove.go (1 hunks)
- pkg/agent/core/faiss/handler/grpc/search.go (1 hunks)
- pkg/agent/core/faiss/handler/grpc/update.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/flush.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/insert.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/linear_search.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/remove.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/search.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/update.go (1 hunks)
- pkg/agent/core/ngt/service/ngt_test.go (5 hunks)
- pkg/manager/index/handler/grpc/handler.go (1 hunks)
- pkg/manager/index/handler/grpc/handler_test.go (1 hunks)
- pkg/manager/index/service/indexer.go (8 hunks)
- pkg/manager/index/service/indexer_test.go (1 hunks)
- pkg/manager/index/service/option.go (4 hunks)
- pkg/manager/index/usecase/indexer.go (1 hunks)
- rust/libs/proto/src/manager.index.v1.tonic.rs (5 hunks)
- rust/libs/proto/src/payload.v1.rs (1 hunks)
- versions/GOLANGCILINT_VERSION (1 hunks)
- versions/K3S_VERSION (1 hunks)
- versions/KIND_VERSION (1 hunks)
- versions/NGT_VERSION (1 hunks)
- versions/PROMETHEUS_STACK_VERSION (1 hunks)
- versions/YQ_VERSION (1 hunks)
- versions/actions/CODECOV_CODECOV_ACTION (1 hunks)
- versions/actions/SOFTPROPS_ACTION_GH_RELEASE (1 hunks)
Files skipped from review due to trivial changes (14)
- .github/ISSUE_TEMPLATE/bug_report.md
- .github/ISSUE_TEMPLATE/security_issue_report.md
- .github/PULL_REQUEST_TEMPLATE.md
- .github/workflows/release.yml
- hack/go.mod.default
- internal/observability/trace/status.go
- versions/GOLANGCILINT_VERSION
- versions/K3S_VERSION
- versions/KIND_VERSION
- versions/NGT_VERSION
- versions/PROMETHEUS_STACK_VERSION
- versions/YQ_VERSION
- versions/actions/CODECOV_CODECOV_ACTION
- versions/actions/SOFTPROPS_ACTION_GH_RELEASE
Additional comments not posted (37)
apis/proto/v1/manager/index/index_manager.proto (1)
35-38
: The addition of theIndexDetail
RPC method is well-defined and aligns with the service's responsibilities.pkg/manager/index/handler/grpc/handler.go (1)
56-65
: The implementation ofIndexDetail
in the gRPC handler is concise and follows good practices with tracing and error handling.Verification successful
The
LoadIndexDetail
method inpkg/manager/index/service/indexer.go
initializes and populates apayload.Info_Index_Detail
object correctly. There is no explicit error handling, but the logic is straightforward and appears to be implemented correctly.
pkg/manager/index/service/indexer.go:356-365
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of `LoadIndexDetail` method in the indexer interface. # Test: Search for the method implementation. Expect: Proper error handling and logic. rg --type go $'LoadIndexDetail'Length of output: 483
Script:
#!/bin/bash # Extract the implementation of the LoadIndexDetail method from indexer.go for review. ast-grep --lang go --pattern $'func (idx *index) LoadIndexDetail() (detail *payload.Info_Index_Detail) { $$$ }' pkg/manager/index/service/indexer.goLength of output: 895
pkg/agent/core/ngt/handler/grpc/flush.go (1)
28-28
: The update to the import path forattribute
aligns with internal observability practices.internal/net/http/metrics/pprof.go (1)
120-143
: The addition of new profiling routes usingpyprof
enhances the profiling capabilities of the service.Verification successful
The search results show the usage of
pyprof
in defining the routes but do not provide information about their integration into the overall profiling setup. We need to verify if these routes are properly initialized and configured.
The previous search command had a syntax error due to an unclosed group. Let's correct the search pattern and re-run the search to find the initialization or configuration code for the
pyprof
routes.
The search results show the usage of
rest.HandlerToRestFunc(pyprof
in defining the routes but do not provide information about their integration into the overall profiling setup. We need to verify if these routes are properly initialized and configured.
The search for
http.HandleFunc
did not produce any output, indicating that the routes might be registered differently. We need to investigate other possible ways the routes might be registered or initialized.
The search results show various instances of route registration and handler usage, but none directly related to the new
pyprof
routes. We need to verify if these routes are properly initialized and configured.
The search results show that
NewPProfHandler
is used ininternal/servers/starter/starter.go
andcmd/tools/cli/benchmark/core/main.go
. We need to verify the usage ofNewPProfHandler
in these files to ensure proper integration of the newpyprof
routes.
The new
pyprof
routes are properly integrated into the profiling setup. TheNewPProfHandler
function, which includes the new routes, is used in bothinternal/servers/starter/starter.go
andcmd/tools/cli/benchmark/core/main.go
, ensuring that the new profiling capabilities are initialized and configured correctly.
internal/servers/starter/starter.go
: TheNewPProfHandler
is used within thesetupMetrics
function to handle profiling routes.cmd/tools/cli/benchmark/core/main.go
: TheNewPProfHandler
is assigned to theHandler
field of an HTTP server, ensuring the routes are served.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the integration of new `pyprof` routes in the profiling setup. # Test: Search for configuration or initialization code that integrates these routes. Expect: Proper integration and configuration. rg --type go $'pyprof'Length of output: 387
Script:
#!/bin/bash # Description: Verify the integration of new `pyprof` routes in the profiling setup. # Test: Search for configuration or initialization code that integrates these routes. Expect: Proper integration and configuration. rg --type go 'rest.HandlerToRestFunc(pyprof'Length of output: 149
Script:
#!/bin/bash # Description: Verify the integration of new `pyprof` routes in the profiling setup. # Test: Search for configuration or initialization code that integrates these routes. Expect: Proper integration and configuration. rg --type go 'rest.HandlerToRestFunc\(pyprof'Length of output: 313
Script:
#!/bin/bash # Description: Verify the integration of new `pyprof` routes in the profiling setup. # Test: Search for configuration or initialization code that integrates these routes. Expect: Proper integration and configuration. rg --type go 'http.HandleFunc'Length of output: 30
Script:
#!/bin/bash # Description: Verify the integration of new `pyprof` routes in the profiling setup. # Test: Search for other common patterns used for route registration. Expect: Proper integration and configuration. rg --type go 'HandleFunc' rg --type go 'Handle'Length of output: 60923
Script:
#!/bin/bash # Description: Verify the integration of new `pyprof` routes in the profiling setup. # Test: Search for the initialization or configuration code that integrates these routes. Expect: Proper integration and configuration. rg --type go 'NewPProfHandler'Length of output: 436
Script:
#!/bin/bash # Description: Review the usage of `NewPProfHandler` in the relevant files to ensure proper integration of the new `pyprof` routes. # Test: Display the relevant lines in `internal/servers/starter/starter.go` and `cmd/tools/cli/benchmark/core/main.go`. rg --type go --context 10 'NewPProfHandler' internal/servers/starter/starter.go rg --type go --context 10 'NewPProfHandler' cmd/tools/cli/benchmark/core/main.goLength of output: 1266
pkg/agent/core/faiss/handler/grpc/remove.go (1)
30-30
: The update to the import path forattribute
aligns with internal observability practices.pkg/agent/core/faiss/handler/grpc/insert.go (1)
31-31
: Import of observability attributes is correctly used for enhanced tracing and logging.pkg/agent/core/faiss/handler/grpc/update.go (1)
30-30
: Import of observability attributes is correctly used for enhanced tracing and logging.pkg/agent/core/faiss/handler/grpc/search.go (1)
30-30
: Import of observability attributes is correctly used for enhanced tracing and logging.apis/swagger/v1/manager/index/index_manager.swagger.json (1)
15-34
: Addition of/index/detail
endpoint andIndexDetail
schema is correctly implemented and enhances the API documentation.Also applies to: 83-105
pkg/manager/index/handler/grpc/handler_test.go (1)
217-326
: Addition ofTest_server_IndexDetail
test function is correctly implemented and enhances the testing coverage.Makefile.d/dependencies.mk (1)
50-51
: The dependency addition and the sed command for updating the Go version ingo/deps
are appropriate and align with the PR's objectives to manage versions more effectively.internal/net/grpc/errdetails/errdetails.go (1)
Line range hint
329-359
: The modifications inDebugInfoFromInfoDetail
enhance error handling by clearing theStackTrace
after use and improving the logging of JSON marshaling errors. These changes align with the PR's objectives to improve observability and error management.pkg/agent/core/ngt/handler/grpc/insert.go (1)
29-29
: The update in the import path for observability attributes aligns with the PR's objectives to consolidate observability-related functionalities within the internal package, enhancing maintainability.pkg/manager/index/service/indexer.go (1)
56-60
: The additions and modifications in theindex
struct and its methods enhance the index management capabilities by introducing more control over index saving operations and improving observability. These changes are well-aligned with the PR's objectives.Also applies to: 69-80, 104-106, 112-116, 151-194, 211-251, 254-287, 344-345, 356-365
internal/info/info.go (4)
51-64
: New fields added to theDetail
struct enhance system observability and debugging capabilities.
144-156
: Updated initialization logic inNew
function correctly handles the new fields in theDetail
struct.
263-268
: UpdatedString
method to include new runtime information fields.
384-392
: Updatedprepare
method to initialize new fields based on runtime information.pkg/agent/core/ngt/handler/grpc/remove.go (1)
29-29
: Importing new observability attributes enhances tracing capabilities.Makefile.d/functions.mk (1)
336-336
: Ensure the conditional logic for settingVERSION
is robust and handles all expectedACTION_NAME
values correctly.Verification successful
The output indicates that the
ACTION_NAME
values are being handled in various conditional statements. Here are the key points:
- The
ACTION_NAME
is checked for specific values likeaquasecurity/trivy-action
,machine-learning-apps/actions-chatops
, andcirrus-actions/rebase
.- There are corresponding actions for these specific
ACTION_NAME
values, such as updating version files and performingsed
operations.To ensure completeness, we need to verify that all possible
ACTION_NAME
values are covered in the conditional logic. This involves checking if there are anyACTION_NAME
values that are used but not handled in the conditional statements.
The previous script failed due to an issue with the grep command's lookbehind assertion. We need to correct this and re-run the script to extract the unique ACTION_NAME values.
The previous attempts to extract ACTION_NAME values using grep did not produce the expected results. We need to adjust our approach to capture these values more effectively. Let's use awk to extract the ACTION_NAME values from the Makefile.
The extracted ACTION_NAME values are:
aquasecurity/trivy-action
cirrus-actions/rebase
security-and-quality
We need to ensure that these values are handled correctly in the conditional logic within the Makefile. Based on the previous context, these values are indeed checked and handled in the conditional statements.
aquasecurity/trivy-action
andcirrus-actions/rebase
are explicitly checked in the conditional logic.security-and-quality
is also checked to ensure it is not equal to the ACTION_NAME.Given this information, it appears that the conditional logic for setting
VERSION
based onACTION_NAME
is robust and handles all expected values correctly.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all ACTION_NAME values are handled correctly in the update-github-actions function. # Test: Search for all ACTION_NAME usages. Expect: All usages should have corresponding handling in the conditional block. rg --type make 'ACTION_NAME' $(fd --type file --name 'functions.mk')Length of output: 1750
Script:
#!/bin/bash # Description: Verify that all ACTION_NAME values are handled correctly in the update-github-actions function. # List all unique ACTION_NAME values used in the Makefile.d/functions.mk rg --type make 'ACTION_NAME' $(fd --type f -e mk) | grep -oP '(?<=ACTION_NAME\s*=\s*")[^"]+' | sort | uniqLength of output: 500
Script:
#!/bin/bash # Description: Verify that all ACTION_NAME values are handled correctly in the update-github-actions function. # List all unique ACTION_NAME values used in the Makefile.d/functions.mk rg --type make 'ACTION_NAME' $(fd --type f -e mk) | grep -oP 'ACTION_NAME\s*=\s*"\K[^"]+' | sort | uniqLength of output: 450
Script:
#!/bin/bash # Description: Verify that all ACTION_NAME values are handled correctly in the update-github-actions function. # List all unique ACTION_NAME values used in the Makefile.d/functions.mk rg --type make 'ACTION_NAME' $(fd --type f -e mk) | awk -F'=' '/ACTION_NAME/ {print $2}' | tr -d ' " ' | sort | uniqLength of output: 675
pkg/agent/core/ngt/handler/grpc/update.go (2)
29-29
: Updated imports for observability are correctly placed and used.
29-29
: Proper use of the updatedUpdate
function withinStreamUpdate
ensures consistency in handling GRPC requests.rust/libs/proto/src/manager.index.v1.tonic.rs (2)
102-102
: Implementation ofindex_info
RPC is robust, utilizing tonic's features effectively.
133-133
: Newindex_detail
RPC implementation is correctly added and aligns with the PR's objectives to enhance API capabilities.pkg/agent/core/ngt/handler/grpc/search.go (1)
29-29
: Ensure the new observability tools are integrated and configured correctly in the deployment environment.pkg/agent/core/ngt/handler/grpc/linear_search.go (6)
29-29
: Updated import for observability attributes aligns with the PR's objectives.
29-29
: Consistent use of updated observability imports across different functions.
29-29
: Consistent observability practices in streaming functions enhance maintainability.
29-29
: Maintaining consistent error handling and observability in ID-based streaming functions.
29-29
: Effective use of concurrency in handling multiple search requests demonstrates good software engineering practices.
29-29
: Consistency in handling ID-based search requests concurrently with other search methods.rust/libs/proto/src/payload.v1.rs (1)
841-853
: The addition of theDetail
message under theIndex
message is well-structured and aligns with the requirements for detailed index information. The use of a map for counts is particularly effective for dynamic data association.apis/docs/v1/docs.md (1)
1182-1185
: Verify the implementation of the new RPC method "IndexDetail".Verification successful
The implementation of the new RPC method "IndexDetail" has been verified successfully. The method is defined and implemented in multiple files, including
pkg/manager/index/service/indexer.go
andpkg/manager/index/handler/grpc/handler.go
.
pkg/manager/index/service/indexer.go
: Contains theLoadIndexDetail
method which is used to load index details.pkg/manager/index/handler/grpc/handler.go
: Implements theIndexDetail
method in theserver
struct, which callsLoadIndexDetail
.Additionally, the method is referenced in various other files, confirming its integration into the codebase.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the new RPC method `IndexDetail`. # Test: Search for the method implementation. Expect: Implementation details. rg --type markdown 'IndexDetail' apis/docs/v1/docs.mdLength of output: 241
Script:
#!/bin/bash # Description: Verify the implementation of the new RPC method `IndexDetail`. # Test: Search for the method implementation in the source code. Expect: Implementation details. rg 'IndexDetail' --type not markdownLength of output: 64
Script:
#!/bin/bash # Description: Verify the implementation of the new RPC method `IndexDetail`. # Test: Search for the method implementation in the source code. Expect: Implementation details. rg 'IndexDetail' --glob '!*.md'Length of output: 3951
pkg/agent/core/ngt/service/ngt_test.go (4)
41-41
: Imports look appropriate for the context.
1559-1560
: Changes to theargs
struct align with enhanced testing capabilities.
1638-1646
: Proper use of client and error handling in the test loop.
Line range hint
2-2
: Verify the initialization and usage ofdefaultConfig
.Verification successful
The
defaultConfig
variable is correctly initialized and used within thepkg/agent/core/ngt/service/ngt_test.go
file.
pkg/agent/core/ngt/service/ngt_test.go
: Initialization and multiple usages ofdefaultConfig
.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the initialization and usage of `defaultConfig`. # Test: Search for the initialization and usage of `defaultConfig`. Expect: Initialization and usage in the same or related files. rg --type go $'defaultConfig'Length of output: 1748
// indexDuration:nil, | ||
// indexDurationLimit:nil, | ||
// saveIndexDurationLimit:nil, | ||
// saveIndexWaitDuration:nil, | ||
// saveIndexTargetAddrCh:nil, | ||
// schMap:nil, | ||
// concurrency:0, | ||
// indexInfos:nil, | ||
// indexing:nil, | ||
// minUncommitted:0, | ||
// uuidsCount:0, | ||
// uncommittedUUIDsCount:0, | ||
// }, | ||
// want: want{}, | ||
// checkFunc: defaultCheckFunc, | ||
// beforeFunc: func(t *testing.T,) { | ||
// t.Helper() | ||
// }, | ||
// afterFunc: func(t *testing.T,) { | ||
// t.Helper() | ||
// }, | ||
// }, | ||
// */ | ||
// | ||
// // TODO test cases | ||
// /* | ||
// func() test { | ||
// return test { | ||
// name: "test_case_2", | ||
// fields: fields { | ||
// client:nil, | ||
// eg:nil, | ||
// creationPoolSize:0, | ||
// indexDuration:nil, | ||
// indexDurationLimit:nil, | ||
// saveIndexDurationLimit:nil, | ||
// saveIndexWaitDuration:nil, | ||
// saveIndexTargetAddrCh:nil, | ||
// schMap:nil, | ||
// concurrency:0, | ||
// indexInfos:nil, | ||
// indexing:nil, | ||
// minUncommitted:0, | ||
// uuidsCount:0, | ||
// uncommittedUUIDsCount:0, | ||
// }, | ||
// want: want{}, | ||
// checkFunc: defaultCheckFunc, | ||
// beforeFunc: func(t *testing.T,) { | ||
// t.Helper() | ||
// }, | ||
// afterFunc: func(t *testing.T,) { | ||
// t.Helper() | ||
// }, | ||
// } | ||
// }(), | ||
// */ | ||
// } | ||
// | ||
// for _, tc := range tests { | ||
// test := tc | ||
// t.Run(test.name, func(tt *testing.T) { | ||
// tt.Parallel() | ||
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) | ||
// if test.beforeFunc != nil { | ||
// test.beforeFunc(tt) | ||
// } | ||
// if test.afterFunc != nil { | ||
// defer test.afterFunc(tt) | ||
// } | ||
// checkFunc := test.checkFunc | ||
// if test.checkFunc == nil { | ||
// checkFunc = defaultCheckFunc | ||
// } | ||
// idx := &index{ | ||
// client: test.fields.client, | ||
// eg: test.fields.eg, | ||
// creationPoolSize: test.fields.creationPoolSize, | ||
// indexDuration: test.fields.indexDuration, | ||
// indexDurationLimit: test.fields.indexDurationLimit, | ||
// saveIndexDurationLimit: test.fields.saveIndexDurationLimit, | ||
// saveIndexWaitDuration: test.fields.saveIndexWaitDuration, | ||
// saveIndexTargetAddrCh: test.fields.saveIndexTargetAddrCh, | ||
// schMap: test.fields.schMap, | ||
// concurrency: test.fields.concurrency, | ||
// indexInfos: test.fields.indexInfos, | ||
// indexing: test.fields.indexing, | ||
// minUncommitted: test.fields.minUncommitted, | ||
// uuidsCount: test.fields.uuidsCount, | ||
// uncommittedUUIDsCount: test.fields.uncommittedUUIDsCount, | ||
// } | ||
// | ||
// gotDetail := idx.LoadIndexDetail() | ||
// if err := checkFunc(test.want, gotDetail); err != nil { | ||
// tt.Errorf("error = %v", err) | ||
// } | ||
// | ||
// }) | ||
// } | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implement the test cases for Test_index_LoadIndexDetail
.
The test function is structured correctly but lacks actual test cases. Would you like assistance in implementing these test cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kpango, here are the proposed test cases for the Test_index_LoadIndexDetail
function. These tests aim to cover various scenarios including successful data retrieval and error handling:
func Test_index_LoadIndexDetail(t *testing.T) {
type fields struct {
client discoverer.Client
eg errgroup.Group
creationPoolSize uint32
indexDuration time.Duration
indexDurationLimit time.Duration
saveIndexDurationLimit time.Duration
saveIndexWaitDuration time.Duration
saveIndexTargetAddrCh chan string
schMap sync.Map[string, any]
concurrency int
indexInfos sync.Map[string, *payload.Info_Index_Count]
indexing atomic.Value
minUncommitted uint32
uuidsCount uint32
uncommittedUUIDsCount uint32
}
type want struct {
wantDetail *payload.Info_Index_Detail
err error
}
tests := []struct {
name string
fields fields
want want
}{
{
name: "test_success",
fields: fields{
// Initialize fields to simulate a successful state
},
want: want{
wantDetail: &payload.Info_Index_Detail{
// Expected details
},
err: nil,
},
},
{
name: "test_error",
fields: fields{
// Initialize fields to simulate an error state
},
want: want{
wantDetail: nil,
err: errors.New("some error"),
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
idx := &index{
client: tt.fields.client,
eg: tt.fields.eg,
creationPoolSize: tt.fields.creationPoolSize,
indexDuration: tt.fields.indexDuration,
indexDurationLimit: tt.fields.indexDurationLimit,
saveIndexDurationLimit: tt.fields.saveIndexDurationLimit,
saveIndexWaitDuration: tt.fields.saveIndexWaitDuration,
saveIndexTargetAddrCh: tt.fields.saveIndexTargetAddrCh,
schMap: tt.fields.schMap,
concurrency: tt.fields.concurrency,
indexInfos: tt.fields.indexInfos,
indexing: tt.fields.indexing,
minUncommitted: tt.fields.minUncommitted,
uuidsCount: tt.fields.uuidsCount,
uncommittedUUIDsCount: tt.fields.uncommittedUUIDsCount,
}
gotDetail, err := idx.LoadIndexDetail()
if !reflect.DeepEqual(gotDetail, tt.want.wantDetail) || !errors.Is(err, tt.want.err) {
t.Errorf("index.LoadIndexDetail() = %v, want %v, error = %v, wantErr %v", gotDetail, tt.want.wantDetail, err, tt.want.err)
}
})
}
}
This template includes two test cases: one for a successful retrieval of index details and another for handling an error scenario. You might need to adjust the field initializations and expected values based on the actual implementation details and requirements.
addr: "127.0.0.1:8080", | ||
client: grpc.New(grpc.WithInsecure(true)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
Ensure grpc.WithInsecure(true)
is used only in test environments.
The search results indicate that grpc.WithInsecure(true)
and similar insecure configurations are used in various parts of the codebase, including non-test files such as pkg/tools/benchmark/job/usecase/benchmarkd.go
, docs/user-guides/filtering-configuration.md
, and example/client/mirror/main.go
. This suggests that insecure configurations might be present outside of test environments.
pkg/tools/benchmark/job/usecase/benchmarkd.go
docs/user-guides/filtering-configuration.md
example/client/mirror/main.go
Please review these instances to ensure that insecure configurations are not used in production code.
Analysis chain
Ensure grpc.WithInsecure(true)
is used only in test environments.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the usage context of `grpc.WithInsecure(true)`.
# Test: Search for the usage of `grpc.WithInsecure(true)`. Expect: Usage only in test files.
rg --type go $'grpc.WithInsecure(true)'
Length of output: 40
Script:
#!/bin/bash
# Description: Verify the usage context of `grpc.WithInsecure(true)`.
# Test: Search for the usage of `grpc.WithInsecure(true)` across all files.
rg 'grpc.WithInsecure(true)'
Length of output: 30
Script:
#!/bin/bash
# Description: Verify the usage context of insecure gRPC configurations.
# Test: Search for the usage of insecure gRPC configurations across all files.
rg 'WithInsecure'
Length of output: 2578
ceec891
to
f007c6e
Compare
d19c157
to
9072d57
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
Outside diff range and nitpick comments (1)
rust/libs/proto/src/payload.v1.rs (1)
841-853
: Ensure the newly added fields inDetail
struct are properly documented.It's good practice to add comments to new fields in a protobuf definition to explain their purpose and usage. This helps maintain clarity and ease of understanding for other developers.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (10)
apis/grpc/v1/manager/index/index_manager.pb.go
is excluded by!**/*.pb.go
,!**/*.pb.go
apis/grpc/v1/manager/index/index_manager_vtproto.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/payload/payload.pb.json.go
is excluded by!**/*.pb.json.go
apis/grpc/v1/payload/payload_vtproto.pb.go
is excluded by!**/*.pb.go
,!**/*.pb.go
example/client/go.mod
is excluded by!**/*.mod
example/client/go.sum
is excluded by!**/*.sum
go.mod
is excluded by!**/*.mod
go.sum
is excluded by!**/*.sum
rust/Cargo.lock
is excluded by!**/*.lock
Files selected for processing (57)
- .gitfiles (3 hunks)
- .github/ISSUE_TEMPLATE/bug_report.md (1 hunks)
- .github/ISSUE_TEMPLATE/security_issue_report.md (1 hunks)
- .github/PULL_REQUEST_TEMPLATE.md (1 hunks)
- .github/actions/docker-build/action.yaml (1 hunks)
- .github/workflows/release.yml (1 hunks)
- Makefile.d/dependencies.mk (1 hunks)
- Makefile.d/docker.mk (1 hunks)
- Makefile.d/functions.mk (1 hunks)
- apis/docs/v1/docs.md (3 hunks)
- apis/proto/v1/manager/index/index_manager.proto (1 hunks)
- apis/proto/v1/payload/payload.proto (1 hunks)
- apis/swagger/v1/manager/index/index_manager.swagger.json (2 hunks)
- dockers/tools/benchmark/job/Dockerfile (1 hunks)
- hack/go.mod.default (2 hunks)
- internal/info/info.go (5 hunks)
- internal/net/grpc/errdetails/errdetails.go (2 hunks)
- internal/net/http/metrics/pprof.go (2 hunks)
- internal/observability/trace/status.go (1 hunks)
- pkg/agent/core/faiss/handler/grpc/insert.go (1 hunks)
- pkg/agent/core/faiss/handler/grpc/remove.go (1 hunks)
- pkg/agent/core/faiss/handler/grpc/search.go (1 hunks)
- pkg/agent/core/faiss/handler/grpc/update.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/flush.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/insert.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/linear_search.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/remove.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/search.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/update.go (1 hunks)
- pkg/agent/core/ngt/service/ngt_test.go (5 hunks)
- pkg/manager/index/handler/grpc/handler.go (1 hunks)
- pkg/manager/index/handler/grpc/handler_test.go (1 hunks)
- pkg/manager/index/service/indexer.go (8 hunks)
- pkg/manager/index/service/indexer_test.go (1 hunks)
- pkg/manager/index/service/option.go (4 hunks)
- pkg/manager/index/usecase/indexer.go (1 hunks)
- rust/libs/proto/src/manager.index.v1.tonic.rs (5 hunks)
- rust/libs/proto/src/payload.v1.rs (1 hunks)
- versions/GOLANGCILINT_VERSION (1 hunks)
- versions/HDF5_VERSION (1 hunks)
- versions/HELM_VERSION (1 hunks)
- versions/JAEGER_OPERATOR_VERSION (1 hunks)
- versions/K3S_VERSION (1 hunks)
- versions/KIND_VERSION (1 hunks)
- versions/KUBECTL_VERSION (1 hunks)
- versions/NGT_VERSION (1 hunks)
- versions/PROMETHEUS_STACK_VERSION (1 hunks)
- versions/PROTOBUF_VERSION (1 hunks)
- versions/YQ_VERSION (1 hunks)
- versions/actions/ACTIONS_CHECKOUT (1 hunks)
- versions/actions/CODECOV_CODECOV_ACTION (1 hunks)
- versions/actions/DOCKER_LOGIN_ACTION (1 hunks)
- versions/actions/GITHUB_CODEQL_ACTION_ANALYZE (1 hunks)
- versions/actions/GITHUB_CODEQL_ACTION_AUTOBUILD (1 hunks)
- versions/actions/GITHUB_CODEQL_ACTION_INIT (1 hunks)
- versions/actions/GITHUB_CODEQL_ACTION_UPLOAD_SARIF (1 hunks)
- versions/actions/GITHUB_ISSUE_METRICS (1 hunks)
Files not processed due to max files limit (1)
- versions/actions/SOFTPROPS_ACTION_GH_RELEASE
Files skipped from review due to trivial changes (24)
- .github/ISSUE_TEMPLATE/bug_report.md
- .github/ISSUE_TEMPLATE/security_issue_report.md
- .github/PULL_REQUEST_TEMPLATE.md
- .github/workflows/release.yml
- pkg/agent/core/ngt/handler/grpc/remove.go
- versions/GOLANGCILINT_VERSION
- versions/HDF5_VERSION
- versions/HELM_VERSION
- versions/JAEGER_OPERATOR_VERSION
- versions/K3S_VERSION
- versions/KIND_VERSION
- versions/KUBECTL_VERSION
- versions/NGT_VERSION
- versions/PROMETHEUS_STACK_VERSION
- versions/PROTOBUF_VERSION
- versions/YQ_VERSION
- versions/actions/ACTIONS_CHECKOUT
- versions/actions/CODECOV_CODECOV_ACTION
- versions/actions/DOCKER_LOGIN_ACTION
- versions/actions/GITHUB_CODEQL_ACTION_ANALYZE
- versions/actions/GITHUB_CODEQL_ACTION_AUTOBUILD
- versions/actions/GITHUB_CODEQL_ACTION_INIT
- versions/actions/GITHUB_CODEQL_ACTION_UPLOAD_SARIF
- versions/actions/GITHUB_ISSUE_METRICS
Additional context used
Hadolint
dockers/tools/benchmark/job/Dockerfile
[warning] 50-50: Use WORKDIR to switch to a directory
[warning] 50-50: Pin versions in apt get install. Instead of
apt-get install <package>
useapt-get install <package>=<version>
Markdownlint
apis/docs/v1/docs.md
1193-1193: null
Bare URL used
1199-1199: null
Bare URL used
1352-1352: null
Bare URL used
1438-1438: null
Bare URL used
1254-1254: null
Spaces inside emphasis markers
1254-1254: null
Spaces inside emphasis markers
1258-1258: null
Spaces inside emphasis markers
1258-1258: null
Spaces inside emphasis markers
627-627: null
Link fragments should be valid
671-671: null
Link fragments should be valid
682-682: null
Link fragments should be valid
693-693: null
Link fragments should be valid
704-704: null
Link fragments should be valid
832-832: null
Link fragments should be valid
928-928: null
Link fragments should be valid
1462-1462: null
Link fragments should be valid
1438-1438: Missing link or image reference definition: "google.rpc.code.permission_denied"
Reference links and images should use a label that is defined
Additional comments not posted (38)
apis/proto/v1/manager/index/index_manager.proto (1)
35-38
: The addition of theIndexDetail
RPC method is correctly implemented with appropriate HTTP annotations.pkg/manager/index/handler/grpc/handler.go (1)
57-64
: The implementation of theIndexDetail
method in the gRPC handler is consistent with the proto definition and correctly uses theLoadIndexDetail
method from theIndexer
interface.pkg/agent/core/ngt/handler/grpc/flush.go (1)
28-28
: The update of the import path for theattribute
package is correctly implemented.internal/net/http/metrics/pprof.go (1)
120-143
: The addition of new pprof routes for delta profiles is correctly implemented using thepyprof
package.pkg/agent/core/faiss/handler/grpc/remove.go (1)
30-30
: Updated import for observability attributes aligns with internal package usage.Verification successful
The new import
github.com/vdaas/vald/internal/observability/attribute
is present in the file, but we need to ensure it is actually used in the code. Let's verify its usage within the file.
The new import
github.com/vdaas/vald/internal/observability/attribute
is used in the file, confirming the change is correctly implemented.
pkg/agent/core/faiss/handler/grpc/remove.go
:var attrs []attribute.KeyValue
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the new attribute import is used consistently in the file. # Test: Search for the old attribute import usage. Expect: No occurrences. rg --type go 'go.opentelemetry.io/otel/attribute' pkg/agent/core/faiss/handler/grpc/remove.goLength of output: 93
Script:
#!/bin/bash # Description: Verify that the new attribute import is used consistently in the file. # Test: Search for the new attribute import usage. Expect: At least one occurrence. rg --type go 'github.com/vdaas/vald/internal/observability/attribute' pkg/agent/core/faiss/handler/grpc/remove.goLength of output: 171
Script:
#!/bin/bash # Description: Verify the usage of the new attribute import in the file. # Test: Search for the usage of the new attribute import. Expect: At least one occurrence. rg --type go 'attribute\.' pkg/agent/core/faiss/handler/grpc/remove.goLength of output: 105
pkg/agent/core/faiss/handler/grpc/insert.go (1)
31-31
: Updated import for observability attributes aligns with internal package usage.Verification successful
The new import
github.com/vdaas/vald/internal/observability/attribute
is present in the file, but we need to ensure it is actually being used. Let's verify its usage within the file.
The new import
github.com/vdaas/vald/internal/observability/attribute
is being used in the file, as evidenced by the occurrence ofattribute.KeyValue
.
pkg/agent/core/faiss/handler/grpc/insert.go
:var attrs []attribute.KeyValue
This confirms that the new import is correctly integrated and utilized in the file.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the new attribute import is used consistently in the file. # Test: Search for the old attribute import usage. Expect: No occurrences. rg --type go 'go.opentelemetry.io/otel/attribute' pkg/agent/core/faiss/handler/grpc/insert.goLength of output: 93
Script:
#!/bin/bash # Description: Verify that the new attribute import is used consistently in the file. # Test: Search for the new attribute import usage. Expect: Occurrences of the new import. rg --type go 'github.com/vdaas/vald/internal/observability/attribute' pkg/agent/core/faiss/handler/grpc/insert.goLength of output: 171
Script:
#!/bin/bash # Description: Verify the usage of the new attribute import in the file. # Test: Search for the usage of the new attribute import. Expect: Occurrences of the new import being used. rg --type go 'attribute\.' pkg/agent/core/faiss/handler/grpc/insert.goLength of output: 105
internal/observability/trace/status.go (1)
22-22
: Updated import for observability attributes aligns with internal package usage.Verification successful
The new attribute import is present in the file, but we need to ensure it is actually being used. Let's verify the usage of the
attribute
package within the file.
The new attribute import is being used consistently throughout the file.
- The
attribute
package is used in type definitions and multiple functions.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the new attribute import is used consistently in the file. # Test: Search for the old attribute import usage. Expect: No occurrences. rg --type go 'go.opentelemetry.io/otel/attribute' internal/observability/trace/status.goLength of output: 88
Script:
#!/bin/bash # Description: Verify that the new attribute import is used consistently in the file. # Test: Search for the new attribute import usage. Expect: At least one occurrence. rg --type go 'github.com/vdaas/vald/internal/observability/attribute' internal/observability/trace/status.goLength of output: 166
Script:
#!/bin/bash # Description: Verify the usage of the new attribute import in the file. # Test: Search for the usage of the attribute package. Expect: At least one occurrence. rg --type go 'attribute\.' internal/observability/trace/status.goLength of output: 1805
.github/actions/docker-build/action.yaml (1)
116-120
: Enhanced Docker build options with additional labels improve metadata for images.pkg/agent/core/faiss/handler/grpc/update.go (1)
30-30
: Updated import for observability attributes aligns with internal package usage.Verification successful
The new import
github.com/vdaas/vald/internal/observability/attribute
is correctly used in the file.
pkg/agent/core/faiss/handler/grpc/update.go
: Line containingvar attrs []attribute.KeyValue
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the new attribute import is used consistently in the file. # Test: Search for the old attribute import usage. Expect: No occurrences. rg --type go 'go.opentelemetry.io/otel/attribute' pkg/agent/core/faiss/handler/grpc/update.goLength of output: 93
Script:
#!/bin/bash # Description: Verify that the new attribute import is used correctly in the file. # Test: Search for the usage of the new attribute import. rg --type go 'github.com/vdaas/vald/internal/observability/attribute' pkg/agent/core/faiss/handler/grpc/update.goLength of output: 171
Script:
#!/bin/bash # Description: Verify that the new attribute import is used in the file. # Test: Search for the usage of the `attribute` package within the file. rg --type go 'attribute\.' pkg/agent/core/faiss/handler/grpc/update.goLength of output: 105
apis/swagger/v1/manager/index/index_manager.swagger.json (2)
83-105
: New definitionIndexDetail
added to Swagger, enhancing API documentation for index details.
15-34
: New endpoint/index/detail
correctly added to the Swagger configuration.Verification successful
The new endpoint
/index/detail
is implemented in the Go backend.
pkg/manager/index/handler/grpc/handler.go
: TheIndexDetail
method is defined and implemented.pkg/manager/index/service/indexer.go
: TheLoadIndexDetail
method is used to load the index details.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the new endpoint integration with the backend. # Test: Search for the endpoint implementation in Go files. Expect: At least one occurrence. rg --type go '/index/detail'Length of output: 28
Script:
#!/bin/bash # Description: Verify the new endpoint integration with the backend by searching for related terms. # Test: Search for the implementation of the endpoint using related terms. rg --type go 'IndexDetail' rg --type go 'Index_IndexDetail'Length of output: 3240
Makefile.d/docker.mk (1)
49-51
: Enhanced Docker build caching options added, which should improve build performance and reliability.Makefile.d/dependencies.mk (1)
50-51
: LGTM! The addition ofupdate/go
ensures that the Go version is updated before other dependencies are installed, which is a good practice.internal/net/grpc/errdetails/errdetails.go (1)
Line range hint
329-359
: The updates toDebugInfoFromInfoDetail
enhance error handling by clearing the stack trace after processing and providing detailed fallback information when JSON marshaling fails. This is crucial for robust error reporting.pkg/agent/core/ngt/handler/grpc/insert.go (1)
29-29
: Updated import paths to use internal observability attributes.pkg/manager/index/service/indexer.go (2)
46-47
: Refactored to enhance index management with added methods and fields for save index durations and concurrency.Also applies to: 56-63, 69-80, 104-116, 112-116, 127-198, 211-251, 254-287
356-365
: Enhanced method to load index details.internal/info/info.go (1)
51-64
: EnhancedDetail
struct with additional runtime information fields and updated methods to handle these enhancements.Also applies to: 144-156, 185-185, 193-193, 384-392
pkg/agent/core/ngt/handler/grpc/update.go (1)
29-29
: Updated import paths for observability attributes.This change aligns with the broader observability package changes mentioned in the PR summary.
rust/libs/proto/src/manager.index.v1.tonic.rs (2)
102-102
: Added new RPC methods for index information retrieval.The addition of
index_info
andindex_detail
methods enhances the functionality of the IndexClient by allowing retrieval of index counts and detailed index information per agent.Also applies to: 131-131
322-322
: Implemented server-side handling for the newindex_detail
RPC.This ensures that the server can appropriately respond to requests for detailed index information, aligning with the new client-side capabilities.
apis/proto/v1/payload/payload.proto (1)
526-534
: LGTM! The additions to theInfo.Index.Detail
message enhance the detail level of index information, aligning with the PR's objectives.pkg/agent/core/ngt/handler/grpc/search.go (1)
29-29
: LGTM! The addition of observability and tracing packages enhances the functionality and maintainability of the search operations.pkg/agent/core/ngt/handler/grpc/linear_search.go (1)
29-29
: Updated import path for observability attributes aligns with internal package restructuring.hack/go.mod.default (1)
332-344
: Updated Kubernetes-related packages to v1.30.1 and controller-runtime to v0.18.3..gitfiles (3)
231-231
: New documentation asset added for read-replica and rotator architecture.
599-599
: New user guide added for read-replica and rotator system.
1825-1832
: New Rust handler files added for various operations, enhancing the system's functionality.apis/docs/v1/docs.md (6)
299-319
: Ensure consistency in terminology and grammar in the new table entries.- count infos for each agents + count information for each agent - index replica of vald cluster + index replica of the Vald cluster - live agent replica of vald cluster + live agent replica of the Vald cluster
1185-1185
: Ensure the description uses singular form for consistency.- Represent the RPC to get the index information for each agents. + Represent the RPC to get the index information for each agent.
Line range hint
627-627
: Verify the validity of link fragments to ensure they correctly point to the intended sections.Also applies to: 671-671, 682-682, 693-693, 704-704, 832-832, 928-928, 1462-1462
Verification successful
The grep command successfully found all the anchor tags corresponding to the flagged link fragments in the
apis/docs/v1/docs.md
file. This indicates that the link fragments are valid and correctly point to the intended sections.
- : The link fragments in the
apis/docs/v1/docs.md
file are valid and correctly point to the intended sections.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for the existence of anchor tags corresponding to the flagged link fragments. grep -E '<a name="payload-v1-Info-Annotations-AnnotationsEntry"></a>|<a name="payload-v1-Info-CPU"></a>|<a name="payload-v1-Info-IPs"></a>|<a name="payload-v1-Info-Index-UUID-Committed"></a>|<a name="payload-v1-Info-Index-UUID-Uncommitted"></a>|<a name="payload-v1-Info-Labels-LabelsEntry"></a>|<a name="payload-v1-Info-Memory"></a>|<a name="payload-v1-Info-Node"></a>' apis/docs/v1/docs.mdLength of output: 752
Line range hint
1438-1438
: Add a missing link reference definition for "google.rpc.code.permission_denied" to ensure the document is complete and navigable.+ [google.rpc.code.permission_denied]: https://example.com/path/to/definition
Line range hint
1193-1193
: Convert bare URLs to Markdown links for better readability and to avoid direct exposure of URLs.- https://www.apache.org/licenses/LICENSE-2.0 + [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)Also applies to: 1199-1199, 1352-1352, 1438-1438
Line range hint
1254-1254
: Remove unnecessary spaces inside emphasis markers to maintain Markdown formatting standards.- * google.rpc.Code.PERMISSION_DENIED * + *google.rpc.Code.PERMISSION_DENIED*Also applies to: 1258-1258
pkg/agent/core/ngt/service/ngt_test.go (4)
41-41
: LGTM! Import statements are appropriate for the context.
Line range hint
2-2
: LGTM! Declaration ofdefaultConfig
appears standard.
1559-1560
: LGTM! Addition ofaddr
andclient
fields toargs
struct is appropriate.
1638-1646
: LGTM! Proper use of gRPC client and error handling in the loop.
@@ -333,14 +333,12 @@ define gen-vald-crd | |||
endef | |||
|
|||
define update-github-actions | |||
@for ACTION_NAME in $1; do \ | |||
@set -e; for ACTION_NAME in $1; do \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure robust error handling in the update-github-actions
function.
Consider adding error handling for the curl
command to manage scenarios where the GitHub API might be unreachable or return an unexpected response. This will prevent the script from failing silently or behaving unpredictably.
@@ -27,8 +27,8 @@ import ( | |||
"github.com/vdaas/vald/internal/log" | |||
"github.com/vdaas/vald/internal/net/grpc/errdetails" | |||
"github.com/vdaas/vald/internal/net/grpc/status" | |||
"github.com/vdaas/vald/internal/observability/attribute" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The old import path go.opentelemetry.io/otel/attribute
is still actively used in internal/observability/attribute/attribute.go
. This indicates that the transition to the new import path is incomplete.
internal/observability/attribute/attribute.go
: The old import pathgo.opentelemetry.io/otel/attribute
is still in use.
Please update the references to use the new import path github.com/vdaas/vald/internal/observability/attribute
to ensure consistency across the project.
Analysis chain
Updated import path for observability attributes aligns with internal project standards.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the new import is used consistently across the project.
# Test: Search for the old import path. Expect: No occurrences.
rg --type go 'go.opentelemetry.io/otel/attribute'
Length of output: 139
Script:
#!/bin/bash
# Description: Inspect the usage of the old import path in the specified file.
# Test: Search for the usage of `go.opentelemetry.io/otel/attribute` in `internal/observability/attribute/attribute.go`.
rg 'go.opentelemetry.io/otel/attribute' internal/observability/attribute/attribute.go
Length of output: 129
Script:
#!/bin/bash
# Description: Check for references to `attribute` within the specified file.
# Test: Search for references to `attribute` in `internal/observability/attribute/attribute.go`.
rg 'attribute' internal/observability/attribute/attribute.go
Length of output: 301
WithMinUncommitted(100), | ||
WithCreationPoolSize(10000), | ||
} | ||
|
||
func WithIndexingConcurrency(c int) Option { | ||
return func(idx *index) error { | ||
if c != 0 { | ||
idx.concurrency = c | ||
idx.createIndexConcurrency = c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The search results confirm that the unit tests for the new option functions are commented out and not currently active. This means that the functionality of these option functions is not being verified through tests.
pkg/manager/index/service/option_test.go
pkg/index/job/creation/service/options_test.go
These files contain commented-out test functions for the new options. It is crucial to uncomment and complete these tests to ensure the new option functions are properly tested.
Analysis chain
The option functions are correctly implemented with appropriate checks and error handling. Ensure that the unit tests for these functions are implemented to verify their functionality.
Also applies to: 47-50, 56-65, 70-79, 84-93
The search results indicate that the unit tests for the new option functions are commented out. We need to verify the content and status of these tests to ensure they are implemented and active.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify if unit tests exist for the new option functions.
# Test: Search for unit tests related to the option functions. Expect: Tests that cover various input scenarios.
rg --type go $'TestWithIndexingConcurrency|TestWithSaveConcurrency|TestWithIndexingDuration|TestWithIndexingDurationLimit|TestWithSaveIndexDurationLimit'
Length of output: 627
Script:
#!/bin/bash
# Description: Check the content and status of the unit tests in the identified files.
# Test: Display the content of the relevant test functions to verify if they are commented out or active.
rg --type go --context 10 $'func TestWithIndexingConcurrency|func TestWithSaveConcurrency|func TestWithIndexingDuration|func TestWithIndexingDurationLimit|func TestWithSaveIndexDurationLimit' pkg/manager/index/service/option_test.go pkg/index/job/creation/service/options_test.go
Length of output: 6832
&& curl -fsSLO https://github.com/HDFGroup/hdf5/releases/download/${HDF5_VERSION}/hdf5.tar.gz \ | ||
&& tar -xzvf hdf5.tar.gz -C hdf5 --strip-components 2 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The addition of the HDF5 installation steps is correctly implemented. Consider addressing the Hadolint warnings:
- Use WORKDIR to switch to directories instead of using
cd
. - Pin versions in
apt-get install
to ensure reproducibility.
- RUN apt-get update && apt-get install -y --no-install-recommends \
+ RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates=20210119 \
Committable suggestion was skipped due low confidence.
9072d57
to
11731ab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (10)
apis/grpc/v1/manager/index/index_manager.pb.go
is excluded by!**/*.pb.go
,!**/*.pb.go
apis/grpc/v1/manager/index/index_manager_vtproto.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/payload/payload.pb.json.go
is excluded by!**/*.pb.json.go
apis/grpc/v1/payload/payload_vtproto.pb.go
is excluded by!**/*.pb.go
,!**/*.pb.go
example/client/go.mod
is excluded by!**/*.mod
example/client/go.sum
is excluded by!**/*.sum
go.mod
is excluded by!**/*.mod
go.sum
is excluded by!**/*.sum
rust/Cargo.lock
is excluded by!**/*.lock
Files selected for processing (57)
- .gitfiles (3 hunks)
- .github/ISSUE_TEMPLATE/bug_report.md (1 hunks)
- .github/ISSUE_TEMPLATE/security_issue_report.md (1 hunks)
- .github/PULL_REQUEST_TEMPLATE.md (1 hunks)
- .github/actions/docker-build/action.yaml (1 hunks)
- .github/workflows/release.yml (1 hunks)
- Makefile.d/dependencies.mk (1 hunks)
- Makefile.d/docker.mk (1 hunks)
- Makefile.d/functions.mk (1 hunks)
- apis/docs/v1/docs.md (3 hunks)
- apis/proto/v1/manager/index/index_manager.proto (1 hunks)
- apis/proto/v1/payload/payload.proto (1 hunks)
- apis/swagger/v1/manager/index/index_manager.swagger.json (2 hunks)
- dockers/tools/benchmark/job/Dockerfile (1 hunks)
- hack/go.mod.default (2 hunks)
- internal/info/info.go (5 hunks)
- internal/net/grpc/errdetails/errdetails.go (2 hunks)
- internal/net/http/metrics/pprof.go (2 hunks)
- internal/observability/trace/status.go (1 hunks)
- internal/tls/tls.go (1 hunks)
- pkg/agent/core/faiss/handler/grpc/insert.go (1 hunks)
- pkg/agent/core/faiss/handler/grpc/remove.go (1 hunks)
- pkg/agent/core/faiss/handler/grpc/search.go (1 hunks)
- pkg/agent/core/faiss/handler/grpc/update.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/flush.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/insert.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/linear_search.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/remove.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/search.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/update.go (1 hunks)
- pkg/agent/core/ngt/service/ngt_test.go (5 hunks)
- pkg/manager/index/handler/grpc/handler.go (1 hunks)
- pkg/manager/index/handler/grpc/handler_test.go (1 hunks)
- pkg/manager/index/service/indexer.go (8 hunks)
- pkg/manager/index/service/indexer_test.go (1 hunks)
- pkg/manager/index/service/option.go (4 hunks)
- pkg/manager/index/usecase/indexer.go (1 hunks)
- rust/libs/proto/src/manager.index.v1.tonic.rs (5 hunks)
- rust/libs/proto/src/payload.v1.rs (1 hunks)
- versions/GOLANGCILINT_VERSION (1 hunks)
- versions/HDF5_VERSION (1 hunks)
- versions/HELM_VERSION (1 hunks)
- versions/JAEGER_OPERATOR_VERSION (1 hunks)
- versions/K3S_VERSION (1 hunks)
- versions/KIND_VERSION (1 hunks)
- versions/KUBECTL_VERSION (1 hunks)
- versions/NGT_VERSION (1 hunks)
- versions/PROMETHEUS_STACK_VERSION (1 hunks)
- versions/PROTOBUF_VERSION (1 hunks)
- versions/YQ_VERSION (1 hunks)
- versions/actions/ACTIONS_CHECKOUT (1 hunks)
- versions/actions/CODECOV_CODECOV_ACTION (1 hunks)
- versions/actions/DOCKER_LOGIN_ACTION (1 hunks)
- versions/actions/GITHUB_CODEQL_ACTION_ANALYZE (1 hunks)
- versions/actions/GITHUB_CODEQL_ACTION_AUTOBUILD (1 hunks)
- versions/actions/GITHUB_CODEQL_ACTION_INIT (1 hunks)
- versions/actions/GITHUB_CODEQL_ACTION_UPLOAD_SARIF (1 hunks)
Files not processed due to max files limit (2)
- versions/actions/GITHUB_ISSUE_METRICS
- versions/actions/SOFTPROPS_ACTION_GH_RELEASE
Files skipped from review as they are similar to previous changes (53)
- .gitfiles
- .github/ISSUE_TEMPLATE/bug_report.md
- .github/ISSUE_TEMPLATE/security_issue_report.md
- .github/PULL_REQUEST_TEMPLATE.md
- .github/actions/docker-build/action.yaml
- .github/workflows/release.yml
- Makefile.d/dependencies.mk
- Makefile.d/docker.mk
- Makefile.d/functions.mk
- apis/proto/v1/manager/index/index_manager.proto
- apis/proto/v1/payload/payload.proto
- apis/swagger/v1/manager/index/index_manager.swagger.json
- hack/go.mod.default
- internal/info/info.go
- internal/net/http/metrics/pprof.go
- internal/observability/trace/status.go
- pkg/agent/core/faiss/handler/grpc/insert.go
- pkg/agent/core/faiss/handler/grpc/remove.go
- pkg/agent/core/faiss/handler/grpc/search.go
- pkg/agent/core/faiss/handler/grpc/update.go
- pkg/agent/core/ngt/handler/grpc/flush.go
- pkg/agent/core/ngt/handler/grpc/insert.go
- pkg/agent/core/ngt/handler/grpc/linear_search.go
- pkg/agent/core/ngt/handler/grpc/remove.go
- pkg/agent/core/ngt/handler/grpc/search.go
- pkg/agent/core/ngt/handler/grpc/update.go
- pkg/agent/core/ngt/service/ngt_test.go
- pkg/manager/index/handler/grpc/handler.go
- pkg/manager/index/handler/grpc/handler_test.go
- pkg/manager/index/service/indexer.go
- pkg/manager/index/service/indexer_test.go
- pkg/manager/index/service/option.go
- pkg/manager/index/usecase/indexer.go
- rust/libs/proto/src/manager.index.v1.tonic.rs
- rust/libs/proto/src/payload.v1.rs
- versions/GOLANGCILINT_VERSION
- versions/HDF5_VERSION
- versions/HELM_VERSION
- versions/JAEGER_OPERATOR_VERSION
- versions/K3S_VERSION
- versions/KIND_VERSION
- versions/KUBECTL_VERSION
- versions/NGT_VERSION
- versions/PROMETHEUS_STACK_VERSION
- versions/PROTOBUF_VERSION
- versions/YQ_VERSION
- versions/actions/ACTIONS_CHECKOUT
- versions/actions/CODECOV_CODECOV_ACTION
- versions/actions/DOCKER_LOGIN_ACTION
- versions/actions/GITHUB_CODEQL_ACTION_ANALYZE
- versions/actions/GITHUB_CODEQL_ACTION_AUTOBUILD
- versions/actions/GITHUB_CODEQL_ACTION_INIT
- versions/actions/GITHUB_CODEQL_ACTION_UPLOAD_SARIF
Additional context used
Hadolint
dockers/tools/benchmark/job/Dockerfile
[warning] 50-50: Use WORKDIR to switch to a directory
[warning] 50-50: Pin versions in apt get install. Instead of
apt-get install <package>
useapt-get install <package>=<version>
Markdownlint
apis/docs/v1/docs.md
1193-1193: null
Bare URL used
1199-1199: null
Bare URL used
1352-1352: null
Bare URL used
1438-1438: null
Bare URL used
1254-1254: null
Spaces inside emphasis markers
1254-1254: null
Spaces inside emphasis markers
1258-1258: null
Spaces inside emphasis markers
1258-1258: null
Spaces inside emphasis markers
627-627: null
Link fragments should be valid
671-671: null
Link fragments should be valid
682-682: null
Link fragments should be valid
693-693: null
Link fragments should be valid
704-704: null
Link fragments should be valid
832-832: null
Link fragments should be valid
928-928: null
Link fragments should be valid
1462-1462: null
Link fragments should be valid
1438-1438: Missing link or image reference definition: "google.rpc.code.permission_denied"
Reference links and images should use a label that is defined
Additional comments not posted (6)
internal/tls/tls.go (1)
114-120
: Reordered logic inNewX509CertPool
to use system cert pool first is a good practice for broader compatibility.dockers/tools/benchmark/job/Dockerfile (1)
71-72
: Consider addressing the Hadolint warnings:
- Use WORKDIR to switch to directories instead of using
cd
.- Pin versions in
apt-get install
to ensure reproducibility.internal/net/grpc/errdetails/errdetails.go (1)
Line range hint
329-359
: The modification inDebugInfoFromInfoDetail
to clear theStackTrace
after processing could impact other system components that rely on this data. Please verify this change does not affect other functionalities.apis/docs/v1/docs.md (3)
26-27
: The addition of theInfo.Index.Detail
andInfo.Index.Detail.CountsEntry
sections enhances the documentation by providing detailed index information. Ensure all related code and API endpoints are updated to reflect these changes.
299-319
: Ensure consistency in terminology and grammar in the new table entries. The previous comments bycoderabbitai[bot]
are still valid and should be applied.- count infos for each agents + count information for each agent - index replica of vald cluster + index replica of the Vald cluster - live agent replica of vald cluster + live agent replica of the Vald cluster
311-319
: TheInfo.Index.Detail.CountsEntry
section is well-structured and provides clear information on the index counts. Ensure that the implementation aligns with this documentation.
ac96628
to
c9e4c92
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 11
Outside diff range and nitpick comments (6)
pkg/manager/index/service/indexer.go (1)
104-106
: The use ofmath.MaxInt64
as a default value for durations ensures that the indexer operates continuously unless configured otherwise. However, consider adding a comment to explain whyMaxInt64
is used here, as it might not be immediately clear to other developers or future maintainers.Also applies to: 112-116
pkg/agent/core/ngt/handler/grpc/update.go (2)
29-29
: Import optimization needed.Consider grouping imports from the same repository to improve readability and maintain consistency across the codebase.
29-29
: Update observability tooling.The change in observability imports (
attribute
andtrace
) suggests a shift in the observability framework. Consider reviewing and updating the observability strategy across all services to ensure consistency and effectiveness.rust/libs/proto/src/vald.v1.tonic.rs (3)
Line range hint
1-1
: Thesearch_client
module is implemented with a comprehensive set of functionalities for search operations, including standard and streaming methods. Consider adding more detailed inline documentation for each method to enhance maintainability and clarity.
Line range hint
1-1
: Theupdate_client
andupdate_server
modules are consistent in their method naming and structure. However, consider unifying the approach to handling errors across all methods to ensure consistency and predictability for the API consumers.
Line range hint
1-1
: Theupsert_client
andupsert_server
modules provide essential functionalities that combine update and insert operations. Ensure that the documentation clearly differentiates between upsert and the individual insert or update operations to avoid confusion.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (23)
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/manager/index/index_manager.pb.go
is excluded by!**/*.pb.go
,!**/*.pb.go
apis/grpc/v1/manager/index/index_manager_vtproto.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/payload/payload.pb.json.go
is excluded by!**/*.pb.json.go
apis/grpc/v1/payload/payload_vtproto.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/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 (57)
- .gitfiles (4 hunks)
- .github/ISSUE_TEMPLATE/bug_report.md (1 hunks)
- .github/ISSUE_TEMPLATE/security_issue_report.md (1 hunks)
- .github/PULL_REQUEST_TEMPLATE.md (1 hunks)
- .github/actions/docker-build/action.yaml (1 hunks)
- .github/workflows/release.yml (1 hunks)
- Makefile.d/dependencies.mk (1 hunks)
- Makefile.d/docker.mk (1 hunks)
- Makefile.d/functions.mk (1 hunks)
- apis/docs/v1/docs.md (3 hunks)
- apis/proto/v1/manager/index/index_manager.proto (1 hunks)
- apis/proto/v1/payload/payload.proto (1 hunks)
- apis/swagger/v1/manager/index/index_manager.swagger.json (2 hunks)
- dockers/tools/benchmark/job/Dockerfile (1 hunks)
- example/client/go.mod (2 hunks)
- go.mod (18 hunks)
- hack/go.mod.default (2 hunks)
- internal/info/info.go (5 hunks)
- internal/net/grpc/errdetails/errdetails.go (2 hunks)
- internal/net/http/metrics/pprof.go (2 hunks)
- internal/observability/trace/status.go (1 hunks)
- internal/tls/tls.go (1 hunks)
- pkg/agent/core/faiss/handler/grpc/insert.go (1 hunks)
- pkg/agent/core/faiss/handler/grpc/remove.go (1 hunks)
- pkg/agent/core/faiss/handler/grpc/search.go (1 hunks)
- pkg/agent/core/faiss/handler/grpc/update.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/flush.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/insert.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/linear_search.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/remove.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/search.go (1 hunks)
- pkg/agent/core/ngt/handler/grpc/update.go (1 hunks)
- pkg/agent/core/ngt/service/ngt_test.go (5 hunks)
- pkg/manager/index/handler/grpc/handler.go (1 hunks)
- pkg/manager/index/handler/grpc/handler_test.go (1 hunks)
- pkg/manager/index/service/indexer.go (8 hunks)
- pkg/manager/index/service/indexer_test.go (1 hunks)
- pkg/manager/index/service/option.go (4 hunks)
- pkg/manager/index/usecase/indexer.go (1 hunks)
- rust/libs/proto/src/filter.egress.v1.tonic.rs (2 hunks)
- rust/libs/proto/src/filter.ingress.v1.tonic.rs (2 hunks)
- rust/libs/proto/src/manager.index.v1.tonic.rs (5 hunks)
- rust/libs/proto/src/payload.v1.rs (1 hunks)
- rust/libs/proto/src/vald.v1.tonic.rs (4 hunks)
- versions/GOLANGCILINT_VERSION (1 hunks)
- versions/GO_VERSION (1 hunks)
- versions/HDF5_VERSION (1 hunks)
- versions/HELM_VERSION (1 hunks)
- versions/JAEGER_OPERATOR_VERSION (1 hunks)
- versions/K3S_VERSION (1 hunks)
- versions/KIND_VERSION (1 hunks)
- versions/KUBECTL_VERSION (1 hunks)
- versions/NGT_VERSION (1 hunks)
- versions/PROMETHEUS_STACK_VERSION (1 hunks)
- versions/PROTOBUF_VERSION (1 hunks)
- versions/REVIEWDOG_VERSION (1 hunks)
- versions/YQ_VERSION (1 hunks)
Files not processed due to max files limit (11)
- versions/actions/ACTIONS_CHECKOUT
- versions/actions/CODECOV_CODECOV_ACTION
- versions/actions/DOCKER_LOGIN_ACTION
- versions/actions/GITHUB_CODEQL_ACTION_ANALYZE
- versions/actions/GITHUB_CODEQL_ACTION_AUTOBUILD
- versions/actions/GITHUB_CODEQL_ACTION_INIT
- versions/actions/GITHUB_CODEQL_ACTION_UPLOAD_SARIF
- versions/actions/GITHUB_ISSUE_METRICS
- versions/actions/REVIEWDOG_ACTION_HADOLINT
- versions/actions/REVIEWDOG_ACTION_LANGUAGETOOL
- versions/actions/SOFTPROPS_ACTION_GH_RELEASE
Files not summarized due to errors (1)
- go.mod: Error: Message exceeds token limit
Files skipped from review due to trivial changes (21)
- .github/ISSUE_TEMPLATE/bug_report.md
- .github/ISSUE_TEMPLATE/security_issue_report.md
- .github/PULL_REQUEST_TEMPLATE.md
- .github/workflows/release.yml
- Makefile.d/docker.mk
- internal/observability/trace/status.go
- rust/libs/proto/src/filter.egress.v1.tonic.rs
- rust/libs/proto/src/filter.ingress.v1.tonic.rs
- versions/GOLANGCILINT_VERSION
- versions/GO_VERSION
- versions/HDF5_VERSION
- versions/HELM_VERSION
- versions/JAEGER_OPERATOR_VERSION
- versions/K3S_VERSION
- versions/KIND_VERSION
- versions/KUBECTL_VERSION
- versions/NGT_VERSION
- versions/PROMETHEUS_STACK_VERSION
- versions/PROTOBUF_VERSION
- versions/REVIEWDOG_VERSION
- versions/YQ_VERSION
Additional context used
Hadolint
dockers/tools/benchmark/job/Dockerfile
[warning] 50-50: Use WORKDIR to switch to a directory (DL3003)
[warning] 50-50: Pin versions in apt get install. Instead of
apt-get install <package>
useapt-get install <package>=<version>
(DL3008)
Markdownlint
apis/docs/v1/docs.md
1193-1193: null (MD034, no-bare-urls)
Bare URL used
1199-1199: null (MD034, no-bare-urls)
Bare URL used
1352-1352: null (MD034, no-bare-urls)
Bare URL used
1438-1438: null (MD034, no-bare-urls)
Bare URL used
1254-1254: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers
1254-1254: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers
1258-1258: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers
1258-1258: null (MD037, no-space-in-emphasis)
Spaces inside emphasis markers
627-627: null (MD051, link-fragments)
Link fragments should be valid
671-671: null (MD051, link-fragments)
Link fragments should be valid
682-682: null (MD051, link-fragments)
Link fragments should be valid
693-693: null (MD051, link-fragments)
Link fragments should be valid
704-704: null (MD051, link-fragments)
Link fragments should be valid
832-832: null (MD051, link-fragments)
Link fragments should be valid
928-928: null (MD051, link-fragments)
Link fragments should be valid
1462-1462: null (MD051, link-fragments)
Link fragments should be valid
1438-1438: Missing link or image reference definition: "google.rpc.code.permission_denied" (MD052, reference-links-images)
Reference links and images should use a label that is defined
Additional comments not posted (66)
apis/proto/v1/manager/index/index_manager.proto (1)
35-38
: The addition of theIndexDetail
RPC method is well-defined and aligns with the existing service structure.pkg/manager/index/handler/grpc/handler.go (1)
56-65
: The implementation of theIndexDetail
method in the GRPC server is correctly done, aligning with the new RPC definition and maintaining consistency in error handling and observability.example/client/go.mod (1)
7-18
: The updates to the dependencies in the Go module file are appropriate and ensure that the project uses the latest and secure versions.pkg/manager/index/service/option.go (1)
41-41
: The new option functions are correctly implemented with appropriate checks and error handling. Ensure that the unit tests for these functions are implemented to verify their functionality.Also applies to: 47-50, 56-65, 70-79, 84-93
pkg/agent/core/ngt/handler/grpc/flush.go (1)
28-28
: Import of observability attributes updated to internal package.This change aligns with the project's move to consolidate observability-related code under the internal package, enhancing modularity and maintainability.
internal/tls/tls.go (1)
114-117
: Reordered logic inNewX509CertPool
to callx509.SystemCertPool()
earlier.This change potentially improves error handling by ensuring that the system certificate pool is accessed before any other operations, reducing the risk of using an uninitialized pool.
dockers/tools/benchmark/job/Dockerfile (1)
71-72
: The addition of the HDF5 installation steps is correctly implemented.The steps to download and configure HDF5 are correctly implemented. Ensure that the Hadolint warnings are addressed to improve the Dockerfile's best practices.
internal/net/http/metrics/pprof.go (2)
25-25
: Integration of Grafana's Pyroscope for delta profiling.The addition of Grafana's Pyroscope library enhances the profiling capabilities by allowing delta profiling, which can provide more granular insights into memory and mutex usage over time.
120-143
: Added new routes for delta profiling: heap, mutex, and block.These new routes extend the profiling capabilities of the application, allowing for more detailed performance analysis in production environments.
pkg/agent/core/faiss/handler/grpc/remove.go (1)
30-30
: Import of observability attributes has been updated.This change aligns with the project-wide update to use internal observability attributes instead of the previous external package.
pkg/agent/core/faiss/handler/grpc/insert.go (1)
31-31
: Import of observability attributes has been updated.This change aligns with the project-wide update to use internal observability attributes instead of the previous external package.
.github/actions/docker-build/action.yaml (1)
116-120
: Updated Docker build options to include platform, builder, and labels.These changes enhance the Docker build process by specifying the platform, using a builder, and adding labels that provide metadata about the image. This is a good practice for maintaining clarity and traceability of Docker images.
pkg/manager/index/usecase/indexer.go (1)
Line range hint
1-1
: No changes detected in this file.Since there are no annotated changes in this file, no specific review comments are required.
pkg/agent/core/faiss/handler/grpc/update.go (1)
30-30
: Updated import path for observability attributes aligns with internal project standards.pkg/agent/core/faiss/handler/grpc/search.go (1)
30-30
: Updated import path for observability attributes aligns with internal project standards.apis/swagger/v1/manager/index/index_manager.swagger.json (2)
15-35
: The new endpoint/index/detail
is well-documented.
83-105
: The definitionIndexDetail
is comprehensive and well-documented.Makefile.d/dependencies.mk (1)
50-51
: The addition ofupdate/go
to thego/deps
target is a good practice for ensuring that all Go dependencies are up-to-date before installation.internal/net/grpc/errdetails/errdetails.go (1)
Line range hint
329-358
: The enhancements in theDebugInfoFromInfoDetail
function, including better stack trace handling and detailed error logging, significantly improve the debugging capabilities.pkg/agent/core/ngt/handler/grpc/insert.go (1)
29-29
: The update to useinternal/observability/attribute
for handling observability attributes aligns with the project's standards and enhances code maintainability.pkg/manager/index/service/indexer.go (7)
46-47
: TheIsSaving
method has been added to theIndexer
interface. Ensure that all implementations of this interface are updated to include this method.
56-60
: The addition ofsaveIndexDuration
andsaveIndexDurationLimit
fields to theindex
struct, along with concurrency settings for index creation and saving, enhances the control over timing and resource usage during indexing operations. Ensure that these new settings are properly documented and validated during initialization.
79-80
: Proper validation is performed to ensure that the sum of durations and limits is greater than zero, which is crucial for the correct operation of the indexer. This is a good practice to avoid misconfigurations that could lead to non-functional indexing behavior.
120-122
: The error handling in thefinalize
function is robust, checking for cancellation and deadline exceeded errors. This is crucial in a long-running process like indexing to handle shutdowns gracefully.
211-251
: ThecreateIndex
function efficiently manages indexing operations across multiple agents. The use ofOrderedRangeConcurrent
for distributing the indexing task is a good choice for load balancing. However, ensure that the error handling forCreateIndex
calls is consistent and that all possible error states are considered.
254-287
: Similar tocreateIndex
, thesaveIndex
function handles concurrent save operations well. The use ofLoadAndDelete
for managing theshouldSaveList
is efficient. However, ensure comprehensive testing, especially for the concurrency aspects and error handling.
356-365
: TheLoadIndexDetail
method efficiently compiles index details from multiple sources. Using a map to aggregate these details is appropriate. Ensure that the map's concurrency handling is robust, especially sinceindexInfos
is accessed concurrently.internal/info/info.go (5)
51-64
: RefactorDetail
struct to include new fields for enhanced runtime information.
144-156
: Ensure initialization of new fields inDetail
struct withinNew
function.
185-193
: Ensure initialization ofinfoProvider
to prevent runtime errors.
263-268
: Optimize theString
method to dynamically fetchcgo_call
andgoroutine_count
.
384-392
: Properly initialize runtime-specific fields inprepare
method to ensure they are set before use.pkg/agent/core/ngt/handler/grpc/remove.go (1)
29-29
: Update import paths to use the new observability attributes.Makefile.d/functions.mk (1)
336-336
: Enhance theupdate-github-actions
function to dynamically fetch and update GitHub Actions versions.rust/libs/proto/src/manager.index.v1.tonic.rs (4)
Line range hint
102-151
: The implementation ofindex_info
inindex_client
is robust, handling potential readiness errors effectively.
133-161
: Theindex_detail
method is well-implemented with consistent error handling and structure as seen inindex_info
.
171-190
: The server-side implementation ofindex_info
is consistent with the client-side, maintaining uniformity in handling and structure.
182-190
: Theindex_detail
server-side method is implemented consistently with the client-side, ensuring robustness and uniformity.apis/proto/v1/payload/payload.proto (1)
526-534
: The addition of theDetail
message in theInfo.Index
provides a structured way to represent detailed index information, enhancing data granularity and utility.pkg/agent/core/ngt/handler/grpc/search.go (5)
29-29
: Updated import paths to use internal observability attributes.
29-29
: TheSearch
function correctly handles dimension size validation and error scenarios.
29-29
: TheSearchByID
function is well-implemented with thorough error handling and validation.
29-29
: TheStreamSearch
function effectively handles streaming search requests with appropriate error handling.
29-29
: TheStreamSearchByID
function is correctly implemented for handling ID-based streaming searches.pkg/agent/core/ngt/handler/grpc/linear_search.go (5)
29-29
: Updated import paths to use internal observability attributes.
29-29
: TheLinearSearch
function correctly handles dimension size validation and error scenarios.
29-29
: TheLinearSearchByID
function is well-implemented with thorough error handling and validation.
29-29
: TheStreamLinearSearch
function effectively handles streaming linear search requests with appropriate error handling.
29-29
: TheStreamLinearSearchByID
function is correctly implemented for handling ID-based streaming linear searches.hack/go.mod.default (1)
Line range hint
165-344
: Update dependencies to ensure compatibility and security.The updates to the dependencies in the
go.mod
file are extensive but necessary to keep the project up-to-date with the latest libraries and frameworks. This is crucial for maintaining compatibility and security. Ensure that all updated dependencies are tested to prevent runtime issues.go.mod (7)
6-6
: Ensure that the updated version ofcloud.google.com/go
is compatible with other Google Cloud dependencies and the project requirements.Verification successful
The updated
cloud.google.com/go
dependency to versionv0.114.0
appears to be compatible with other Google Cloud dependencies listed in thego.mod
file. Additionally, the release notes did not indicate any breaking changes or compatibility issues for this version.
cloud.google.com/go v0.114.0
cloud.google.com/go/bigquery v1.61.0
cloud.google.com/go/compute v1.27.0
cloud.google.com/go/datastore v1.17.1
cloud.google.com/go/firestore v1.15.0
cloud.google.com/go/iam v1.1.8
cloud.google.com/go/kms v1.17.1
cloud.google.com/go/monitoring v1.19.0
cloud.google.com/go/pubsub v1.38.0
cloud.google.com/go/secretmanager v1.13.1
cloud.google.com/go/storage v1.42.0
cloud.google.com/go/trace v1.10.7
google.golang.org/api v0.183.0
google.golang.org/appengine v1.6.8
google.golang.org/genproto v0.0.0-20240610135401-a8a62080eff3
google.golang.org/grpc v1.64.0
google.golang.org/protobuf v1.34.2
No compatibility issues were found in the release notes for
cloud.google.com/go v0.114.0
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify compatibility of cloud.google.com/go with other Google Cloud dependencies. # Test: Search for compatibility issues in the project documentation or issue tracker. gh issue list --search "cloud.google.com/go compatibility"Length of output: 60
Script:
#!/bin/bash # Description: List all Google Cloud dependencies in the go.mod file. # Search for all Google Cloud dependencies in the go.mod file. grep 'cloud.google.com/go' go.mod grep 'google.golang.org' go.modLength of output: 2435
Script:
#!/bin/bash # Description: Check for breaking changes or compatibility notes in the release notes of cloud.google.com/go v0.114.0. # Fetch the release notes for cloud.google.com/go v0.114.0. curl -s https://pkg.go.dev/cloud.google.com/[email protected] | grep -i 'breaking changes\|compatibility'Length of output: 235
25-25
: Confirm that the new version ofgithub.com/Azure/azure-sdk-for-go/sdk/azcore
integrates well with other Azure SDK components used in the project.
47-47
: Validate the compatibility and performance implications of the updatedgithub.com/aws/aws-sdk-go
version.
164-164
: Review the changes ingithub.com/gorilla/websocket
to ensure they do not introduce any regressions in WebSocket functionalities.
94-94
: Ensure that the update togithub.com/emicklei/go-restful/v3
does not affect the existing RESTful interfaces in the project.
8-8
: Check the specific enhancements or bug fixes incloud.google.com/go/compute
v1.27.0 that necessitated this update.
18-18
: Review the stability and release notes ofcode.cloudfoundry.org/bytefmt
to ensure the update does not introduce breaking changes.rust/libs/proto/src/payload.v1.rs (1)
841-853
: Addition ofDetail
struct for index information aggregation.This addition aligns with the PR's objective to enhance index management capabilities. Ensure that the corresponding documentation and usage examples are updated to reflect these changes.
.gitfiles (1)
Line range hint
231-600
: The.gitfiles
content appears to be correctly updated and maintained. Good job keeping the repository organized.apis/docs/v1/docs.md (1)
26-27
: Addition of new sections in the documentation is well-structured and clear.rust/libs/proto/src/vald.v1.tonic.rs (2)
Line range hint
1-1
: The file structure and imports are well-organized and adhere to Rust's best practices for a gRPC service implementation.
Line range hint
1-1
: Thesearch_server
module effectively handles various search operations. Ensure that error handling is robust, especially in streaming operations where network issues can occur. Consider implementing more specific error messages based on the type of failure.Verification successful
The verification process has revealed that the file
rust/libs/proto/src/vald.v1.tonic.rs
contains multiple instances oftonic::Status::new
, primarily used to handle errors when the service is not ready. These instances are consistent and follow a pattern of mapping errors to atonic::Status
with aCode::Unknown
.
- The error handling is consistent across multiple instances.
- The error messages are generic, indicating that the service was not ready.
Given this information, the error handling appears to be implemented correctly, but the error messages could be more specific to provide better insights into the type of failure.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify error handling in streaming operations. # Test: Search for error handling patterns. Expect: Specific error handling for network issues. rg --type rust 'tonic::Status::new' 'vald.v1.tonic.rs'Length of output: 109
Script:
#!/bin/bash # Locate the correct file path for vald.v1.tonic.rs fd vald.v1.tonic.rs # Verify error handling in streaming operations in the correct file fd vald.v1.tonic.rs --exec rg 'tonic::Status::new' {}Length of output: 1794
Script:
#!/bin/bash # Extract lines around each instance of `tonic::Status::new` for context rg 'tonic::Status::new' rust/libs/proto/src/vald.v1.tonic.rs -C 5Length of output: 15980
pkg/agent/core/ngt/service/ngt_test.go (4)
41-41
: Imports look appropriate for the file context.
41-41
: Default configuration setup appears standard and correct.
1559-1560
: Struct definitions for test arguments and expectations are well-defined.
1616-1616
: Ensuregrpc.WithInsecure(true)
is used only in test environments.
// indexDuration:nil, | ||
// indexDurationLimit:nil, | ||
// saveIndexDurationLimit:nil, | ||
// saveIndexWaitDuration:nil, | ||
// saveIndexTargetAddrCh:nil, | ||
// schMap:nil, | ||
// concurrency:0, | ||
// indexInfos:nil, | ||
// indexing:nil, | ||
// minUncommitted:0, | ||
// uuidsCount:0, | ||
// uncommittedUUIDsCount:0, | ||
// }, | ||
// want: want{}, | ||
// checkFunc: defaultCheckFunc, | ||
// beforeFunc: func(t *testing.T,) { | ||
// t.Helper() | ||
// }, | ||
// afterFunc: func(t *testing.T,) { | ||
// t.Helper() | ||
// }, | ||
// }, | ||
// */ | ||
// | ||
// // TODO test cases | ||
// /* | ||
// func() test { | ||
// return test { | ||
// name: "test_case_2", | ||
// fields: fields { | ||
// client:nil, | ||
// eg:nil, | ||
// creationPoolSize:0, | ||
// indexDuration:nil, | ||
// indexDurationLimit:nil, | ||
// saveIndexDurationLimit:nil, | ||
// saveIndexWaitDuration:nil, | ||
// saveIndexTargetAddrCh:nil, | ||
// schMap:nil, | ||
// concurrency:0, | ||
// indexInfos:nil, | ||
// indexing:nil, | ||
// minUncommitted:0, | ||
// uuidsCount:0, | ||
// uncommittedUUIDsCount:0, | ||
// }, | ||
// want: want{}, | ||
// checkFunc: defaultCheckFunc, | ||
// beforeFunc: func(t *testing.T,) { | ||
// t.Helper() | ||
// }, | ||
// afterFunc: func(t *testing.T,) { | ||
// t.Helper() | ||
// }, | ||
// } | ||
// }(), | ||
// */ | ||
// } | ||
// | ||
// for _, tc := range tests { | ||
// test := tc | ||
// t.Run(test.name, func(tt *testing.T) { | ||
// tt.Parallel() | ||
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) | ||
// if test.beforeFunc != nil { | ||
// test.beforeFunc(tt) | ||
// } | ||
// if test.afterFunc != nil { | ||
// defer test.afterFunc(tt) | ||
// } | ||
// checkFunc := test.checkFunc | ||
// if test.checkFunc == nil { | ||
// checkFunc = defaultCheckFunc | ||
// } | ||
// idx := &index{ | ||
// client: test.fields.client, | ||
// eg: test.fields.eg, | ||
// creationPoolSize: test.fields.creationPoolSize, | ||
// indexDuration: test.fields.indexDuration, | ||
// indexDurationLimit: test.fields.indexDurationLimit, | ||
// saveIndexDurationLimit: test.fields.saveIndexDurationLimit, | ||
// saveIndexWaitDuration: test.fields.saveIndexWaitDuration, | ||
// saveIndexTargetAddrCh: test.fields.saveIndexTargetAddrCh, | ||
// schMap: test.fields.schMap, | ||
// concurrency: test.fields.concurrency, | ||
// indexInfos: test.fields.indexInfos, | ||
// indexing: test.fields.indexing, | ||
// minUncommitted: test.fields.minUncommitted, | ||
// uuidsCount: test.fields.uuidsCount, | ||
// uncommittedUUIDsCount: test.fields.uncommittedUUIDsCount, | ||
// } | ||
// | ||
// gotDetail := idx.LoadIndexDetail() | ||
// if err := checkFunc(test.want, gotDetail); err != nil { | ||
// tt.Errorf("error = %v", err) | ||
// } | ||
// | ||
// }) | ||
// } | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test function Test_index_LoadIndexDetail
is structured correctly but lacks actual test cases. Would you like assistance in implementing these test cases?
@@ -26,9 +26,9 @@ import ( | |||
"github.com/vdaas/vald/internal/net/grpc/codes" | |||
"github.com/vdaas/vald/internal/net/grpc/errdetails" | |||
"github.com/vdaas/vald/internal/net/grpc/status" | |||
"github.com/vdaas/vald/internal/observability/attribute" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure consistent import paths.
The import path for attribute
and trace
seems to have been changed recently. Verify that all references in the codebase have been updated to reflect this change.
Refactor error handling.
The error handling in the Update
function is verbose and repetitive. Consider abstracting common patterns into helper functions or using a middleware approach for error handling to reduce code duplication and improve maintainability.
Optimize stream handling.
The StreamUpdate
function could benefit from more efficient stream handling strategies, such as concurrent processing of requests where possible. Consider implementing a worker pool or similar concurrency patterns to improve performance.
Improve batch processing.
The MultiUpdate
function processes multiple update requests sequentially. To enhance throughput and reduce latency, consider implementing batch processing techniques or parallel processing where appropriate.
apis/docs/v1/docs.md
Outdated
| Method Name | Request Type | Response Type | Description | | ||
| ----------- | -------------------------------------- | -------------------------------------------------------------- | --------------------------------------------------------------- | | ||
| IndexInfo | [.payload.v1.Empty](#payload-v1-Empty) | [.payload.v1.Info.Index.Count](#payload-v1-Info-Index-Count) | Represent the RPC to get the index information. | | ||
| IndexDetail | [.payload.v1.Empty](#payload-v1-Empty) | [.payload.v1.Info.Index.Detail](#payload-v1-Info-Index-Detail) | Represent the RPC to get the index information for each agents. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure the method description is grammatically correct.
- Represent the RPC to get the index information for each agents.
+ Represent the RPC to get the index information for each agent.
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.
| IndexDetail | [.payload.v1.Empty](#payload-v1-Empty) | [.payload.v1.Info.Index.Detail](#payload-v1-Info-Index-Detail) | Represent the RPC to get the index information for each agents. | | |
| IndexDetail | [.payload.v1.Empty](#payload-v1-Empty) | [.payload.v1.Info.Index.Detail](#payload-v1-Info-Index-Detail) | Represent the RPC to get the index information for each agent. | |
<a name="payload-v1-Info-Index-Detail"></a> | ||
|
||
### Info.Index.Detail | ||
|
||
Represent the index count for each Agents message. | ||
|
||
| Field | Type | Label | Description | | ||
| ----------- | -------------------------------------------------------------------------- | -------- | ---------------------------------- | | ||
| counts | [Info.Index.Detail.CountsEntry](#payload-v1-Info-Index-Detail-CountsEntry) | repeated | count infos for each agents | | ||
| replica | [uint32](#uint32) | | index replica of vald cluster | | ||
| live_agents | [uint32](#uint32) | | live agent replica of vald cluster | | ||
|
||
<a name="payload-v1-Info-Index-Detail-CountsEntry"></a> | ||
|
||
### Info.Index.Detail.CountsEntry | ||
|
||
| Field | Type | Label | Description | | ||
| ----- | ------------------------------------------------ | ----- | ----------- | | ||
| key | [string](#string) | | | | ||
| value | [Info.Index.Count](#payload-v1-Info-Index-Count) | | | | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure grammatical consistency and correct terminology in the documentation.
- count infos for each agents
+ count information for each agent
- index replica of vald cluster
+ index replica of the Vald cluster
- live agent replica of vald cluster
+ live agent replica of the Vald cluster
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.
<a name="payload-v1-Info-Index-Detail"></a> | |
### Info.Index.Detail | |
Represent the index count for each Agents message. | |
| Field | Type | Label | Description | | |
| ----------- | -------------------------------------------------------------------------- | -------- | ---------------------------------- | | |
| counts | [Info.Index.Detail.CountsEntry](#payload-v1-Info-Index-Detail-CountsEntry) | repeated | count infos for each agents | | |
| replica | [uint32](#uint32) | | index replica of vald cluster | | |
| live_agents | [uint32](#uint32) | | live agent replica of vald cluster | | |
<a name="payload-v1-Info-Index-Detail-CountsEntry"></a> | |
### Info.Index.Detail.CountsEntry | |
| Field | Type | Label | Description | | |
| ----- | ------------------------------------------------ | ----- | ----------- | | |
| key | [string](#string) | | | | |
| value | [Info.Index.Count](#payload-v1-Info-Index-Count) | | | | |
<a name="payload-v1-Info-Index-Detail"></a> | |
### Info.Index.Detail | |
Represent the index count for each Agents message. | |
| Field | Type | Label | Description | | |
| ----------- | -------------------------------------------------------------------------- | -------- | ---------------------------------- | | |
| counts | [Info.Index.Detail.CountsEntry](#payload-v1-Info-Index-Detail-CountsEntry) | repeated | count information for each agent | | |
| replica | [uint32](#uint32) | | index replica of the Vald cluster | | |
| live_agents | [uint32](#uint32) | | live agent replica of the Vald cluster | | |
<a name="payload-v1-Info-Index-Detail-CountsEntry"></a> | |
### Info.Index.Detail.CountsEntry | |
| Field | Type | Label | Description | | |
| ----- | ------------------------------------------------ | ----- | ----------- | | |
| key | [string](#string) | | | | |
| value | [Info.Index.Count](#payload-v1-Info-Index-Count) | | | | |
case <-it.C: // index duration ticker | ||
// execute CreateIndex. This execution ignores low index agent. | ||
err = idx.createIndex(grpc.WithGRPCMethod(ctx, "core.v1.Agent/CreateIndex"), true) | ||
if err != nil && | ||
!errors.Is(err, context.Canceled) && | ||
!errors.Is(err, context.DeadlineExceeded) { | ||
err = errors.Wrap(err, "an error occurred during create indexing") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indexing and saving operations are triggered by tickers, and the error handling includes checks for cancellation and deadline exceeded errors. This is a good practice in asynchronous operations. However, consider abstracting the repetitive error handling logic into a separate function to reduce code duplication and improve maintainability.
+ func handleTickerError(err error, ctx context.Context, ech chan<- error) error {
+ if err != nil && !errors.Is(err, context.Canceled) && !errors.Is(err, context.DeadlineExceeded) {
+ log.Error(err)
+ select {
+ case <-ctx.Done():
+ return nil
+ case ech <- err:
+ }
+ }
+ return nil
+ }
- // Replace repetitive error handling blocks with the above function call
Also applies to: 142-148, 151-165, 173-191
Committable suggestion was skipped due to low confidence.
// type want struct { | ||
// wantRes *payload.Info_Index_Detail | ||
// err error | ||
// } | ||
// type test struct { | ||
// name string | ||
// args args | ||
// fields fields | ||
// want want | ||
// checkFunc func(want, *payload.Info_Index_Detail, error) error | ||
// beforeFunc func(*testing.T, args) | ||
// afterFunc func(*testing.T, args) | ||
// } | ||
// defaultCheckFunc := func(w want, gotRes *payload.Info_Index_Detail, err error) error { | ||
// if !errors.Is(err, w.err) { | ||
// return errors.Errorf("got_error: \"%#v\",\n\t\t\t\twant: \"%#v\"", err, w.err) | ||
// } | ||
// if !reflect.DeepEqual(gotRes, w.wantRes) { | ||
// return errors.Errorf("got: \"%#v\",\n\t\t\t\twant: \"%#v\"", gotRes, w.wantRes) | ||
// } | ||
// return nil | ||
// } | ||
// tests := []test{ | ||
// // TODO test cases | ||
// /* | ||
// { | ||
// name: "test_case_1", | ||
// args: args { | ||
// ctx:nil, | ||
// in1:nil, | ||
// }, | ||
// fields: fields { | ||
// indexer:nil, | ||
// UnimplementedIndexServer:nil, | ||
// }, | ||
// want: want{}, | ||
// checkFunc: defaultCheckFunc, | ||
// beforeFunc: func(t *testing.T, args args) { | ||
// t.Helper() | ||
// }, | ||
// afterFunc: func(t *testing.T, args args) { | ||
// t.Helper() | ||
// }, | ||
// }, | ||
// */ | ||
// | ||
// // TODO test cases | ||
// /* | ||
// func() test { | ||
// return test { | ||
// name: "test_case_2", | ||
// args: args { | ||
// ctx:nil, | ||
// in1:nil, | ||
// }, | ||
// fields: fields { | ||
// indexer:nil, | ||
// UnimplementedIndexServer:nil, | ||
// }, | ||
// want: want{}, | ||
// checkFunc: defaultCheckFunc, | ||
// beforeFunc: func(t *testing.T, args args) { | ||
// t.Helper() | ||
// }, | ||
// afterFunc: func(t *testing.T, args args) { | ||
// t.Helper() | ||
// }, | ||
// } | ||
// }(), | ||
// */ | ||
// } | ||
// | ||
// for _, tc := range tests { | ||
// test := tc | ||
// t.Run(test.name, func(tt *testing.T) { | ||
// tt.Parallel() | ||
// defer goleak.VerifyNone(tt, goleak.IgnoreCurrent()) | ||
// if test.beforeFunc != nil { | ||
// test.beforeFunc(tt, test.args) | ||
// } | ||
// if test.afterFunc != nil { | ||
// defer test.afterFunc(tt, test.args) | ||
// } | ||
// checkFunc := test.checkFunc | ||
// if test.checkFunc == nil { | ||
// checkFunc = defaultCheckFunc | ||
// } | ||
// s := &server{ | ||
// indexer: test.fields.indexer, | ||
// UnimplementedIndexServer: test.fields.UnimplementedIndexServer, | ||
// } | ||
// | ||
// gotRes, err := s.IndexDetail(test.args.ctx, test.args.in1) | ||
// if err := checkFunc(test.want, gotRes, err); err != nil { | ||
// tt.Errorf("error = %v", err) | ||
// } | ||
// | ||
// }) | ||
// } | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please ensure to uncomment and complete these test cases to validate the new functionality effectively.
Would you like assistance in implementing these test cases?
defer test.args.client.Close(ctx) | ||
|
||
for i := 0; i < 2; i++ { | ||
for _, req := range test.args.requests { | ||
_, err := client.MultiUpsert(ctx, req) | ||
_, err := test.args.client.Do(ctx, test.args.addr, | ||
func(ctx context.Context, conn *grpc.ClientConn, opts ...grpc.CallOption) (any, error) { | ||
return vald.NewValdClient(conn).MultiInsert(ctx, req) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider handling errors more robustly and ensure resources are managed efficiently.
- for i := 0; i < 2; i++ {
- for _, req := range test.args.requests {
- _, err := test.args.client.Do(ctx, test.args.addr,
- func(ctx context.Context, conn *grpc.ClientConn, opts ...grpc.CallOption) (any, error) {
- return vald.NewValdClient(conn).MultiInsert(ctx, req)
- })
- if err != nil {
- t.Error(err)
- }
+ for _, req := range test.args.requests {
+ _, err := test.args.client.Do(ctx, test.args.addr,
+ func(ctx context.Context, conn *grpc.ClientConn, opts ...grpc.CallOption) (any, error) {
+ return vald.NewValdClient(conn).MultiInsert(ctx, req)
+ })
+ if err != nil {
+ t.Errorf("Failed to perform MultiInsert: %v", err)
+ }
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.
defer test.args.client.Close(ctx) | |
for i := 0; i < 2; i++ { | |
for _, req := range test.args.requests { | |
_, err := client.MultiUpsert(ctx, req) | |
_, err := test.args.client.Do(ctx, test.args.addr, | |
func(ctx context.Context, conn *grpc.ClientConn, opts ...grpc.CallOption) (any, error) { | |
return vald.NewValdClient(conn).MultiInsert(ctx, req) | |
}) | |
defer test.args.client.Close(ctx) | |
for _, req := range test.args.requests { | |
_, err := test.args.client.Do(ctx, test.args.addr, | |
func(ctx context.Context, conn *grpc.ClientConn, opts ...grpc.CallOption) (any, error) { | |
return vald.NewValdClient(conn).MultiInsert(ctx, req) | |
}) | |
if err != nil { | |
t.Errorf("Failed to perform MultiInsert: %v", err) | |
} |
go.mod
Outdated
@@ -154,20 +154,21 @@ replace ( | |||
github.com/google/gofuzz => github.com/google/gofuzz v1.2.0 | |||
github.com/google/martian => github.com/google/martian v2.1.0+incompatible | |||
github.com/google/martian/v3 => github.com/google/martian/v3 v3.3.3 | |||
github.com/google/pprof => github.com/google/pprof v0.0.0-20240507183855-6f11f98ebb1c | |||
github.com/google/pprof => github.com/google/pprof v0.0.0-20240528025155-186aa0362fba |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The recent search results indicate that there are changes related to profiling features, such as the addition of settings for profiling with Pyroscope and an end-to-end profiling job. These changes suggest that the new version of github.com/google/pprof
includes enhancements or modifications to profiling features.
.github/workflows/e2e-profiling.yml
: Addition of an end-to-end profiling job.- Commit messages indicating the addition of settings for profiling with Pyroscope.
These changes imply that the new version may have introduced new profiling capabilities or improved existing ones.
Analysis chain
Check the implications of the new version of github.com/google/pprof
on performance profiling features.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check implications of new pprof version on profiling features.
# Test: Review the documentation for changes in profiling features.
curl -s https://github.com/google/pprof/blob/master/CHANGELOG.md | grep 'v0.0.0-20240528025155-186aa0362fba'
Length of output: 108
Script:
#!/bin/bash
# Description: Check implications of new pprof version on profiling features.
# Test: Review the documentation for changes in profiling features around the date of the new version.
curl -s https://github.com/google/pprof/blob/master/CHANGELOG.md | grep -A 10 '2024-05-28'
# Test: Review the documentation for any significant updates in profiling features.
curl -s https://github.com/google/pprof/blob/master/README.md | grep -i 'profiling'
Length of output: 174
Script:
#!/bin/bash
# Description: Check implications of new pprof version on profiling features.
# Test: Review the entire CHANGELOG.md for any recent updates or changes.
curl -s https://github.com/google/pprof/blob/master/CHANGELOG.md
# Test: Review the entire README.md for any mentions of profiling features.
curl -s https://github.com/google/pprof/blob/master/README.md
Length of output: 130
Script:
#!/bin/bash
# Description: Check implications of new pprof version on profiling features.
# Test: Search the source code for any significant changes related to profiling features.
fd -e go -x grep -i 'profiling' {}
# Test: Look for any recent commits or pull requests that might provide insights into changes in profiling features.
git log -p -10 | grep -i 'profiling'
Length of output: 861
apis/docs/v1/docs.md
Outdated
|
||
<a name="payload-v1-Info-Index-Count"></a> | ||
### Info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[LanguageTool] reported by reviewdog 🐶
Possible typo: you repeated a word (ENGLISH_WORD_REPEAT_RULE)
Suggestions: Info
Rule: https://community.languagetool.org/rule/show/ENGLISH_WORD_REPEAT_RULE?lang=en-US
Category: MISC
apis/docs/v1/docs.md
Outdated
|
||
|
||
|
||
|
||
|
||
<a name="payload-v1-Remove-Timestamp-Operator"></a> | ||
|
||
### Remove.Timestamp.Operator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[LanguageTool] reported by reviewdog 🐶
Possible typo: you repeated a word (ENGLISH_WORD_REPEAT_RULE)
Suggestions: Operator
Rule: https://community.languagetool.org/rule/show/ENGLISH_WORD_REPEAT_RULE?lang=en-US
Category: MISC
apis/docs/v1/docs.md
Outdated
|
||
|
||
<a name="v1_agent_core_agent-proto"></a> | ||
<p align="right"><a href="#top">Top</a></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[LanguageTool] reported by reviewdog 🐶
Unpaired symbol: ‘"’ seems to be missing (EN_UNPAIRED_QUOTES)
URL: https://languagetool.org/insights/post/punctuation-guide/#what-are-parentheses
Rule: https://community.languagetool.org/rule/show/EN_UNPAIRED_QUOTES?lang=en-US
Category: PUNCTUATION
@@ -1480,6 +1504,23 @@ Flush service provides ways to flush all indexed vectors. | |||
| ----------- | ------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------- | | |||
| Flush | [.payload.v1.Flush.Request](#payload-v1-Flush-Request) | [.payload.v1.Info.Index.Count](#payload-v1-Info-Index-Count) | A method to flush all indexed vector. | | |||
|
|||
<a name="v1_vald_index-proto"></a> | |||
|
|||
<p align="right"><a href="#top">Top</a></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[LanguageTool] reported by reviewdog 🐶
Unpaired symbol: ‘"’ seems to be missing (EN_UNPAIRED_QUOTES)
URL: https://languagetool.org/insights/post/punctuation-guide/#what-are-parentheses
Rule: https://community.languagetool.org/rule/show/EN_UNPAIRED_QUOTES?lang=en-US
Category: PUNCTUATION
| Method Name | Request Type | Response Type | Description | | ||
| ----------- | -------------------------------------- | -------------------------------------------------------------- | --------------------------------------------------------------- | | ||
| IndexInfo | [.payload.v1.Empty](#payload-v1-Empty) | [.payload.v1.Info.Index.Count](#payload-v1-Info-Index-Count) | Represent the RPC to get the index information. | | ||
| IndexDetail | [.payload.v1.Empty](#payload-v1-Empty) | [.payload.v1.Info.Index.Detail](#payload-v1-Info-Index-Detail) | Represent the RPC to get the index information for each agents. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[LanguageTool] reported by reviewdog 🐶
The noun should probably be in the singular form. (EVERY_EACH_SINGULAR[1])
Suggestions: agent
URL: https://languagetool.org/insights/post/word-choice-each-and-every/
Rule: https://community.languagetool.org/rule/show/EVERY_EACH_SINGULAR?lang=en-US&subId=1
Category: GRAMMAR
This commit fixes the style issues introduced in d4595d2 according to the output from Gofumpt and Prettier. Details: #2505 Signed-off-by: kpango <[email protected]>
96add59
to
cb3b0e5
Compare
This commit fixes the style issues introduced in d4595d2 according to the output from Gofumpt and Prettier. Details: #2505 Signed-off-by: kpango <[email protected]>
73d7926
to
1707dd8
Compare
176550e
to
fe32d1c
Compare
…informations Signed-off-by: kpango <[email protected]>
fe32d1c
to
63df5f1
Compare
Description
Related Issue
Versions
Checklist
Special notes for your reviewer
Summary by CodeRabbit
New Features
/index/detail
to retrieve index information for agents.Bug Fixes
Refactor
NewX509CertPool
function for better handling of certificate pools and error conditions.Dependencies
go.mod
, including Kubernetes-related packages and other libraries.Documentation