blob: 07bbcb2190e8d193af9f2517c7061e7ef7213a39 [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 -070018option optimize_for = LITE_RUNTIME;
19
Stefan Lafoncdb1a0e2017-09-27 20:24:15 -070020package android.os.statsd;
21
Yao Chenab273e22017-09-06 12:53:50 -070022option java_package = "com.android.internal.os";
23option java_outer_classname = "StatsdConfigProto";
24
Primiano Tuccie4d44912018-01-10 12:14:50 +000025import "frameworks/base/cmds/statsd/src/perfetto/perfetto_config.proto";
26
Yangster-mac20877162017-12-22 17:19:39 -080027enum Position {
Yangsterb84e8b12018-01-22 16:18:34 -080028 POSITION_UNKNOWN = 0;
29
30 FIRST = 1;
31
32 LAST = 2;
33
34 ANY = 3;
Yao Chenab273e22017-09-06 12:53:50 -070035}
36
Yangster-macb8144812018-01-04 10:56:23 -080037enum TimeUnit {
Yangsterb84e8b12018-01-22 16:18:34 -080038 TIME_UNIT_UNSPECIFIED = 0;
39 ONE_MINUTE = 1;
40 FIVE_MINUTES = 2;
41 TEN_MINUTES = 3;
42 THIRTY_MINUTES = 4;
43 ONE_HOUR = 5;
44 THREE_HOURS = 6;
45 SIX_HOURS = 7;
46 TWELVE_HOURS = 8;
47 ONE_DAY = 9;
48 CTS = 1000;
Yangster-macb8144812018-01-04 10:56:23 -080049}
50
Yangster-mac20877162017-12-22 17:19:39 -080051message FieldMatcher {
Yangsterb84e8b12018-01-22 16:18:34 -080052 optional int32 field = 1;
Yangster-mac20877162017-12-22 17:19:39 -080053
Yangsterb84e8b12018-01-22 16:18:34 -080054 optional Position position = 2;
Yangster-mac20877162017-12-22 17:19:39 -080055
Yangsterb84e8b12018-01-22 16:18:34 -080056 repeated FieldMatcher child = 3;
Yangster-mac20877162017-12-22 17:19:39 -080057}
58
59message FieldValueMatcher {
Yangsterb84e8b12018-01-22 16:18:34 -080060 optional int32 field = 1;
Yangster-mac20877162017-12-22 17:19:39 -080061
Yangsterb84e8b12018-01-22 16:18:34 -080062 optional Position position = 2;
Yao Chenab273e22017-09-06 12:53:50 -070063
Yangsterb84e8b12018-01-22 16:18:34 -080064 oneof value_matcher {
65 bool eq_bool = 3;
66 string eq_string = 4;
67 int32 eq_int = 5;
David Chendd896942017-09-26 11:44:40 -070068
Yangsterb84e8b12018-01-22 16:18:34 -080069 int64 lt_int = 6;
70 int64 gt_int = 7;
71 float lt_float = 8;
72 float gt_float = 9;
David Chendd896942017-09-26 11:44:40 -070073
Yangsterb84e8b12018-01-22 16:18:34 -080074 int64 lte_int = 10;
75 int64 gte_int = 11;
Yangster-mac20877162017-12-22 17:19:39 -080076
Yangsterb84e8b12018-01-22 16:18:34 -080077 MessageMatcher matches_tuple = 12;
78 }
Yao Chenab273e22017-09-06 12:53:50 -070079}
80
Yangster-mac20877162017-12-22 17:19:39 -080081message MessageMatcher {
Yangsterb84e8b12018-01-22 16:18:34 -080082 repeated FieldValueMatcher field_value_matcher = 1;
Yangster-mac20877162017-12-22 17:19:39 -080083}
84
yro00698da2017-09-15 10:06:40 -070085enum LogicalOperation {
Yangsterb84e8b12018-01-22 16:18:34 -080086 LOGICAL_OPERATION_UNSPECIFIED = 0;
87 AND = 1;
88 OR = 2;
89 NOT = 3;
90 NAND = 4;
91 NOR = 5;
Yao Chenab273e22017-09-06 12:53:50 -070092}
93
Stefan Lafonb8c9aa82017-12-03 14:27:25 -080094message SimpleAtomMatcher {
Yangsterb84e8b12018-01-22 16:18:34 -080095 optional int32 atom_id = 1;
yro00698da2017-09-15 10:06:40 -070096
Yangsterb84e8b12018-01-22 16:18:34 -080097 repeated FieldValueMatcher field_value_matcher = 2;
Yao Chenab273e22017-09-06 12:53:50 -070098}
99
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800100message AtomMatcher {
Yangsterb84e8b12018-01-22 16:18:34 -0800101 optional int64 id = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700102
Yangsterb84e8b12018-01-22 16:18:34 -0800103 message Combination {
104 optional LogicalOperation operation = 1;
Yao Chencaf339d2017-10-06 16:01:10 -0700105
Yangsterb84e8b12018-01-22 16:18:34 -0800106 repeated int64 matcher = 2;
107 }
108 oneof contents {
109 SimpleAtomMatcher simple_atom_matcher = 2;
110 Combination combination = 3;
111 }
Yao Chenab273e22017-09-06 12:53:50 -0700112}
113
Stefan Lafon12d01fa2017-12-04 20:56:09 -0800114message SimplePredicate {
Yangsterb84e8b12018-01-22 16:18:34 -0800115 optional int64 start = 1;
yro00698da2017-09-15 10:06:40 -0700116
Yangsterb84e8b12018-01-22 16:18:34 -0800117 optional int64 stop = 2;
yro00698da2017-09-15 10:06:40 -0700118
Yangsterb84e8b12018-01-22 16:18:34 -0800119 optional bool count_nesting = 3 [default = true];
yro00698da2017-09-15 10:06:40 -0700120
Yangsterb84e8b12018-01-22 16:18:34 -0800121 optional int64 stop_all = 4;
Yao Chen5154a372017-10-30 22:57:06 -0700122
Yangsterb84e8b12018-01-22 16:18:34 -0800123 enum InitialValue {
124 UNKNOWN = 0;
125 FALSE = 1;
126 }
127 optional InitialValue initial_value = 5 [default = FALSE];
Yao Chen967b2052017-11-07 16:36:43 -0800128
Yangsterb84e8b12018-01-22 16:18:34 -0800129 optional FieldMatcher dimensions = 6;
yro00698da2017-09-15 10:06:40 -0700130}
131
Stefan Lafon12d01fa2017-12-04 20:56:09 -0800132message Predicate {
Yangsterb84e8b12018-01-22 16:18:34 -0800133 optional int64 id = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700134
Yangsterb84e8b12018-01-22 16:18:34 -0800135 message Combination {
136 optional LogicalOperation operation = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700137
Yangsterb84e8b12018-01-22 16:18:34 -0800138 repeated int64 predicate = 2;
139 }
Yao Chenab273e22017-09-06 12:53:50 -0700140
Yangsterb84e8b12018-01-22 16:18:34 -0800141 oneof contents {
142 SimplePredicate simple_predicate = 2;
143 Combination combination = 3;
144 }
Yao Chenab273e22017-09-06 12:53:50 -0700145}
146
Stefan Lafona5b51912017-12-05 21:43:52 -0800147message MetricConditionLink {
Yangsterb84e8b12018-01-22 16:18:34 -0800148 optional int64 condition = 1;
Yangster-macd1815dc2017-11-13 21:43:15 -0800149
Yangsterb84e8b12018-01-22 16:18:34 -0800150 optional FieldMatcher fields_in_what = 2;
Yangster-macd1815dc2017-11-13 21:43:15 -0800151
Yangsterb84e8b12018-01-22 16:18:34 -0800152 optional FieldMatcher fields_in_condition = 3;
Yao Chen729093d2017-10-16 10:33:26 -0700153}
154
Chenjie Yud9dfda72017-12-11 17:41:20 -0800155message FieldFilter {
Yangsterb84e8b12018-01-22 16:18:34 -0800156 optional bool include_all = 1 [default = false];
157 optional FieldMatcher fields = 2;
Chenjie Yud9dfda72017-12-11 17:41:20 -0800158}
159
yro00698da2017-09-15 10:06:40 -0700160message EventMetric {
Yangsterb84e8b12018-01-22 16:18:34 -0800161 optional int64 id = 1;
yro00698da2017-09-15 10:06:40 -0700162
Yangsterb84e8b12018-01-22 16:18:34 -0800163 optional int64 what = 2;
yro00698da2017-09-15 10:06:40 -0700164
Yangsterb84e8b12018-01-22 16:18:34 -0800165 optional int64 condition = 3;
Yao Chen729093d2017-10-16 10:33:26 -0700166
Yangsterb84e8b12018-01-22 16:18:34 -0800167 repeated MetricConditionLink links = 4;
Yao Chenab273e22017-09-06 12:53:50 -0700168}
169
yro00698da2017-09-15 10:06:40 -0700170message CountMetric {
Yangsterb84e8b12018-01-22 16:18:34 -0800171 optional int64 id = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700172
Yangsterb84e8b12018-01-22 16:18:34 -0800173 optional int64 what = 2;
Yao Chenab273e22017-09-06 12:53:50 -0700174
Yangsterb84e8b12018-01-22 16:18:34 -0800175 optional int64 condition = 3;
Yao Chenab273e22017-09-06 12:53:50 -0700176
Yangsterb84e8b12018-01-22 16:18:34 -0800177 optional FieldMatcher dimensions_in_what = 4;
Yao Chenab273e22017-09-06 12:53:50 -0700178
Yangsterb84e8b12018-01-22 16:18:34 -0800179 optional FieldMatcher dimensions_in_condition = 7;
Yao Chen729093d2017-10-16 10:33:26 -0700180
Yangsterb84e8b12018-01-22 16:18:34 -0800181 optional TimeUnit bucket = 5;
Yangster-mac468ff042018-01-17 12:26:34 -0800182
Yangsterb84e8b12018-01-22 16:18:34 -0800183 repeated MetricConditionLink links = 6;
Yao Chenab273e22017-09-06 12:53:50 -0700184}
185
Yao Chencaf339d2017-10-06 16:01:10 -0700186message DurationMetric {
Yangsterb84e8b12018-01-22 16:18:34 -0800187 optional int64 id = 1;
Yao Chencaf339d2017-10-06 16:01:10 -0700188
Yangsterb84e8b12018-01-22 16:18:34 -0800189 optional int64 what = 2;
Yao Chen729093d2017-10-16 10:33:26 -0700190
Yangsterb84e8b12018-01-22 16:18:34 -0800191 optional int64 condition = 3;
Yao Chen5c925ad2017-11-15 14:15:46 -0800192
Yangsterb84e8b12018-01-22 16:18:34 -0800193 repeated MetricConditionLink links = 4;
Yao Chen5c925ad2017-11-15 14:15:46 -0800194
Yangsterb84e8b12018-01-22 16:18:34 -0800195 enum AggregationType {
196 SUM = 1;
Yao Chencaf339d2017-10-06 16:01:10 -0700197
Yangsterb84e8b12018-01-22 16:18:34 -0800198 MAX_SPARSE = 2;
199 }
200 optional AggregationType aggregation_type = 5 [default = SUM];
Yao Chencaf339d2017-10-06 16:01:10 -0700201
Yangsterb84e8b12018-01-22 16:18:34 -0800202 optional FieldMatcher dimensions_in_what = 6;
Yao Chencaf339d2017-10-06 16:01:10 -0700203
Yangsterb84e8b12018-01-22 16:18:34 -0800204 optional FieldMatcher dimensions_in_condition = 8;
Yangster-mac468ff042018-01-17 12:26:34 -0800205
Yangsterb84e8b12018-01-22 16:18:34 -0800206 optional TimeUnit bucket = 7;
Yangsterfa28aec2017-10-30 10:29:52 -0700207}
208
209message GaugeMetric {
Yangsterb84e8b12018-01-22 16:18:34 -0800210 optional int64 id = 1;
Yangsterfa28aec2017-10-30 10:29:52 -0700211
Yangsterb84e8b12018-01-22 16:18:34 -0800212 optional int64 what = 2;
Yangsterfa28aec2017-10-30 10:29:52 -0700213
Yangsterb84e8b12018-01-22 16:18:34 -0800214 optional FieldFilter gauge_fields_filter = 3;
Yangsterfa28aec2017-10-30 10:29:52 -0700215
Yangsterb84e8b12018-01-22 16:18:34 -0800216 optional int64 condition = 4;
Yangsterfa28aec2017-10-30 10:29:52 -0700217
Yangsterb84e8b12018-01-22 16:18:34 -0800218 optional FieldMatcher dimensions_in_what = 5;
Yangsterfa28aec2017-10-30 10:29:52 -0700219
Yangsterb84e8b12018-01-22 16:18:34 -0800220 optional FieldMatcher dimensions_in_condition = 8;
Yangsterfa28aec2017-10-30 10:29:52 -0700221
Yangsterb84e8b12018-01-22 16:18:34 -0800222 optional TimeUnit bucket = 6;
Yangster-mac468ff042018-01-17 12:26:34 -0800223
Yangsterb84e8b12018-01-22 16:18:34 -0800224 repeated MetricConditionLink links = 7;
Yao Chencaf339d2017-10-06 16:01:10 -0700225}
226
Yao Chen729093d2017-10-16 10:33:26 -0700227message ValueMetric {
Yangsterb84e8b12018-01-22 16:18:34 -0800228 optional int64 id = 1;
Yao Chen729093d2017-10-16 10:33:26 -0700229
Yangsterb84e8b12018-01-22 16:18:34 -0800230 optional int64 what = 2;
Yao Chen729093d2017-10-16 10:33:26 -0700231
Yangsterb84e8b12018-01-22 16:18:34 -0800232 optional FieldMatcher value_field = 3;
Yao Chen729093d2017-10-16 10:33:26 -0700233
Yangsterb84e8b12018-01-22 16:18:34 -0800234 optional int64 condition = 4;
Yao Chen729093d2017-10-16 10:33:26 -0700235
Yangsterb84e8b12018-01-22 16:18:34 -0800236 optional FieldMatcher dimensions_in_what = 5;
Yao Chen729093d2017-10-16 10:33:26 -0700237
Yangsterb84e8b12018-01-22 16:18:34 -0800238 optional FieldMatcher dimensions_in_condition = 9;
Yao Chen729093d2017-10-16 10:33:26 -0700239
Yangsterb84e8b12018-01-22 16:18:34 -0800240 optional TimeUnit bucket = 6;
Yangster-mac468ff042018-01-17 12:26:34 -0800241
Yangsterb84e8b12018-01-22 16:18:34 -0800242 repeated MetricConditionLink links = 7;
Yangsterfa28aec2017-10-30 10:29:52 -0700243
Yangsterb84e8b12018-01-22 16:18:34 -0800244 enum AggregationType {
245 SUM = 1;
246 }
247 optional AggregationType aggregation_type = 8 [default = SUM];
Yao Chen729093d2017-10-16 10:33:26 -0700248}
249
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800250message Alert {
Yangsterb84e8b12018-01-22 16:18:34 -0800251 optional int64 id = 1;
Yao Chen729093d2017-10-16 10:33:26 -0700252
Yangsterb84e8b12018-01-22 16:18:34 -0800253 optional int64 metric_id = 2;
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800254
Yangsterb84e8b12018-01-22 16:18:34 -0800255 optional int32 num_buckets = 3;
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800256
Yangsterb84e8b12018-01-22 16:18:34 -0800257 optional int32 refractory_period_secs = 4;
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800258
Yangsterb84e8b12018-01-22 16:18:34 -0800259 optional double trigger_if_sum_gt = 5;
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800260}
Yao Chen729093d2017-10-16 10:33:26 -0700261
Yangster-mac94e197c2018-01-02 16:03:03 -0800262message Alarm {
Yangsterb84e8b12018-01-22 16:18:34 -0800263 optional int64 id = 1;
264
265 optional int64 offset_millis = 2;
266
267 optional int64 period_millis = 3;
Yangster-mac94e197c2018-01-02 16:03:03 -0800268}
269
270message IncidentdDetails {
Yangsterb84e8b12018-01-22 16:18:34 -0800271 repeated int32 section = 1;
Yangster-mac94e197c2018-01-02 16:03:03 -0800272}
273
274message PerfettoDetails {
Yangsterb84e8b12018-01-22 16:18:34 -0800275 optional perfetto.protos.TraceConfig trace_config = 1;
276}
277
278message BroadcastSubscriberDetails {
279 optional int64 subscriber_id = 1;
Yangster-mac94e197c2018-01-02 16:03:03 -0800280}
281
282message Subscription {
Yangsterb84e8b12018-01-22 16:18:34 -0800283 optional int64 id = 1;
Yangster-mac94e197c2018-01-02 16:03:03 -0800284
Yangsterb84e8b12018-01-22 16:18:34 -0800285 enum RuleType {
286 RULE_TYPE_UNSPECIFIED = 0;
287 ALARM = 1;
288 ALERT = 2;
289 }
290 optional RuleType rule_type = 2;
Yangster-mac94e197c2018-01-02 16:03:03 -0800291
Yangsterb84e8b12018-01-22 16:18:34 -0800292 optional int64 rule_id = 3;
Yangster-mac94e197c2018-01-02 16:03:03 -0800293
Yangsterb84e8b12018-01-22 16:18:34 -0800294 oneof subscriber_information {
295 IncidentdDetails incidentd_details = 4;
296 PerfettoDetails perfetto_details = 5;
297 BroadcastSubscriberDetails broadcast_subscriber_details = 6;
298 }
Yangster-mac94e197c2018-01-02 16:03:03 -0800299}
300
Yao Chenab273e22017-09-06 12:53:50 -0700301message StatsdConfig {
Yangsterb84e8b12018-01-22 16:18:34 -0800302 optional int64 id = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700303
Yangsterb84e8b12018-01-22 16:18:34 -0800304 repeated EventMetric event_metric = 2;
yro00698da2017-09-15 10:06:40 -0700305
Yangsterb84e8b12018-01-22 16:18:34 -0800306 repeated CountMetric count_metric = 3;
yro00698da2017-09-15 10:06:40 -0700307
Yangsterb84e8b12018-01-22 16:18:34 -0800308 repeated ValueMetric value_metric = 4;
yro00698da2017-09-15 10:06:40 -0700309
Yangsterb84e8b12018-01-22 16:18:34 -0800310 repeated GaugeMetric gauge_metric = 5;
Yao Chen729093d2017-10-16 10:33:26 -0700311
Yangsterb84e8b12018-01-22 16:18:34 -0800312 repeated DurationMetric duration_metric = 6;
Yao Chen729093d2017-10-16 10:33:26 -0700313
Yangsterb84e8b12018-01-22 16:18:34 -0800314 repeated AtomMatcher atom_matcher = 7;
Yangster1d4d6862017-10-31 12:58:51 -0700315
Yangsterb84e8b12018-01-22 16:18:34 -0800316 repeated Predicate predicate = 8;
Yang Lu3eba6212017-10-25 19:54:45 -0700317
Yangsterb84e8b12018-01-22 16:18:34 -0800318 repeated Alert alert = 9;
Yao Chend10f7b12017-12-18 12:53:50 -0800319
Yangsterb84e8b12018-01-22 16:18:34 -0800320 repeated Alarm alarm = 10;
Yangster-mac94e197c2018-01-02 16:03:03 -0800321
Yangsterb84e8b12018-01-22 16:18:34 -0800322 repeated Subscription subscription = 11;
Yangster-mac94e197c2018-01-02 16:03:03 -0800323
Yangsterb84e8b12018-01-22 16:18:34 -0800324 repeated string allowed_log_source = 12;
Yangster-mac94e197c2018-01-02 16:03:03 -0800325
Yangsterb84e8b12018-01-22 16:18:34 -0800326 repeated int64 no_report_metric = 13;
Yao Chenab273e22017-09-06 12:53:50 -0700327}