Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Instrumentation.AWS] Update AWS SDK Activity Tags (#1857) #1865

Merged
merged 7 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog - OpenTelemetry.Instrumentation.AWS

## Unreleased

Check failure on line 3 in src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md

View workflow job for this annotation

GitHub Actions / lint-md / run-markdownlint

Headings should be surrounded by blank lines

src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md:3 MD022/blanks-around-headings Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## Unreleased"] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md022.md
Kielek marked this conversation as resolved.
Show resolved Hide resolved
* Added `rpc.system`, `rpc.service`, and `rpc.method` to activity tags based on

Check failure on line 4 in src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md

View workflow job for this annotation

GitHub Actions / lint-md / run-markdownlint

Lists should be surrounded by blank lines

src/OpenTelemetry.Instrumentation.AWS/CHANGELOG.md:4 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "* Added `rpc.system`, `rpc.ser..."] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md032.md
[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))

## 1.1.0-beta.4

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ private static string FetchRequestId(IRequestContext requestContext, IResponseCo
{
activity.SetTag(AWSSemanticConventions.AttributeAWSServiceName, service);
activity.SetTag(AWSSemanticConventions.AttributeAWSOperationName, operation);

// 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);
var client = executionContext.RequestContext.ClientConfig;
if (client != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,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)
Expand All @@ -226,5 +229,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"));
}
}
Loading