-
Notifications
You must be signed in to change notification settings - Fork 751
Add experimental composite sampler #4714
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
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.
Added a bunch of comments, I have yet to review the PR after looking at the doc here
https://opentelemetry.io/docs/specs/otel/trace/tracestate-probability-sampling/
opentelemetry-sdk/src/opentelemetry/sdk/trace/_sampling_experimental/__init__.py
Show resolved
Hide resolved
opentelemetry-sdk/src/opentelemetry/sdk/trace/_sampling_experimental/_always_off.py
Outdated
Show resolved
Hide resolved
opentelemetry-sdk/src/opentelemetry/sdk/trace/_sampling_experimental/_fixed_threshold.py
Outdated
Show resolved
Hide resolved
opentelemetry-sdk/src/opentelemetry/sdk/trace/_sampling_experimental/_sampler.py
Show resolved
Hide resolved
opentelemetry-sdk/src/opentelemetry/sdk/trace/_sampling_experimental/_parent_based.py
Outdated
Show resolved
Hide resolved
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.
Thanks all. Actually I had realized while I was looking at the tracestate handling section of the spec, I completely missed the SDK portions... So I have compared with that and renamed things to match it. Notably, the word consistent isn't used much and the concept seems to composite sampling.
One note is I made an editorial decision on the public API - one thing I noticed with the sampling.py one is some samplers are constants, others are classes, which seemed inconsistent. Here I hid all the classes and only expose functions to be able to use singleton or not as needed with a consistent surface. Happy to go with anything the maintainers prefer though.
opentelemetry-sdk/src/opentelemetry/sdk/trace/_sampling_experimental/_composable.py
Show resolved
Hide resolved
opentelemetry-sdk/src/opentelemetry/sdk/trace/_sampling_experimental/_trace_state.py
Show resolved
Hide resolved
opentelemetry-sdk/src/opentelemetry/sdk/trace/_sampling_experimental/_traceid_ratio.py
Show resolved
Hide resolved
Thanks @tammy-baylis-swi sorry for missing that - ran formatting |
This is a reopening of open-telemetry/opentelemetry-python-contrib#3668 as was recommended to target this repo.
Looking at some other similar
_
exports for experimental features, they seem to be complete concepts (i.e. logs), while this is a type of an existing concept, sampler. So I tried the_sampling_experimental
name to clarify that it is an experimental part of sampling. Let me know any thoughts.Description
Adds an implementation of consistent samplers
https://opentelemetry.io/docs/specs/otel/trace/tracestate-probability-sampling/
https://opentelemetry.io/docs/specs/otel/trace/sdk/#built-in-composablesamplers
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
TraceState
)/cc @xrmx @tammy-baylis-swi
/cc @PeterF778 as original author in Java if interested
Type of change
How Has This Been Tested?
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.