Capture gRPC UNKNOWN requests#16214
Draft
trask wants to merge 8 commits into
Draft
Conversation
5077197 to
cdfa917
Compare
trask
commented
Feb 19, 2026
61aa2e2 to
d2e67c0
Compare
0db6fec to
577c288
Compare
trask
commented
Feb 26, 2026
68a9c42 to
e49e31e
Compare
d082557 to
c233a62
Compare
# 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
Contributor
There was a problem hiding this comment.
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
ServerStreamTracerfallback 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. |
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.
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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #15690
Related to #15871