blob: 8750275645467beb917c5bc60ea8be4ce78d1dba [file] [log] [blame]
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Yao Chenab273e22017-09-06 12:53:50 -070016
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070017syntax = "proto2";
Yao Chenab273e22017-09-06 12:53:50 -070018
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070019package android.os.statsd;
20
Yao Chenab273e22017-09-06 12:53:50 -070021option java_package = "com.android.internal.os";
22option java_outer_classname = "StatsdConfigProto";
23
Primiano Tuccie4d44912018-01-10 12:14:50 +000024import "frameworks/base/cmds/statsd/src/perfetto/perfetto_config.proto";
25
Yangster-mac20877162017-12-22 17:19:39 -080026enum Position {
Yangsterb84e8b12018-01-22 16:18:34 -080027 POSITION_UNKNOWN = 0;
28
29 FIRST = 1;
30
31 LAST = 2;
32
33 ANY = 3;
Yao Chenab273e22017-09-06 12:53:50 -070034}
35
Yangster-macb8144812018-01-04 10:56:23 -080036enum TimeUnit {
Yangsterb84e8b12018-01-22 16:18:34 -080037 TIME_UNIT_UNSPECIFIED = 0;
38 ONE_MINUTE = 1;
39 FIVE_MINUTES = 2;
40 TEN_MINUTES = 3;
41 THIRTY_MINUTES = 4;
42 ONE_HOUR = 5;
43 THREE_HOURS = 6;
44 SIX_HOURS = 7;
45 TWELVE_HOURS = 8;
46 ONE_DAY = 9;
47 CTS = 1000;
Yangster-macb8144812018-01-04 10:56:23 -080048}
49
Yangster-mac20877162017-12-22 17:19:39 -080050message FieldMatcher {
Yangsterb84e8b12018-01-22 16:18:34 -080051 optional int32 field = 1;
Yangster-mac20877162017-12-22 17:19:39 -080052
Yangsterb84e8b12018-01-22 16:18:34 -080053 optional Position position = 2;
Yangster-mac20877162017-12-22 17:19:39 -080054
Yangsterb84e8b12018-01-22 16:18:34 -080055 repeated FieldMatcher child = 3;
Yangster-mac20877162017-12-22 17:19:39 -080056}
57
58message FieldValueMatcher {
Yangsterb84e8b12018-01-22 16:18:34 -080059 optional int32 field = 1;
Yangster-mac20877162017-12-22 17:19:39 -080060
Yangsterb84e8b12018-01-22 16:18:34 -080061 optional Position position = 2;
Yao Chenab273e22017-09-06 12:53:50 -070062
Yangsterb84e8b12018-01-22 16:18:34 -080063 oneof value_matcher {
64 bool eq_bool = 3;
65 string eq_string = 4;
Bookatzb223c4e2018-02-01 15:35:04 -080066 int64 eq_int = 5;
David Chendd896942017-09-26 11:44:40 -070067
Yangsterb84e8b12018-01-22 16:18:34 -080068 int64 lt_int = 6;
69 int64 gt_int = 7;
70 float lt_float = 8;
71 float gt_float = 9;
David Chendd896942017-09-26 11:44:40 -070072
Yangsterb84e8b12018-01-22 16:18:34 -080073 int64 lte_int = 10;
74 int64 gte_int = 11;
Yangster-mac20877162017-12-22 17:19:39 -080075
Yangsterb84e8b12018-01-22 16:18:34 -080076 MessageMatcher matches_tuple = 12;
77 }
Yao Chenab273e22017-09-06 12:53:50 -070078}
79
Yangster-mac20877162017-12-22 17:19:39 -080080message MessageMatcher {
Yangsterb84e8b12018-01-22 16:18:34 -080081 repeated FieldValueMatcher field_value_matcher = 1;
Yangster-mac20877162017-12-22 17:19:39 -080082}
83
yro00698da2017-09-15 10:06:40 -070084enum LogicalOperation {
Yangsterb84e8b12018-01-22 16:18:34 -080085 LOGICAL_OPERATION_UNSPECIFIED = 0;
86 AND = 1;
87 OR = 2;
88 NOT = 3;
89 NAND = 4;
90 NOR = 5;
Yao Chenab273e22017-09-06 12:53:50 -070091}
92
Stefan Lafonb8c9aa82017-12-03 14:27:25 -080093message SimpleAtomMatcher {
Yangsterb84e8b12018-01-22 16:18:34 -080094 optional int32 atom_id = 1;
yro00698da2017-09-15 10:06:40 -070095
Yangsterb84e8b12018-01-22 16:18:34 -080096 repeated FieldValueMatcher field_value_matcher = 2;
Yao Chenab273e22017-09-06 12:53:50 -070097}
98
Stefan Lafonb8c9aa82017-12-03 14:27:25 -080099message AtomMatcher {
Yangsterb84e8b12018-01-22 16:18:34 -0800100 optional int64 id = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700101
Yangsterb84e8b12018-01-22 16:18:34 -0800102 message Combination {
103 optional LogicalOperation operation = 1;
Yao Chencaf339d2017-10-06 16:01:10 -0700104
Yangsterb84e8b12018-01-22 16:18:34 -0800105 repeated int64 matcher = 2;
106 }
107 oneof contents {
108 SimpleAtomMatcher simple_atom_matcher = 2;
109 Combination combination = 3;
110 }
Yao Chenab273e22017-09-06 12:53:50 -0700111}
112
Stefan Lafon12d01fa2017-12-04 20:56:09 -0800113message SimplePredicate {
Yangsterb84e8b12018-01-22 16:18:34 -0800114 optional int64 start = 1;
yro00698da2017-09-15 10:06:40 -0700115
Yangsterb84e8b12018-01-22 16:18:34 -0800116 optional int64 stop = 2;
yro00698da2017-09-15 10:06:40 -0700117
Yangsterb84e8b12018-01-22 16:18:34 -0800118 optional bool count_nesting = 3 [default = true];
yro00698da2017-09-15 10:06:40 -0700119
Yangsterb84e8b12018-01-22 16:18:34 -0800120 optional int64 stop_all = 4;
Yao Chen5154a372017-10-30 22:57:06 -0700121
Yangsterb84e8b12018-01-22 16:18:34 -0800122 enum InitialValue {
123 UNKNOWN = 0;
124 FALSE = 1;
125 }
126 optional InitialValue initial_value = 5 [default = FALSE];
Yao Chen967b2052017-11-07 16:36:43 -0800127
Yangsterb84e8b12018-01-22 16:18:34 -0800128 optional FieldMatcher dimensions = 6;
yro00698da2017-09-15 10:06:40 -0700129}
130
Stefan Lafon12d01fa2017-12-04 20:56:09 -0800131message Predicate {
Yangsterb84e8b12018-01-22 16:18:34 -0800132 optional int64 id = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700133
Yangsterb84e8b12018-01-22 16:18:34 -0800134 message Combination {
135 optional LogicalOperation operation = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700136
Yangsterb84e8b12018-01-22 16:18:34 -0800137 repeated int64 predicate = 2;
138 }
Yao Chenab273e22017-09-06 12:53:50 -0700139
Yangsterb84e8b12018-01-22 16:18:34 -0800140 oneof contents {
141 SimplePredicate simple_predicate = 2;
142 Combination combination = 3;
143 }
Yao Chenab273e22017-09-06 12:53:50 -0700144}
145
Stefan Lafona5b51912017-12-05 21:43:52 -0800146message MetricConditionLink {
Yangsterb84e8b12018-01-22 16:18:34 -0800147 optional int64 condition = 1;
Yangster-macd1815dc2017-11-13 21:43:15 -0800148
Yangsterb84e8b12018-01-22 16:18:34 -0800149 optional FieldMatcher fields_in_what = 2;
Yangster-macd1815dc2017-11-13 21:43:15 -0800150
Yangsterb84e8b12018-01-22 16:18:34 -0800151 optional FieldMatcher fields_in_condition = 3;
Yao Chen729093d2017-10-16 10:33:26 -0700152}
153
Chenjie Yud9dfda72017-12-11 17:41:20 -0800154message FieldFilter {
Yangsterb84e8b12018-01-22 16:18:34 -0800155 optional bool include_all = 1 [default = false];
156 optional FieldMatcher fields = 2;
Chenjie Yud9dfda72017-12-11 17:41:20 -0800157}
158
yro00698da2017-09-15 10:06:40 -0700159message EventMetric {
Yangsterb84e8b12018-01-22 16:18:34 -0800160 optional int64 id = 1;
yro00698da2017-09-15 10:06:40 -0700161
Yangsterb84e8b12018-01-22 16:18:34 -0800162 optional int64 what = 2;
yro00698da2017-09-15 10:06:40 -0700163
Yangsterb84e8b12018-01-22 16:18:34 -0800164 optional int64 condition = 3;
Yao Chen729093d2017-10-16 10:33:26 -0700165
Yangsterb84e8b12018-01-22 16:18:34 -0800166 repeated MetricConditionLink links = 4;
Yao Chenab273e22017-09-06 12:53:50 -0700167}
168
yro00698da2017-09-15 10:06:40 -0700169message CountMetric {
Yangsterb84e8b12018-01-22 16:18:34 -0800170 optional int64 id = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700171
Yangsterb84e8b12018-01-22 16:18:34 -0800172 optional int64 what = 2;
Yao Chenab273e22017-09-06 12:53:50 -0700173
Yangsterb84e8b12018-01-22 16:18:34 -0800174 optional int64 condition = 3;
Yao Chenab273e22017-09-06 12:53:50 -0700175
Yangsterb84e8b12018-01-22 16:18:34 -0800176 optional FieldMatcher dimensions_in_what = 4;
Yao Chenab273e22017-09-06 12:53:50 -0700177
Yangsterb84e8b12018-01-22 16:18:34 -0800178 optional FieldMatcher dimensions_in_condition = 7;
Yao Chen729093d2017-10-16 10:33:26 -0700179
Yangsterb84e8b12018-01-22 16:18:34 -0800180 optional TimeUnit bucket = 5;
Yangster-mac468ff042018-01-17 12:26:34 -0800181
Yangsterb84e8b12018-01-22 16:18:34 -0800182 repeated MetricConditionLink links = 6;
Yao Chenab273e22017-09-06 12:53:50 -0700183}
184
Yao Chencaf339d2017-10-06 16:01:10 -0700185message DurationMetric {
Yangsterb84e8b12018-01-22 16:18:34 -0800186 optional int64 id = 1;
Yao Chencaf339d2017-10-06 16:01:10 -0700187
Yangsterb84e8b12018-01-22 16:18:34 -0800188 optional int64 what = 2;
Yao Chen729093d2017-10-16 10:33:26 -0700189
Yangsterb84e8b12018-01-22 16:18:34 -0800190 optional int64 condition = 3;
Yao Chen5c925ad2017-11-15 14:15:46 -0800191
Yangsterb84e8b12018-01-22 16:18:34 -0800192 repeated MetricConditionLink links = 4;
Yao Chen5c925ad2017-11-15 14:15:46 -0800193
Yangsterb84e8b12018-01-22 16:18:34 -0800194 enum AggregationType {
195 SUM = 1;
Yao Chencaf339d2017-10-06 16:01:10 -0700196
Yangsterb84e8b12018-01-22 16:18:34 -0800197 MAX_SPARSE = 2;
198 }
199 optional AggregationType aggregation_type = 5 [default = SUM];
Yao Chencaf339d2017-10-06 16:01:10 -0700200
Yangsterb84e8b12018-01-22 16:18:34 -0800201 optional FieldMatcher dimensions_in_what = 6;
Yao Chencaf339d2017-10-06 16:01:10 -0700202
Yangsterb84e8b12018-01-22 16:18:34 -0800203 optional FieldMatcher dimensions_in_condition = 8;
Yangster-mac468ff042018-01-17 12:26:34 -0800204
Yangsterb84e8b12018-01-22 16:18:34 -0800205 optional TimeUnit bucket = 7;
Yangsterfa28aec2017-10-30 10:29:52 -0700206}
207
208message GaugeMetric {
Yangsterb84e8b12018-01-22 16:18:34 -0800209 optional int64 id = 1;
Yangsterfa28aec2017-10-30 10:29:52 -0700210
Yangsterb84e8b12018-01-22 16:18:34 -0800211 optional int64 what = 2;
Yangsterfa28aec2017-10-30 10:29:52 -0700212
Yangsterb84e8b12018-01-22 16:18:34 -0800213 optional FieldFilter gauge_fields_filter = 3;
Yangsterfa28aec2017-10-30 10:29:52 -0700214
Yangsterb84e8b12018-01-22 16:18:34 -0800215 optional int64 condition = 4;
Yangsterfa28aec2017-10-30 10:29:52 -0700216
Yangsterb84e8b12018-01-22 16:18:34 -0800217 optional FieldMatcher dimensions_in_what = 5;
Yangsterfa28aec2017-10-30 10:29:52 -0700218
Yangsterb84e8b12018-01-22 16:18:34 -0800219 optional FieldMatcher dimensions_in_condition = 8;
Yangsterfa28aec2017-10-30 10:29:52 -0700220
Yangsterb84e8b12018-01-22 16:18:34 -0800221 optional TimeUnit bucket = 6;
Yangster-mac468ff042018-01-17 12:26:34 -0800222
Yangsterb84e8b12018-01-22 16:18:34 -0800223 repeated MetricConditionLink links = 7;
Yangster-mac34ea1102018-01-29 12:40:55 -0800224
225 enum SamplingType {
226 RANDOM_ONE_SAMPLE = 1;
227 ALL_CONDITION_CHANGES = 2;
228 }
229 optional SamplingType sampling_type = 9 [default = RANDOM_ONE_SAMPLE] ;
Yao Chencaf339d2017-10-06 16:01:10 -0700230}
231
Yao Chen729093d2017-10-16 10:33:26 -0700232message ValueMetric {
Yangsterb84e8b12018-01-22 16:18:34 -0800233 optional int64 id = 1;
Yao Chen729093d2017-10-16 10:33:26 -0700234
Yangsterb84e8b12018-01-22 16:18:34 -0800235 optional int64 what = 2;
Yao Chen729093d2017-10-16 10:33:26 -0700236
Yangsterb84e8b12018-01-22 16:18:34 -0800237 optional FieldMatcher value_field = 3;
Yao Chen729093d2017-10-16 10:33:26 -0700238
Yangsterb84e8b12018-01-22 16:18:34 -0800239 optional int64 condition = 4;
Yao Chen729093d2017-10-16 10:33:26 -0700240
Yangsterb84e8b12018-01-22 16:18:34 -0800241 optional FieldMatcher dimensions_in_what = 5;
Yao Chen729093d2017-10-16 10:33:26 -0700242
Yangsterb84e8b12018-01-22 16:18:34 -0800243 optional FieldMatcher dimensions_in_condition = 9;
Yao Chen729093d2017-10-16 10:33:26 -0700244
Yangsterb84e8b12018-01-22 16:18:34 -0800245 optional TimeUnit bucket = 6;
Yangster-mac468ff042018-01-17 12:26:34 -0800246
Yangsterb84e8b12018-01-22 16:18:34 -0800247 repeated MetricConditionLink links = 7;
Yangsterfa28aec2017-10-30 10:29:52 -0700248
Yangsterb84e8b12018-01-22 16:18:34 -0800249 enum AggregationType {
250 SUM = 1;
251 }
252 optional AggregationType aggregation_type = 8 [default = SUM];
Yao Chen729093d2017-10-16 10:33:26 -0700253}
254
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800255message Alert {
Yangsterb84e8b12018-01-22 16:18:34 -0800256 optional int64 id = 1;
Yao Chen729093d2017-10-16 10:33:26 -0700257
Yangsterb84e8b12018-01-22 16:18:34 -0800258 optional int64 metric_id = 2;
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800259
Yangsterb84e8b12018-01-22 16:18:34 -0800260 optional int32 num_buckets = 3;
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800261
Yangsterb84e8b12018-01-22 16:18:34 -0800262 optional int32 refractory_period_secs = 4;
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800263
Yangsterb84e8b12018-01-22 16:18:34 -0800264 optional double trigger_if_sum_gt = 5;
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800265}
Yao Chen729093d2017-10-16 10:33:26 -0700266
Yangster-mac94e197c2018-01-02 16:03:03 -0800267message Alarm {
Yangsterb84e8b12018-01-22 16:18:34 -0800268 optional int64 id = 1;
269
270 optional int64 offset_millis = 2;
271
272 optional int64 period_millis = 3;
Yangster-mac94e197c2018-01-02 16:03:03 -0800273}
274
275message IncidentdDetails {
Yangsterb84e8b12018-01-22 16:18:34 -0800276 repeated int32 section = 1;
Yi Jinafb36062018-01-31 19:14:25 -0800277
278 enum Destination {
279 AUTOMATIC = 0;
280 EXPLICIT = 1;
281 }
282 optional Destination dest = 2;
Yangster-mac94e197c2018-01-02 16:03:03 -0800283}
284
285message PerfettoDetails {
Yangsterb84e8b12018-01-22 16:18:34 -0800286 optional perfetto.protos.TraceConfig trace_config = 1;
287}
288
289message BroadcastSubscriberDetails {
290 optional int64 subscriber_id = 1;
Yangster-mac94e197c2018-01-02 16:03:03 -0800291}
292
293message Subscription {
Yangsterb84e8b12018-01-22 16:18:34 -0800294 optional int64 id = 1;
Yangster-mac94e197c2018-01-02 16:03:03 -0800295
Yangsterb84e8b12018-01-22 16:18:34 -0800296 enum RuleType {
297 RULE_TYPE_UNSPECIFIED = 0;
298 ALARM = 1;
299 ALERT = 2;
300 }
301 optional RuleType rule_type = 2;
Yangster-mac94e197c2018-01-02 16:03:03 -0800302
Yangsterb84e8b12018-01-22 16:18:34 -0800303 optional int64 rule_id = 3;
Yangster-mac94e197c2018-01-02 16:03:03 -0800304
Yangsterb84e8b12018-01-22 16:18:34 -0800305 oneof subscriber_information {
306 IncidentdDetails incidentd_details = 4;
307 PerfettoDetails perfetto_details = 5;
308 BroadcastSubscriberDetails broadcast_subscriber_details = 6;
309 }
Yangster-mac94e197c2018-01-02 16:03:03 -0800310}
311
Yao Chenab273e22017-09-06 12:53:50 -0700312message StatsdConfig {
Yangsterb84e8b12018-01-22 16:18:34 -0800313 optional int64 id = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700314
Yangsterb84e8b12018-01-22 16:18:34 -0800315 repeated EventMetric event_metric = 2;
yro00698da2017-09-15 10:06:40 -0700316
Yangsterb84e8b12018-01-22 16:18:34 -0800317 repeated CountMetric count_metric = 3;
yro00698da2017-09-15 10:06:40 -0700318
Yangsterb84e8b12018-01-22 16:18:34 -0800319 repeated ValueMetric value_metric = 4;
yro00698da2017-09-15 10:06:40 -0700320
Yangsterb84e8b12018-01-22 16:18:34 -0800321 repeated GaugeMetric gauge_metric = 5;
Yao Chen729093d2017-10-16 10:33:26 -0700322
Yangsterb84e8b12018-01-22 16:18:34 -0800323 repeated DurationMetric duration_metric = 6;
Yao Chen729093d2017-10-16 10:33:26 -0700324
Yangsterb84e8b12018-01-22 16:18:34 -0800325 repeated AtomMatcher atom_matcher = 7;
Yangster1d4d6862017-10-31 12:58:51 -0700326
Yangsterb84e8b12018-01-22 16:18:34 -0800327 repeated Predicate predicate = 8;
Yang Lu3eba6212017-10-25 19:54:45 -0700328
Yangsterb84e8b12018-01-22 16:18:34 -0800329 repeated Alert alert = 9;
Yao Chend10f7b12017-12-18 12:53:50 -0800330
Yangsterb84e8b12018-01-22 16:18:34 -0800331 repeated Alarm alarm = 10;
Yangster-mac94e197c2018-01-02 16:03:03 -0800332
Yangsterb84e8b12018-01-22 16:18:34 -0800333 repeated Subscription subscription = 11;
Yangster-mac94e197c2018-01-02 16:03:03 -0800334
Yangsterb84e8b12018-01-22 16:18:34 -0800335 repeated string allowed_log_source = 12;
Yangster-mac94e197c2018-01-02 16:03:03 -0800336
Yangsterb84e8b12018-01-22 16:18:34 -0800337 repeated int64 no_report_metric = 13;
Yao Chenab273e22017-09-06 12:53:50 -0700338}