Skip to content

Commit

Permalink
server span name follow convention
Browse files Browse the repository at this point in the history
  • Loading branch information
chenlujjj committed Jan 8, 2025
1 parent a5e1a43 commit ee68060
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<JsonRpcRequest> {
// 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());
}
}

0 comments on commit ee68060

Please sign in to comment.