fix: Clean up attributes for traces and metrics#12677
Open
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors observability attribute collection by removing artifact and version attributes, centralizing error attribute logic into a new method, and updating tracing logic to use this centralized method. The review identified a consistent typo in the new method name 'gettErrorAttributes', which should be corrected to 'getErrorAttributes' across the codebase, including in the corresponding test method names.
...m-java/gax-java/gax/src/main/java/com/google/api/gax/tracing/GoldenSignalsMetricsTracer.java
Outdated
Show resolved
Hide resolved
sdk-platform-java/gax-java/gax/src/main/java/com/google/api/gax/tracing/ObservabilityUtils.java
Outdated
Show resolved
Hide resolved
sdk-platform-java/gax-java/gax/src/main/java/com/google/api/gax/tracing/SpanTracer.java
Outdated
Show resolved
Hide resolved
...tform-java/gax-java/gax/src/test/java/com/google/api/gax/tracing/ObservabilityUtilsTest.java
Outdated
Show resolved
Hide resolved
lqiu96
reviewed
Apr 3, 2026
| ObservabilityUtils.populateStatusAttributes(attributes, null, transport); | ||
| metricsRecorder.recordOperationLatency( | ||
| clientRequestTimer.elapsed(TimeUnit.NANOSECONDS) / 1_000_000_000.0, attributes); | ||
| recordError(null); |
Member
There was a problem hiding this comment.
Can you add a comment as to why we need to call recordError() with a null Throwable? IIUC, this is to additional attributes like status?
Side node: Perhaps status can be recorded separately from recordError()?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR
exception.typeandgcp.client.repoattributes to metrics.gcp.client.artifactandgcp.client.versionfrom Span attributes since they are recorded as instrumentationName and instrumentationScope.ObservabilityUtils