Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure DD_TRACE_SAMPLE_RATE enables full RuleSampler #1416

Merged
merged 1 commit into from
Apr 5, 2021

Conversation

marcotc
Copy link
Member

@marcotc marcotc commented Mar 18, 2021

DD_TRACE_SAMPLE_RATE controls the global sampling rate of traces in ddtrace. This settings was introduced as a newer feature, compared to our default, agent-driven, RateByServiceSampler.

Because DD_TRACE_SAMPLE_RATE is implemented using the new RuleSampler (instead of RateByServiceSampler), it has different semantics that affect backend behaviour: RuleSampler sets two new tags (_dd.rule_psr and _dd.limit_psr) that report application-side sampling rates to the backend for throughput extrapolation (if we sent 10 spans/sec, with a sampling rate of 0.1, the application actually generated 100 spans/sec).

This PR addresses the fact that setting a sampling rate to the new environment variable DD_TRACE_SAMPLE_RATE was not sending the required sampling tags.

This PR keeps intact the behaviour for users that do not enable the new RuleSampler, either through DD_TRACE_SAMPLE_RATE or programmatic configuration.

@marcotc marcotc added the bug Involves a bug label Mar 18, 2021
@marcotc marcotc self-assigned this Mar 18, 2021
@marcotc marcotc requested a review from a team March 18, 2021 19:23
@marcotc marcotc marked this pull request as draft March 18, 2021 19:36
@marcotc marcotc removed the request for review from a team March 18, 2021 19:36
@marcotc marcotc force-pushed the fix-sample-rate-1.0 branch 2 times, most recently from 743f431 to a8052d3 Compare March 18, 2021 20:53
@marcotc marcotc marked this pull request as ready for review March 18, 2021 22:02
@marcotc marcotc requested a review from a team March 18, 2021 22:03
@marcotc marcotc force-pushed the fix-sample-rate-1.0 branch 2 times, most recently from 29a5468 to df39d64 Compare March 18, 2021 22:10
@delner delner added the core Involves Datadog core libraries label Apr 1, 2021
Copy link
Contributor

@delner delner left a comment

Choose a reason for hiding this comment

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

👍

@marcotc marcotc merged commit a046e21 into master Apr 5, 2021
@marcotc marcotc deleted the fix-sample-rate-1.0 branch April 5, 2021 20:48
@github-actions github-actions bot added this to the 0.48.0 milestone Apr 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Involves a bug core Involves Datadog core libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants