Skip to content

Support 'and' in RuleBasedRoutingSampler (.drop) #1896

Open
@void-spark

Description

@void-spark

Component(s)

samplers

Is your feature request related to a problem? Please describe.

Right now this sampler allows dropping based on a single attribute, like so:
RuleBasedRoutingSampler.builder(SpanKind.SERVER, fallback)
.drop(CODE_FUNCTION, "myAnnoyingMethod")
.build());

In some cases, we would want to drop on a combination of attributes.
E.g. "code.function" with "code.namespace" (from CodeAttributesExtractor).

As far as I can tell, this isn't possible with the current RuleBasedRoutingSampler.

Describe the solution you'd like

RuleBasedRoutingSampler allows dropping (or other rules/actions),
based on a set of attributes.

Hopefully some nice fluent API could be created, but I'd be happy with just a few overloaded (2arg, 4 args, 6 args),
so I can do:
blabla.drop(CODE_FUNCTION, "myAnnoyingMethod", CODE_NAMESPACE, "myAnnoyingClass")

Describe alternatives you've considered

Writing my own custom Sampler, which gets ugly fast.
Matching just one attribute, like code.function, and carefully making sure the same value is not used in another context.

Additional context

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions