Add more alert details to incidentd header.
+ Add metric_id, dimension, metric_value in the incident report header
to make it easier to identify an anomaly.
+ In case there is a uid in the dimension, put the its package info in the header too
Test: statsd_test && tested locally with a config
Change-Id: I762a1a4b0563fb3104e0d32b616b4a2367485e48
diff --git a/cmds/statsd/src/anomaly/DurationAnomalyTracker.cpp b/cmds/statsd/src/anomaly/DurationAnomalyTracker.cpp
index 3acfd17..2b56810 100644
--- a/cmds/statsd/src/anomaly/DurationAnomalyTracker.cpp
+++ b/cmds/statsd/src/anomaly/DurationAnomalyTracker.cpp
@@ -65,7 +65,9 @@
// If the alarm is set in the past but hasn't fired yet (due to lag), catch it now.
if (itr->second != nullptr && timestampNs >= (int64_t)NS_PER_SEC * itr->second->timestampSec) {
- declareAnomaly(timestampNs, dimensionKey);
+ declareAnomaly(timestampNs, mAlert.metric_id(), dimensionKey,
+ mAlert.trigger_if_sum_gt() + (timestampNs / NS_PER_SEC) -
+ itr->second->timestampSec);
}
if (mAlarmMonitor != nullptr) {
mAlarmMonitor->remove(itr->second);
@@ -100,7 +102,9 @@
// Now declare each of these alarms to have fired.
for (const auto& kv : matchedAlarms) {
- declareAnomaly(timestampNs, kv.first);
+ declareAnomaly(
+ timestampNs, mAlert.metric_id(), kv.first,
+ mAlert.trigger_if_sum_gt() + (timestampNs / NS_PER_SEC) - kv.second->timestampSec);
mAlarms.erase(kv.first);
firedAlarms.erase(kv.second); // No one else can also own it, so we're done with it.
}