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, ) diff --git a/instrumentation/opentelemetry-instrumentation-aws-lambda/tests/test_aws_lambda_instrumentation_manual.py b/instrumentation/opentelemetry-instrumentation-aws-lambda/tests/test_aws_lambda_instrumentation_manual.py index 17152e6ce9..60e1357017 100644 --- a/instrumentation/opentelemetry-instrumentation-aws-lambda/tests/test_aws_lambda_instrumentation_manual.py +++ b/instrumentation/opentelemetry-instrumentation-aws-lambda/tests/test_aws_lambda_instrumentation_manual.py @@ -37,6 +37,7 @@ TRACE_ID_FIRST_PART_LENGTH, TRACE_ID_VERSION, ) +from opentelemetry.semconv.resource import ResourceAttributes from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.test.test_base import TestBase from opentelemetry.trace import NoOpTracerProvider, SpanKind, StatusCode @@ -146,7 +147,7 @@ def test_active_tracing(self): { SpanAttributes.CLOUD_RESOURCE_ID: MOCK_LAMBDA_CONTEXT.invoked_function_arn, SpanAttributes.FAAS_INVOCATION_ID: MOCK_LAMBDA_CONTEXT.aws_request_id, - "cloud.account.id": MOCK_LAMBDA_CONTEXT.invoked_function_arn.split(":")[4], + ResourceAttributes.CLOUD_ACCOUNT_ID: MOCK_LAMBDA_CONTEXT.invoked_function_arn.split(":")[4], }, )