[Metrics UI] Metric Threshold rule type should clear previous group cache on KQL query change #115468
Labels
bug
Fixes for quality problems that affect the customer experience
Feature:Metrics UI
Metrics UI feature
Team:Infra Monitoring UI - DEPRECATED
DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services
Metric Threshold rules store the previous list of detected groups in
state.groups
, in order to detect when groups unexpectedly disappear. To make sure we don't continue to alert on them when we do expect them to disappear, i.e. when the user edits the rule definition, we check to see if thegroupBy
(alert per) value has changed. But sometimes, changing the rule's KQL filter can also result in some groups disappearing.See logic in https://github.com/elastic/kibana/blob/master/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.ts#L96-L98
Note that we are only checking if the groupBy value has changed — if it has changed,
prevGroups
evaluates as an empty array instead of the storedstate.groups
. This resets the cache, asprevGroups
gets merged with the currently detectedgroups
to get saved tostate.groups
.Acceptance criteria
filterQuery
in rule stategroupBy
has changed before buildingprevGroups
, also check to see if thefilterQuery
has changedThe text was updated successfully, but these errors were encountered: