blob: 6ac0e2863898f400282a2eecf5c4cc0f546734e4 [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
Yangster-mac20877162017-12-22 17:19:39 -080025enum Position {
26 POSITION_UNKNOWN = 0;
27 FIRST = 1;
28 LAST = 2;
29 ANY = 3;
Yao Chenab273e22017-09-06 12:53:50 -070030}
31
Yangster-mac20877162017-12-22 17:19:39 -080032message FieldMatcher {
33 optional int32 field = 1;
34
35 optional Position position = 2;
36
37 repeated FieldMatcher child = 3;
38}
39
40message FieldValueMatcher {
41 // Field id, as specified in the atom proto message.
42 optional int32 field = 1;
43
44 // For repeated fields, specifies the position in the array.
45 // FIRST and LAST mean that if the values are found at the first
46 // or last position, it's a match. ANY means that if the values are found
47 // anywhere in the array, then it's a match.
48 optional Position position = 2;
Yao Chenab273e22017-09-06 12:53:50 -070049
Stefan Lafonb8c9aa82017-12-03 14:27:25 -080050 oneof value_matcher {
Yangster-mac20877162017-12-22 17:19:39 -080051 bool eq_bool = 3;
52 string eq_string = 4;
53 int32 eq_int = 5;
David Chendd896942017-09-26 11:44:40 -070054
Yangster-mac20877162017-12-22 17:19:39 -080055 int64 lt_int = 6;
56 int64 gt_int = 7;
57 float lt_float = 8;
58 float gt_float = 9;
David Chendd896942017-09-26 11:44:40 -070059
Yangster-mac20877162017-12-22 17:19:39 -080060 int64 lte_int = 10;
61 int64 gte_int = 11;
62
63 MessageMatcher matches_tuple = 12;
Stefan Lafonb8c9aa82017-12-03 14:27:25 -080064 }
Yao Chenab273e22017-09-06 12:53:50 -070065}
66
Yangster-mac20877162017-12-22 17:19:39 -080067message MessageMatcher {
68 repeated FieldValueMatcher field_value_matcher = 1;
69}
70
yro00698da2017-09-15 10:06:40 -070071enum LogicalOperation {
Stefan Lafonb8c9aa82017-12-03 14:27:25 -080072 LOGICAL_OPERATION_UNSPECIFIED = 0;
73 AND = 1;
74 OR = 2;
75 NOT = 3;
76 NAND = 4;
77 NOR = 5;
Yao Chenab273e22017-09-06 12:53:50 -070078}
79
Stefan Lafonb8c9aa82017-12-03 14:27:25 -080080message SimpleAtomMatcher {
Yangster-mac20877162017-12-22 17:19:39 -080081 optional int32 atom_id = 1;
yro00698da2017-09-15 10:06:40 -070082
Yangster-mac20877162017-12-22 17:19:39 -080083 repeated FieldValueMatcher field_value_matcher = 2;
Yao Chenab273e22017-09-06 12:53:50 -070084}
85
Stefan Lafonb8c9aa82017-12-03 14:27:25 -080086message AtomMatcher {
Yangster-mac94e197c2018-01-02 16:03:03 -080087 optional int64 id = 1;
Yao Chenab273e22017-09-06 12:53:50 -070088
Stefan Lafonb8c9aa82017-12-03 14:27:25 -080089 message Combination {
90 optional LogicalOperation operation = 1;
Yao Chencaf339d2017-10-06 16:01:10 -070091
Yangster-mac94e197c2018-01-02 16:03:03 -080092 repeated int64 matcher = 2;
Stefan Lafonb8c9aa82017-12-03 14:27:25 -080093 }
94 oneof contents {
95 SimpleAtomMatcher simple_atom_matcher = 2;
96 Combination combination = 3;
97 }
Yao Chenab273e22017-09-06 12:53:50 -070098}
99
Stefan Lafon12d01fa2017-12-04 20:56:09 -0800100message SimplePredicate {
Yangster-mac94e197c2018-01-02 16:03:03 -0800101 optional int64 start = 1;
yro00698da2017-09-15 10:06:40 -0700102
Yangster-mac94e197c2018-01-02 16:03:03 -0800103 optional int64 stop = 2;
yro00698da2017-09-15 10:06:40 -0700104
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800105 optional bool count_nesting = 3 [default = true];
yro00698da2017-09-15 10:06:40 -0700106
Yangster-mac94e197c2018-01-02 16:03:03 -0800107 optional int64 stop_all = 4;
Yao Chen5154a372017-10-30 22:57:06 -0700108
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800109 enum InitialValue {
110 UNKNOWN = 0;
111 FALSE = 1;
112 }
113 optional InitialValue initial_value = 5 [default = FALSE];
Yao Chen967b2052017-11-07 16:36:43 -0800114
Yangster-mac20877162017-12-22 17:19:39 -0800115 optional FieldMatcher dimensions = 6;
yro00698da2017-09-15 10:06:40 -0700116}
117
Stefan Lafon12d01fa2017-12-04 20:56:09 -0800118message Predicate {
Yangster-mac94e197c2018-01-02 16:03:03 -0800119 optional int64 id = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700120
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800121 message Combination {
122 optional LogicalOperation operation = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700123
Yangster-mac94e197c2018-01-02 16:03:03 -0800124 repeated int64 predicate = 2;
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800125 }
Yao Chenab273e22017-09-06 12:53:50 -0700126
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800127 oneof contents {
Stefan Lafon12d01fa2017-12-04 20:56:09 -0800128 SimplePredicate simple_predicate = 2;
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800129 Combination combination = 3;
130 }
Yao Chenab273e22017-09-06 12:53:50 -0700131}
132
yro00698da2017-09-15 10:06:40 -0700133message Bucket {
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800134 optional int64 bucket_size_millis = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700135}
136
Stefan Lafona5b51912017-12-05 21:43:52 -0800137message MetricConditionLink {
Yangster-mac94e197c2018-01-02 16:03:03 -0800138 optional int64 condition = 1;
Yangster-macd1815dc2017-11-13 21:43:15 -0800139
Yangster-mac20877162017-12-22 17:19:39 -0800140 optional FieldMatcher dimensions_in_what = 2;
Yangster-macd1815dc2017-11-13 21:43:15 -0800141
Yangster-mac20877162017-12-22 17:19:39 -0800142 optional FieldMatcher dimensions_in_condition = 3;
Yao Chen729093d2017-10-16 10:33:26 -0700143}
144
Chenjie Yud9dfda72017-12-11 17:41:20 -0800145message FieldFilter {
Yangster-mac20877162017-12-22 17:19:39 -0800146 optional bool include_all = 1 [default = false];
147 optional FieldMatcher fields = 2;
Chenjie Yud9dfda72017-12-11 17:41:20 -0800148}
149
yro00698da2017-09-15 10:06:40 -0700150message EventMetric {
Yangster-mac94e197c2018-01-02 16:03:03 -0800151 optional int64 id = 1;
yro00698da2017-09-15 10:06:40 -0700152
Yangster-mac94e197c2018-01-02 16:03:03 -0800153 optional int64 what = 2;
yro00698da2017-09-15 10:06:40 -0700154
Yangster-mac94e197c2018-01-02 16:03:03 -0800155 optional int64 condition = 3;
Yao Chen729093d2017-10-16 10:33:26 -0700156
Stefan Lafona5b51912017-12-05 21:43:52 -0800157 repeated MetricConditionLink links = 4;
Yao Chenab273e22017-09-06 12:53:50 -0700158}
159
yro00698da2017-09-15 10:06:40 -0700160message CountMetric {
Yangster-mac94e197c2018-01-02 16:03:03 -0800161 optional int64 id = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700162
Yangster-mac94e197c2018-01-02 16:03:03 -0800163 optional int64 what = 2;
Yao Chenab273e22017-09-06 12:53:50 -0700164
Yangster-mac94e197c2018-01-02 16:03:03 -0800165 optional int64 condition = 3;
Yao Chenab273e22017-09-06 12:53:50 -0700166
Yangster-mac20877162017-12-22 17:19:39 -0800167 optional FieldMatcher dimensions = 4;
Yao Chenab273e22017-09-06 12:53:50 -0700168
Yangster-macd1815dc2017-11-13 21:43:15 -0800169 optional Bucket bucket = 5;
Yao Chen729093d2017-10-16 10:33:26 -0700170
Stefan Lafona5b51912017-12-05 21:43:52 -0800171 repeated MetricConditionLink links = 6;
Yao Chenab273e22017-09-06 12:53:50 -0700172}
173
Yao Chencaf339d2017-10-06 16:01:10 -0700174message DurationMetric {
Yangster-mac94e197c2018-01-02 16:03:03 -0800175 optional int64 id = 1;
Yao Chencaf339d2017-10-06 16:01:10 -0700176
Yangster-mac94e197c2018-01-02 16:03:03 -0800177 optional int64 what = 2;
Yao Chen729093d2017-10-16 10:33:26 -0700178
Yangster-mac94e197c2018-01-02 16:03:03 -0800179 optional int64 condition = 3;
Yao Chen5c925ad2017-11-15 14:15:46 -0800180
Stefan Lafona5b51912017-12-05 21:43:52 -0800181 repeated MetricConditionLink links = 4;
Yao Chen5c925ad2017-11-15 14:15:46 -0800182
Yangster-macd1815dc2017-11-13 21:43:15 -0800183 enum AggregationType {
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800184 SUM = 1;
Yao Chencaf339d2017-10-06 16:01:10 -0700185
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800186 MAX_SPARSE = 2;
Yao Chen5c925ad2017-11-15 14:15:46 -0800187 }
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800188 optional AggregationType aggregation_type = 5 [default = SUM];
Yao Chencaf339d2017-10-06 16:01:10 -0700189
Yangster-mac20877162017-12-22 17:19:39 -0800190 optional FieldMatcher dimensions = 6;
Yao Chencaf339d2017-10-06 16:01:10 -0700191
Yao Chen5c925ad2017-11-15 14:15:46 -0800192 optional Bucket bucket = 7;
Yangsterfa28aec2017-10-30 10:29:52 -0700193}
194
195message GaugeMetric {
Yangster-mac94e197c2018-01-02 16:03:03 -0800196 optional int64 id = 1;
Yangsterfa28aec2017-10-30 10:29:52 -0700197
Yangster-mac94e197c2018-01-02 16:03:03 -0800198 optional int64 what = 2;
Yangsterfa28aec2017-10-30 10:29:52 -0700199
Yangster-mac20877162017-12-22 17:19:39 -0800200 optional FieldFilter gauge_fields_filter = 3;
Yangsterfa28aec2017-10-30 10:29:52 -0700201
Yangster-mac94e197c2018-01-02 16:03:03 -0800202 optional int64 condition = 4;
Yangsterfa28aec2017-10-30 10:29:52 -0700203
Yangster-mac20877162017-12-22 17:19:39 -0800204 optional FieldMatcher dimensions = 5;
Yangsterfa28aec2017-10-30 10:29:52 -0700205
Yangster-macd1815dc2017-11-13 21:43:15 -0800206 optional Bucket bucket = 6;
Yangsterfa28aec2017-10-30 10:29:52 -0700207
Stefan Lafona5b51912017-12-05 21:43:52 -0800208 repeated MetricConditionLink links = 7;
Yao Chencaf339d2017-10-06 16:01:10 -0700209}
210
Yao Chen729093d2017-10-16 10:33:26 -0700211message ValueMetric {
Yangster-mac94e197c2018-01-02 16:03:03 -0800212 optional int64 id = 1;
Yao Chen729093d2017-10-16 10:33:26 -0700213
Yangster-mac94e197c2018-01-02 16:03:03 -0800214 optional int64 what = 2;
Yao Chen729093d2017-10-16 10:33:26 -0700215
Yangster-macd1815dc2017-11-13 21:43:15 -0800216 optional int32 value_field = 3;
Yao Chen729093d2017-10-16 10:33:26 -0700217
Yangster-mac94e197c2018-01-02 16:03:03 -0800218 optional int64 condition = 4;
Yao Chen729093d2017-10-16 10:33:26 -0700219
Yangster-mac20877162017-12-22 17:19:39 -0800220 optional FieldMatcher dimensions = 5;
Yao Chen729093d2017-10-16 10:33:26 -0700221
Yangster-macd1815dc2017-11-13 21:43:15 -0800222 optional Bucket bucket = 6;
Yao Chen729093d2017-10-16 10:33:26 -0700223
Stefan Lafona5b51912017-12-05 21:43:52 -0800224 repeated MetricConditionLink links = 7;
Yangsterfa28aec2017-10-30 10:29:52 -0700225
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800226 enum AggregationType { SUM = 1; }
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800227 optional AggregationType aggregation_type = 8 [default = SUM];
Yao Chen729093d2017-10-16 10:33:26 -0700228}
229
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800230message Alert {
Yangster-mac94e197c2018-01-02 16:03:03 -0800231 optional int64 id = 1;
Yao Chen729093d2017-10-16 10:33:26 -0700232
Yangster-mac94e197c2018-01-02 16:03:03 -0800233 optional int64 metric_id = 2;
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800234
Yangster-mac94e197c2018-01-02 16:03:03 -0800235 optional int32 number_of_buckets = 3;
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800236
Yangster-mac94e197c2018-01-02 16:03:03 -0800237 optional int32 refractory_period_secs = 4;
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800238
Yangster-mac94e197c2018-01-02 16:03:03 -0800239 optional int64 trigger_if_sum_gt = 5;
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800240}
Yao Chen729093d2017-10-16 10:33:26 -0700241
Yao Chend10f7b12017-12-18 12:53:50 -0800242message AllowedLogSource {
243 repeated int32 uid = 1;
244 repeated string package = 2;
245}
246
Yangster-mac94e197c2018-01-02 16:03:03 -0800247message Alarm {
248 optional int64 id = 1;
249 optional int64 offset_millis = 2;
250 optional int64 period_millis = 3;
251}
252
253message IncidentdDetails {
254 repeated int32 section = 1;
255}
256
257message PerfettoDetails {
258 optional int32 perfetto_stuff = 1;
259}
260
261message Subscription {
262 optional int64 id = 1;
263
264 enum RuleType {
265 RULE_TYPE_UNSPECIFIED = 0;
266 ALARM = 1;
267 ALERT = 2;
268 }
269 optional RuleType rule_type = 2;
270
271 optional int64 rule_id = 3;
272
273 oneof subscriber_information {
274 IncidentdDetails incidentd_details = 4;
275 PerfettoDetails perfetto_details = 5;
276 }
277}
278
Yao Chenab273e22017-09-06 12:53:50 -0700279message StatsdConfig {
Yangster-mac94e197c2018-01-02 16:03:03 -0800280 optional int64 id = 1;
Yao Chenab273e22017-09-06 12:53:50 -0700281
Yangster-macd1815dc2017-11-13 21:43:15 -0800282 repeated EventMetric event_metric = 2;
yro00698da2017-09-15 10:06:40 -0700283
Yangster-macd1815dc2017-11-13 21:43:15 -0800284 repeated CountMetric count_metric = 3;
yro00698da2017-09-15 10:06:40 -0700285
Yangster-macd1815dc2017-11-13 21:43:15 -0800286 repeated ValueMetric value_metric = 4;
yro00698da2017-09-15 10:06:40 -0700287
Yangster-macd1815dc2017-11-13 21:43:15 -0800288 repeated GaugeMetric gauge_metric = 5;
Yao Chen729093d2017-10-16 10:33:26 -0700289
Yangster-macd1815dc2017-11-13 21:43:15 -0800290 repeated DurationMetric duration_metric = 6;
Yao Chen729093d2017-10-16 10:33:26 -0700291
Stefan Lafonb8c9aa82017-12-03 14:27:25 -0800292 repeated AtomMatcher atom_matcher = 7;
Yangster1d4d6862017-10-31 12:58:51 -0700293
Stefan Lafon12d01fa2017-12-04 20:56:09 -0800294 repeated Predicate predicate = 8;
Yang Lu3eba6212017-10-25 19:54:45 -0700295
Stefan Lafoncfed20b2017-11-18 09:26:53 -0800296 repeated Alert alert = 9;
Yao Chend10f7b12017-12-18 12:53:50 -0800297
Yangster-mac94e197c2018-01-02 16:03:03 -0800298 repeated Alarm alarm = 10;
299
300 repeated Subscription subscription = 11;
301
302 optional AllowedLogSource log_source = 12;
303
304 repeated int64 no_report_metric = 13;
Yao Chenab273e22017-09-06 12:53:50 -0700305}