Skip to content

Add rule based sampler#1096

Merged
seemk merged 3 commits intomainfrom
rule-based-sampler
Mar 18, 2026
Merged

Add rule based sampler#1096
seemk merged 3 commits intomainfrom
rule-based-sampler

Conversation

@t2t2
Copy link
Contributor

@t2t2 t2t2 commented Mar 17, 2026

Basically a port of java's implementation (including basically copy-paste of java's documentation). When running tests http instrumentation seems to still use the old semconv (sfx app makes it so both attributes show up), so the checks use both old and new attribute names.

Composite Sampler is quite a new package so 🙏

@t2t2 t2t2 requested review from a team as code owners March 17, 2026 17:50

if (configSampler === undefined) {
if (getNonEmptyEnvVar('OTEL_TRACES_SAMPLER') === undefined) {
const envSampler = getNonEmptyEnvVar('OTEL_TRACES_SAMPLER');
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the rule based sampler be configurable via the config file?

  • can it be passed in via programmatic API?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

config file: Probably better to then fully support composite/development sampler

// TODO: Should composite/development be supported?

unclear if in scope for now

programmattic API: User can compose it by using @opentelemetry/sampler-composite package directly

@seemk seemk merged commit f67eb1d into main Mar 18, 2026
187 of 188 checks passed
@seemk seemk deleted the rule-based-sampler branch March 18, 2026 14:06
@github-actions github-actions bot locked and limited conversation to collaborators Mar 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants