Repository navigation
test(metrics): add Cloud Storage client metrics validation tests - #5255
alleaditya wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive integration tests for Go SDK Standard and Debug metrics, refactors the fake gRPC storage server to support advanced simulation scenarios (such as stalls, retries, and bidirectional streaming), and enhances the OpenTelemetry metric verification utilities with scope-specific lookups and detailed histogram assertions. Feedback on the changes highlights that modifying the GODEBUG environment variable at runtime via os.Setenv to enable fallback roots is ineffective because it is parsed at process startup, and recommends documenting this requirement for the external test environment instead.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## refactor-grpc-metrics-test-infra #5255 +/- ##
====================================================================
+ Coverage 85.23% 85.24% +0.01%
====================================================================
Files 181 181
Lines 19974 20005 +31
====================================================================
+ Hits 17024 17054 +30
- Misses 2949 2951 +2
+ Partials 1 0 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
b9a9985 to
8598114
Compare
65ea4a2 to
5cc778b
Compare
5cc778b to
eab5500
Compare
eab5500 to
abfb2b4
Compare
abfb2b4 to
eccb3f9
Compare
02cc578 to
b813601
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive integration tests for Cloud Storage client Standard and Debug OpenTelemetry metrics. It expands the 'reflectFakeServer' in 'grpc_metrics_test.go' to support TLS, OAuth2 token exchanges, and various failure/stall simulations, and adds a new test suite in 'storage_client_metrics_test.go'. Additionally, 'metrics_test_utils.go' is enhanced with new verification options (such as scope, unit, and non-monotonicity checks). Feedback on the changes suggests asserting the success of 'AppendCertsFromPEM' and replacing thread-unsafe 'os.Setenv' calls with 't.Setenv' in the test TLS setup.
b813601 to
6399de3
Compare
|
Hi @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you! |
|
Hi @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you! |
|
Hi @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you! |
1 similar comment
|
Hi @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you! |
Add end-to-end validation tests in internal/fs/storage_client_metrics_test.go for all 16 Cloud Storage client OpenTelemetry metrics (8 Standard + 8 Debug) emitted under scope cloud.google.com/go/storage when wired through GCSFuse's gRPC storage client: - Add hermetic ECDSA P-256 x509 fallback-root TLS and service-account OAuth2 token fixtures in internal/fs/storage_client_metrics_test.go, validating units, monotonicity, attributes, counts, sums, retry/stall/streaming edge cases, and env/config gating flags. - Extend reflectFakeServer and setupGRPCMetricsFixture in internal/fs/grpc_metrics_test.go with simulation hooks for TLS/OAuth, QueryWriteStatus, x-goog-gfe-service-time headers, multi-chunk reads, transient retries, read/write stalls, and in-flight stream synchronization. - Extend metrics/metrics_test_utils.go with the VerifyOptions and negative presence assertions used by these tests (WithScope, WithUnit, NonMonotonic, AtLeastSum, VerifyMetricNotPresent, VerifyDataPointNotPresent).
Verify pool.AppendCertsFromPEM succeeds inside ensureTestTLSFixture and replace manual os.Setenv/os.Unsetenv manipulation with t.Setenv so GODEBUG is set and restored safely under Go's test harness.
6399de3 to
7c21134
Compare
|
Hi @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you! |
1 similar comment
|
Hi @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you! |
…ics tests - Remove unused sh and mh fields from grpcMetricsTestFixture and unused sendGFEHeader field from grpcMetricsTestOptions. - Fail fast on early SyncFile errors before BidiWriteObject entry while canceling and draining the sync goroutine cleanly on unwind. - Return early from BidiWriteObject if the stream context is canceled while blocked. - Trigger a single sequential ListObjects RPC via OpenDir/ReadDir in TestStorageClientDebugMetrics_CredentialRefreshFailure for deterministic Count=1 without errgroup cancellation races. - Include gcp.storage.client.gfe.duration in storageClientDebugMetricNames negative checks and update doc comments. - Use ReqIncreaseRate=0.25 in read-stall retry test config so attempt 2 has 160ms headroom instead of 10.47ms.
Description
Stacked on #5265.
Add end-to-end validation tests in
internal/fs/storage_client_metrics_test.gofor all 16 Cloud Storage client OpenTelemetry metrics (8 Standard + 8 Debug under instrumentation scopecloud.google.com/go/storage) wired through GCSFuse's gRPC storage client:GCP_STORAGE_GO_ENABLE_OTEL_METRICS=true):gcp/storage/client/operations,gcp/client/request/duration,gcp/storage/client/attempts,rpc/client/call/duration,gcp/storage/client/operation/ttfb,gcp/storage/client/errors,gcp/storage/client/response/body/size, andgcp/storage/client/request/body/size.GCP_STORAGE_GO_ENABLE_OTEL_DEBUG_METRICS=true):gcp/storage/client/network/bytes/received,gcp/storage/client/network/bytes/sent,gcp/storage/client/request/active,gcp/storage/client/network/tcp/connect/duration,gcp/storage/client/network/tls/handshake/duration,gcp/storage/client/stall/duration(both read-stall and resumable write-stall watchdog paths),gcp/storage/client/gfe/header_missing, andgcp/storage/client/auth/credential_refresh/duration(bothOKandCLIENT_AUTHENTICATION_ERROR).WithScope,WithUnit,NonMonotonic,AtLeastSum,VerifyMetricNotPresent, andVerifyDataPointNotPresentinmetrics/metrics_test_utils.go, and extendreflectFakeServer/setupGRPCMetricsFixtureininternal/fs/grpc_metrics_test.gowith hooks for TLS/OAuth,QueryWriteStatus,x-goog-gfe-service-timeheaders, multi-chunk reads, transient retries, read/write stalls, and in-flight stream synchronization.Link to the issue in case of a bug fix.
Fixes b/586721467
Testing details
make build(go generate,goimports,go mod tidy,gofmt -s,go vet ./...,golangci-lint,go build ./...).go test -race -shuffle=on -count=3 ./internal/fs -run "TestGrpcMetrics|TestStorageClient"(~2.2s non-race suite runtime including the 1sWriteStallwatchdog).StorageHandle-> in-processgoogle.storage.v2.Storagefake server + ECDSA P-256 TLS + OAuth2 flows ininternal/fs.Any backward incompatible change? If so, please explain.
N/A