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
Allow customizing spam filtering in event client library #103918
Conversation
Hi @olagacek. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
duplicateEvent := makeEvent("duplicate", "me again", makeObjectReference("Pod", "my-pod", "my-ns")) | ||
similarEvent := makeEvent("first", "me again", makeObjectReference("Pod", "my-pod", "my-ns")) | ||
testCases := map[string]struct { | ||
previousEvents []v1.Event |
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.
Nit, looks like previous event is always the same, it might be more readable to not include previousEvents
field in the test case
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.
Removed previousEvents field
newEvent v1.Event | ||
expectedEvent v1.Event | ||
intervalSeconds int | ||
burstSize int |
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.
ditto for burstSize and expected Skip. Not need to include in test case if they don't change between tests.
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.
burstSize is not included in test case anymore, but expectedSkip actually changes between the test cases :)
"") | ||
} | ||
firstEvent := makeEvent("first", "i am first", makeObjectReference("Pod", "my-pod", "my-ns")) | ||
duplicateEvent := makeEvent("duplicate", "me again", makeObjectReference("Pod", "my-pod", "my-ns")) |
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.
For me those names are reversed. Duplicate event should be exactly the same as the original and similar can differ. Can we make it more clearer in names or in test arguments what are differences?
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.
Renamed the variables, hope they are more descriptive now
/assign @serathius |
/ok-to-test |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: olagacek, serathius The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Current implementation
Event client library has aggregation and spam filtering implemented. While aggregation can be fully customized, spam filtering functionality doesn't allow overriding spamKey func - function that is responsible for creating a key (based on an event) which is used to detect "spam" events. Currently used
getSpamKey()
function takes into accountSource
andInvolvedObject
of an event. Per each such keyBurstSize
events can be sent.Changes in PR
Allow customizing spamKey func in
CorrelatorOptions
ofEventCorrelator
.Why allow customizing spamKey func?
For some use cases it can be useful to also include for example
Reason
field of an event in spamKey. For example, if we haven
normal events for a specific Object with the same reason andn+1
-th event is e.g warning with a different reason we would like to have it emitted, while filtering n-1 normal events.This PR does not change default behavior and doesn't introduce any breaking change. Current users of client library won't experience any change, unless they explicitly modify
CorrelatorOptions
.Which issue(s) this PR fixes:
None
Does this PR introduce a user-facing change?
/cc @serathius @dashpole @logicalhan
/sig instrumentation