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

ddtrace/tracer: removed restriction of non-empty fields in sampling rules #1510

Merged
merged 5 commits into from
Oct 12, 2022

Conversation

dianashevchenko
Copy link
Contributor

Removed the restriction where rules without both service and operation names were dropped.

In the rules section of the RFC, the rules with no service and operation names are deemed valid. Other tracers follow that recommendation.

@dianashevchenko dianashevchenko requested a review from a team October 11, 2022 10:21
@dianashevchenko dianashevchenko changed the title removed restriction of non-empty fields in sampling rules ddtrace/tracer: removed restriction of non-empty fields in sampling rules Oct 11, 2022
@@ -47,9 +50,10 @@
// DD_SPAN_SAMPLING_RULES environment variables. When set, it overrides rules set by tracer.WithSamplingRules.
// The value is a JSON array of objects. All rule objects must have a "sample_rate".
// For trace sampling rules the "name" and "service" fields are optional.
// For span sampling rules, at least one of the fields must be specified and must be a valid glob pattern,
// i.e. a string where "*" matches any contiguous substring, even the empty string,
// For span sampling rules, the "name" and "service", if specified, must be a valid glob pattern,
Copy link
Contributor

Choose a reason for hiding this comment

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

So if neither name nor service are supplied what does the rule do? (And can we add that to the documentation here to clarify it for future readers)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to the RFC, and the implementation in other tracers there shouldn't be solid restrictions like we had before. I am confident that there should be a check to discard a rule like {"service":"*", "name":"*", "sampling_rate": 1} in whatever form it comes. If the customer wants to allow all sampling, it should be done without misusing this API. Wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I definitely agree that setting it to * for both fields is a clear mis-use of the API so restricting it makes sense to me. I'm still confused what the intended behavior of having an empty name and empty service name since I don't think any spans can have both be empty? So the rule would just never match anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On the contrary, empty means it "match all"

@dianashevchenko dianashevchenko added this to the v1.44.0 milestone Oct 12, 2022
Copy link
Contributor

@ajgajg1134 ajgajg1134 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, thanks for clarifying in the docs!

@dianashevchenko dianashevchenko merged commit 3765b4d into main Oct 12, 2022
@dianashevchenko dianashevchenko deleted the shevchenko/default-values-for-sampling-rule branch October 12, 2022 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants