blob: 1ed1e05ba2721f8f1741b2aa5979381f84154acb [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";
enum Position {
POSITION_UNKNOWN = 0;
FIRST = 1;
LAST = 2;
ANY = 3;
}
message FieldMatcher {
optional int32 field = 1;
optional Position position = 2;
repeated FieldMatcher child = 3;
}
message FieldValueMatcher {
// Field id, as specified in the atom proto message.
optional int32 field = 1;
// For repeated fields, specifies the position in the array.
// FIRST and LAST mean that if the values are found at the first
// or last position, it's a match. ANY means that if the values are found
// anywhere in the array, then it's a match.
optional Position position = 2;
oneof value_matcher {
bool eq_bool = 3;
string eq_string = 4;
int32 eq_int = 5;
int64 lt_int = 6;
int64 gt_int = 7;
float lt_float = 8;
float gt_float = 9;
int64 lte_int = 10;
int64 gte_int = 11;
MessageMatcher matches_tuple = 12;
}
}
message MessageMatcher {
repeated FieldValueMatcher field_value_matcher = 1;
}
enum LogicalOperation {
LOGICAL_OPERATION_UNSPECIFIED = 0;
AND = 1;
OR = 2;
NOT = 3;
NAND = 4;
NOR = 5;
}
message SimpleAtomMatcher {
optional int32 atom_id = 1;
repeated FieldValueMatcher field_value_matcher = 2;
}
message AtomMatcher {
optional string name = 1;
message Combination {
optional LogicalOperation operation = 1;
repeated string matcher = 2;
}
oneof contents {
SimpleAtomMatcher simple_atom_matcher = 2;
Combination combination = 3;
}
}
message SimplePredicate {
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 = FALSE];
optional FieldMatcher dimensions = 6;
}
message Predicate {
optional string name = 1;
message Combination {
optional LogicalOperation operation = 1;
repeated string predicate = 2;
}
oneof contents {
SimplePredicate simple_predicate = 2;
Combination combination = 3;
}
}
message Bucket {
optional int64 bucket_size_millis = 1;
}
message MetricConditionLink {
optional string condition = 1;
optional FieldMatcher dimensions_in_what = 2;
optional FieldMatcher dimensions_in_condition = 3;
}
message FieldFilter {
optional bool include_all = 1 [default = false];
optional FieldMatcher fields = 2;
}
message EventMetric {
optional string name = 1;
optional string what = 2;
optional string condition = 3;
repeated MetricConditionLink links = 4;
}
message CountMetric {
optional string name = 1;
optional string what = 2;
optional string condition = 3;
optional FieldMatcher dimensions = 4;
optional Bucket bucket = 5;
repeated MetricConditionLink links = 6;
}
message DurationMetric {
optional string name = 1;
optional string what = 2;
optional string condition = 3;
repeated MetricConditionLink links = 4;
enum AggregationType {
SUM = 1;
MAX_SPARSE = 2;
}
optional AggregationType aggregation_type = 5 [default = SUM];
optional FieldMatcher dimensions = 6;
optional Bucket bucket = 7;
}
message GaugeMetric {
optional string name = 1;
optional string what = 2;
optional FieldFilter gauge_fields_filter = 3;
optional string condition = 4;
optional FieldMatcher dimensions = 5;
optional Bucket bucket = 6;
repeated MetricConditionLink links = 7;
}
message ValueMetric {
optional string name = 1;
optional string what = 2;
optional int32 value_field = 3;
optional string condition = 4;
optional FieldMatcher dimensions = 5;
optional Bucket bucket = 6;
repeated MetricConditionLink links = 7;
enum AggregationType { SUM = 1; }
optional AggregationType aggregation_type = 8 [default = SUM];
}
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;
optional int64 trigger_if_sum_gt = 6;
}
message AllowedLogSource {
repeated int32 uid = 1;
repeated string package = 2;
}
message StatsdConfig {
optional string name = 1;
repeated EventMetric event_metric = 2;
repeated CountMetric count_metric = 3;
repeated ValueMetric value_metric = 4;
repeated GaugeMetric gauge_metric = 5;
repeated DurationMetric duration_metric = 6;
repeated AtomMatcher atom_matcher = 7;
repeated Predicate predicate = 8;
repeated Alert alert = 9;
optional AllowedLogSource log_source = 10;
}