From 7f8194af0b5978061610354245b2cd809bfce014 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 21 Mar 2024 12:05:29 -0700 Subject: [PATCH] Use ResourceAttributes.CLOUD_ACCOUNT_ID --- .../opentelemetry/instrumentation/aws_lambda/__init__.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/instrumentation/opentelemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/__init__.py b/instrumentation/opentelemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/__init__.py index 95a9bf873d..8f29a0ec38 100644 --- a/instrumentation/opentelemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/__init__.py @@ -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, @@ -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, )