GeezerVison is showing github.com — feat(gax): Add error attributes to golden signal metrics. by blakeli0 · Pull Request #12564 · googleapis/google-cloud-java
Conversation
blakeli0
commented
Apr 1, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
This PR
- Added error attributes to metrics
- Added version as instrumentation version
- Added ITOtelGoldenMetrics that verifies all attributes
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
gemini-code-assist[bot] reacted with eyes emoji
This commit ensures that all required metrics attributes for Golden
Signals are fully implemented in sdk-platform-java.
Specifically:
- Always populate `rpc.response.status_code` for both gRPC and HTTP transports.
- Conditionally populate `http.response.status_code` only for HTTP transport.
- Add `error.type` attribute to metrics exclusively on operation failures.
- Ensured all other attributes (`gcp.client.service`, `rpc.system.name`, `rpc.method`, `url.domain`, `url.template`, `server.address`, `server.port`) are consistently populated from `ApiTracerContext.getMetricsAttributes()`.
Added additional test cases to GoldenSignalsMetricsTracerTest to ensure that ObservabilityUtils.extractErrorType is correctly translating various exceptions (like CancellationException, SocketTimeoutException, and IllegalArgumentException) into the appropriate error.type attributes during failure reporting.
Updated GoldenSignalsMetricsRecorder to automatically apply the library version retrieved from LibraryMetadata as the instrumentation version on the built OpenTelemetry Meter.
…Recorder
Instead of manually extracting properties and passing separate tracking arguments to GoldenSignalsMetricsRecorder, this passes the entire LibraryMetadata model and builds the telemetry setup dynamically.
Removed repetitive check for LibraryMetadata and artifactName from GoldenSignalsMetricsTracerFactory#withContext. Instead, GoldenSignalsMetricsRecorder gracefully handles missing metadata by acting as a no-op instead of creating an underlying OpenTelemetry instrument.
Extracted the metadata validation into a static `create` method inside `GoldenSignalsMetricsRecorder`. This allows the recorder to own the validation logic while allowing `GoldenSignalsMetricsTracerFactory` to cleanly bail out and return a `BaseApiTracerFactory` if telemetry cannot be correctly constructed, maximizing performance by avoiding any tracer overhead without duplicating checks.
Added unit tests to `GoldenSignalsMetricsRecorderTest` to explicitly verify that `GoldenSignalsMetricsRecorder.create()` correctly intercepts invalid `LibraryMetadata` states (null values, missing artifact name, empty artifact name) and returns `null` as expected.
Cleaned up instances of fully qualified class references (LibraryMetadata, Strings, Nullable) by introducing proper Java import statements across GoldenSignalsMetricsRecorder and its associated tests.
Added `ITOtelGoldenMetrics` alongside `ITOtelTracing` to ensure that Golden Signals are correctly collected with accurate dimensional attributes (e.g., service name, status code, error type, port, addressing) across both the gRPC and HTTP/JSON runtime transports.
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.
Code Review
This pull request refactors GoldenSignalsMetricsRecorder to use LibraryMetadata for instrumentation versioning and standardizes status attribute population in GoldenSignalsMetricsTracer and ObservabilityUtils. It also adds integration tests for OpenTelemetry metrics. Reviewers suggested simplifying metadata validation and ensuring the error.type attribute is consistently applied to cancelled operations.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
blakeli0
changed the title
feat(observability): implement and verify golden signal metrics attributes
feat(gax): Add error attributes to golden signal metrics.
Apr 2, 2026
…te expectations and resolve test flakiness in ITOtelGoldenMetricsTest
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Apr 3, 2026
This was referenced Apr 7, 2026
This was referenced Apr 10, 2026
Reviewers
2 more reviewers
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|