From ee68060a5c1e15af3b4d7382b795d1ab312d3bb8 Mon Sep 17 00:00:00 2001 From: chenlujjj <953546398@qq.com> Date: Wed, 8 Jan 2025 20:12:50 +0800 Subject: [PATCH] server span name follow convention --- .../jsonrpc4j/v1_6/JsonRpcServerSpanNameExtractor.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/instrumentation/jsonrpc4j-1.6/library/src/main/java/io/opentelemetry/instrumentation/jsonrpc4j/v1_6/JsonRpcServerSpanNameExtractor.java b/instrumentation/jsonrpc4j-1.6/library/src/main/java/io/opentelemetry/instrumentation/jsonrpc4j/v1_6/JsonRpcServerSpanNameExtractor.java index 385f8f2a00c8..79f6d29a1017 100644 --- a/instrumentation/jsonrpc4j-1.6/library/src/main/java/io/opentelemetry/instrumentation/jsonrpc4j/v1_6/JsonRpcServerSpanNameExtractor.java +++ b/instrumentation/jsonrpc4j-1.6/library/src/main/java/io/opentelemetry/instrumentation/jsonrpc4j/v1_6/JsonRpcServerSpanNameExtractor.java @@ -6,10 +6,13 @@ package io.opentelemetry.instrumentation.jsonrpc4j.v1_6; import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor; +import java.lang.reflect.Method; public class JsonRpcServerSpanNameExtractor implements SpanNameExtractor { + // Follow https://opentelemetry.io/docs/specs/semconv/rpc/rpc-spans/#span-name @Override public String extract(JsonRpcRequest request) { - return request.getMethod().getName(); + Method method = request.getMethod(); + return String.format("%s/%s", method.getDeclaringClass().getName(), method.getName()); } }