-
Notifications
You must be signed in to change notification settings - Fork 435
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
ddtrace/tracer: removed restriction of non-empty fields in sampling rules #1510
Conversation
@@ -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, |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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"
There was a problem hiding this 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!
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.