diff --git a/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTest.java b/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTest.java index b5aac93905d6..c1051d03faff 100644 --- a/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTest.java +++ b/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTest.java @@ -13,6 +13,9 @@ import static io.opentelemetry.semconv.NetworkAttributes.NETWORK_TYPE; import static io.opentelemetry.semconv.ServerAttributes.SERVER_ADDRESS; import static io.opentelemetry.semconv.ServerAttributes.SERVER_PORT; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SERVICE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import static org.assertj.core.api.Assertions.assertThat; import io.opentelemetry.api.trace.SpanKind; @@ -132,12 +135,10 @@ void testApacheDubboBase() throws ReflectiveOperationException { .hasParent(trace.getSpan(0)) .hasAttributesSatisfyingExactly( equalTo( - RpcIncubatingAttributes.RPC_SYSTEM, + RPC_SYSTEM, RpcIncubatingAttributes.RpcSystemIncubatingValues.APACHE_DUBBO), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "org.apache.dubbo.rpc.service.GenericService"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "$invoke"), + equalTo(RPC_SERVICE, "org.apache.dubbo.rpc.service.GenericService"), + equalTo(RPC_METHOD, "$invoke"), equalTo(SERVER_ADDRESS, "localhost"), satisfies(SERVER_PORT, k -> k.isInstanceOf(Long.class)), satisfies( @@ -166,12 +167,12 @@ void testApacheDubboBase() throws ReflectiveOperationException { .hasParent(trace.getSpan(1)) .hasAttributesSatisfying( equalTo( - RpcIncubatingAttributes.RPC_SYSTEM, + RPC_SYSTEM, RpcIncubatingAttributes.RpcSystemIncubatingValues.APACHE_DUBBO), equalTo( - RpcIncubatingAttributes.RPC_SERVICE, + RPC_SERVICE, "io.opentelemetry.instrumentation.apachedubbo.v2_7.api.HelloService"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "hello"), + equalTo(RPC_METHOD, "hello"), satisfies(NETWORK_PEER_ADDRESS, k -> k.isInstanceOf(String.class)), satisfies(NETWORK_PEER_PORT, k -> k.isInstanceOf(Long.class)), satisfies(NETWORK_TYPE, AbstractAssert::isNull)))); @@ -226,12 +227,10 @@ void testApacheDubboTest() .hasParent(trace.getSpan(0)) .hasAttributesSatisfyingExactly( equalTo( - RpcIncubatingAttributes.RPC_SYSTEM, + RPC_SYSTEM, RpcIncubatingAttributes.RpcSystemIncubatingValues.APACHE_DUBBO), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "org.apache.dubbo.rpc.service.GenericService"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "$invokeAsync"), + equalTo(RPC_SERVICE, "org.apache.dubbo.rpc.service.GenericService"), + equalTo(RPC_METHOD, "$invokeAsync"), equalTo(SERVER_ADDRESS, "localhost"), satisfies(SERVER_PORT, k -> k.isInstanceOf(Long.class)), satisfies( @@ -260,12 +259,12 @@ void testApacheDubboTest() .hasParent(trace.getSpan(1)) .hasAttributesSatisfying( equalTo( - RpcIncubatingAttributes.RPC_SYSTEM, + RPC_SYSTEM, RpcIncubatingAttributes.RpcSystemIncubatingValues.APACHE_DUBBO), equalTo( - RpcIncubatingAttributes.RPC_SERVICE, + RPC_SERVICE, "io.opentelemetry.instrumentation.apachedubbo.v2_7.api.HelloService"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "hello"), + equalTo(RPC_METHOD, "hello"), satisfies(NETWORK_PEER_ADDRESS, k -> k.isInstanceOf(String.class)), satisfies(NETWORK_PEER_PORT, k -> k.isInstanceOf(Long.class)), satisfies( diff --git a/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTraceChainTest.java b/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTraceChainTest.java index a792c8e71279..f1d7a28dd75d 100644 --- a/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTraceChainTest.java +++ b/instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTraceChainTest.java @@ -13,6 +13,9 @@ import static io.opentelemetry.semconv.NetworkAttributes.NETWORK_TYPE; import static io.opentelemetry.semconv.ServerAttributes.SERVER_ADDRESS; import static io.opentelemetry.semconv.ServerAttributes.SERVER_PORT; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SERVICE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import static org.assertj.core.api.Assertions.assertThat; import io.opentelemetry.api.trace.SpanKind; @@ -175,12 +178,10 @@ void testDubboChain() throws ReflectiveOperationException { .hasParent(trace.getSpan(0)) .hasAttributesSatisfyingExactly( equalTo( - RpcIncubatingAttributes.RPC_SYSTEM, + RPC_SYSTEM, RpcIncubatingAttributes.RpcSystemIncubatingValues.APACHE_DUBBO), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "org.apache.dubbo.rpc.service.GenericService"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "$invoke"), + equalTo(RPC_SERVICE, "org.apache.dubbo.rpc.service.GenericService"), + equalTo(RPC_METHOD, "$invoke"), equalTo(SERVER_ADDRESS, "localhost"), satisfies(SERVER_PORT, k -> k.isInstanceOf(Long.class)), satisfies( @@ -209,12 +210,12 @@ void testDubboChain() throws ReflectiveOperationException { .hasParent(trace.getSpan(1)) .hasAttributesSatisfying( equalTo( - RpcIncubatingAttributes.RPC_SYSTEM, + RPC_SYSTEM, RpcIncubatingAttributes.RpcSystemIncubatingValues.APACHE_DUBBO), equalTo( - RpcIncubatingAttributes.RPC_SERVICE, + RPC_SERVICE, "io.opentelemetry.instrumentation.apachedubbo.v2_7.api.MiddleService"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "hello"), + equalTo(RPC_METHOD, "hello"), satisfies(NETWORK_PEER_ADDRESS, k -> k.isInstanceOf(String.class)), satisfies(NETWORK_PEER_PORT, k -> k.isInstanceOf(Long.class)), satisfies( @@ -230,12 +231,10 @@ void testDubboChain() throws ReflectiveOperationException { .hasParent(trace.getSpan(2)) .hasAttributesSatisfyingExactly( equalTo( - RpcIncubatingAttributes.RPC_SYSTEM, + RPC_SYSTEM, RpcIncubatingAttributes.RpcSystemIncubatingValues.APACHE_DUBBO), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "org.apache.dubbo.rpc.service.GenericService"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "$invoke"), + equalTo(RPC_SERVICE, "org.apache.dubbo.rpc.service.GenericService"), + equalTo(RPC_METHOD, "$invoke"), equalTo(SERVER_ADDRESS, "localhost"), satisfies(SERVER_PORT, k -> k.isInstanceOf(Long.class)), satisfies( @@ -264,12 +263,12 @@ void testDubboChain() throws ReflectiveOperationException { .hasParent(trace.getSpan(3)) .hasAttributesSatisfying( equalTo( - RpcIncubatingAttributes.RPC_SYSTEM, + RPC_SYSTEM, RpcIncubatingAttributes.RpcSystemIncubatingValues.APACHE_DUBBO), equalTo( - RpcIncubatingAttributes.RPC_SERVICE, + RPC_SERVICE, "io.opentelemetry.instrumentation.apachedubbo.v2_7.api.HelloService"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "hello"), + equalTo(RPC_METHOD, "hello"), satisfies(NETWORK_PEER_ADDRESS, k -> k.isInstanceOf(String.class)), satisfies(NETWORK_PEER_PORT, k -> k.isInstanceOf(Long.class)), satisfies( @@ -346,12 +345,10 @@ void testDubboChainInJvm() throws ReflectiveOperationException { .hasParent(trace.getSpan(0)) .hasAttributesSatisfyingExactly( equalTo( - RpcIncubatingAttributes.RPC_SYSTEM, + RPC_SYSTEM, RpcIncubatingAttributes.RpcSystemIncubatingValues.APACHE_DUBBO), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "org.apache.dubbo.rpc.service.GenericService"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "$invoke"), + equalTo(RPC_SERVICE, "org.apache.dubbo.rpc.service.GenericService"), + equalTo(RPC_METHOD, "$invoke"), equalTo(SERVER_ADDRESS, "localhost"), satisfies(SERVER_PORT, k -> k.isInstanceOf(Long.class)), satisfies( @@ -380,12 +377,12 @@ void testDubboChainInJvm() throws ReflectiveOperationException { .hasParent(trace.getSpan(1)) .hasAttributesSatisfying( equalTo( - RpcIncubatingAttributes.RPC_SYSTEM, + RPC_SYSTEM, RpcIncubatingAttributes.RpcSystemIncubatingValues.APACHE_DUBBO), equalTo( - RpcIncubatingAttributes.RPC_SERVICE, + RPC_SERVICE, "io.opentelemetry.instrumentation.apachedubbo.v2_7.api.MiddleService"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "hello"), + equalTo(RPC_METHOD, "hello"), satisfies(NETWORK_PEER_ADDRESS, k -> k.isInstanceOf(String.class)), satisfies(NETWORK_PEER_PORT, k -> k.isInstanceOf(Long.class)), satisfies( diff --git a/instrumentation/armeria/armeria-grpc-1.14/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/armeria/grpc/v1_14/ArmeriaGrpcTest.java b/instrumentation/armeria/armeria-grpc-1.14/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/armeria/grpc/v1_14/ArmeriaGrpcTest.java index 97bb4aea78e1..275981b80849 100644 --- a/instrumentation/armeria/armeria-grpc-1.14/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/armeria/grpc/v1_14/ArmeriaGrpcTest.java +++ b/instrumentation/armeria/armeria-grpc-1.14/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/armeria/grpc/v1_14/ArmeriaGrpcTest.java @@ -8,6 +8,10 @@ import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; import static io.opentelemetry.semconv.ServerAttributes.SERVER_ADDRESS; import static io.opentelemetry.semconv.ServerAttributes.SERVER_PORT; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SERVICE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import static org.assertj.core.api.Assertions.assertThat; import com.linecorp.armeria.client.grpc.GrpcClients; @@ -21,7 +25,6 @@ import io.opentelemetry.api.trace.SpanKind; import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; import io.opentelemetry.semconv.incubating.MessageIncubatingAttributes; -import io.opentelemetry.semconv.incubating.RpcIncubatingAttributes; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -76,12 +79,10 @@ void grpcInstrumentation() { .hasKind(SpanKind.CLIENT) .hasParent(trace.getSpan(0)) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()), equalTo(SERVER_ADDRESS, "127.0.0.1"), equalTo(SERVER_PORT, (long) server.httpPort())) .hasEventsSatisfyingExactly( @@ -103,12 +104,10 @@ void grpcInstrumentation() { .hasKind(SpanKind.SERVER) .hasParent(trace.getSpan(1)) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()), equalTo(SERVER_ADDRESS, "127.0.0.1"), equalTo(SERVER_PORT, server.httpPort())) .hasEventsSatisfyingExactly( diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractSqsSuppressReceiveSpansTest.java b/instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractSqsSuppressReceiveSpansTest.java index 8f290b779690..74ab20759001 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractSqsSuppressReceiveSpansTest.java +++ b/instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractSqsSuppressReceiveSpansTest.java @@ -18,6 +18,9 @@ import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_MESSAGE_ID; import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION; import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_SYSTEM; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SERVICE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import static org.assertj.core.api.Assertions.assertThat; import com.amazonaws.auth.AWSStaticCredentialsProvider; @@ -36,7 +39,6 @@ import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; import io.opentelemetry.semconv.incubating.AwsIncubatingAttributes; import io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes; -import io.opentelemetry.semconv.incubating.RpcIncubatingAttributes; import org.elasticmq.rest.sqs.SQSRestServer; import org.elasticmq.rest.sqs.SQSRestServerBuilder; import org.junit.jupiter.api.AfterEach; @@ -108,9 +110,9 @@ void testSimpleSqsProducerConsumerServices() { satisfies( AwsIncubatingAttributes.AWS_REQUEST_ID, val -> val.isInstanceOf(String.class)), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "AmazonSQS"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "CreateQueue"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "AmazonSQS"), + equalTo(RPC_METHOD, "CreateQueue"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo(URL_FULL, "http://localhost:" + sqsPort), @@ -132,9 +134,9 @@ void testSimpleSqsProducerConsumerServices() { satisfies( AwsIncubatingAttributes.AWS_REQUEST_ID, val -> val.isInstanceOf(String.class)), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "AmazonSQS"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SendMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "AmazonSQS"), + equalTo(RPC_METHOD, "SendMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo(URL_FULL, "http://localhost:" + sqsPort), @@ -162,9 +164,9 @@ void testSimpleSqsProducerConsumerServices() { satisfies( AwsIncubatingAttributes.AWS_REQUEST_ID, val -> val.isInstanceOf(String.class)), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "AmazonSQS"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "ReceiveMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "AmazonSQS"), + equalTo(RPC_METHOD, "ReceiveMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo(URL_FULL, "http://localhost:" + sqsPort), @@ -220,9 +222,9 @@ void testSimpleSqsProducerConsumerServicesWithParentSpan() { satisfies( AwsIncubatingAttributes.AWS_REQUEST_ID, val -> val.isInstanceOf(String.class)), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "AmazonSQS"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "CreateQueue"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "AmazonSQS"), + equalTo(RPC_METHOD, "CreateQueue"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo(URL_FULL, "http://localhost:" + sqsPort), @@ -244,9 +246,9 @@ void testSimpleSqsProducerConsumerServicesWithParentSpan() { satisfies( AwsIncubatingAttributes.AWS_REQUEST_ID, val -> val.isInstanceOf(String.class)), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "AmazonSQS"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SendMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "AmazonSQS"), + equalTo(RPC_METHOD, "SendMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo(URL_FULL, "http://localhost:" + sqsPort), @@ -274,9 +276,9 @@ void testSimpleSqsProducerConsumerServicesWithParentSpan() { satisfies( AwsIncubatingAttributes.AWS_REQUEST_ID, val -> val.isInstanceOf(String.class)), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "AmazonSQS"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "ReceiveMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "AmazonSQS"), + equalTo(RPC_METHOD, "ReceiveMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo(URL_FULL, "http://localhost:" + sqsPort), @@ -315,9 +317,9 @@ void testSimpleSqsProducerConsumerServicesWithParentSpan() { satisfies( AwsIncubatingAttributes.AWS_REQUEST_ID, val -> val.isInstanceOf(String.class)), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "AmazonSQS"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "ReceiveMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "AmazonSQS"), + equalTo(RPC_METHOD, "ReceiveMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo(URL_FULL, "http://localhost:" + sqsPort), diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractSqsTracingTest.java b/instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractSqsTracingTest.java index 083a52a2f127..92a9e88384bd 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractSqsTracingTest.java +++ b/instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractSqsTracingTest.java @@ -20,6 +20,9 @@ import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_MESSAGE_ID; import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION; import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_SYSTEM; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SERVICE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import static org.assertj.core.api.Assertions.assertThat; import com.amazonaws.auth.AWSStaticCredentialsProvider; @@ -43,7 +46,6 @@ import io.opentelemetry.sdk.trace.data.SpanData; import io.opentelemetry.semconv.incubating.AwsIncubatingAttributes; import io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes; -import io.opentelemetry.semconv.incubating.RpcIncubatingAttributes; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -142,9 +144,9 @@ void testSimpleSqsProducerConsumerServicesCaptureHeaders(boolean testCaptureHead satisfies( AwsIncubatingAttributes.AWS_REQUEST_ID, val -> val.isInstanceOf(String.class)), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "AmazonSQS"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "CreateQueue"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "AmazonSQS"), + equalTo(RPC_METHOD, "CreateQueue"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo(URL_FULL, "http://localhost:" + sqsPort), @@ -165,9 +167,9 @@ void testSimpleSqsProducerConsumerServicesCaptureHeaders(boolean testCaptureHead satisfies( AwsIncubatingAttributes.AWS_REQUEST_ID, val -> val.isInstanceOf(String.class)), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "AmazonSQS"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SendMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "AmazonSQS"), + equalTo(RPC_METHOD, "SendMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo(URL_FULL, "http://localhost:" + sqsPort), @@ -209,9 +211,9 @@ void testSimpleSqsProducerConsumerServicesCaptureHeaders(boolean testCaptureHead satisfies( AwsIncubatingAttributes.AWS_REQUEST_ID, val -> val.isInstanceOf(String.class)), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "AmazonSQS"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "ReceiveMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "AmazonSQS"), + equalTo(RPC_METHOD, "ReceiveMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo(URL_FULL, "http://localhost:" + sqsPort), @@ -250,9 +252,9 @@ void testSimpleSqsProducerConsumerServicesCaptureHeaders(boolean testCaptureHead satisfies( AwsIncubatingAttributes.AWS_REQUEST_ID, val -> val.isInstanceOf(String.class)), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "AmazonSQS"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "ReceiveMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "AmazonSQS"), + equalTo(RPC_METHOD, "ReceiveMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo(URL_FULL, "http://localhost:" + sqsPort), @@ -320,9 +322,9 @@ void testSimpleSqsProducerConsumerServicesWithParentSpan() { satisfies( AwsIncubatingAttributes.AWS_REQUEST_ID, val -> val.isInstanceOf(String.class)), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "AmazonSQS"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "CreateQueue"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "AmazonSQS"), + equalTo(RPC_METHOD, "CreateQueue"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo(URL_FULL, "http://localhost:" + sqsPort), @@ -344,9 +346,9 @@ void testSimpleSqsProducerConsumerServicesWithParentSpan() { satisfies( AwsIncubatingAttributes.AWS_REQUEST_ID, val -> val.isInstanceOf(String.class)), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "AmazonSQS"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SendMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "AmazonSQS"), + equalTo(RPC_METHOD, "SendMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo(URL_FULL, "http://localhost:" + sqsPort), @@ -388,9 +390,9 @@ void testSimpleSqsProducerConsumerServicesWithParentSpan() { satisfies( AwsIncubatingAttributes.AWS_REQUEST_ID, val -> val.isInstanceOf(String.class)), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "AmazonSQS"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "ReceiveMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "AmazonSQS"), + equalTo(RPC_METHOD, "ReceiveMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo(URL_FULL, "http://localhost:" + sqsPort), @@ -413,9 +415,9 @@ void testSimpleSqsProducerConsumerServicesWithParentSpan() { satisfies( AwsIncubatingAttributes.AWS_REQUEST_ID, val -> val.isInstanceOf(String.class)), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "AmazonSQS"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "ReceiveMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "AmazonSQS"), + equalTo(RPC_METHOD, "ReceiveMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo(URL_FULL, "http://localhost:" + sqsPort), @@ -448,9 +450,9 @@ void testSimpleSqsProducerConsumerServicesWithParentSpan() { satisfies( AwsIncubatingAttributes.AWS_REQUEST_ID, val -> val.isInstanceOf(String.class)), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "AmazonSQS"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "ReceiveMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "AmazonSQS"), + equalTo(RPC_METHOD, "ReceiveMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo(URL_FULL, "http://localhost:" + sqsPort), diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientRecordHttpErrorTest.java b/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientRecordHttpErrorTest.java index 60d015f50fed..9ab563a0c0ac 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientRecordHttpErrorTest.java +++ b/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientRecordHttpErrorTest.java @@ -14,12 +14,14 @@ import static io.opentelemetry.semconv.ServerAttributes.SERVER_PORT; import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_OPERATION; import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_SYSTEM; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SERVICE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import io.opentelemetry.api.trace.SpanKind; import io.opentelemetry.instrumentation.api.internal.ConfigPropertiesUtil; import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; import io.opentelemetry.semconv.incubating.AwsIncubatingAttributes; -import io.opentelemetry.semconv.incubating.RpcIncubatingAttributes; import io.opentelemetry.testing.internal.armeria.common.HttpResponse; import io.opentelemetry.testing.internal.armeria.common.HttpStatus; import io.opentelemetry.testing.internal.armeria.common.MediaType; @@ -175,9 +177,9 @@ public void testSendDynamoDbRequestWithRetries() { equalTo(HTTP_RESPONSE_STATUS_CODE, 200), equalTo( stringKey("url.full"), "http://127.0.0.1:" + server.httpPort() + "/"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, service), - equalTo(RpcIncubatingAttributes.RPC_METHOD, operation), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, service), + equalTo(RPC_METHOD, operation), equalTo(stringKey("aws.agent"), "java-aws-sdk"), equalTo(AwsIncubatingAttributes.AWS_REQUEST_ID, requestId), equalTo(stringKey("aws.table.name"), "sometable"), diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2SqsTracingTest.java b/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2SqsTracingTest.java index e61bd5ab7da0..e8085e14eccf 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2SqsTracingTest.java +++ b/instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2SqsTracingTest.java @@ -19,6 +19,9 @@ import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_MESSAGE_ID; import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION; import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_SYSTEM; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SERVICE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import static org.assertj.core.api.Assertions.assertThat; import io.opentelemetry.api.common.Attributes; @@ -30,7 +33,6 @@ import io.opentelemetry.sdk.trace.data.SpanData; import io.opentelemetry.semconv.incubating.AwsIncubatingAttributes; import io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes; -import io.opentelemetry.semconv.incubating.RpcIncubatingAttributes; import io.opentelemetry.testing.internal.armeria.internal.shaded.guava.collect.ImmutableList; import java.net.URI; import java.net.URISyntaxException; @@ -183,9 +185,9 @@ void assertSqsTraces(Boolean withParent, Boolean captureHeaders) { .isEqualTo( "00000000-0000-0000-0000-000000000000"), v -> assertThat(v).isEqualTo("UNKNOWN"))), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "Sqs"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "CreateQueue"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "Sqs"), + equalTo(RPC_METHOD, "CreateQueue"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), satisfies( @@ -212,9 +214,9 @@ void assertSqsTraces(Boolean withParent, Boolean captureHeaders) { .isEqualTo( "00000000-0000-0000-0000-000000000000"), v -> assertThat(v).isEqualTo("UNKNOWN"))), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "Sqs"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SendMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "Sqs"), + equalTo(RPC_METHOD, "SendMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), satisfies( @@ -272,9 +274,9 @@ void assertSqsTraces(Boolean withParent, Boolean captureHeaders) { .isEqualTo( "00000000-0000-0000-0000-000000000000"), v -> assertThat(v).isEqualTo("UNKNOWN"))), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "Sqs"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "ReceiveMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "Sqs"), + equalTo(RPC_METHOD, "ReceiveMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), satisfies( @@ -290,9 +292,9 @@ void assertSqsTraces(Boolean withParent, Boolean captureHeaders) { new ArrayList<>( Arrays.asList( equalTo(stringKey("aws.agent"), "java-aws-sdk"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "Sqs"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "ReceiveMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "Sqs"), + equalTo(RPC_METHOD, "ReceiveMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), satisfies( @@ -330,9 +332,9 @@ void assertSqsTraces(Boolean withParent, Boolean captureHeaders) { new ArrayList<>( Arrays.asList( equalTo(stringKey("aws.agent"), "java-aws-sdk"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "Sqs"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "ReceiveMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "Sqs"), + equalTo(RPC_METHOD, "ReceiveMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), satisfies( @@ -505,9 +507,9 @@ void testBatchSqsProducerConsumerServicesSync() throws URISyntaxException { .isEqualTo( "00000000-0000-0000-0000-000000000000"), v -> assertThat(v.trim()).isEqualTo("UNKNOWN"))), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "Sqs"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SendMessageBatch"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "Sqs"), + equalTo(RPC_METHOD, "SendMessageBatch"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), satisfies(URL_FULL, v -> v.startsWith("http://localhost:" + sqsPort)), @@ -530,9 +532,9 @@ void testBatchSqsProducerConsumerServicesSync() throws URISyntaxException { .hasTotalRecordedLinks(0) .hasAttributesSatisfyingExactly( equalTo(stringKey("aws.agent"), "java-aws-sdk"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "Sqs"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "ReceiveMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "Sqs"), + equalTo(RPC_METHOD, "ReceiveMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), satisfies(URL_FULL, v -> v.startsWith("http://localhost:" + sqsPort)), @@ -573,9 +575,9 @@ void testBatchSqsProducerConsumerServicesSync() throws URISyntaxException { .hasParent(trace.getSpan(0)) .hasAttributesSatisfyingExactly( equalTo(stringKey("aws.agent"), "java-aws-sdk"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "Sqs"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "ReceiveMessage"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_SERVICE, "Sqs"), + equalTo(RPC_METHOD, "ReceiveMessage"), equalTo(HTTP_REQUEST_METHOD, "POST"), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), satisfies( diff --git a/instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcStreamingTest.java b/instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcStreamingTest.java index e867b98134b6..21bf17544044 100644 --- a/instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcStreamingTest.java +++ b/instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcStreamingTest.java @@ -14,6 +14,10 @@ import static io.opentelemetry.semconv.NetworkAttributes.NETWORK_TYPE; import static io.opentelemetry.semconv.ServerAttributes.SERVER_ADDRESS; import static io.opentelemetry.semconv.ServerAttributes.SERVER_PORT; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SERVICE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import example.GreeterGrpc; import example.Helloworld; @@ -31,7 +35,6 @@ import io.opentelemetry.instrumentation.testing.util.ThrowingRunnable; import io.opentelemetry.sdk.trace.data.EventData; import io.opentelemetry.semconv.incubating.MessageIncubatingAttributes; -import io.opentelemetry.semconv.incubating.RpcIncubatingAttributes; import java.util.ArrayList; import java.util.List; import java.util.Queue; @@ -187,12 +190,10 @@ public void onCompleted() { .hasNoParent() .hasAttributesSatisfyingExactly( addExtraClientAttributes( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "Conversation"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "Conversation"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, (long) server.getPort()))) .satisfies( @@ -204,12 +205,10 @@ public void onCompleted() { .hasKind(SpanKind.SERVER) .hasParent(trace.getSpan(0)) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "Conversation"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "Conversation"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, server.getPort()), equalTo(NETWORK_TYPE, "ipv4"), @@ -234,15 +233,11 @@ public void onCompleted() { point -> point.hasAttributesSatisfying( equalTo(SERVER_ADDRESS, "localhost"), + equalTo(RPC_METHOD, "Conversation"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_SYSTEM, "grpc"), equalTo( - RpcIncubatingAttributes.RPC_METHOD, - "Conversation"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, + RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value())))))); testing() .waitAndAssertMetrics( @@ -260,15 +255,11 @@ public void onCompleted() { point.hasAttributesSatisfying( equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, server.getPort()), + equalTo(RPC_METHOD, "Conversation"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_SYSTEM, "grpc"), equalTo( - RpcIncubatingAttributes.RPC_METHOD, - "Conversation"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, + RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value())))))); } diff --git a/instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcTest.java b/instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcTest.java index f76a91c26488..801a9ad82df4 100644 --- a/instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcTest.java +++ b/instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcTest.java @@ -13,6 +13,10 @@ import static io.opentelemetry.semconv.NetworkAttributes.NETWORK_TYPE; import static io.opentelemetry.semconv.ServerAttributes.SERVER_ADDRESS; import static io.opentelemetry.semconv.ServerAttributes.SERVER_PORT; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SERVICE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.params.provider.Arguments.arguments; @@ -53,7 +57,6 @@ import io.opentelemetry.sdk.testing.assertj.AttributeAssertion; import io.opentelemetry.sdk.trace.data.StatusData; import io.opentelemetry.semconv.incubating.MessageIncubatingAttributes; -import io.opentelemetry.semconv.incubating.RpcIncubatingAttributes; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -139,12 +142,10 @@ public void sayHello( .hasParent(trace.getSpan(0)) .hasAttributesSatisfyingExactly( addExtraClientAttributes( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, (long) server.getPort()))) .hasEventsSatisfyingExactly( @@ -168,12 +169,10 @@ public void sayHello( .hasKind(SpanKind.SERVER) .hasParent(trace.getSpan(1)) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, server.getPort()), equalTo(NETWORK_TYPE, "ipv4"), @@ -210,14 +209,11 @@ public void sayHello( point -> point.hasAttributesSatisfying( equalTo(SERVER_ADDRESS, "localhost"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_SYSTEM, "grpc"), equalTo( - RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, + RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value())))))); testing() .waitAndAssertMetrics( @@ -235,14 +231,11 @@ public void sayHello( point.hasAttributesSatisfying( equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, server.getPort()), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_SYSTEM, "grpc"), equalTo( - RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, + RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value())))))); } @@ -302,12 +295,10 @@ public void sayHello( .hasParent(trace.getSpan(0)) .hasAttributesSatisfyingExactly( addExtraClientAttributes( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, (long) server.getPort()))) .hasEventsSatisfyingExactly( @@ -331,12 +322,10 @@ public void sayHello( .hasKind(SpanKind.SERVER) .hasParent(trace.getSpan(1)) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, server.getPort()), equalTo(NETWORK_TYPE, "ipv4"), @@ -377,14 +366,11 @@ public void sayHello( point -> point.hasAttributesSatisfying( equalTo(SERVER_ADDRESS, "localhost"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_SYSTEM, "grpc"), equalTo( - RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, + RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value())))))); testing() .waitAndAssertMetrics( @@ -402,14 +388,11 @@ public void sayHello( point.hasAttributesSatisfying( equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, server.getPort()), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_SYSTEM, "grpc"), equalTo( - RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, + RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value())))))); } @@ -477,12 +460,10 @@ public void onCompleted() { .hasParent(trace.getSpan(0)) .hasAttributesSatisfyingExactly( addExtraClientAttributes( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, (long) server.getPort()))) .hasEventsSatisfyingExactly( @@ -506,12 +487,10 @@ public void onCompleted() { .hasKind(SpanKind.SERVER) .hasParent(trace.getSpan(1)) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, server.getPort()), equalTo(NETWORK_TYPE, "ipv4"), @@ -552,14 +531,11 @@ public void onCompleted() { point -> point.hasAttributesSatisfying( equalTo(SERVER_ADDRESS, "localhost"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_SYSTEM, "grpc"), equalTo( - RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, + RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value())))))); testing() .waitAndAssertMetrics( @@ -577,14 +553,11 @@ public void onCompleted() { point.hasAttributesSatisfying( equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, server.getPort()), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_SYSTEM, "grpc"), equalTo( - RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, + RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value())))))); } @@ -627,12 +600,10 @@ public void sayHello( .hasStatus(StatusData.error()) .hasAttributesSatisfyingExactly( addExtraClientAttributes( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) status.getCode().value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_GRPC_STATUS_CODE, (long) status.getCode().value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, (long) server.getPort()))) .hasEventsSatisfyingExactly( @@ -649,12 +620,10 @@ public void sayHello( .hasParent(trace.getSpan(0)) .hasStatus(isServerError ? StatusData.error() : StatusData.unset()) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) status.getCode().value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_GRPC_STATUS_CODE, (long) status.getCode().value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, server.getPort()), equalTo(NETWORK_TYPE, "ipv4"), @@ -691,14 +660,11 @@ public void sayHello( point -> point.hasAttributesSatisfying( equalTo(SERVER_ADDRESS, "localhost"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_SYSTEM, "grpc"), equalTo( - RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, + RPC_GRPC_STATUS_CODE, (long) status.getCode().value())))))); testing() .waitAndAssertMetrics( @@ -716,14 +682,11 @@ public void sayHello( point.hasAttributesSatisfying( equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, server.getPort()), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_SYSTEM, "grpc"), equalTo( - RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, + RPC_GRPC_STATUS_CODE, (long) status.getCode().value())))))); } @@ -774,11 +737,11 @@ public void sayHello( .hasStatus(StatusData.error()) .hasAttributesSatisfyingExactly( addExtraClientAttributes( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayHello"), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayHello"), equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, + RPC_GRPC_STATUS_CODE, (long) Status.UNKNOWN.getCode().value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, (long) server.getPort()))) @@ -796,12 +759,10 @@ public void sayHello( .hasParent(trace.getSpan(0)) .hasStatus(StatusData.error()) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.UNKNOWN.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.UNKNOWN.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, server.getPort()), equalTo(NETWORK_TYPE, "ipv4"), @@ -833,14 +794,11 @@ public void sayHello( point -> point.hasAttributesSatisfying( equalTo(SERVER_ADDRESS, "localhost"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_SYSTEM, "grpc"), equalTo( - RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, + RPC_GRPC_STATUS_CODE, (long) Status.Code.UNKNOWN.value())))))); testing() .waitAndAssertMetrics( @@ -858,14 +816,11 @@ public void sayHello( point.hasAttributesSatisfying( equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, server.getPort()), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_SYSTEM, "grpc"), equalTo( - RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, + RPC_GRPC_STATUS_CODE, (long) Status.Code.UNKNOWN.value())))))); } @@ -1017,12 +972,10 @@ public void onCompleted() { .hasParent(trace.getSpan(0)) .hasAttributesSatisfyingExactly( addExtraClientAttributes( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, (long) server.getPort()))) .hasEventsSatisfyingExactly( @@ -1046,12 +999,10 @@ public void onCompleted() { .hasKind(SpanKind.SERVER) .hasParent(trace.getSpan(1)) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, server.getPort()), equalTo(NETWORK_TYPE, "ipv4"), @@ -1138,12 +1089,11 @@ public void onCompleted() { .hasStatus(StatusData.error()) .hasAttributesSatisfyingExactly( addExtraClientAttributes( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayMultipleHello"), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayMultipleHello"), equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.CANCELLED.value()), + RPC_GRPC_STATUS_CODE, (long) Status.Code.CANCELLED.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, (long) server.getPort()))) .hasEventsSatisfying( @@ -1167,12 +1117,10 @@ public void onCompleted() { .hasKind(SpanKind.SERVER) .hasParent(trace.getSpan(1)) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayMultipleHello"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.CANCELLED.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayMultipleHello"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.CANCELLED.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, server.getPort()), equalTo(NETWORK_TYPE, "ipv4"), @@ -1255,15 +1203,11 @@ public void onCompleted() { .hasNoParent() .hasAttributesSatisfyingExactly( addExtraClientAttributes( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), + equalTo(RPC_SYSTEM, "grpc"), equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "grpc.reflection.v1alpha.ServerReflection"), - equalTo( - RpcIncubatingAttributes.RPC_METHOD, "ServerReflectionInfo"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value()), + RPC_SERVICE, "grpc.reflection.v1alpha.ServerReflection"), + equalTo(RPC_METHOD, "ServerReflectionInfo"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, (long) server.getPort()))) .hasEventsSatisfyingExactly( @@ -1288,14 +1232,10 @@ public void onCompleted() { .hasKind(SpanKind.SERVER) .hasParent(trace.getSpan(0)) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "grpc.reflection.v1alpha.ServerReflection"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "ServerReflectionInfo"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "grpc.reflection.v1alpha.ServerReflection"), + equalTo(RPC_METHOD, "ServerReflectionInfo"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, server.getPort()), equalTo(NETWORK_TYPE, "ipv4"), @@ -1366,12 +1306,10 @@ public void sayHello( .hasParent(trace.getSpan(0)) .hasAttributesSatisfyingExactly( addExtraClientAttributes( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, (long) server.getPort()))) .hasEventsSatisfyingExactly( @@ -1395,12 +1333,10 @@ public void sayHello( .hasKind(SpanKind.SERVER) .hasParent(trace.getSpan(1)) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "grpc"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "example.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SayHello"), - equalTo( - RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE, - (long) Status.Code.OK.value()), + equalTo(RPC_SYSTEM, "grpc"), + equalTo(RPC_SERVICE, "example.Greeter"), + equalTo(RPC_METHOD, "SayHello"), + equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()), equalTo(SERVER_ADDRESS, "localhost"), equalTo(SERVER_PORT, server.getPort()), equalTo(NETWORK_TYPE, "ipv4"), diff --git a/instrumentation/gwt-2.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/gwt/GwtTest.java b/instrumentation/gwt-2.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/gwt/GwtTest.java index 711d627c3ddb..426bc25b6dbd 100644 --- a/instrumentation/gwt-2.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/gwt/GwtTest.java +++ b/instrumentation/gwt-2.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/gwt/GwtTest.java @@ -7,13 +7,15 @@ import static io.opentelemetry.instrumentation.testing.util.TelemetryDataUtil.orderByRootSpanName; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SERVICE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import static org.junit.jupiter.api.Assertions.assertEquals; import io.opentelemetry.api.trace.SpanKind; import io.opentelemetry.instrumentation.test.utils.PortUtils; import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; -import io.opentelemetry.semconv.incubating.RpcIncubatingAttributes; import java.io.File; import java.io.IOException; import java.net.URI; @@ -157,11 +159,9 @@ void testGwt() { .hasKind(SpanKind.SERVER) .hasParent(trace.getSpan(0)) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "gwt"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "test.gwt.shared.MessageService"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "sendMessage")))); + equalTo(RPC_SYSTEM, "gwt"), + equalTo(RPC_SERVICE, "test.gwt.shared.MessageService"), + equalTo(RPC_METHOD, "sendMessage")))); testing.clearData(); @@ -182,11 +182,9 @@ void testGwt() { .hasParent(trace.getSpan(0)) .hasException(new IOException()) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "gwt"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "test.gwt.shared.MessageService"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "sendMessage")))); + equalTo(RPC_SYSTEM, "gwt"), + equalTo(RPC_SERVICE, "test.gwt.shared.MessageService"), + equalTo(RPC_METHOD, "sendMessage")))); driver.close(); } diff --git a/instrumentation/rmi/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/rmi/RmiTest.java b/instrumentation/rmi/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/rmi/RmiTest.java index 8563a15d2b4b..3ea0b017985a 100644 --- a/instrumentation/rmi/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/rmi/RmiTest.java +++ b/instrumentation/rmi/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/rmi/RmiTest.java @@ -11,6 +11,9 @@ import static io.opentelemetry.semconv.ExceptionAttributes.EXCEPTION_MESSAGE; import static io.opentelemetry.semconv.ExceptionAttributes.EXCEPTION_STACKTRACE; import static io.opentelemetry.semconv.ExceptionAttributes.EXCEPTION_TYPE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SERVICE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import static org.assertj.core.api.Assertions.catchThrowableOfType; import io.opentelemetry.api.trace.SpanId; @@ -18,7 +21,6 @@ import io.opentelemetry.instrumentation.test.utils.PortUtils; import io.opentelemetry.instrumentation.testing.internal.AutoCleanupExtension; import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; -import io.opentelemetry.semconv.incubating.RpcIncubatingAttributes; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import java.rmi.server.UnicastRemoteObject; @@ -84,17 +86,17 @@ void clientCallCreatesSpans() throws Exception { .hasKind(SpanKind.CLIENT) .hasParentSpanId(trace.get(0).getSpanId()) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "java_rmi"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "rmi.app.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "hello")), + equalTo(RPC_SYSTEM, "java_rmi"), + equalTo(RPC_SERVICE, "rmi.app.Greeter"), + equalTo(RPC_METHOD, "hello")), span -> assertThat(span) .hasName("rmi.app.Server/hello") .hasKind(SpanKind.SERVER) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "java_rmi"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "rmi.app.Server"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "hello")))); + equalTo(RPC_SYSTEM, "java_rmi"), + equalTo(RPC_SERVICE, "rmi.app.Server"), + equalTo(RPC_METHOD, "hello")))); } @Test @@ -158,9 +160,9 @@ void serviceThrownException() throws Exception { EXCEPTION_STACKTRACE, AbstractAssert::isNotNull))) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "java_rmi"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "rmi.app.Greeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "exceptional")), + equalTo(RPC_SYSTEM, "java_rmi"), + equalTo(RPC_SERVICE, "rmi.app.Greeter"), + equalTo(RPC_METHOD, "exceptional")), span -> assertThat(span) .hasName("rmi.app.Server/exceptional") @@ -178,8 +180,8 @@ void serviceThrownException() throws Exception { EXCEPTION_STACKTRACE, AbstractAssert::isNotNull))) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "java_rmi"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "rmi.app.Server"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "exceptional")))); + equalTo(RPC_SYSTEM, "java_rmi"), + equalTo(RPC_SERVICE, "rmi.app.Server"), + equalTo(RPC_METHOD, "exceptional")))); } } diff --git a/instrumentation/spring/spring-cloud-aws-3.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/aws/AwsSqsTest.java b/instrumentation/spring/spring-cloud-aws-3.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/aws/AwsSqsTest.java index cc0cc91ff260..4c35dc6776dd 100644 --- a/instrumentation/spring/spring-cloud-aws-3.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/aws/AwsSqsTest.java +++ b/instrumentation/spring/spring-cloud-aws-3.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/aws/AwsSqsTest.java @@ -17,6 +17,9 @@ import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_MESSAGE_ID; import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION; import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_SYSTEM; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SERVICE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import static org.assertj.core.api.Assertions.assertThat; import io.awspring.cloud.sqs.operations.SqsTemplate; @@ -27,7 +30,6 @@ import io.opentelemetry.semconv.HttpAttributes; import io.opentelemetry.semconv.incubating.AwsIncubatingAttributes; import io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes; -import io.opentelemetry.semconv.incubating.RpcIncubatingAttributes; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; @@ -90,9 +92,9 @@ void sqsListener() throws InterruptedException, ExecutionException, TimeoutExcep .hasKind(SpanKind.CLIENT) .hasParent(trace.getSpan(0)) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "GetQueueUrl"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "Sqs"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_METHOD, "GetQueueUrl"), + equalTo(RPC_SERVICE, "Sqs"), equalTo( HTTP_REQUEST_METHOD, HttpAttributes.HttpRequestMethodValues.POST), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), @@ -112,9 +114,9 @@ void sqsListener() throws InterruptedException, ExecutionException, TimeoutExcep .hasKind(SpanKind.PRODUCER) .hasParent(trace.getSpan(0)) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "SendMessage"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "Sqs"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_METHOD, "SendMessage"), + equalTo(RPC_SERVICE, "Sqs"), equalTo( HTTP_REQUEST_METHOD, HttpAttributes.HttpRequestMethodValues.POST), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), @@ -145,9 +147,9 @@ void sqsListener() throws InterruptedException, ExecutionException, TimeoutExcep .hasKind(SpanKind.CONSUMER) .hasParent(trace.getSpan(2)) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "ReceiveMessage"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "Sqs"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_METHOD, "ReceiveMessage"), + equalTo(RPC_SERVICE, "Sqs"), equalTo( HTTP_REQUEST_METHOD, HttpAttributes.HttpRequestMethodValues.POST), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), @@ -172,9 +174,9 @@ void sqsListener() throws InterruptedException, ExecutionException, TimeoutExcep .hasKind(SpanKind.CLIENT) .hasParent(trace.getSpan(2)) .hasAttributesSatisfyingExactly( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "aws-api"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "DeleteMessageBatch"), - equalTo(RpcIncubatingAttributes.RPC_SERVICE, "Sqs"), + equalTo(RPC_SYSTEM, "aws-api"), + equalTo(RPC_METHOD, "DeleteMessageBatch"), + equalTo(RPC_SERVICE, "Sqs"), equalTo( HTTP_REQUEST_METHOD, HttpAttributes.HttpRequestMethodValues.POST), equalTo(HTTP_RESPONSE_STATUS_CODE, 200), diff --git a/instrumentation/spring/spring-rmi-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/rmi/v4_0/SpringRmiTest.java b/instrumentation/spring/spring-rmi-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/rmi/v4_0/SpringRmiTest.java index 97b2784bab4b..4d1570932d02 100644 --- a/instrumentation/spring/spring-rmi-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/rmi/v4_0/SpringRmiTest.java +++ b/instrumentation/spring/spring-rmi-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/rmi/v4_0/SpringRmiTest.java @@ -10,6 +10,9 @@ import static io.opentelemetry.semconv.ExceptionAttributes.EXCEPTION_MESSAGE; import static io.opentelemetry.semconv.ExceptionAttributes.EXCEPTION_STACKTRACE; import static io.opentelemetry.semconv.ExceptionAttributes.EXCEPTION_TYPE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SERVICE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -19,7 +22,6 @@ import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; import io.opentelemetry.sdk.testing.assertj.SpanDataAssert; import io.opentelemetry.sdk.trace.data.StatusData; -import io.opentelemetry.semconv.incubating.RpcIncubatingAttributes; import java.rmi.RemoteException; import java.util.ArrayList; import java.util.HashMap; @@ -158,11 +160,9 @@ void clientCallCreatesSpans(TestSource testSource) throws RemoteException { .hasKind(SpanKind.CLIENT) .hasParent(trace.getSpan(0)) .hasAttributesSatisfying( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "spring_rmi"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "springrmi.app.SpringRmiGreeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "hello"))); + equalTo(RPC_SYSTEM, "spring_rmi"), + equalTo(RPC_SERVICE, "springrmi.app.SpringRmiGreeter"), + equalTo(RPC_METHOD, "hello"))); if (testSource == TestSource.RMI) { assertions.add( span -> @@ -170,10 +170,9 @@ void clientCallCreatesSpans(TestSource testSource) throws RemoteException { .hasKind(SpanKind.SERVER) .hasParent(trace.getSpan(1)) .hasAttributesSatisfying( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, testSource.serverSystem), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, testSource.remoteClassName), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "hello"))); + equalTo(RPC_SYSTEM, testSource.serverSystem), + equalTo(RPC_SERVICE, testSource.remoteClassName), + equalTo(RPC_METHOD, "hello"))); } trace.hasSpansSatisfyingExactly(assertions); @@ -223,11 +222,9 @@ void throwsException(TestSource testSource) { EXCEPTION_STACKTRACE, val -> val.isInstanceOf(String.class)))) .hasAttributesSatisfying( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, "spring_rmi"), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, - "springrmi.app.SpringRmiGreeter"), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "exceptional"))); + equalTo(RPC_SYSTEM, "spring_rmi"), + equalTo(RPC_SERVICE, "springrmi.app.SpringRmiGreeter"), + equalTo(RPC_METHOD, "exceptional"))); if (testSource == TestSource.RMI) { assertions.add( span -> @@ -247,10 +244,9 @@ void throwsException(TestSource testSource) { EXCEPTION_STACKTRACE, val -> val.isInstanceOf(String.class)))) .hasAttributesSatisfying( - equalTo(RpcIncubatingAttributes.RPC_SYSTEM, testSource.serverSystem), - equalTo( - RpcIncubatingAttributes.RPC_SERVICE, testSource.remoteClassName), - equalTo(RpcIncubatingAttributes.RPC_METHOD, "exceptional"))); + equalTo(RPC_SYSTEM, testSource.serverSystem), + equalTo(RPC_SERVICE, testSource.remoteClassName), + equalTo(RPC_METHOD, "exceptional"))); } trace.hasSpansSatisfyingExactly(assertions);