From e93781f0f435c62dce89d080d9fe6f9a3a91eea6 Mon Sep 17 00:00:00 2001 From: Yiran Wang Date: Tue, 4 Jun 2024 11:42:32 -0700 Subject: [PATCH 1/6] [Instrumentation.AWS] Update AWS SDK Activity Tags based on https://opentelemetry.io/docs/specs/semconv/cloud-providers/aws-sdk (#1857) --- .../Implementation/AWSSemanticConventions.cs | 4 ++++ .../Implementation/AWSTracingPipelineHandler.cs | 5 +++++ .../TestAWSClientInstrumentation.cs | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSSemanticConventions.cs b/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSSemanticConventions.cs index dc5bbda9ad..ce6f1fe325 100644 --- a/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSSemanticConventions.cs +++ b/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSSemanticConventions.cs @@ -17,4 +17,8 @@ internal static class AWSSemanticConventions public const string AttributeHttpResponseContentLength = "http.response_content_length"; public const string AttributeValueDynamoDb = "dynamodb"; + + public const string AttributeValueRPCSystem = "rpc.system"; + public const string AttributeValueRPCService = "rpc.service"; + public const string AttributeValueRPCMethod = "rpc.method"; } diff --git a/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs b/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs index 84cbc01490..7f8a3225a0 100644 --- a/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs +++ b/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs @@ -233,6 +233,11 @@ private static string FetchRequestId(IRequestContext requestContext, IResponseCo { activity.SetTag(AWSSemanticConventions.AttributeAWSServiceName, service); activity.SetTag(AWSSemanticConventions.AttributeAWSOperationName, operation); + + // Follow: https://opentelemetry.io/docs/specs/otel/trace/semantic_conventions/instrumentation/aws-sdk/#common-attributes + activity.SetTag(AWSSemanticConventions.AttributeValueRPCSystem, "aws-api"); + activity.SetTag(AWSSemanticConventions.AttributeValueRPCService, service); + activity.SetTag(AWSSemanticConventions.AttributeValueRPCMethod, operation); var client = executionContext.RequestContext.ClientConfig; if (client != null) { diff --git a/test/OpenTelemetry.Instrumentation.AWS.Tests/TestAWSClientInstrumentation.cs b/test/OpenTelemetry.Instrumentation.AWS.Tests/TestAWSClientInstrumentation.cs index 81340c5764..7b09abae4e 100644 --- a/test/OpenTelemetry.Instrumentation.AWS.Tests/TestAWSClientInstrumentation.cs +++ b/test/OpenTelemetry.Instrumentation.AWS.Tests/TestAWSClientInstrumentation.cs @@ -205,6 +205,9 @@ private void ValidateDynamoActivityTags(Activity ddb_activity) Assert.Equal("us-east-1", Utils.GetTagValue(ddb_activity, "aws.region")); Assert.Equal("SampleProduct", Utils.GetTagValue(ddb_activity, "aws.table_name")); Assert.Equal("dynamodb", Utils.GetTagValue(ddb_activity, "db.system")); + Assert.Equal("aws-api", Utils.GetTagValue(ddb_activity, "rpc.system")); + Assert.Equal("DynamoDB", Utils.GetTagValue(ddb_activity, "rpc.service")); + Assert.Equal("Scan", Utils.GetTagValue(ddb_activity, "rpc.method")); } private void ValidateSqsActivityTags(Activity sqs_activity) @@ -214,5 +217,8 @@ private void ValidateSqsActivityTags(Activity sqs_activity) Assert.Equal("SendMessage", Utils.GetTagValue(sqs_activity, "aws.operation")); Assert.Equal("us-east-1", Utils.GetTagValue(sqs_activity, "aws.region")); Assert.Equal("https://sqs.us-east-1.amazonaws.com/123456789/MyTestQueue", Utils.GetTagValue(sqs_activity, "aws.queue_url")); + Assert.Equal("aws-api", Utils.GetTagValue(sqs_activity, "rpc.system")); + Assert.Equal("SQS", Utils.GetTagValue(sqs_activity, "rpc.service")); + Assert.Equal("SendMessage", Utils.GetTagValue(sqs_activity, "rpc.method")); } } From 9547f9fe2dee33d2bf35a2942cbf6926f4a6e1b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Thu, 6 Jun 2024 06:22:50 +0200 Subject: [PATCH 2/6] replace url to the spec --- .../Implementation/AWSTracingPipelineHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs b/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs index 7f8a3225a0..a58298b79a 100644 --- a/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs +++ b/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs @@ -234,7 +234,7 @@ private static string FetchRequestId(IRequestContext requestContext, IResponseCo activity.SetTag(AWSSemanticConventions.AttributeAWSServiceName, service); activity.SetTag(AWSSemanticConventions.AttributeAWSOperationName, operation); - // Follow: https://opentelemetry.io/docs/specs/otel/trace/semantic_conventions/instrumentation/aws-sdk/#common-attributes + // Follow: https://github.com/open-telemetry/semantic-conventions/blob/v1.26.0/docs/cloud-providers/aws-sdk.md#common-attributes activity.SetTag(AWSSemanticConventions.AttributeValueRPCSystem, "aws-api"); activity.SetTag(AWSSemanticConventions.AttributeValueRPCService, service); activity.SetTag(AWSSemanticConventions.AttributeValueRPCMethod, operation); From 33c715a3ad1c96a2c1364caab6ee314e20cf7ba8 Mon Sep 17 00:00:00 2001 From: Yiran Wang Date: Mon, 10 Jun 2024 13:43:58 -0700 Subject: [PATCH 3/6] Update AWS Instrumentation CHANGELOG --- src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md index d1433f2e15..93099d20bf 100644 --- a/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog - OpenTelemetry.Instrumentation.AWS ## Unreleased +* Updates AWS SDK Activity Tags based on https://github.com/open-telemetry/semantic-conventions/blob/v1.26.0/docs/cloud-providers/aws-sdk.md#common-attributes. + ([#1865](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1865)) ## 1.1.0-beta.4 From c87fad39a429018ff8bd50ba6e37140ad8bf3b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Wed, 12 Jun 2024 06:42:26 +0200 Subject: [PATCH 4/6] update changelog --- src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md index 93099d20bf..7f22601964 100644 --- a/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md @@ -1,7 +1,9 @@ # Changelog - OpenTelemetry.Instrumentation.AWS ## Unreleased -* Updates AWS SDK Activity Tags based on https://github.com/open-telemetry/semantic-conventions/blob/v1.26.0/docs/cloud-providers/aws-sdk.md#common-attributes. +* Added `rpc.system`, `rpc.service`, and `rpc.method` to activity tags based on + [semantic convention v1.26.0](https://github.com/open-telemetry/semantic-conventions/blob/v1.26.0/docs/cloud-providers/aws-sdk.md#common-attributes). + ([#1865](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1865)) ([#1865](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1865)) ## 1.1.0-beta.4 From cbf5fe3d8a80c59f28834641809fa2f544ffdc1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Wed, 12 Jun 2024 06:42:44 +0200 Subject: [PATCH 5/6] Update src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md --- src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md index 7f22601964..9c597a20f7 100644 --- a/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md @@ -4,7 +4,6 @@ * Added `rpc.system`, `rpc.service`, and `rpc.method` to activity tags based on [semantic convention v1.26.0](https://github.com/open-telemetry/semantic-conventions/blob/v1.26.0/docs/cloud-providers/aws-sdk.md#common-attributes). ([#1865](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1865)) - ([#1865](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1865)) ## 1.1.0-beta.4 From fc38dd1231e81721b453006abc27f464b006344e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Wed, 12 Jun 2024 06:47:29 +0200 Subject: [PATCH 6/6] fix lint md --- src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md index 9c597a20f7..a8de77fcd7 100644 --- a/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog - OpenTelemetry.Instrumentation.AWS ## Unreleased + * Added `rpc.system`, `rpc.service`, and `rpc.method` to activity tags based on [semantic convention v1.26.0](https://github.com/open-telemetry/semantic-conventions/blob/v1.26.0/docs/cloud-providers/aws-sdk.md#common-attributes). ([#1865](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1865))