Test: Ran statsd tests.
Change-Id: I3a83bdfb38be82d70ca547825152370df8bca9cc
case LogicalOperation::NOR:
newCondition = hasTrue ? ConditionState::kFalse : ConditionState::kTrue;
break;
+ case LogicalOperation::LOGICAL_OPERATION_UNSPECIFIED:
+ newCondition = ConditionState::kFalse;
+ break;
}
return newCondition;
}
metric->mutable_bucket()->set_bucket_size_millis(30 * 1000L);
// Anomaly threshold for screen-on count.
- Alert* alert = config.add_alerts();
+ Alert* alert = config.add_alert();
alert->set_name("1");
alert->set_number_of_buckets(6);
alert->set_trigger_if_sum_gt(10);
keyMatcher->set_key(UID_PROCESS_STATE_UID_KEY);
// Anomaly threshold for background count.
- alert = config.add_alerts();
+ alert = config.add_alert();
alert->set_name("2");
alert->set_number_of_buckets(4);
alert->set_trigger_if_sum_gt(30);
DurationMetric* durationMetric = config.add_duration_metric();
durationMetric->set_name("5");
durationMetric->mutable_bucket()->set_bucket_size_millis(30 * 1000L);
- durationMetric->set_type(DurationMetric_AggregationType_DURATION_SUM);
+ durationMetric->set_aggregation_type(DurationMetric_AggregationType_SUM);
keyMatcher = durationMetric->add_dimension();
keyMatcher->set_key(WAKE_LOCK_UID_KEY_ID);
durationMetric->set_what("WL_HELD_PER_APP_PER_NAME");
durationMetric = config.add_duration_metric();
durationMetric->set_name("6");
durationMetric->mutable_bucket()->set_bucket_size_millis(30 * 1000L);
- durationMetric->set_type(DurationMetric_AggregationType_DURATION_MAX_SPARSE);
+ durationMetric->set_aggregation_type(DurationMetric_AggregationType_MAX_SPARSE);
keyMatcher = durationMetric->add_dimension();
keyMatcher->set_key(WAKE_LOCK_UID_KEY_ID);
durationMetric->set_what("WL_HELD_PER_APP_PER_NAME");
durationMetric = config.add_duration_metric();
durationMetric->set_name("7");
durationMetric->mutable_bucket()->set_bucket_size_millis(30 * 1000L);
- durationMetric->set_type(DurationMetric_AggregationType_DURATION_MAX_SPARSE);
+ durationMetric->set_aggregation_type(DurationMetric_AggregationType_MAX_SPARSE);
durationMetric->set_what("WL_HELD_PER_APP_PER_NAME");
durationMetric->set_condition("APP_IS_BACKGROUND_AND_SCREEN_ON");
link = durationMetric->add_links();
durationMetric = config.add_duration_metric();
durationMetric->set_name("8");
durationMetric->mutable_bucket()->set_bucket_size_millis(10 * 1000L);
- durationMetric->set_type(DurationMetric_AggregationType_DURATION_SUM);
+ durationMetric->set_aggregation_type(DurationMetric_AggregationType_SUM);
durationMetric->set_what("SCREEN_IS_ON");
// Value metric to count KERNEL_WAKELOCK when screen turned on
}
}
break;
+ case LogicalOperation::LOGICAL_OPERATION_UNSPECIFIED:
+ matched = false;
+ break;
}
return matched;
}
unique_ptr<DurationTracker> DurationMetricProducer::createDurationTracker(
vector<DurationBucket>& bucket) {
- switch (mMetric.type()) {
- case DurationMetric_AggregationType_DURATION_SUM:
+ switch (mMetric.aggregation_type()) {
+ case DurationMetric_AggregationType_SUM:
return make_unique<OringDurationTracker>(mWizard, mConditionTrackerIndex, mNested,
mCurrentBucketStartTimeNs, mBucketSizeNs,
bucket);
- case DurationMetric_AggregationType_DURATION_MAX_SPARSE:
+ case DurationMetric_AggregationType_MAX_SPARSE:
return make_unique<MaxDurationTracker>(mWizard, mConditionTrackerIndex, mNested,
mCurrentBucketStartTimeNs, mBucketSizeNs,
bucket);
}
enum LogicalOperation {
+ LOGICAL_OPERATION_UNSPECIFIED = 0;
AND = 1;
OR = 2;
NOT = 3;
optional int64 bucket_size_millis = 1;
}
-message Alert {
- optional string name = 1;
-
- optional string metric_name = 2;
-
- message IncidentdDetails {
- repeated int32 section = 1;
- }
- optional IncidentdDetails incidentd_details = 3;
-
- optional int32 number_of_buckets = 4;
-
- optional int32 refractory_period_secs = 5;
+message EventConditionLink {
+ optional string condition = 1;
- optional int64 trigger_if_sum_gt = 6;
+ repeated KeyMatcher key_in_main = 2;
- optional int32 refractory_period_in_buckets = 7;
+ repeated KeyMatcher key_in_condition = 3;
}
message EventMetric {
optional Bucket bucket = 5;
- optional bool include_in_output = 6;
-
- repeated EventConditionLink links = 7;
+ repeated EventConditionLink links = 6;
}
message DurationMetric {
repeated EventConditionLink links = 4;
enum AggregationType {
- DURATION_SUM = 1;
+ SUM = 1;
- DURATION_MAX_SPARSE = 2;
+ MAX_SPARSE = 2;
}
- optional AggregationType type = 5;
+ optional AggregationType aggregation_type = 5 [default = SUM];
repeated KeyMatcher dimension = 6;
repeated EventConditionLink links = 7;
- enum Operation { SUM = 1; }
- optional Operation operation = 9 [default = SUM];
+ enum AggregationType {
+ SUM = 1;
+ }
+ optional AggregationType aggregation_type = 8 [default = SUM];
}
-message EventConditionLink {
- optional string condition = 1;
+message Alert {
+ optional string name = 1;
- repeated KeyMatcher key_in_main = 2;
- repeated KeyMatcher key_in_condition = 3;
-};
+ optional string metric_name = 2;
+
+ message IncidentdDetails {
+ repeated int32 section = 1;
+ }
+ optional IncidentdDetails incidentd_details = 3;
+
+ optional int32 number_of_buckets = 4;
+
+ optional int32 refractory_period_secs = 5;
+
+ optional int64 trigger_if_sum_gt = 6;
+
+ optional int32 refractory_period_in_buckets = 7;
+}
message StatsdConfig {
optional string name = 1;
repeated Condition condition = 8;
- repeated Alert alerts = 9;
+ repeated Alert alert = 9;
}