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 ability to set sampling rules by resource #3513

Closed
wants to merge 2 commits into from

Conversation

cjubb39
Copy link

@cjubb39 cjubb39 commented Mar 8, 2024

What does this PR do?

This PR adds support for sampling based on resources. It does not change anything about when the rules / matchers / etc are evaluated. It just compares against the existing resource value in addition to the name and service values.

Default behavior continues to be matching all resources

Motivation:

I was looking for a way to ensure that everything from a given resource within a service was sampled at a 1.0 rate. I also noticed this feature existed in the python interface (added here) so it seemed there would be no fundamental objection.

Additional Notes:

How to test the change?

Mirrored the existing testing for name and service. Additionally added in test cases for the combinations of (name,service,resource) patterns.

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!

@cjubb39 cjubb39 requested a review from a team as a code owner March 8, 2024 00:18
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.24%. Comparing base (44b9c6c) to head (8f9837b).
Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #3513    +/-   ##
========================================
  Coverage   98.23%   98.24%            
========================================
  Files        1275     1275            
  Lines       75226    75369   +143     
  Branches     3552     3558     +6     
========================================
+ Hits        73901    74045   +144     
+ Misses       1325     1324     -1     

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

@marcotc
Copy link
Member

marcotc commented Mar 15, 2024

👋 @cjubb39, thank you so much for this request. We are also working on this feature ourselves, and your PR looks like a great contribution to get this work delivered.

Will touch base soon about this feature.

@cjubb39
Copy link
Author

cjubb39 commented Mar 19, 2024

@marcotc great to hear it's being prioritized! The feature would be quite useful at my company -- so please let me know if there's any massaging I can do to this PR to help speed things along!

@delner
Copy link
Contributor

delner commented Mar 27, 2024

Echoing @marcotc said, but also want to say @cjubb39 the PR is already shaping up very nicely! Nice work so far 👍

@delner delner added community Was opened by a community member feature Involves a product feature labels Mar 27, 2024
@delner delner requested a review from marcotc March 27, 2024 14:50
@marcotc
Copy link
Member

marcotc commented Apr 30, 2024

This was shipped in #3585, thank you for your contribution @cjubb39!

@marcotc marcotc closed this Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Was opened by a community member feature Involves a product feature tracing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants