Skip to content

AWS X-Ray Remote Sampler Part 1 - Initial Classes and Rules Poller Implementation#3366

Merged
xrmx merged 23 commits intoopen-telemetry:mainfrom
jj22ee:xray-sampler-pr0
Aug 25, 2025
Merged

AWS X-Ray Remote Sampler Part 1 - Initial Classes and Rules Poller Implementation#3366
xrmx merged 23 commits intoopen-telemetry:mainfrom
jj22ee:xray-sampler-pr0

Conversation

@jj22ee
Copy link
Copy Markdown
Contributor

@jj22ee jj22ee commented Mar 15, 2025

Description

This is an initial PR to address #3305 in order for OTel Python to support X-Ray Remote Sampling. A series of PRs to fully implement this feature will follow.

Changes:

  • Add xray sampler under opentelemetry-sdk-extension-aws
  • Code changes:
    • Add Sampling Client class to communicate with X-Ray Service for Sampling Rules/Targets
    • Add X-Ray Sampling Rules/Targets/Statistics class to help represent the Sampling related data from X-Ray
    • Added the AwsXRayRemoteSampler skeleton class
      • Ensure AwsXRayRemoteSampler is a ParentBased Sampler, with internal logic inside _AWSXRayRemoteSampler
      • Run poller upon instantiation to regularly obtain X-Ray Sampling Rules from X-Ray

Type of change

Please delete options that are not relevant.

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

How Has This Been Tested?

This PR is not a full implementation of the sampler, so it cannot be tested for correct functionality.
Right now, it currently always return a Parent Based decision or a DROP decision as a placeholder.

  • Unit Tests

A couple more PRs will follow-up to complete the implementation, which should look like this Sampler code from the AWS ADOT repo. At that point in the future, a full E2E integration test will be run.

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

@jj22ee jj22ee requested a review from a team as a code owner March 15, 2025 12:31
@jj22ee jj22ee removed their assignment Mar 16, 2025
@xrmx
Copy link
Copy Markdown
Contributor

xrmx commented Mar 17, 2025

@jj22ee
Copy link
Copy Markdown
Contributor Author

jj22ee commented Mar 18, 2025

Yeah that makes sense, opentelemetry-sdk-extension-aws seems to hold all aws components... except the AWS XRay Propagator that I based my work off of...

I synced with package owner @srprash, there is no concern with moving this Sampler to the SDK Extensions.

@jj22ee jj22ee removed their assignment Mar 19, 2025
Copy link
Copy Markdown

@srprash srprash left a comment

Choose a reason for hiding this comment

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

Minor comments. Overall LGTM.

Comment thread .github/component_owners.yml Outdated
@jj22ee
Copy link
Copy Markdown
Contributor Author

jj22ee commented Apr 29, 2025

@xrmx looking for approval from maintainers, the PR has component owner approval.

Comment thread sdk-extension/opentelemetry-sdk-extension-aws/README.rst Outdated
Comment thread sdk-extension/opentelemetry-sdk-extension-aws/pyproject.toml
@jj22ee
Copy link
Copy Markdown
Contributor Author

jj22ee commented Jun 4, 2025

@xrmx Since this is a partial implementation, what is a good way to hide this new AwsXRayRemoteSampler class from users? Can I give it a dummy name or just prefix it with an underscore until the implementation is complete?

@jj22ee
Copy link
Copy Markdown
Contributor Author

jj22ee commented Jun 17, 2025

@xrmx @srprash Since the sampler is currently partially implemented, I've renamed the 2 X-Ray Sampler classes to be marked as internal for now via the following changes:

  • _AwsXRayRemoteSampler -> _InternalAwsXRayRemoteSampler
  • AwsXRayRemoteSampler -> _AwsXRayRemoteSampler

When the implementation is complete, I will rename _AwsXRayRemoteSampler back to AwsXRayRemoteSampler.
Can this PR be merged?

@xrmx xrmx moved this to Ready for review in Python PR digest Jun 24, 2025
Comment thread sdk-extension/opentelemetry-sdk-extension-aws/README.rst Outdated
Comment thread .github/component_owners.yml
Comment thread .github/component_owners.yml Outdated
@jj22ee
Copy link
Copy Markdown
Contributor Author

jj22ee commented Aug 4, 2025

@xrmx Looking for merge! Planning the submit one more PR after this to complete the implementation.

@xrmx xrmx merged commit 032d6c6 into open-telemetry:main Aug 25, 2025
1195 of 1198 checks passed
@github-project-automation github-project-automation Bot moved this from Ready for review to Done in Python PR digest Aug 25, 2025
sightseeker added a commit to sightseeker/opentelemetry-python-contrib that referenced this pull request Mar 11, 2026
…plementation (open-telemetry#3366)

* remote sampling - initial classes and rules poller

* run generate-workflows and ruff

* add component owner for aws sampler, run lint

* move sampler into aws sdk-extensions

* move sampler tests to trace dir, update otel api/sdk deps, update changelog

* move mock_clock into tests dir

* update component owners for sdk-extension-aws

* ruff and lint

* address comments

* make sampler implementation internal until completion, update tests to not make http requests

* remove use of Optional, restore README of the package

* remove unused clock and client_id

* Update component_owners.yml

* Update CHANGELOG.md

---------

Co-authored-by: Riccardo Magliocchetti <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants