Merge "Statsd anomaly detection atom"

This commit is contained in:
TreeHugger Robot
2017-12-19 07:28:27 +00:00
committed by Android (Google) Code Review
2 changed files with 23 additions and 1 deletions

View File

@@ -23,6 +23,7 @@
#include <android/os/IIncidentManager.h>
#include <android/os/IncidentReportArgs.h>
#include <binder/IServiceManager.h>
#include <statslog.h>
#include <time.h>
namespace android {
@@ -224,6 +225,9 @@ void AnomalyTracker::declareAnomaly(const uint64_t& timestampNs) {
}
StatsdStats::getInstance().noteAnomalyDeclared(mConfigKey, mAlert.name());
android::util::stats_write(android::util::ANOMALY_DETECTED, mConfigKey.GetUid(),
mConfigKey.GetName().c_str(), mAlert.name().c_str());
}
void AnomalyTracker::declareAnomalyIfAlarmExpired(const HashableDimensionKey& dimensionKey,

View File

@@ -79,7 +79,8 @@ message Atom {
IsolatedUidChanged isolated_uid_changed = 43;
PacketWakeupOccurred packet_wakeup_occurred = 44;
DropboxErrorChanged dropbox_error_changed = 45;
AppHook app_hook = 46;
AnomalyDetected anomaly_detected = 46;
AppHook app_hook = 47;
// TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
}
@@ -840,6 +841,23 @@ message AppHook {
optional State state = 3;
}
/**
* Logs when statsd detects an anomaly.
*
* Logged from:
* frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
*/
message AnomalyDetected {
// Uid that owns the config whose anomaly detection alert fired.
optional int32 config_uid = 1;
// Name of the config whose anomaly detection alert fired.
optional string config_name = 2;
// Name of the alert (i.e. name of the anomaly that was detected).
optional string alert_name = 3;
}
/**
* Pulls bytes transferred via wifi (Sum of foreground and background usage).
*