Skip to content

Commit 8eed5ba

Browse files
committed
feat(bootstrap): Improve default instrumentation name for http servers
1 parent 44f8ed9 commit 8eed5ba

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/HttpServerDecorator.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public abstract class HttpServerDecorator<REQUEST, CONNECTION, RESPONSE, REQUEST
7272
Config.get().isRuleEnabled("URLAsResourceNameRule");
7373

7474
private static final BitSet SERVER_ERROR_STATUSES = Config.get().getHttpServerErrorStatuses();
75+
private static final String DEFAULT_INSTRUMENTATION_NAME = "http-server";
7576

7677
private final boolean traceClientIpResolverEnabled =
7778
Config.get().isTraceClientIpResolverEnabled();
@@ -140,8 +141,11 @@ public Context extract(REQUEST_CARRIER carrier) {
140141
* @return A new context bundling the span, child of the given parent context.
141142
*/
142143
public Context startSpan(REQUEST_CARRIER carrier, Context context) {
144+
String[] instrumentationNames = instrumentationNames();
143145
String instrumentationName =
144-
instrumentationNames().length == 0 ? "http-server" : instrumentationNames()[0];
146+
instrumentationNames != null && instrumentationNames.length > 0
147+
? instrumentationNames[0]
148+
: DEFAULT_INSTRUMENTATION_NAME;
145149
AgentSpanContext.Extracted extracted = callIGCallbackStart(context);
146150
AgentSpan span =
147151
tracer().startSpan(instrumentationName, spanName(), extracted).setMeasured(true);

0 commit comments

Comments
 (0)