diff --git a/dd-java-agent/instrumentation/akka-http-10.0/src/lagomTest/groovy/LagomTest.groovy b/dd-java-agent/instrumentation/akka-http-10.0/src/lagomTest/groovy/LagomTest.groovy index 788d636c19..407c06a6d3 100644 --- a/dd-java-agent/instrumentation/akka-http-10.0/src/lagomTest/groovy/LagomTest.groovy +++ b/dd-java-agent/instrumentation/akka-http-10.0/src/lagomTest/groovy/LagomTest.groovy @@ -65,12 +65,12 @@ class LagomTest extends AgentTestRunner { spanType DDSpanTypes.HTTP_SERVER errored false tags { - defaultTags() - "$Tags.HTTP_STATUS" 101 + "$Tags.COMPONENT" "akka-http-server" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER "$Tags.HTTP_URL" "ws://localhost:${server.port()}/echo" "$Tags.HTTP_METHOD" "GET" - "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER - "$Tags.COMPONENT" "akka-http-server" + "$Tags.HTTP_STATUS" 101 + defaultTags() } } span(1) { @@ -104,13 +104,13 @@ class LagomTest extends AgentTestRunner { spanType DDSpanTypes.HTTP_SERVER errored true tags { - defaultTags() - "$Tags.HTTP_STATUS" 500 + "$Tags.COMPONENT" "akka-http-server" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER "$Tags.HTTP_URL" "ws://localhost:${server.port()}/error" "$Tags.HTTP_METHOD" "GET" - "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER - "$Tags.COMPONENT" "akka-http-server" + "$Tags.HTTP_STATUS" 500 "$Tags.ERROR" true + defaultTags() } } } diff --git a/dd-java-agent/instrumentation/akka-http-10.0/src/test/groovy/AkkaHttpClientInstrumentationTest.groovy b/dd-java-agent/instrumentation/akka-http-10.0/src/test/groovy/AkkaHttpClientInstrumentationTest.groovy index 3fb34a7658..d513dac7b4 100644 --- a/dd-java-agent/instrumentation/akka-http-10.0/src/test/groovy/AkkaHttpClientInstrumentationTest.groovy +++ b/dd-java-agent/instrumentation/akka-http-10.0/src/test/groovy/AkkaHttpClientInstrumentationTest.groovy @@ -73,11 +73,11 @@ class AkkaHttpClientInstrumentationTest extends HttpClientTest { parent() } tags { + "$Tags.COMPONENT" serverDecorator.component() + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.PEER_HOSTNAME" { it == "localhost" || it == "127.0.0.1" } + "$Tags.PEER_HOST_IPV4" { it == null || it == "127.0.0.1" } // Optional + "$Tags.PEER_PORT" Integer + "$Tags.HTTP_STATUS" endpoint.status + "$Tags.HTTP_METHOD" method + "$Tags.HTTP_URL" "${endpoint.resolve(address)}" "servlet.context" "/$context" "servlet.path" endpoint.path "span.origin.type" { it.startsWith("TestServlets\$") || it == DefaultServlet.name } - - defaultTags(true) - "$Tags.COMPONENT" serverDecorator.component() if (endpoint.errored) { "$Tags.ERROR" endpoint.errored "error.msg" { it == null || it == EXCEPTION.body } "error.type" { it == null || it == Exception.name } "error.stack" { it == null || it instanceof String } } - "$Tags.HTTP_STATUS" endpoint.status - "$Tags.HTTP_URL" "${endpoint.resolve(address)}" - "$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 + defaultTags(true) } } } diff --git a/dd-java-agent/instrumentation/grpc-1.5/src/test/groovy/GrpcStreamingTest.groovy b/dd-java-agent/instrumentation/grpc-1.5/src/test/groovy/GrpcStreamingTest.groovy index b7911d204a..14d7a7b8bd 100644 --- a/dd-java-agent/instrumentation/grpc-1.5/src/test/groovy/GrpcStreamingTest.groovy +++ b/dd-java-agent/instrumentation/grpc-1.5/src/test/groovy/GrpcStreamingTest.groovy @@ -91,9 +91,9 @@ class GrpcStreamingTest extends AgentTestRunner { childOf trace(1).get(0) errored false tags { - "status.code" "OK" - "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER "$Tags.COMPONENT" "grpc-server" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "status.code" "OK" defaultTags(true) } } @@ -106,8 +106,8 @@ class GrpcStreamingTest extends AgentTestRunner { childOf span(0) errored false tags { - "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER "$Tags.COMPONENT" "grpc-server" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER "message.type" "example.Helloworld\$Response" defaultTags() } @@ -123,9 +123,9 @@ class GrpcStreamingTest extends AgentTestRunner { parent() errored false tags { - "status.code" "OK" - "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT "$Tags.COMPONENT" "grpc-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "status.code" "OK" defaultTags() } } @@ -138,8 +138,8 @@ class GrpcStreamingTest extends AgentTestRunner { childOf span(0) errored false tags { - "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT "$Tags.COMPONENT" "grpc-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT "message.type" "example.Helloworld\$Response" defaultTags() } diff --git a/dd-java-agent/instrumentation/grpc-1.5/src/test/groovy/GrpcTest.groovy b/dd-java-agent/instrumentation/grpc-1.5/src/test/groovy/GrpcTest.groovy index 564704c025..090e934bfb 100644 --- a/dd-java-agent/instrumentation/grpc-1.5/src/test/groovy/GrpcTest.groovy +++ b/dd-java-agent/instrumentation/grpc-1.5/src/test/groovy/GrpcTest.groovy @@ -47,9 +47,9 @@ class GrpcTest extends AgentTestRunner { childOf trace(1).get(0) errored false tags { - "status.code" "OK" - "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER "$Tags.COMPONENT" "grpc-server" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "status.code" "OK" defaultTags(true) } } @@ -61,8 +61,8 @@ class GrpcTest extends AgentTestRunner { childOf span(0) errored false tags { - "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER "$Tags.COMPONENT" "grpc-server" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER "message.type" "example.Helloworld\$Request" defaultTags() } @@ -77,9 +77,9 @@ class GrpcTest extends AgentTestRunner { parent() errored false tags { - "status.code" "OK" - "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT "$Tags.COMPONENT" "grpc-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "status.code" "OK" defaultTags() } } @@ -91,8 +91,8 @@ class GrpcTest extends AgentTestRunner { childOf span(0) errored false tags { - "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT "$Tags.COMPONENT" "grpc-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT "message.type" "example.Helloworld\$Response" defaultTags() } @@ -139,10 +139,10 @@ class GrpcTest extends AgentTestRunner { childOf trace(1).get(0) errored true tags { + "$Tags.COMPONENT" "grpc-server" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER "status.code" "${status.code.name()}" "status.description" description - "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER - "$Tags.COMPONENT" "grpc-server" if (status.cause != null) { errorTags status.cause.class, status.cause.message } else { @@ -159,8 +159,8 @@ class GrpcTest extends AgentTestRunner { childOf span(0) errored false tags { - "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER "$Tags.COMPONENT" "grpc-server" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER "message.type" "example.Helloworld\$Request" defaultTags() } @@ -175,10 +175,10 @@ class GrpcTest extends AgentTestRunner { parent() errored true tags { + "$Tags.COMPONENT" "grpc-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT "status.code" "${status.code.name()}" "status.description" description - "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT - "$Tags.COMPONENT" "grpc-client" tag "error", true defaultTags() } @@ -231,8 +231,8 @@ class GrpcTest extends AgentTestRunner { childOf trace(1).get(0) errored true tags { - "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER "$Tags.COMPONENT" "grpc-server" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER errorTags error.class, error.message defaultTags(true) } @@ -245,8 +245,8 @@ class GrpcTest extends AgentTestRunner { childOf span(0) errored false tags { - "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER "$Tags.COMPONENT" "grpc-server" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER "message.type" "example.Helloworld\$Request" defaultTags() } @@ -261,9 +261,9 @@ class GrpcTest extends AgentTestRunner { parent() errored true tags { - "status.code" "UNKNOWN" - "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT "$Tags.COMPONENT" "grpc-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "status.code" "UNKNOWN" tag "error", true defaultTags() } diff --git a/dd-java-agent/instrumentation/hibernate/core-3.3/src/test/groovy/SessionTest.groovy b/dd-java-agent/instrumentation/hibernate/core-3.3/src/test/groovy/SessionTest.groovy index 67f4319b37..6fa2f01e7f 100644 --- a/dd-java-agent/instrumentation/hibernate/core-3.3/src/test/groovy/SessionTest.groovy +++ b/dd-java-agent/instrumentation/hibernate/core-3.3/src/test/groovy/SessionTest.groovy @@ -314,10 +314,9 @@ class SessionTest extends AbstractHibernateTest { childOf span(0) errored(true) tags { - errorTags(MappingException, "Unknown entity: java.lang.Long") - "$Tags.COMPONENT" "java-hibernate" "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + errorTags(MappingException, "Unknown entity: java.lang.Long") defaultTags() } } diff --git a/dd-java-agent/instrumentation/hibernate/core-4.0/src/test/groovy/SessionTest.groovy b/dd-java-agent/instrumentation/hibernate/core-4.0/src/test/groovy/SessionTest.groovy index 1a18f94fc9..e8773d469e 100644 --- a/dd-java-agent/instrumentation/hibernate/core-4.0/src/test/groovy/SessionTest.groovy +++ b/dd-java-agent/instrumentation/hibernate/core-4.0/src/test/groovy/SessionTest.groovy @@ -247,10 +247,9 @@ class SessionTest extends AbstractHibernateTest { childOf span(0) errored(true) tags { - errorTags(MappingException, "Unknown entity: java.lang.Long") - "$Tags.COMPONENT" "java-hibernate" "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + errorTags(MappingException, "Unknown entity: java.lang.Long") defaultTags() } } diff --git a/dd-java-agent/instrumentation/hibernate/core-4.3/src/test/groovy/ProcedureCallTest.groovy b/dd-java-agent/instrumentation/hibernate/core-4.3/src/test/groovy/ProcedureCallTest.groovy index 674645595f..2fa4069a0a 100644 --- a/dd-java-agent/instrumentation/hibernate/core-4.3/src/test/groovy/ProcedureCallTest.groovy +++ b/dd-java-agent/instrumentation/hibernate/core-4.3/src/test/groovy/ProcedureCallTest.groovy @@ -162,9 +162,9 @@ class ProcedureCallTest extends AgentTestRunner { childOf span(0) errored(true) tags { - errorTags(SQLGrammarException, "could not prepare statement") "$Tags.COMPONENT" "java-hibernate" "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + errorTags(SQLGrammarException, "could not prepare statement") defaultTags() } } diff --git a/dd-java-agent/instrumentation/http-url-connection/src/test/groovy/HttpUrlConnectionTest.groovy b/dd-java-agent/instrumentation/http-url-connection/src/test/groovy/HttpUrlConnectionTest.groovy index 7547d7da31..da235125bb 100644 --- a/dd-java-agent/instrumentation/http-url-connection/src/test/groovy/HttpUrlConnectionTest.groovy +++ b/dd-java-agent/instrumentation/http-url-connection/src/test/groovy/HttpUrlConnectionTest.groovy @@ -98,11 +98,11 @@ class HttpUrlConnectionTest extends HttpClientTest { tags { "$Tags.COMPONENT" "http-url-connection" "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.PEER_HOSTNAME" "localhost" + "$Tags.PEER_PORT" server.address.port "$Tags.HTTP_URL" "$url" "$Tags.HTTP_METHOD" "GET" "$Tags.HTTP_STATUS" STATUS - "$Tags.PEER_HOSTNAME" "localhost" - "$Tags.PEER_PORT" server.address.port defaultTags() } } @@ -116,11 +116,11 @@ class HttpUrlConnectionTest extends HttpClientTest { tags { "$Tags.COMPONENT" "http-url-connection" "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.PEER_HOSTNAME" "localhost" + "$Tags.PEER_PORT" server.address.port "$Tags.HTTP_URL" "$url" "$Tags.HTTP_METHOD" "GET" "$Tags.HTTP_STATUS" STATUS - "$Tags.PEER_HOSTNAME" "localhost" - "$Tags.PEER_PORT" server.address.port defaultTags() } } @@ -183,11 +183,11 @@ class HttpUrlConnectionTest extends HttpClientTest { tags { "$Tags.COMPONENT" "http-url-connection" "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.PEER_HOSTNAME" "localhost" + "$Tags.PEER_PORT" server.address.port "$Tags.HTTP_URL" "$url" "$Tags.HTTP_METHOD" "GET" "$Tags.HTTP_STATUS" STATUS - "$Tags.PEER_HOSTNAME" "localhost" - "$Tags.PEER_PORT" server.address.port defaultTags() } } @@ -201,11 +201,11 @@ class HttpUrlConnectionTest extends HttpClientTest { tags { "$Tags.COMPONENT" "http-url-connection" "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.PEER_HOSTNAME" "localhost" + "$Tags.PEER_PORT" server.address.port "$Tags.HTTP_URL" "$url" "$Tags.HTTP_METHOD" "GET" "$Tags.HTTP_STATUS" STATUS - "$Tags.PEER_HOSTNAME" "localhost" - "$Tags.PEER_PORT" server.address.port defaultTags() } } @@ -253,11 +253,11 @@ class HttpUrlConnectionTest extends HttpClientTest { tags { "$Tags.COMPONENT" "http-url-connection" "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.PEER_HOSTNAME" "localhost" + "$Tags.PEER_PORT" server.address.port "$Tags.HTTP_URL" "$url" "$Tags.HTTP_METHOD" "GET" "$Tags.HTTP_STATUS" STATUS - "$Tags.PEER_HOSTNAME" "localhost" - "$Tags.PEER_PORT" server.address.port defaultTags() } } @@ -321,11 +321,11 @@ class HttpUrlConnectionTest extends HttpClientTest { tags { "$Tags.COMPONENT" "http-url-connection" "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.PEER_HOSTNAME" "localhost" + "$Tags.PEER_PORT" server.address.port "$Tags.HTTP_URL" "$url" "$Tags.HTTP_METHOD" "POST" "$Tags.HTTP_STATUS" STATUS - "$Tags.PEER_HOSTNAME" "localhost" - "$Tags.PEER_PORT" server.address.port defaultTags() } } diff --git a/dd-java-agent/instrumentation/http-url-connection/src/test/groovy/UrlConnectionTest.groovy b/dd-java-agent/instrumentation/http-url-connection/src/test/groovy/UrlConnectionTest.groovy index 7d39a95024..7162606ece 100644 --- a/dd-java-agent/instrumentation/http-url-connection/src/test/groovy/UrlConnectionTest.groovy +++ b/dd-java-agent/instrumentation/http-url-connection/src/test/groovy/UrlConnectionTest.groovy @@ -50,10 +50,10 @@ class UrlConnectionTest extends AgentTestRunner { tags { "$Tags.COMPONENT" "http-url-connection" "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT - "$Tags.HTTP_URL" "$url/" - "$Tags.HTTP_METHOD" "GET" "$Tags.PEER_HOSTNAME" "localhost" "$Tags.PEER_PORT" UNUSABLE_PORT + "$Tags.HTTP_URL" "$url/" + "$Tags.HTTP_METHOD" "GET" errorTags ConnectException, String defaultTags() } @@ -105,9 +105,9 @@ class UrlConnectionTest extends AgentTestRunner { tags { "$Tags.COMPONENT" UrlInstrumentation.COMPONENT "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.PEER_PORT" 80 // FIXME: These tags really make no sense for non-http connections, why do we set them? "$Tags.HTTP_URL" "$url" - "$Tags.PEER_PORT" 80 errorTags IllegalArgumentException, String defaultTags() } diff --git a/dd-java-agent/instrumentation/hystrix-1.4/src/test/groovy/HystrixObservableChainTest.groovy b/dd-java-agent/instrumentation/hystrix-1.4/src/test/groovy/HystrixObservableChainTest.groovy index 128d098c3d..f055ab73b9 100644 --- a/dd-java-agent/instrumentation/hystrix-1.4/src/test/groovy/HystrixObservableChainTest.groovy +++ b/dd-java-agent/instrumentation/hystrix-1.4/src/test/groovy/HystrixObservableChainTest.groovy @@ -90,10 +90,10 @@ class HystrixObservableChainTest extends AgentTestRunner { childOf span(3) errored false tags { + "$Tags.COMPONENT" "hystrix" "hystrix.command" "HystrixObservableChainTest\$2" "hystrix.group" "OtherGroup" "hystrix.circuit-open" false - "$Tags.COMPONENT" "hystrix" defaultTags() } } @@ -117,10 +117,10 @@ class HystrixObservableChainTest extends AgentTestRunner { childOf span(0) errored false tags { + "$Tags.COMPONENT" "hystrix" "hystrix.command" "HystrixObservableChainTest\$1" "hystrix.group" "ExampleGroup" "hystrix.circuit-open" false - "$Tags.COMPONENT" "hystrix" defaultTags() } } diff --git a/dd-java-agent/instrumentation/hystrix-1.4/src/test/groovy/HystrixObservableTest.groovy b/dd-java-agent/instrumentation/hystrix-1.4/src/test/groovy/HystrixObservableTest.groovy index 151bde9745..1d1f463b48 100644 --- a/dd-java-agent/instrumentation/hystrix-1.4/src/test/groovy/HystrixObservableTest.groovy +++ b/dd-java-agent/instrumentation/hystrix-1.4/src/test/groovy/HystrixObservableTest.groovy @@ -82,10 +82,10 @@ class HystrixObservableTest extends AgentTestRunner { childOf span(0) errored false tags { + "$Tags.COMPONENT" "hystrix" "hystrix.command" "HystrixObservableTest\$1" "hystrix.group" "ExampleGroup" "hystrix.circuit-open" false - "$Tags.COMPONENT" "hystrix" defaultTags() } } @@ -192,10 +192,10 @@ class HystrixObservableTest extends AgentTestRunner { childOf span(0) errored true tags { + "$Tags.COMPONENT" "hystrix" "hystrix.command" "HystrixObservableTest\$2" "hystrix.group" "ExampleGroup" "hystrix.circuit-open" false - "$Tags.COMPONENT" "hystrix" errorTags(IllegalArgumentException) defaultTags() } @@ -208,10 +208,10 @@ class HystrixObservableTest extends AgentTestRunner { childOf span(1) errored false tags { + "$Tags.COMPONENT" "hystrix" "hystrix.command" "HystrixObservableTest\$2" "hystrix.group" "ExampleGroup" "hystrix.circuit-open" false - "$Tags.COMPONENT" "hystrix" defaultTags() } } @@ -312,10 +312,10 @@ class HystrixObservableTest extends AgentTestRunner { childOf span(0) errored true tags { + "$Tags.COMPONENT" "hystrix" "hystrix.command" "HystrixObservableTest\$3" "hystrix.group" "FailingGroup" "hystrix.circuit-open" false - "$Tags.COMPONENT" "hystrix" errorTags(IllegalArgumentException) defaultTags() } @@ -328,10 +328,10 @@ class HystrixObservableTest extends AgentTestRunner { childOf span(1) errored true tags { + "$Tags.COMPONENT" "hystrix" "hystrix.command" "HystrixObservableTest\$3" "hystrix.group" "FailingGroup" "hystrix.circuit-open" false - "$Tags.COMPONENT" "hystrix" errorTags(UnsupportedOperationException, "No fallback available.") defaultTags() } diff --git a/dd-java-agent/instrumentation/hystrix-1.4/src/test/groovy/HystrixTest.groovy b/dd-java-agent/instrumentation/hystrix-1.4/src/test/groovy/HystrixTest.groovy index 0b059139d2..e16564a256 100644 --- a/dd-java-agent/instrumentation/hystrix-1.4/src/test/groovy/HystrixTest.groovy +++ b/dd-java-agent/instrumentation/hystrix-1.4/src/test/groovy/HystrixTest.groovy @@ -62,10 +62,10 @@ class HystrixTest extends AgentTestRunner { childOf span(0) errored false tags { + "$Tags.COMPONENT" "hystrix" "hystrix.command" "HystrixTest\$1" "hystrix.group" "ExampleGroup" "hystrix.circuit-open" false - "$Tags.COMPONENT" "hystrix" defaultTags() } } @@ -140,10 +140,10 @@ class HystrixTest extends AgentTestRunner { childOf span(0) errored true tags { + "$Tags.COMPONENT" "hystrix" "hystrix.command" "HystrixTest\$2" "hystrix.group" "ExampleGroup" "hystrix.circuit-open" false - "$Tags.COMPONENT" "hystrix" errorTags(IllegalArgumentException) defaultTags() } @@ -156,10 +156,10 @@ class HystrixTest extends AgentTestRunner { childOf span(1) errored false tags { + "$Tags.COMPONENT" "hystrix" "hystrix.command" "HystrixTest\$2" "hystrix.group" "ExampleGroup" "hystrix.circuit-open" false - "$Tags.COMPONENT" "hystrix" defaultTags() } } diff --git a/dd-java-agent/instrumentation/java-concurrent/src/slickTest/groovy/SlickTest.groovy b/dd-java-agent/instrumentation/java-concurrent/src/slickTest/groovy/SlickTest.groovy index c550ef698b..354260bf59 100644 --- a/dd-java-agent/instrumentation/java-concurrent/src/slickTest/groovy/SlickTest.groovy +++ b/dd-java-agent/instrumentation/java-concurrent/src/slickTest/groovy/SlickTest.groovy @@ -38,13 +38,10 @@ class SlickTest extends AgentTestRunner { tags { "$Tags.COMPONENT" "java-jdbc-prepared_statement" "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT - "$Tags.DB_TYPE" SlickUtils.Driver() + "$Tags.DB_INSTANCE" SlickUtils.Db() "$Tags.DB_USER" SlickUtils.Username() - - "db.instance" SlickUtils.Db() "span.origin.type" "org.h2.jdbc.JdbcPreparedStatement" - defaultTags() } } diff --git a/dd-java-agent/instrumentation/jax-rs-annotations-2/src/test/groovy/DropwizardTest.groovy b/dd-java-agent/instrumentation/jax-rs-annotations-2/src/test/groovy/DropwizardTest.groovy index 06eda17163..8d591db596 100644 --- a/dd-java-agent/instrumentation/jax-rs-annotations-2/src/test/groovy/DropwizardTest.groovy +++ b/dd-java-agent/instrumentation/jax-rs-annotations-2/src/test/groovy/DropwizardTest.groovy @@ -2,6 +2,7 @@ import datadog.opentracing.DDSpan import datadog.trace.agent.test.asserts.TraceAssert import datadog.trace.agent.test.base.HttpServerTest import datadog.trace.api.DDSpanTypes +import datadog.trace.instrumentation.api.Tags import datadog.trace.instrumentation.jaxrs2.JaxRsAnnotationsDecorator import datadog.trace.instrumentation.servlet3.Servlet3Decorator import io.dropwizard.Application @@ -10,7 +11,6 @@ import io.dropwizard.setup.Bootstrap import io.dropwizard.setup.Environment import io.dropwizard.testing.ConfigOverride import io.dropwizard.testing.DropwizardTestSupport -import io.opentracing.tag.Tags import org.eclipse.jetty.servlet.ServletHandler import javax.ws.rs.GET @@ -85,11 +85,11 @@ class DropwizardTest extends HttpServerTest { parent() } tags { - "span.origin.type" handlerName - defaultTags(true) "$Tags.COMPONENT" serverDecorator.component() + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.PEER_HOSTNAME" { it == "localhost" || it == "127.0.0.1" } + "$Tags.PEER_HOST_IPV4" { it == null || it == "127.0.0.1" } // Optional + "$Tags.PEER_PORT" Integer + "$Tags.HTTP_URL" "${endpoint.resolve(address)}" + "$Tags.HTTP_METHOD" method + "$Tags.HTTP_STATUS" endpoint.status + "span.origin.type" handlerName if (endpoint.errored) { "$Tags.ERROR" endpoint.errored "error.msg" { it == null || it == EXCEPTION.body } "error.type" { it == null || it == Exception.name } "error.stack" { it == null || it instanceof String } } - "$Tags.HTTP_STATUS" endpoint.status - "$Tags.HTTP_URL" "${endpoint.resolve(address)}" - "$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 + defaultTags(true) } } } diff --git a/dd-java-agent/instrumentation/jms/src/latestDepTest/groovy/JMS2Test.groovy b/dd-java-agent/instrumentation/jms/src/latestDepTest/groovy/JMS2Test.groovy index 8fcd9aa77d..15d1e500b0 100644 --- a/dd-java-agent/instrumentation/jms/src/latestDepTest/groovy/JMS2Test.groovy +++ b/dd-java-agent/instrumentation/jms/src/latestDepTest/groovy/JMS2Test.groovy @@ -163,10 +163,10 @@ class JMS2Test extends AgentTestRunner { errored false tags { - defaultTags() - "${Tags.COMPONENT}" "jms" - "${Tags.SPAN_KIND}" "consumer" + "$Tags.COMPONENT" "jms" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CONSUMER "span.origin.type" HornetQMessageConsumer.name + defaultTags() } } } @@ -201,10 +201,10 @@ class JMS2Test extends AgentTestRunner { errored false tags { - defaultTags() - "${Tags.COMPONENT}" "jms" - "${Tags.SPAN_KIND}" "consumer" + "$Tags.COMPONENT" "jms" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CONSUMER "span.origin.type" HornetQMessageConsumer.name + defaultTags() } } } @@ -230,10 +230,10 @@ class JMS2Test extends AgentTestRunner { errored false tags { - defaultTags() - "${Tags.COMPONENT}" "jms" - "${Tags.SPAN_KIND}" "producer" + "$Tags.COMPONENT" "jms" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_PRODUCER "span.origin.type" HornetQMessageProducer.name + defaultTags() } } } @@ -255,10 +255,10 @@ class JMS2Test extends AgentTestRunner { errored false tags { - defaultTags(true) "${Tags.COMPONENT}" "jms" "${Tags.SPAN_KIND}" "consumer" "span.origin.type" origin.name + defaultTags(true) } } } diff --git a/dd-java-agent/instrumentation/jms/src/test/groovy/JMS1Test.groovy b/dd-java-agent/instrumentation/jms/src/test/groovy/JMS1Test.groovy index 51daf528f7..dadc05e21e 100644 --- a/dd-java-agent/instrumentation/jms/src/test/groovy/JMS1Test.groovy +++ b/dd-java-agent/instrumentation/jms/src/test/groovy/JMS1Test.groovy @@ -126,10 +126,10 @@ class JMS1Test extends AgentTestRunner { errored false tags { - defaultTags() - "${Tags.COMPONENT}" "jms" - "${Tags.SPAN_KIND}" "consumer" + "$Tags.COMPONENT" "jms" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CONSUMER "span.origin.type" ActiveMQMessageConsumer.name + defaultTags() } } } @@ -164,10 +164,10 @@ class JMS1Test extends AgentTestRunner { errored false tags { - defaultTags() - "${Tags.COMPONENT}" "jms" - "${Tags.SPAN_KIND}" "consumer" + "$Tags.COMPONENT" "jms" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CONSUMER "span.origin.type" ActiveMQMessageConsumer.name + defaultTags() } } } @@ -215,10 +215,10 @@ class JMS1Test extends AgentTestRunner { errored false tags { - defaultTags() - "${Tags.COMPONENT}" "jms" - "${Tags.SPAN_KIND}" "consumer" + "$Tags.COMPONENT" "jms" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CONSUMER "span.origin.type" ActiveMQMessageConsumer.name + defaultTags() } } } @@ -247,10 +247,10 @@ class JMS1Test extends AgentTestRunner { parent() tags { - defaultTags() - "${Tags.COMPONENT}" "jms" - "${Tags.SPAN_KIND}" "producer" + "$Tags.COMPONENT" "jms" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_PRODUCER "span.origin.type" ActiveMQMessageProducer.name + defaultTags() } } } @@ -272,10 +272,10 @@ class JMS1Test extends AgentTestRunner { childOf parentSpan tags { - defaultTags(true) - "${Tags.COMPONENT}" "jms" - "${Tags.SPAN_KIND}" "consumer" + "$Tags.COMPONENT" "jms" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CONSUMER "span.origin.type" origin.name + defaultTags(true) } } } diff --git a/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationBasicTests.groovy b/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationBasicTests.groovy index 39f2c66e01..26535e877c 100644 --- a/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationBasicTests.groovy +++ b/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationBasicTests.groovy @@ -3,6 +3,7 @@ import datadog.trace.agent.test.AgentTestRunner 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 okhttp3.MultipartBody import okhttp3.OkHttpClient import okhttp3.Request @@ -93,17 +94,17 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { spanType DDSpanTypes.HTTP_SERVER errored false tags { - "http.url" "http://localhost:$port/$jspWebappContext/$jspFileName" - "http.method" "GET" - "peer.hostname" "127.0.0.1" - "peer.ipv4" "127.0.0.1" - "peer.port" Integer - "span.kind" "server" - "component" "java-web-servlet" + "$Tags.COMPONENT" "java-web-servlet" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.PEER_HOSTNAME" "127.0.0.1" + "$Tags.PEER_HOST_IPV4" "127.0.0.1" + "$Tags.PEER_PORT" Integer + "$Tags.HTTP_URL" "http://localhost:$port/$jspWebappContext/$jspFileName" + "$Tags.HTTP_METHOD" "GET" + "$Tags.HTTP_STATUS" 200 "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" "servlet.path" "/$jspFileName" - "http.status_code" 200 defaultTags() } } @@ -114,7 +115,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/$jspFileName" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" jspClassName "servlet.context" "/$jspWebappContext" "jsp.requestURL" reqUrl @@ -128,7 +129,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/$jspFileName" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.$jspClassNamePrefix$jspClassName" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -169,17 +170,17 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { spanType DDSpanTypes.HTTP_SERVER errored false tags { - "http.url" "http://localhost:$port/$jspWebappContext/getQuery.jsp" - "http.method" "GET" - "peer.hostname" "127.0.0.1" - "peer.ipv4" "127.0.0.1" - "peer.port" Integer - "span.kind" "server" - "component" "java-web-servlet" + "$Tags.COMPONENT" "java-web-servlet" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.PEER_HOSTNAME" "127.0.0.1" + "$Tags.PEER_HOST_IPV4" "127.0.0.1" + "$Tags.PEER_PORT" Integer + "$Tags.HTTP_URL" "http://localhost:$port/$jspWebappContext/getQuery.jsp" + "$Tags.HTTP_METHOD" "GET" + "$Tags.HTTP_STATUS" 200 "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" "servlet.path" "/getQuery.jsp" - "http.status_code" 200 defaultTags() } } @@ -190,7 +191,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/getQuery.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" "getQuery_jsp" "servlet.context" "/$jspWebappContext" "jsp.requestURL" reqUrl @@ -204,7 +205,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/getQuery.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.getQuery_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -242,17 +243,17 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { spanType DDSpanTypes.HTTP_SERVER errored false tags { - "http.url" "http://localhost:$port/$jspWebappContext/post.jsp" - "http.method" "POST" - "peer.hostname" "127.0.0.1" - "peer.ipv4" "127.0.0.1" - "peer.port" Integer - "span.kind" "server" - "component" "java-web-servlet" + "$Tags.COMPONENT" "java-web-servlet" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.PEER_HOSTNAME" "127.0.0.1" + "$Tags.PEER_HOST_IPV4" "127.0.0.1" + "$Tags.PEER_PORT" Integer + "$Tags.HTTP_URL" "http://localhost:$port/$jspWebappContext/post.jsp" + "$Tags.HTTP_METHOD" "POST" + "$Tags.HTTP_STATUS" 200 "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" "servlet.path" "/post.jsp" - "http.status_code" 200 defaultTags() } } @@ -263,7 +264,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/post.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" "post_jsp" "servlet.context" "/$jspWebappContext" "jsp.requestURL" reqUrl @@ -277,7 +278,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/post.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.post_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -312,17 +313,17 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { spanType DDSpanTypes.HTTP_SERVER errored true tags { - "http.url" "http://localhost:$port/$jspWebappContext/$jspFileName" - "http.method" "GET" - "peer.hostname" "127.0.0.1" - "peer.ipv4" "127.0.0.1" - "peer.port" Integer - "span.kind" "server" - "component" "java-web-servlet" + "$Tags.COMPONENT" "java-web-servlet" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.PEER_HOSTNAME" "127.0.0.1" + "$Tags.PEER_HOST_IPV4" "127.0.0.1" + "$Tags.PEER_PORT" Integer + "$Tags.HTTP_URL" "http://localhost:$port/$jspWebappContext/$jspFileName" + "$Tags.HTTP_METHOD" "GET" + "$Tags.HTTP_STATUS" 500 "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" "servlet.path" "/$jspFileName" - "http.status_code" 500 "error" true "error.type" { String tagExceptionType -> return tagExceptionType == exceptionClass.getName() || tagExceptionType.contains(exceptionClass.getSimpleName()) @@ -341,7 +342,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/$jspFileName" errored true tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" jspClassName "servlet.context" "/$jspWebappContext" "jsp.requestURL" reqUrl @@ -363,7 +364,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/$jspFileName" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.$jspClassName" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -403,17 +404,17 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { spanType DDSpanTypes.HTTP_SERVER errored false tags { - "http.url" "http://localhost:$port/$jspWebappContext/includes/includeHtml.jsp" - "http.method" "GET" - "peer.hostname" "127.0.0.1" - "peer.ipv4" "127.0.0.1" - "peer.port" Integer - "span.kind" "server" - "component" "java-web-servlet" + "$Tags.COMPONENT" "java-web-servlet" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.PEER_HOSTNAME" "127.0.0.1" + "$Tags.PEER_HOST_IPV4" "127.0.0.1" + "$Tags.PEER_PORT" Integer + "$Tags.HTTP_URL" "http://localhost:$port/$jspWebappContext/includes/includeHtml.jsp" + "$Tags.HTTP_METHOD" "GET" + "$Tags.HTTP_STATUS" 200 "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" "servlet.path" "/includes/includeHtml.jsp" - "http.status_code" 200 defaultTags() } } @@ -424,7 +425,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/includes/includeHtml.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" "includeHtml_jsp" "servlet.context" "/$jspWebappContext" "jsp.requestURL" reqUrl @@ -438,7 +439,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/includes/includeHtml.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.includes.includeHtml_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -472,17 +473,17 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { spanType DDSpanTypes.HTTP_SERVER errored false tags { - "http.url" "http://localhost:$port/$jspWebappContext/includes/includeMulti.jsp" - "http.method" "GET" - "peer.hostname" "127.0.0.1" - "peer.ipv4" "127.0.0.1" - "peer.port" Integer - "span.kind" "server" - "component" "java-web-servlet" + "$Tags.COMPONENT" "java-web-servlet" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.PEER_HOSTNAME" "127.0.0.1" + "$Tags.PEER_HOST_IPV4" "127.0.0.1" + "$Tags.PEER_PORT" Integer + "$Tags.HTTP_URL" "http://localhost:$port/$jspWebappContext/includes/includeMulti.jsp" + "$Tags.HTTP_METHOD" "GET" + "$Tags.HTTP_STATUS" 200 "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" "servlet.path" "/includes/includeMulti.jsp" - "http.status_code" 200 defaultTags() } } @@ -493,7 +494,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/includes/includeMulti.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" "includeMulti_jsp" "servlet.context" "/$jspWebappContext" "jsp.requestURL" reqUrl @@ -507,7 +508,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/common/javaLoopH2.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" "javaLoopH2_jsp" "servlet.context" "/$jspWebappContext" "jsp.requestURL" reqUrl @@ -521,7 +522,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/common/javaLoopH2.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.common.javaLoopH2_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -535,7 +536,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/common/javaLoopH2.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" "javaLoopH2_jsp" "servlet.context" "/$jspWebappContext" "jsp.requestURL" reqUrl @@ -549,7 +550,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/common/javaLoopH2.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.common.javaLoopH2_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -563,7 +564,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/includes/includeMulti.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.includes.includeMulti_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -597,17 +598,17 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { spanType DDSpanTypes.HTTP_SERVER errored true tags { - "http.url" "http://localhost:$port/$jspWebappContext/$jspFileName" - "http.method" "GET" - "peer.hostname" "127.0.0.1" - "peer.ipv4" "127.0.0.1" - "peer.port" Integer - "span.kind" "server" - "component" "java-web-servlet" + "$Tags.COMPONENT" "java-web-servlet" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.PEER_HOSTNAME" "127.0.0.1" + "$Tags.PEER_HOST_IPV4" "127.0.0.1" + "$Tags.PEER_PORT" Integer + "$Tags.HTTP_URL" "http://localhost:$port/$jspWebappContext/$jspFileName" + "$Tags.HTTP_METHOD" "GET" + "$Tags.HTTP_STATUS" 500 "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" "servlet.path" "/$jspFileName" - "http.status_code" 500 errorTags(JasperException, String) defaultTags() } @@ -619,7 +620,7 @@ class JSPInstrumentationBasicTests extends AgentTestRunner { resourceName "/$jspFileName" errored true tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.$jspClassNamePrefix$jspClassName" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" diff --git a/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationForwardTests.groovy b/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationForwardTests.groovy index b0b0c33cc1..b8ed0d82be 100644 --- a/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationForwardTests.groovy +++ b/dd-java-agent/instrumentation/jsp-2.3/src/test/groovy/JSPInstrumentationForwardTests.groovy @@ -3,6 +3,7 @@ import datadog.trace.agent.test.AgentTestRunner 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 okhttp3.OkHttpClient import okhttp3.Request import okhttp3.Response @@ -92,17 +93,17 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { spanType DDSpanTypes.HTTP_SERVER errored false tags { - "http.url" "http://localhost:$port/$jspWebappContext/$forwardFromFileName" - "http.method" "GET" - "peer.hostname" "127.0.0.1" - "peer.ipv4" "127.0.0.1" - "peer.port" Integer - "span.kind" "server" - "component" "java-web-servlet" + "$Tags.COMPONENT" "java-web-servlet" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.PEER_HOSTNAME" "127.0.0.1" + "$Tags.PEER_HOST_IPV4" "127.0.0.1" + "$Tags.PEER_PORT" Integer + "$Tags.HTTP_URL" "http://localhost:$port/$jspWebappContext/$forwardFromFileName" + "$Tags.HTTP_METHOD" "GET" + "$Tags.HTTP_STATUS" 200 "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" "servlet.path" "/$forwardFromFileName" - "http.status_code" 200 defaultTags() } } @@ -113,7 +114,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/$forwardFromFileName" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" jspForwardFromClassName "servlet.context" "/$jspWebappContext" "jsp.requestURL" reqUrl @@ -127,7 +128,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/$forwardDestFileName" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" jspForwardDestClassName "servlet.context" "/$jspWebappContext" "jsp.forwardOrigin" "/$forwardFromFileName" @@ -142,7 +143,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/$forwardDestFileName" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.$jspForwardDestClassPrefix$jspForwardDestClassName" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -156,7 +157,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/$forwardFromFileName" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.$jspForwardFromClassPrefix$jspForwardFromClassName" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -195,17 +196,17 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { spanType DDSpanTypes.HTTP_SERVER errored false tags { - "http.url" "http://localhost:$port/$jspWebappContext/forwards/forwardToHtml.jsp" - "http.method" "GET" - "peer.hostname" "127.0.0.1" - "peer.ipv4" "127.0.0.1" - "peer.port" Integer - "span.kind" "server" - "component" "java-web-servlet" + "$Tags.COMPONENT" "java-web-servlet" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.PEER_HOSTNAME" "127.0.0.1" + "$Tags.PEER_HOST_IPV4" "127.0.0.1" + "$Tags.PEER_PORT" Integer + "$Tags.HTTP_URL" "http://localhost:$port/$jspWebappContext/forwards/forwardToHtml.jsp" + "$Tags.HTTP_METHOD" "GET" + "$Tags.HTTP_STATUS" 200 "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" "servlet.path" "/forwards/forwardToHtml.jsp" - "http.status_code" 200 defaultTags() } } @@ -216,7 +217,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/forwards/forwardToHtml.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" "forwardToHtml_jsp" "servlet.context" "/$jspWebappContext" "jsp.requestURL" reqUrl @@ -230,7 +231,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/forwards/forwardToHtml.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.forwards.forwardToHtml_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -264,17 +265,17 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { spanType DDSpanTypes.HTTP_SERVER errored false tags { - "http.url" "http://localhost:$port/$jspWebappContext/forwards/forwardToIncludeMulti.jsp" - "http.method" "GET" - "peer.hostname" "127.0.0.1" - "peer.ipv4" "127.0.0.1" - "peer.port" Integer - "span.kind" "server" - "component" "java-web-servlet" + "$Tags.COMPONENT" "java-web-servlet" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.PEER_HOSTNAME" "127.0.0.1" + "$Tags.PEER_HOST_IPV4" "127.0.0.1" + "$Tags.PEER_PORT" Integer + "$Tags.HTTP_URL" "http://localhost:$port/$jspWebappContext/forwards/forwardToIncludeMulti.jsp" + "$Tags.HTTP_METHOD" "GET" + "$Tags.HTTP_STATUS" 200 "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" "servlet.path" "/forwards/forwardToIncludeMulti.jsp" - "http.status_code" 200 defaultTags() } } @@ -285,7 +286,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/forwards/forwardToIncludeMulti.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" "forwardToIncludeMulti_jsp" "servlet.context" "/$jspWebappContext" "jsp.requestURL" reqUrl @@ -299,7 +300,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/includes/includeMulti.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" "includeMulti_jsp" "servlet.context" "/$jspWebappContext" "jsp.forwardOrigin" "/forwards/forwardToIncludeMulti.jsp" @@ -314,7 +315,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/common/javaLoopH2.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" "javaLoopH2_jsp" "servlet.context" "/$jspWebappContext" "jsp.forwardOrigin" "/forwards/forwardToIncludeMulti.jsp" @@ -329,7 +330,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/common/javaLoopH2.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.common.javaLoopH2_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -343,7 +344,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/common/javaLoopH2.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" "javaLoopH2_jsp" "servlet.context" "/$jspWebappContext" "jsp.forwardOrigin" "/forwards/forwardToIncludeMulti.jsp" @@ -358,7 +359,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/common/javaLoopH2.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.common.javaLoopH2_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -372,7 +373,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/includes/includeMulti.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.includes.includeMulti_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -386,7 +387,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/forwards/forwardToIncludeMulti.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.forwards.forwardToIncludeMulti_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -420,17 +421,17 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { spanType DDSpanTypes.HTTP_SERVER errored false tags { - "http.url" "http://localhost:$port/$jspWebappContext/forwards/forwardToJspForward.jsp" - "http.method" "GET" - "peer.hostname" "127.0.0.1" - "peer.ipv4" "127.0.0.1" - "peer.port" Integer - "span.kind" "server" - "component" "java-web-servlet" + "$Tags.COMPONENT" "java-web-servlet" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.PEER_HOSTNAME" "127.0.0.1" + "$Tags.PEER_HOST_IPV4" "127.0.0.1" + "$Tags.PEER_PORT" Integer + "$Tags.HTTP_URL" "http://localhost:$port/$jspWebappContext/forwards/forwardToJspForward.jsp" + "$Tags.HTTP_METHOD" "GET" + "$Tags.HTTP_STATUS" 200 "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" "servlet.path" "/forwards/forwardToJspForward.jsp" - "http.status_code" 200 defaultTags() } } @@ -441,7 +442,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/forwards/forwardToJspForward.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" "forwardToJspForward_jsp" "servlet.context" "/$jspWebappContext" "jsp.requestURL" reqUrl @@ -455,7 +456,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/forwards/forwardToSimpleJava.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" "forwardToSimpleJava_jsp" "servlet.context" "/$jspWebappContext" "jsp.forwardOrigin" "/forwards/forwardToJspForward.jsp" @@ -470,7 +471,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/common/loop.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" "loop_jsp" "servlet.context" "/$jspWebappContext" "jsp.forwardOrigin" "/forwards/forwardToJspForward.jsp" @@ -485,7 +486,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/common/loop.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.common.loop_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -499,7 +500,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/forwards/forwardToSimpleJava.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.forwards.forwardToSimpleJava_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -513,7 +514,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/forwards/forwardToJspForward.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.forwards.forwardToJspForward_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -547,17 +548,17 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { spanType DDSpanTypes.HTTP_SERVER errored true tags { - "http.url" "http://localhost:$port/$jspWebappContext/forwards/forwardToCompileError.jsp" - "http.method" "GET" - "peer.hostname" "127.0.0.1" - "peer.ipv4" "127.0.0.1" - "peer.port" Integer - "span.kind" "server" - "component" "java-web-servlet" + "$Tags.COMPONENT" "java-web-servlet" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.PEER_HOSTNAME" "127.0.0.1" + "$Tags.PEER_HOST_IPV4" "127.0.0.1" + "$Tags.PEER_PORT" Integer + "$Tags.HTTP_URL" "http://localhost:$port/$jspWebappContext/forwards/forwardToCompileError.jsp" + "$Tags.HTTP_METHOD" "GET" + "$Tags.HTTP_STATUS" 500 "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" "servlet.path" "/forwards/forwardToCompileError.jsp" - "http.status_code" 500 errorTags(JasperException, String) defaultTags() } @@ -569,7 +570,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/forwards/forwardToCompileError.jsp" errored true tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" "forwardToCompileError_jsp" "servlet.context" "/$jspWebappContext" "jsp.requestURL" reqUrl @@ -584,7 +585,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/compileError.jsp" errored true tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.compileError_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -599,7 +600,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/forwards/forwardToCompileError.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.forwards.forwardToCompileError_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -633,17 +634,17 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { spanType DDSpanTypes.HTTP_SERVER errored false tags { - "http.url" "http://localhost:$port/$jspWebappContext/forwards/forwardToNonExistent.jsp" - "http.method" "GET" - "peer.hostname" "127.0.0.1" - "peer.ipv4" "127.0.0.1" - "peer.port" Integer - "span.kind" "server" - "component" "java-web-servlet" + "$Tags.COMPONENT" "java-web-servlet" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.PEER_HOSTNAME" "127.0.0.1" + "$Tags.PEER_HOST_IPV4" "127.0.0.1" + "$Tags.PEER_PORT" Integer + "$Tags.HTTP_URL" "http://localhost:$port/$jspWebappContext/forwards/forwardToNonExistent.jsp" + "$Tags.HTTP_METHOD" "GET" + "$Tags.HTTP_STATUS" 404 "span.origin.type" "org.apache.catalina.core.ApplicationFilterChain" "servlet.context" "/$jspWebappContext" "servlet.path" "/forwards/forwardToNonExistent.jsp" - "http.status_code" 404 defaultTags() } } @@ -654,7 +655,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/forwards/forwardToNonExistent.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "span.origin.type" "forwardToNonExistent_jsp" "servlet.context" "/$jspWebappContext" "jsp.requestURL" reqUrl @@ -668,7 +669,7 @@ class JSPInstrumentationForwardTests extends AgentTestRunner { resourceName "/forwards/forwardToNonExistent.jsp" errored false tags { - "component" "jsp-http-servlet" + "$Tags.COMPONENT" "jsp-http-servlet" "servlet.context" "/$jspWebappContext" "jsp.classFQCN" "org.apache.jsp.forwards.forwardToNonExistent_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" diff --git a/dd-java-agent/instrumentation/kafka-clients-0.11/src/test/groovy/KafkaClientTest.groovy b/dd-java-agent/instrumentation/kafka-clients-0.11/src/test/groovy/KafkaClientTest.groovy index 727dd501e4..4024af6c34 100644 --- a/dd-java-agent/instrumentation/kafka-clients-0.11/src/test/groovy/KafkaClientTest.groovy +++ b/dd-java-agent/instrumentation/kafka-clients-0.11/src/test/groovy/KafkaClientTest.groovy @@ -1,4 +1,5 @@ import datadog.trace.agent.test.AgentTestRunner +import datadog.trace.instrumentation.api.Tags import org.apache.kafka.clients.consumer.ConsumerConfig import org.apache.kafka.clients.consumer.ConsumerRecord import org.apache.kafka.clients.consumer.KafkaConsumer @@ -88,8 +89,8 @@ class KafkaClientTest extends AgentTestRunner { errored false parent() tags { - "component" "java-kafka" - "span.kind" "producer" + "$Tags.COMPONENT" "java-kafka" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_PRODUCER defaultTags() } } @@ -104,8 +105,8 @@ class KafkaClientTest extends AgentTestRunner { errored false childOf TEST_WRITER[0][0] tags { - "component" "java-kafka" - "span.kind" "consumer" + "$Tags.COMPONENT" "java-kafka" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CONSUMER "partition" { it >= 0 } "offset" 0 defaultTags(true) @@ -170,8 +171,8 @@ class KafkaClientTest extends AgentTestRunner { errored false parent() tags { - "component" "java-kafka" - "span.kind" "producer" + "$Tags.COMPONENT" "java-kafka" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_PRODUCER "kafka.partition" { it >= 0 } defaultTags(true) } @@ -187,8 +188,8 @@ class KafkaClientTest extends AgentTestRunner { errored false childOf TEST_WRITER[0][0] tags { - "component" "java-kafka" - "span.kind" "consumer" + "$Tags.COMPONENT" "java-kafka" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CONSUMER "partition" { it >= 0 } "offset" 0 defaultTags(true) diff --git a/dd-java-agent/instrumentation/kafka-streams-0.11/src/test/groovy/KafkaStreamsTest.groovy b/dd-java-agent/instrumentation/kafka-streams-0.11/src/test/groovy/KafkaStreamsTest.groovy index dda624d385..f90fce7259 100644 --- a/dd-java-agent/instrumentation/kafka-streams-0.11/src/test/groovy/KafkaStreamsTest.groovy +++ b/dd-java-agent/instrumentation/kafka-streams-0.11/src/test/groovy/KafkaStreamsTest.groovy @@ -1,4 +1,5 @@ import datadog.trace.agent.test.AgentTestRunner +import datadog.trace.instrumentation.api.Tags import org.apache.kafka.clients.consumer.ConsumerRecord import org.apache.kafka.common.serialization.Serdes import org.apache.kafka.streams.KafkaStreams @@ -133,8 +134,8 @@ class KafkaStreamsTest extends AgentTestRunner { errored false parent() tags { - "component" "java-kafka" - "span.kind" "producer" + "$Tags.COMPONENT" "java-kafka" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_PRODUCER defaultTags() } } @@ -149,8 +150,8 @@ class KafkaStreamsTest extends AgentTestRunner { errored false childOf TEST_WRITER[0][0] tags { - "component" "java-kafka" - "span.kind" "consumer" + "$Tags.COMPONENT" "java-kafka" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CONSUMER "partition" { it >= 0 } "offset" 0 defaultTags(true) @@ -169,8 +170,8 @@ class KafkaStreamsTest extends AgentTestRunner { childOf span(1) tags { - "component" "java-kafka" - "span.kind" "producer" + "$Tags.COMPONENT" "java-kafka" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_PRODUCER defaultTags() } } @@ -185,12 +186,12 @@ class KafkaStreamsTest extends AgentTestRunner { childOf TEST_WRITER[0][0] tags { - "component" "java-kafka" - "span.kind" "consumer" + "$Tags.COMPONENT" "java-kafka" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CONSUMER "partition" { it >= 0 } "offset" 0 - defaultTags(true) "asdf" "testing" + defaultTags(true) } } } @@ -204,12 +205,12 @@ class KafkaStreamsTest extends AgentTestRunner { errored false childOf TEST_WRITER[2][0] tags { - "component" "java-kafka" - "span.kind" "consumer" + "$Tags.COMPONENT" "java-kafka" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CONSUMER "partition" { it >= 0 } "offset" 0 - defaultTags(true) "testing" 123 + defaultTags(true) } } } diff --git a/dd-java-agent/instrumentation/lettuce-5/src/test/groovy/LettuceAsyncClientTest.groovy b/dd-java-agent/instrumentation/lettuce-5/src/test/groovy/LettuceAsyncClientTest.groovy index 5af20d06d0..6da0ae8786 100644 --- a/dd-java-agent/instrumentation/lettuce-5/src/test/groovy/LettuceAsyncClientTest.groovy +++ b/dd-java-agent/instrumentation/lettuce-5/src/test/groovy/LettuceAsyncClientTest.groovy @@ -1,6 +1,7 @@ import datadog.trace.agent.test.AgentTestRunner import datadog.trace.agent.test.utils.PortUtils import datadog.trace.api.DDSpanTypes +import datadog.trace.instrumentation.api.Tags import io.lettuce.core.ClientOptions import io.lettuce.core.ConnectionFuture import io.lettuce.core.RedisClient @@ -121,13 +122,13 @@ class LettuceAsyncClientTest extends AgentTestRunner { errored false tags { - defaultTags() - "component" "redis-client" + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.PEER_HOSTNAME" HOST + "$Tags.PEER_PORT" port + "$Tags.DB_TYPE" "redis" "db.redis.dbIndex" 0 - "db.type" "redis" - "peer.hostname" HOST - "peer.port" port - "span.kind" "client" + defaultTags() } } } @@ -160,14 +161,14 @@ class LettuceAsyncClientTest extends AgentTestRunner { errored true tags { - defaultTags() - "component" "redis-client" + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.PEER_HOSTNAME" HOST + "$Tags.PEER_PORT" incorrectPort + "$Tags.DB_TYPE" "redis" "db.redis.dbIndex" 0 - "db.type" "redis" errorTags CompletionException, String - "peer.hostname" HOST - "peer.port" incorrectPort - "span.kind" "client" + defaultTags() } } } @@ -191,10 +192,10 @@ class LettuceAsyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -229,10 +230,10 @@ class LettuceAsyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -281,10 +282,10 @@ class LettuceAsyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -319,10 +320,10 @@ class LettuceAsyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -376,10 +377,10 @@ class LettuceAsyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -392,10 +393,10 @@ class LettuceAsyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -438,11 +439,11 @@ class LettuceAsyncClientTest extends AgentTestRunner { errored true tags { - defaultTags() - "component" "redis-client" - "db.type" "redis" + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" errorTags(IllegalStateException, "TestException") - "span.kind" "client" + defaultTags() } } } @@ -479,11 +480,11 @@ class LettuceAsyncClientTest extends AgentTestRunner { errored false tags { - defaultTags() - "component" "redis-client" - "db.type" "redis" + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" "db.command.cancelled" true - "span.kind" "client" + defaultTags() } } } @@ -505,10 +506,10 @@ class LettuceAsyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -531,10 +532,10 @@ class LettuceAsyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } diff --git a/dd-java-agent/instrumentation/lettuce-5/src/test/groovy/LettuceReactiveClientTest.groovy b/dd-java-agent/instrumentation/lettuce-5/src/test/groovy/LettuceReactiveClientTest.groovy index 72a92e8585..4bb68a7e81 100644 --- a/dd-java-agent/instrumentation/lettuce-5/src/test/groovy/LettuceReactiveClientTest.groovy +++ b/dd-java-agent/instrumentation/lettuce-5/src/test/groovy/LettuceReactiveClientTest.groovy @@ -1,6 +1,7 @@ import datadog.trace.agent.test.AgentTestRunner import datadog.trace.agent.test.utils.PortUtils import datadog.trace.api.DDSpanTypes +import datadog.trace.instrumentation.api.Tags import io.lettuce.core.ClientOptions import io.lettuce.core.RedisClient import io.lettuce.core.api.StatefulConnection @@ -94,10 +95,10 @@ class LettuceReactiveClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -123,10 +124,10 @@ class LettuceReactiveClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -160,10 +161,10 @@ class LettuceReactiveClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -195,10 +196,10 @@ class LettuceReactiveClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -220,11 +221,11 @@ class LettuceReactiveClientTest extends AgentTestRunner { errored false tags { - defaultTags() - "component" "redis-client" - "db.type" "redis" + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" "db.command.results.count" 157 - "span.kind" "client" + defaultTags() } } } @@ -246,12 +247,12 @@ class LettuceReactiveClientTest extends AgentTestRunner { errored false tags { - defaultTags() - "component" "redis-client" - "db.type" "redis" + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" "db.command.cancelled" true "db.command.results.count" 2 - "span.kind" "client" + defaultTags() } } } @@ -285,10 +286,10 @@ class LettuceReactiveClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -310,10 +311,10 @@ class LettuceReactiveClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } diff --git a/dd-java-agent/instrumentation/lettuce-5/src/test/groovy/LettuceSyncClientTest.groovy b/dd-java-agent/instrumentation/lettuce-5/src/test/groovy/LettuceSyncClientTest.groovy index f328eb240b..9058e83531 100644 --- a/dd-java-agent/instrumentation/lettuce-5/src/test/groovy/LettuceSyncClientTest.groovy +++ b/dd-java-agent/instrumentation/lettuce-5/src/test/groovy/LettuceSyncClientTest.groovy @@ -1,6 +1,7 @@ import datadog.trace.agent.test.AgentTestRunner import datadog.trace.agent.test.utils.PortUtils import datadog.trace.api.DDSpanTypes +import datadog.trace.instrumentation.api.Tags import io.lettuce.core.ClientOptions import io.lettuce.core.RedisClient import io.lettuce.core.RedisConnectionException @@ -101,13 +102,13 @@ class LettuceSyncClientTest extends AgentTestRunner { errored false tags { - defaultTags() - "component" "redis-client" + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.PEER_HOSTNAME" HOST + "$Tags.PEER_PORT" port + "$Tags.DB_TYPE" "redis" "db.redis.dbIndex" 0 - "db.type" "redis" - "peer.hostname" HOST - "peer.port" port - "span.kind" "client" + defaultTags() } } } @@ -137,14 +138,14 @@ class LettuceSyncClientTest extends AgentTestRunner { errored true tags { - defaultTags() - "component" "redis-client" + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.PEER_HOSTNAME" HOST + "$Tags.PEER_PORT" incorrectPort + "$Tags.DB_TYPE" "redis" "db.redis.dbIndex" 0 - "db.type" "redis" errorTags CompletionException, String - "peer.hostname" HOST - "peer.port" incorrectPort - "span.kind" "client" + defaultTags() } } } @@ -167,10 +168,10 @@ class LettuceSyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -193,10 +194,10 @@ class LettuceSyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -219,10 +220,10 @@ class LettuceSyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -245,10 +246,10 @@ class LettuceSyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -271,10 +272,10 @@ class LettuceSyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -297,10 +298,10 @@ class LettuceSyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -323,10 +324,10 @@ class LettuceSyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -348,10 +349,10 @@ class LettuceSyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } @@ -373,10 +374,10 @@ class LettuceSyncClientTest extends AgentTestRunner { errored false tags { + "$Tags.COMPONENT" "redis-client" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.DB_TYPE" "redis" defaultTags() - "component" "redis-client" - "db.type" "redis" - "span.kind" "client" } } } diff --git a/dd-java-agent/instrumentation/mongo/driver-3.1/src/test/groovy/MongoClientTest.groovy b/dd-java-agent/instrumentation/mongo/driver-3.1/src/test/groovy/MongoClientTest.groovy index 6ee24ee109..0145ac68e5 100644 --- a/dd-java-agent/instrumentation/mongo/driver-3.1/src/test/groovy/MongoClientTest.groovy +++ b/dd-java-agent/instrumentation/mongo/driver-3.1/src/test/groovy/MongoClientTest.groovy @@ -250,14 +250,14 @@ class MongoClientTest extends MongoBaseTest { tags { "$Tags.COMPONENT" "java-mongo" "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT - "$Tags.DB_INSTANCE" instance + "$Tags.PEER_HOSTNAME" "localhost" + "$Tags.PEER_HOST_IPV4" "127.0.0.1" + "$Tags.PEER_PORT" port "$Tags.DB_STATEMENT" { it.replace(" ", "") == statement } "$Tags.DB_TYPE" "mongo" - "$Tags.PEER_HOSTNAME" "localhost" - "$Tags.PEER_HOST_IPV4" "127.0.0.1" - "$Tags.PEER_PORT" port + "$Tags.DB_INSTANCE" instance defaultTags() } } diff --git a/dd-java-agent/instrumentation/mongo/driver-async-3.3/src/test/groovy/MongoAsyncClientTest.groovy b/dd-java-agent/instrumentation/mongo/driver-async-3.3/src/test/groovy/MongoAsyncClientTest.groovy index bb8cb0bd80..0a80365c34 100644 --- a/dd-java-agent/instrumentation/mongo/driver-async-3.3/src/test/groovy/MongoAsyncClientTest.groovy +++ b/dd-java-agent/instrumentation/mongo/driver-async-3.3/src/test/groovy/MongoAsyncClientTest.groovy @@ -285,12 +285,12 @@ class MongoAsyncClientTest extends MongoBaseTest { tags { "$Tags.COMPONENT" "java-mongo" "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT - "$Tags.DB_INSTANCE" instance - "$Tags.DB_STATEMENT" statementEval - "$Tags.DB_TYPE" "mongo" "$Tags.PEER_HOSTNAME" "localhost" "$Tags.PEER_HOST_IPV4" "127.0.0.1" "$Tags.PEER_PORT" port + "$Tags.DB_STATEMENT" statementEval + "$Tags.DB_TYPE" "mongo" + "$Tags.DB_INSTANCE" instance defaultTags() } } diff --git a/dd-java-agent/instrumentation/netty-4.1/src/test/groovy/Netty41ClientTest.groovy b/dd-java-agent/instrumentation/netty-4.1/src/test/groovy/Netty41ClientTest.groovy index 7e44dafac1..643ba87d3b 100644 --- a/dd-java-agent/instrumentation/netty-4.1/src/test/groovy/Netty41ClientTest.groovy +++ b/dd-java-agent/instrumentation/netty-4.1/src/test/groovy/Netty41ClientTest.groovy @@ -199,8 +199,8 @@ class Netty41ClientTest extends HttpClientTest { resourceName "AnnotatedClass.makeRequestUnderTrace" errored false tags { - defaultTags() "$Tags.COMPONENT" "trace" + defaultTags() } } clientSpan(it, 2, span(1), method) diff --git a/dd-java-agent/instrumentation/play-2.4/src/test/groovy/server/PlayServerTest.groovy b/dd-java-agent/instrumentation/play-2.4/src/test/groovy/server/PlayServerTest.groovy index 5adbb8c96e..5f1384a565 100644 --- a/dd-java-agent/instrumentation/play-2.4/src/test/groovy/server/PlayServerTest.groovy +++ b/dd-java-agent/instrumentation/play-2.4/src/test/groovy/server/PlayServerTest.groovy @@ -88,17 +88,17 @@ class PlayServerTest extends HttpServerTest { childOf(parent as DDSpan) tags { "$Tags.COMPONENT" PlayHttpServerDecorator.DECORATE.component() - "$Tags.HTTP_STATUS" Integer - "$Tags.HTTP_URL" String - "$Tags.PEER_HOST_IPV4" { it == null || it == "127.0.0.1" } // Optional - "$Tags.HTTP_METHOD" String "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER - defaultTags() + "$Tags.PEER_HOST_IPV4" { it == null || it == "127.0.0.1" } // Optional + "$Tags.HTTP_URL" String + "$Tags.HTTP_METHOD" String + "$Tags.HTTP_STATUS" Integer if (endpoint == ERROR) { "$Tags.ERROR" true } else if (endpoint == EXCEPTION) { errorTags(Exception, EXCEPTION.body) } + defaultTags() } } } diff --git a/dd-java-agent/instrumentation/play-2.6/src/test/groovy/server/PlayServerTest.groovy b/dd-java-agent/instrumentation/play-2.6/src/test/groovy/server/PlayServerTest.groovy index 3e5e198fb5..7e2f4f7350 100644 --- a/dd-java-agent/instrumentation/play-2.6/src/test/groovy/server/PlayServerTest.groovy +++ b/dd-java-agent/instrumentation/play-2.6/src/test/groovy/server/PlayServerTest.groovy @@ -90,17 +90,17 @@ class PlayServerTest extends HttpServerTest { childOf(parent as DDSpan) tags { "$Tags.COMPONENT" PlayHttpServerDecorator.DECORATE.component() - "$Tags.HTTP_STATUS" Integer - "$Tags.HTTP_URL" String - "$Tags.PEER_HOST_IPV4" { it == null || it == "127.0.0.1" } // Optional - "$Tags.HTTP_METHOD" String "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER - defaultTags() + "$Tags.PEER_HOST_IPV4" { it == null || it == "127.0.0.1" } // Optional + "$Tags.HTTP_URL" String + "$Tags.HTTP_METHOD" String + "$Tags.HTTP_STATUS" Integer if (endpoint == ERROR) { "$Tags.ERROR" true } else if (endpoint == EXCEPTION) { errorTags(Exception, EXCEPTION.body) } + defaultTags() } } } @@ -119,18 +119,18 @@ class PlayServerTest extends HttpServerTest { parent() } tags { - defaultTags(true) "$Tags.COMPONENT" serverDecorator.component() + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.HTTP_STATUS" endpoint.status + "$Tags.HTTP_URL" "${endpoint.resolve(address)}" + "$Tags.HTTP_METHOD" method if (endpoint.errored) { "$Tags.ERROR" endpoint.errored "error.msg" { it == null || it == EXCEPTION.body } "error.type" { it == null || it == Exception.name } "error.stack" { it == null || it instanceof String } } - "$Tags.HTTP_STATUS" endpoint.status - "$Tags.HTTP_URL" "${endpoint.resolve(address)}" - "$Tags.HTTP_METHOD" method - "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + defaultTags(true) } } } diff --git a/dd-java-agent/instrumentation/rabbitmq-amqp-2.7/src/test/groovy/RabbitMQTest.groovy b/dd-java-agent/instrumentation/rabbitmq-amqp-2.7/src/test/groovy/RabbitMQTest.groovy index f7481b401a..7d23703dbd 100644 --- a/dd-java-agent/instrumentation/rabbitmq-amqp-2.7/src/test/groovy/RabbitMQTest.groovy +++ b/dd-java-agent/instrumentation/rabbitmq-amqp-2.7/src/test/groovy/RabbitMQTest.groovy @@ -365,9 +365,6 @@ class RabbitMQTest extends AgentTestRunner { errored exception != null tags { - if (exception) { - errorTags(exception.class, errorMsg) - } "$Tags.COMPONENT" "rabbitmq-amqp" "$Tags.PEER_HOSTNAME" { it == null || it instanceof String } "$Tags.PEER_HOST_IPV4" { "127.0.0.1" } @@ -401,6 +398,9 @@ class RabbitMQTest extends AgentTestRunner { "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT "amqp.command" { it == null || it == resource } } + if (exception) { + errorTags(exception.class, errorMsg) + } defaultTags(distributedRootSpan) } } diff --git a/dd-java-agent/instrumentation/ratpack-1.4/src/test/groovy/RatpackOtherTest.groovy b/dd-java-agent/instrumentation/ratpack-1.4/src/test/groovy/RatpackOtherTest.groovy index eb161aec08..dbef2b3f39 100644 --- a/dd-java-agent/instrumentation/ratpack-1.4/src/test/groovy/RatpackOtherTest.groovy +++ b/dd-java-agent/instrumentation/ratpack-1.4/src/test/groovy/RatpackOtherTest.groovy @@ -72,12 +72,12 @@ class RatpackOtherTest extends AgentTestRunner { tags { "$Tags.COMPONENT" "netty" "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER - "$Tags.HTTP_METHOD" "GET" - "$Tags.HTTP_STATUS" 200 - "$Tags.HTTP_URL" "${app.address.resolve(path)}" "$Tags.PEER_HOSTNAME" "$app.address.host" "$Tags.PEER_HOST_IPV4" "127.0.0.1" "$Tags.PEER_PORT" Integer + "$Tags.HTTP_URL" "${app.address.resolve(path)}" + "$Tags.HTTP_METHOD" "GET" + "$Tags.HTTP_STATUS" 200 defaultTags() } } @@ -91,11 +91,11 @@ class RatpackOtherTest extends AgentTestRunner { tags { "$Tags.COMPONENT" "ratpack" "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER - "$Tags.HTTP_METHOD" "GET" - "$Tags.HTTP_STATUS" 200 - "$Tags.HTTP_URL" "${app.address.resolve(path)}" "$Tags.PEER_HOSTNAME" "$app.address.host" "$Tags.PEER_PORT" Integer + "$Tags.HTTP_URL" "${app.address.resolve(path)}" + "$Tags.HTTP_METHOD" "GET" + "$Tags.HTTP_STATUS" 200 defaultTags() } } diff --git a/dd-java-agent/instrumentation/ratpack-1.4/src/test/groovy/server/RatpackHttpServerTest.groovy b/dd-java-agent/instrumentation/ratpack-1.4/src/test/groovy/server/RatpackHttpServerTest.groovy index a4bc0396e9..5b59647d6b 100644 --- a/dd-java-agent/instrumentation/ratpack-1.4/src/test/groovy/server/RatpackHttpServerTest.groovy +++ b/dd-java-agent/instrumentation/ratpack-1.4/src/test/groovy/server/RatpackHttpServerTest.groovy @@ -107,19 +107,19 @@ class RatpackHttpServerTest extends HttpServerTest { parent() } tags { + "$Tags.COMPONENT" serverDecorator.component() + "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + "$Tags.PEER_HOSTNAME" "localhost" + "$Tags.PEER_HOST_IPV4" "127.0.0.1" + // No peer port + "$Tags.HTTP_URL" "${endpoint.resolve(address)}" + "$Tags.HTTP_METHOD" method + "$Tags.HTTP_STATUS" endpoint.status "servlet.context" "/$CONTEXT" "servlet.path" endpoint.path "span.origin.type" TestServlet2.Sync.name - - defaultTags(true) - "$Tags.COMPONENT" serverDecorator.component() if (endpoint.errored) { "$Tags.ERROR" endpoint.errored "error.msg" { it == null || it == EXCEPTION.body } "error.type" { it == null || it == Exception.name } "error.stack" { it == null || it instanceof String } } - "$Tags.HTTP_STATUS" endpoint.status - "$Tags.HTTP_URL" "${endpoint.resolve(address)}" - "$Tags.PEER_HOSTNAME" "localhost" - // No peer port - "$Tags.PEER_HOST_IPV4" "127.0.0.1" - "$Tags.HTTP_METHOD" method - "$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER + defaultTags(true) } } } diff --git a/dd-java-agent/instrumentation/servlet/request-3/src/test/groovy/AbstractServlet3Test.groovy b/dd-java-agent/instrumentation/servlet/request-3/src/test/groovy/AbstractServlet3Test.groovy index ce0aa772b9..b5af4875ff 100644 --- a/dd-java-agent/instrumentation/servlet/request-3/src/test/groovy/AbstractServlet3Test.groovy +++ b/dd-java-agent/instrumentation/servlet/request-3/src/test/groovy/AbstractServlet3Test.groovy @@ -82,25 +82,24 @@ abstract class AbstractServlet3Test extends HttpServerTest extends Age spanType DDSpanTypes.HTTP_CLIENT errored exception != null tags { - defaultTags() - if (exception) { - errorTags(exception.class, exception.message) - } "$Tags.COMPONENT" clientDecorator.component() + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT + "$Tags.PEER_HOSTNAME" "localhost" + "$Tags.PEER_HOST_IPV4" { it == null || it == "127.0.0.1" } // Optional + "$Tags.PEER_PORT" uri.port + "$Tags.HTTP_URL" "${uri.resolve(uri.path)}" + "$Tags.HTTP_METHOD" method if (status) { "$Tags.HTTP_STATUS" status } - "$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" "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 + if (exception) { + errorTags(exception.class, exception.message) + } + defaultTags() } } } diff --git a/dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy b/dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy index 452bc42d7c..4b5ec23c46 100644 --- a/dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy +++ b/dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy @@ -412,10 +412,10 @@ abstract class HttpServerTest ext errored errorMessage != null childOf(parent as DDSpan) tags { - defaultTags() if (errorMessage) { errorTags(Exception, errorMessage) } + defaultTags() } } } @@ -439,22 +439,22 @@ abstract class HttpServerTest ext parent() } tags { - defaultTags(true) "$Tags.COMPONENT" serverDecorator.component() - if (endpoint.errored) { - "$Tags.ERROR" endpoint.errored - } - "$Tags.HTTP_STATUS" endpoint.status + "$Tags.SPAN_KIND" 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_URL" "${endpoint.resolve(address)}" + "$Tags.HTTP_METHOD" method + "$Tags.HTTP_STATUS" endpoint.status // if (tagQueryString) { // "$DDTags.HTTP_QUERY" uri.query // "$DDTags.HTTP_FRAGMENT" { it == null || it == uri.fragment } // Optional // } - "$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 + if (endpoint.errored) { + "$Tags.ERROR" endpoint.errored + } + defaultTags(true) } } } diff --git a/dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/utils/TraceUtils.groovy b/dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/utils/TraceUtils.groovy index e7b78e07f8..629ee446e8 100644 --- a/dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/utils/TraceUtils.groovy +++ b/dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/utils/TraceUtils.groovy @@ -63,10 +63,10 @@ class TraceUtils { resourceName resource errored exception != null tags { - defaultTags() if (exception) { errorTags(exception.class, exception.message) } + defaultTags() } } }