-
Notifications
You must be signed in to change notification settings - Fork 469
feat(tracer): Add support for OpenTelemetry #7949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds OpenTelemetry support to AWS Lambda Powertools, introducing a new TracerOpenTelemetry class that provides distributed tracing using the OpenTelemetry SDK. The implementation follows Powertools conventions while offering flexibility through two modes: "auto" mode for use with the ADOT Lambda Layer, and "manual" mode for custom TracerProvider configurations.
Changes:
- Introduced
TracerOpenTelemetryclass with support for both auto and manual modes - Added context propagation helpers for SQS message tracing
- Created comprehensive unit, functional, and E2E test suites with 30+ test cases
- Added detailed documentation with examples for various use cases
- Updated dependencies to include OpenTelemetry packages as optional extras
Reviewed changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
aws_lambda_powertools/tracing/otel/tracer.py |
Core OpenTelemetry tracer implementation with decorators for Lambda handlers and methods |
aws_lambda_powertools/tracing/otel/propagation.py |
Context propagation utilities for distributed tracing across services |
aws_lambda_powertools/tracing/otel/__init__.py |
Module initialization and exports |
tests/unit/tracing/otel/test_tracer_otel.py |
Comprehensive unit tests covering initialization, decorators, and edge cases |
tests/functional/tracing/otel/test_tracer_otel.py |
Functional tests with real OpenTelemetry SDK integration |
tests/e2e/tracer_otel/test_tracer_otel.py |
End-to-end test scaffolding for ADOT Layer integration |
tests/e2e/tracer_otel/infrastructure.py |
CDK infrastructure for E2E tests |
tests/e2e/tracer_otel/handlers/*.py |
Sample Lambda handlers for E2E testing |
docs/core/tracer-otel.md |
Comprehensive documentation covering features, usage, and API reference |
mkdocs.yml |
Navigation structure updated to include OpenTelemetry tracer documentation |
examples/tracer_otel/src/*.py |
Example code demonstrating various tracer features |
pyproject.toml |
Added OpenTelemetry dependencies as optional extras under "otel" group |
poetry.lock |
Lock file updated with new OpenTelemetry dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if self._tracer is None: | ||
| self._tracer = self.provider.get_tracer( | ||
| instrumenting_module_name="aws_lambda_powertools", | ||
| instrumenting_library_version="1.0.0", |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The instrumenting_library_version is hardcoded to "1.0.0". This should use the actual library version from aws_lambda_powertools.shared.version.VERSION to accurately represent the Powertools library version in traces.
|



Issue number: closes #
Summary
Related RFC: aws-powertools/powertools-lambda#90
Changes
WIP
User experience
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.