opentelemetry-sdk: add experimental composable rule based sampler by xrmx · Pull Request #4882 · open-telemetry/opentelemetry-python

@xrmx

@xrmx

@xrmx xrmx mentioned this pull request

Jan 19, 2026

@xrmx

anuraaga

xrmx and others added 3 commits

January 20, 2026 09:49
…mental/_rule_based.py

Co-authored-by: Anuraag (Rag) Agrawal <anuraaga@gmail.com>
…t_description

While at it also provide AttributePredicate

anuraaga

herin049

@xrmx

@xrmx

tammy-baylis-swi

tammy-baylis-swi

@xrmx

tammy-baylis-swi

@xrmx xrmx enabled auto-merge (squash)

February 10, 2026 16:24

@xrmx

JWinermaSplunk pushed a commit to JWinermaSplunk/opentelemetry-python that referenced this pull request

Feb 17, 2026
…en-telemetry#4882)

* opentelemetry-sdk: add experimental composable rule based sampler

* Add CHANGELOG

* Use a protocol for PredicateT

* Update opentelemetry-sdk/src/opentelemetry/sdk/trace/_sampling_experimental/_rule_based.py

Co-authored-by: Anuraag (Rag) Agrawal <anuraaga@gmail.com>

* Extend Predicate protocol to require __str__ and use it on sampler get_description

While at it also provide AttributePredicate

* Use a generator for getting predicates and descriptions

* Add tests that matches with more than one rule

---------

Co-authored-by: Anuraag (Rag) Agrawal <anuraaga@gmail.com>