Skip to content

Retrieve gRPC server.address/server.port from gRPC target#16161

Draft
trask wants to merge 11 commits intoopen-telemetry:mainfrom
trask:grpc-server-address
Draft

Retrieve gRPC server.address/server.port from gRPC target#16161
trask wants to merge 11 commits intoopen-telemetry:mainfrom
trask:grpc-server-address

Conversation

@trask
Copy link
Member

@trask trask commented Feb 12, 2026

Currently built on top of

Prototype for open-telemetry/semantic-conventions#3317

Java agent instrumentation can do this for all gRPC versions.

Library instrumentation can only do this (automatically) using an internal gRPC API available since version 1.64.0: InternalManagedChannelBuilder.

I'm not convinced about the API / dependency on internals, could limit us on marking it stable, but marking ready-for-review to get feedback.

Related to #15871

Copy link
Member

@lmolkova lmolkova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great (assuming you're comfortable depending on '@internal public' API)

@trask trask force-pushed the grpc-server-address branch from c45ee61 to ce22789 Compare February 13, 2026 04:14
@trask trask marked this pull request as ready for review February 13, 2026 22:54
@trask trask requested a review from a team as a code owner February 13, 2026 22:54
@trask trask force-pushed the grpc-server-address branch from 9a1c3d7 to 2a0e0b9 Compare February 17, 2026 17:14
@trask trask force-pushed the grpc-server-address branch 5 times, most recently from 0f60636 to dd4d89f Compare February 26, 2026 04:09
@trask trask marked this pull request as draft February 26, 2026 04:28
@trask trask force-pushed the grpc-server-address branch 4 times, most recently from 7e67249 to 6ae035b Compare February 27, 2026 03:14
trask and others added 4 commits February 26, 2026 19:47
Per the stable gRPC semconv spec, rpc.response.status_code should use
the named status code (OK, CANCELLED, UNAVAILABLE, etc.) not the
numeric value (0, 2, 14).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Fix missed status code assertions in streaming and clientErrorThrown tests

Use Status.Code.name() instead of String.valueOf(Status.Code.*.value()) for
rpc.response.status_code assertions in AbstractGrpcStreamingTest and the
clientErrorThrown test in AbstractGrpcTest.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
In rpc/dup mode, span attributes can only hold one value for rpc.method.
The dualEmitContextCustomizer stashes the old rpc.method value in
context so RpcClientMetrics/RpcServerMetrics can use it for old metrics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Suppress deprecation warning for RpcMetricsContextCustomizers in build()

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Tests the full gRPC pipeline in rpc/dup mode to catch issues like
missing context customizer wiring that would produce wrong rpc.method
values on old metrics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
trask and others added 6 commits February 27, 2026 11:09
The stable semconv spec uses rpc.request.metadata.<key> instead of
rpc.grpc.request.metadata.<key>. Add stableRequestAttributeKey() to
CapturedGrpcMetadataUtil and use it when stable semconv is active.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The library tests exercise GrpcTelemetryBuilder.build() directly,
which is the code path where issues like missing context customizer
wiring would be caught.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Fix RPC_SYSTEM assertions for rpc/dup semconv mode in tests

Replace equalTo(maybeStable(RPC_SYSTEM), "grpc") with dual RPC_SYSTEM and
RPC_SYSTEM_NAME assertions in AbstractGrpcTest and AbstractGrpcStreamingTest,
to correctly handle rpc/dup mode where both attributes are emitted.
Also removes the now-unused maybeStable import from both test files.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- ArmeriaGrpcTest: use Status.Code.OK.name() instead of
  String.valueOf(Status.Code.OK.value()) for rpc.response.status_code,
  matching the GrpcAttributesExtractor implementation
- grpc-1.6 build.gradle.kts: add testLatestDeps system property and
  IPv4 preference to testStableSemconv and testBothSemconv tasks,
  matching the existing test task configuration

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@trask trask force-pushed the grpc-server-address branch from 6ae035b to d93c7e4 Compare February 28, 2026 21:54
@trask trask force-pushed the grpc-server-address branch from d93c7e4 to e19f9d2 Compare March 1, 2026 02:27
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