Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[otelgrpc] Emit attributes identifying host endpoint #6608

Open
jade-guiton-dd opened this issue Jan 13, 2025 · 0 comments
Open

[otelgrpc] Emit attributes identifying host endpoint #6608

jade-guiton-dd opened this issue Jan 13, 2025 · 0 comments
Assignees
Labels
area: instrumentation Related to an instrumentation package enhancement New feature or request instrumentation: otelgrpc

Comments

@jade-guiton-dd
Copy link

Problem Statement

When used with a gRPC server, otelgrpc does not seem to emit span/metric attributes identifying the endpoint address or port number. This is problematic for its use in the OTLP receiver, as we want to make sure users can identify which receiver instance emitted a span/metric when multiple gRPC endpoints are configured, and the last resort of comparing the port number with the receiver config is not currently possible.

Under the 1.17.0 semantic convention (for spans / for metrics), which seems to be the one that is currently implemented, this would correspond to the net.sock.host.addr and net.sock.host.port attributes.

Note that these attributes are "Recommended" under said convention, but the corresponding server.address and server.port attributes in the latest 1.29.0 semantic convention (for spans / for metrics) are actually "Required" for spans, so they would have to be implemented as part of a convention version upgrade.

Proposed Solution

Emit net.sock.host.addr and net.sock.host.port attributes. If I'm not mistaken, I believe this information can be obtained from the LocalAddr field in the ConnTagInfo and InHeader structs received in the stats handler.

Alternatives

An alternative for users would be to manually setup these attributes by passing WithSpanAttributes/WithMetricAttributes options to NewServerHandler.

Prior Art

otelhttp provides the similar net.host.name and net.host.port, although those seem to be derived from the HTTP Host header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: instrumentation Related to an instrumentation package enhancement New feature or request instrumentation: otelgrpc
Projects
None yet
Development

No branches or pull requests

2 participants