GeezerVison is showing github.com — fix: Clean up attributes for traces and metrics by blakeli0 · Pull Request #12677 · googleapis/google-cloud-java
Conversation
This PR
- Add
exception.type and gcp.client.repo attributes to metrics.
- Remove
gcp.client.artifact and gcp.client.version from Span attributes since they are recorded as instrumentationName and instrumentationScope.
- Refactor common logics of getting error attributes to
ObservabilityUtils
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
gemini-code-assist[bot] reacted with eyes emoji
blakeli0
changed the title
fix: update observability attributes and tests
fix: Clean up attributes for traces and metrics
Apr 3, 2026
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 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.
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.
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.
|
|
ObservabilityUtils.populateStatusAttributes(attributes, null, transport);
|
|
|
metricsRecorder.recordOperationLatency(
|
|
|
clientRequestTimer.elapsed(TimeUnit.NANOSECONDS) / 1_000_000_000.0, attributes);
|
|
|
recordMetric(null);
|
lqiu96
Apr 6, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
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.
not a blocker for this PR, but I feel that recordMetric(null) gives the wrong impression of the logic (maybe it's just to me and I may be just reading it too fast). At a first glance, I read the method like record no metric. Only after reading the signature did it make sense that the first param correspond to the error.
Maybe ideally something like recordErrorMetric that takes in the error param and recordMetric that records the status? But I guess that requires a bit of duplication in the logic.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Makes sense. I can definitely see the potential confusion. Let me give it more thoughts.
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.
This was referenced Apr 7, 2026
This was referenced Apr 10, 2026
Reviewers
lqiu96
lqiu96 approved these changes
+1 more reviewer
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.
|