Set span.type = web on jax-rs endpoints
MODIFY
dd-java-agent/instrumentation/jax-rs-annotations/src/main/java/datadog/trace/instrumentation/jaxrs/JaxRsAnnotationsDecorator.java
dd-java-agent/instrumentation/jax-rs-annotations/src/main/java/datadog/trace/instrumentation/jaxrs/JaxRsAnnotationsDecorator.java
@@ -3,6 +3,7 @@ package datadog.trace.instrumentation.jaxrs;
import static datadog.trace.bootstrap.WeakMap.Provider.newWeakMap;
import datadog.trace.agent.decorator.BaseDecorator;
+import datadog.trace.api.DDSpanTypes;
import datadog.trace.api.DDTags;
import datadog.trace.bootstrap.WeakMap;
import io.opentracing.Scope;
@@ -50,8 +51,9 @@ public class JaxRsAnnotationsDecorator extends BaseDecorator {
}
public void updateCurrentScope(final Scope scope, final Method method) {
- String resourceName = getResourceName(method);
final Span span = scope.span();
+ span.setTag(DDTags.SPAN_TYPE, DDSpanTypes.HTTP_SERVER);
+ String resourceName = getResourceName(method);
if (!resourceName.isEmpty()) {
span.setTag(DDTags.RESOURCE_NAME, resourceName);
}

MODIFY
dd-java-agent/instrumentation/jax-rs-annotations/src/test/groovy/JaxRsAnnotationsInstrumentationTest.groovy
dd-java-agent/instrumentation/jax-rs-annotations/src/test/groovy/JaxRsAnnotationsInstrumentationTest.groovy
@@ -27,7 +27,8 @@ class JaxRsAnnotationsInstrumentationTest extends AgentTestRunner {
trace(0, 1) {
span(0) {
operationName "jax-rs.endpoint"
- resourceName 'POST /a'
+ resourceName "POST /a"
+ spanType "web"
tags {
"$Tags.COMPONENT.key" "jax-rs-controller"
defaultTags()
@@ -59,6 +60,7 @@ class JaxRsAnnotationsInstrumentationTest extends AgentTestRunner {
span(1) {
operationName "jax-rs.endpoint"
resourceName name
+ spanType "web"
childOf span(0)
tags {
"$Tags.COMPONENT.key" "jax-rs-controller"

Set span.type = web on jax-rs endpoints