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
Add groupByKeys context to recovered alerts for Log Threshold Rule and Metric Threshold Rule #146874
Add groupByKeys context to recovered alerts for Log Threshold Rule and Metric Threshold Rule #146874
Conversation
Pinging @elastic/actionable-observability (Team: Actionable Observability) |
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
@@ -935,6 +940,7 @@ const processRecoveredAlerts = ({ | |||
const baseContext = { | |||
alertDetailsUrl: getAlertDetailsUrl(basePath, spaceId, alertUuid), | |||
group: hasGroupBy(validatedParams) ? recoveredAlertId : null, | |||
groupByKeys: groupByKeysObjectForRecovered[recoveredAlertId], |
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.
Just out of curiosity: Do we have a test to check what is generated in the context?
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 don't believe we have tests to check context of recovered
alerts. I will add this in a separate PR.
💚 Build Succeeded
Metrics [docs]Unknown metric groupsESLint disabled in files
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
…d Metric Threshold Rule (elastic#146874) ## Summary Closes elastic#146349, elastic#146347 With this PR, it is possible to use `groupByKeys` context variable for `Recovered` action template when creating Log threshold and Metric threshold rules. Previously this context variable was available, but was not set for `recovered` alerts. When a Log/Metric Threshold rule is created with one or more `group by`, for example, `agent.hostname` and `container.id`, the `context.groupByKeys` variable will have an object of group by keys as below: ``` { "agent": { "hostname": "host-01" }, "container": { "id": "container-01" } } ``` Co-authored-by: Faisal Kanout <faisal.kanout@elastic.co>
Summary
Closes #146349, #146347
With this PR, it is possible to use
groupByKeys
context variable forRecovered
action template when creating Log threshold and Metric threshold rules. Previously this context variable was available, but was not set forrecovered
alerts.When a Log/Metric Threshold rule is created with one or more
group by
, for example,agent.hostname
andcontainer.id
, thecontext.groupByKeys
variable will have an object of group by keys as below: