-
Notifications
You must be signed in to change notification settings - Fork 160
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
Implement extended sampling #2384
Conversation
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.
LGTM with respect to the RFC 👍
75407c6
to
a6dfb4b
Compare
4ff93ff
to
1453ab9
Compare
bool dd_rule_matches(zval *pattern, zval *prop, int rulesFormat); | ||
bool dd_glob_rule_matches(zval *pattern, zend_string* value); |
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.
Thinking about it, I may have put them in compat_string.[h|c]
, not to do an additional #include
in priority_sampling.c
, but this may be irrelevant 🤷
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.
I understand the will not to do additional includes, but compat_string
seems not to be the good placeholder for this. As rule matching as nothing to see with string compatibility.
I could move to a dedicated file if we believe it's not meant in ddshared
, but it wouldn't solve the extra incude part of the comment
Support for tags and resources in sampling rules Allows looking at arbitrary spans too, not only root spans Signed-off-by: Bob Weinand <[email protected]>
Sampling rules now use glob pattern matching. We used to have regexes, so it's a breaking change. To work around this, we add a new DD_TRACE_SAMPLING_RULES_FORMAT parameter. This parameter allows `regex` and `glob`. `regex` is the default for retrocompatibility reasons. That said we will drop this parameter in 1.0. Glob matching was already implemented for single span samplling so I just factorized some code.
There was one issue when you were using only `?`. I've added a circuit break that fixes that issue and also improve the perf of the algo in the case of patterns with no `*` and shorter than the length of the input string.
We test that sampling works on resources with the same glob patterns Also adds a test where we test all criterias in one sampling rule.
8f7fc87
to
ef2686c
Compare
Description
Sampling rules use glob pattern matching
We used to have regexes, so it would be a breaking change. To work around this, we add a new
DD_TRACE_SAMPLING_RULES_FORMAT
parameter. This parameter allowsregex
andglob
.regex
is the default for retrocompatibility reasons. That said we will drop this parameter in 1.0.Glob matching algo
It already existed for single spans sampling. So we're just factorizing some code. The previous algo had a small bug so there's one commit dedicated to this fix.
Readiness checklist
Reviewer checklist