Skip to content

otelgrpc: add server.address and server.port#8723

Merged
dmathieu merged 1 commit intoopen-telemetry:mainfrom
dashpole:grpc_addresses
Mar 30, 2026
Merged

otelgrpc: add server.address and server.port#8723
dmathieu merged 1 commit intoopen-telemetry:mainfrom
dashpole:grpc_addresses

Conversation

@dashpole
Copy link
Copy Markdown
Contributor

@dashpole dashpole commented Mar 24, 2026

Part of #6608 (leaving it open because this isn't fixing server metrics).

Adds server.address and server.port attributes to otelgrpc client and server metrics to match what is in the latest semantic conventions.

This also fixes an issue where server spans were using peer.FromContext(ctx) as the server's IP and port. It is actually the client's IP and Port.

For client + server spans and for client metrics, it has the same requirement level:

server.address Conditionally Required If available.

server.port Conditionally Required if applicable and if server.address is set.

For server metrics, it is Opt-In, so it is left as a TODO to add those attributes:

server.address Opt-In

server.port Opt-In

Detailed description is the same everywhere:

[5] server.address: May contain a DNS name, an endpoint and path in the service registry, local socket name or an IP address. Semantic conventions for individual RPC systems SHOULD document how to populate this attribute. When address is an IP address, instrumentations SHOULD NOT do a reverse DNS lookup to obtain a DNS name and SHOULD set server.address to the provided IP address.

[6] server.port: When observed from the client side, and when communicating through an intermediary, server.port SHOULD represent the server port behind any intermediaries, for example proxies, if it’s available.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.2%. Comparing base (1676912) to head (4f4b149).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #8723   +/-   ##
=====================================
  Coverage   82.2%   82.2%           
=====================================
  Files        183     183           
  Lines      13812   13819    +7     
=====================================
+ Hits       11354   11361    +7     
  Misses      2054    2054           
  Partials     404     404           
Files with missing lines Coverage Δ
...n/google.golang.org/grpc/otelgrpc/stats_handler.go 98.5% <100.0%> (+<0.1%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dashpole dashpole force-pushed the grpc_addresses branch 3 times, most recently from 8c48a5d to e09bb37 Compare March 24, 2026 17:23
Comment thread instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go
@dashpole dashpole marked this pull request as ready for review March 24, 2026 17:29
@dashpole dashpole requested a review from a team as a code owner March 24, 2026 17:29
Signed-off-by: David Ashpole <dashpole@google.com>
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