Partial config update for alerts/subscriptions
Preserves alerts if the definition didn't change and the underlying metric didnt change. All alerts need to be readded to the metric b/c metrics will always clear the alerts on config updates. In the existing code, the metric producer created the AnomalyTracker (since duration metrics need DurationAnomalyTrackers). Preserved alerts already have an AnomalyTracker. Therefore, we need a second overload of addAnomalyTracker within MetricProducer to add existing ones. Note that we don't need to worry about the type of AnomlayTracker, since if the alert is preserved, both the AnomalyTracker and metric must not have changed, so they will both be the correct type. Subscriptions are also redone - alerts will clear their subscriptions, and all subscriptions will be readded. For duration metric, we now need to propagate adding anomaly trackers to the DurationTrackers since it's now possible to add anomaly trackers after the durationTrackers have been created. Test: atest statsd_test Bug: 162323547 Change-Id: Id3afa04b252f3a3523114407a389be25b9171a97
Loading
Please register or sign in to comment