blob: a07f76ad4e8ed94cb55cb87cd178bcb45543d826 [file] [log] [blame]
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
syntax = "proto2";
option optimize_for = LITE_RUNTIME;
package android.os.statsd;
option java_package = "com.android.internal.os";
option java_outer_classname = "StatsdConfigProto";
message KeyMatcher {
optional int32 key = 1;
optional bool as_package_name = 2 [ default = false ];
}
message KeyValueMatcher {
optional KeyMatcher key_matcher = 1;
oneof value_matcher {
bool eq_bool = 2;
string eq_string = 3;
int32 eq_int = 4;
int64 lt_int = 5;
int64 gt_int = 6;
float lt_float = 7;
float gt_float = 8;
int64 lte_int = 9;
int64 gte_int = 10;
}
}
enum LogicalOperation {
AND = 1;
OR = 2;
NOT = 3;
NAND = 4;
NOR = 5;
}
message SimpleLogEntryMatcher {
optional int32 tag = 1;
repeated KeyValueMatcher key_value_matcher = 2;
}
message LogEntryMatcher {
optional string name = 1;
message Combination {
optional LogicalOperation operation = 1;
repeated string matcher = 2;
}
oneof contents {
SimpleLogEntryMatcher simple_log_entry_matcher = 2;
Combination combination = 3;
}
}
message SimpleCondition {
optional string start = 1;
optional string stop = 2;
optional bool count_nesting = 3 [default = true];
optional string stop_all = 4;
enum InitialValue {
UNKNOWN = 0;
FALSE = 1;
}
optional InitialValue initial_value = 5 [default = UNKNOWN];
repeated KeyMatcher dimension = 6;
}
message Condition {
optional string name = 1;
message Combination {
optional LogicalOperation operation = 1;
repeated string condition = 2;
}
oneof contents {
SimpleCondition simple_condition = 2;
Combination combination = 3;
}
}
message Bucket {
optional int64 bucket_size_millis = 1;
}
message Alert {
message IncidentdDetails {
optional string alert_name = 1;
repeated int32 incidentd_sections = 2;
}
optional IncidentdDetails incidentd_details = 1;
optional int32 number_of_buckets = 3;
optional int32 refractory_period_secs = 4;
optional int64 trigger_if_sum_gt = 5;
optional int32 refractory_period_in_buckets = 6;
}
message EventMetric {
optional int64 metric_id = 1;
optional string what = 2;
optional string condition = 3;
repeated EventConditionLink links = 4;
}
message CountMetric {
optional int64 metric_id = 1;
optional string what = 2;
optional string condition = 3;
repeated KeyMatcher dimension = 4;
optional Bucket bucket = 5;
repeated Alert alerts = 6;
optional bool include_in_output = 7;
repeated EventConditionLink links = 8;
}
message DurationMetric {
optional int64 metric_id = 1;
optional string what = 2;
enum AggregationType {
DURATION_SUM = 1;
DURATION_MAX_SPARSE = 2;
}
optional AggregationType type = 3;
optional string predicate = 4;
repeated KeyMatcher dimension = 5;
optional Bucket bucket = 6;
repeated Alert alerts = 7;
repeated EventConditionLink links = 8;
}
message GaugeMetric {
optional int64 metric_id = 1;
optional string what = 2;
optional int32 gauge_field = 3;
optional string condition = 4;
repeated KeyMatcher dimension = 5;
optional Bucket bucket = 6;
repeated Alert alerts = 7;
repeated EventConditionLink links = 8;
}
message ValueMetric {
optional int64 metric_id = 1;
optional string what = 2;
optional int32 value_field = 3;
optional string condition = 4;
repeated KeyMatcher dimension = 5;
optional Bucket bucket = 6;
repeated Alert alerts = 7;
repeated EventConditionLink links = 8;
enum Operation {
SUM = 1;
}
optional Operation operation = 9 [default = SUM];
}
message EventConditionLink {
optional string condition = 1;
repeated KeyMatcher key_in_main = 2;
repeated KeyMatcher key_in_condition = 3;
};
message StatsdConfig {
optional int64 config_id = 1;
repeated EventMetric event_metric = 2;
repeated CountMetric count_metric = 3;
repeated ValueMetric value_metric = 4;
repeated DurationMetric duration_metric = 5;
repeated GaugeMetric gauge_metric = 6;
repeated LogEntryMatcher log_entry_matcher = 7;
repeated Condition condition = 8;
repeated Alert alerts = 9;
}