Skip to content

Conversation

lukeina2z
Copy link
Contributor

Description

This PR adds support for the AWS_LAMBDA_RESOURCE_MAPPING_ID semantic convention attribute in the AWS Lambda SDK instrumentation library.

https://github.com/open-telemetry/semantic-conventions/blob/main/docs/registry/attributes/aws.md#amazon-lambda-attributes

It also introduces the following two experimental attributes. Work is currently underway to add these keys to the AWS section of the Semantic Conventions registry:

aws.lambda.function.arn
aws.lambda.function.name

Name is extracted from request object.
ARN is extracted from response object.
Resource Mapping ID is extracted from both request and response objects. This behavior is covered by unit tests.

Backward Compatibility
This change is backward compatible. It only adds instrumentation for additional AWS resources and does not modify existing behavior in the auto-instrumentation library.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Added new unit tests (passing).

Verified with:
tox -e py312-test-instrumentation-botocore
tox -e spellcheck
tox -e lint-instrumentation-botocore
tox -e ruff

Does This PR Require a Core Repo Change?

  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

…S Lambda SDK

This PR adds support for the AWS_LAMBDA_RESOURCE_MAPPING_ID semantic convention attribute in the AWS Lambda SDK instrumentation library.

https://github.com/open-telemetry/semantic-conventions/blob/main/docs/registry/attributes/aws.md#amazon-lambda-attributes

It also introduces the following two experimental attributes. Work is currently underway to add these keys to the AWS section of the Semantic Conventions registry:

aws.lambda.function.arn
aws.lambda.function.name

Name is extracted from request object.
ARN is extracted from response object.
Resource Mapping ID is extracted from both request and response objects. This behavior is covered by unit tests.

Tests
Added new unit tests (passing).

Verified with:
tox -e py312-test-instrumentation-botocore
tox -e spellcheck
tox -e lint-instrumentation-botocore
tox -e ruff

Backward Compatibility
This change is backward compatible. It only adds instrumentation for additional AWS resources and does not modify existing behavior in the auto-instrumentation library.
@lukeina2z lukeina2z changed the title Add AWS_LAMBDA_RESOURCE_MAPPING_ID Semantic Convention Support for AWS Lambda SDK botocore: Add AWS_LAMBDA_RESOURCE_MAPPING_ID Semantic Convention Support for AWS Lambda SDK Sep 30, 2025
@lukeina2z lukeina2z requested a review from a team as a code owner September 30, 2025 22:50
@xrmx
Copy link
Contributor

xrmx commented Oct 1, 2025

@lukeina2z @yiyuan-he thanks for your PRs and reviews, what do you think on being listed as component owner for the botocore instrumentation since you seem to have an interest in it?

@yiyuan-he
Copy link

@xrmx Thanks Riccardo, I'd be happy come onboard as a component owner!

@lukeina2z
Copy link
Contributor Author

@lukeina2z @yiyuan-he thanks for your PRs and reviews, what do you think on being listed as component owner for the botocore instrumentation since you seem to have an interest in it?

I am happy to contribute. Let's move forward.

@xrmx xrmx moved this to Ready for review in @xrmx's Python PR digest Oct 3, 2025
@xrmx
Copy link
Contributor

xrmx commented Oct 3, 2025

@lukeina2z @yiyuan-he thanks for your PRs and reviews, what do you think on being listed as component owner for the botocore instrumentation since you seem to have an interest in it?

I am happy to contribute. Let's move forward.

Thanks, please approve #3806

Copy link

@yiyuan-he yiyuan-he left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +27 to +28
- `opentelemetry-exporter-credential-provider-gcp`: create this package which provides support for supplying your machine's Application Default Credentials (https://cloud.google.com/docs/authentication/application-default-credentials) to the OTLP Exporters created automatically by OpenTelemetry Python's auto instrumentation. These credentials authorize OTLP traces to be sent to `telemetry.googleapis.com`.
[#3766](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3766).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `opentelemetry-exporter-credential-provider-gcp`: create this package which provides support for supplying your machine's Application Default Credentials (https://cloud.google.com/docs/authentication/application-default-credentials) to the OTLP Exporters created automatically by OpenTelemetry Python's auto instrumentation. These credentials authorize OTLP traces to be sent to `telemetry.googleapis.com`.
[#3766](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3766).

from opentelemetry.trace.span import Span

# Work is underway to add these two keys to the SemConv AWS registry, in line with other AWS resources.
# https://github.com/open-telemetry/semantic-conventions/blob/main/docs/registry/attributes/aws.md#amazon-lambda-attributes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually don't add attributes before they're added to semconv, do you want to wait for these to get there or move the usage of these attributes to another PR?

return function_name_or_arn if function_name is None else function_name
if function_name_or_arn is None:
return None
matches = _OpInvoke.ARN_LAMBDA_PATTERN.match(function_name_or_arn)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why you are moving to a staticmethod while still referencing class attributes but not an issue for me 😅

@xrmx xrmx moved this from Ready for review to Reviewed PRs that need fixes in @xrmx's Python PR digest Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Reviewed PRs that need fixes

Development

Successfully merging this pull request may close these issues.

3 participants