Switch to new Tags class in testing module
MODIFY
dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/asserts/TagsAssert.groovy
dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/asserts/TagsAssert.groovy
@@ -2,9 +2,9 @@ package datadog.trace.agent.test.asserts
import datadog.opentracing.DDSpan
import datadog.trace.api.Config
+import datadog.trace.instrumentation.api.Tags
import groovy.transform.stc.ClosureParams
import groovy.transform.stc.SimpleType
-import io.opentracing.tag.Tags
import java.util.regex.Pattern
@@ -50,7 +50,7 @@ class TagsAssert {
assert tags[Config.RUNTIME_ID_TAG] == null
}
- boolean isServer = (tags[Tags.SPAN_KIND.key] == Tags.SPAN_KIND_SERVER)
+ boolean isServer = (tags[Tags.SPAN_KIND] == Tags.SPAN_KIND_SERVER)
if (isRoot || distributedRootSpan || isServer) {
assert tags[Config.LANGUAGE_TAG_KEY] == Config.LANGUAGE_TAG_VALUE
} else {

MODIFY
dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/base/HttpClientTest.groovy
dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/base/HttpClientTest.groovy
@@ -7,7 +7,7 @@ import datadog.trace.agent.test.asserts.TraceAssert
import datadog.trace.api.Config
import datadog.trace.api.DDSpanTypes
import datadog.trace.api.DDTags
-import io.opentracing.tag.Tags
+import datadog.trace.instrumentation.api.Tags
import spock.lang.AutoCleanup
import spock.lang.Shared
import spock.lang.Unroll
@@ -324,20 +324,20 @@ abstract class HttpClientTest<DECORATOR extends HttpClientDecorator> extends Age
if (exception) {
errorTags(exception.class, exception.message)
}
- "$Tags.COMPONENT.key" clientDecorator.component()
+ "$Tags.COMPONENT" clientDecorator.component()
if (status) {
- "$Tags.HTTP_STATUS.key" status
+ "$Tags.HTTP_STATUS" status
}
- "$Tags.HTTP_URL.key" "${uri.resolve(uri.path)}"
+ "$Tags.HTTP_URL" "${uri.resolve(uri.path)}"
if (tagQueryString) {
"$DDTags.HTTP_QUERY" uri.query
"$DDTags.HTTP_FRAGMENT" { it == null || it == uri.fragment } // Optional
}
- "$Tags.PEER_HOSTNAME.key" "localhost"
- "$Tags.PEER_PORT.key" uri.port
- "$Tags.PEER_HOST_IPV4.key" { it == null || it == "127.0.0.1" } // Optional
- "$Tags.HTTP_METHOD.key" method
- "$Tags.SPAN_KIND.key" Tags.SPAN_KIND_CLIENT
+ "$Tags.PEER_HOSTNAME" "localhost"
+ "$Tags.PEER_PORT" uri.port
+ "$Tags.PEER_HOST_IPV4" { it == null || it == "127.0.0.1" } // Optional
+ "$Tags.HTTP_METHOD" method
+ "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT
}
}
}

MODIFY
dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy
dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy
@@ -8,9 +8,9 @@ import datadog.trace.agent.test.asserts.TraceAssert
import datadog.trace.agent.test.utils.OkHttpUtils
import datadog.trace.agent.test.utils.PortUtils
import datadog.trace.api.DDSpanTypes
+import datadog.trace.instrumentation.api.Tags
import groovy.transform.stc.ClosureParams
import groovy.transform.stc.SimpleType
-import io.opentracing.tag.Tags
import okhttp3.HttpUrl
import okhttp3.OkHttpClient
import okhttp3.Request
@@ -440,21 +440,21 @@ abstract class HttpServerTest<SERVER, DECORATOR extends HttpServerDecorator> ext
}
tags {
defaultTags(true)
- "$Tags.COMPONENT.key" serverDecorator.component()
+ "$Tags.COMPONENT" serverDecorator.component()
if (endpoint.errored) {
- "$Tags.ERROR.key" endpoint.errored
+ "$Tags.ERROR" endpoint.errored
}
- "$Tags.HTTP_STATUS.key" endpoint.status
- "$Tags.HTTP_URL.key" "${endpoint.resolve(address)}"
+ "$Tags.HTTP_STATUS" endpoint.status
+ "$Tags.HTTP_URL" "${endpoint.resolve(address)}"
// if (tagQueryString) {
// "$DDTags.HTTP_QUERY" uri.query
// "$DDTags.HTTP_FRAGMENT" { it == null || it == uri.fragment } // Optional
// }
- "$Tags.PEER_HOSTNAME.key" { it == "localhost" || it == "127.0.0.1" }
- "$Tags.PEER_PORT.key" Integer
- "$Tags.PEER_HOST_IPV4.key" { it == null || it == "127.0.0.1" } // Optional
- "$Tags.HTTP_METHOD.key" method
- "$Tags.SPAN_KIND.key" Tags.SPAN_KIND_SERVER
+ "$Tags.PEER_HOSTNAME" { it == "localhost" || it == "127.0.0.1" }
+ "$Tags.PEER_PORT" Integer
+ "$Tags.PEER_HOST_IPV4" { it == null || it == "127.0.0.1" } // Optional
+ "$Tags.HTTP_METHOD" method
+ "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
}
}
}

MODIFY
dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/server/http/TestHttpServer.groovy
dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/server/http/TestHttpServer.groovy
@@ -3,7 +3,7 @@ package datadog.trace.agent.test.server.http
import datadog.opentracing.DDSpan
import datadog.trace.agent.test.asserts.ListWriterAssert
import datadog.trace.instrumentation.api.AgentSpan
-import io.opentracing.tag.Tags
+import datadog.trace.instrumentation.api.Tags
import org.eclipse.jetty.http.HttpMethods
import org.eclipse.jetty.server.Handler
import org.eclipse.jetty.server.Request
@@ -104,7 +104,7 @@ class TestHttpServer implements AutoCloseable {
childOf(parentSpan)
}
tags {
- "$Tags.SPAN_KIND.key" Tags.SPAN_KIND_SERVER
+ "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
defaultTags(parentSpan != null)
}
}
@@ -235,10 +235,10 @@ class TestHttpServer implements AutoCloseable {
final AgentSpan.Context extractedContext = propagate().extract(req, GETTER)
if (extractedContext != null) {
startSpan("test-http-server", extractedContext)
- .setTag(Tags.SPAN_KIND.key, Tags.SPAN_KIND_SERVER).finish()
+ .setTag(Tags.SPAN_KIND, Tags.SPAN_KIND_SERVER).finish()
} else {
startSpan("test-http-server")
- .setTag(Tags.SPAN_KIND.key, Tags.SPAN_KIND_SERVER).finish()
+ .setTag(Tags.SPAN_KIND, Tags.SPAN_KIND_SERVER).finish()
}
}
}

Switch to new Tags class in testing module