[#noissue] Support Release Candidate rpc semconv keys in the OTLP tra…#14053
Conversation
…ce collector The RPC semantic conventions reached Release Candidate with renames the collector only knew by their deprecated 1.x spellings: - rpc.system -> rpc.system.name: resolved via a shared key-precedence helper (RC key before deprecated), consistent with the existing http.request.method/http.method handling. Only the consumed variant is filtered from the raw attributes. - rpc.system value "apache_dubbo" -> "dubbo": both spellings resolve to APACHE_DUBBO_PROVIDER/CONSUMER in the server/client type resolvers. - rpc.grpc.status_code (int 0-16) -> rpc.response.status_code (string status NAME, e.g. "OK"): promoted to the grpc.status annotation. The RC key is shared by all rpc systems, so it is only interpreted when rpc.system(.name) is grpc — a jsonrpc error code like "-32602" must not render as a gRPC status. Numeric strings under the RC key are defensively translated to the name representation. rpc.service (deprecated, folded into the fully-qualified rpc.method) is kept as an endPoint fallback for 1.x SDKs; no behavior change there.
|
There was a problem hiding this comment.
Pull request overview
This PR updates the OTLP trace collector’s RPC attribute handling to support OpenTelemetry RPC semantic convention Release Candidate (RC) key/value changes, while maintaining compatibility with deprecated 1.x spellings. It extends service-type dispatch and gRPC status promotion logic to recognize the RC keys and adds/updates tests to validate the behavior.
Changes:
- Add
rpc.system.nameprecedence over deprecatedrpc.systemfor ServiceType dispatch, shared between root spans and span events. - Support RC Dubbo spelling (
dubbo) alongside deprecatedapache_dubboin client/server type resolvers. - Promote RC
rpc.response.status_codeto the existinggrpc.statusannotation only when the RPC system is gRPC, with numeric-string defensive translation; add corresponding test coverage.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| otlptrace/otlptrace-collector/src/test/java/com/navercorp/pinpoint/otlp/trace/collector/mapper/OtlpTraceSpanMapperTest.java | Adds root-span tests for RC rpc.system.name precedence and rpc.response.status_code gRPC-status promotion gating. |
| otlptrace/otlptrace-collector/src/test/java/com/navercorp/pinpoint/otlp/trace/collector/mapper/OtlpTraceSpanEventMapperTest.java | Adds span-event tests for RC rpc.system.name dispatch and RC gRPC status promotion. |
| otlptrace/otlptrace-collector/src/test/java/com/navercorp/pinpoint/otlp/trace/collector/mapper/OtlpServerTypeResolverTest.java | Adds test ensuring dubbo resolves to the same server ServiceType as apache_dubbo. |
| otlptrace/otlptrace-collector/src/test/java/com/navercorp/pinpoint/otlp/trace/collector/mapper/OtlpClientTypeResolverTest.java | Adds test ensuring dubbo resolves to the same client ServiceType as apache_dubbo. |
| otlptrace/otlptrace-collector/src/main/java/com/navercorp/pinpoint/otlp/trace/collector/mapper/OtlpTraceSpanMapper.java | Refactors server-side RPC system extraction into a shared RC-aware helper (getRpcSystem). |
| otlptrace/otlptrace-collector/src/main/java/com/navercorp/pinpoint/otlp/trace/collector/mapper/OtlpTraceSpanEventMapper.java | Switches client span-event RPC system dispatch to use the shared RC-aware helper. |
| otlptrace/otlptrace-collector/src/main/java/com/navercorp/pinpoint/otlp/trace/collector/mapper/OtlpTraceConstants.java | Adds RC constants (rpc.system.name, rpc.response.status_code, dubbo) and key-precedence lists. |
| otlptrace/otlptrace-collector/src/main/java/com/navercorp/pinpoint/otlp/trace/collector/mapper/OtlpServerTypeResolver.java | Maps dubbo to the existing Dubbo provider ServiceType name. |
| otlptrace/otlptrace-collector/src/main/java/com/navercorp/pinpoint/otlp/trace/collector/mapper/OtlpGrpcStatusResolver.java | Adds RC rpc.response.status_code handling gated by RPC system == gRPC, with numeric-string normalization. |
| otlptrace/otlptrace-collector/src/main/java/com/navercorp/pinpoint/otlp/trace/collector/mapper/OtlpClientTypeResolver.java | Maps dubbo to the existing Dubbo consumer ServiceType name. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| static @Nullable String getRpcSystem(Map<String, AttributeValue> attributes, Set<String> consumedKeys) { | ||
| for (String key : OtlpTraceConstants.RPC_SYSTEM_KEYS) { | ||
| final String system = AttributeUtils.getAttributeStringValue(attributes, key, null); | ||
| if (system != null) { | ||
| consumedKeys.add(key); | ||
| return system; | ||
| } | ||
| } | ||
| return null; | ||
| } | ||
| } |
| public static GrpcStatus resolve(Map<String, AttributeValue> attributes) { | ||
| // RC generic key first — gated on the rpc system actually being grpc (peek only; the | ||
| // status key itself is what the caller consumes via sourceKey()). | ||
| if (isGrpcSystem(attributes)) { | ||
| final String status = AttributeUtils.getAttributeStringValue( | ||
| attributes, OtlpTraceConstants.ATTRIBUTE_KEY_RPC_RESPONSE_STATUS_CODE, null); | ||
| if (status != null && !status.isEmpty()) { | ||
| return new GrpcStatus(normalizeStatus(status), | ||
| OtlpTraceConstants.ATTRIBUTE_KEY_RPC_RESPONSE_STATUS_CODE); | ||
| } |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14053 +/- ##
============================================
- Coverage 34.71% 34.65% -0.07%
- Complexity 12289 12306 +17
============================================
Files 4192 4203 +11
Lines 99558 99864 +306
Branches 10654 10697 +43
============================================
+ Hits 34565 34606 +41
- Misses 62053 62315 +262
- Partials 2940 2943 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|



…ce collector
The RPC semantic conventions reached Release Candidate with renames the collector only knew by their deprecated 1.x spellings:
rpc.service (deprecated, folded into the fully-qualified rpc.method) is kept as an endPoint fallback for 1.x SDKs; no behavior change there.