1/* 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 */ 16 17syntax = "proto2"; 18 19package android.os.statsd; 20 21option java_package = "com.android.os"; 22option java_outer_classname = "StatsLog"; 23 24import "frameworks/base/cmds/statsd/src/atoms.proto"; 25 26message DimensionsValue { 27 optional int32 field = 1; 28 29 oneof value { 30 string value_str = 2; 31 int32 value_int = 3; 32 int64 value_long = 4; 33 bool value_bool = 5; 34 float value_float = 6; 35 DimensionsValueTuple value_tuple = 7; 36 uint64 value_str_hash = 8; 37 } 38} 39 40message DimensionsValueTuple { 41 repeated DimensionsValue dimensions_value = 1; 42} 43 44message EventMetricData { 45 optional int64 elapsed_timestamp_nanos = 1; 46 47 optional Atom atom = 2; 48 49 optional int64 wall_clock_timestamp_nanos = 3 [deprecated = true]; 50} 51 52message CountBucketInfo { 53 optional int64 start_bucket_elapsed_nanos = 1; 54 55 optional int64 end_bucket_elapsed_nanos = 2; 56 57 optional int64 count = 3; 58 59 optional int64 bucket_num = 4; 60 61 optional int64 start_bucket_elapsed_millis = 5; 62 63 optional int64 end_bucket_elapsed_millis = 6; 64} 65 66message CountMetricData { 67 optional DimensionsValue dimensions_in_what = 1; 68 69 optional DimensionsValue dimensions_in_condition = 2; 70 71 repeated CountBucketInfo bucket_info = 3; 72 73 repeated DimensionsValue dimension_leaf_values_in_what = 4; 74 75 repeated DimensionsValue dimension_leaf_values_in_condition = 5; 76} 77 78message DurationBucketInfo { 79 optional int64 start_bucket_elapsed_nanos = 1; 80 81 optional int64 end_bucket_elapsed_nanos = 2; 82 83 optional int64 duration_nanos = 3; 84 85 optional int64 bucket_num = 4; 86 87 optional int64 start_bucket_elapsed_millis = 5; 88 89 optional int64 end_bucket_elapsed_millis = 6; 90} 91 92message DurationMetricData { 93 optional DimensionsValue dimensions_in_what = 1; 94 95 optional DimensionsValue dimensions_in_condition = 2; 96 97 repeated DurationBucketInfo bucket_info = 3; 98 99 repeated DimensionsValue dimension_leaf_values_in_what = 4; 100 101 repeated DimensionsValue dimension_leaf_values_in_condition = 5; 102} 103 104message ValueBucketInfo { 105 optional int64 start_bucket_elapsed_nanos = 1; 106 107 optional int64 end_bucket_elapsed_nanos = 2; 108 109 optional int64 value = 3 [deprecated = true]; 110 111 oneof single_value { 112 int64 value_long = 7 [deprecated = true]; 113 114 double value_double = 8 [deprecated = true]; 115 } 116 117 message Value { 118 optional int32 index = 1; 119 oneof value { 120 int64 value_long = 2; 121 double value_double = 3; 122 } 123 } 124 125 repeated Value values = 9; 126 127 optional int64 bucket_num = 4; 128 129 optional int64 start_bucket_elapsed_millis = 5; 130 131 optional int64 end_bucket_elapsed_millis = 6; 132 133 optional int64 condition_true_nanos = 10; 134} 135 136message ValueMetricData { 137 optional DimensionsValue dimensions_in_what = 1; 138 139 optional DimensionsValue dimensions_in_condition = 2; 140 141 repeated ValueBucketInfo bucket_info = 3; 142 143 repeated DimensionsValue dimension_leaf_values_in_what = 4; 144 145 repeated DimensionsValue dimension_leaf_values_in_condition = 5; 146} 147 148message GaugeBucketInfo { 149 optional int64 start_bucket_elapsed_nanos = 1; 150 151 optional int64 end_bucket_elapsed_nanos = 2; 152 153 repeated Atom atom = 3; 154 155 repeated int64 elapsed_timestamp_nanos = 4; 156 157 repeated int64 wall_clock_timestamp_nanos = 5 [deprecated = true]; 158 159 optional int64 bucket_num = 6; 160 161 optional int64 start_bucket_elapsed_millis = 7; 162 163 optional int64 end_bucket_elapsed_millis = 8; 164} 165 166message GaugeMetricData { 167 optional DimensionsValue dimensions_in_what = 1; 168 169 optional DimensionsValue dimensions_in_condition = 2; 170 171 repeated GaugeBucketInfo bucket_info = 3; 172 173 repeated DimensionsValue dimension_leaf_values_in_what = 4; 174 175 repeated DimensionsValue dimension_leaf_values_in_condition = 5; 176} 177 178message StatsLogReport { 179 optional int64 metric_id = 1; 180 181 // Fields 2 and 3 are reserved. 182 183 message SkippedBuckets { 184 optional int64 start_bucket_elapsed_nanos = 1; 185 optional int64 end_bucket_elapsed_nanos = 2; 186 optional int64 start_bucket_elapsed_millis = 3; 187 optional int64 end_bucket_elapsed_millis = 4; 188 } 189 190 message EventMetricDataWrapper { 191 repeated EventMetricData data = 1; 192 } 193 message CountMetricDataWrapper { 194 repeated CountMetricData data = 1; 195 } 196 message DurationMetricDataWrapper { 197 repeated DurationMetricData data = 1; 198 } 199 message ValueMetricDataWrapper { 200 repeated ValueMetricData data = 1; 201 repeated SkippedBuckets skipped = 2; 202 } 203 204 message GaugeMetricDataWrapper { 205 repeated GaugeMetricData data = 1; 206 repeated SkippedBuckets skipped = 2; 207 } 208 209 oneof data { 210 EventMetricDataWrapper event_metrics = 4; 211 CountMetricDataWrapper count_metrics = 5; 212 DurationMetricDataWrapper duration_metrics = 6; 213 ValueMetricDataWrapper value_metrics = 7; 214 GaugeMetricDataWrapper gauge_metrics = 8; 215 } 216 217 optional int64 time_base_elapsed_nano_seconds = 9; 218 219 optional int64 bucket_size_nano_seconds = 10; 220 221 optional DimensionsValue dimensions_path_in_what = 11; 222 223 optional DimensionsValue dimensions_path_in_condition = 12; 224 225 // DO NOT USE field 13. 226 227 optional bool is_active = 14; 228} 229 230message UidMapping { 231 message PackageInfoSnapshot { 232 message PackageInfo { 233 optional string name = 1; 234 235 optional int64 version = 2; 236 237 optional int32 uid = 3; 238 239 optional bool deleted = 4; 240 241 optional uint64 name_hash = 5; 242 243 optional string version_string = 6; 244 245 optional uint64 version_string_hash = 7; 246 247 optional string installer = 8; 248 249 optional uint64 installer_hash = 9; 250 } 251 optional int64 elapsed_timestamp_nanos = 1; 252 253 repeated PackageInfo package_info = 2; 254 } 255 repeated PackageInfoSnapshot snapshots = 1; 256 257 message Change { 258 optional bool deletion = 1; 259 260 optional int64 elapsed_timestamp_nanos = 2; 261 optional string app = 3; 262 optional int32 uid = 4; 263 264 optional int64 new_version = 5; 265 optional int64 prev_version = 6; 266 optional uint64 app_hash = 7; 267 optional string new_version_string = 8; 268 optional string prev_version_string = 9; 269 optional uint64 new_version_string_hash = 10; 270 optional uint64 prev_version_string_hash = 11; 271 } 272 repeated Change changes = 2; 273} 274 275message ConfigMetricsReport { 276 repeated StatsLogReport metrics = 1; 277 278 optional UidMapping uid_map = 2; 279 280 optional int64 last_report_elapsed_nanos = 3; 281 282 optional int64 current_report_elapsed_nanos = 4; 283 284 optional int64 last_report_wall_clock_nanos = 5; 285 286 optional int64 current_report_wall_clock_nanos = 6; 287 288 message Annotation { 289 optional int64 field_int64 = 1; 290 optional int32 field_int32 = 2; 291 } 292 repeated Annotation annotation = 7; 293 294 enum DumpReportReason { 295 DEVICE_SHUTDOWN = 1; 296 CONFIG_UPDATED = 2; 297 CONFIG_REMOVED = 3; 298 GET_DATA_CALLED = 4; 299 ADB_DUMP = 5; 300 CONFIG_RESET = 6; 301 STATSCOMPANION_DIED = 7; 302 TERMINATION_SIGNAL_RECEIVED = 8; 303 } 304 optional DumpReportReason dump_report_reason = 8; 305 306 repeated string strings = 9; 307} 308 309message ConfigMetricsReportList { 310 message ConfigKey { 311 optional int32 uid = 1; 312 optional int64 id = 2; 313 } 314 optional ConfigKey config_key = 1; 315 316 repeated ConfigMetricsReport reports = 2; 317 318 reserved 10; 319} 320 321message StatsdStatsReport { 322 optional int32 stats_begin_time_sec = 1; 323 324 optional int32 stats_end_time_sec = 2; 325 326 message MatcherStats { 327 optional int64 id = 1; 328 optional int32 matched_times = 2; 329 } 330 331 message ConditionStats { 332 optional int64 id = 1; 333 optional int32 max_tuple_counts = 2; 334 } 335 336 message MetricStats { 337 optional int64 id = 1; 338 optional int32 max_tuple_counts = 2; 339 } 340 341 message AlertStats { 342 optional int64 id = 1; 343 optional int32 alerted_times = 2; 344 } 345 346 message ConfigStats { 347 optional int32 uid = 1; 348 optional int64 id = 2; 349 optional int32 creation_time_sec = 3; 350 optional int32 deletion_time_sec = 4; 351 optional int32 reset_time_sec = 19; 352 optional int32 metric_count = 5; 353 optional int32 condition_count = 6; 354 optional int32 matcher_count = 7; 355 optional int32 alert_count = 8; 356 optional bool is_valid = 9; 357 repeated int32 broadcast_sent_time_sec = 10; 358 repeated int32 data_drop_time_sec = 11; 359 repeated int64 data_drop_bytes = 21; 360 repeated int32 dump_report_time_sec = 12; 361 repeated int32 dump_report_data_size = 20; 362 repeated MatcherStats matcher_stats = 13; 363 repeated ConditionStats condition_stats = 14; 364 repeated MetricStats metric_stats = 15; 365 repeated AlertStats alert_stats = 16; 366 repeated MetricStats metric_dimension_in_condition_stats = 17; 367 message Annotation { 368 optional int64 field_int64 = 1; 369 optional int32 field_int32 = 2; 370 } 371 repeated Annotation annotation = 18; 372 repeated int32 activation_time_sec = 22; 373 repeated int32 deactivation_time_sec = 23; 374 } 375 376 repeated ConfigStats config_stats = 3; 377 378 message AtomStats { 379 optional int32 tag = 1; 380 optional int32 count = 2; 381 } 382 383 repeated AtomStats atom_stats = 7; 384 385 message UidMapStats { 386 optional int32 changes = 1; 387 optional int32 bytes_used = 2; 388 optional int32 dropped_changes = 3; 389 optional int32 deleted_apps = 4; 390 } 391 optional UidMapStats uidmap_stats = 8; 392 393 message AnomalyAlarmStats { 394 optional int32 alarms_registered = 1; 395 } 396 optional AnomalyAlarmStats anomaly_alarm_stats = 9; 397 398 message PulledAtomStats { 399 optional int32 atom_id = 1; 400 optional int64 total_pull = 2; 401 optional int64 total_pull_from_cache = 3; 402 optional int64 min_pull_interval_sec = 4; 403 optional int64 average_pull_time_nanos = 5; 404 optional int64 max_pull_time_nanos = 6; 405 optional int64 average_pull_delay_nanos = 7; 406 optional int64 max_pull_delay_nanos = 8; 407 optional int64 data_error = 9; 408 optional int64 pull_timeout = 10; 409 optional int64 pull_exceed_max_delay = 11; 410 optional int64 pull_failed = 12; 411 optional int64 stats_companion_pull_failed = 13; 412 optional int64 stats_companion_pull_binder_transaction_failed = 14; 413 optional int64 empty_data = 15; 414 optional int64 registered_count = 16; 415 optional int64 unregistered_count = 17; 416 } 417 repeated PulledAtomStats pulled_atom_stats = 10; 418 419 message AtomMetricStats { 420 optional int64 metric_id = 1; 421 optional int64 hard_dimension_limit_reached = 2; 422 optional int64 late_log_event_skipped = 3; 423 optional int64 skipped_forward_buckets = 4; 424 optional int64 bad_value_type = 5; 425 optional int64 condition_change_in_next_bucket = 6; 426 optional int64 invalidated_bucket = 7; 427 optional int64 bucket_dropped = 8; 428 optional int64 min_bucket_boundary_delay_ns = 9; 429 optional int64 max_bucket_boundary_delay_ns = 10; 430 optional int64 bucket_unknown_condition = 11; 431 optional int64 bucket_count = 12; 432 } 433 repeated AtomMetricStats atom_metric_stats = 17; 434 435 message LoggerErrorStats { 436 optional int32 logger_disconnection_sec = 1; 437 optional int32 error_code = 2; 438 } 439 repeated LoggerErrorStats logger_error_stats = 11; 440 441 message PeriodicAlarmStats { 442 optional int32 alarms_registered = 1; 443 } 444 optional PeriodicAlarmStats periodic_alarm_stats = 12; 445 446 message SkippedLogEventStats { 447 optional int32 tag = 1; 448 optional int64 elapsed_timestamp_nanos = 2; 449 } 450 repeated SkippedLogEventStats skipped_log_event_stats = 13; 451 452 repeated int64 log_loss_stats = 14; 453 454 repeated int32 system_restart_sec = 15; 455 456 message LogLossStats { 457 optional int32 detected_time_sec = 1; 458 optional int32 count = 2; 459 optional int32 last_error = 3; 460 optional int32 last_tag = 4; 461 optional int32 uid = 5; 462 optional int32 pid = 6; 463 } 464 repeated LogLossStats detected_log_loss = 16; 465 466 message EventQueueOverflow { 467 optional int32 count = 1; 468 optional int64 max_queue_history_ns = 2; 469 optional int64 min_queue_history_ns = 3; 470 } 471 472 optional EventQueueOverflow queue_overflow = 18; 473 474 message ActivationBroadcastGuardrail { 475 optional int32 uid = 1; 476 repeated int32 guardrail_met_sec = 2; 477 } 478 479 repeated ActivationBroadcastGuardrail activation_guardrail_stats = 19; 480} 481 482message AlertTriggerDetails { 483 message MetricValue { 484 optional int64 metric_id = 1; 485 optional DimensionsValue dimension_in_what = 2; 486 optional DimensionsValue dimension_in_condition = 3; 487 optional int64 value = 4; 488 } 489 oneof value { 490 MetricValue trigger_metric = 1; 491 EventMetricData trigger_event = 2; 492 } 493 optional UidMapping.PackageInfoSnapshot package_info = 3; 494} 495