From 6d41a16ba8d611a3fba1a8d4590b5b55fe6e2dff Mon Sep 17 00:00:00 2001 From: Prashant Srivastava <50466688+srprash@users.noreply.github.com> Date: Thu, 22 Feb 2024 15:27:17 -0800 Subject: [PATCH] prefix AWS.SDK to the RemoteService from v1 (#756) --- .../appsignals/test/awssdk/v1/AwsSdkV1Test.java | 8 ++++---- .../javaagent/providers/AwsMetricAttributeGenerator.java | 5 +---- .../providers/AwsMetricAttributeGeneratorTest.java | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/awssdk/v1/AwsSdkV1Test.java b/appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/awssdk/v1/AwsSdkV1Test.java index d33d17ae75..1730b83a5c 100644 --- a/appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/awssdk/v1/AwsSdkV1Test.java +++ b/appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/awssdk/v1/AwsSdkV1Test.java @@ -59,22 +59,22 @@ protected String getKinesisSpanNamePrefix() { @Override protected String getS3ServiceName() { - return "Amazon S3"; + return "AWS.SDK.Amazon S3"; } @Override protected String getDynamoDbServiceName() { - return "AmazonDynamoDBv2"; + return "AWS.SDK.AmazonDynamoDBv2"; } @Override protected String getSqsServiceName() { - return "AmazonSQS"; + return "AWS.SDK.AmazonSQS"; } @Override protected String getKinesisServiceName() { - return "AmazonKinesis"; + return "AWS.SDK.AmazonKinesis"; } protected String getS3RpcServiceName() { 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 9cca61ab67..ad0c97f97b 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 @@ -216,10 +216,7 @@ private static void setEgressOperation(SpanData span, AttributesBuilder builder) // add `AWS.SDK.` as prefix to indicate the metrics resulted from current span is from AWS SDK private static String normalizeServiceName(SpanData span, String serviceName) { if (AwsSpanProcessingUtil.isAwsSDKSpan(span)) { - String scopeName = span.getInstrumentationScopeInfo().getName(); - if (scopeName.contains("aws-sdk-2.")) { - return "AWS.SDK." + serviceName; - } + return "AWS.SDK." + serviceName; } return serviceName; } 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 9c6ba5e4b2..f3d813ecfd 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 @@ -969,7 +969,7 @@ public void testNormalizeServiceNameAwsSdkV1Span() { Attributes actualAttributes = GENERATOR.generateMetricAttributeMapFromSpan(spanDataMock, resource).get(DEPENDENCY_METRIC); - assertThat(actualAttributes.get(AWS_REMOTE_SERVICE)).isEqualTo("Amazon S3"); + assertThat(actualAttributes.get(AWS_REMOTE_SERVICE)).isEqualTo("AWS.SDK.Amazon S3"); } @Test