-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Unexpected behavior of And policy #29637
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
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
The issue is related to the two parts of code: In the first version config, the non- In the second version config, the non- |
I don't quite understand the purpose to differentiate |
typically, invert match is used to exclude small parts of data that user don't want to see it. For example, when using invert match to exclude health check trace:
Well if I think this may be an unavoidable trade-off where there will always be a configuration layout that needs to compromise. In your case, I modified the configuration to make it more symmetry: tail_sampling:
policies:
- name: policy-for-other-service
type: and
and:
and_sub_policy:
- name: define-other-service
type: string_attribute
string_attribute:
invert_match: true
key: service.name
values:
- foo
# the following part is omitted in your config, I add it here for comprehensive.
- name: real-policy
type: always_sample
- name: policy-for-foo-service
type: and
and:
and_sub_policy:
- name: define-foo-service
type: string_attribute
string_attribute:
key: service.name
values:
- foo
- name: real-policy
type: string_attribute
string_attribute:
invert_match: true
key: http.route
values:
- /actuator/health/** Now it looks neat. I understand that it's complicated; however, if the behavior of Me personally suggestion (put on my end-user hat):
|
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This issue has been closed as inactive because it has been stale for 120 days with no activity. |
#### Description This pull-request introduces a new policy type to explicitly drop traces regardless of other policy decisions. The new `drop` policy type behaves much like an `and`, however, it returns a `Dropped` decision when all of its policies return `Sampled`. A `Dropped` decision takes precedence over all others. The `Dropped` decision is not new, however, it was unused and therefor safe to use for this purpose. This new policy type is very **approachable** and capable. This new policy type can be used to replace the top-level (not within an `and` policy) use of `invert_match` to control the final sampling decision. We could deprecate the current `invert_match` top-level decision logic. The string, numeric, and boolean filter policies still support `invert_match`, which continues to flip the decision for the individual policy. Let `invert_match` be simple. Example: ``` { name: drop-it-like-its-hot, type: drop, drop: { drop_sub_policy: [ { name: do-not-sample, type: boolean_attribute, boolean_attribute: { key: app.do_not_sample, value: true }, } ] } } ``` This is a reduced version of a previous PR #37760 #### Related Issues - #36673 - #33656 - #36795 - #34296 - #34085 - #29637 - #27049 - Probably more 😅 --------- Signed-off-by: Sean Porter <[email protected]>
Component(s)
processor/tailsampling
What happened?
Description
I tried to use the
tailsampling
processor to drop the health check traces of a particular service (let's name isfoo
here), but the behavior of theAnd
policy was out of my expectation.Steps to Reproduce
The first version of config:
It worked as I expected, excluding all traces with
http.route=/actuator/health/**
of servicefoo
.Then I thought maybe I could simplify the config a bit, as below:
The only change was moving the sub policy of
And
to the top level.Then I found that other traces with
http.route
not equal to/actuator/health/**
of servicefoo
were dropped too.Expected Result
Moving the only one sub policy of
And
to the top level should not change its behavior.Actual Result
The policy behavior is changed
Collector version
0.79.0
Environment information
Environment
OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")
OpenTelemetry Collector configuration
No response
Log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: