From bd829a649410e90e0453283dc61d9d64aff9d44c Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Mon, 19 Apr 2021 11:41:37 -0700 Subject: [PATCH] Remove duplicate status verification (#2710) --- .../AkkaHttpClientInstrumentationTest.groovy | 3 +- .../apachedubbo/v2_7/AbstractDubboTest.groovy | 14 +- .../groovy/ApacheHttpAsyncClientTest.groovy | 2 +- ...RequestStreamWrapperPropagationTest.groovy | 3 +- .../TracingRequestStreamWrapperTest.groovy | 3 +- .../v1_0/TracingRequestWrapperTest.groovy | 3 +- ...AbstractAwsLambdaRequestHandlerTest.groovy | 5 +- .../awssdk/v1_11/Aws1ClientTest.groovy | 4 +- .../groovy/Aws0ClientTest.groovy | 8 +- .../v1_11/AbstractAws1ClientTest.groovy | 24 +-- .../awssdk/v2_2/AbstractAws2ClientTest.groovy | 8 +- .../src/test/groovy/CouchbaseSpanUtil.groovy | 3 +- .../groovy/util/AbstractCouchbaseTest.groovy | 3 +- .../src/test/groovy/DropwizardTest.groovy | 7 +- .../Elasticsearch5NodeClientTest.groovy | 7 +- .../Elasticsearch5TransportClientTest.groovy | 7 +- .../Elasticsearch53NodeClientTest.groovy | 7 +- .../Elasticsearch53TransportClientTest.groovy | 7 +- ...Elasticsearch53SpringRepositoryTest.groovy | 1 - .../Elasticsearch53SpringTemplateTest.groovy | 3 +- .../Elasticsearch6NodeClientTest.groovy | 7 +- .../Elasticsearch6TransportClientTest.groovy | 7 +- .../test/groovy/TraceAnnotationsTest.groovy | 8 +- .../src/test/groovy/TraceProvidersTest.groovy | 1 - .../groovy/FinatraServerLatestTest.groovy | 1 - .../src/test/groovy/FinatraServerTest.groovy | 1 - .../src/test/groovy/PutGetTest.groovy | 5 - .../AbstractGoogleHttpClientTest.groovy | 7 +- .../src/test/groovy/test/GrailsTest.groovy | 9 +- .../v1_5/AbstractGrpcStreamingTest.groovy | 4 +- .../grpc/v1_5/AbstractGrpcTest.groovy | 19 +-- .../src/test/groovy/SessionTest.groovy | 3 +- .../src/test/groovy/SessionTest.groovy | 3 +- .../src/test/groovy/ProcedureCallTest.groovy | 3 +- ...tpUrlConnectionResponseCodeOnlyTest.groovy | 2 +- .../test/groovy/HttpUrlConnectionTest.groovy | 15 +- ...HttpUrlConnectionUseCachesFalseTest.groovy | 2 +- .../test/groovy/SpringRestTemplateTest.groovy | 2 +- .../src/test/groovy/UrlConnectionTest.groovy | 5 +- .../groovy/HystrixObservableChainTest.groovy | 5 - .../test/groovy/HystrixObservableTest.groovy | 14 +- .../src/test/groovy/HystrixTest.groovy | 8 +- .../src/test/groovy/JdkHttpClientTest.groovy | 7 +- .../src/test/groovy/JaxRsClientTest.groovy | 3 +- .../src/main/groovy/JaxRsFilterTest.groovy | 8 +- .../main/groovy/JaxRsHttpServerTest.groovy | 7 +- .../src/main/groovy/AbstractJaxWsTest.groovy | 21 ++- .../groovy/JdbcInstrumentationTest.groovy | 11 -- .../src/jms2Test/groovy/Jms2Test.groovy | 2 - .../javaagent/src/test/groovy/Jms1Test.groovy | 3 - .../src/main/groovy/BaseJsfTest.groovy | 7 +- .../JspInstrumentationBasicTests.groovy | 33 +---- .../JspInstrumentationForwardTests.groovy | 45 +----- .../KafkaClientPropagationDisabledTest.groovy | 3 - .../KafkaClientPropagationEnabledTest.groovy | 8 - .../src/test/groovy/KafkaStreamsTest.groovy | 5 - .../test/groovy/KubernetesClientTest.groovy | 3 +- .../test/groovy/LettuceAsyncClientTest.groovy | 15 +- .../test/groovy/LettuceSyncClientTest.groovy | 13 +- .../test/groovy/LettuceAsyncClientTest.groovy | 15 +- .../groovy/LettuceReactiveClientTest.groovy | 17 --- .../test/groovy/LettuceSyncClientTest.groovy | 13 +- .../v5_1/LettuceReactiveClientTest.groovy | 3 - .../AbstractLettuceAsyncClientTest.groovy | 6 - .../AbstractLettuceReactiveClientTest.groovy | 11 -- .../AbstractLettuceSyncClientAuthTest.groovy | 1 - .../v5_1/AbstractLettuceSyncClientTest.groovy | 14 +- .../groovy/Netty38ClientTest.groovy | 3 +- .../src/test/groovy/Netty38ClientTest.groovy | 3 +- .../src/test/groovy/Netty40ClientTest.groovy | 3 +- .../src/test/groovy/Netty41ClientTest.groovy | 8 +- .../groovy/WithSpanInstrumentationTest.groovy | 71 ++++----- .../test/groovy/server/PlayServerTest.groovy | 4 +- .../test/groovy/server/PlayServerTest.groovy | 3 +- .../src/test/groovy/RabbitMQTest.groovy | 3 +- .../src/test/groovy/RatpackOtherTest.groovy | 2 - .../server/RatpackHttpServerTest.groovy | 3 +- .../reactor/AbstractReactorCoreTest.groovy | 5 +- .../javaagent/src/test/groovy/RmiTest.groovy | 5 +- .../RxJava2WithSpanInstrumentationTest.groovy | 140 ++++++++---------- .../RxJava3WithSpanInstrumentationTest.groovy | 140 ++++++++---------- .../src/slickTest/groovy/SlickTest.groovy | 2 - .../src/test/groovy/JettyServlet2Test.groovy | 1 - .../groovy/AbstractServletMappingTest.groovy | 22 +-- .../groovy/HttpServletResponseTest.groovy | 3 +- .../test/groovy/RequestDispatcherTest.groovy | 3 +- .../src/test/groovy/SparkJavaBasedTest.groovy | 1 - .../src/test/groovy/SpringBatchTest.groovy | 3 +- .../src/test/groovy/SpringJpaTest.groovy | 5 - .../test/groovy/SpringSchedulingTest.groovy | 3 - .../src/test/groovy/SpringWebfluxTest.groovy | 11 +- .../test/boot/SpringBootBasedTest.groovy | 6 +- .../test/filter/ServletFilterTest.groovy | 5 +- .../test/groovy/test/boot/SpringWsTest.groovy | 11 +- .../src/test/groovy/SpymemcachedTest.groovy | 6 +- .../test/groovy/Struts2ActionSpanTest.groovy | 7 +- .../src/test/groovy/TapestryTest.groovy | 3 +- .../test/groovy/test/TwilioClientTest.groovy | 22 +-- .../VertxReactivePropagationTest.groovy | 2 - .../test/asserts/SpanAssert.groovy | 12 +- .../test/base/HttpClientTest.groovy | 62 ++++---- .../test/base/HttpServerTest.groovy | 17 ++- .../test/server/http/TestHttpServer.groovy | 1 - .../test/utils/TraceUtils.groovy | 2 +- 104 files changed, 438 insertions(+), 692 deletions(-) diff --git a/instrumentation/akka-http-10.0/javaagent/src/test/groovy/AkkaHttpClientInstrumentationTest.groovy b/instrumentation/akka-http-10.0/javaagent/src/test/groovy/AkkaHttpClientInstrumentationTest.groovy index 8a3f2e261e..c28c9112e9 100644 --- a/instrumentation/akka-http-10.0/javaagent/src/test/groovy/AkkaHttpClientInstrumentationTest.groovy +++ b/instrumentation/akka-http-10.0/javaagent/src/test/groovy/AkkaHttpClientInstrumentationTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import akka.actor.ActorSystem import akka.http.javadsl.Http @@ -84,7 +85,7 @@ class AkkaHttpClientInstrumentationTest extends HttpClientTest impl hasNoParent() name "HTTP request" kind CLIENT - errored true + status ERROR errorEvent(NullPointerException, e.getMessage()) } } diff --git a/instrumentation/apache-dubbo/apache-dubbo-2.7/testing/src/main/groovy/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTest.groovy b/instrumentation/apache-dubbo/apache-dubbo-2.7/testing/src/main/groovy/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTest.groovy index 4c2cd82b3f..7dfeca1d27 100644 --- a/instrumentation/apache-dubbo/apache-dubbo-2.7/testing/src/main/groovy/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTest.groovy +++ b/instrumentation/apache-dubbo/apache-dubbo-2.7/testing/src/main/groovy/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTest.groovy @@ -5,6 +5,11 @@ package io.opentelemetry.instrumentation.apachedubbo.v2_7 +import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.SpanKind.SERVER +import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan +import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace + import io.opentelemetry.instrumentation.apachedubbo.v2_7.api.HelloService import io.opentelemetry.instrumentation.apachedubbo.v2_7.impl.HelloServiceImpl import io.opentelemetry.instrumentation.test.InstrumentationSpecification @@ -22,11 +27,6 @@ import org.apache.dubbo.rpc.service.GenericService import spock.lang.Shared import spock.lang.Unroll -import static io.opentelemetry.api.trace.SpanKind.CLIENT -import static io.opentelemetry.api.trace.SpanKind.SERVER -import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan -import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace - @Unroll abstract class AbstractDubboTest extends InstrumentationSpecification { @@ -93,7 +93,6 @@ abstract class AbstractDubboTest extends InstrumentationSpecification { name "org.apache.dubbo.rpc.service.GenericService/\$invoke" kind CLIENT childOf span(0) - errored false attributes { "${SemanticAttributes.RPC_SYSTEM.key}" "dubbo" "${SemanticAttributes.RPC_SERVICE.key}" "org.apache.dubbo.rpc.service.GenericService" @@ -106,7 +105,6 @@ abstract class AbstractDubboTest extends InstrumentationSpecification { name "io.opentelemetry.instrumentation.apachedubbo.v2_7.api.HelloService/hello" kind SERVER childOf span(1) - errored false attributes { "${SemanticAttributes.RPC_SYSTEM.key}" "dubbo" "${SemanticAttributes.RPC_SERVICE.key}" "io.opentelemetry.instrumentation.apachedubbo.v2_7.api.HelloService" @@ -162,7 +160,6 @@ abstract class AbstractDubboTest extends InstrumentationSpecification { name "org.apache.dubbo.rpc.service.GenericService/\$invokeAsync" kind CLIENT childOf span(0) - errored false attributes { "${SemanticAttributes.RPC_SYSTEM.key}" "dubbo" "${SemanticAttributes.RPC_SERVICE.key}" "org.apache.dubbo.rpc.service.GenericService" @@ -175,7 +172,6 @@ abstract class AbstractDubboTest extends InstrumentationSpecification { name "io.opentelemetry.instrumentation.apachedubbo.v2_7.api.HelloService/hello" kind SERVER childOf span(1) - errored false attributes { "${SemanticAttributes.RPC_SYSTEM.key}" "dubbo" "${SemanticAttributes.RPC_SERVICE.key}" "io.opentelemetry.instrumentation.apachedubbo.v2_7.api.HelloService" diff --git a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/test/groovy/ApacheHttpAsyncClientTest.groovy b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/test/groovy/ApacheHttpAsyncClientTest.groovy index 0021f52334..81dfa4dc22 100644 --- a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/test/groovy/ApacheHttpAsyncClientTest.groovy +++ b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/test/groovy/ApacheHttpAsyncClientTest.groovy @@ -65,7 +65,7 @@ class ApacheHttpAsyncClientTest extends HttpClientTest implement } @Override - Integer statusOnRedirectError() { + Integer responseCodeOnRedirectError() { return 302 } diff --git a/instrumentation/aws-lambda-1.0/library/src/test/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/TracingRequestStreamWrapperPropagationTest.groovy b/instrumentation/aws-lambda-1.0/library/src/test/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/TracingRequestStreamWrapperPropagationTest.groovy index d4ec8dc2ce..af2766d22f 100644 --- a/instrumentation/aws-lambda-1.0/library/src/test/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/TracingRequestStreamWrapperPropagationTest.groovy +++ b/instrumentation/aws-lambda-1.0/library/src/test/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/TracingRequestStreamWrapperPropagationTest.groovy @@ -6,6 +6,7 @@ package io.opentelemetry.instrumentation.awslambda.v1_0 import static io.opentelemetry.api.trace.SpanKind.SERVER +import static io.opentelemetry.api.trace.StatusCode.ERROR import com.amazonaws.services.lambda.runtime.Context import com.amazonaws.services.lambda.runtime.RequestStreamHandler @@ -120,7 +121,7 @@ class TracingRequestStreamWrapperPropagationTest extends LibraryInstrumentationS traceId("4fd0b6131f19f39af59518d127b0cafe") name("my_function") kind SERVER - errored true + status ERROR errorEvent(IllegalArgumentException, "bad argument") attributes { "${SemanticAttributes.FAAS_EXECUTION.key}" "1-22-333" diff --git a/instrumentation/aws-lambda-1.0/library/src/test/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/TracingRequestStreamWrapperTest.groovy b/instrumentation/aws-lambda-1.0/library/src/test/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/TracingRequestStreamWrapperTest.groovy index 4101537679..bcb41f7fca 100644 --- a/instrumentation/aws-lambda-1.0/library/src/test/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/TracingRequestStreamWrapperTest.groovy +++ b/instrumentation/aws-lambda-1.0/library/src/test/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/TracingRequestStreamWrapperTest.groovy @@ -6,6 +6,7 @@ package io.opentelemetry.instrumentation.awslambda.v1_0 import static io.opentelemetry.api.trace.SpanKind.SERVER +import static io.opentelemetry.api.trace.StatusCode.ERROR import com.amazonaws.services.lambda.runtime.Context import com.amazonaws.services.lambda.runtime.RequestStreamHandler @@ -102,7 +103,7 @@ class TracingRequestStreamWrapperTest extends LibraryInstrumentationSpecificatio span(0) { name("my_function") kind SERVER - errored true + status ERROR errorEvent(IllegalArgumentException, "bad argument") attributes { "$ResourceAttributes.FAAS_ID.key" "arn:aws:lambda:us-east-1:123456789:function:test" diff --git a/instrumentation/aws-lambda-1.0/library/src/test/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/TracingRequestWrapperTest.groovy b/instrumentation/aws-lambda-1.0/library/src/test/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/TracingRequestWrapperTest.groovy index 7c2474da34..e7ab02259e 100644 --- a/instrumentation/aws-lambda-1.0/library/src/test/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/TracingRequestWrapperTest.groovy +++ b/instrumentation/aws-lambda-1.0/library/src/test/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/TracingRequestWrapperTest.groovy @@ -6,6 +6,7 @@ package io.opentelemetry.instrumentation.awslambda.v1_0 import static io.opentelemetry.api.trace.SpanKind.SERVER +import static io.opentelemetry.api.trace.StatusCode.ERROR import com.amazonaws.services.lambda.runtime.Context import com.amazonaws.services.lambda.runtime.RequestHandler @@ -68,7 +69,7 @@ class TracingRequestWrapperTest extends TracingRequestWrapperTestBase { span(0) { name("my_function") kind SERVER - errored true + status ERROR errorEvent(IllegalArgumentException, "bad argument") attributes { "$ResourceAttributes.FAAS_ID.key" "arn:aws:lambda:us-east-1:123456789:function:test" diff --git a/instrumentation/aws-lambda-1.0/testing/src/main/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/AbstractAwsLambdaRequestHandlerTest.groovy b/instrumentation/aws-lambda-1.0/testing/src/main/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/AbstractAwsLambdaRequestHandlerTest.groovy index 12033415d9..b2ec9cd716 100644 --- a/instrumentation/aws-lambda-1.0/testing/src/main/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/AbstractAwsLambdaRequestHandlerTest.groovy +++ b/instrumentation/aws-lambda-1.0/testing/src/main/groovy/io/opentelemetry/instrumentation/awslambda/v1_0/AbstractAwsLambdaRequestHandlerTest.groovy @@ -6,12 +6,13 @@ package io.opentelemetry.instrumentation.awslambda.v1_0 import static io.opentelemetry.api.trace.SpanKind.SERVER +import static io.opentelemetry.api.trace.StatusCode.ERROR import com.amazonaws.services.lambda.runtime.Context import com.amazonaws.services.lambda.runtime.RequestHandler import com.github.stefanbirkner.systemlambda.SystemLambda -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.InstrumentationSpecification +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes abstract class AbstractAwsLambdaRequestHandlerTest extends InstrumentationSpecification { @@ -67,7 +68,7 @@ abstract class AbstractAwsLambdaRequestHandlerTest extends InstrumentationSpecif span(0) { name("my_function") kind SERVER - errored true + status ERROR errorEvent(IllegalArgumentException, "bad argument") attributes { "${SemanticAttributes.FAAS_EXECUTION.key}" "1-22-333" diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/awssdk/v1_11/Aws1ClientTest.groovy b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/awssdk/v1_11/Aws1ClientTest.groovy index af24eca550..c14ff1a7be 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/awssdk/v1_11/Aws1ClientTest.groovy +++ b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/awssdk/v1_11/Aws1ClientTest.groovy @@ -5,6 +5,8 @@ package io.opentelemetry.javaagent.instrumentation.awssdk.v1_11 +import static io.opentelemetry.api.trace.StatusCode.ERROR + import com.amazonaws.AmazonWebServiceClient import com.amazonaws.Request import com.amazonaws.auth.BasicAWSCredentials @@ -90,7 +92,7 @@ class Aws1ClientTest extends AbstractAws1ClientTest implements AgentTestTrait { span(0) { name "S3.HeadBucket" kind SpanKind.CLIENT - errored true + status ERROR errorEvent RuntimeException, "bad handler" hasNoParent() attributes { diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test_before_1_11_106/groovy/Aws0ClientTest.groovy b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test_before_1_11_106/groovy/Aws0ClientTest.groovy index 6624c84985..4f5c40f83e 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test_before_1_11_106/groovy/Aws0ClientTest.groovy +++ b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test_before_1_11_106/groovy/Aws0ClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.server.http.TestHttpServer.httpServer import static io.opentelemetry.instrumentation.test.utils.PortUtils.UNUSABLE_PORT @@ -101,7 +102,6 @@ class Aws0ClientTest extends AgentInstrumentationSpecification { span(0) { name "$service.$operation" kind CLIENT - errored false hasNoParent() attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" @@ -160,7 +160,7 @@ class Aws0ClientTest extends AgentInstrumentationSpecification { span(0) { name "$service.$operation" kind CLIENT - errored true + status ERROR errorEvent AmazonClientException, ~/Unable to execute HTTP request/ hasNoParent() attributes { @@ -208,7 +208,7 @@ class Aws0ClientTest extends AgentInstrumentationSpecification { span(0) { name "S3.GetObject" kind CLIENT - errored true + status ERROR errorEvent RuntimeException, "bad handler" hasNoParent() attributes { @@ -254,7 +254,7 @@ class Aws0ClientTest extends AgentInstrumentationSpecification { span(0) { name "S3.GetObject" kind CLIENT - errored true + status ERROR errorEvent AmazonClientException, ~/Unable to execute HTTP request/ hasNoParent() attributes { diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractAws1ClientTest.groovy b/instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractAws1ClientTest.groovy index 664a8c3373..fde3aa67ea 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractAws1ClientTest.groovy +++ b/instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractAws1ClientTest.groovy @@ -7,6 +7,7 @@ package io.opentelemetry.instrumentation.awssdk.v1_11 import static io.opentelemetry.api.trace.SpanKind.CLIENT import static io.opentelemetry.api.trace.SpanKind.PRODUCER +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.server.http.TestHttpServer.httpServer import static io.opentelemetry.instrumentation.test.utils.PortUtils.UNUSABLE_PORT @@ -94,7 +95,6 @@ abstract class AbstractAws1ClientTest extends InstrumentationSpecification { span(0) { name "$service.$operation" kind operation == "SendMessage" ? PRODUCER : CLIENT - errored false hasNoParent() attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" @@ -119,19 +119,19 @@ abstract class AbstractAws1ClientTest extends InstrumentationSpecification { server.lastRequest.headers.get("traceparent") == null where: - service | operation | method | path | clientBuilder | call | additionalAttributes | body - "S3" | "CreateBucket" | "PUT" | "/testbucket/" | AmazonS3ClientBuilder.standard().withPathStyleAccessEnabled(true) | { c -> c.createBucket("testbucket") } | ["aws.bucket.name": "testbucket"] | "" - "S3" | "GetObject" | "GET" | "/someBucket/someKey" | AmazonS3ClientBuilder.standard().withPathStyleAccessEnabled(true) | { c -> c.getObject("someBucket", "someKey") } | ["aws.bucket.name": "someBucket"] | "" - "DynamoDBv2" | "CreateTable" | "POST" | "/" | AmazonDynamoDBClientBuilder.standard() | { c -> c.createTable(new CreateTableRequest("sometable", null)) } | ["aws.table.name": "sometable"] | "" - "Kinesis" | "DeleteStream" | "POST" | "/" | AmazonKinesisClientBuilder.standard() | { c -> c.deleteStream(new DeleteStreamRequest().withStreamName("somestream")) } | ["aws.stream.name": "somestream"] | "" - "EC2" | "AllocateAddress" | "POST" | "/" | AmazonEC2ClientBuilder.standard() | { c -> c.allocateAddress() } | [:] | """ + service | operation | method | path | clientBuilder | call | additionalAttributes | body + "S3" | "CreateBucket" | "PUT" | "/testbucket/" | AmazonS3ClientBuilder.standard().withPathStyleAccessEnabled(true) | { c -> c.createBucket("testbucket") } | ["aws.bucket.name": "testbucket"] | "" + "S3" | "GetObject" | "GET" | "/someBucket/someKey" | AmazonS3ClientBuilder.standard().withPathStyleAccessEnabled(true) | { c -> c.getObject("someBucket", "someKey") } | ["aws.bucket.name": "someBucket"] | "" + "DynamoDBv2" | "CreateTable" | "POST" | "/" | AmazonDynamoDBClientBuilder.standard() | { c -> c.createTable(new CreateTableRequest("sometable", null)) } | ["aws.table.name": "sometable"] | "" + "Kinesis" | "DeleteStream" | "POST" | "/" | AmazonKinesisClientBuilder.standard() | { c -> c.deleteStream(new DeleteStreamRequest().withStreamName("somestream")) } | ["aws.stream.name": "somestream"] | "" + "EC2" | "AllocateAddress" | "POST" | "/" | AmazonEC2ClientBuilder.standard() | { c -> c.allocateAddress() } | [:] | """ 59dbff89-35bd-4eac-99ed-be587EXAMPLE 192.0.2.1 standard """ - "RDS" | "DeleteOptionGroup" | "POST" | "/" | AmazonRDSClientBuilder.standard() | { c -> c.deleteOptionGroup(new DeleteOptionGroupRequest()) } | [:] | """ + "RDS" | "DeleteOptionGroup" | "POST" | "/" | AmazonRDSClientBuilder.standard() | { c -> c.deleteOptionGroup(new DeleteOptionGroupRequest()) } | [:] | """ 0ac9cda2-bbf4-11d3-f92b-31fa5e8dbc99 @@ -160,7 +160,7 @@ abstract class AbstractAws1ClientTest extends InstrumentationSpecification { span(0) { name "$service.$operation" kind CLIENT - errored true + status ERROR errorEvent SdkClientException, ~/Unable to execute HTTP request/ hasNoParent() attributes { @@ -183,8 +183,8 @@ abstract class AbstractAws1ClientTest extends InstrumentationSpecification { } where: - service | operation | method | url | call | additionalAttributes | body | clientBuilder - "S3" | "GetObject" | "GET" | "someBucket/someKey" | { c -> c.getObject("someBucket", "someKey") } | ["aws.bucket.name": "someBucket"] | "" | AmazonS3ClientBuilder.standard() + service | operation | method | url | call | additionalAttributes | body | clientBuilder + "S3" | "GetObject" | "GET" | "someBucket/someKey" | { c -> c.getObject("someBucket", "someKey") } | ["aws.bucket.name": "someBucket"] | "" | AmazonS3ClientBuilder.standard() } // TODO(anuraaga): Add events for retries. @@ -215,7 +215,7 @@ abstract class AbstractAws1ClientTest extends InstrumentationSpecification { span(0) { name "S3.GetObject" kind CLIENT - errored true + status ERROR try { errorEvent AmazonClientException, ~/Unable to execute HTTP request/ } catch (AssertionError e) { diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientTest.groovy b/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientTest.groovy index b26c08fc97..9a38b3fb04 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientTest.groovy +++ b/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/groovy/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientTest.groovy @@ -7,6 +7,7 @@ package io.opentelemetry.instrumentation.awssdk.v2_2 import static com.google.common.collect.ImmutableMap.of import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.server.http.TestHttpServer.httpServer import io.opentelemetry.instrumentation.test.InstrumentationSpecification @@ -153,7 +154,6 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification { span(0) { name "DynamoDb.CreateTable" kind CLIENT - errored false hasNoParent() attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" @@ -189,7 +189,6 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification { span(0) { name "DynamoDb.Query" kind CLIENT - errored false hasNoParent() attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" @@ -224,7 +223,6 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification { span(0) { name "$service.$operation" kind CLIENT - errored false hasNoParent() attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" @@ -337,7 +335,6 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification { span(0) { name "$service.$operation" kind CLIENT - errored false hasNoParent() attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" @@ -426,7 +423,6 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification { span(0) { name "$service.$operation" kind CLIENT - errored false hasNoParent() attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" @@ -526,7 +522,7 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification { span(0) { name "S3.GetObject" kind CLIENT - errored true + status ERROR errorEvent SdkClientException, "Unable to execute HTTP request: Read timed out" hasNoParent() attributes { diff --git a/instrumentation/couchbase/couchbase-2.6/javaagent/src/test/groovy/CouchbaseSpanUtil.groovy b/instrumentation/couchbase/couchbase-2.6/javaagent/src/test/groovy/CouchbaseSpanUtil.groovy index e8ee78ae9a..bee1718ed3 100644 --- a/instrumentation/couchbase/couchbase-2.6/javaagent/src/test/groovy/CouchbaseSpanUtil.groovy +++ b/instrumentation/couchbase/couchbase-2.6/javaagent/src/test/groovy/CouchbaseSpanUtil.groovy @@ -16,7 +16,6 @@ class CouchbaseSpanUtil { trace.span(index) { name spanName kind CLIENT - errored false if (parentSpan == null) { hasNoParent() } else { @@ -41,7 +40,7 @@ class CouchbaseSpanUtil { // that do have operation ids "couchbase.operation_id" { it == null || String } - "${SemanticAttributes.DB_STATEMENT.key}" (statement ?: spanName) + "${SemanticAttributes.DB_STATEMENT.key}"(statement ?: spanName) } } } diff --git a/instrumentation/couchbase/couchbase-testing/src/main/groovy/util/AbstractCouchbaseTest.groovy b/instrumentation/couchbase/couchbase-testing/src/main/groovy/util/AbstractCouchbaseTest.groovy index 8dfa53d20e..531c0cf27b 100644 --- a/instrumentation/couchbase/couchbase-testing/src/main/groovy/util/AbstractCouchbaseTest.groovy +++ b/instrumentation/couchbase/couchbase-testing/src/main/groovy/util/AbstractCouchbaseTest.groovy @@ -107,7 +107,6 @@ abstract class AbstractCouchbaseTest extends AgentInstrumentationSpecification { trace.span(index) { name spanName kind CLIENT - errored false if (parentSpan == null) { hasNoParent() } else { @@ -118,7 +117,7 @@ abstract class AbstractCouchbaseTest extends AgentInstrumentationSpecification { if (bucketName != null) { "${SemanticAttributes.DB_NAME.key}" bucketName } - "${SemanticAttributes.DB_STATEMENT.key}" (statement ?: spanName) + "${SemanticAttributes.DB_STATEMENT.key}"(statement ?: spanName) } } } diff --git a/instrumentation/dropwizard-testing/src/test/groovy/DropwizardTest.groovy b/instrumentation/dropwizard-testing/src/test/groovy/DropwizardTest.groovy index f2f9280629..a5b94b9bb6 100644 --- a/instrumentation/dropwizard-testing/src/test/groovy/DropwizardTest.groovy +++ b/instrumentation/dropwizard-testing/src/test/groovy/DropwizardTest.groovy @@ -18,6 +18,7 @@ import io.dropwizard.setup.Bootstrap import io.dropwizard.setup.Environment import io.dropwizard.testing.ConfigOverride import io.dropwizard.testing.DropwizardTestSupport +import io.opentelemetry.api.trace.StatusCode import io.opentelemetry.instrumentation.test.AgentTestTrait import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.instrumentation.test.base.HttpServerTest @@ -76,8 +77,8 @@ class DropwizardTest extends HttpServerTest implements Ag trace.span(index) { name "${this.testResource().simpleName}.${endpoint.name().toLowerCase()}" kind INTERNAL - errored endpoint == EXCEPTION if (endpoint == EXCEPTION) { + status StatusCode.ERROR errorEvent(Exception, EXCEPTION.body) } childOf((SpanData) parent) @@ -90,7 +91,9 @@ class DropwizardTest extends HttpServerTest implements Ag trace.span(index) { name "${endpoint == PATH_PARAM ? "/path/{id}/param" : endpoint.resolvePath(address).path}" kind SERVER - errored endpoint.errored + if (endpoint.errored) { + status StatusCode.ERROR + } if (parentID != null) { traceId traceID parentSpanId parentID diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5NodeClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5NodeClientTest.groovy index dd336312ac..7cbb7f36e4 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5NodeClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5NodeClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING @@ -68,10 +69,10 @@ class Elasticsearch5NodeClientTest extends AgentInstrumentationSpecification { setup: def result = client.admin().cluster().health(new ClusterHealthRequest()) - def status = result.get().status + def clusterHealthStatus = result.get().status expect: - status.name() == "GREEN" + clusterHealthStatus.name() == "GREEN" assertTraces(1) { trace(0, 1) { @@ -101,7 +102,7 @@ class Elasticsearch5NodeClientTest extends AgentInstrumentationSpecification { trace(0, 1) { span(0) { name "GetAction" - errored true + status ERROR errorEvent IndexNotFoundException, "no such index" kind CLIENT attributes { diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5TransportClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5TransportClientTest.groovy index 9ca7ed2e8b..b47bd112b9 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5TransportClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent/src/test/groovy/Elasticsearch5TransportClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING @@ -84,10 +85,10 @@ class Elasticsearch5TransportClientTest extends AgentInstrumentationSpecificatio setup: def result = client.admin().cluster().health(new ClusterHealthRequest()) - def status = result.get().status + def clusterHealthStatus = result.get().status expect: - status.name() == "GREEN" + clusterHealthStatus.name() == "GREEN" assertTraces(1) { trace(0, 1) { @@ -121,7 +122,7 @@ class Elasticsearch5TransportClientTest extends AgentInstrumentationSpecificatio span(0) { name "GetAction" kind CLIENT - errored true + status ERROR errorEvent RemoteTransportException, String attributes { "${SemanticAttributes.DB_SYSTEM.key}" "elasticsearch" diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53NodeClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53NodeClientTest.groovy index 1c19320b6b..192bb1c589 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53NodeClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53NodeClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING @@ -71,10 +72,10 @@ class Elasticsearch53NodeClientTest extends AgentInstrumentationSpecification { setup: def result = client.admin().cluster().health(new ClusterHealthRequest()) - def status = result.get().status + def clusterHealthStatus = result.get().status expect: - status.name() == "GREEN" + clusterHealthStatus.name() == "GREEN" assertTraces(1) { trace(0, 1) { @@ -105,7 +106,7 @@ class Elasticsearch53NodeClientTest extends AgentInstrumentationSpecification { span(0) { name "GetAction" kind CLIENT - errored true + status ERROR errorEvent IndexNotFoundException, "no such index" attributes { "${SemanticAttributes.DB_SYSTEM.key}" "elasticsearch" diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53TransportClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53TransportClientTest.groovy index d0add13a20..f864bccfc8 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53TransportClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/Elasticsearch53TransportClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING @@ -89,10 +90,10 @@ class Elasticsearch53TransportClientTest extends AgentInstrumentationSpecificati setup: def result = client.admin().cluster().health(new ClusterHealthRequest()) - def status = result.get().status + def clusterHealthStatus = result.get().status expect: - status.name() == "GREEN" + clusterHealthStatus.name() == "GREEN" assertTraces(1) { trace(0, 1) { @@ -126,7 +127,7 @@ class Elasticsearch53TransportClientTest extends AgentInstrumentationSpecificati span(0) { name "GetAction" kind CLIENT - errored true + status ERROR errorEvent RemoteTransportException, String attributes { "${SemanticAttributes.DB_SYSTEM.key}" "elasticsearch" diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringRepositoryTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringRepositoryTest.groovy index 1d6cfcbd5e..e4e6fecb16 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringRepositoryTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringRepositoryTest.groovy @@ -89,7 +89,6 @@ class Elasticsearch53SpringRepositoryTest extends AgentInstrumentationSpecificat span(1) { name "SearchAction" kind CLIENT - errored false childOf span(0) attributes { "${SemanticAttributes.DB_SYSTEM.key}" "elasticsearch" diff --git a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringTemplateTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringTemplateTest.groovy index b56c4e0071..5c1613e617 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringTemplateTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent/src/test/groovy/springdata/Elasticsearch53SpringTemplateTest.groovy @@ -6,6 +6,7 @@ package springdata import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING @@ -93,7 +94,7 @@ class Elasticsearch53SpringTemplateTest extends AgentInstrumentationSpecificatio span(0) { name "RefreshAction" kind CLIENT - errored true + status ERROR errorEvent IndexNotFoundException, "no such index" attributes { "${SemanticAttributes.DB_SYSTEM.key}" "elasticsearch" diff --git a/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6NodeClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6NodeClientTest.groovy index 9cff3db5e5..c7548eca35 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6NodeClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6NodeClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING @@ -66,10 +67,10 @@ class Elasticsearch6NodeClientTest extends AgentInstrumentationSpecification { setup: def result = client.admin().cluster().health(new ClusterHealthRequest()).get() - def status = result.status + def clusterHealthStatus = result.status expect: - status.name() == "GREEN" + clusterHealthStatus.name() == "GREEN" assertTraces(1) { trace(0, 1) { @@ -100,7 +101,7 @@ class Elasticsearch6NodeClientTest extends AgentInstrumentationSpecification { span(0) { name "GetAction" kind CLIENT - errored true + status ERROR errorEvent IndexNotFoundException, ~/no such index( \[invalid-index\])?/ attributes { "${SemanticAttributes.DB_SYSTEM.key}" "elasticsearch" diff --git a/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6TransportClientTest.groovy b/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6TransportClientTest.groovy index 907ca52d8e..9de3aca2d2 100644 --- a/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6TransportClientTest.groovy +++ b/instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/test/groovy/Elasticsearch6TransportClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING @@ -82,10 +83,10 @@ class Elasticsearch6TransportClientTest extends AgentInstrumentationSpecificatio setup: def result = client.admin().cluster().health(new ClusterHealthRequest()) - def status = result.get().status + def clusterHealthStatus = result.get().status expect: - status.name() == "GREEN" + clusterHealthStatus.name() == "GREEN" assertTraces(1) { trace(0, 1) { @@ -119,7 +120,7 @@ class Elasticsearch6TransportClientTest extends AgentInstrumentationSpecificatio span(0) { name "GetAction" kind CLIENT - errored true + status ERROR errorEvent RemoteTransportException, String attributes { "${SemanticAttributes.DB_SYSTEM.key}" "elasticsearch" diff --git a/instrumentation/external-annotations/javaagent/src/test/groovy/TraceAnnotationsTest.groovy b/instrumentation/external-annotations/javaagent/src/test/groovy/TraceAnnotationsTest.groovy index 433852a6e9..fc920b55cd 100644 --- a/instrumentation/external-annotations/javaagent/src/test/groovy/TraceAnnotationsTest.groovy +++ b/instrumentation/external-annotations/javaagent/src/test/groovy/TraceAnnotationsTest.groovy @@ -3,6 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +import static io.opentelemetry.api.trace.StatusCode.ERROR + import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.test.annotation.SayTracedHello import io.opentracing.contrib.dropwizard.Trace @@ -21,7 +23,6 @@ class TraceAnnotationsTest extends AgentInstrumentationSpecification { span(0) { name "SayTracedHello.sayHello" hasNoParent() - errored false attributes { "myattr" "test" } @@ -41,7 +42,6 @@ class TraceAnnotationsTest extends AgentInstrumentationSpecification { span(0) { name "SayTracedHello.sayHelloSayHa" hasNoParent() - errored false attributes { "myattr" "test2" } @@ -49,7 +49,6 @@ class TraceAnnotationsTest extends AgentInstrumentationSpecification { span(1) { name "SayTracedHello.sayHello" childOf span(0) - errored false attributes { "myattr" "test" } @@ -57,7 +56,6 @@ class TraceAnnotationsTest extends AgentInstrumentationSpecification { span(2) { name "SayTracedHello.sayHello" childOf span(0) - errored false attributes { "myattr" "test" } @@ -80,7 +78,7 @@ class TraceAnnotationsTest extends AgentInstrumentationSpecification { trace(0, 1) { span(0) { name "SayTracedHello.sayError" - errored true + status ERROR errorEvent(error.class) } } diff --git a/instrumentation/external-annotations/javaagent/src/test/groovy/TraceProvidersTest.groovy b/instrumentation/external-annotations/javaagent/src/test/groovy/TraceProvidersTest.groovy index 280ee92ff6..56d35ca67b 100644 --- a/instrumentation/external-annotations/javaagent/src/test/groovy/TraceProvidersTest.groovy +++ b/instrumentation/external-annotations/javaagent/src/test/groovy/TraceProvidersTest.groovy @@ -21,7 +21,6 @@ class TraceProvidersTest extends AgentInstrumentationSpecification { span(0) { name "SayTracedHello.${provider.toLowerCase()}" hasNoParent() - errored false attributes { "providerAttr" provider } diff --git a/instrumentation/finatra-2.9/javaagent/src/latestDepTest/groovy/FinatraServerLatestTest.groovy b/instrumentation/finatra-2.9/javaagent/src/latestDepTest/groovy/FinatraServerLatestTest.groovy index b225035c49..6121335785 100644 --- a/instrumentation/finatra-2.9/javaagent/src/latestDepTest/groovy/FinatraServerLatestTest.groovy +++ b/instrumentation/finatra-2.9/javaagent/src/latestDepTest/groovy/FinatraServerLatestTest.groovy @@ -90,7 +90,6 @@ class FinatraServerLatestTest extends HttpServerTest implements Agen childOf(parent as SpanData) // Finatra doesn't propagate the stack trace or exception to the instrumentation // so the normal errorAttributes() method can't be used - errored false attributes { } } diff --git a/instrumentation/finatra-2.9/javaagent/src/test/groovy/FinatraServerTest.groovy b/instrumentation/finatra-2.9/javaagent/src/test/groovy/FinatraServerTest.groovy index 04ef2c205a..b473169b3f 100644 --- a/instrumentation/finatra-2.9/javaagent/src/test/groovy/FinatraServerTest.groovy +++ b/instrumentation/finatra-2.9/javaagent/src/test/groovy/FinatraServerTest.groovy @@ -76,7 +76,6 @@ class FinatraServerTest extends HttpServerTest implements AgentTestT childOf(parent as SpanData) // Finatra doesn't propagate the stack trace or exception to the instrumentation // so the normal errorAttributes() method can't be used - errored false attributes { } } diff --git a/instrumentation/geode-1.4/javaagent/src/test/groovy/PutGetTest.groovy b/instrumentation/geode-1.4/javaagent/src/test/groovy/PutGetTest.groovy index cb04e4b3fe..76db370ba3 100644 --- a/instrumentation/geode-1.4/javaagent/src/test/groovy/PutGetTest.groovy +++ b/instrumentation/geode-1.4/javaagent/src/test/groovy/PutGetTest.groovy @@ -112,12 +112,10 @@ class PutGetTest extends AgentInstrumentationSpecification { span(0) { name "someTrace" kind INTERNAL - errored false } span(1) { name "clear" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "geode" "$SemanticAttributes.DB_NAME.key" "test-region" @@ -127,7 +125,6 @@ class PutGetTest extends AgentInstrumentationSpecification { span(2) { name "put" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "geode" "$SemanticAttributes.DB_NAME.key" "test-region" @@ -137,7 +134,6 @@ class PutGetTest extends AgentInstrumentationSpecification { span(3) { name verb kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "geode" "$SemanticAttributes.DB_NAME.key" "test-region" @@ -171,7 +167,6 @@ class PutGetTest extends AgentInstrumentationSpecification { span(0) { name "query" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "geode" "$SemanticAttributes.DB_NAME.key" "test-region" diff --git a/instrumentation/google-http-client-1.19/javaagent/src/test/groovy/AbstractGoogleHttpClientTest.groovy b/instrumentation/google-http-client-1.19/javaagent/src/test/groovy/AbstractGoogleHttpClientTest.groovy index f6c1b8f970..ebf85ed61b 100644 --- a/instrumentation/google-http-client-1.19/javaagent/src/test/groovy/AbstractGoogleHttpClientTest.groovy +++ b/instrumentation/google-http-client-1.19/javaagent/src/test/groovy/AbstractGoogleHttpClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import com.google.api.client.http.GenericUrl import com.google.api.client.http.HttpRequest @@ -64,15 +65,15 @@ abstract class AbstractGoogleHttpClientTest extends HttpClientTest def uri = server.address.resolve("/error") when: - def status = doRequest(method, uri) + def responseCode = doRequest(method, uri) then: - status == 500 + responseCode == 500 assertTraces(1) { trace(0, 2) { span(0) { kind CLIENT - errored true + status ERROR attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_NAME.key}" "localhost" diff --git a/instrumentation/grails-3.0/javaagent/src/test/groovy/test/GrailsTest.groovy b/instrumentation/grails-3.0/javaagent/src/test/groovy/test/GrailsTest.groovy index 9f91e9d289..782556c5bc 100644 --- a/instrumentation/grails-3.0/javaagent/src/test/groovy/test/GrailsTest.groovy +++ b/instrumentation/grails-3.0/javaagent/src/test/groovy/test/GrailsTest.groovy @@ -16,6 +16,7 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn import grails.boot.GrailsApp import grails.boot.config.GrailsAutoConfiguration import groovy.transform.CompileStatic +import io.opentelemetry.api.trace.StatusCode import io.opentelemetry.instrumentation.test.AgentTestTrait import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.instrumentation.test.base.HttpServerTest @@ -36,7 +37,8 @@ class GrailsTest extends HttpServerTest implemen try { ServerProperties.getDeclaredMethod("getServlet") contextPathKey = "server.servlet.contextPath" - } catch (NoSuchMethodException ignore) {} + } catch (NoSuchMethodException ignore) { + } Map properties = new HashMap<>() properties.put("server.port", port) properties.put(contextPathKey, contextPath) @@ -116,7 +118,6 @@ class GrailsTest extends HttpServerTest implemen trace.span(index + 1) { name errorSpanName kind INTERNAL - errored false attributes { } } @@ -124,7 +125,6 @@ class GrailsTest extends HttpServerTest implemen trace.span(index + 2) { name ~/\.sendError$/ kind INTERNAL - errored false attributes { } } @@ -136,7 +136,6 @@ class GrailsTest extends HttpServerTest implemen trace.span(index) { name endpoint == REDIRECT ? ~/\.sendRedirect$/ : ~/\.sendError$/ kind INTERNAL - errored false attributes { } } @@ -155,8 +154,8 @@ class GrailsTest extends HttpServerTest implemen name "TestController.${endpoint.name().toLowerCase()}" } kind INTERNAL - errored endpoint == EXCEPTION if (endpoint == EXCEPTION) { + status StatusCode.ERROR errorEvent(Exception, EXCEPTION.body) } childOf((SpanData) parent) diff --git a/instrumentation/grpc-1.5/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_5/AbstractGrpcStreamingTest.groovy b/instrumentation/grpc-1.5/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_5/AbstractGrpcStreamingTest.groovy index e24c82627f..c15a4f489f 100644 --- a/instrumentation/grpc-1.5/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_5/AbstractGrpcStreamingTest.groovy +++ b/instrumentation/grpc-1.5/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_5/AbstractGrpcStreamingTest.groovy @@ -16,9 +16,9 @@ import io.grpc.ManagedChannelBuilder import io.grpc.Server import io.grpc.ServerBuilder import io.grpc.stub.StreamObserver -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.InstrumentationSpecification import io.opentelemetry.instrumentation.test.utils.PortUtils +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import java.util.concurrent.CopyOnWriteArrayList import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicReference @@ -108,7 +108,6 @@ abstract class AbstractGrpcStreamingTest extends InstrumentationSpecification { name "example.Greeter/Conversation" kind CLIENT hasNoParent() - errored false attributes { "${SemanticAttributes.RPC_SYSTEM.key}" "grpc" "${SemanticAttributes.RPC_SERVICE.key}" "example.Greeter" @@ -129,7 +128,6 @@ abstract class AbstractGrpcStreamingTest extends InstrumentationSpecification { name "example.Greeter/Conversation" kind SERVER childOf span(0) - errored false attributes { "${SemanticAttributes.RPC_SYSTEM.key}" "grpc" "${SemanticAttributes.RPC_SERVICE.key}" "example.Greeter" diff --git a/instrumentation/grpc-1.5/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_5/AbstractGrpcTest.groovy b/instrumentation/grpc-1.5/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_5/AbstractGrpcTest.groovy index c080a40a3d..3b8827edd5 100644 --- a/instrumentation/grpc-1.5/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_5/AbstractGrpcTest.groovy +++ b/instrumentation/grpc-1.5/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_5/AbstractGrpcTest.groovy @@ -7,6 +7,7 @@ package io.opentelemetry.instrumentation.grpc.v1_5 import static io.opentelemetry.api.trace.SpanKind.CLIENT import static io.opentelemetry.api.trace.SpanKind.SERVER +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace @@ -31,10 +32,9 @@ import io.grpc.ServerInterceptor import io.grpc.Status import io.grpc.StatusRuntimeException import io.grpc.stub.StreamObserver -import io.opentelemetry.api.trace.StatusCode -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.instrumentation.test.InstrumentationSpecification import io.opentelemetry.instrumentation.test.utils.PortUtils +import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicReference @@ -86,7 +86,6 @@ abstract class AbstractGrpcTest extends InstrumentationSpecification { name "example.Greeter/SayHello" kind CLIENT childOf span(0) - errored false event(0) { eventName "message" attributes { @@ -104,7 +103,6 @@ abstract class AbstractGrpcTest extends InstrumentationSpecification { name "example.Greeter/SayHello" kind SERVER childOf span(1) - errored false event(0) { eventName "message" attributes { @@ -168,8 +166,7 @@ abstract class AbstractGrpcTest extends InstrumentationSpecification { name "example.Greeter/SayHello" kind CLIENT hasNoParent() - errored true - status(StatusCode.ERROR) + status ERROR attributes { "${SemanticAttributes.RPC_SYSTEM.key}" "grpc" "${SemanticAttributes.RPC_SERVICE.key}" "example.Greeter" @@ -180,8 +177,7 @@ abstract class AbstractGrpcTest extends InstrumentationSpecification { name "example.Greeter/SayHello" kind SERVER childOf span(0) - errored true - status(StatusCode.ERROR) + status ERROR event(0) { eventName "message" attributes { @@ -255,7 +251,7 @@ abstract class AbstractGrpcTest extends InstrumentationSpecification { name "example.Greeter/SayHello" kind CLIENT hasNoParent() - errored true + status ERROR // NB: Exceptions thrown on the server don't appear to be propagated to the client, at // least for the version we test against. attributes { @@ -268,8 +264,7 @@ abstract class AbstractGrpcTest extends InstrumentationSpecification { name "example.Greeter/SayHello" kind SERVER childOf span(0) - errored true - status(StatusCode.ERROR) + status ERROR event(0) { eventName "message" attributes { @@ -413,7 +408,6 @@ abstract class AbstractGrpcTest extends InstrumentationSpecification { name "example.Greeter/SayHello" kind CLIENT childOf span(0) - errored false event(0) { eventName "message" attributes { @@ -431,7 +425,6 @@ abstract class AbstractGrpcTest extends InstrumentationSpecification { name "example.Greeter/SayHello" kind SERVER childOf span(1) - errored false event(0) { eventName "message" attributes { diff --git a/instrumentation/hibernate/hibernate-3.3/javaagent/src/test/groovy/SessionTest.groovy b/instrumentation/hibernate/hibernate-3.3/javaagent/src/test/groovy/SessionTest.groovy index 77bfa869a0..8c43da3b47 100644 --- a/instrumentation/hibernate/hibernate-3.3/javaagent/src/test/groovy/SessionTest.groovy +++ b/instrumentation/hibernate/hibernate-3.3/javaagent/src/test/groovy/SessionTest.groovy @@ -5,6 +5,7 @@ import static io.opentelemetry.api.trace.SpanKind.CLIENT import static io.opentelemetry.api.trace.SpanKind.INTERNAL +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import io.opentelemetry.semconv.trace.attributes.SemanticAttributes @@ -286,7 +287,7 @@ class SessionTest extends AbstractHibernateTest { name "Session.replicate" kind INTERNAL childOf span(0) - errored(true) + status ERROR errorEvent(MappingException, "Unknown entity: java.lang.Long") } span(2) { diff --git a/instrumentation/hibernate/hibernate-4.0/javaagent/src/test/groovy/SessionTest.groovy b/instrumentation/hibernate/hibernate-4.0/javaagent/src/test/groovy/SessionTest.groovy index 657fa7a385..b82fe56d70 100644 --- a/instrumentation/hibernate/hibernate-4.0/javaagent/src/test/groovy/SessionTest.groovy +++ b/instrumentation/hibernate/hibernate-4.0/javaagent/src/test/groovy/SessionTest.groovy @@ -5,6 +5,7 @@ import static io.opentelemetry.api.trace.SpanKind.CLIENT import static io.opentelemetry.api.trace.SpanKind.INTERNAL +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import io.opentelemetry.semconv.trace.attributes.SemanticAttributes @@ -225,7 +226,7 @@ class SessionTest extends AbstractHibernateTest { name "Session.replicate" kind INTERNAL childOf span(0) - errored(true) + status ERROR errorEvent(MappingException, "Unknown entity: java.lang.Long") } span(2) { diff --git a/instrumentation/hibernate/hibernate-4.3/javaagent/src/test/groovy/ProcedureCallTest.groovy b/instrumentation/hibernate/hibernate-4.3/javaagent/src/test/groovy/ProcedureCallTest.groovy index 83c067eea4..402d8ec670 100644 --- a/instrumentation/hibernate/hibernate-4.3/javaagent/src/test/groovy/ProcedureCallTest.groovy +++ b/instrumentation/hibernate/hibernate-4.3/javaagent/src/test/groovy/ProcedureCallTest.groovy @@ -5,6 +5,7 @@ import static io.opentelemetry.api.trace.SpanKind.CLIENT import static io.opentelemetry.api.trace.SpanKind.INTERNAL +import static io.opentelemetry.api.trace.StatusCode.ERROR import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.semconv.trace.attributes.SemanticAttributes @@ -151,7 +152,7 @@ class ProcedureCallTest extends AgentInstrumentationSpecification { name "ProcedureCall.getOutputs TEST_PROC" kind INTERNAL childOf span(0) - errored(true) + status ERROR errorEvent(SQLGrammarException, "could not prepare statement") } span(2) { diff --git a/instrumentation/http-url-connection/javaagent/src/test/groovy/HttpUrlConnectionResponseCodeOnlyTest.groovy b/instrumentation/http-url-connection/javaagent/src/test/groovy/HttpUrlConnectionResponseCodeOnlyTest.groovy index e33257972f..fe598969e1 100644 --- a/instrumentation/http-url-connection/javaagent/src/test/groovy/HttpUrlConnectionResponseCodeOnlyTest.groovy +++ b/instrumentation/http-url-connection/javaagent/src/test/groovy/HttpUrlConnectionResponseCodeOnlyTest.groovy @@ -32,7 +32,7 @@ class HttpUrlConnectionResponseCodeOnlyTest extends HttpClientTest implements } @Override - Integer statusOnRedirectError() { + Integer responseCodeOnRedirectError() { return 302 } @@ -99,7 +99,6 @@ class HttpUrlConnectionTest extends HttpClientTest implements span(0) { name "someTrace" hasNoParent() - errored false attributes { } } @@ -107,7 +106,6 @@ class HttpUrlConnectionTest extends HttpClientTest implements name expectedOperationName("GET") kind CLIENT childOf span(0) - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_NAME.key}" "localhost" @@ -122,7 +120,6 @@ class HttpUrlConnectionTest extends HttpClientTest implements name "test-http-server" kind SERVER childOf span(1) - errored false attributes { } } @@ -130,7 +127,6 @@ class HttpUrlConnectionTest extends HttpClientTest implements name expectedOperationName("GET") kind CLIENT childOf span(0) - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_NAME.key}" "localhost" @@ -145,7 +141,6 @@ class HttpUrlConnectionTest extends HttpClientTest implements name "test-http-server" kind SERVER childOf span(3) - errored false attributes { } } @@ -190,7 +185,6 @@ class HttpUrlConnectionTest extends HttpClientTest implements span(0) { name "someTrace" hasNoParent() - errored false attributes { } } @@ -198,7 +192,6 @@ class HttpUrlConnectionTest extends HttpClientTest implements name expectedOperationName("GET") kind CLIENT childOf span(0) - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_NAME.key}" "localhost" @@ -213,7 +206,6 @@ class HttpUrlConnectionTest extends HttpClientTest implements name expectedOperationName("GET") kind CLIENT childOf span(0) - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_NAME.key}" "localhost" @@ -249,7 +241,6 @@ class HttpUrlConnectionTest extends HttpClientTest implements span(0) { name "someTrace" hasNoParent() - errored false attributes { } } @@ -257,7 +248,6 @@ class HttpUrlConnectionTest extends HttpClientTest implements name expectedOperationName("GET") kind CLIENT childOf span(0) - errored false attributes { "${SemanticAttributes.NET_PEER_NAME.key}" "localhost" "${SemanticAttributes.NET_PEER_PORT.key}" server.address.port @@ -308,7 +298,6 @@ class HttpUrlConnectionTest extends HttpClientTest implements span(0) { name "someTrace" hasNoParent() - errored false attributes { } } @@ -316,7 +305,6 @@ class HttpUrlConnectionTest extends HttpClientTest implements name expectedOperationName("POST") kind CLIENT childOf span(0) - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_NAME.key}" "localhost" @@ -331,7 +319,6 @@ class HttpUrlConnectionTest extends HttpClientTest implements name "test-http-server" kind SERVER childOf span(1) - errored false attributes { } } diff --git a/instrumentation/http-url-connection/javaagent/src/test/groovy/HttpUrlConnectionUseCachesFalseTest.groovy b/instrumentation/http-url-connection/javaagent/src/test/groovy/HttpUrlConnectionUseCachesFalseTest.groovy index e6a719f709..6c3d2360b9 100644 --- a/instrumentation/http-url-connection/javaagent/src/test/groovy/HttpUrlConnectionUseCachesFalseTest.groovy +++ b/instrumentation/http-url-connection/javaagent/src/test/groovy/HttpUrlConnectionUseCachesFalseTest.groovy @@ -39,7 +39,7 @@ class HttpUrlConnectionUseCachesFalseTest extends HttpClientTest> implemen } @Override - Integer statusOnRedirectError() { + Integer responseCodeOnRedirectError() { return 302 } } diff --git a/instrumentation/http-url-connection/javaagent/src/test/groovy/UrlConnectionTest.groovy b/instrumentation/http-url-connection/javaagent/src/test/groovy/UrlConnectionTest.groovy index 23ab69bc92..ad4cc84874 100644 --- a/instrumentation/http-url-connection/javaagent/src/test/groovy/UrlConnectionTest.groovy +++ b/instrumentation/http-url-connection/javaagent/src/test/groovy/UrlConnectionTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.PortUtils.UNUSABLE_PORT import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace @@ -32,14 +33,14 @@ class UrlConnectionTest extends AgentInstrumentationSpecification { span(0) { name "someTrace" hasNoParent() - errored true + status ERROR errorEvent ConnectException, String } span(1) { name expectedOperationName("GET") kind CLIENT childOf span(0) - errored true + status ERROR errorEvent ConnectException, String attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" diff --git a/instrumentation/hystrix-1.4/javaagent/src/test/groovy/HystrixObservableChainTest.groovy b/instrumentation/hystrix-1.4/javaagent/src/test/groovy/HystrixObservableChainTest.groovy index 389df4e5ed..e3f23813ba 100644 --- a/instrumentation/hystrix-1.4/javaagent/src/test/groovy/HystrixObservableChainTest.groovy +++ b/instrumentation/hystrix-1.4/javaagent/src/test/groovy/HystrixObservableChainTest.groovy @@ -63,14 +63,12 @@ class HystrixObservableChainTest extends AgentInstrumentationSpecification { span(0) { name "parent" hasNoParent() - errored false attributes { } } span(1) { name "ExampleGroup.HystrixObservableChainTest\$1.execute" childOf span(0) - errored false attributes { "hystrix.command" "HystrixObservableChainTest\$1" "hystrix.group" "ExampleGroup" @@ -80,14 +78,12 @@ class HystrixObservableChainTest extends AgentInstrumentationSpecification { span(2) { name "tracedMethod" childOf span(1) - errored false attributes { } } span(3) { name "OtherGroup.HystrixObservableChainTest\$2.execute" childOf span(1) - errored false attributes { "hystrix.command" "HystrixObservableChainTest\$2" "hystrix.group" "OtherGroup" @@ -97,7 +93,6 @@ class HystrixObservableChainTest extends AgentInstrumentationSpecification { span(4) { name "anotherTracedMethod" childOf span(3) - errored false attributes { } } diff --git a/instrumentation/hystrix-1.4/javaagent/src/test/groovy/HystrixObservableTest.groovy b/instrumentation/hystrix-1.4/javaagent/src/test/groovy/HystrixObservableTest.groovy index 65d3c8be27..913f2a64df 100644 --- a/instrumentation/hystrix-1.4/javaagent/src/test/groovy/HystrixObservableTest.groovy +++ b/instrumentation/hystrix-1.4/javaagent/src/test/groovy/HystrixObservableTest.groovy @@ -4,6 +4,7 @@ */ import static com.netflix.hystrix.HystrixCommandGroupKey.Factory.asKey +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runInternalSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace @@ -54,14 +55,12 @@ class HystrixObservableTest extends AgentInstrumentationSpecification { span(0) { name "parent" hasNoParent() - errored false attributes { } } span(1) { name "ExampleGroup.HystrixObservableTest\$1.execute" childOf span(0) - errored false attributes { "hystrix.command" "HystrixObservableTest\$1" "hystrix.group" "ExampleGroup" @@ -71,7 +70,6 @@ class HystrixObservableTest extends AgentInstrumentationSpecification { span(2) { name "tracedMethod" childOf span(1) - errored false attributes { } } @@ -148,14 +146,13 @@ class HystrixObservableTest extends AgentInstrumentationSpecification { span(0) { name "parent" hasNoParent() - errored false attributes { } } span(1) { name "ExampleGroup.HystrixObservableTest\$2.execute" childOf span(0) - errored true + status ERROR errorEvent(IllegalArgumentException) attributes { "hystrix.command" "HystrixObservableTest\$2" @@ -166,7 +163,6 @@ class HystrixObservableTest extends AgentInstrumentationSpecification { span(2) { name "ExampleGroup.HystrixObservableTest\$2.fallback" childOf span(1) - errored false attributes { "hystrix.command" "HystrixObservableTest\$2" "hystrix.group" "ExampleGroup" @@ -245,13 +241,13 @@ class HystrixObservableTest extends AgentInstrumentationSpecification { span(0) { name "parent" hasNoParent() - errored true + status ERROR errorEvent(HystrixRuntimeException, "HystrixObservableTest\$3 failed and no fallback available.") } span(1) { name "FailingGroup.HystrixObservableTest\$3.execute" childOf span(0) - errored true + status ERROR errorEvent(IllegalArgumentException) attributes { "hystrix.command" "HystrixObservableTest\$3" @@ -262,7 +258,7 @@ class HystrixObservableTest extends AgentInstrumentationSpecification { span(2) { name "FailingGroup.HystrixObservableTest\$3.fallback" childOf span(1) - errored true + status ERROR errorEvent(UnsupportedOperationException, "No fallback available.") attributes { "hystrix.command" "HystrixObservableTest\$3" diff --git a/instrumentation/hystrix-1.4/javaagent/src/test/groovy/HystrixTest.groovy b/instrumentation/hystrix-1.4/javaagent/src/test/groovy/HystrixTest.groovy index d1b8793a36..2c887a45a2 100644 --- a/instrumentation/hystrix-1.4/javaagent/src/test/groovy/HystrixTest.groovy +++ b/instrumentation/hystrix-1.4/javaagent/src/test/groovy/HystrixTest.groovy @@ -4,6 +4,7 @@ */ import static com.netflix.hystrix.HystrixCommandGroupKey.Factory.asKey +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runInternalSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace @@ -38,14 +39,12 @@ class HystrixTest extends AgentInstrumentationSpecification { span(0) { name "parent" hasNoParent() - errored false attributes { } } span(1) { name "ExampleGroup.HystrixTest\$1.execute" childOf span(0) - errored false attributes { "hystrix.command" "HystrixTest\$1" "hystrix.group" "ExampleGroup" @@ -55,7 +54,6 @@ class HystrixTest extends AgentInstrumentationSpecification { span(2) { name "tracedMethod" childOf span(1) - errored false attributes { } } @@ -100,14 +98,13 @@ class HystrixTest extends AgentInstrumentationSpecification { span(0) { name "parent" hasNoParent() - errored false attributes { } } span(1) { name "ExampleGroup.HystrixTest\$2.execute" childOf span(0) - errored true + status ERROR errorEvent(IllegalArgumentException) attributes { "hystrix.command" "HystrixTest\$2" @@ -118,7 +115,6 @@ class HystrixTest extends AgentInstrumentationSpecification { span(2) { name "ExampleGroup.HystrixTest\$2.fallback" childOf span(1) - errored false attributes { "hystrix.command" "HystrixTest\$2" "hystrix.group" "ExampleGroup" diff --git a/instrumentation/java-httpclient/javaagent/src/test/groovy/JdkHttpClientTest.groovy b/instrumentation/java-httpclient/javaagent/src/test/groovy/JdkHttpClientTest.groovy index f0726344fb..2409b05ce3 100644 --- a/instrumentation/java-httpclient/javaagent/src/test/groovy/JdkHttpClientTest.groovy +++ b/instrumentation/java-httpclient/javaagent/src/test/groovy/JdkHttpClientTest.groovy @@ -71,17 +71,16 @@ class JdkHttpClientTest extends HttpClientTest implements AgentTest def uri = new URI("https://www.google.com/") when: - def status = doRequest(method, uri) + def responseCode = doRequest(method, uri) then: - status == 200 + responseCode == 200 assertTraces(1) { trace(0, 1 + extraClientSpans()) { span(0) { hasNoParent() name expectedOperationName(method) kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_NAME.key}" uri.host @@ -91,7 +90,7 @@ class JdkHttpClientTest extends HttpClientTest implements AgentTest "${SemanticAttributes.HTTP_URL.key}" { it == "${uri}" || it == "${removeFragment(uri)}" } "${SemanticAttributes.HTTP_METHOD.key}" method "${SemanticAttributes.HTTP_FLAVOR.key}" "2.0" - "${SemanticAttributes.HTTP_STATUS_CODE.key}" status + "${SemanticAttributes.HTTP_STATUS_CODE.key}" responseCode } } } diff --git a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-common/javaagent/src/test/groovy/JaxRsClientTest.groovy b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-common/javaagent/src/test/groovy/JaxRsClientTest.groovy index b3a566e563..343a0f4946 100644 --- a/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-common/javaagent/src/test/groovy/JaxRsClientTest.groovy +++ b/instrumentation/jaxrs-client/jaxrs-client-2.0/jaxrs-client-2.0-common/javaagent/src/test/groovy/JaxRsClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import io.opentelemetry.instrumentation.test.AgentTestTrait import io.opentelemetry.instrumentation.test.base.HttpClientTest @@ -83,7 +84,7 @@ abstract class JaxRsClientTest extends HttpClientTest implem hasNoParent() name expectedOperationName(method) kind CLIENT - errored true + status ERROR attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_NAME.key}" uri.host diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-testing/src/main/groovy/JaxRsFilterTest.groovy b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-testing/src/main/groovy/JaxRsFilterTest.groovy index c95e7e6720..4dcde6c47b 100644 --- a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-testing/src/main/groovy/JaxRsFilterTest.groovy +++ b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-testing/src/main/groovy/JaxRsFilterTest.groovy @@ -5,6 +5,7 @@ import static io.opentelemetry.api.trace.SpanKind.INTERNAL import static io.opentelemetry.api.trace.SpanKind.SERVER +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderServerTrace import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification @@ -74,11 +75,8 @@ abstract class JaxRsFilterTest extends AgentInstrumentationSpecification { span(0) { name parentSpanName != null ? parentSpanName : "test.span" kind SERVER - if (runsOnServer()) { - errored abortNormal - } else { - attributes { - } + if (runsOnServer() && abortNormal) { + status ERROR } } span(1) { diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-testing/src/main/groovy/JaxRsHttpServerTest.groovy b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-testing/src/main/groovy/JaxRsHttpServerTest.groovy index b6bb32b023..96bae8a635 100644 --- a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-testing/src/main/groovy/JaxRsHttpServerTest.groovy +++ b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-testing/src/main/groovy/JaxRsHttpServerTest.groovy @@ -5,6 +5,7 @@ import static io.opentelemetry.api.trace.SpanKind.INTERNAL import static io.opentelemetry.api.trace.SpanKind.SERVER +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.EXCEPTION import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.PATH_PARAM import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS @@ -173,7 +174,9 @@ abstract class JaxRsHttpServerTest extends HttpServerTest implements Agent trace.span(index) { name path kind SERVER - errored isError + if (isError) { + status ERROR + } if (parentID != null) { traceId traceID parentSpanId parentID @@ -216,8 +219,8 @@ abstract class JaxRsHttpServerTest extends HttpServerTest implements Agent trace.span(index) { name "JaxRsTestResource.${methodName}" kind INTERNAL - errored isError if (isError) { + status ERROR errorEvent(Exception, exceptionMessage) } childOf((SpanData) parent) diff --git a/instrumentation/jaxws/jaxws-2.0-testing/src/main/groovy/AbstractJaxWsTest.groovy b/instrumentation/jaxws/jaxws-2.0-testing/src/main/groovy/AbstractJaxWsTest.groovy index 0099013a8c..df400e9ebb 100644 --- a/instrumentation/jaxws/jaxws-2.0-testing/src/main/groovy/AbstractJaxWsTest.groovy +++ b/instrumentation/jaxws/jaxws-2.0-testing/src/main/groovy/AbstractJaxWsTest.groovy @@ -3,14 +3,17 @@ * SPDX-License-Identifier: Apache-2.0 */ -import io.opentelemetry.api.trace.SpanKind +import static io.opentelemetry.api.trace.SpanKind.INTERNAL +import static io.opentelemetry.api.trace.SpanKind.SERVER +import static io.opentelemetry.api.trace.StatusCode.ERROR + import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.instrumentation.test.base.HttpServerTestTrait import io.opentelemetry.sdk.trace.data.SpanData import io.opentelemetry.semconv.trace.attributes.SemanticAttributes -import io.opentelemetry.test.hello_web_service.HelloRequest import io.opentelemetry.test.hello_web_service.Hello2Request +import io.opentelemetry.test.hello_web_service.HelloRequest import org.eclipse.jetty.server.Server import org.eclipse.jetty.util.resource.Resource import org.eclipse.jetty.webapp.WebAppContext @@ -156,8 +159,10 @@ abstract class AbstractJaxWsTest extends AgentInstrumentationSpecification imple trace.span(index) { hasNoParent() name operation - kind SpanKind.SERVER - errored exception != null + kind SERVER + if (exception != null) { + status ERROR + } } } @@ -169,9 +174,9 @@ abstract class AbstractJaxWsTest extends AgentInstrumentationSpecification imple childOf((SpanData) parentSpan) } name "HelloService/" + operation - kind SpanKind.INTERNAL - errored exception != null + kind INTERNAL if (exception) { + status ERROR errorEvent(exception.class, exception.message) } } @@ -185,9 +190,9 @@ abstract class AbstractJaxWsTest extends AgentInstrumentationSpecification imple childOf((SpanData) parentSpan) } name "HelloServiceImpl." + methodName - kind SpanKind.INTERNAL - errored exception != null + kind INTERNAL if (exception) { + status ERROR errorEvent(exception.class, exception.message) } attributes { diff --git a/instrumentation/jdbc/javaagent/src/test/groovy/JdbcInstrumentationTest.groovy b/instrumentation/jdbc/javaagent/src/test/groovy/JdbcInstrumentationTest.groovy index 7acdc2d066..8cbccb63e8 100644 --- a/instrumentation/jdbc/javaagent/src/test/groovy/JdbcInstrumentationTest.groovy +++ b/instrumentation/jdbc/javaagent/src/test/groovy/JdbcInstrumentationTest.groovy @@ -180,7 +180,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification { name spanName kind CLIENT childOf span(0) - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" system "$SemanticAttributes.DB_NAME.key" dbNameLower @@ -238,7 +237,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification { name spanName kind CLIENT childOf span(0) - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" system "$SemanticAttributes.DB_NAME.key" dbNameLower @@ -288,7 +286,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification { name spanName kind CLIENT childOf span(0) - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" system "$SemanticAttributes.DB_NAME.key" dbNameLower @@ -338,7 +335,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification { name spanName kind CLIENT childOf span(0) - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" system "$SemanticAttributes.DB_NAME.key" dbName.toLowerCase() @@ -388,7 +384,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification { name dbNameLower kind CLIENT childOf span(0) - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" system "$SemanticAttributes.DB_NAME.key" dbNameLower @@ -439,7 +434,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification { name dbNameLower kind CLIENT childOf span(0) - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" system "$SemanticAttributes.DB_NAME.key" dbName.toLowerCase() @@ -501,7 +495,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification { name spanName kind CLIENT childOf span(0) - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" system "$SemanticAttributes.DB_NAME.key" dbNameLower @@ -604,7 +597,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification { name "DB Query" kind CLIENT childOf span(0) - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "testdb" "$SemanticAttributes.DB_STATEMENT.key" "testing ?" @@ -643,7 +635,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification { name spanName kind CLIENT childOf span(0) - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "testdb" "$SemanticAttributes.DB_NAME.key" databaseName @@ -702,7 +693,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification { span(0) { name "SELECT ${dbNameLower}.INFORMATION_SCHEMA.SYSTEM_USERS" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "hsqldb" "$SemanticAttributes.DB_NAME.key" dbNameLower @@ -748,7 +738,6 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification { name "SELECT table" kind CLIENT childOf span(0) - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "testdb" "$SemanticAttributes.DB_CONNECTION_STRING.key" "testdb://localhost" diff --git a/instrumentation/jms-1.1/javaagent/src/jms2Test/groovy/Jms2Test.groovy b/instrumentation/jms-1.1/javaagent/src/jms2Test/groovy/Jms2Test.groovy index d551ec869e..ae3059f55d 100644 --- a/instrumentation/jms-1.1/javaagent/src/jms2Test/groovy/Jms2Test.groovy +++ b/instrumentation/jms-1.1/javaagent/src/jms2Test/groovy/Jms2Test.groovy @@ -239,7 +239,6 @@ class Jms2Test extends AgentInstrumentationSpecification { trace.span(index) { name destinationName + " send" kind PRODUCER - errored false hasNoParent() attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "jms" @@ -264,7 +263,6 @@ class Jms2Test extends AgentInstrumentationSpecification { } else { hasNoParent() } - errored false attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "jms" "${SemanticAttributes.MESSAGING_DESTINATION.key}" destinationName diff --git a/instrumentation/jms-1.1/javaagent/src/test/groovy/Jms1Test.groovy b/instrumentation/jms-1.1/javaagent/src/test/groovy/Jms1Test.groovy index f5ab8d4138..aa87f6b987 100644 --- a/instrumentation/jms-1.1/javaagent/src/test/groovy/Jms1Test.groovy +++ b/instrumentation/jms-1.1/javaagent/src/test/groovy/Jms1Test.groovy @@ -199,7 +199,6 @@ class Jms1Test extends AgentInstrumentationSpecification { hasNoParent() name destinationName + " receive" kind CONSUMER - errored false attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "jms" "${SemanticAttributes.MESSAGING_DESTINATION.key}" destinationName @@ -271,7 +270,6 @@ class Jms1Test extends AgentInstrumentationSpecification { trace.span(index) { name destinationName + " send" kind PRODUCER - errored false hasNoParent() attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "jms" @@ -296,7 +294,6 @@ class Jms1Test extends AgentInstrumentationSpecification { } else { hasNoParent() } - errored false attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "jms" "${SemanticAttributes.MESSAGING_DESTINATION.key}" destinationName diff --git a/instrumentation/jsf/jsf-testing-common/src/main/groovy/BaseJsfTest.groovy b/instrumentation/jsf/jsf-testing-common/src/main/groovy/BaseJsfTest.groovy index 5b9ec89e09..b24ec76fbc 100644 --- a/instrumentation/jsf/jsf-testing-common/src/main/groovy/BaseJsfTest.groovy +++ b/instrumentation/jsf/jsf-testing-common/src/main/groovy/BaseJsfTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.INTERNAL +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicServerSpan import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification @@ -126,7 +127,7 @@ abstract class BaseJsfTest extends AgentInstrumentationSpecification implements // set up form parameter for post RequestBody formBody = new FormBody.Builder() .add("app-form", "app-form") - // value used for name is returned in app-form:output-message element + // value used for name is returned in app-form:output-message element .add("app-form:name", "test") .add("app-form:submit", "Say hello") .add("app-form_SUBMIT", "1") // MyFaces @@ -186,7 +187,7 @@ abstract class BaseJsfTest extends AgentInstrumentationSpecification implements // set up form parameter for post RequestBody formBody = new FormBody.Builder() .add("app-form", "app-form") - // setting name parameter to "exception" triggers throwing exception in GreetingForm + // setting name parameter to "exception" triggers throwing exception in GreetingForm .add("app-form:name", "exception") .add("app-form:submit", "Say hello") .add("app-form_SUBMIT", "1") // MyFaces @@ -219,8 +220,8 @@ abstract class BaseJsfTest extends AgentInstrumentationSpecification implements trace.span(index) { name spanName kind INTERNAL - errored expectedException != null if (expectedException != null) { + status ERROR errorEvent(expectedException.getClass(), expectedException.getMessage()) } childOf((SpanData) parent) diff --git a/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationBasicTests.groovy b/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationBasicTests.groovy index 7ced2ca98c..1444a41a2b 100644 --- a/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationBasicTests.groovy +++ b/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationBasicTests.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.SERVER +import static io.opentelemetry.api.trace.StatusCode.ERROR import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.test.utils.OkHttpUtils @@ -87,7 +88,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { hasNoParent() name "/$jspWebappContext/$jspFileName" kind SERVER - errored false attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" "${SemanticAttributes.NET_PEER_PORT.key}" Long @@ -102,7 +102,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(1) { childOf span(0) name "Compile /$jspFileName" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.$jspClassNamePrefix$jspClassName" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -111,7 +110,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(2) { childOf span(0) name "Render /$jspFileName" - errored false attributes { "jsp.requestURL" reqUrl } @@ -146,7 +144,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { hasNoParent() name "/$jspWebappContext/getQuery.jsp" kind SERVER - errored false attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" "${SemanticAttributes.NET_PEER_PORT.key}" Long @@ -161,7 +158,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(1) { childOf span(0) name "Compile /getQuery.jsp" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.getQuery_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -170,7 +166,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(2) { childOf span(0) name "Render /getQuery.jsp" - errored false attributes { "jsp.requestURL" reqUrl } @@ -202,7 +197,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { hasNoParent() name "/$jspWebappContext/post.jsp" kind SERVER - errored false attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" "${SemanticAttributes.NET_PEER_PORT.key}" Long @@ -217,7 +211,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(1) { childOf span(0) name "Compile /post.jsp" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.post_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -226,7 +219,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(2) { childOf span(0) name "Render /post.jsp" - errored false attributes { "jsp.requestURL" reqUrl } @@ -255,7 +247,7 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { hasNoParent() name "/$jspWebappContext/$jspFileName" kind SERVER - errored true + status ERROR event(0) { eventName(SemanticAttributes.EXCEPTION_EVENT_NAME) attributes { @@ -282,7 +274,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(1) { childOf span(0) name "Compile /$jspFileName" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.$jspClassName" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -291,7 +282,7 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(2) { childOf span(0) name "Render /$jspFileName" - errored true + status ERROR event(0) { eventName(SemanticAttributes.EXCEPTION_EVENT_NAME) attributes { @@ -337,7 +328,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { hasNoParent() name "/$jspWebappContext/includes/includeHtml.jsp" kind SERVER - errored false attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" "${SemanticAttributes.NET_PEER_PORT.key}" Long @@ -352,7 +342,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(1) { childOf span(0) name "Compile /includes/includeHtml.jsp" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.includes.includeHtml_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -361,7 +350,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(2) { childOf span(0) name "Render /includes/includeHtml.jsp" - errored false attributes { "jsp.requestURL" reqUrl } @@ -369,7 +357,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(3) { childOf span(2) name "ApplicationDispatcher.include" - errored false } } } @@ -394,7 +381,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { hasNoParent() name "/$jspWebappContext/includes/includeMulti.jsp" kind SERVER - errored false attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" "${SemanticAttributes.NET_PEER_PORT.key}" Long @@ -409,7 +395,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(1) { childOf span(0) name "Compile /includes/includeMulti.jsp" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.includes.includeMulti_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -418,7 +403,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(2) { childOf span(0) name "Render /includes/includeMulti.jsp" - errored false attributes { "jsp.requestURL" reqUrl } @@ -426,12 +410,10 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(3) { childOf span(2) name "ApplicationDispatcher.include" - errored false } span(4) { childOf span(3) name "Compile /common/javaLoopH2.jsp" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.common.javaLoopH2_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -440,7 +422,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(5) { childOf span(3) name "Render /common/javaLoopH2.jsp" - errored false attributes { "jsp.requestURL" reqUrl } @@ -448,12 +429,10 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(6) { childOf span(2) name "ApplicationDispatcher.include" - errored false } span(7) { childOf span(6) name "Compile /common/javaLoopH2.jsp" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.common.javaLoopH2_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -462,7 +441,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(8) { childOf span(6) name "Render /common/javaLoopH2.jsp" - errored false attributes { "jsp.requestURL" reqUrl } @@ -490,7 +468,7 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { hasNoParent() name "/$jspWebappContext/$jspFileName" kind SERVER - errored true + status ERROR errorEvent(JasperException, String) attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -506,7 +484,7 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { span(1) { childOf span(0) name "Compile /$jspFileName" - errored true + status ERROR errorEvent(JasperException, String) attributes { "jsp.classFQCN" "org.apache.jsp.$jspClassNamePrefix$jspClassName" @@ -542,7 +520,6 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification { hasNoParent() name "/$jspWebappContext/*" kind SERVER - errored false attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" "${SemanticAttributes.NET_PEER_PORT.key}" Long diff --git a/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationForwardTests.groovy b/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationForwardTests.groovy index 6ba89c0ac1..d69fd87a1c 100644 --- a/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationForwardTests.groovy +++ b/instrumentation/jsp-2.3/javaagent/src/test/groovy/JspInstrumentationForwardTests.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.SERVER +import static io.opentelemetry.api.trace.StatusCode.ERROR import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.test.utils.OkHttpUtils @@ -85,7 +86,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { hasNoParent() name "/$jspWebappContext/$forwardFromFileName" kind SERVER - errored false attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" "${SemanticAttributes.NET_PEER_PORT.key}" Long @@ -100,7 +100,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(1) { childOf span(0) name "Compile /$forwardFromFileName" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.$jspForwardFromClassPrefix$jspForwardFromClassName" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -109,7 +108,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(2) { childOf span(0) name "Render /$forwardFromFileName" - errored false attributes { "jsp.requestURL" reqUrl } @@ -117,12 +115,10 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(3) { childOf span(2) name "ApplicationDispatcher.forward" - errored false } span(4) { childOf span(3) name "Compile /$forwardDestFileName" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.$jspForwardDestClassPrefix$jspForwardDestClassName" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -131,7 +127,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(5) { childOf span(3) name "Render /$forwardDestFileName" - errored false attributes { "jsp.forwardOrigin" "/$forwardFromFileName" "jsp.requestURL" baseUrl + "/$forwardDestFileName" @@ -165,7 +160,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { hasNoParent() name "/$jspWebappContext/forwards/forwardToHtml.jsp" kind SERVER - errored false attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" "${SemanticAttributes.NET_PEER_PORT.key}" Long @@ -180,7 +174,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(1) { childOf span(0) name "Compile /forwards/forwardToHtml.jsp" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.forwards.forwardToHtml_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -189,7 +182,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(2) { childOf span(0) name "Render /forwards/forwardToHtml.jsp" - errored false attributes { "jsp.requestURL" reqUrl } @@ -197,7 +189,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(3) { childOf span(2) name "ApplicationDispatcher.forward" - errored false } } } @@ -222,7 +213,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { hasNoParent() name "/$jspWebappContext/forwards/forwardToIncludeMulti.jsp" kind SERVER - errored false attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" "${SemanticAttributes.NET_PEER_PORT.key}" Long @@ -237,7 +227,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(1) { childOf span(0) name "Compile /forwards/forwardToIncludeMulti.jsp" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.forwards.forwardToIncludeMulti_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -246,7 +235,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(2) { childOf span(0) name "Render /forwards/forwardToIncludeMulti.jsp" - errored false attributes { "jsp.requestURL" reqUrl } @@ -254,12 +242,10 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(3) { childOf span(2) name "ApplicationDispatcher.forward" - errored false } span(4) { childOf span(3) name "Compile /includes/includeMulti.jsp" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.includes.includeMulti_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -268,7 +254,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(5) { childOf span(3) name "Render /includes/includeMulti.jsp" - errored false attributes { "jsp.forwardOrigin" "/forwards/forwardToIncludeMulti.jsp" "jsp.requestURL" baseUrl + "/includes/includeMulti.jsp" @@ -277,12 +262,10 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(6) { childOf span(5) name "ApplicationDispatcher.include" - errored false } span(7) { childOf span(6) name "Compile /common/javaLoopH2.jsp" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.common.javaLoopH2_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -291,7 +274,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(8) { childOf span(6) name "Render /common/javaLoopH2.jsp" - errored false attributes { "jsp.forwardOrigin" "/forwards/forwardToIncludeMulti.jsp" "jsp.requestURL" baseUrl + "/includes/includeMulti.jsp" @@ -300,12 +282,10 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(9) { childOf span(5) name "ApplicationDispatcher.include" - errored false } span(10) { childOf span(9) name "Compile /common/javaLoopH2.jsp" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.common.javaLoopH2_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -314,7 +294,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(11) { childOf span(9) name "Render /common/javaLoopH2.jsp" - errored false attributes { "jsp.forwardOrigin" "/forwards/forwardToIncludeMulti.jsp" "jsp.requestURL" baseUrl + "/includes/includeMulti.jsp" @@ -343,7 +322,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { hasNoParent() name "/$jspWebappContext/forwards/forwardToJspForward.jsp" kind SERVER - errored false attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" "${SemanticAttributes.NET_PEER_PORT.key}" Long @@ -358,7 +336,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(1) { childOf span(0) name "Compile /forwards/forwardToJspForward.jsp" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.forwards.forwardToJspForward_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -367,7 +344,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(2) { childOf span(0) name "Render /forwards/forwardToJspForward.jsp" - errored false attributes { "jsp.requestURL" reqUrl } @@ -375,12 +351,10 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(3) { childOf span(2) name "ApplicationDispatcher.forward" - errored false } span(4) { childOf span(3) name "Compile /forwards/forwardToSimpleJava.jsp" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.forwards.forwardToSimpleJava_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -389,7 +363,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(5) { childOf span(3) name "Render /forwards/forwardToSimpleJava.jsp" - errored false attributes { "jsp.forwardOrigin" "/forwards/forwardToJspForward.jsp" "jsp.requestURL" baseUrl + "/forwards/forwardToSimpleJava.jsp" @@ -398,12 +371,10 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(6) { childOf span(5) name "ApplicationDispatcher.forward" - errored false } span(7) { childOf span(6) name "Compile /common/loop.jsp" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.common.loop_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -412,7 +383,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(8) { childOf span(6) name "Render /common/loop.jsp" - errored false attributes { "jsp.forwardOrigin" "/forwards/forwardToJspForward.jsp" "jsp.requestURL" baseUrl + "/common/loop.jsp" @@ -441,7 +411,7 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { hasNoParent() name "/$jspWebappContext/forwards/forwardToCompileError.jsp" kind SERVER - errored true + status ERROR errorEvent(JasperException, String) attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -457,7 +427,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(1) { childOf span(0) name "Compile /forwards/forwardToCompileError.jsp" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.forwards.forwardToCompileError_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -466,7 +435,7 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(2) { childOf span(0) name "Render /forwards/forwardToCompileError.jsp" - errored true + status ERROR errorEvent(JasperException, String) attributes { "jsp.requestURL" reqUrl @@ -475,13 +444,13 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(3) { childOf span(2) name "ApplicationDispatcher.forward" - errored true + status ERROR errorEvent(JasperException, String) } span(4) { childOf span(3) name "Compile /compileError.jsp" - errored true + status ERROR errorEvent(JasperException, String) attributes { "jsp.classFQCN" "org.apache.jsp.compileError_jsp" @@ -511,7 +480,7 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { hasNoParent() name "/$jspWebappContext/forwards/forwardToNonExistent.jsp" kind SERVER - errored true + status ERROR attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" "${SemanticAttributes.NET_PEER_PORT.key}" Long @@ -526,7 +495,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(1) { childOf span(0) name "Compile /forwards/forwardToNonExistent.jsp" - errored false attributes { "jsp.classFQCN" "org.apache.jsp.forwards.forwardToNonExistent_jsp" "jsp.compiler" "org.apache.jasper.compiler.JDTCompiler" @@ -535,7 +503,6 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification { span(2) { childOf span(0) name "Render /forwards/forwardToNonExistent.jsp" - errored false attributes { "jsp.requestURL" reqUrl } diff --git a/instrumentation/kafka-clients-0.11/javaagent/src/test/groovy/KafkaClientPropagationDisabledTest.groovy b/instrumentation/kafka-clients-0.11/javaagent/src/test/groovy/KafkaClientPropagationDisabledTest.groovy index 5100013ce9..b48a4b1db3 100644 --- a/instrumentation/kafka-clients-0.11/javaagent/src/test/groovy/KafkaClientPropagationDisabledTest.groovy +++ b/instrumentation/kafka-clients-0.11/javaagent/src/test/groovy/KafkaClientPropagationDisabledTest.groovy @@ -37,7 +37,6 @@ class KafkaClientPropagationDisabledTest extends KafkaClientBaseTest { span(0) { name SHARED_TOPIC + " send" kind PRODUCER - errored false hasNoParent() attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka" @@ -62,7 +61,6 @@ class KafkaClientPropagationDisabledTest extends KafkaClientBaseTest { span(0) { name SHARED_TOPIC + " send" kind PRODUCER - errored false hasNoParent() attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka" @@ -75,7 +73,6 @@ class KafkaClientPropagationDisabledTest extends KafkaClientBaseTest { span(0) { name SHARED_TOPIC + " process" kind CONSUMER - errored false hasNoParent() attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka" diff --git a/instrumentation/kafka-clients-0.11/javaagent/src/test/groovy/KafkaClientPropagationEnabledTest.groovy b/instrumentation/kafka-clients-0.11/javaagent/src/test/groovy/KafkaClientPropagationEnabledTest.groovy index f08bc81824..0a5be69abc 100644 --- a/instrumentation/kafka-clients-0.11/javaagent/src/test/groovy/KafkaClientPropagationEnabledTest.groovy +++ b/instrumentation/kafka-clients-0.11/javaagent/src/test/groovy/KafkaClientPropagationEnabledTest.groovy @@ -88,7 +88,6 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest { span(1) { name SHARED_TOPIC + " send" kind PRODUCER - errored false childOf span(0) attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka" @@ -99,7 +98,6 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest { span(2) { name SHARED_TOPIC + " process" kind CONSUMER - errored false childOf span(1) attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka" @@ -178,7 +176,6 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest { span(1) { name SHARED_TOPIC + " send" kind PRODUCER - errored false childOf span(0) attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka" @@ -189,7 +186,6 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest { span(2) { name SHARED_TOPIC + " process" kind CONSUMER - errored false childOf span(1) attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka" @@ -261,7 +257,6 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest { span(0) { name SHARED_TOPIC + " send" kind PRODUCER - errored false hasNoParent() attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka" @@ -274,7 +269,6 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest { span(1) { name SHARED_TOPIC + " process" kind CONSUMER - errored false childOf span(0) attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka" @@ -336,7 +330,6 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest { span(0) { name SHARED_TOPIC + " send" kind PRODUCER - errored false hasNoParent() attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka" @@ -348,7 +341,6 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest { span(1) { name SHARED_TOPIC + " process" kind CONSUMER - errored false childOf span(0) attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka" diff --git a/instrumentation/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsTest.groovy b/instrumentation/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsTest.groovy index 457747abfb..ce2cd59931 100644 --- a/instrumentation/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsTest.groovy +++ b/instrumentation/kafka-streams-0.11/javaagent/src/test/groovy/KafkaStreamsTest.groovy @@ -130,7 +130,6 @@ class KafkaStreamsTest extends AgentInstrumentationSpecification { span(0) { name STREAM_PENDING + " send" kind PRODUCER - errored false hasNoParent() attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka" @@ -142,7 +141,6 @@ class KafkaStreamsTest extends AgentInstrumentationSpecification { span(1) { name STREAM_PENDING + " process" kind CONSUMER - errored false childOf span(0) attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka" @@ -159,7 +157,6 @@ class KafkaStreamsTest extends AgentInstrumentationSpecification { span(2) { name STREAM_PENDING + " process" kind CONSUMER - errored false childOf span(0) attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka" @@ -175,7 +172,6 @@ class KafkaStreamsTest extends AgentInstrumentationSpecification { span(3) { name STREAM_PROCESSED + " send" kind PRODUCER - errored false childOf span(2) attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka" @@ -187,7 +183,6 @@ class KafkaStreamsTest extends AgentInstrumentationSpecification { span(4) { name STREAM_PROCESSED + " process" kind CONSUMER - errored false childOf span(3) attributes { "${SemanticAttributes.MESSAGING_SYSTEM.key}" "kafka" diff --git a/instrumentation/kubernetes-client-7.0/javaagent/src/test/groovy/KubernetesClientTest.groovy b/instrumentation/kubernetes-client-7.0/javaagent/src/test/groovy/KubernetesClientTest.groovy index dee4400aa0..e30fc1cb38 100644 --- a/instrumentation/kubernetes-client-7.0/javaagent/src/test/groovy/KubernetesClientTest.groovy +++ b/instrumentation/kubernetes-client-7.0/javaagent/src/test/groovy/KubernetesClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.server.http.TestHttpServer.distributedRequestSpan import static io.opentelemetry.instrumentation.test.server.http.TestHttpServer.httpServer import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan @@ -172,8 +173,8 @@ class KubernetesClientTest extends AgentInstrumentationSpecification { name spanName kind CLIENT childOf trace.span(0) - errored hasFailed if (hasFailed) { + status ERROR errorEvent exception.class, exception.message } attributes { diff --git a/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy b/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy index bafa0e1c75..a5ba8b732c 100644 --- a/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy +++ b/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import com.lambdaworks.redis.ClientOptions import com.lambdaworks.redis.RedisClient @@ -116,7 +117,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "CONNECT" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_PEER_NAME.key}" HOST "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -149,7 +149,7 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "CONNECT" kind CLIENT - errored true + status ERROR errorEvent RedisConnectionException, String attributes { "${SemanticAttributes.NET_PEER_NAME.key}" HOST @@ -175,7 +175,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "SET" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "SET" @@ -208,7 +207,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "GET" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "GET" @@ -255,7 +253,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "GET" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "GET" @@ -288,7 +285,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "RANDOMKEY" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "RANDOMKEY" @@ -340,7 +336,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "HMSET" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "HMSET" @@ -351,7 +346,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "HGETALL" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "HGETALL" @@ -392,7 +386,7 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "DEL" kind CLIENT - errored true + status ERROR errorEvent(IllegalStateException, "TestException") attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" @@ -428,7 +422,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "SADD" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "SADD" @@ -449,7 +442,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "DEBUG" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "DEBUG" @@ -470,7 +462,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "SHUTDOWN" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "SHUTDOWN" diff --git a/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceSyncClientTest.groovy b/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceSyncClientTest.groovy index 837f5e2f99..bb16a72cd3 100644 --- a/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceSyncClientTest.groovy +++ b/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceSyncClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import com.lambdaworks.redis.ClientOptions import com.lambdaworks.redis.RedisClient @@ -98,7 +99,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "CONNECT" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_PEER_NAME.key}" HOST "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -129,7 +129,7 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "CONNECT" kind CLIENT - errored true + status ERROR errorEvent RedisConnectionException, String attributes { "${SemanticAttributes.NET_PEER_NAME.key}" HOST @@ -154,7 +154,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "SET" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "SET" @@ -175,7 +174,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "GET" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "GET" @@ -196,7 +194,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "GET" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "GET" @@ -217,7 +214,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "RANDOMKEY" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "RANDOMKEY" @@ -238,7 +234,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "LPUSH" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "LPUSH" @@ -259,7 +254,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "HMSET" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "HMSET" @@ -280,7 +274,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "HGETALL" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "HGETALL" @@ -300,7 +293,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "DEBUG" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "DEBUG" @@ -320,7 +312,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "SHUTDOWN" kind CLIENT - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "redis" "${SemanticAttributes.DB_STATEMENT.key}" "SHUTDOWN" diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy b/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy index 2a298d2139..4dd71a912d 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import io.lettuce.core.ClientOptions import io.lettuce.core.ConnectionFuture @@ -120,7 +121,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "CONNECT" kind CLIENT - errored false attributes { "$SemanticAttributes.NET_PEER_NAME.key" PEER_NAME "$SemanticAttributes.NET_PEER_IP.key" PEER_IP @@ -154,7 +154,7 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "CONNECT" kind CLIENT - errored true + status ERROR errorEvent AbstractChannel.AnnotatedConnectException, String attributes { "$SemanticAttributes.NET_PEER_NAME.key" PEER_NAME @@ -180,7 +180,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "SET" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "SET TESTSETKEY ?" @@ -213,7 +212,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "GET" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "GET TESTKEY" @@ -260,7 +258,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "GET" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "GET NON_EXISTENT_KEY" @@ -293,7 +290,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "RANDOMKEY" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "RANDOMKEY" @@ -344,7 +340,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "HMSET" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "HMSET TESTHM firstname ? lastname ? age ?" @@ -355,7 +350,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "HGETALL" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "HGETALL TESTHM" @@ -396,7 +390,7 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "DEL" kind CLIENT - errored true + status ERROR errorEvent(IllegalStateException, "TestException") attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" @@ -432,7 +426,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "SADD" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "SADD SKEY ? ?" @@ -453,7 +446,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "DEBUG" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "DEBUG SEGFAULT" @@ -474,7 +466,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification { span(0) { name "SHUTDOWN" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "SHUTDOWN NOSAVE" diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceReactiveClientTest.groovy b/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceReactiveClientTest.groovy index 68ff24010d..ccbda21762 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceReactiveClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceReactiveClientTest.groovy @@ -96,7 +96,6 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification { span(0) { name "SET" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "SET TESTSETKEY ?" @@ -120,7 +119,6 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification { span(0) { name "GET" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "GET TESTKEY" @@ -152,7 +150,6 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification { span(0) { name "GET" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "GET NON_EXISTENT_KEY" @@ -182,7 +179,6 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification { span(0) { name "RANDOMKEY" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "RANDOMKEY" @@ -202,7 +198,6 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification { span(0) { name "COMMAND" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "COMMAND" @@ -223,7 +218,6 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification { span(0) { name "COMMAND" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "COMMAND" @@ -254,7 +248,6 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification { span(0) { name "DEBUG" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "DEBUG SEGFAULT" @@ -274,7 +267,6 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification { span(0) { name "SHUTDOWN" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "SHUTDOWN NOSAVE" @@ -297,14 +289,12 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification { trace(0, 3) { span(0) { name "test-parent" - errored false attributes { } } span(1) { name "SET" kind CLIENT - errored false childOf span(0) attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" @@ -314,7 +304,6 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification { span(2) { name "GET" kind CLIENT - errored false childOf span(0) attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" @@ -338,14 +327,12 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification { trace(0, 3) { span(0) { name "test-parent" - errored false attributes { } } span(1) { name "SET" kind CLIENT - errored false childOf span(0) attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" @@ -355,7 +342,6 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification { span(2) { name "GET" kind CLIENT - errored false childOf span(0) attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" @@ -380,14 +366,12 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification { trace(0, 3) { span(0) { name "test-parent" - errored false attributes { } } span(1) { name "SET" kind CLIENT - errored false childOf span(0) attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" @@ -397,7 +381,6 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification { span(2) { name "GET" kind CLIENT - errored false childOf span(0) attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceSyncClientTest.groovy b/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceSyncClientTest.groovy index 8217d5bd89..361271ca88 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceSyncClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceSyncClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import io.lettuce.core.ClientOptions import io.lettuce.core.RedisClient @@ -100,7 +101,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "CONNECT" kind CLIENT - errored false attributes { "$SemanticAttributes.NET_PEER_NAME.key" PEER_NAME "$SemanticAttributes.NET_PEER_IP.key" PEER_IP @@ -131,7 +131,7 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "CONNECT" kind CLIENT - errored true + status ERROR errorEvent AbstractChannel.AnnotatedConnectException, String attributes { "$SemanticAttributes.NET_PEER_NAME.key" PEER_NAME @@ -156,7 +156,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "SET" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "SET TESTSETKEY ?" @@ -177,7 +176,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "GET" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "GET TESTKEY" @@ -198,7 +196,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "GET" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "GET NON_EXISTENT_KEY" @@ -219,7 +216,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "RANDOMKEY" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "RANDOMKEY" @@ -240,7 +236,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "LPUSH" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "LPUSH TESTLIST ?" @@ -261,7 +256,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "HMSET" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "HMSET user firstname ? lastname ? age ?" @@ -282,7 +276,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "HGETALL" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "HGETALL TESTHM" @@ -302,7 +295,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "DEBUG" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "DEBUG SEGFAULT" @@ -322,7 +314,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification { span(0) { name "SHUTDOWN" kind CLIENT - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "redis" "$SemanticAttributes.DB_STATEMENT.key" "SHUTDOWN NOSAVE" diff --git a/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceReactiveClientTest.groovy b/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceReactiveClientTest.groovy index 8d337e672c..ef01bd1dc7 100644 --- a/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceReactiveClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.1/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/lettuce/v5_1/LettuceReactiveClientTest.groovy @@ -36,14 +36,12 @@ class LettuceReactiveClientTest extends AbstractLettuceReactiveClientTest implem trace(0, 3) { span(0) { name "test-parent" - errored false attributes { } } span(1) { name "SET" kind SpanKind.CLIENT - errored false childOf span(0) attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" @@ -63,7 +61,6 @@ class LettuceReactiveClientTest extends AbstractLettuceReactiveClientTest implem span(2) { name "GET" kind SpanKind.CLIENT - errored false childOf span(0) attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" diff --git a/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceAsyncClientTest.groovy b/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceAsyncClientTest.groovy index 55b8028fdf..bd0924a8f0 100644 --- a/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceAsyncClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceAsyncClientTest.groovy @@ -148,7 +148,6 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati span(0) { name "SET" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -191,7 +190,6 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati span(0) { name "GET" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -248,7 +246,6 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati span(0) { name "GET" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -291,7 +288,6 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati span(0) { name "RANDOMKEY" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -352,7 +348,6 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati span(0) { name "HMSET" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -373,7 +368,6 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati span(0) { name "HGETALL" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" diff --git a/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceReactiveClientTest.groovy b/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceReactiveClientTest.groovy index ba39f7e5fa..9534c77592 100644 --- a/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceReactiveClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceReactiveClientTest.groovy @@ -97,7 +97,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific span(0) { name "SET" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -131,7 +130,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific span(0) { name "GET" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -173,7 +171,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific span(0) { name "GET" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -213,7 +210,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific span(0) { name "RANDOMKEY" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -243,7 +239,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific span(0) { name "COMMAND" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -285,14 +280,12 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific trace(0, 3) { span(0) { name "test-parent" - errored false attributes { } } span(1) { name "SET" kind CLIENT - errored false childOf span(0) attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" @@ -312,7 +305,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific span(2) { name "GET" kind CLIENT - errored false childOf span(0) attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" @@ -346,14 +338,12 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific trace(0, 3) { span(0) { name "test-parent" - errored false attributes { } } span(1) { name "SET" kind CLIENT - errored false childOf span(0) attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" @@ -373,7 +363,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific span(2) { name "GET" kind CLIENT - errored false childOf span(0) attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" diff --git a/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceSyncClientAuthTest.groovy b/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceSyncClientAuthTest.groovy index 9be9cd6d3f..7868c29e9b 100644 --- a/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceSyncClientAuthTest.groovy +++ b/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceSyncClientAuthTest.groovy @@ -71,7 +71,6 @@ abstract class AbstractLettuceSyncClientAuthTest extends InstrumentationSpecific span(0) { name "AUTH" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" diff --git a/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceSyncClientTest.groovy b/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceSyncClientTest.groovy index 6fd90eb521..b98cdd79dd 100644 --- a/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceSyncClientTest.groovy +++ b/instrumentation/lettuce/lettuce-5.1/testing/src/main/groovy/io/opentelemetry/instrumentation/lettuce/v5_1/AbstractLettuceSyncClientTest.groovy @@ -6,6 +6,7 @@ package io.opentelemetry.instrumentation.lettuce.v5_1 import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static java.nio.charset.StandardCharsets.UTF_8 import io.lettuce.core.RedisClient @@ -133,7 +134,6 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio span(0) { name "SET" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -167,7 +167,6 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio span(0) { name "SET" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -199,7 +198,6 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio span(0) { name "GET" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -230,7 +228,6 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio span(0) { name "GET" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -261,7 +258,6 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio span(0) { name "RANDOMKEY" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -292,7 +288,6 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio span(0) { name "LPUSH" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -323,7 +318,6 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio span(0) { name "HMSET" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -354,7 +348,6 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio span(0) { name "HGETALL" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -390,7 +383,6 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio span(0) { name "EVAL" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -425,7 +417,6 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio span(0) { name "MSET" kind CLIENT - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -456,7 +447,6 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio name "DEBUG" kind CLIENT // Disconnect not an actual error even though an exception is recorded. - errored false attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -492,7 +482,7 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio kind CLIENT if (Boolean.getBoolean("testLatestDeps")) { // Seems to only be treated as an error with Lettuce 6+ - errored true + status ERROR } attributes { "${SemanticAttributes.NET_TRANSPORT.key}" "IP.TCP" diff --git a/instrumentation/netty/netty-3.8/javaagent/src/latestDepTest/groovy/Netty38ClientTest.groovy b/instrumentation/netty/netty-3.8/javaagent/src/latestDepTest/groovy/Netty38ClientTest.groovy index 79060934ec..951ddc3f36 100644 --- a/instrumentation/netty/netty-3.8/javaagent/src/latestDepTest/groovy/Netty38ClientTest.groovy +++ b/instrumentation/netty/netty-3.8/javaagent/src/latestDepTest/groovy/Netty38ClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.PortUtils.UNUSABLE_PORT import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace @@ -108,7 +109,7 @@ class Netty38ClientTest extends HttpClientTest implements AgentTestTrai name "CONNECT" kind CLIENT childOf span(0) - errored true + status ERROR Class errorClass = ConnectException try { errorClass = Class.forName('io.netty.channel.AbstractChannel$AnnotatedConnectException') diff --git a/instrumentation/netty/netty-3.8/javaagent/src/test/groovy/Netty38ClientTest.groovy b/instrumentation/netty/netty-3.8/javaagent/src/test/groovy/Netty38ClientTest.groovy index d23b8307e4..4dbcf1f299 100644 --- a/instrumentation/netty/netty-3.8/javaagent/src/test/groovy/Netty38ClientTest.groovy +++ b/instrumentation/netty/netty-3.8/javaagent/src/test/groovy/Netty38ClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.PortUtils.UNUSABLE_PORT import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace @@ -105,7 +106,7 @@ class Netty38ClientTest extends HttpClientTest implements AgentTestTrai name "CONNECT" kind CLIENT childOf span(0) - errored true + status ERROR Class errorClass = ConnectException try { errorClass = Class.forName('io.netty.channel.AbstractChannel$AnnotatedConnectException') diff --git a/instrumentation/netty/netty-4.0/javaagent/src/test/groovy/Netty40ClientTest.groovy b/instrumentation/netty/netty-4.0/javaagent/src/test/groovy/Netty40ClientTest.groovy index 971601e6d4..ef65e2fb90 100644 --- a/instrumentation/netty/netty-4.0/javaagent/src/test/groovy/Netty40ClientTest.groovy +++ b/instrumentation/netty/netty-4.0/javaagent/src/test/groovy/Netty40ClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.PortUtils.UNUSABLE_PORT import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace @@ -118,7 +119,7 @@ class Netty40ClientTest extends HttpClientTest implement name "CONNECT" kind CLIENT childOf span(0) - errored true + status ERROR Class errorClass = ConnectException try { errorClass = Class.forName('io.netty.channel.AbstractChannel$AnnotatedConnectException') diff --git a/instrumentation/netty/netty-4.1/javaagent/src/test/groovy/Netty41ClientTest.groovy b/instrumentation/netty/netty-4.1/javaagent/src/test/groovy/Netty41ClientTest.groovy index 9ed4e81f78..28ca075547 100644 --- a/instrumentation/netty/netty-4.1/javaagent/src/test/groovy/Netty41ClientTest.groovy +++ b/instrumentation/netty/netty-4.1/javaagent/src/test/groovy/Netty41ClientTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.PortUtils.UNUSABLE_PORT import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace @@ -185,7 +186,7 @@ class Netty41ClientTest extends HttpClientTest implement name "CONNECT" kind CLIENT childOf span(0) - errored true + status ERROR errorEvent(thrownException.class, ~/Connection refused:( no further information:)? localhost\/\[?[0-9.:]+\]?:$UNUSABLE_PORT/) } } @@ -273,19 +274,18 @@ class Netty41ClientTest extends HttpClientTest implement def annotatedClass = new TracedClass() when: - def status = runUnderTrace("parent") { + def responseCode = runUnderTrace("parent") { annotatedClass.tracedMethod(method) } then: - status == 200 + responseCode == 200 assertTraces(1) { trace(0, 4) { basicSpan(it, 0, "parent") span(1) { childOf span(0) name "tracedMethod" - errored false attributes { } } diff --git a/instrumentation/opentelemetry-annotations-1.0/javaagent/src/test/groovy/WithSpanInstrumentationTest.groovy b/instrumentation/opentelemetry-annotations-1.0/javaagent/src/test/groovy/WithSpanInstrumentationTest.groovy index 7de2eb6b50..44d74838bb 100644 --- a/instrumentation/opentelemetry-annotations-1.0/javaagent/src/test/groovy/WithSpanInstrumentationTest.groovy +++ b/instrumentation/opentelemetry-annotations-1.0/javaagent/src/test/groovy/WithSpanInstrumentationTest.groovy @@ -3,18 +3,18 @@ * SPDX-License-Identifier: Apache-2.0 */ -import io.opentelemetry.extension.annotations.WithSpan -import io.opentelemetry.instrumentation.test.utils.TraceUtils -import java.lang.reflect.Modifier -import java.util.concurrent.CompletableFuture - import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.SpanKind.INTERNAL import static io.opentelemetry.api.trace.SpanKind.PRODUCER import static io.opentelemetry.api.trace.SpanKind.SERVER +import static io.opentelemetry.api.trace.StatusCode.ERROR -import io.opentelemetry.api.trace.SpanKind +import io.opentelemetry.extension.annotations.WithSpan import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification +import io.opentelemetry.instrumentation.test.utils.TraceUtils import io.opentelemetry.test.annotation.TracedWithSpan +import java.lang.reflect.Modifier +import java.util.concurrent.CompletableFuture import net.bytebuddy.ByteBuddy import net.bytebuddy.ClassFileVersion import net.bytebuddy.asm.MemberAttributeExtension @@ -38,9 +38,8 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { trace(0, 1) { span(0) { name "TracedWithSpan.otel" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -58,7 +57,6 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { span(0) { name "manualName" hasNoParent() - errored false attributes { } } @@ -77,7 +75,6 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { name "TracedWithSpan.oneOfAKind" kind PRODUCER hasNoParent() - errored false attributes { } } @@ -96,14 +93,12 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { name "TracedWithSpan.server" kind SERVER hasNoParent() - errored false attributes { } } span(1) { name "TracedWithSpan.otel" childOf span(0) - errored false attributes { } } @@ -122,7 +117,6 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { name "TracedWithSpan.nestedServers" kind SERVER hasNoParent() - errored false attributes { } } @@ -141,7 +135,6 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { name "TracedWithSpan.nestedClients" kind CLIENT hasNoParent() - errored false attributes { } } @@ -168,9 +161,8 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { trace(0, 1) { span(0) { name "TracedWithSpan.completionStage" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -193,9 +185,8 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { trace(0, 1) { span(0) { name "TracedWithSpan.completionStage" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -214,9 +205,9 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { trace(0, 1) { span(0) { name "TracedWithSpan.completionStage" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -240,9 +231,9 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { trace(0, 1) { span(0) { name "TracedWithSpan.completionStage" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -260,9 +251,8 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { trace(0, 1) { span(0) { name "TracedWithSpan.completionStage" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -280,9 +270,8 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { trace(0, 1) { span(0) { name "TracedWithSpan.completableFuture" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -305,9 +294,8 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { trace(0, 1) { span(0) { name "TracedWithSpan.completableFuture" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -326,9 +314,9 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { trace(0, 1) { span(0) { name "TracedWithSpan.completableFuture" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -352,9 +340,9 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { trace(0, 1) { span(0) { name "TracedWithSpan.completableFuture" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -372,9 +360,8 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { trace(0, 1) { span(0) { name "TracedWithSpan.completableFuture" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -397,11 +384,11 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { .name("GeneratedJava6TestClass") .implement(Runnable) .defineMethod("run", void.class, Modifier.PUBLIC).intercept(MethodDelegation.to(new Object() { - @RuntimeType - void intercept(@This Object o) { - TraceUtils.runUnderTrace("intercept", {}) - } - })) + @RuntimeType + void intercept(@This Object o) { + TraceUtils.runUnderTrace("intercept", {}) + } + })) .visit(new MemberAttributeExtension.ForMethod() .annotateMethod(AnnotationDescription.Builder.ofType(WithSpan).build()) .on(ElementMatchers.named("run"))) @@ -417,17 +404,15 @@ class WithSpanInstrumentationTest extends AgentInstrumentationSpecification { trace(0, 2) { span(0) { name "GeneratedJava6TestClass.run" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } span(1) { name "intercept" - kind SpanKind.INTERNAL + kind INTERNAL childOf(span(0)) - errored false attributes { } } diff --git a/instrumentation/play/play-2.4/javaagent/src/test/groovy/server/PlayServerTest.groovy b/instrumentation/play/play-2.4/javaagent/src/test/groovy/server/PlayServerTest.groovy index 62a405335e..13df0c72c8 100644 --- a/instrumentation/play/play-2.4/javaagent/src/test/groovy/server/PlayServerTest.groovy +++ b/instrumentation/play/play-2.4/javaagent/src/test/groovy/server/PlayServerTest.groovy @@ -12,6 +12,7 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.REDIRECT import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS +import io.opentelemetry.api.trace.StatusCode import io.opentelemetry.instrumentation.test.AgentTestTrait import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.instrumentation.test.base.HttpServerTest @@ -70,8 +71,8 @@ class PlayServerTest extends HttpServerTest implements AgentTestTrait { trace.span(index) { name "play.request" kind INTERNAL - errored endpoint == EXCEPTION if (endpoint == EXCEPTION) { + status StatusCode.ERROR errorEvent(Exception, EXCEPTION.body) } childOf((SpanData) parent) @@ -82,5 +83,4 @@ class PlayServerTest extends HttpServerTest implements AgentTestTrait { String expectedServerSpanName(ServerEndpoint endpoint) { return "HTTP GET" } - } diff --git a/instrumentation/play/play-2.6/javaagent/src/test/groovy/server/PlayServerTest.groovy b/instrumentation/play/play-2.6/javaagent/src/test/groovy/server/PlayServerTest.groovy index 03034cabf1..aa48e1cf27 100644 --- a/instrumentation/play/play-2.6/javaagent/src/test/groovy/server/PlayServerTest.groovy +++ b/instrumentation/play/play-2.6/javaagent/src/test/groovy/server/PlayServerTest.groovy @@ -12,6 +12,7 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.REDIRECT import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS +import io.opentelemetry.api.trace.StatusCode import io.opentelemetry.instrumentation.test.AgentTestTrait import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.instrumentation.test.base.HttpServerTest @@ -72,9 +73,9 @@ class PlayServerTest extends HttpServerTest implements AgentTestTrait { trace.span(index) { name "play.request" kind INTERNAL - errored endpoint == EXCEPTION childOf((SpanData) parent) if (endpoint == EXCEPTION) { + status StatusCode.ERROR errorEvent(Exception, EXCEPTION.body) } } diff --git a/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMQTest.groovy b/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMQTest.groovy index 26864fd952..3e1232bd64 100644 --- a/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMQTest.groovy +++ b/instrumentation/rabbitmq-2.7/javaagent/src/test/groovy/RabbitMQTest.groovy @@ -6,6 +6,7 @@ import static io.opentelemetry.api.trace.SpanKind.CLIENT import static io.opentelemetry.api.trace.SpanKind.CONSUMER import static io.opentelemetry.api.trace.SpanKind.PRODUCER +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import com.rabbitmq.client.AMQP @@ -350,8 +351,8 @@ class RabbitMQTest extends AgentInstrumentationSpecification { hasLink((SpanData) linkSpan) } - errored exception != null if (exception) { + status ERROR errorEvent(exception.class, errorMsg) } diff --git a/instrumentation/ratpack-1.4/javaagent/src/test/groovy/RatpackOtherTest.groovy b/instrumentation/ratpack-1.4/javaagent/src/test/groovy/RatpackOtherTest.groovy index bc6eb46b74..14ea84821b 100644 --- a/instrumentation/ratpack-1.4/javaagent/src/test/groovy/RatpackOtherTest.groovy +++ b/instrumentation/ratpack-1.4/javaagent/src/test/groovy/RatpackOtherTest.groovy @@ -73,7 +73,6 @@ class RatpackOtherTest extends AgentInstrumentationSpecification { name "/$route" kind SERVER hasNoParent() - errored false attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" "${SemanticAttributes.NET_PEER_PORT.key}" Long @@ -89,7 +88,6 @@ class RatpackOtherTest extends AgentInstrumentationSpecification { name "/$route" kind INTERNAL childOf span(0) - errored false attributes { } } diff --git a/instrumentation/ratpack-1.4/javaagent/src/test/groovy/server/RatpackHttpServerTest.groovy b/instrumentation/ratpack-1.4/javaagent/src/test/groovy/server/RatpackHttpServerTest.groovy index 2e0ffd2d2b..445e93671d 100644 --- a/instrumentation/ratpack-1.4/javaagent/src/test/groovy/server/RatpackHttpServerTest.groovy +++ b/instrumentation/ratpack-1.4/javaagent/src/test/groovy/server/RatpackHttpServerTest.groovy @@ -13,6 +13,7 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.REDIRECT import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS +import io.opentelemetry.api.trace.StatusCode import io.opentelemetry.instrumentation.test.AgentTestTrait import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.instrumentation.test.base.HttpServerTest @@ -112,9 +113,9 @@ class RatpackHttpServerTest extends HttpServerTest implements Agent trace.span(index) { name endpoint.status == 404 ? "/" : endpoint == PATH_PARAM ? "/path/:id/param" : endpoint.path kind INTERNAL - errored endpoint == EXCEPTION childOf((SpanData) parent) if (endpoint == EXCEPTION) { + status StatusCode.ERROR errorEvent(Exception, EXCEPTION.body) } } diff --git a/instrumentation/reactor-3.1/testing/src/main/groovy/io/opentelemetry/instrumentation/reactor/AbstractReactorCoreTest.groovy b/instrumentation/reactor-3.1/testing/src/main/groovy/io/opentelemetry/instrumentation/reactor/AbstractReactorCoreTest.groovy index ab5b5621ea..7a9dde4ae3 100644 --- a/instrumentation/reactor-3.1/testing/src/main/groovy/io/opentelemetry/instrumentation/reactor/AbstractReactorCoreTest.groovy +++ b/instrumentation/reactor-3.1/testing/src/main/groovy/io/opentelemetry/instrumentation/reactor/AbstractReactorCoreTest.groovy @@ -5,6 +5,7 @@ package io.opentelemetry.instrumentation.reactor +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runInternalSpan @@ -97,7 +98,7 @@ abstract class AbstractReactorCoreTest extends InstrumentationSpecification { trace(0, 2) { span(0) { name "trace-parent" - errored true + status ERROR errorEvent(RuntimeException, EXCEPTION_MESSAGE) hasNoParent() } @@ -128,7 +129,7 @@ abstract class AbstractReactorCoreTest extends InstrumentationSpecification { trace(0, workSpans + 2) { span(0) { name "trace-parent" - errored true + status ERROR errorEvent(RuntimeException, EXCEPTION_MESSAGE) hasNoParent() } diff --git a/instrumentation/rmi/javaagent/src/test/groovy/RmiTest.groovy b/instrumentation/rmi/javaagent/src/test/groovy/RmiTest.groovy index d29becdf82..8b1ba6d18b 100644 --- a/instrumentation/rmi/javaagent/src/test/groovy/RmiTest.groovy +++ b/instrumentation/rmi/javaagent/src/test/groovy/RmiTest.groovy @@ -5,6 +5,7 @@ import static io.opentelemetry.api.trace.SpanKind.CLIENT import static io.opentelemetry.api.trace.SpanKind.SERVER +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace @@ -107,7 +108,7 @@ class RmiTest extends AgentInstrumentationSpecification { name "rmi.app.Greeter/exceptional" kind CLIENT childOf span(0) - errored true + status ERROR errorEvent(RuntimeException, String) attributes { "${SemanticAttributes.RPC_SYSTEM.key}" "java_rmi" @@ -119,7 +120,7 @@ class RmiTest extends AgentInstrumentationSpecification { span(2) { name "rmi.app.Server/exceptional" kind SERVER - errored true + status ERROR errorEvent(RuntimeException, String) attributes { "${SemanticAttributes.RPC_SYSTEM.key}" "java_rmi" diff --git a/instrumentation/rxjava/rxjava-2.0/javaagent/src/test/groovy/RxJava2WithSpanInstrumentationTest.groovy b/instrumentation/rxjava/rxjava-2.0/javaagent/src/test/groovy/RxJava2WithSpanInstrumentationTest.groovy index a1e14f4491..8e33aa2013 100644 --- a/instrumentation/rxjava/rxjava-2.0/javaagent/src/test/groovy/RxJava2WithSpanInstrumentationTest.groovy +++ b/instrumentation/rxjava/rxjava-2.0/javaagent/src/test/groovy/RxJava2WithSpanInstrumentationTest.groovy @@ -3,7 +3,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import io.opentelemetry.api.trace.SpanKind +import static io.opentelemetry.api.trace.SpanKind.INTERNAL +import static io.opentelemetry.api.trace.StatusCode.ERROR + import io.opentelemetry.instrumentation.rxjava2.TracedWithSpan import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.reactivex.Completable @@ -38,9 +40,8 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.completable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -68,9 +69,8 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.completable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -93,9 +93,9 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.completable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -125,9 +125,9 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.completable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -151,9 +151,8 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.maybe" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -164,7 +163,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for already empty Maybe"() { setup: def observer = new TestObserver() - def source = Maybe.empty() + def source = Maybe. empty() new TracedWithSpan() .maybe(source) .subscribe(observer) @@ -175,9 +174,8 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.maybe" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -187,7 +185,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually completed Maybe"() { setup: - def source = MaybeSubject.create() + def source = MaybeSubject. create() def observer = new TestObserver() new TracedWithSpan() .maybe(source) @@ -206,9 +204,8 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.maybe" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -220,7 +217,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati setup: def error = new IllegalArgumentException("Boom") def observer = new TestObserver() - def source = Maybe.error(error) + def source = Maybe. error(error) new TracedWithSpan() .maybe(source) .subscribe(observer) @@ -231,9 +228,9 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.maybe" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -245,7 +242,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually errored Maybe"() { setup: def error = new IllegalArgumentException("Boom") - def source = MaybeSubject.create() + def source = MaybeSubject. create() def observer = new TestObserver() new TracedWithSpan() .maybe(source) @@ -263,9 +260,9 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.maybe" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -289,9 +286,8 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.single" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -301,7 +297,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually completed Single"() { setup: - def source = SingleSubject.create() + def source = SingleSubject. create() def observer = new TestObserver() new TracedWithSpan() .single(source) @@ -320,9 +316,8 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.single" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -334,7 +329,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati setup: def error = new IllegalArgumentException("Boom") def observer = new TestObserver() - def source = Single.error(error) + def source = Single. error(error) new TracedWithSpan() .single(source) .subscribe(observer) @@ -345,9 +340,9 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.single" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -359,7 +354,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually errored Single"() { setup: def error = new IllegalArgumentException("Boom") - def source = SingleSubject.create() + def source = SingleSubject. create() def observer = new TestObserver() new TracedWithSpan() .single(source) @@ -377,9 +372,9 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.single" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -391,7 +386,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for already completed Observable"() { setup: def observer = new TestObserver() - def source = Observable.just("Value") + def source = Observable. just("Value") new TracedWithSpan() .observable(source) .subscribe(observer) @@ -403,9 +398,8 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.observable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -415,7 +409,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually completed Observable"() { setup: - def source = UnicastSubject.create() + def source = UnicastSubject. create() def observer = new TestObserver() new TracedWithSpan() .observable(source) @@ -439,9 +433,8 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.observable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -453,7 +446,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati setup: def error = new IllegalArgumentException("Boom") def observer = new TestObserver() - def source = Observable.error(error) + def source = Observable. error(error) new TracedWithSpan() .observable(source) .subscribe(observer) @@ -464,9 +457,9 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.observable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -478,7 +471,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually errored Observable"() { setup: def error = new IllegalArgumentException("Boom") - def source = UnicastSubject.create() + def source = UnicastSubject. create() def observer = new TestObserver() new TracedWithSpan() .observable(source) @@ -502,9 +495,9 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.observable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -516,7 +509,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for already completed Flowable"() { setup: def observer = new TestSubscriber() - def source = Flowable.just("Value") + def source = Flowable. just("Value") new TracedWithSpan() .flowable(source) .subscribe(observer) @@ -528,9 +521,8 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.flowable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -540,7 +532,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually completed Flowable"() { setup: - def source = UnicastProcessor.create() + def source = UnicastProcessor. create() def observer = new TestSubscriber() new TracedWithSpan() .flowable(source) @@ -564,9 +556,8 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.flowable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -578,7 +569,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati setup: def error = new IllegalArgumentException("Boom") def observer = new TestSubscriber() - def source = Flowable.error(error) + def source = Flowable. error(error) new TracedWithSpan() .flowable(source) .subscribe(observer) @@ -589,9 +580,9 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.flowable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -603,7 +594,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually errored Flowable"() { setup: def error = new IllegalArgumentException("Boom") - def source = UnicastProcessor.create() + def source = UnicastProcessor. create() def observer = new TestSubscriber() new TracedWithSpan() .flowable(source) @@ -627,9 +618,9 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.flowable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -641,7 +632,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for already completed ParallelFlowable"() { setup: def observer = new TestSubscriber() - def source = Flowable.just("Value") + def source = Flowable. just("Value") new TracedWithSpan() .parallelFlowable(source.parallel()) .sequential() @@ -654,9 +645,8 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.parallelFlowable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -666,7 +656,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually completed ParallelFlowable"() { setup: - def source = UnicastProcessor.create() + def source = UnicastProcessor. create() def observer = new TestSubscriber() new TracedWithSpan() .parallelFlowable(source.parallel()) @@ -691,9 +681,8 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.parallelFlowable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -705,7 +694,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati setup: def error = new IllegalArgumentException("Boom") def observer = new TestSubscriber() - def source = Flowable.error(error) + def source = Flowable. error(error) new TracedWithSpan() .parallelFlowable(source.parallel()) .sequential() @@ -717,9 +706,9 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.parallelFlowable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -731,7 +720,7 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually errored ParallelFlowable"() { setup: def error = new IllegalArgumentException("Boom") - def source = UnicastProcessor.create() + def source = UnicastProcessor. create() def observer = new TestSubscriber() new TracedWithSpan() .parallelFlowable(source.parallel()) @@ -756,9 +745,9 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.parallelFlowable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -787,9 +776,8 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.publisher" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -818,9 +806,9 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.publisher" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -847,9 +835,9 @@ class RxJava2WithSpanInstrumentationTest extends AgentInstrumentationSpecificati } @Override - void request(long l) { } + void request(long l) {} @Override - void cancel() { } + void cancel() {} } } diff --git a/instrumentation/rxjava/rxjava-3.0/javaagent/src/test/groovy/RxJava3WithSpanInstrumentationTest.groovy b/instrumentation/rxjava/rxjava-3.0/javaagent/src/test/groovy/RxJava3WithSpanInstrumentationTest.groovy index 3a620d0d93..c94bf8c8af 100644 --- a/instrumentation/rxjava/rxjava-3.0/javaagent/src/test/groovy/RxJava3WithSpanInstrumentationTest.groovy +++ b/instrumentation/rxjava/rxjava-3.0/javaagent/src/test/groovy/RxJava3WithSpanInstrumentationTest.groovy @@ -3,7 +3,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import io.opentelemetry.api.trace.SpanKind +import static io.opentelemetry.api.trace.SpanKind.INTERNAL +import static io.opentelemetry.api.trace.StatusCode.ERROR + import io.opentelemetry.instrumentation.rxjava3.TracedWithSpan import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.reactivex.rxjava3.core.Completable @@ -38,9 +40,8 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.completable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -67,9 +68,8 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.completable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -92,9 +92,9 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.completable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -123,9 +123,9 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.completable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -149,9 +149,8 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.maybe" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -162,7 +161,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for already empty Maybe"() { setup: def observer = new TestObserver() - def source = Maybe.empty() + def source = Maybe. empty() new TracedWithSpan() .maybe(source) .subscribe(observer) @@ -173,9 +172,8 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.maybe" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -185,7 +183,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually completed Maybe"() { setup: - def source = MaybeSubject.create() + def source = MaybeSubject. create() def observer = new TestObserver() new TracedWithSpan() .maybe(source) @@ -203,9 +201,8 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.maybe" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -217,7 +214,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati setup: def error = new IllegalArgumentException("Boom") def observer = new TestObserver() - def source = Maybe.error(error) + def source = Maybe. error(error) new TracedWithSpan() .maybe(source) .subscribe(observer) @@ -228,9 +225,9 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.maybe" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -242,7 +239,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually errored Maybe"() { setup: def error = new IllegalArgumentException("Boom") - def source = MaybeSubject.create() + def source = MaybeSubject. create() def observer = new TestObserver() new TracedWithSpan() .maybe(source) @@ -259,9 +256,9 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.maybe" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -285,9 +282,8 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.single" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -297,7 +293,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually completed Single"() { setup: - def source = SingleSubject.create() + def source = SingleSubject. create() def observer = new TestObserver() new TracedWithSpan() .single(source) @@ -315,9 +311,8 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.single" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -329,7 +324,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati setup: def error = new IllegalArgumentException("Boom") def observer = new TestObserver() - def source = Single.error(error) + def source = Single. error(error) new TracedWithSpan() .single(source) .subscribe(observer) @@ -340,9 +335,9 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.single" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -354,7 +349,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually errored Single"() { setup: def error = new IllegalArgumentException("Boom") - def source = SingleSubject.create() + def source = SingleSubject. create() def observer = new TestObserver() new TracedWithSpan() .single(source) @@ -371,9 +366,9 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.single" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -385,7 +380,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for already completed Observable"() { setup: def observer = new TestObserver() - def source = Observable.just("Value") + def source = Observable. just("Value") new TracedWithSpan() .observable(source) .subscribe(observer) @@ -397,9 +392,8 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.observable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -409,7 +403,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually completed Observable"() { setup: - def source = UnicastSubject.create() + def source = UnicastSubject. create() def observer = new TestObserver() new TracedWithSpan() .observable(source) @@ -432,9 +426,8 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.observable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -446,7 +439,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati setup: def error = new IllegalArgumentException("Boom") def observer = new TestObserver() - def source = Observable.error(error) + def source = Observable. error(error) new TracedWithSpan() .observable(source) .subscribe(observer) @@ -457,9 +450,9 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.observable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -471,7 +464,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually errored Observable"() { setup: def error = new IllegalArgumentException("Boom") - def source = UnicastSubject.create() + def source = UnicastSubject. create() def observer = new TestObserver() new TracedWithSpan() .observable(source) @@ -494,9 +487,9 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.observable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -508,7 +501,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for already completed Flowable"() { setup: def observer = new TestSubscriber() - def source = Flowable.just("Value") + def source = Flowable. just("Value") new TracedWithSpan() .flowable(source) .subscribe(observer) @@ -520,9 +513,8 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.flowable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -532,7 +524,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually completed Flowable"() { setup: - def source = UnicastProcessor.create() + def source = UnicastProcessor. create() def observer = new TestSubscriber() new TracedWithSpan() .flowable(source) @@ -555,9 +547,8 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.flowable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -569,7 +560,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati setup: def error = new IllegalArgumentException("Boom") def observer = new TestSubscriber() - def source = Flowable.error(error) + def source = Flowable. error(error) new TracedWithSpan() .flowable(source) .subscribe(observer) @@ -580,9 +571,9 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.flowable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -594,7 +585,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually errored Flowable"() { setup: def error = new IllegalArgumentException("Boom") - def source = UnicastProcessor.create() + def source = UnicastProcessor. create() def observer = new TestSubscriber() new TracedWithSpan() .flowable(source) @@ -617,9 +608,9 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.flowable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -631,7 +622,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for already completed ParallelFlowable"() { setup: def observer = new TestSubscriber() - def source = Flowable.just("Value") + def source = Flowable. just("Value") new TracedWithSpan() .parallelFlowable(source.parallel()) .sequential() @@ -644,9 +635,8 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.parallelFlowable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -656,7 +646,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually completed ParallelFlowable"() { setup: - def source = UnicastProcessor.create() + def source = UnicastProcessor. create() def observer = new TestSubscriber() new TracedWithSpan() .parallelFlowable(source.parallel()) @@ -680,9 +670,8 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.parallelFlowable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -694,7 +683,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati setup: def error = new IllegalArgumentException("Boom") def observer = new TestSubscriber() - def source = Flowable.error(error) + def source = Flowable. error(error) new TracedWithSpan() .parallelFlowable(source.parallel()) .sequential() @@ -706,9 +695,9 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.parallelFlowable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -720,7 +709,7 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati def "should capture span for eventually errored ParallelFlowable"() { setup: def error = new IllegalArgumentException("Boom") - def source = UnicastProcessor.create() + def source = UnicastProcessor. create() def observer = new TestSubscriber() new TracedWithSpan() .parallelFlowable(source.parallel()) @@ -744,9 +733,9 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.parallelFlowable" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -774,9 +763,8 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.publisher" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored false attributes { } } @@ -804,9 +792,9 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati trace(0, 1) { span(0) { name "TracedWithSpan.publisher" - kind SpanKind.INTERNAL + kind INTERNAL hasNoParent() - errored true + status ERROR errorEvent(IllegalArgumentException, "Boom") attributes { } @@ -833,9 +821,9 @@ class RxJava3WithSpanInstrumentationTest extends AgentInstrumentationSpecificati } @Override - void request(long l) { } + void request(long l) {} @Override - void cancel() { } + void cancel() {} } } diff --git a/instrumentation/scala-executors/javaagent/src/slickTest/groovy/SlickTest.groovy b/instrumentation/scala-executors/javaagent/src/slickTest/groovy/SlickTest.groovy index 379a254b6b..66759546d2 100644 --- a/instrumentation/scala-executors/javaagent/src/slickTest/groovy/SlickTest.groovy +++ b/instrumentation/scala-executors/javaagent/src/slickTest/groovy/SlickTest.groovy @@ -26,7 +26,6 @@ class SlickTest extends AgentInstrumentationSpecification { span(0) { name "run query" hasNoParent() - errored false attributes { } } @@ -34,7 +33,6 @@ class SlickTest extends AgentInstrumentationSpecification { name "SELECT ${SlickUtils.Db()}" kind CLIENT childOf span(0) - errored false attributes { "$SemanticAttributes.DB_SYSTEM.key" "h2" "$SemanticAttributes.DB_NAME.key" SlickUtils.Db() diff --git a/instrumentation/servlet/servlet-2.2/javaagent/src/test/groovy/JettyServlet2Test.groovy b/instrumentation/servlet/servlet-2.2/javaagent/src/test/groovy/JettyServlet2Test.groovy index 7a881364d2..54eb145abc 100644 --- a/instrumentation/servlet/servlet-2.2/javaagent/src/test/groovy/JettyServlet2Test.groovy +++ b/instrumentation/servlet/servlet-2.2/javaagent/src/test/groovy/JettyServlet2Test.groovy @@ -81,7 +81,6 @@ class JettyServlet2Test extends HttpServerTest implements AgentTestTrait trace.span(index) { name endpoint == REDIRECT ? "Response.sendRedirect" : "Response.sendError" kind INTERNAL - errored false childOf((SpanData) parent) attributes { } diff --git a/instrumentation/servlet/servlet-3.0/javaagent/src/test/groovy/AbstractServletMappingTest.groovy b/instrumentation/servlet/servlet-3.0/javaagent/src/test/groovy/AbstractServletMappingTest.groovy index f3ac54e357..c3300caebf 100644 --- a/instrumentation/servlet/servlet-3.0/javaagent/src/test/groovy/AbstractServletMappingTest.groovy +++ b/instrumentation/servlet/servlet-3.0/javaagent/src/test/groovy/AbstractServletMappingTest.groovy @@ -3,6 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +import static io.opentelemetry.api.trace.StatusCode.ERROR + import io.opentelemetry.api.trace.SpanKind import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.test.base.HttpServerTestTrait @@ -56,7 +58,9 @@ abstract class AbstractServletMappingTest extends AgentInstrume span(0) { name getContextPath() + spanName kind SpanKind.SERVER - errored !success + if (!success) { + status ERROR + } } if (!success) { span(1) { @@ -66,13 +70,13 @@ abstract class AbstractServletMappingTest extends AgentInstrume } where: - path | spanName | success - 'prefix' | '/prefix/*' | true - 'prefix/' | '/prefix/*' | true - 'prefix/a' | '/prefix/*' | true - 'prefixa' | '/*' | false - 'a.suffix' | '/*.suffix' | true - '.suffix' | '/*.suffix' | true - 'suffix' | '/*' | false + path | spanName | success + 'prefix' | '/prefix/*' | true + 'prefix/' | '/prefix/*' | true + 'prefix/a' | '/prefix/*' | true + 'prefixa' | '/*' | false + 'a.suffix' | '/*.suffix' | true + '.suffix' | '/*.suffix' | true + 'suffix' | '/*' | false } } diff --git a/instrumentation/servlet/servlet-javax-common/javaagent/src/test/groovy/HttpServletResponseTest.groovy b/instrumentation/servlet/servlet-javax-common/javaagent/src/test/groovy/HttpServletResponseTest.groovy index 84ea8a565a..8a9a52a4e9 100644 --- a/instrumentation/servlet/servlet-javax-common/javaagent/src/test/groovy/HttpServletResponseTest.groovy +++ b/instrumentation/servlet/servlet-javax-common/javaagent/src/test/groovy/HttpServletResponseTest.groovy @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static java.util.Collections.emptyEnumeration @@ -108,7 +109,7 @@ class HttpServletResponseTest extends AgentInstrumentationSpecification { span(1) { name 'HttpServletResponseTest$2.sendRedirect' childOf span(0) - errored true + status ERROR errorEvent(ex.class, ex.message) } } diff --git a/instrumentation/servlet/servlet-javax-common/javaagent/src/test/groovy/RequestDispatcherTest.groovy b/instrumentation/servlet/servlet-javax-common/javaagent/src/test/groovy/RequestDispatcherTest.groovy index 09c295fd22..9331bc477c 100644 --- a/instrumentation/servlet/servlet-javax-common/javaagent/src/test/groovy/RequestDispatcherTest.groovy +++ b/instrumentation/servlet/servlet-javax-common/javaagent/src/test/groovy/RequestDispatcherTest.groovy @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace @@ -121,7 +122,7 @@ class RequestDispatcherTest extends AgentInstrumentationSpecification { span(1) { name "TestDispatcher.$operation" childOf span(0) - errored true + status ERROR errorEvent(ex.class, ex.message) } basicSpan(it, 2, "$operation-child", span(1)) diff --git a/instrumentation/spark-2.3/javaagent/src/test/groovy/SparkJavaBasedTest.groovy b/instrumentation/spark-2.3/javaagent/src/test/groovy/SparkJavaBasedTest.groovy index 45d1a0ca72..d1b0585878 100644 --- a/instrumentation/spark-2.3/javaagent/src/test/groovy/SparkJavaBasedTest.groovy +++ b/instrumentation/spark-2.3/javaagent/src/test/groovy/SparkJavaBasedTest.groovy @@ -48,7 +48,6 @@ class SparkJavaBasedTest extends AgentInstrumentationSpecification { span(0) { name "/param/:param" kind SERVER - errored false hasNoParent() attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" diff --git a/instrumentation/spring/spring-batch-3.0/javaagent/src/test/groovy/SpringBatchTest.groovy b/instrumentation/spring/spring-batch-3.0/javaagent/src/test/groovy/SpringBatchTest.groovy index f0668ffcd9..602933800c 100644 --- a/instrumentation/spring/spring-batch-3.0/javaagent/src/test/groovy/SpringBatchTest.groovy +++ b/instrumentation/spring/spring-batch-3.0/javaagent/src/test/groovy/SpringBatchTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.INTERNAL +import static io.opentelemetry.api.trace.StatusCode.ERROR import static java.util.Collections.emptyMap import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification @@ -61,7 +62,7 @@ abstract class SpringBatchTest extends AgentInstrumentationSpecification { name "BatchJob taskletJob.step.Chunk" kind INTERNAL childOf span(1) - errored true + status ERROR errorEvent RuntimeException, "fail" } } diff --git a/instrumentation/spring/spring-data-1.8/javaagent/src/test/groovy/SpringJpaTest.groovy b/instrumentation/spring/spring-data-1.8/javaagent/src/test/groovy/SpringJpaTest.groovy index 60a0ea643d..b3d150245b 100644 --- a/instrumentation/spring/spring-data-1.8/javaagent/src/test/groovy/SpringJpaTest.groovy +++ b/instrumentation/spring/spring-data-1.8/javaagent/src/test/groovy/SpringJpaTest.groovy @@ -61,7 +61,6 @@ class SpringJpaTest extends AgentInstrumentationSpecification { span(0) { name "JpaRepository.findAll" kind INTERNAL - errored false attributes { } } @@ -94,7 +93,6 @@ class SpringJpaTest extends AgentInstrumentationSpecification { span(0) { name "CrudRepository.save" kind INTERNAL - errored false attributes { } } @@ -127,7 +125,6 @@ class SpringJpaTest extends AgentInstrumentationSpecification { span(0) { name "CrudRepository.save" kind INTERNAL - errored false attributes { } } @@ -172,7 +169,6 @@ class SpringJpaTest extends AgentInstrumentationSpecification { span(0) { name "JpaCustomerRepository.findByLastName" kind INTERNAL - errored false attributes { } } @@ -203,7 +199,6 @@ class SpringJpaTest extends AgentInstrumentationSpecification { span(0) { name "CrudRepository.delete" kind INTERNAL - errored false attributes { } } diff --git a/instrumentation/spring/spring-scheduling-3.1/javaagent/src/test/groovy/SpringSchedulingTest.groovy b/instrumentation/spring/spring-scheduling-3.1/javaagent/src/test/groovy/SpringSchedulingTest.groovy index dce537b11e..1692a8327a 100644 --- a/instrumentation/spring/spring-scheduling-3.1/javaagent/src/test/groovy/SpringSchedulingTest.groovy +++ b/instrumentation/spring/spring-scheduling-3.1/javaagent/src/test/groovy/SpringSchedulingTest.groovy @@ -23,7 +23,6 @@ class SpringSchedulingTest extends AgentInstrumentationSpecification { span(0) { name "TriggerTask.run" hasNoParent() - errored false attributes { } } @@ -45,7 +44,6 @@ class SpringSchedulingTest extends AgentInstrumentationSpecification { span(0) { name "IntervalTask.run" hasNoParent() - errored false attributes { } } @@ -67,7 +65,6 @@ class SpringSchedulingTest extends AgentInstrumentationSpecification { span(0) { nameContains "LambdaTaskConfigurer\$\$Lambda\$" hasNoParent() - errored false attributes { } } diff --git a/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/SpringWebfluxTest.groovy b/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/SpringWebfluxTest.groovy index e43b0f382f..3b6ec0ef83 100644 --- a/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/SpringWebfluxTest.groovy +++ b/instrumentation/spring/spring-webflux-5.0/javaagent/src/test/groovy/SpringWebfluxTest.groovy @@ -5,6 +5,7 @@ import static io.opentelemetry.api.trace.SpanKind.INTERNAL import static io.opentelemetry.api.trace.SpanKind.SERVER +import static io.opentelemetry.api.trace.StatusCode.ERROR import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.test.utils.OkHttpUtils @@ -161,7 +162,6 @@ class SpringWebfluxTest extends AgentInstrumentationSpecification { span(2) { name "tracedMethod" childOf span(0) - errored false attributes { } } @@ -249,7 +249,6 @@ class SpringWebfluxTest extends AgentInstrumentationSpecification { span(2) { name "tracedMethod" childOf span(annotatedMethod ? 0 : 1) - errored false attributes { } } @@ -278,7 +277,7 @@ class SpringWebfluxTest extends AgentInstrumentationSpecification { name "/**" kind SERVER hasNoParent() - errored true + status ERROR attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" "${SemanticAttributes.NET_PEER_PORT.key}" Long @@ -294,7 +293,7 @@ class SpringWebfluxTest extends AgentInstrumentationSpecification { name "ResourceWebHandler.handle" kind INTERNAL childOf span(0) - errored true + status ERROR errorEvent(ResponseStatusException, String) attributes { "spring-webflux.handler.type" "org.springframework.web.reactive.resource.ResourceWebHandler" @@ -370,7 +369,7 @@ class SpringWebfluxTest extends AgentInstrumentationSpecification { span(0) { name urlPathWithVariables kind SERVER - errored true + status ERROR hasNoParent() attributes { "${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1" @@ -393,7 +392,7 @@ class SpringWebfluxTest extends AgentInstrumentationSpecification { } kind INTERNAL childOf span(0) - errored true + status ERROR errorEvent(RuntimeException, "bad things happen") attributes { if (annotatedMethod == null) { diff --git a/instrumentation/spring/spring-webmvc-3.1/javaagent/src/test/groovy/test/boot/SpringBootBasedTest.groovy b/instrumentation/spring/spring-webmvc-3.1/javaagent/src/test/groovy/test/boot/SpringBootBasedTest.groovy index ad9f8433ec..03cb986646 100644 --- a/instrumentation/spring/spring-webmvc-3.1/javaagent/src/test/groovy/test/boot/SpringBootBasedTest.groovy +++ b/instrumentation/spring/spring-webmvc-3.1/javaagent/src/test/groovy/test/boot/SpringBootBasedTest.groovy @@ -14,6 +14,7 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.REDIRECT import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS +import io.opentelemetry.api.trace.StatusCode import io.opentelemetry.instrumentation.test.AgentTestTrait import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.instrumentation.test.base.HttpServerTest @@ -155,7 +156,6 @@ class SpringBootBasedTest extends HttpServerTest trace.span(index) { name "BasicErrorController.error" kind INTERNAL - errored false attributes { } } @@ -167,7 +167,6 @@ class SpringBootBasedTest extends HttpServerTest trace.span(index) { name responseSpanName kind INTERNAL - errored false attributes { } } @@ -178,7 +177,6 @@ class SpringBootBasedTest extends HttpServerTest trace.span(index) { name "Render RedirectView" kind INTERNAL - errored false attributes { "spring-webmvc.view.type" RedirectView.simpleName } @@ -194,8 +192,8 @@ class SpringBootBasedTest extends HttpServerTest trace.span(index) { name handlerSpanName kind INTERNAL - errored endpoint == EXCEPTION if (endpoint == EXCEPTION) { + status StatusCode.ERROR errorEvent(Exception, EXCEPTION.body) } childOf((SpanData) parent) diff --git a/instrumentation/spring/spring-webmvc-3.1/javaagent/src/test/groovy/test/filter/ServletFilterTest.groovy b/instrumentation/spring/spring-webmvc-3.1/javaagent/src/test/groovy/test/filter/ServletFilterTest.groovy index 60a3bc6107..100be1a076 100644 --- a/instrumentation/spring/spring-webmvc-3.1/javaagent/src/test/groovy/test/filter/ServletFilterTest.groovy +++ b/instrumentation/spring/spring-webmvc-3.1/javaagent/src/test/groovy/test/filter/ServletFilterTest.groovy @@ -12,6 +12,7 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.REDIRECT import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS +import io.opentelemetry.api.trace.StatusCode import io.opentelemetry.instrumentation.test.AgentTestTrait import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.instrumentation.test.base.HttpServerTest @@ -84,9 +85,9 @@ class ServletFilterTest extends HttpServerTest i trace.span(index) { name "TestController.${endpoint.name().toLowerCase()}" kind INTERNAL - errored endpoint == EXCEPTION childOf((SpanData) parent) if (endpoint == EXCEPTION) { + status StatusCode.ERROR errorEvent(Exception, EXCEPTION.body) } } @@ -107,7 +108,6 @@ class ServletFilterTest extends HttpServerTest i trace.span(index) { name "ApplicationDispatcher.forward" kind INTERNAL - errored false childOf((SpanData) parent) attributes { } @@ -115,7 +115,6 @@ class ServletFilterTest extends HttpServerTest i trace.span(index + 1) { name "BasicErrorController.error" kind INTERNAL - errored false childOf(trace.span(index)) attributes { } diff --git a/instrumentation/spring/spring-ws-2.0/javaagent/src/test/groovy/test/boot/SpringWsTest.groovy b/instrumentation/spring/spring-ws-2.0/javaagent/src/test/groovy/test/boot/SpringWsTest.groovy index 4811ee2c11..d8ed378090 100644 --- a/instrumentation/spring/spring-ws-2.0/javaagent/src/test/groovy/test/boot/SpringWsTest.groovy +++ b/instrumentation/spring/spring-ws-2.0/javaagent/src/test/groovy/test/boot/SpringWsTest.groovy @@ -5,6 +5,9 @@ package test.boot +import static io.opentelemetry.api.trace.SpanKind.INTERNAL +import static io.opentelemetry.api.trace.StatusCode.ERROR + import io.opentelemetry.api.trace.SpanKind import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification import io.opentelemetry.instrumentation.test.asserts.TraceAssert @@ -123,7 +126,9 @@ class SpringWsTest extends AgentInstrumentationSpecification implements HttpServ hasNoParent() name operation kind SpanKind.SERVER - errored exception != null + if (exception != null) { + status ERROR + } } } @@ -135,9 +140,9 @@ class SpringWsTest extends AgentInstrumentationSpecification implements HttpServ childOf((SpanData) parentSpan) } name "HelloEndpoint." + methodName - kind SpanKind.INTERNAL - errored exception != null + kind INTERNAL if (exception) { + status ERROR errorEvent(exception.class, exception.message) } attributes { diff --git a/instrumentation/spymemcached-2.12/javaagent/src/test/groovy/SpymemcachedTest.groovy b/instrumentation/spymemcached-2.12/javaagent/src/test/groovy/SpymemcachedTest.groovy index 445402a0f0..2cb2691354 100644 --- a/instrumentation/spymemcached-2.12/javaagent/src/test/groovy/SpymemcachedTest.groovy +++ b/instrumentation/spymemcached-2.12/javaagent/src/test/groovy/SpymemcachedTest.groovy @@ -4,6 +4,7 @@ */ import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static net.spy.memcached.ConnectionFactoryBuilder.Protocol.BINARY @@ -592,7 +593,6 @@ class SpymemcachedTest extends AgentInstrumentationSpecification { return trace.span(index) { name parentOperation hasNoParent() - errored false attributes { } } @@ -606,7 +606,9 @@ class SpymemcachedTest extends AgentInstrumentationSpecification { name operation kind CLIENT - errored(error != null && error != "canceled") + if (error != null && error != "canceled") { + status ERROR + } if (error == "timeout") { errorEvent( diff --git a/instrumentation/struts-2.3/javaagent/src/test/groovy/Struts2ActionSpanTest.groovy b/instrumentation/struts-2.3/javaagent/src/test/groovy/Struts2ActionSpanTest.groovy index 1ac2cb9596..62c24819af 100644 --- a/instrumentation/struts-2.3/javaagent/src/test/groovy/Struts2ActionSpanTest.groovy +++ b/instrumentation/struts-2.3/javaagent/src/test/groovy/Struts2ActionSpanTest.groovy @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import static io.opentelemetry.api.trace.SpanKind.INTERNAL import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.ERROR import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.EXCEPTION import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.PATH_PARAM @@ -10,7 +11,7 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicServerSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan -import io.opentelemetry.api.trace.SpanKind +import io.opentelemetry.api.trace.StatusCode import io.opentelemetry.instrumentation.test.AgentTestTrait import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.instrumentation.test.base.HttpServerTest @@ -73,9 +74,9 @@ class Struts2ActionSpanTest extends HttpServerTest implements AgentTestT void handlerSpan(TraceAssert trace, int index, Object parent, String method, ServerEndpoint endpoint) { trace.span(index) { name "GreetingAction.${endpoint.name().toLowerCase()}" - kind SpanKind.INTERNAL - errored endpoint == EXCEPTION + kind INTERNAL if (endpoint == EXCEPTION) { + status StatusCode.ERROR errorEvent(Exception, EXCEPTION.body) } def expectedMethodName = endpoint.name().toLowerCase() diff --git a/instrumentation/tapestry-5.4/javaagent/src/test/groovy/TapestryTest.groovy b/instrumentation/tapestry-5.4/javaagent/src/test/groovy/TapestryTest.groovy index bad01e327f..9a27a0658e 100644 --- a/instrumentation/tapestry-5.4/javaagent/src/test/groovy/TapestryTest.groovy +++ b/instrumentation/tapestry-5.4/javaagent/src/test/groovy/TapestryTest.groovy @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan import io.opentelemetry.api.trace.SpanKind @@ -123,7 +124,7 @@ class TapestryTest extends AgentInstrumentationSpecification implements HttpServ hasNoParent() kind SpanKind.SERVER name getContextPath() + "/Index" - errored true + status ERROR } basicSpan(it, 1, "activate/Index", span(0)) basicSpan(it, 2, "action/Index:exception", span(0), new IllegalStateException("expected")) diff --git a/instrumentation/twilio-6.6/javaagent/src/test/groovy/test/TwilioClientTest.groovy b/instrumentation/twilio-6.6/javaagent/src/test/groovy/test/TwilioClientTest.groovy index e579ca6ee3..ddadcab191 100644 --- a/instrumentation/twilio-6.6/javaagent/src/test/groovy/test/TwilioClientTest.groovy +++ b/instrumentation/twilio-6.6/javaagent/src/test/groovy/test/TwilioClientTest.groovy @@ -6,6 +6,7 @@ package test import static io.opentelemetry.api.trace.SpanKind.CLIENT +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import com.fasterxml.jackson.databind.ObjectMapper @@ -135,7 +136,6 @@ class TwilioClientTest extends AgentInstrumentationSpecification { trace(0, 2) { span(0) { name "test" - errored false hasNoParent() attributes { } @@ -143,7 +143,6 @@ class TwilioClientTest extends AgentInstrumentationSpecification { span(1) { name "MessageCreator.create" kind CLIENT - errored false attributes { "twilio.type" "com.twilio.rest.api.v2010.account.Message" "twilio.account" "AC14984e09e497506cf0d5eb59b1f6ace7" @@ -179,7 +178,6 @@ class TwilioClientTest extends AgentInstrumentationSpecification { trace(0, 2) { span(0) { name "test" - errored false hasNoParent() attributes { } @@ -187,7 +185,6 @@ class TwilioClientTest extends AgentInstrumentationSpecification { span(1) { name "CallCreator.create" kind CLIENT - errored false attributes { "twilio.type" "com.twilio.rest.api.v2010.account.Call" "twilio.account" "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" @@ -245,7 +242,6 @@ class TwilioClientTest extends AgentInstrumentationSpecification { trace(0, 2) { span(0) { name "test" - errored false hasNoParent() attributes { } @@ -254,7 +250,6 @@ class TwilioClientTest extends AgentInstrumentationSpecification { name "MessageCreator.create" kind CLIENT childOf(span(0)) - errored false attributes { "twilio.type" "com.twilio.rest.api.v2010.account.Message" "twilio.account" "AC14984e09e497506cf0d5eb59b1f6ace7" @@ -327,7 +322,6 @@ class TwilioClientTest extends AgentInstrumentationSpecification { trace(0, 2) { span(0) { name "test" - errored false hasNoParent() attributes { } @@ -336,7 +330,6 @@ class TwilioClientTest extends AgentInstrumentationSpecification { name "MessageCreator.create" kind CLIENT childOf(span(0)) - errored false attributes { "twilio.type" "com.twilio.rest.api.v2010.account.Message" "twilio.account" "AC14984e09e497506cf0d5eb59b1f6ace7" @@ -416,7 +409,6 @@ class TwilioClientTest extends AgentInstrumentationSpecification { trace(0, 2) { span(0) { name "test" - errored false hasNoParent() attributes { } @@ -425,7 +417,6 @@ class TwilioClientTest extends AgentInstrumentationSpecification { name "MessageCreator.createAsync" kind CLIENT childOf(span(0)) - errored false attributes { "twilio.type" "com.twilio.rest.api.v2010.account.Message" "twilio.account" "AC14984e09e497506cf0d5eb59b1f6ace7" @@ -466,14 +457,14 @@ class TwilioClientTest extends AgentInstrumentationSpecification { trace(0, 2) { span(0) { name "test" - errored true + status ERROR errorEvent(ApiException, "Testing Failure") hasNoParent() } span(1) { name "MessageCreator.create" kind CLIENT - errored true + status ERROR errorEvent(ApiException, "Testing Failure") } } @@ -502,7 +493,6 @@ class TwilioClientTest extends AgentInstrumentationSpecification { name "MessageCreator.create" kind CLIENT hasNoParent() - errored false attributes { "twilio.type" "com.twilio.rest.api.v2010.account.Message" "twilio.account" "AC14984e09e497506cf0d5eb59b1f6ace7" @@ -547,7 +537,6 @@ class TwilioClientTest extends AgentInstrumentationSpecification { trace(0, 2) { span(0) { name "test" - errored false hasNoParent() attributes { } @@ -555,7 +544,6 @@ class TwilioClientTest extends AgentInstrumentationSpecification { span(1) { name "MessageCreator.createAsync" kind CLIENT - errored false attributes { "twilio.type" "com.twilio.rest.api.v2010.account.Message" "twilio.account" "AC14984e09e497506cf0d5eb59b1f6ace7" @@ -607,14 +595,14 @@ class TwilioClientTest extends AgentInstrumentationSpecification { trace(0, 2) { span(0) { name "test" - errored true + status ERROR errorEvent(ApiException, "Testing Failure") hasNoParent() } span(1) { name "MessageCreator.createAsync" kind CLIENT - errored true + status ERROR errorEvent(ApiException, "Testing Failure") } } diff --git a/instrumentation/vertx-reactive-3.5/javaagent/src/test/groovy/VertxReactivePropagationTest.groovy b/instrumentation/vertx-reactive-3.5/javaagent/src/test/groovy/VertxReactivePropagationTest.groovy index f05df1612b..1831b24c71 100644 --- a/instrumentation/vertx-reactive-3.5/javaagent/src/test/groovy/VertxReactivePropagationTest.groovy +++ b/instrumentation/vertx-reactive-3.5/javaagent/src/test/groovy/VertxReactivePropagationTest.groovy @@ -53,7 +53,6 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification { span(0) { name "/listProducts" kind SERVER - errored false hasNoParent() attributes { "${SemanticAttributes.NET_PEER_PORT.key}" Long @@ -72,7 +71,6 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification { name "SELECT test.products" kind CLIENT childOf span(2) - errored false attributes { "${SemanticAttributes.DB_SYSTEM.key}" "hsqldb" "${SemanticAttributes.DB_NAME.key}" "test" diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/asserts/SpanAssert.groovy b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/asserts/SpanAssert.groovy index fa7531c76f..c63e1852f3 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/asserts/SpanAssert.groovy +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/asserts/SpanAssert.groovy @@ -125,16 +125,6 @@ class SpanAssert { checked.status = true } - def errored(boolean errored) { - if (errored) { - // comparing only canonical code, since description may be different - assert span.status.statusCode == StatusCode.ERROR - } else { - assert span.status.statusCode == StatusCode.UNSET - } - checked.status = true - } - def errorEvent(Class errorType) { errorEvent(errorType, null) } @@ -158,7 +148,7 @@ class SpanAssert { void assertDefaults() { if (!checked.status) { - errored(false) + status(StatusCode.UNSET) } if (!checked.kind) { kind(SpanKind.INTERNAL) diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpClientTest.groovy b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpClientTest.groovy index b1092d2e5c..a608523a3f 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpClientTest.groovy +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpClientTest.groovy @@ -7,6 +7,7 @@ package io.opentelemetry.instrumentation.test.base import static io.opentelemetry.api.trace.SpanKind.CLIENT import static io.opentelemetry.api.trace.SpanKind.SERVER +import static io.opentelemetry.api.trace.StatusCode.ERROR import static io.opentelemetry.instrumentation.test.server.http.TestHttpServer.httpServer import static io.opentelemetry.instrumentation.test.utils.PortUtils.UNUSABLE_PORT import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicClientSpan @@ -174,7 +175,7 @@ abstract class HttpClientTest extends InstrumentationSpecification { throw new UnsupportedOperationException() } - Integer statusOnRedirectError() { + Integer responseCodeOnRedirectError() { return null } @@ -188,10 +189,10 @@ abstract class HttpClientTest extends InstrumentationSpecification { def "basic #method request #url"() { when: - def status = doRequest(method, url) + def responseCode = doRequest(method, url) then: - status == 200 + responseCode == 200 assertTraces(1) { trace(0, 2 + extraClientSpans()) { clientSpan(it, 0, null, method, url) @@ -208,12 +209,12 @@ abstract class HttpClientTest extends InstrumentationSpecification { def "basic #method request with parent"() { when: - def status = runUnderTrace("parent") { + def responseCode = runUnderTrace("parent") { doRequest(method, server.address.resolve("/success")) } then: - status == 200 + responseCode == 200 assertTraces(1) { trace(0, 3 + extraClientSpans()) { basicSpan(it, 0, "parent") @@ -231,12 +232,12 @@ abstract class HttpClientTest extends InstrumentationSpecification { assumeTrue(testWithClientParent()) when: - def status = runUnderParentClientSpan { + def responseCode = runUnderParentClientSpan { doRequest(method, server.address.resolve("/success")) } then: - status == 200 + responseCode == 200 // there should be 2 separate traces since the nested CLIENT span is suppressed // (and the span context propagation along with it) assertTraces(2) { @@ -259,12 +260,12 @@ abstract class HttpClientTest extends InstrumentationSpecification { def "trace request without propagation"() { when: - def status = runUnderTrace("parent") { + def responseCode = runUnderTrace("parent") { doRequest(method, server.address.resolve("/success"), ["is-test-server": "false"]) } then: - status == 200 + responseCode == 200 // only one trace (client). assertTraces(1) { trace(0, 2 + extraClientSpans()) { @@ -282,18 +283,18 @@ abstract class HttpClientTest extends InstrumentationSpecification { assumeTrue(testCallback()) assumeTrue(testCallbackWithParent()) - def status = new BlockingVariable() + def responseCode = new BlockingVariable() when: runUnderTrace("parent") { doRequestWithCallback(method, server.address.resolve("/success"), ["is-test-server": "false"]) { runUnderTrace("child") {} - status.set(it) + responseCode.set(it) } } then: - status.get() == 200 + responseCode.get() == 200 // only one trace (client). assertTraces(1) { trace(0, 3 + extraClientSpans()) { @@ -311,17 +312,17 @@ abstract class HttpClientTest extends InstrumentationSpecification { given: assumeTrue(testCallback()) - def status = new BlockingVariable() + def responseCode = new BlockingVariable() when: doRequestWithCallback(method, server.address.resolve("/success"), ["is-test-server": "false"]) { runUnderTrace("callback") { } - status.set(it) + responseCode.set(it) } then: - status.get() == 200 + responseCode.get() == 200 // only one trace (client). assertTraces(2) { trace(0, 1 + extraClientSpans()) { @@ -345,10 +346,10 @@ abstract class HttpClientTest extends InstrumentationSpecification { def uri = server.address.resolve("/redirect") when: - def status = doRequest(method, uri) + def responseCode = doRequest(method, uri) then: - status == 200 + responseCode == 200 assertTraces(1) { trace(0, 3 + extraClientSpans()) { clientSpan(it, 0, null, method, uri) @@ -367,10 +368,10 @@ abstract class HttpClientTest extends InstrumentationSpecification { def uri = server.address.resolve("/another-redirect") when: - def status = doRequest(method, uri) + def responseCode = doRequest(method, uri) then: - status == 200 + responseCode == 200 assertTraces(1) { trace(0, 4 + extraClientSpans()) { clientSpan(it, 0, null, method, uri) @@ -399,7 +400,7 @@ abstract class HttpClientTest extends InstrumentationSpecification { and: assertTraces(1) { trace(0, 1 + extraClientSpans() + maxRedirects()) { - clientSpan(it, 0, null, method, uri, statusOnRedirectError(), thrownException) + clientSpan(it, 0, null, method, uri, responseCodeOnRedirectError(), thrownException) def start = 1 + extraClientSpans() for (int i = start; i < maxRedirects() + start; i++) { serverSpan(it, i, span(extraClientSpans())) @@ -418,10 +419,10 @@ abstract class HttpClientTest extends InstrumentationSpecification { when: - def status = doRequest(method, uri, [(BASIC_AUTH_KEY): BASIC_AUTH_VAL]) + def responseCode = doRequest(method, uri, [(BASIC_AUTH_KEY): BASIC_AUTH_VAL]) then: - status == 200 + responseCode == 200 assertTraces(1) { trace(0, 3 + extraClientSpans()) { clientSpan(it, 0, null, method, uri) @@ -439,10 +440,10 @@ abstract class HttpClientTest extends InstrumentationSpecification { assumeTrue(testReusedRequest()) when: - def status = doReusedRequest(method, url) + def responseCode = doReusedRequest(method, url) then: - status == 200 + responseCode == 200 assertTraces(2) { trace(0, 2 + extraClientSpans()) { clientSpan(it, 0, null, method, url) @@ -543,10 +544,10 @@ abstract class HttpClientTest extends InstrumentationSpecification { def uri = new URI("https://www.google.com/") when: - def status = doRequest(method, uri) + def responseCode = doRequest(method, uri) then: - status == 200 + responseCode == 200 assertTraces(1) { trace(0, 1 + extraClientSpans()) { clientSpan(it, 0, null, method, uri) @@ -664,7 +665,7 @@ abstract class HttpClientTest extends InstrumentationSpecification { } // parent span must be cast otherwise it breaks debugging classloading (junit loads it early) - void clientSpan(TraceAssert trace, int index, Object parentSpan, String method = "GET", URI uri = server.address.resolve("/success"), Integer status = 200, Throwable exception = null, String httpFlavor = "1.1") { + void clientSpan(TraceAssert trace, int index, Object parentSpan, String method = "GET", URI uri = server.address.resolve("/success"), Integer responseCode = 200, Throwable exception = null, String httpFlavor = "1.1") { def userAgent = userAgent() def extraAttributes = extraAttributes() trace.span(index) { @@ -675,8 +676,8 @@ abstract class HttpClientTest extends InstrumentationSpecification { } name expectedOperationName(method) kind CLIENT - errored exception != null if (exception) { + status ERROR errorEvent(exception.class, exception.message) } attributes { @@ -698,8 +699,8 @@ abstract class HttpClientTest extends InstrumentationSpecification { if (userAgent) { "${SemanticAttributes.HTTP_USER_AGENT.key}" { it.startsWith(userAgent) } } - if (status) { - "${SemanticAttributes.HTTP_STATUS_CODE.key}" status + if (responseCode) { + "${SemanticAttributes.HTTP_STATUS_CODE.key}" responseCode } if (extraAttributes.contains(SemanticAttributes.HTTP_HOST)) { @@ -727,7 +728,6 @@ abstract class HttpClientTest extends InstrumentationSpecification { traces.span(index) { name "test-http-server" kind SERVER - errored false if (parentSpan == null) { hasNoParent() } else { diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy index 7c39e38ca9..456b97bcc8 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy @@ -5,6 +5,7 @@ package io.opentelemetry.instrumentation.test.base + import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.ERROR import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.EXCEPTION import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.INDEXED_CHILD @@ -17,10 +18,11 @@ import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace import static org.junit.Assume.assumeTrue -import io.opentelemetry.api.common.AttributeKey import io.opentelemetry.api.GlobalOpenTelemetry +import io.opentelemetry.api.common.AttributeKey import io.opentelemetry.api.trace.Span import io.opentelemetry.api.trace.SpanKind +import io.opentelemetry.api.trace.StatusCode import io.opentelemetry.context.Context import io.opentelemetry.instrumentation.test.InstrumentationSpecification import io.opentelemetry.instrumentation.test.asserts.TraceAssert @@ -390,6 +392,7 @@ abstract class HttpServerTest extends InstrumentationSpecification imple This way we verify that child span created by the server actually corresponds to the client request. */ + def "high concurrency test"() { setup: assumeTrue(testConcurrency()) @@ -510,8 +513,8 @@ abstract class HttpServerTest extends InstrumentationSpecification imple void controllerSpan(TraceAssert trace, int index, Object parent, String errorMessage = null, Class exceptionClass = Exception) { trace.span(index) { name "controller" - errored errorMessage != null if (errorMessage) { + status StatusCode.ERROR errorEvent(exceptionClass, errorMessage) } childOf((SpanData) parent) @@ -558,8 +561,8 @@ abstract class HttpServerTest extends InstrumentationSpecification imple trace.span(index) { name ~/\.forward$/ kind SpanKind.INTERNAL - errored errorMessage != null if (errorMessage) { + status StatusCode.ERROR errorEvent(exceptionClass, errorMessage) } childOf((SpanData) parent) @@ -570,8 +573,8 @@ abstract class HttpServerTest extends InstrumentationSpecification imple trace.span(index) { name ~/\.include$/ kind SpanKind.INTERNAL - errored errorMessage != null if (errorMessage) { + status StatusCode.ERROR errorEvent(exceptionClass, errorMessage) } childOf((SpanData) parent) @@ -584,7 +587,9 @@ abstract class HttpServerTest extends InstrumentationSpecification imple trace.span(index) { name expectedServerSpanName(endpoint) kind SpanKind.SERVER // can't use static import because of SERVER type parameter - errored endpoint.errored + if (endpoint.errored) { + status StatusCode.ERROR + } if (parentID != null) { traceId traceID parentSpanId parentID @@ -649,7 +654,6 @@ abstract class HttpServerTest extends InstrumentationSpecification imple trace.span(1) { name expectedServerSpanName(endpoint) kind SpanKind.SERVER // can't use static import because of SERVER type parameter - errored false childOf((SpanData) parent) attributes { "${SemanticAttributes.NET_PEER_PORT.key}" { it == null || it instanceof Long } @@ -667,7 +671,6 @@ abstract class HttpServerTest extends InstrumentationSpecification imple void indexedControllerSpan(TraceAssert trace, int index, Object parent, int requestId) { trace.span(index) { name "controller" - errored false childOf((SpanData) parent) attributes { it."test.request.id" requestId diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/server/http/TestHttpServer.groovy b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/server/http/TestHttpServer.groovy index ecb0a3c0e5..e8a479f974 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/server/http/TestHttpServer.groovy +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/server/http/TestHttpServer.groovy @@ -117,7 +117,6 @@ class TestHttpServer implements AutoCloseable { trace.span(index) { name "test-http-server" kind SERVER - errored false if (parentSpan == null) { hasNoParent() } else { diff --git a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/utils/TraceUtils.groovy b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/utils/TraceUtils.groovy index f2eb8a44ce..4d9fd9d910 100644 --- a/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/utils/TraceUtils.groovy +++ b/testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/utils/TraceUtils.groovy @@ -89,8 +89,8 @@ class TraceUtils { } name operation kind spanKind - errored exception != null if (exception) { + status StatusCode.ERROR errorEvent(exception.class, exception.message) }