From f055242c4b15a84e40fa817cdf53699e91677220 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 31 Aug 2023 11:12:47 -0700 Subject: [PATCH 1/4] Update AWS detector semconv --- CHANGELOG.md | 7 +++++++ detectors/aws/ec2/ec2.go | 2 +- detectors/aws/ec2/ec2_test.go | 2 +- detectors/aws/ecs/ecs.go | 2 +- detectors/aws/ecs/ecs_test.go | 2 +- detectors/aws/ecs/test/ecs_test.go | 2 +- detectors/aws/eks/detector.go | 2 +- detectors/aws/eks/detector_test.go | 2 +- detectors/aws/lambda/detector.go | 2 +- detectors/aws/lambda/detector_test.go | 2 +- 10 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8514fa343ab..0a5c3efe449 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add the new `go.opentelemetry.io/contrib/instrgen` package to provide auto-generated source code instrumentation. (#3068, #3108) +### Changed + +- The semantic conventions used by `go.opentelemetry.io/contrib/detectors/aws/ec2` have been upgraded to v1.21.0. (#TBD) +- The semantic conventions used by `go.opentelemetry.io/contrib/detectors/aws/ecs` have been upgraded to v1.21.0. (#TBD) +- The semantic conventions used by `go.opentelemetry.io/contrib/detectors/aws/eks` have been upgraded to v1.21.0. (#TBD) +- The semantic conventions used by `go.opentelemetry.io/contrib/detectors/aws/lambda` have been upgraded to v1.21.0. (#TBD) + ## [1.18.0/0.43.0/0.12.0] - 2023-08-28 ### Added diff --git a/detectors/aws/ec2/ec2.go b/detectors/aws/ec2/ec2.go index 91bdc19e8a2..f0c10c3218f 100644 --- a/detectors/aws/ec2/ec2.go +++ b/detectors/aws/ec2/ec2.go @@ -25,7 +25,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) type config struct { diff --git a/detectors/aws/ec2/ec2_test.go b/detectors/aws/ec2/ec2_test.go index e9f881e3640..b489ebeef1d 100644 --- a/detectors/aws/ec2/ec2_test.go +++ b/detectors/aws/ec2/ec2_test.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) func TestAWS_Detect(t *testing.T) { diff --git a/detectors/aws/ecs/ecs.go b/detectors/aws/ecs/ecs.go index 8063c01e46b..c1782d026f5 100644 --- a/detectors/aws/ecs/ecs.go +++ b/detectors/aws/ecs/ecs.go @@ -27,7 +27,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) const ( diff --git a/detectors/aws/ecs/ecs_test.go b/detectors/aws/ecs/ecs_test.go index fe4624a6932..01ee209424a 100644 --- a/detectors/aws/ecs/ecs_test.go +++ b/detectors/aws/ecs/ecs_test.go @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" metadata "github.com/brunoscheufler/aws-ecs-metadata-go" "github.com/stretchr/testify/assert" diff --git a/detectors/aws/ecs/test/ecs_test.go b/detectors/aws/ecs/test/ecs_test.go index 8611ab9ffa1..090e4f83b84 100644 --- a/detectors/aws/ecs/test/ecs_test.go +++ b/detectors/aws/ecs/test/ecs_test.go @@ -25,7 +25,7 @@ import ( ecs "go.opentelemetry.io/contrib/detectors/aws/ecs" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "github.com/stretchr/testify/assert" ) diff --git a/detectors/aws/eks/detector.go b/detectors/aws/eks/detector.go index b5e0dba83a6..653707506f2 100644 --- a/detectors/aws/eks/detector.go +++ b/detectors/aws/eks/detector.go @@ -27,7 +27,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) const ( diff --git a/detectors/aws/eks/detector_test.go b/detectors/aws/eks/detector_test.go index 5dd64098a1d..c6fcd45e315 100644 --- a/detectors/aws/eks/detector_test.go +++ b/detectors/aws/eks/detector_test.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) type MockDetectorUtils struct { diff --git a/detectors/aws/lambda/detector.go b/detectors/aws/lambda/detector.go index bad46d27d2e..73a3357f9e3 100644 --- a/detectors/aws/lambda/detector.go +++ b/detectors/aws/lambda/detector.go @@ -22,7 +22,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) // For a complete list of reserved environment variables in Lambda, see: diff --git a/detectors/aws/lambda/detector_test.go b/detectors/aws/lambda/detector_test.go index 77c636ac2ba..8d45f7ceb96 100644 --- a/detectors/aws/lambda/detector_test.go +++ b/detectors/aws/lambda/detector_test.go @@ -23,7 +23,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) // successfully return resource when process is running on Amazon Lambda environment. From e701e3332b61ed87dc853e85577ebbd7f7f82978 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 31 Aug 2023 11:14:23 -0700 Subject: [PATCH 2/4] Update PR number --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a5c3efe449..d35d8fb1727 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,10 +14,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed -- The semantic conventions used by `go.opentelemetry.io/contrib/detectors/aws/ec2` have been upgraded to v1.21.0. (#TBD) -- The semantic conventions used by `go.opentelemetry.io/contrib/detectors/aws/ecs` have been upgraded to v1.21.0. (#TBD) -- The semantic conventions used by `go.opentelemetry.io/contrib/detectors/aws/eks` have been upgraded to v1.21.0. (#TBD) -- The semantic conventions used by `go.opentelemetry.io/contrib/detectors/aws/lambda` have been upgraded to v1.21.0. (#TBD) +- The semantic conventions used by `go.opentelemetry.io/contrib/detectors/aws/ec2` have been upgraded to v1.21.0. (#4265) +- The semantic conventions used by `go.opentelemetry.io/contrib/detectors/aws/ecs` have been upgraded to v1.21.0. (#4265) +- The semantic conventions used by `go.opentelemetry.io/contrib/detectors/aws/eks` have been upgraded to v1.21.0. (#4265) +- The semantic conventions used by `go.opentelemetry.io/contrib/detectors/aws/lambda` have been upgraded to v1.21.0. (#4265) ## [1.18.0/0.43.0/0.12.0] - 2023-08-28 From aa32d199457bd5ecc8e83e68fd3086050d63fa5b Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 31 Aug 2023 11:30:17 -0700 Subject: [PATCH 3/4] Upgrade otellambda semconv --- CHANGELOG.md | 3 +++ .../github.com/aws/aws-lambda-go/otellambda/lambda.go | 6 +++--- .../aws/aws-lambda-go/otellambda/test/lambda_test.go | 10 +++++----- .../otellambda/xrayconfig/xrayconfig_test.go | 4 ++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d35d8fb1727..e1ffd1c9b5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The semantic conventions used by `go.opentelemetry.io/contrib/detectors/aws/ecs` have been upgraded to v1.21.0. (#4265) - The semantic conventions used by `go.opentelemetry.io/contrib/detectors/aws/eks` have been upgraded to v1.21.0. (#4265) - The semantic conventions used by `go.opentelemetry.io/contrib/detectors/aws/lambda` have been upgraded to v1.21.0. (#4265) +- The semantic conventions used by `go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda` have been upgraded to v1.21.0. (#4265) + - The `faas.execution` attribute is now `faas.invocation_id`. + - The `faas.id` attribute is now `aws.lambda.invoked_arn`. ## [1.18.0/0.43.0/0.12.0] - 2023-08-28 diff --git a/instrumentation/github.com/aws/aws-lambda-go/otellambda/lambda.go b/instrumentation/github.com/aws/aws-lambda-go/otellambda/lambda.go index 35ee635d08e..b08c6813b88 100644 --- a/instrumentation/github.com/aws/aws-lambda-go/otellambda/lambda.go +++ b/instrumentation/github.com/aws/aws-lambda-go/otellambda/lambda.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) @@ -72,7 +72,7 @@ func (i *instrumentor) tracingBegin(ctx context.Context, eventJSON []byte) (cont } if lc != nil { ctxRequestID := lc.AwsRequestID - attributes = append(attributes, semconv.FaaSExecution(ctxRequestID)) + attributes = append(attributes, semconv.FaaSInvocationID(ctxRequestID)) // Some resource attrs added as span attrs because lambda // resource detectors are created before a lambda @@ -80,7 +80,7 @@ func (i *instrumentor) tracingBegin(ctx context.Context, eventJSON []byte) (cont // Create these attrs upon first invocation if len(i.resAttrs) == 0 { ctxFunctionArn := lc.InvokedFunctionArn - attributes = append(attributes, semconv.FaaSID(ctxFunctionArn)) + attributes = append(attributes, semconv.AWSLambdaInvokedARN(ctxFunctionArn)) arnParts := strings.Split(ctxFunctionArn, ":") if len(arnParts) >= 5 { attributes = append(attributes, semconv.CloudAccountID(arnParts[4])) diff --git a/instrumentation/github.com/aws/aws-lambda-go/otellambda/test/lambda_test.go b/instrumentation/github.com/aws/aws-lambda-go/otellambda/test/lambda_test.go index b6734b1ca4b..e1cb7d2d3d1 100644 --- a/instrumentation/github.com/aws/aws-lambda-go/otellambda/test/lambda_test.go +++ b/instrumentation/github.com/aws/aws-lambda-go/otellambda/test/lambda_test.go @@ -40,7 +40,7 @@ import ( "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) @@ -136,8 +136,8 @@ var ( SpanKind: trace.SpanKindServer, StartTime: time.Time{}, EndTime: time.Time{}, - Attributes: []attribute.KeyValue{attribute.String("faas.execution", "123"), - attribute.String("faas.id", "arn:partition:service:region:account-id:resource-type:resource-id"), + Attributes: []attribute.KeyValue{attribute.String("faas.invocation_id", "123"), + attribute.String("aws.lambda.invoked_arn", "arn:partition:service:region:account-id:resource-type:resource-id"), attribute.String("cloud.account.id", "account-id")}, Events: nil, Links: nil, @@ -326,8 +326,8 @@ var ( SpanKind: trace.SpanKindServer, StartTime: time.Time{}, EndTime: time.Time{}, - Attributes: []attribute.KeyValue{attribute.String("faas.execution", "123"), - attribute.String("faas.id", "arn:partition:service:region:account-id:resource-type:resource-id"), + Attributes: []attribute.KeyValue{attribute.String("faas.invocation_id", "123"), + attribute.String("aws.lambda.invoked_arn", "arn:partition:service:region:account-id:resource-type:resource-id"), attribute.String("cloud.account.id", "account-id")}, Events: nil, Links: nil, diff --git a/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/xrayconfig_test.go b/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/xrayconfig_test.go index 2965fa07113..b32080f0ce7 100644 --- a/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/xrayconfig_test.go +++ b/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/xrayconfig_test.go @@ -102,8 +102,8 @@ var ( Kind: v1trace.Span_SPAN_KIND_SERVER, StartTimeUnixNano: 0, EndTimeUnixNano: 0, - Attributes: []*v1common.KeyValue{{Key: "faas.execution", Value: &v1common.AnyValue{Value: &v1common.AnyValue_StringValue{StringValue: "123"}}}, - {Key: "faas.id", Value: &v1common.AnyValue{Value: &v1common.AnyValue_StringValue{StringValue: "arn:partition:service:region:account-id:resource-type:resource-id"}}}, + Attributes: []*v1common.KeyValue{{Key: "faas.invocation_id", Value: &v1common.AnyValue{Value: &v1common.AnyValue_StringValue{StringValue: "123"}}}, + {Key: "aws.lambda.invoked_arn", Value: &v1common.AnyValue{Value: &v1common.AnyValue_StringValue{StringValue: "arn:partition:service:region:account-id:resource-type:resource-id"}}}, {Key: "cloud.account.id", Value: &v1common.AnyValue{Value: &v1common.AnyValue_StringValue{StringValue: "account-id"}}}}, DroppedAttributesCount: 0, Events: nil, From 1b7eac106ac70d02d5581c9123b71e7b2d99fb95 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 31 Aug 2023 11:52:59 -0700 Subject: [PATCH 4/4] Upgrade otelaws --- CHANGELOG.md | 1 + .../github.com/aws/aws-sdk-go-v2/otelaws/attributes.go | 2 +- .../github.com/aws/aws-sdk-go-v2/otelaws/attributes_test.go | 2 +- instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/aws.go | 2 +- .../github.com/aws/aws-sdk-go-v2/otelaws/dynamodbattributes.go | 2 +- .../github.com/aws/aws-sdk-go-v2/otelaws/sqsattributes.go | 2 +- .../github.com/aws/aws-sdk-go-v2/otelaws/sqsattributes_test.go | 2 +- 7 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1ffd1c9b5e..9d75fef1a85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The semantic conventions used by `go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda` have been upgraded to v1.21.0. (#4265) - The `faas.execution` attribute is now `faas.invocation_id`. - The `faas.id` attribute is now `aws.lambda.invoked_arn`. +- The semantic conventions used by `go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws` have been upgraded to v1.21.0. (#4265) ## [1.18.0/0.43.0/0.12.0] - 2023-08-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 bfe74ca6b86..a233b73a433 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 @@ -23,7 +23,7 @@ import ( "github.com/aws/smithy-go/middleware" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) // AWS attributes. diff --git a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/attributes_test.go b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/attributes_test.go index 455be3d9aef..abc0f4bd208 100644 --- a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/attributes_test.go +++ b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/attributes_test.go @@ -20,7 +20,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) func TestOperationAttr(t *testing.T) { diff --git a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/aws.go b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/aws.go index be38e05006d..7889c827963 100644 --- a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/aws.go +++ b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/aws.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/propagation" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) 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 6f37605b48a..6fe93b8b199 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 @@ -22,7 +22,7 @@ import ( "github.com/aws/smithy-go/middleware" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) // DynamoDBAttributeSetter sets DynamoDB specific attributes depending on the DynamoDB operation being performed. diff --git a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/sqsattributes.go b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/sqsattributes.go index 585485a2d13..0be72658388 100644 --- a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/sqsattributes.go +++ b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/sqsattributes.go @@ -21,7 +21,7 @@ import ( "github.com/aws/smithy-go/middleware" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) // SQSAttributeSetter sets SQS specific attributes depending on the SQS operation being performed. diff --git a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/sqsattributes_test.go b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/sqsattributes_test.go index 1ae348b7ebb..c6599543237 100644 --- a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/sqsattributes_test.go +++ b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/sqsattributes_test.go @@ -23,7 +23,7 @@ import ( "github.com/aws/smithy-go/middleware" "github.com/stretchr/testify/assert" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) func TestSQSDeleteMessageBatchInput(t *testing.T) {