1/* 2 * Copyright (C) 2021 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 */ 16 17// Partial clone of packages/modules/StatsD/statsd/src/statsd_config.proto. The service only 18// uses some parameters when configuring StatsD. 19 20syntax = "proto2"; 21 22package android.car.telemetry; 23 24option java_package = "com.android.car.telemetry"; 25option java_outer_classname = "StatsdConfigProto"; 26 27enum TimeUnit { 28 TIME_UNIT_UNSPECIFIED = 0; 29 FIVE_MINUTES = 2; 30 TEN_MINUTES = 3; 31 THIRTY_MINUTES = 4; 32 ONE_HOUR = 5; 33 reserved 1, 6, 7, 8, 9, 10, 1000; 34} 35 36message FieldMatcher { 37 optional int32 field = 1; 38 39 repeated FieldMatcher child = 3; 40 41 reserved 2; 42} 43 44message SimpleAtomMatcher { 45 optional int32 atom_id = 1; 46 47 reserved 2; 48} 49 50message AtomMatcher { 51 optional int64 id = 1; 52 53 oneof contents { 54 SimpleAtomMatcher simple_atom_matcher = 2; 55 } 56 57 reserved 3; 58} 59 60message FieldFilter { 61 optional bool include_all = 1 [default = false]; 62 optional FieldMatcher fields = 2; 63} 64 65message EventMetric { 66 optional int64 id = 1; 67 optional int64 what = 2; 68 optional int64 condition = 3; 69 70 reserved 4; 71 reserved 100; 72 reserved 101; 73} 74 75message GaugeMetric { 76 optional int64 id = 1; 77 78 optional int64 what = 2; 79 80 optional FieldFilter gauge_fields_filter = 3; 81 82 optional int64 condition = 4; 83 84 optional FieldMatcher dimensions_in_what = 5; 85 86 optional TimeUnit bucket = 6; 87 88 enum SamplingType { 89 RANDOM_ONE_SAMPLE = 1; 90 CONDITION_CHANGE_TO_TRUE = 3; 91 FIRST_N_SAMPLES = 4; 92 reserved 2; 93 } 94 optional SamplingType sampling_type = 9 [default = RANDOM_ONE_SAMPLE]; 95 96 optional int64 max_num_gauge_atoms_per_bucket = 11 [default = 10]; 97 98 optional int32 max_pull_delay_sec = 13 [default = 30]; 99 100 reserved 7, 8, 10, 12, 14; 101 reserved 100; 102 reserved 101; 103} 104 105message PullAtomPackages { 106 optional int32 atom_id = 1; 107 108 repeated string packages = 2; 109} 110 111message SimplePredicate { 112 optional int64 start = 1; 113 114 optional int64 stop = 2; 115 116 optional bool count_nesting = 3 [default = true]; 117 118 optional int64 stop_all = 4; 119 120 enum InitialValue { 121 UNKNOWN = 0; 122 FALSE = 1; 123 } 124 125 optional InitialValue initial_value = 5; 126 127 optional FieldMatcher dimensions = 6; 128} 129 130enum LogicalOperation { 131 LOGICAL_OPERATION_UNSPECIFIED = 0; 132 AND = 1; 133 OR = 2; 134 NOT = 3; 135 NAND = 4; 136 NOR = 5; 137} 138 139message Predicate { 140 optional int64 id = 1; 141 142 message Combination { 143 optional LogicalOperation operation = 1; 144 145 repeated int64 predicate = 2; 146 } 147 148 oneof contents { 149 SimplePredicate simple_predicate = 2; 150 Combination combination = 3; 151 } 152} 153 154message StatsdConfig { 155 optional int64 id = 1; 156 157 repeated EventMetric event_metric = 2; 158 159 repeated GaugeMetric gauge_metric = 5; 160 161 repeated AtomMatcher atom_matcher = 7; 162 163 repeated Predicate predicate = 8; 164 165 repeated string allowed_log_source = 12; 166 167 optional int64 ttl_in_seconds = 15; 168 169 optional bool hash_strings_in_metric_report = 16 [default = true]; 170 171 optional bool persist_locally = 20 [default = false]; 172 173 repeated PullAtomPackages pull_atom_packages = 23; 174 175 repeated int32 whitelisted_atom_ids = 24; 176 177 reserved 3, 4, 6, 9, 10, 11, 13, 14, 17, 18, 19, 21, 22, 25; 178 179 // Do not use. 180 reserved 1000, 1001; 181} 182