From 5806dc2faed00b4e735468c0692bf4fc8a5a4299 Mon Sep 17 00:00:00 2001 From: Luke Zhang Date: Wed, 13 Aug 2025 13:46:58 -0700 Subject: [PATCH] fix(deps): update dependency otel/semconv to v1.29.0 This PR upgrades these two upstream dependencies in ADOT Java from v1.28.0 to v1.29.0. io.opentelemetry.semconv:opentelemetry-semconv io.opentelemetry.semconv:opentelemetry-semconv-incubating Upstream OTel Java Agent v2.11 is using semconv v1.29.0, not v1.28.0. This PR keeps OTel and ADOT in sync. ADOT by default uses the same version of semconv OTel is using. In March 2024, upstream stopped using semconv keys from package "io.opentelemetry.semconv.SemanticAttributes". Semconv 1.25.0 migration #10983 open-telemetry/opentelemetry-java-instrumentation#10983 ADOT Java did not follow. It's still using keys from this package: https://github.com/aws-observability/aws-otel-java-instrumentation/blob/release/v2.11.x/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanProcessingUtil.java#L18 Unfortunately, in this Jan., this package was deleted from upstream. This is causing ADOT Java build break if we need upgrade upstream dependencies. This PR replaces these old keys in ADOT Java code base. Basically, it is doing the same update upstream had done in last March. The code change is safe. It has a limited scope that only updates the definitions of semconv keys. The text content of these keys remain untouched. Test: ./gradlew build Pass ./gradlew test. Pass Manual E2E test Pass Backward Compatibility: This change is backward compatible. It does not change any runtime behaviors. --- awsagentprovider/build.gradle.kts | 6 +- .../AwsMetricAttributeGenerator.java | 68 ++++++++++--------- .../AwsResourceAttributeConfigurator.java | 2 +- .../providers/AwsSpanMetricsProcessor.java | 4 +- .../providers/AwsSpanProcessingUtil.java | 20 +++--- ...AttributePropagatingSpanProcessorTest.java | 6 +- .../AwsMetricAttributeGeneratorTest.java | 52 +++++++++++--- .../AwsMetricAttributesSpanExporterTest.java | 4 +- .../AwsSpanMetricsProcessorTest.java | 2 +- .../providers/AwsSpanProcessingUtilTest.java | 9 ++- 10 files changed, 106 insertions(+), 67 deletions(-) diff --git a/awsagentprovider/build.gradle.kts b/awsagentprovider/build.gradle.kts index 1abe269cc0..3aeb79f935 100644 --- a/awsagentprovider/build.gradle.kts +++ b/awsagentprovider/build.gradle.kts @@ -26,8 +26,10 @@ base { dependencies { compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api") - compileOnly("io.opentelemetry.semconv:opentelemetry-semconv:1.28.0-alpha") - testImplementation("io.opentelemetry.semconv:opentelemetry-semconv:1.28.0-alpha") + compileOnly("io.opentelemetry.semconv:opentelemetry-semconv") + compileOnly("io.opentelemetry.semconv:opentelemetry-semconv-incubating") + testImplementation("io.opentelemetry.semconv:opentelemetry-semconv") + testImplementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating") compileOnly("com.google.errorprone:error_prone_annotations:2.19.1") compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi") compileOnly("org.slf4j:slf4j-api") diff --git a/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributeGenerator.java b/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributeGenerator.java index a1349f06b5..c96346dc88 100644 --- a/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributeGenerator.java +++ b/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributeGenerator.java @@ -15,36 +15,34 @@ package software.amazon.opentelemetry.javaagent.providers; -import static io.opentelemetry.semconv.SemanticAttributes.DB_CONNECTION_STRING; -import static io.opentelemetry.semconv.SemanticAttributes.DB_NAME; -import static io.opentelemetry.semconv.SemanticAttributes.DB_OPERATION; -import static io.opentelemetry.semconv.SemanticAttributes.DB_STATEMENT; -import static io.opentelemetry.semconv.SemanticAttributes.DB_SYSTEM; -import static io.opentelemetry.semconv.SemanticAttributes.DB_USER; -import static io.opentelemetry.semconv.SemanticAttributes.FAAS_INVOKED_NAME; -import static io.opentelemetry.semconv.SemanticAttributes.FAAS_TRIGGER; -import static io.opentelemetry.semconv.SemanticAttributes.GRAPHQL_OPERATION_TYPE; -import static io.opentelemetry.semconv.SemanticAttributes.HTTP_METHOD; -import static io.opentelemetry.semconv.SemanticAttributes.HTTP_REQUEST_METHOD; -import static io.opentelemetry.semconv.SemanticAttributes.HTTP_RESPONSE_STATUS_CODE; -import static io.opentelemetry.semconv.SemanticAttributes.HTTP_STATUS_CODE; -import static io.opentelemetry.semconv.SemanticAttributes.HTTP_URL; -import static io.opentelemetry.semconv.SemanticAttributes.MESSAGING_OPERATION; -import static io.opentelemetry.semconv.SemanticAttributes.MESSAGING_SYSTEM; -import static io.opentelemetry.semconv.SemanticAttributes.NETWORK_PEER_ADDRESS; -import static io.opentelemetry.semconv.SemanticAttributes.NETWORK_PEER_PORT; -import static io.opentelemetry.semconv.SemanticAttributes.NET_PEER_NAME; -import static io.opentelemetry.semconv.SemanticAttributes.NET_PEER_PORT; -import static io.opentelemetry.semconv.SemanticAttributes.NET_SOCK_PEER_ADDR; -import static io.opentelemetry.semconv.SemanticAttributes.NET_SOCK_PEER_PORT; -import static io.opentelemetry.semconv.SemanticAttributes.PEER_SERVICE; -import static io.opentelemetry.semconv.SemanticAttributes.RPC_METHOD; -import static io.opentelemetry.semconv.SemanticAttributes.RPC_SERVICE; -import static io.opentelemetry.semconv.SemanticAttributes.SERVER_ADDRESS; -import static io.opentelemetry.semconv.SemanticAttributes.SERVER_PORT; -import static io.opentelemetry.semconv.SemanticAttributes.SERVER_SOCKET_ADDRESS; -import static io.opentelemetry.semconv.SemanticAttributes.SERVER_SOCKET_PORT; -import static io.opentelemetry.semconv.SemanticAttributes.URL_FULL; +import static io.opentelemetry.semconv.HttpAttributes.HTTP_REQUEST_METHOD; +import static io.opentelemetry.semconv.HttpAttributes.HTTP_RESPONSE_STATUS_CODE; +import static io.opentelemetry.semconv.NetworkAttributes.NETWORK_PEER_ADDRESS; +import static io.opentelemetry.semconv.NetworkAttributes.NETWORK_PEER_PORT; +import static io.opentelemetry.semconv.ServerAttributes.SERVER_ADDRESS; +import static io.opentelemetry.semconv.ServerAttributes.SERVER_PORT; +import static io.opentelemetry.semconv.UrlAttributes.URL_FULL; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_CONNECTION_STRING; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_NAME; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_OPERATION; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_STATEMENT; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_SYSTEM; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_USER; +import static io.opentelemetry.semconv.incubating.FaasIncubatingAttributes.FAAS_INVOKED_NAME; +import static io.opentelemetry.semconv.incubating.FaasIncubatingAttributes.FAAS_TRIGGER; +import static io.opentelemetry.semconv.incubating.GraphqlIncubatingAttributes.GRAPHQL_OPERATION_TYPE; +import static io.opentelemetry.semconv.incubating.HttpIncubatingAttributes.HTTP_METHOD; +import static io.opentelemetry.semconv.incubating.HttpIncubatingAttributes.HTTP_STATUS_CODE; +import static io.opentelemetry.semconv.incubating.HttpIncubatingAttributes.HTTP_URL; +import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION; +import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_SYSTEM; +import static io.opentelemetry.semconv.incubating.NetIncubatingAttributes.NET_PEER_NAME; +import static io.opentelemetry.semconv.incubating.NetIncubatingAttributes.NET_PEER_PORT; +import static io.opentelemetry.semconv.incubating.NetIncubatingAttributes.NET_SOCK_PEER_ADDR; +import static io.opentelemetry.semconv.incubating.NetIncubatingAttributes.NET_SOCK_PEER_PORT; +import static io.opentelemetry.semconv.incubating.PeerIncubatingAttributes.PEER_SERVICE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SERVICE; import static software.amazon.opentelemetry.javaagent.providers.AwsApplicationSignalsCustomizerProvider.LAMBDA_APPLICATION_SIGNALS_REMOTE_ENVIRONMENT; import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_AGENT_ID; import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_AUTH_ACCESS_KEY; @@ -99,8 +97,6 @@ import io.opentelemetry.sdk.trace.data.EventData; import io.opentelemetry.sdk.trace.data.ExceptionEventData; import io.opentelemetry.sdk.trace.data.SpanData; -import io.opentelemetry.semconv.ResourceAttributes; -import io.opentelemetry.semconv.SemanticAttributes; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URI; @@ -126,6 +122,14 @@ * represent "outgoing" traffic, and {@link SpanKind#INTERNAL} spans are ignored. */ final class AwsMetricAttributeGenerator implements MetricAttributeGenerator { + // ToDo: These two keys were deleted by upstream. Code need to be updated to capture the same + // information by using new keys. + // https://github.com/open-telemetry/semantic-conventions-java/blob/release/v1.28.0/semconv/src/main/java/io/opentelemetry/semconv/SemanticAttributes.java#L3784-L3795 + static final AttributeKey SERVER_SOCKET_ADDRESS = + io.opentelemetry.api.common.AttributeKey.stringKey("server.socket.address"); + + static final AttributeKey SERVER_SOCKET_PORT = + io.opentelemetry.api.common.AttributeKey.longKey("server.socket.port"); private static final Logger logger = Logger.getLogger(AwsMetricAttributeGenerator.class.getName()); diff --git a/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsResourceAttributeConfigurator.java b/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsResourceAttributeConfigurator.java index d2decdc16c..01132a1919 100644 --- a/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsResourceAttributeConfigurator.java +++ b/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsResourceAttributeConfigurator.java @@ -15,7 +15,7 @@ package software.amazon.opentelemetry.javaagent.providers; -import static io.opentelemetry.semconv.ResourceAttributes.SERVICE_NAME; +import static io.opentelemetry.semconv.ServiceAttributes.SERVICE_NAME; import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LOCAL_SERVICE; import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.UNKNOWN_SERVICE; diff --git a/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanMetricsProcessor.java b/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanMetricsProcessor.java index c2f133a48d..37436f5d3b 100644 --- a/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanMetricsProcessor.java +++ b/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanMetricsProcessor.java @@ -15,8 +15,8 @@ package software.amazon.opentelemetry.javaagent.providers; -import static io.opentelemetry.semconv.SemanticAttributes.HTTP_RESPONSE_STATUS_CODE; -import static io.opentelemetry.semconv.SemanticAttributes.HTTP_STATUS_CODE; +import static io.opentelemetry.semconv.HttpAttributes.HTTP_RESPONSE_STATUS_CODE; +import static io.opentelemetry.semconv.incubating.HttpIncubatingAttributes.HTTP_STATUS_CODE; import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_REMOTE_SERVICE; import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.isKeyPresent; diff --git a/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanProcessingUtil.java b/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanProcessingUtil.java index 4211c24a7c..ebeb751acb 100644 --- a/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanProcessingUtil.java +++ b/awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanProcessingUtil.java @@ -15,16 +15,16 @@ package software.amazon.opentelemetry.javaagent.providers; -import static io.opentelemetry.semconv.SemanticAttributes.DB_OPERATION; -import static io.opentelemetry.semconv.SemanticAttributes.DB_STATEMENT; -import static io.opentelemetry.semconv.SemanticAttributes.DB_SYSTEM; -import static io.opentelemetry.semconv.SemanticAttributes.HTTP_METHOD; -import static io.opentelemetry.semconv.SemanticAttributes.HTTP_REQUEST_METHOD; -import static io.opentelemetry.semconv.SemanticAttributes.HTTP_TARGET; -import static io.opentelemetry.semconv.SemanticAttributes.MESSAGING_OPERATION; -import static io.opentelemetry.semconv.SemanticAttributes.MessagingOperationValues.PROCESS; -import static io.opentelemetry.semconv.SemanticAttributes.RPC_SYSTEM; -import static io.opentelemetry.semconv.SemanticAttributes.URL_PATH; +import static io.opentelemetry.semconv.UrlAttributes.URL_PATH; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_OPERATION; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_STATEMENT; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_SYSTEM; +import static io.opentelemetry.semconv.incubating.HttpIncubatingAttributes.HTTP_METHOD; +import static io.opentelemetry.semconv.incubating.HttpIncubatingAttributes.HTTP_REQUEST_METHOD; +import static io.opentelemetry.semconv.incubating.HttpIncubatingAttributes.HTTP_TARGET; +import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION; +import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MessagingOperationTypeIncubatingValues.PROCESS; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import static software.amazon.opentelemetry.javaagent.providers.AwsApplicationSignalsCustomizerProvider.AWS_LAMBDA_FUNCTION_NAME_CONFIG; import static software.amazon.opentelemetry.javaagent.providers.AwsApplicationSignalsCustomizerProvider.isLambdaEnvironment; import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LAMBDA_LOCAL_OPERATION_OVERRIDE; diff --git a/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AttributePropagatingSpanProcessorTest.java b/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AttributePropagatingSpanProcessorTest.java index 102f411013..443fca8b49 100644 --- a/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AttributePropagatingSpanProcessorTest.java +++ b/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AttributePropagatingSpanProcessorTest.java @@ -15,9 +15,9 @@ package software.amazon.opentelemetry.javaagent.providers; -import static io.opentelemetry.semconv.SemanticAttributes.MESSAGING_OPERATION; -import static io.opentelemetry.semconv.SemanticAttributes.MessagingOperationValues.PROCESS; -import static io.opentelemetry.semconv.SemanticAttributes.RPC_SYSTEM; +import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION; +import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MessagingOperationTypeIncubatingValues.PROCESS; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import static org.assertj.core.api.Assertions.assertThat; import io.opentelemetry.api.common.AttributeKey; diff --git a/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributeGeneratorTest.java b/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributeGeneratorTest.java index 8b362193df..a9f272483f 100644 --- a/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributeGeneratorTest.java +++ b/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributeGeneratorTest.java @@ -15,9 +15,39 @@ package software.amazon.opentelemetry.javaagent.providers; -import static io.opentelemetry.semconv.ResourceAttributes.SERVICE_NAME; -import static io.opentelemetry.semconv.SemanticAttributes.*; -import static io.opentelemetry.semconv.SemanticAttributes.MessagingOperationValues.PROCESS; +import static io.opentelemetry.semconv.HttpAttributes.HTTP_REQUEST_METHOD; +import static io.opentelemetry.semconv.HttpAttributes.HTTP_RESPONSE_STATUS_CODE; +import static io.opentelemetry.semconv.NetworkAttributes.NETWORK_PEER_ADDRESS; +import static io.opentelemetry.semconv.NetworkAttributes.NETWORK_PEER_PORT; +import static io.opentelemetry.semconv.ServerAttributes.SERVER_ADDRESS; +import static io.opentelemetry.semconv.ServerAttributes.SERVER_PORT; +import static io.opentelemetry.semconv.ServiceAttributes.SERVICE_NAME; +import static io.opentelemetry.semconv.UrlAttributes.URL_FULL; +import static io.opentelemetry.semconv.UrlAttributes.URL_PATH; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_CONNECTION_STRING; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_NAME; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_OPERATION; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_STATEMENT; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_SYSTEM; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_USER; +import static io.opentelemetry.semconv.incubating.FaasIncubatingAttributes.FAAS_INVOKED_NAME; +import static io.opentelemetry.semconv.incubating.FaasIncubatingAttributes.FAAS_INVOKED_PROVIDER; +import static io.opentelemetry.semconv.incubating.FaasIncubatingAttributes.FAAS_TRIGGER; +import static io.opentelemetry.semconv.incubating.GraphqlIncubatingAttributes.GRAPHQL_OPERATION_TYPE; +import static io.opentelemetry.semconv.incubating.HttpIncubatingAttributes.HTTP_METHOD; +import static io.opentelemetry.semconv.incubating.HttpIncubatingAttributes.HTTP_TARGET; +import static io.opentelemetry.semconv.incubating.HttpIncubatingAttributes.HTTP_URL; +import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION; +import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_SYSTEM; +import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MessagingOperationTypeIncubatingValues.PROCESS; +import static io.opentelemetry.semconv.incubating.NetIncubatingAttributes.NET_PEER_NAME; +import static io.opentelemetry.semconv.incubating.NetIncubatingAttributes.NET_PEER_PORT; +import static io.opentelemetry.semconv.incubating.NetIncubatingAttributes.NET_SOCK_PEER_ADDR; +import static io.opentelemetry.semconv.incubating.NetIncubatingAttributes.NET_SOCK_PEER_PORT; +import static io.opentelemetry.semconv.incubating.PeerIncubatingAttributes.PEER_SERVICE; +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 static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -1237,28 +1267,28 @@ public void testDBClientSpanWithRemoteResourceAttributes() { // Validate behaviour of DB_NAME, SERVER_SOCKET_ADDRESS and SERVER_SOCKET_PORT exist, then // remove it. mockAttribute(DB_NAME, "db_name"); - mockAttribute(SERVER_SOCKET_ADDRESS, "abc.com"); - mockAttribute(SERVER_SOCKET_PORT, 3306L); + mockAttribute(AwsMetricAttributeGenerator.SERVER_SOCKET_ADDRESS, "abc.com"); + mockAttribute(AwsMetricAttributeGenerator.SERVER_SOCKET_PORT, 3306L); validateRemoteResourceAttributes("DB::Connection", "db_name|abc.com|3306"); mockAttribute(DB_NAME, null); - mockAttribute(SERVER_SOCKET_ADDRESS, null); - mockAttribute(SERVER_SOCKET_PORT, null); + mockAttribute(AwsMetricAttributeGenerator.SERVER_SOCKET_ADDRESS, null); + mockAttribute(AwsMetricAttributeGenerator.SERVER_SOCKET_PORT, null); // Validate behaviour of DB_NAME, SERVER_SOCKET_ADDRESS exist, then remove it. mockAttribute(DB_NAME, "db_name"); - mockAttribute(SERVER_SOCKET_ADDRESS, "abc.com"); + mockAttribute(AwsMetricAttributeGenerator.SERVER_SOCKET_ADDRESS, "abc.com"); validateRemoteResourceAttributes("DB::Connection", "db_name|abc.com"); mockAttribute(DB_NAME, null); - mockAttribute(SERVER_SOCKET_ADDRESS, null); + mockAttribute(AwsMetricAttributeGenerator.SERVER_SOCKET_ADDRESS, null); // Validate behaviour of SERVER_SOCKET_PORT exist, then remove it. - mockAttribute(SERVER_SOCKET_PORT, 3306L); + mockAttribute(AwsMetricAttributeGenerator.SERVER_SOCKET_PORT, 3306L); when(spanDataMock.getKind()).thenReturn(SpanKind.CLIENT); actualAttributes = GENERATOR.generateMetricAttributeMapFromSpan(spanDataMock, resource).get(DEPENDENCY_METRIC); assertThat(actualAttributes.get(AWS_REMOTE_RESOURCE_TYPE)).isNull(); assertThat(actualAttributes.get(AWS_REMOTE_RESOURCE_IDENTIFIER)).isNull(); - mockAttribute(SERVER_SOCKET_PORT, null); + mockAttribute(AwsMetricAttributeGenerator.SERVER_SOCKET_PORT, null); // Validate behaviour of only DB_NAME exist, then remove it. mockAttribute(DB_NAME, "db_name"); diff --git a/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributesSpanExporterTest.java b/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributesSpanExporterTest.java index 7f7b340fef..f2c0a9d01b 100644 --- a/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributesSpanExporterTest.java +++ b/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributesSpanExporterTest.java @@ -15,8 +15,8 @@ package software.amazon.opentelemetry.javaagent.providers; -import static io.opentelemetry.semconv.SemanticAttributes.MESSAGING_OPERATION; -import static io.opentelemetry.semconv.SemanticAttributes.MessagingOperationValues.PROCESS; +import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION; +import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MessagingOperationTypeIncubatingValues.PROCESS; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; diff --git a/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanMetricsProcessorTest.java b/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanMetricsProcessorTest.java index 65bba3a513..28a628f526 100644 --- a/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanMetricsProcessorTest.java +++ b/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanMetricsProcessorTest.java @@ -15,7 +15,7 @@ package software.amazon.opentelemetry.javaagent.providers; -import static io.opentelemetry.semconv.SemanticAttributes.HTTP_RESPONSE_STATUS_CODE; +import static io.opentelemetry.semconv.HttpAttributes.HTTP_RESPONSE_STATUS_CODE; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; diff --git a/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanProcessingUtilTest.java b/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanProcessingUtilTest.java index 9318a4c4ca..798f3f060a 100644 --- a/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanProcessingUtilTest.java +++ b/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsSpanProcessingUtilTest.java @@ -15,9 +15,12 @@ package software.amazon.opentelemetry.javaagent.providers; -import static io.opentelemetry.semconv.SemanticAttributes.*; -import static io.opentelemetry.semconv.SemanticAttributes.MessagingOperationValues.PROCESS; -import static io.opentelemetry.semconv.SemanticAttributes.MessagingOperationValues.RECEIVE; +import static io.opentelemetry.semconv.HttpAttributes.HTTP_REQUEST_METHOD; +import static io.opentelemetry.semconv.UrlAttributes.URL_PATH; +import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION; +import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MessagingOperationTypeIncubatingValues.PROCESS; +import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MessagingOperationTypeIncubatingValues.RECEIVE; +import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Answers.CALLS_REAL_METHODS; import static org.mockito.Mockito.mock;