Skip to content

Conversation

anuraaga
Copy link
Contributor

@anuraaga anuraaga commented Aug 1, 2025

Description

Adds an implementation of consistent samplers

https://opentelemetry.io/docs/specs/otel/trace/tracestate-probability-sampling/

Based on the Java implementation

https://github.com/open-telemetry/opentelemetry-java-contrib/tree/main/consistent-sampling/src/main/java/io/opentelemetry/contrib/sampler/consistent56

Some differences from Java

  • Does not add non-standard samplers for now, e.g. ratelimited, rule based
  • Some trace state validation is assumed to be done by the SDK and invalid cases aren't tested (the API doesn't accept string but SDK TraceState)

/cc @xrmx for maintainer review
/cc @PeterF778 as original author in Java if interested

Type of change

  • [C] New feature (non-breaking change which adds functionality)- [ ] This change requires a documentation update

How Has This Been Tested?

  • Unit tests

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

@anuraaga anuraaga requested a review from a team as a code owner August 1, 2025 08:49
@xrmx xrmx moved this to Ready for review in @xrmx's Python PR digest Aug 4, 2025
@tammy-baylis-swi
Copy link
Contributor

Thanks for working on this and providing those links!

The Python repos are purposed a bit differently than Java. I think this new sampler might be better in opentelemetry-python SDK trace instead, with all other existing samplers.

@anuraaga
Copy link
Contributor Author

anuraaga commented Aug 7, 2025

Thanks @tammy-baylis-swi - currently the sampler is a draft in the OTel spec so the idea is to be able to have a way to get something to try to verify and stabilize the spec. Would it still be appropriate in the main repo as a draft spec?

@tammy-baylis-swi
Copy link
Contributor

Thanks @tammy-baylis-swi - currently the sampler is a draft in the OTel spec so the idea is to be able to have a way to get something to try to verify and stabilize the spec. Would it still be appropriate in the main repo as a draft spec?

I think so, though maybe the @open-telemetry/python-maintainers should chime in on this.

We do use _ prefixing to indicate new features are not yet stable. For example, the Python Logging API is still experimental so we've put it in _logs. Maybe it could go in an SDK subdir for now like _sampler.

@anuraaga
Copy link
Contributor Author

anuraaga commented Aug 8, 2025

Thanks - I've opened a PR in the SDK repo so will close this one

open-telemetry/opentelemetry-python#4714

@anuraaga anuraaga closed this Aug 8, 2025
@github-project-automation github-project-automation bot moved this from Ready for review to Done in @xrmx's Python PR digest Aug 8, 2025
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.

2 participants