Skip to content

Commit

Permalink
Use ResourceAttributes.CLOUD_ACCOUNT_ID
Browse files Browse the repository at this point in the history
  • Loading branch information
tammy-baylis-swi committed Mar 21, 2024
1 parent f3421b6 commit 7f8194a
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def custom_event_context_extractor(lambda_event):
TRACE_HEADER_KEY,
AwsXRayPropagator,
)
from opentelemetry.semconv.resource import ResourceAttributes
from opentelemetry.semconv.trace import SpanAttributes
from opentelemetry.trace import (
Span,
Expand Down Expand Up @@ -358,11 +359,8 @@ def _instrumented_lambda_handler_call( # noqa pylint: disable=too-many-branches
# See more:
# https://github.com/open-telemetry/semantic-conventions/blob/main/docs/faas/aws-lambda.md#all-triggers
account_id = lambda_context.invoked_function_arn.split(":")[4]

# TODO: Update key with semconvgen 1.23.0
# https://github.com/open-telemetry/semantic-conventions/issues/551
span.set_attribute(
"cloud.account.id",
ResourceAttributes.CLOUD_ACCOUNT_ID,
account_id,
)

Expand Down

0 comments on commit 7f8194a

Please sign in to comment.