Skip to content

Commit

Permalink
Upgrade otellambda semconv
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlias committed Aug 31, 2023
1 parent e701e33 commit 0759492
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ 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)

## [1.18.0/0.43.0/0.12.0] - 2023-08-28

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -72,15 +72,15 @@ 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
// invocation and therefore lack lambdacontext.
// 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]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down

0 comments on commit 0759492

Please sign in to comment.