feat(storage): add OpenTelemetry tracing for OAuth2 token source - #20376
Open
sahusneha2004 wants to merge 6 commits into
Open
feat(storage): add OpenTelemetry tracing for OAuth2 token source#20376sahusneha2004 wants to merge 6 commits into
sahusneha2004 wants to merge 6 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces TracedTokenSource, which wraps an oauth2.TokenSource to record OpenTelemetry spans for authentication token refreshes, along with corresponding unit tests. The feedback highlights a critical compilation error in Token() where a context.Context is incorrectly passed to endSpan instead of a trace.Span, and notes that the new TracedTokenSource is not yet integrated into the client initialization path.
sahusneha2004
force-pushed
the
feat/otel-auth-refresh-token
branch
2 times, most recently
from
August 13, 2026 06:39
c5c9a8f to
ad3f1ed
Compare
sahusneha2004
force-pushed
the
feat/otel-auth-refresh-token
branch
from
August 17, 2026 10:16
ad3f1ed to
b347cf4
Compare
sahusneha2004
force-pushed
the
feat/otel-auth-refresh-token
branch
from
August 20, 2026 05:44
b347cf4 to
3a45573
Compare
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.
Description
This PR introduces OpenTelemetry tracing support for authentication token refreshes (
Auth.RefreshAccessToken) to fulfill the T5 internal operations telemetry specification for the Google Cloud Storage Go client.Background & Architectural Context
In the Go Cloud SDKs, default credential resolution (Application Default Credentials) and background token lifecycle management are handled deep within the shared transport layer (
google.golang.org/api/transportandcloud.google.com/go/auth).To provide
Auth.RefreshAccessTokenspan recording within thestoragemodule without modifying upstream shared transport dependencies, this PR introducesTracedTokenSourceas a non-intrusive decorator aroundoauth2.TokenSource.Includes unit test
TestTracedTokenSourceSpaninstorage/trace_test.go.Usage Example
Callers or integrations supplying a custom
oauth2.TokenSourcecan wrap it withNewTracedTokenSource: