open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.09k stars 2.38k forks source link

Probabilistic sampling based on a specific attribute #33449

Open fenos opened 5 months ago

fenos commented 5 months ago

Component(s)

processor/tailsampling

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

My server runs in a multi-tenant fashion, I have a specific attribute on my trace spans called tenant.id I'd like to sample traces on a fixed ratio per tenant.id instead of sampling based on the traceId.

This will allow me to sample only x% of traces for specific tenant requests

Describe the solution you'd like

One way to achieve this is improve the probabilistic sampler and allow to pass an attributes key which the values will then be used to compute the hash as opposed to the traceId to

Describe alternatives you've considered

No response

Additional context

No response

github-actions[bot] commented 5 months ago

Pinging code owners:

github-actions[bot] commented 5 months ago

Pinging code owners for processor/probabilisticsampler: @jpkrohling @jmacd. See Adding Labels via Comments if you do not have permissions to add labels yourself.

frzifus commented 5 months ago

Just to clarify you propose to concatenate attributes to a traceID before making a decision in the probabilistic sampler?

I assume there are no objections, wdyt @jpkrohling?

In that case do you want to work on some draft @fenos?

jpkrohling commented 4 months ago

Does all of your spans have a tenant.id attribute, or only one (or a few) spans from the whole trace? This works already with the tail-sampling processor, which has to be used anyway if you have the tenant attribute only on a few spans instead of all spans for the trace.

github-actions[bot] commented 2 months ago

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

github-actions[bot] commented 3 weeks ago

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.