Skip to content

fix: Clean up attributes for traces and metrics#12677

Open
blakeli0 wants to merge 4 commits intomainfrom
fix-observability-tests
Open

fix: Clean up attributes for traces and metrics#12677
blakeli0 wants to merge 4 commits intomainfrom
fix-observability-tests

Conversation

@blakeli0
Copy link
Copy Markdown
Contributor

@blakeli0 blakeli0 commented Apr 3, 2026

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

@blakeli0 blakeli0 requested a review from a team as a code owner April 3, 2026 22:04
@blakeli0 blakeli0 changed the title fix: update observability attributes and tests fix: Clean up attributes for traces and metrics Apr 3, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

@blakeli0 blakeli0 requested a review from lqiu96 April 3, 2026 22:21
ObservabilityUtils.populateStatusAttributes(attributes, null, transport);
metricsRecorder.recordOperationLatency(
clientRequestTimer.elapsed(TimeUnit.NANOSECONDS) / 1_000_000_000.0, attributes);
recordError(null);
Copy link
Copy Markdown
Member

@lqiu96 lqiu96 Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants