Set span.type = web on jax-rs endpoints
This commit is contained in:
parent
359ac9c190
commit
d877039fa7
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue