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

Minimize sampling API #3423

Merged
merged 1 commit into from
Feb 1, 2024
Merged

Minimize sampling API #3423

merged 1 commit into from
Feb 1, 2024

Conversation

marcotc
Copy link
Member

@marcotc marcotc commented Jan 30, 2024

2.0 Upgrade Guide notes

The following sampling classes have been removed from the public API:

Datadog::Tracing::Sampling::AllSampler
Datadog::Tracing::Sampling::Matcher
Datadog::Tracing::Sampling::SimpleMatcher
Datadog::Tracing::Sampling::ProcMatcher
Datadog::Tracing::Sampling::PrioritySampler
Datadog::Tracing::Sampling::RateByKeySampler
Datadog::Tracing::Sampling::RateByServiceSampler
Datadog::Tracing::Sampling::RateLimiter
Datadog::Tracing::Sampling::TokenBucket
Datadog::Tracing::Sampling::UnlimitedLimiter
Datadog::Tracing::Sampling::RateSampler
Datadog::Tracing::Sampling::Rule
Datadog::Tracing::Sampling::SimpleRule
Datadog::Tracing::Sampling::RuleSampler
Datadog::Tracing::Sampling::Sampler

Most custom sampling can be accomplished with a combination of Ingestion Controls and user-defined rules. This is the preferred option, as it is more maintainable and auditable than custom sampling.

If you still need a custom sampler, its API has been simplified in 2.0. See https://github.com/DataDog/dd-trace-rb/blob/2.0/docs/GettingStarted.md#custom-sampling for the new detailed requirements of a custom sampler.

Motivation:

We have made large improvements to sampling since 1.0.0 and plan to introduce new features and improvements in the near future.
The sampling changes introduced since 1.0.0 were hard to implement because almost all of the sampling classes are part of the public API. Moreover, large technical debt was introduced in order to keep the API stable while implementing such improvements. Thus, recent changes to the sampling logic have been very hard to implement correctly.

Since 1.0.0, we have introduced new ways to configure rule sampling, as well as post-ingestion sampling, which give users more maintainable options than using our custom sampling classes.

How to test the change?
There is no change in behaviour for ddtrace.
Changes to custom samplers are documented in our public docs.

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles
    credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.

Unsure? Have a question? Request a review!

@marcotc marcotc marked this pull request as ready for review January 31, 2024 22:18
@marcotc marcotc requested review from a team as code owners January 31, 2024 22:18
@codecov-commenter
Copy link

Codecov Report

Attention: 33 lines in your changes are missing coverage. Please review.

Comparison is base (5cb48c5) 98.13% compared to head (1aa01b2) 98.09%.
Report is 26 commits behind head on 2.0.

Files Patch % Lines
...datadog/tracing/contrib/trilogy/instrumentation.rb 41.30% 27 Missing ⚠️
lib/datadog/tracing/contrib/trilogy/patcher.rb 80.00% 3 Missing ⚠️
.../tracing/contrib/trilogy/configuration/settings.rb 96.77% 1 Missing ⚠️
lib/datadog/tracing/contrib/trilogy/integration.rb 95.23% 1 Missing ⚠️
.../datadog/tracing/contrib/rails/support/database.rb 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              2.0    #3423      +/-   ##
==========================================
- Coverage   98.13%   98.09%   -0.04%     
==========================================
  Files        1249     1254       +5     
  Lines       72086    72186     +100     
  Branches     3372     3379       +7     
==========================================
+ Hits        70741    70813      +72     
- Misses       1345     1373      +28     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@brett0000FF brett0000FF left a comment

Choose a reason for hiding this comment

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

Looks good from Docs side.

@marcotc marcotc merged commit 33ec11d into 2.0 Feb 1, 2024
153 checks passed
@marcotc marcotc deleted the simplify-sampling branch February 1, 2024 19:57
@TonyCTHsu TonyCTHsu added this to the 2.0 milestone Feb 20, 2024
@ivoanjo ivoanjo added the 2.0 label Mar 14, 2024
@TonyCTHsu TonyCTHsu modified the milestones: 2.0, 2.0.0.beta1 Mar 22, 2024
@TonyCTHsu TonyCTHsu mentioned this pull request Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants