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

Add sampling rule glob pattern support #3616

Merged
merged 1 commit into from
May 2, 2024
Merged

Add sampling rule glob pattern support #3616

merged 1 commit into from
May 2, 2024

Conversation

marcotc
Copy link
Member

@marcotc marcotc commented Apr 30, 2024

What does this PR do?
This PR adds support for matching sample rules not only by simple strings, but also buy a simple matching pattern. The matching is also case insensitive now.

This brings there will be tracer to parody with other tracing languages.

The following special characters are supported:

  • ?: matches any single character
  • *: matches any substring

Additional Notes:
Support for an arbitrary matcher your object has been removed, given the sampling APIs are now private and does not need such flexibility.

The glob pattern is the same for trace sampling and span sampling, so the code was refractored to share this complex matcher.

How to test the change?
They are unit tests and system tests for this change: DataDog/system-tests#2415

Signed-off-by: Marco Costa <marco.costa@datadoghq.com>
Comment on lines -53 to +55
REMOTE_USER_RULE = '-10'
REMOTE_USER_RULE = '-11'
# Dynamically configured rule, automatically generated by Datadog.
REMOTE_DYNAMIC_RULE = '-11'
REMOTE_DYNAMIC_RULE = '-12'
Copy link
Member Author

Choose a reason for hiding this comment

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

The RFC was recently changed, and these numbers have been updated.


# A {Datadog::Tracing::Sampling::Matcher} that allows for arbitrary trace matching
# based on the return value of a provided block.
class ProcMatcher < Matcher
Copy link
Member Author

Choose a reason for hiding this comment

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

Arbitrary object matching is not required anymore, that this helper is no longer needed.

@marcotc marcotc self-assigned this Apr 30, 2024
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 98.85057% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 98.12%. Comparing base (370d7b1) to head (6e3d05a).
Report is 1 commits behind head on master.

Files Patch % Lines
lib/datadog/tracing/sampling/matcher.rb 96.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3616      +/-   ##
==========================================
- Coverage   98.12%   98.12%   -0.01%     
==========================================
  Files        1223     1223              
  Lines       72136    72097      -39     
  Branches     3425     3424       -1     
==========================================
- Hits        70787    70748      -39     
  Misses       1349     1349              

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

@ivoanjo ivoanjo added this to the 2.0.0 milestone May 1, 2024
@marcotc marcotc merged commit abdd5d0 into master May 2, 2024
166 checks passed
@marcotc marcotc deleted the sampling-glob branch May 2, 2024 20:08
@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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants