Add anomaly detection transform stage to flowlogs-pipeline#1143
Add anomaly detection transform stage to flowlogs-pipeline#1143vatankh wants to merge 13 commits into
Conversation
…nd-config Add anomaly detection transform
|
Hi @vatankh. Thanks for your PR. I'm waiting for a github.com 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. DetailsInstructions 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-sigs/prow repository. |
|
Thanks @vatankh ! This is looking pretty good already. I have a few more comments, let's start with the nitpicking one :-) : could you remove Then a comment on the API design: as it is, it doesn't allow to run several anomaly detections (e.g. on several valueFields, or with different keys). A single Anomaly stage runs for a single value field, and if several stages are defined, they would conflict when writing on the same output fields. A simple way to fix this would be to add a Another approach would be to allow multiple value fields in a single stage. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Introduce anomaly type enum
|
|
is there anything needs fixing ? @jotak |
|
Sorry for the delay, I'm taking another look at it |
| } | ||
|
|
||
| // Reset clears the internal state; useful for tests. | ||
| func (a *Anomaly) Reset() { |
There was a problem hiding this comment.
As it's only used in the test file that sits in the same package, let's not export it (use reset without capital R)
Removing IBM copyright & license header from new files
|
/ok-to-test |
|
@vatankh: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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-sigs/prow repository. I understand the commands that are listed here. |
|
We need to rebase the PR - image build jobs are failing because they check out the PR against the updated |
|
I see also the linter complaining about formatting issues. You can run |
Description
This PR introduces a new
anomalytransform stage toflowlogs-pipelineas a first step toward anomaly detection for Kubernetes network flows (see issue #).Key points:
type: anomalytransform that computes streaming anomaly scores per key.zscore: rolling z-score over a sliding window.ewma: exponentially weighted moving average baseline.algorithm(ewma | zscore)valueField(numeric field, e.g.Bytes)keyFields(used to group flows per entity, e.g.[SrcAddr, DstAddr, Proto])windowSize,baselineWindow,sensitivity,ewmaAlphaanomaly_scoreanomaly_type(e.g.warming_up,normal,zscore_high,zscore_low,ewma_high,ewma_low)baseline_window(current number of samples in the baseline window)hack/examples/pipeline-anomaly.yaml).This is intentionally a local, per-instance anomaly stage that works on the existing pipeline input only; it does not consume Loki/Kafka yet, as discussed in the issue conversation.
Dependencies
n/a
Testing
go test ./pkg/pipeline/transform -run TestTransformAnomalygo test ./...go build ./cmd/flowlogs-pipeline./flowlogs-pipeline --log-level debug --config hack/examples/pipeline-anomaly.yamlChecklist
If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.
[ x] Will this change affect NetObserv / Network Observability operator? If not, you can ignore the rest of this checklist.
No, this change only adds a new optional transform in flowlogs-pipeline and is not yet wired into the operator.
Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
Does this PR require product documentation?
Does this PR require a product release notes entry?
Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
QE requirements (check 1 from the list):
To run a perfscale test, comment with:
/test flp-node-density-heavy-25nodes