DataDog / dd-trace-dotnet

.NET Client Library for Datadog APM
https://docs.datadoghq.com/tracing/
Apache License 2.0
437 stars 137 forks source link

DD_SPAN_SAMPLING_RULES not working #6029

Closed ArjunVachhani closed 1 week ago

ArjunVachhani commented 2 weeks ago

I am developing a microservice using ASP.NET Core. We are using Datadog.Tracer library for distributed traces & span. Currently it is collecting all the spans and traces. I only want 1% of spans to be collected and ingested. I am setting below environment variables, but it is not having any effect.

DD_TRACE_SAMPLE_RATE: "0.01" DD_SPAN_SAMPLING_RULES: '[{"sample_rate":0.01,"service":"*","name":"*"}]' Why it is not sampling spans? What am I missing?

bouwkast commented 2 weeks ago

Hi @ArjunVachhani,

We have a few environment variables that control sampling:

DD_TRACE_SAMPLE_RATE sets the global sampling rate for traces DD_TRACE_SAMPLING_RULES defines sampling rules by service for traces. DD_SPAN_SAMPLING_RULES defines sampling for specific spans within traces that are kept.

I don't see anything that would explain why your defined sampling rules isn't taking effect, so I think we'd need more information.

To help expedite a solution for you, could you please open a new ticket for Datadog Support (no sign-in required) for the .NET Tracer for this issue? This will allow our support team to collect necessary information and prioritize work on this. Here is a direct link to create a new ticket for the .NET Tracer: https://help.datadoghq.com/hc/requests/new?tf_1260824651490=pt_product_type:apm&tf_1900004146284=pt_apm_language:.net