From 6c127abd8d9c4768d1d3a83f65458139919b1173 Mon Sep 17 00:00:00 2001 From: Natanael Oliva Date: Fri, 13 May 2022 15:50:12 +0100 Subject: [PATCH] Fixed issue #2260 where attributes for DynamoDB were not added because of a wrong name in the servicemap. --- CHANGELOG.md | 1 + .../github.com/aws/aws-sdk-go-v2/otelaws/attributes.go | 3 ++- .../github.com/aws/aws-sdk-go-v2/otelaws/dynamodbattributes.go | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 769e5330467..7977d20bd71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm This makes `4xx` response codes to not be an error anymore. (#1973) - Fixed jaegerremote sampler not behaving properly with per operation strategy set. (#2137) - Stopped injecting propagation context into response headers in otelhttp. (#2180) +- Fix issue where attributes for DynamoDB were not added because of a string miss match. (#2272) ## [1.6.0/0.31.0] - 2022-03-28 diff --git a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/attributes.go b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/attributes.go index a18b64e1dc2..48b6a965bcf 100644 --- a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/attributes.go +++ b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/attributes.go @@ -16,6 +16,7 @@ package otelaws // import "go.opentelemetry.io/contrib/instrumentation/github.co import ( "context" + "github.com/aws/aws-sdk-go-v2/service/dynamodb" v2Middleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/smithy-go/middleware" @@ -32,7 +33,7 @@ const ( ) var servicemap = map[string]AttributeSetter{ - "dynamodb": DynamoDBAttributeSetter, + dynamodb.ServiceID: DynamoDBAttributeSetter, } func OperationAttr(operation string) attribute.KeyValue { diff --git a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/dynamodbattributes.go b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/dynamodbattributes.go index 2b4b341109d..42775d361d6 100644 --- a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/dynamodbattributes.go +++ b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/dynamodbattributes.go @@ -25,7 +25,7 @@ import ( semconv "go.opentelemetry.io/otel/semconv/v1.10.0" ) -// DynamoDBAttributeSetter sets DynamoDB specific attributes depending on the the DynamoDB operation being performed. +// DynamoDBAttributeSetter sets DynamoDB specific attributes depending on the DynamoDB operation being performed. func DynamoDBAttributeSetter(ctx context.Context, in middleware.InitializeInput) []attribute.KeyValue { dynamodbAttributes := []attribute.KeyValue{semconv.DBSystemKey.String("dynamodb")}