Add more RequestMetadata attributes to trace spans#12038
Open
Add more RequestMetadata attributes to trace spans#12038
Conversation
ac6946a to
29feac8
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands OpenTelemetry root span enrichment using Bazel RequestMetadata, adding more queryable attributes to traces while avoiding attaching the full serialized metadata blob.
Changes:
- Extend request metadata extraction to also read
RequestMetadatabytes fromcontext.Contextvalues (in addition to incoming gRPC metadata). - Add
TraceAttributes()andSetTraceAttributes()helpers to convertRequestMetadatainto span attributes and apply them only when the span is recording. - Refactor gRPC interceptors to use the new helper for propagating request metadata onto spans, and update Bazel deps accordingly.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| server/util/bazel_request/bazel_request.go | Adds trace attribute helpers and broadens where request metadata bytes can be sourced from (incoming metadata or context value). |
| server/util/bazel_request/BUILD | Adds OpenTelemetry attribute/trace deps required by the new helpers. |
| server/rpc/interceptors/interceptors.go | Switches span enrichment to call the new centralized request-metadata-to-span helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
29feac8 to
3cdbdd7
Compare
3cdbdd7 to
af95995
Compare
vanja-p
approved these changes
Apr 29, 2026
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.
Also, don't unnecessarily set attributes if we're not recording.