-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] Add new custom rule action to force time shift #188710
Conversation
@elastic/ml-ui This works as far as validation in the Advanced Wizard goes, but I noticed that custom rule actions are wired in a few more places (Customer rule editor UI among other things). Could someone please pick this PR up and extend the missing places? |
@elasticmachine merge upstream |
@elastic/ml-ui Can someone please review my PR? |
This PR extends the schema of the detection rule API by adding a new parametrizable action `force_time_shift` and a new property `params` to hold the parameter `total_shift_amount` as signed long in seconds to control the behavior of the time shift. A valid schema looks like this: ```http POST _ml/anomaly_detectors/my_job/_update { "detectors": { "detector_index": 0, "custom_rules": [ // update the detector with a custom rule that forces a time shift of 1 hour back starting now { "actions": [ "force_time_shift" ], "params": { "force_time_shift": { "time_shift_amount": 3600} } }, "conditions": [{ "applies_to": "time", "operator": "gt", "value": "now" }, { "applies_to": "time", "operator": "lt", "value": "now+bucket_span" }, ] }, ... ``` Execution of the detection rule action `force_time_shift` will shift the time inside the anomaly detector by a specified amount. This is useful, e.g. to quickly adapt to the daylight saving time events that are known beforehand. This PR is accompanied by changes in Kibana elastic/kibana#188710 and the native ml-cpp code elastic/ml-cpp#2690. The integration tests between Java and C++ parts of the force-time shift action will be implemented in a separate PR.
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
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: cc @valeriy42 |
This PR follows up elastic/elasticsearch#110974 and extends the schema for custom rules.
A valid schema looks like this: