Skip to content

feat(auth): enrich invoke-level telemetry with transport detail#14264

Merged
westarle merged 4 commits intogoogleapis:mainfrom
westarle:westarle/tracing-auth-enrichment
Apr 2, 2026
Merged

feat(auth): enrich invoke-level telemetry with transport detail#14264
westarle merged 4 commits intogoogleapis:mainfrom
westarle:westarle/tracing-auth-enrichment

Conversation

@westarle
Copy link
Copy Markdown
Contributor

@westarle westarle commented Mar 26, 2026

This PR has auth code fill in TelemetryTransportData in order to send details from the transport back up to higher layers. See googleapis/gax-go#496. This in turn allows code in those higher layers to report telemetry information for the last request that is only known by the transport layer.

Changes Made

  • Logical Hostname Extraction: Updated extraction logic to parse logical hostnames and ports directly from req.URL (HTTP) and cc.Target() (gRPC) prior to invoking the transport
    layer.
  • Implicit Port Fallback: Added scheme-based port fallbacks (80 for HTTP, 443 for HTTPS) when handling URLs with implicit ports.

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 enhances OpenTelemetry integration by adding metrics support for both gRPC and HTTP transports. For gRPC, a new unary client interceptor is introduced to extract server address and port from the target and populate gax.TransportTelemetryData, utilizing a new extractHostPort helper function. For HTTP, the otelAttributeTransport is updated to similarly extract server address, port, and response status code. New unit tests cover these telemetry functionalities and the extractHostPort helper. Review feedback indicates an improvement opportunity in extractHostPort's error handling when the port is invalid, suggesting it should return the parsed host instead of the full target string, along with a corresponding test case update.

Comment thread auth/grpctransport/grpctransport.go Outdated
Comment thread auth/grpctransport/grpctransport_otel_test.go Outdated
@westarle westarle force-pushed the westarle/tracing-auth-enrichment branch 4 times, most recently from cf67087 to 643756c Compare March 27, 2026 03:05
@westarle westarle marked this pull request as ready for review March 27, 2026 04:17
@westarle westarle requested review from a team as code owners March 27, 2026 04:17
@westarle westarle force-pushed the westarle/tracing-auth-enrichment branch from 099729a to 03340f3 Compare March 29, 2026 19:09
@westarle westarle requested review from a team as code owners March 29, 2026 19:09
@westarle westarle force-pushed the westarle/tracing-auth-enrichment branch from 03340f3 to ce631e8 Compare March 29, 2026 19:13
Comment thread auth/httptransport/transport.go Outdated
Comment thread auth/grpctransport/grpctransport.go Outdated
- Avoid expensive net.SplitHostPort per-RPC in gRPC interceptor
- Extract HTTP host and port directly from req.URL instead of physical connection
- Add scheme-based fallback for implicit HTTP ports
- Add implicit port extraction tests
Comment thread auth/grpctransport/grpctransport.go
Comment thread auth/grpctransport/grpctransport.go Outdated
Comment thread auth/grpctransport/grpctransport.go Outdated
Comment thread auth/httptransport/transport.go
Comment thread auth/grpctransport/grpctransport.go
@westarle westarle merged commit 7c968bc into googleapis:main Apr 2, 2026
10 checks passed
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.

3 participants