blob: fd365602427d386926baa6bbbbb280e79f5852ad [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;
Yangster-mace06cfd72018-03-10 23:22:59 -080034
35 ALL = 4;
Yao Chenab273e22017-09-06 12:53:50 -070036}
37
Yangster-macb8144812018-01-04 10:56:23 -080038enum TimeUnit {
Yangsterb84e8b12018-01-22 16:18:34 -080039 TIME_UNIT_UNSPECIFIED = 0;
40 ONE_MINUTE = 1;
41 FIVE_MINUTES = 2;
42 TEN_MINUTES = 3;
43 THIRTY_MINUTES = 4;
44 ONE_HOUR = 5;
45 THREE_HOURS = 6;
46 SIX_HOURS = 7;
47 TWELVE_HOURS = 8;
48 ONE_DAY = 9;
49 CTS = 1000;
Yangster-macb8144812018-01-04 10:56:23 -080050}
51
Yangster-mac20877162017-12-22 17:19:39 -080052message FieldMatcher {
Yangsterb84e8b12018-01-22 16:18:34 -080053 optional int32 field = 1;
Yangster-mac20877162017-12-22 17:19:39 -080054
Yangsterb84e8b12018-01-22 16:18:34 -080055 optional Position position = 2;
Yangster-mac20877162017-12-22 17:19:39 -080056
Yangsterb84e8b12018-01-22 16:18:34 -080057 repeated FieldMatcher child = 3;
Yangster-mac20877162017-12-22 17:19:39 -080058}
59
60message FieldValueMatcher {
Yangsterb84e8b12018-01-22 16:18:34 -080061 optional int32 field = 1;
Yangster-mac20877162017-12-22 17:19:39 -080062
Yangsterb84e8b12018-01-22 16:18:34 -080063 optional Position position = 2;
Yao Chenab273e22017-09-06 12:53:50 -070064
Yangsterb84e8b12018-01-22 16:18:34 -080065 oneof value_matcher {
66 bool eq_bool = 3;
67 string eq_string = 4;
Bookatzb223c4e2018-02-01 15:35:04 -080068 int64 eq_int = 5;
David Chendd896942017-09-26 11:44:40 -070069
Yangsterb84e8b12018-01-22 16:18:34 -080070 int64 lt_int = 6;
71 int64 gt_int = 7;
72 float lt_float = 8;
73 float gt_float = 9;
David Chendd896942017-09-26 11:44:40 -070074
Yangsterb84e8b12018-01-22 16:18:34 -080075 int64 lte_int = 10;
76 int64 gte_int = 11;
Yangster-mac20877162017-12-22 17:19:39 -080077
Yangsterb84e8b12018-01-22 16:18:34 -080078 MessageMatcher matches_tuple = 12;
Yao Chen9b1140e2018-02-27 10:55:54 -080079
80 StringListMatcher eq_any_string = 13;
Yao Chend50f2ae2018-03-23 11:10:13 -070081 StringListMatcher neq_any_string = 14;
Yangsterb84e8b12018-01-22 16:18:34 -080082 }
Yao Chenab273e22017-09-06 12:53:50 -070083}
84
Yangster-mac20877162017-12-22 17:19:39 -080085message MessageMatcher {
Yangsterb84e8b12018-01-22 16:18:34 -080086 repeated FieldValueMatcher field_value_matcher = 1;
Yangster-mac20877162017-12-22 17:19:39 -080087}
88
Yao Chen9b1140e2018-02-27 10:55:54 -080089message StringListMatcher {
90 repeated string str_value = 1;
91}
92
yro00698da2017-09-15 10:06:40 -070093enum LogicalOperation {
Yangsterb84e8b12018-01-22 16:18:34 -080094 LOGICAL_OPERATION_UNSPECIFIED = 0;
95 AND = 1;
96 OR = 2;
97 NOT = 3;
98 NAND = 4;
99 NOR = 5;
Yao Chenab273e22017-09-06 12:53:50 -0700100}
101
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800102message SimpleAtomMatcher {
Yangsterb84e8b12018-01-22 16:18:34 -0800103 optional int32 atom_id = 1;
yro00698da2017-09-15 10:06:40 -0700104
Yangsterb84e8b12018-01-22 16:18:34 -0800105 repeated FieldValueMatcher field_value_matcher = 2;
Yao Chenab273e22017-09-06 12:53:50 -0700106}
107
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800108message AtomMatcher {
Yangsterb84e8b12018-01-22 16:18:34 -0800109 optional int64 id = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700110
Yangsterb84e8b12018-01-22 16:18:34 -0800111 message Combination {
112 optional LogicalOperation operation = 1;
Yao Chencaf339d2017-10-06 16:01:10 -0700113
Yangsterb84e8b12018-01-22 16:18:34 -0800114 repeated int64 matcher = 2;
115 }
116 oneof contents {
117 SimpleAtomMatcher simple_atom_matcher = 2;
118 Combination combination = 3;
119 }
Yao Chenab273e22017-09-06 12:53:50 -0700120}
121
Stefan Lafon12d01fa2017-12-04 20:56:09 -0800122message SimplePredicate {
Yangsterb84e8b12018-01-22 16:18:34 -0800123 optional int64 start = 1;
yro00698da2017-09-15 10:06:40 -0700124
Yangsterb84e8b12018-01-22 16:18:34 -0800125 optional int64 stop = 2;
yro00698da2017-09-15 10:06:40 -0700126
Yangsterb84e8b12018-01-22 16:18:34 -0800127 optional bool count_nesting = 3 [default = true];
yro00698da2017-09-15 10:06:40 -0700128
Yangsterb84e8b12018-01-22 16:18:34 -0800129 optional int64 stop_all = 4;
Yao Chen5154a372017-10-30 22:57:06 -0700130
Yangsterb84e8b12018-01-22 16:18:34 -0800131 enum InitialValue {
132 UNKNOWN = 0;
133 FALSE = 1;
134 }
135 optional InitialValue initial_value = 5 [default = FALSE];
Yao Chen967b2052017-11-07 16:36:43 -0800136
Yangsterb84e8b12018-01-22 16:18:34 -0800137 optional FieldMatcher dimensions = 6;
yro00698da2017-09-15 10:06:40 -0700138}
139
Stefan Lafon12d01fa2017-12-04 20:56:09 -0800140message Predicate {
Yangsterb84e8b12018-01-22 16:18:34 -0800141 optional int64 id = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700142
Yangsterb84e8b12018-01-22 16:18:34 -0800143 message Combination {
144 optional LogicalOperation operation = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700145
Yangsterb84e8b12018-01-22 16:18:34 -0800146 repeated int64 predicate = 2;
147 }
Yao Chenab273e22017-09-06 12:53:50 -0700148
Yangsterb84e8b12018-01-22 16:18:34 -0800149 oneof contents {
150 SimplePredicate simple_predicate = 2;
151 Combination combination = 3;
152 }
Yao Chenab273e22017-09-06 12:53:50 -0700153}
154
Stefan Lafona5b51912017-12-05 21:43:52 -0800155message MetricConditionLink {
Yangsterb84e8b12018-01-22 16:18:34 -0800156 optional int64 condition = 1;
Yangster-macd1815dc2017-11-13 21:43:15 -0800157
Yangsterb84e8b12018-01-22 16:18:34 -0800158 optional FieldMatcher fields_in_what = 2;
Yangster-macd1815dc2017-11-13 21:43:15 -0800159
Yangsterb84e8b12018-01-22 16:18:34 -0800160 optional FieldMatcher fields_in_condition = 3;
Yao Chen729093d2017-10-16 10:33:26 -0700161}
162
Chenjie Yud9dfda72017-12-11 17:41:20 -0800163message FieldFilter {
Yangsterb84e8b12018-01-22 16:18:34 -0800164 optional bool include_all = 1 [default = false];
165 optional FieldMatcher fields = 2;
Chenjie Yud9dfda72017-12-11 17:41:20 -0800166}
167
yro00698da2017-09-15 10:06:40 -0700168message EventMetric {
Yangsterb84e8b12018-01-22 16:18:34 -0800169 optional int64 id = 1;
yro00698da2017-09-15 10:06:40 -0700170
Yangsterb84e8b12018-01-22 16:18:34 -0800171 optional int64 what = 2;
yro00698da2017-09-15 10:06:40 -0700172
Yangsterb84e8b12018-01-22 16:18:34 -0800173 optional int64 condition = 3;
Yao Chen729093d2017-10-16 10:33:26 -0700174
Yangsterb84e8b12018-01-22 16:18:34 -0800175 repeated MetricConditionLink links = 4;
Yao Chenab273e22017-09-06 12:53:50 -0700176}
177
yro00698da2017-09-15 10:06:40 -0700178message CountMetric {
Yangsterb84e8b12018-01-22 16:18:34 -0800179 optional int64 id = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700180
Yangsterb84e8b12018-01-22 16:18:34 -0800181 optional int64 what = 2;
Yao Chenab273e22017-09-06 12:53:50 -0700182
Yangsterb84e8b12018-01-22 16:18:34 -0800183 optional int64 condition = 3;
Yao Chenab273e22017-09-06 12:53:50 -0700184
Yangsterb84e8b12018-01-22 16:18:34 -0800185 optional FieldMatcher dimensions_in_what = 4;
Yao Chenab273e22017-09-06 12:53:50 -0700186
Yangsterb84e8b12018-01-22 16:18:34 -0800187 optional FieldMatcher dimensions_in_condition = 7;
Yao Chen729093d2017-10-16 10:33:26 -0700188
Yangsterb84e8b12018-01-22 16:18:34 -0800189 optional TimeUnit bucket = 5;
Yangster-mac468ff042018-01-17 12:26:34 -0800190
Yangsterb84e8b12018-01-22 16:18:34 -0800191 repeated MetricConditionLink links = 6;
Yao Chenab273e22017-09-06 12:53:50 -0700192}
193
Yao Chencaf339d2017-10-06 16:01:10 -0700194message DurationMetric {
Yangsterb84e8b12018-01-22 16:18:34 -0800195 optional int64 id = 1;
Yao Chencaf339d2017-10-06 16:01:10 -0700196
Yangsterb84e8b12018-01-22 16:18:34 -0800197 optional int64 what = 2;
Yao Chen729093d2017-10-16 10:33:26 -0700198
Yangsterb84e8b12018-01-22 16:18:34 -0800199 optional int64 condition = 3;
Yao Chen5c925ad2017-11-15 14:15:46 -0800200
Yangsterb84e8b12018-01-22 16:18:34 -0800201 repeated MetricConditionLink links = 4;
Yao Chen5c925ad2017-11-15 14:15:46 -0800202
Yangsterb84e8b12018-01-22 16:18:34 -0800203 enum AggregationType {
204 SUM = 1;
Yao Chencaf339d2017-10-06 16:01:10 -0700205
Yangsterb84e8b12018-01-22 16:18:34 -0800206 MAX_SPARSE = 2;
207 }
208 optional AggregationType aggregation_type = 5 [default = SUM];
Yao Chencaf339d2017-10-06 16:01:10 -0700209
Yangsterb84e8b12018-01-22 16:18:34 -0800210 optional FieldMatcher dimensions_in_what = 6;
Yao Chencaf339d2017-10-06 16:01:10 -0700211
Yangsterb84e8b12018-01-22 16:18:34 -0800212 optional FieldMatcher dimensions_in_condition = 8;
Yangster-mac468ff042018-01-17 12:26:34 -0800213
Yangsterb84e8b12018-01-22 16:18:34 -0800214 optional TimeUnit bucket = 7;
Yangsterfa28aec2017-10-30 10:29:52 -0700215}
216
217message GaugeMetric {
Yangsterb84e8b12018-01-22 16:18:34 -0800218 optional int64 id = 1;
Yangsterfa28aec2017-10-30 10:29:52 -0700219
Yangsterb84e8b12018-01-22 16:18:34 -0800220 optional int64 what = 2;
Yangsterfa28aec2017-10-30 10:29:52 -0700221
Yangsterb84e8b12018-01-22 16:18:34 -0800222 optional FieldFilter gauge_fields_filter = 3;
Yangsterfa28aec2017-10-30 10:29:52 -0700223
Yangsterb84e8b12018-01-22 16:18:34 -0800224 optional int64 condition = 4;
Yangsterfa28aec2017-10-30 10:29:52 -0700225
Yangsterb84e8b12018-01-22 16:18:34 -0800226 optional FieldMatcher dimensions_in_what = 5;
Yangsterfa28aec2017-10-30 10:29:52 -0700227
Yangsterb84e8b12018-01-22 16:18:34 -0800228 optional FieldMatcher dimensions_in_condition = 8;
Yangsterfa28aec2017-10-30 10:29:52 -0700229
Yangsterb84e8b12018-01-22 16:18:34 -0800230 optional TimeUnit bucket = 6;
Yangster-mac468ff042018-01-17 12:26:34 -0800231
Yangsterb84e8b12018-01-22 16:18:34 -0800232 repeated MetricConditionLink links = 7;
Yangster-mac34ea1102018-01-29 12:40:55 -0800233
234 enum SamplingType {
235 RANDOM_ONE_SAMPLE = 1;
236 ALL_CONDITION_CHANGES = 2;
237 }
238 optional SamplingType sampling_type = 9 [default = RANDOM_ONE_SAMPLE] ;
David Chen81245fd2018-04-12 14:33:37 -0700239
240 optional int64 min_bucket_size_nanos = 10;
Yao Chencaf339d2017-10-06 16:01:10 -0700241}
242
Yao Chen729093d2017-10-16 10:33:26 -0700243message ValueMetric {
Yangsterb84e8b12018-01-22 16:18:34 -0800244 optional int64 id = 1;
Yao Chen729093d2017-10-16 10:33:26 -0700245
Yangsterb84e8b12018-01-22 16:18:34 -0800246 optional int64 what = 2;
Yao Chen729093d2017-10-16 10:33:26 -0700247
Yangsterb84e8b12018-01-22 16:18:34 -0800248 optional FieldMatcher value_field = 3;
Yao Chen729093d2017-10-16 10:33:26 -0700249
Yangsterb84e8b12018-01-22 16:18:34 -0800250 optional int64 condition = 4;
Yao Chen729093d2017-10-16 10:33:26 -0700251
Yangsterb84e8b12018-01-22 16:18:34 -0800252 optional FieldMatcher dimensions_in_what = 5;
Yao Chen729093d2017-10-16 10:33:26 -0700253
Yangsterb84e8b12018-01-22 16:18:34 -0800254 optional FieldMatcher dimensions_in_condition = 9;
Yao Chen729093d2017-10-16 10:33:26 -0700255
Yangsterb84e8b12018-01-22 16:18:34 -0800256 optional TimeUnit bucket = 6;
Yangster-mac468ff042018-01-17 12:26:34 -0800257
Yangsterb84e8b12018-01-22 16:18:34 -0800258 repeated MetricConditionLink links = 7;
Yangsterfa28aec2017-10-30 10:29:52 -0700259
Yangsterb84e8b12018-01-22 16:18:34 -0800260 enum AggregationType {
261 SUM = 1;
262 }
263 optional AggregationType aggregation_type = 8 [default = SUM];
David Chen81245fd2018-04-12 14:33:37 -0700264
265 optional int64 min_bucket_size_nanos = 10;
Yao Chen729093d2017-10-16 10:33:26 -0700266}
267
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800268message Alert {
Yangsterb84e8b12018-01-22 16:18:34 -0800269 optional int64 id = 1;
Yao Chen729093d2017-10-16 10:33:26 -0700270
Yangsterb84e8b12018-01-22 16:18:34 -0800271 optional int64 metric_id = 2;
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800272
Yangsterb84e8b12018-01-22 16:18:34 -0800273 optional int32 num_buckets = 3;
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800274
Yangsterb84e8b12018-01-22 16:18:34 -0800275 optional int32 refractory_period_secs = 4;
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800276
Yangsterb84e8b12018-01-22 16:18:34 -0800277 optional double trigger_if_sum_gt = 5;
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800278}
Yao Chen729093d2017-10-16 10:33:26 -0700279
Yangster-mac94e197c2018-01-02 16:03:03 -0800280message Alarm {
Yangsterb84e8b12018-01-22 16:18:34 -0800281 optional int64 id = 1;
282
283 optional int64 offset_millis = 2;
284
285 optional int64 period_millis = 3;
Yangster-mac94e197c2018-01-02 16:03:03 -0800286}
287
288message IncidentdDetails {
Yangsterb84e8b12018-01-22 16:18:34 -0800289 repeated int32 section = 1;
Yi Jinafb36062018-01-31 19:14:25 -0800290
291 enum Destination {
292 AUTOMATIC = 0;
293 EXPLICIT = 1;
294 }
295 optional Destination dest = 2;
Yangster-mac94e197c2018-01-02 16:03:03 -0800296}
297
298message PerfettoDetails {
Yangsterb84e8b12018-01-22 16:18:34 -0800299 optional perfetto.protos.TraceConfig trace_config = 1;
300}
301
302message BroadcastSubscriberDetails {
303 optional int64 subscriber_id = 1;
Bookatz058d8692018-03-06 09:53:47 -0800304 repeated string cookie = 2;
Yangster-mac94e197c2018-01-02 16:03:03 -0800305}
306
307message Subscription {
Yangsterb84e8b12018-01-22 16:18:34 -0800308 optional int64 id = 1;
Yangster-mac94e197c2018-01-02 16:03:03 -0800309
Yangsterb84e8b12018-01-22 16:18:34 -0800310 enum RuleType {
311 RULE_TYPE_UNSPECIFIED = 0;
312 ALARM = 1;
313 ALERT = 2;
314 }
315 optional RuleType rule_type = 2;
Yangster-mac94e197c2018-01-02 16:03:03 -0800316
Yangsterb84e8b12018-01-22 16:18:34 -0800317 optional int64 rule_id = 3;
Yangster-mac94e197c2018-01-02 16:03:03 -0800318
Yangsterb84e8b12018-01-22 16:18:34 -0800319 oneof subscriber_information {
320 IncidentdDetails incidentd_details = 4;
321 PerfettoDetails perfetto_details = 5;
322 BroadcastSubscriberDetails broadcast_subscriber_details = 6;
323 }
Bookatz12c12702018-02-16 15:14:42 -0800324
325 optional float probability_of_informing = 7 [default = 1.1];
Yangster-mac94e197c2018-01-02 16:03:03 -0800326}
327
Yao Chenab273e22017-09-06 12:53:50 -0700328message StatsdConfig {
Yangsterb84e8b12018-01-22 16:18:34 -0800329 optional int64 id = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700330
Yangsterb84e8b12018-01-22 16:18:34 -0800331 repeated EventMetric event_metric = 2;
yro00698da2017-09-15 10:06:40 -0700332
Yangsterb84e8b12018-01-22 16:18:34 -0800333 repeated CountMetric count_metric = 3;
yro00698da2017-09-15 10:06:40 -0700334
Yangsterb84e8b12018-01-22 16:18:34 -0800335 repeated ValueMetric value_metric = 4;
yro00698da2017-09-15 10:06:40 -0700336
Yangsterb84e8b12018-01-22 16:18:34 -0800337 repeated GaugeMetric gauge_metric = 5;
Yao Chen729093d2017-10-16 10:33:26 -0700338
Yangsterb84e8b12018-01-22 16:18:34 -0800339 repeated DurationMetric duration_metric = 6;
Yao Chen729093d2017-10-16 10:33:26 -0700340
Yangsterb84e8b12018-01-22 16:18:34 -0800341 repeated AtomMatcher atom_matcher = 7;
Yangster1d4d6862017-10-31 12:58:51 -0700342
Yangsterb84e8b12018-01-22 16:18:34 -0800343 repeated Predicate predicate = 8;
Yang Lu3eba6212017-10-25 19:54:45 -0700344
Yangsterb84e8b12018-01-22 16:18:34 -0800345 repeated Alert alert = 9;
Yao Chend10f7b12017-12-18 12:53:50 -0800346
Yangsterb84e8b12018-01-22 16:18:34 -0800347 repeated Alarm alarm = 10;
Yangster-mac94e197c2018-01-02 16:03:03 -0800348
Yangsterb84e8b12018-01-22 16:18:34 -0800349 repeated Subscription subscription = 11;
Yangster-mac94e197c2018-01-02 16:03:03 -0800350
Yangsterb84e8b12018-01-22 16:18:34 -0800351 repeated string allowed_log_source = 12;
Yangster-mac94e197c2018-01-02 16:03:03 -0800352
Yangsterb84e8b12018-01-22 16:18:34 -0800353 repeated int64 no_report_metric = 13;
David Chenfaa1af52018-03-30 15:14:04 -0700354
355 message Annotation {
356 optional int64 field_int64 = 1;
357 optional int32 field_int32 = 2;
358 }
359 repeated Annotation annotation = 14;
360
Yangster-macb142cc82018-03-30 15:22:08 -0700361 optional int64 ttl_in_seconds = 15;
362
David Chenfaa1af52018-03-30 15:14:04 -0700363 // Field number 1000 is reserved for later use.
364 reserved 1000;
Yao Chenab273e22017-09-06 12:53:50 -0700365}