Skip to content

feat(tracer): add OpenTelemetryProvider implementation (#7003) - #8366

Open
Alwaysgaurav1 wants to merge 3 commits into
aws-powertools:developfrom
Alwaysgaurav1:feature/opentelemetry-provider
Open

Alwaysgaurav1 wants to merge 3 commits into
aws-powertools:developfrom
Alwaysgaurav1:feature/opentelemetry-provider

Conversation

@Alwaysgaurav1

@Alwaysgaurav1 Alwaysgaurav1 commented Aug 5, 2026

Copy link
Copy Markdown

Issue number: closes #7003

Summary

Changes

  • Implemented OpenTelemetrySegment and OpenTelemetryProvider in aws_lambda_powertools.tracing.opentelemetry.
  • Exported OpenTelemetryProvider and OpenTelemetrySegment from aws_lambda_powertools.tracing.
  • Added unit tests covering segment attribute set, exception recording, subsegment context managers, and Tracer decorator integration in tests/unit/test_opentelemetry.py.

User experience

Users can now pass an OpenTelemetryProvider to Tracer to send trace data to OpenTelemetry backends:

from aws_lambda_powertools import Tracer
from aws_lambda_powertools.tracing import OpenTelemetryProvider

provider = OpenTelemetryProvider()
tracer = Tracer(service="my-service", provider=provider)

@tracer.capture_method
def handler(event, context):
    return "ok"

@Alwaysgaurav1
Alwaysgaurav1 requested a review from a team as a code owner August 5, 2026 10:30
@Alwaysgaurav1
Alwaysgaurav1 requested a review from hjgraca August 5, 2026 10:30
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 5, 2026
@boring-cyborg boring-cyborg Bot added tests tracer Tracer utility labels Aug 5, 2026
@boring-cyborg

boring-cyborg Bot commented Aug 5, 2026

Copy link
Copy Markdown

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@Alwaysgaurav1 Alwaysgaurav1 removed their assignment Aug 5, 2026
@powertools-for-aws-oss-automation

Copy link
Copy Markdown

No acknowledgement section found. Please make sure you used the template to open a PR and didn't remove the acknowledgment section. Check the template at .github/PULL_REQUEST_TEMPLATE.md#acknowledgment

@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tests tracer Tracer utility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: OpenTelemetry Support

1 participant