Skip to content

Capture gRPC UNKNOWN requests#16214

Draft
trask wants to merge 8 commits into
open-telemetry:mainfrom
trask:grpc-unknown
Draft

Capture gRPC UNKNOWN requests#16214
trask wants to merge 8 commits into
open-telemetry:mainfrom
trask:grpc-unknown

Conversation

@trask

@trask trask commented Feb 17, 2026

Copy link
Copy Markdown
Member

Resolves #15690

Related to #15871

@trask trask force-pushed the grpc-unknown branch 2 times, most recently from 5077197 to cdfa917 Compare February 17, 2026 17:51
@trask trask force-pushed the grpc-unknown branch 5 times, most recently from 61aa2e2 to d2e67c0 Compare February 25, 2026 04:23
@trask trask changed the title Prototype: Capture gRPC UNKNOWN requests Capture gRPC UNKNOWN requests Feb 25, 2026
@trask trask force-pushed the grpc-unknown branch 6 times, most recently from 0db6fec to 577c288 Compare February 26, 2026 03:13
@trask trask force-pushed the grpc-unknown branch 9 times, most recently from 68a9c42 to e49e31e Compare March 3, 2026 22:38
@trask trask force-pushed the grpc-unknown branch 3 times, most recently from d082557 to c233a62 Compare March 13, 2026 20:48
trask added 4 commits March 27, 2026 09:25
# Conflicts:
#	instrumentation/armeria/armeria-grpc-1.14/javaagent/build.gradle.kts
#	instrumentation/grpc-1.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grpc/v1_6/GrpcServerBuilderInstrumentation.java
#	instrumentation/grpc-1.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grpc/v1_6/GrpcSingletons.java

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends gRPC server instrumentation to capture requests to unregistered/unknown services (where server interceptors are not invoked) by adding a ServerStreamTracer.Factory-based fallback, and wires this into both the library API and javaagent integrations.

Changes:

  • Add gRPC ServerStreamTracer fallback that creates a server span for unhandled (unknown/unregistered) methods and coordinates with the existing server interceptor to avoid double-instrumentation.
  • Introduce stable-semconv support for recording the original method name via rpc.method_original (paired with _OTHER).
  • Update library/javaagent integrations and tests (including Armeria) to use the new server-builder configuration path.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcTest.java Adds coverage for unknown/unregistered service behavior.
instrumentation/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTest.java Updates tests to configure server via configureServerBuilder.
instrumentation/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcStreamingTest.java Updates streaming tests to configure server via configureServerBuilder.
instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/TracingServerStreamTracerFactory.java New stream tracer factory to hook unknown requests.
instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/TracingServerStreamTracer.java New stream tracer that emits a fallback server span for unhandled requests.
instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/TracingServerInterceptor.java Marks the stream tracer as “handled” when interceptor runs to prevent duplicate spans.
instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/internal/Internal.java Adds an internal hook to create a server interceptor from GrpcTelemetry.
instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTelemetry.java Adds configureServerBuilder and deprecates createServerInterceptor.
instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcSpanNameExtractor.java Switches to GrpcRequest.getFullMethodName() to support unknown-method requests.
instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcRpcAttributesGetter.java Adds support for rpc.method_original.
instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcRequest.java Adds fields for full/original method name to support _OTHER handling.
instrumentation/grpc-1.6/library/README.md Updates docs to use configureServerBuilder rather than interceptor-only setup.
instrumentation/grpc-1.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grpc/v1_6/GrpcSingletons.java Switches javaagent wiring to configure server builder (interceptor + stream tracer factory).
instrumentation/grpc-1.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grpc/v1_6/GrpcServerBuilderInstrumentation.java Uses GrpcSingletons.configureServerBuilder to install full server instrumentation.
instrumentation/armeria/armeria-grpc-1.14/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/armeria/grpc/v1_14/ArmeriaGrpcTest.java Adds unknown-service coverage and adjusts expected spans (includes HTTP server span).
instrumentation/armeria/armeria-grpc-1.14/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/armeria/grpc/v1_14/ArmeriaGrpcSingletons.java New singleton to reuse a single server interceptor instance.
instrumentation/armeria/armeria-grpc-1.14/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/armeria/grpc/v1_14/ArmeriaGrpcServiceBuilderInstrumentation.java Uses the singleton interceptor rather than constructing telemetry per build.
instrumentation/armeria/armeria-grpc-1.14/javaagent/build.gradle.kts Adds additional test instrumentation and disables thread-propagation debugger for tests.
instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/rpc/RpcCommonAttributesExtractor.java Emits rpc.method_original (stable semconv).
instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/rpc/RpcAttributesGetter.java Adds getRpcMethodOriginal() API.

trask added 2 commits May 11, 2026 19:09
Mark the field @nullable and use requireNonNull at the call site, matching the pattern used in open-telemetry#18291. Add a comment noting that the factory is registered in GrpcTelemetry's static initializer before any GrpcTelemetry instance can be passed here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Comment on lines 64 to +68
systemProperty("collectMetadata", otelProps.collectMetadata)
// The armeria HTTP instrumentation creates an HTTP server span, and then the gRPC
// interceptor creates a second server span from the same incoming context, which triggers the
// context leak debugger.
jvmArgs("-Dotel.javaagent.experimental.thread-propagation-debugger.enabled=false")
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.

gRPC server instrumentation: no spans created for unknown service

2 participants