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/proto_logging/stats/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 StateValue { 45 optional int32 atom_id = 1; 46 47 oneof contents { 48 int64 group_id = 2; 49 int32 value = 3; 50 } 51} 52 53message AggregatedAtomInfo { 54 optional Atom atom = 1; 55 56 repeated int64 elapsed_timestamp_nanos = 2; 57} 58 59message EventMetricData { 60 optional int64 elapsed_timestamp_nanos = 1; 61 62 optional Atom atom = 2; 63 64 optional int64 wall_clock_timestamp_nanos = 3 [deprecated = true]; 65 66 optional AggregatedAtomInfo aggregated_atom_info = 4; 67} 68 69message CountBucketInfo { 70 optional int64 start_bucket_elapsed_nanos = 1; 71 72 optional int64 end_bucket_elapsed_nanos = 2; 73 74 optional int64 count = 3; 75 76 optional int64 bucket_num = 4; 77 78 optional int64 start_bucket_elapsed_millis = 5; 79 80 optional int64 end_bucket_elapsed_millis = 6; 81} 82 83message CountMetricData { 84 optional DimensionsValue dimensions_in_what = 1; 85 86 repeated StateValue slice_by_state = 6; 87 88 repeated CountBucketInfo bucket_info = 3; 89 90 repeated DimensionsValue dimension_leaf_values_in_what = 4; 91 92 optional DimensionsValue dimensions_in_condition = 2 [deprecated = true]; 93 94 repeated DimensionsValue dimension_leaf_values_in_condition = 5 [deprecated = true]; 95} 96 97message DurationBucketInfo { 98 optional int64 start_bucket_elapsed_nanos = 1; 99 100 optional int64 end_bucket_elapsed_nanos = 2; 101 102 optional int64 duration_nanos = 3; 103 104 optional int64 bucket_num = 4; 105 106 optional int64 start_bucket_elapsed_millis = 5; 107 108 optional int64 end_bucket_elapsed_millis = 6; 109} 110 111message DurationMetricData { 112 optional DimensionsValue dimensions_in_what = 1; 113 114 repeated StateValue slice_by_state = 6; 115 116 repeated DurationBucketInfo bucket_info = 3; 117 118 repeated DimensionsValue dimension_leaf_values_in_what = 4; 119 120 optional DimensionsValue dimensions_in_condition = 2 [deprecated = true]; 121 122 repeated DimensionsValue dimension_leaf_values_in_condition = 5 [deprecated = true]; 123} 124 125message ValueBucketInfo { 126 optional int64 start_bucket_elapsed_nanos = 1; 127 128 optional int64 end_bucket_elapsed_nanos = 2; 129 130 optional int64 value = 3 [deprecated = true]; 131 132 oneof single_value { 133 int64 value_long = 7 [deprecated = true]; 134 135 double value_double = 8 [deprecated = true]; 136 } 137 138 message Value { 139 optional int32 index = 1; 140 oneof value { 141 int64 value_long = 2; 142 double value_double = 3; 143 } 144 } 145 146 repeated Value values = 9; 147 148 optional int64 bucket_num = 4; 149 150 optional int64 start_bucket_elapsed_millis = 5; 151 152 optional int64 end_bucket_elapsed_millis = 6; 153 154 optional int64 condition_true_nanos = 10; 155 156 optional int64 condition_correction_nanos = 11; 157} 158 159message ValueMetricData { 160 optional DimensionsValue dimensions_in_what = 1; 161 162 repeated StateValue slice_by_state = 6; 163 164 repeated ValueBucketInfo bucket_info = 3; 165 166 repeated DimensionsValue dimension_leaf_values_in_what = 4; 167 168 optional DimensionsValue dimensions_in_condition = 2 [deprecated = true]; 169 170 repeated DimensionsValue dimension_leaf_values_in_condition = 5 [deprecated = true]; 171} 172 173message KllBucketInfo { 174 optional int64 start_bucket_elapsed_nanos = 1; 175 176 optional int64 end_bucket_elapsed_nanos = 2; 177 178 message KllSketch { 179 optional int32 index = 1; 180 optional bytes kll_sketch = 2; 181 } 182 183 repeated KllSketch sketches = 3; 184 185 optional int64 bucket_num = 4; 186 187 optional int64 start_bucket_elapsed_millis = 5; 188 189 optional int64 end_bucket_elapsed_millis = 6; 190 191 optional int64 condition_true_nanos = 7; 192} 193 194message KllMetricData { 195 optional DimensionsValue dimensions_in_what = 1; 196 197 repeated StateValue slice_by_state = 6; 198 199 repeated KllBucketInfo bucket_info = 3; 200 201 repeated DimensionsValue dimension_leaf_values_in_what = 4; 202 203 reserved 2, 5; 204} 205 206message GaugeBucketInfo { 207 optional int64 start_bucket_elapsed_nanos = 1; 208 209 optional int64 end_bucket_elapsed_nanos = 2; 210 211 repeated Atom atom = 3; 212 213 repeated int64 elapsed_timestamp_nanos = 4; 214 215 repeated int64 wall_clock_timestamp_nanos = 5 [deprecated = true]; 216 217 optional int64 bucket_num = 6; 218 219 optional int64 start_bucket_elapsed_millis = 7; 220 221 optional int64 end_bucket_elapsed_millis = 8; 222 223 repeated AggregatedAtomInfo aggregated_atom_info = 9; 224} 225 226message GaugeMetricData { 227 optional DimensionsValue dimensions_in_what = 1; 228 229 // Currently unsupported 230 repeated StateValue slice_by_state = 6; 231 232 repeated GaugeBucketInfo bucket_info = 3; 233 234 repeated DimensionsValue dimension_leaf_values_in_what = 4; 235 236 optional DimensionsValue dimensions_in_condition = 2 [deprecated = true]; 237 238 repeated DimensionsValue dimension_leaf_values_in_condition = 5 [deprecated = true]; 239} 240 241message StatsLogReport { 242 optional int64 metric_id = 1; 243 244 // Deprecated. 245 reserved 2, 3; 246 247 // Keep this in sync with BucketDropReason enum in MetricProducer.h. 248 enum BucketDropReason { 249 // For ValueMetric, a bucket is dropped during a dump report request iff 250 // current bucket should be included, a pull is needed (pulled metric and 251 // condition is true), and we are under fast time constraints. 252 DUMP_REPORT_REQUESTED = 1; 253 EVENT_IN_WRONG_BUCKET = 2; 254 CONDITION_UNKNOWN = 3; 255 PULL_FAILED = 4; 256 PULL_DELAYED = 5; 257 DIMENSION_GUARDRAIL_REACHED = 6; 258 MULTIPLE_BUCKETS_SKIPPED = 7; 259 // Not an invalid bucket case, but the bucket is dropped. 260 BUCKET_TOO_SMALL = 8; 261 // Not an invalid bucket case, but the bucket is skipped. 262 NO_DATA = 9; 263 }; 264 265 message DropEvent { 266 optional BucketDropReason drop_reason = 1; 267 268 optional int64 drop_time_millis = 2; 269 } 270 271 message SkippedBuckets { 272 optional int64 start_bucket_elapsed_nanos = 1; 273 274 optional int64 end_bucket_elapsed_nanos = 2; 275 276 optional int64 start_bucket_elapsed_millis = 3; 277 278 optional int64 end_bucket_elapsed_millis = 4; 279 280 // The number of drop events is capped by StatsdStats::kMaxLoggedBucketDropEvents. 281 // The current maximum is 10 drop events. 282 repeated DropEvent drop_event = 5; 283 } 284 285 message EventMetricDataWrapper { 286 repeated EventMetricData data = 1; 287 } 288 289 message CountMetricDataWrapper { 290 repeated CountMetricData data = 1; 291 } 292 293 message DurationMetricDataWrapper { 294 repeated DurationMetricData data = 1; 295 } 296 297 message ValueMetricDataWrapper { 298 repeated ValueMetricData data = 1; 299 repeated SkippedBuckets skipped = 2; 300 } 301 302 message GaugeMetricDataWrapper { 303 repeated GaugeMetricData data = 1; 304 repeated SkippedBuckets skipped = 2; 305 } 306 307 message KllMetricDataWrapper { 308 repeated KllMetricData data = 1; 309 repeated SkippedBuckets skipped = 2; 310 } 311 312 oneof data { 313 EventMetricDataWrapper event_metrics = 4; 314 CountMetricDataWrapper count_metrics = 5; 315 DurationMetricDataWrapper duration_metrics = 6; 316 ValueMetricDataWrapper value_metrics = 7; 317 GaugeMetricDataWrapper gauge_metrics = 8; 318 KllMetricDataWrapper kll_metrics = 16; 319 } 320 321 optional int64 time_base_elapsed_nano_seconds = 9; 322 323 optional int64 bucket_size_nano_seconds = 10; 324 325 optional DimensionsValue dimensions_path_in_what = 11; 326 327 optional DimensionsValue dimensions_path_in_condition = 12 [deprecated = true]; 328 329 optional bool is_active = 14; 330 331 // Do not use. 332 reserved 13, 15; 333} 334 335message UidMapping { 336 message PackageInfoSnapshot { 337 message PackageInfo { 338 optional string name = 1; 339 340 optional int64 version = 2; 341 342 optional int32 uid = 3; 343 344 optional bool deleted = 4; 345 346 optional uint64 name_hash = 5; 347 348 optional string version_string = 6; 349 350 optional uint64 version_string_hash = 7; 351 352 optional string installer = 8; 353 354 optional uint64 installer_hash = 9; 355 356 optional uint32 installer_index = 10; 357 358 optional bytes truncated_certificate_hash = 11; 359 } 360 optional int64 elapsed_timestamp_nanos = 1; 361 362 repeated PackageInfo package_info = 2; 363 } 364 repeated PackageInfoSnapshot snapshots = 1; 365 366 message Change { 367 optional bool deletion = 1; 368 369 optional int64 elapsed_timestamp_nanos = 2; 370 optional string app = 3; 371 optional int32 uid = 4; 372 373 optional int64 new_version = 5; 374 optional int64 prev_version = 6; 375 optional uint64 app_hash = 7; 376 optional string new_version_string = 8; 377 optional string prev_version_string = 9; 378 optional uint64 new_version_string_hash = 10; 379 optional uint64 prev_version_string_hash = 11; 380 } 381 repeated Change changes = 2; 382 383 // Populated when StatsdConfig.hash_strings_in_metric_reports = true 384 repeated uint64 installer_hash = 3; 385 386 // Populated when StatsdConfig.hash_strings_in_metric_reports = false 387 repeated string installer_name = 4; 388} 389 390message ConfigMetricsReport { 391 repeated StatsLogReport metrics = 1; 392 393 optional UidMapping uid_map = 2; 394 395 optional int64 last_report_elapsed_nanos = 3; 396 397 optional int64 current_report_elapsed_nanos = 4; 398 399 optional int64 last_report_wall_clock_nanos = 5; 400 401 optional int64 current_report_wall_clock_nanos = 6; 402 403 message Annotation { 404 optional int64 field_int64 = 1; 405 optional int32 field_int32 = 2; 406 } 407 repeated Annotation annotation = 7; 408 409 enum DumpReportReason { 410 DEVICE_SHUTDOWN = 1; 411 CONFIG_UPDATED = 2; 412 CONFIG_REMOVED = 3; 413 GET_DATA_CALLED = 4; 414 ADB_DUMP = 5; 415 CONFIG_RESET = 6; 416 STATSCOMPANION_DIED = 7; 417 TERMINATION_SIGNAL_RECEIVED = 8; 418 } 419 optional DumpReportReason dump_report_reason = 8; 420 421 repeated string strings = 9; 422} 423 424message ConfigMetricsReportList { 425 message ConfigKey { 426 optional int32 uid = 1; 427 optional int64 id = 2; 428 } 429 optional ConfigKey config_key = 1; 430 431 repeated ConfigMetricsReport reports = 2; 432 433 reserved 10; 434} 435 436message StatsdStatsReport { 437 optional int32 stats_begin_time_sec = 1; 438 439 optional int32 stats_end_time_sec = 2; 440 441 message MatcherStats { 442 optional int64 id = 1; 443 optional int32 matched_times = 2; 444 } 445 446 message ConditionStats { 447 optional int64 id = 1; 448 optional int32 max_tuple_counts = 2; 449 } 450 451 message MetricStats { 452 optional int64 id = 1; 453 optional int32 max_tuple_counts = 2; 454 } 455 456 message AlertStats { 457 optional int64 id = 1; 458 optional int32 alerted_times = 2; 459 } 460 461 message ConfigStats { 462 optional int32 uid = 1; 463 optional int64 id = 2; 464 optional int32 creation_time_sec = 3; 465 optional int32 deletion_time_sec = 4; 466 optional int32 reset_time_sec = 19; 467 optional int32 metric_count = 5; 468 optional int32 condition_count = 6; 469 optional int32 matcher_count = 7; 470 optional int32 alert_count = 8; 471 optional bool is_valid = 9; 472 repeated int32 broadcast_sent_time_sec = 10; 473 repeated int32 data_drop_time_sec = 11; 474 repeated int64 data_drop_bytes = 21; 475 repeated int32 dump_report_time_sec = 12; 476 repeated int32 dump_report_data_size = 20; 477 repeated MatcherStats matcher_stats = 13; 478 repeated ConditionStats condition_stats = 14; 479 repeated MetricStats metric_stats = 15; 480 repeated AlertStats alert_stats = 16; 481 repeated MetricStats metric_dimension_in_condition_stats = 17 [deprecated = true]; 482 message Annotation { 483 optional int64 field_int64 = 1; 484 optional int32 field_int32 = 2; 485 } 486 repeated Annotation annotation = 18; 487 repeated int32 activation_time_sec = 22; 488 repeated int32 deactivation_time_sec = 23; 489 } 490 491 repeated ConfigStats config_stats = 3; 492 493 message AtomStats { 494 optional int32 tag = 1; 495 optional int32 count = 2; 496 optional int32 error_count = 3; 497 } 498 499 repeated AtomStats atom_stats = 7; 500 501 message UidMapStats { 502 optional int32 changes = 1; 503 optional int32 bytes_used = 2; 504 optional int32 dropped_changes = 3; 505 optional int32 deleted_apps = 4; 506 } 507 optional UidMapStats uidmap_stats = 8; 508 509 message AnomalyAlarmStats { 510 optional int32 alarms_registered = 1; 511 } 512 optional AnomalyAlarmStats anomaly_alarm_stats = 9; 513 514 message PulledAtomStats { 515 optional int32 atom_id = 1; 516 optional int64 total_pull = 2; 517 optional int64 total_pull_from_cache = 3; 518 optional int64 min_pull_interval_sec = 4; 519 optional int64 average_pull_time_nanos = 5; 520 optional int64 max_pull_time_nanos = 6; 521 optional int64 average_pull_delay_nanos = 7; 522 optional int64 max_pull_delay_nanos = 8; 523 optional int64 data_error = 9; 524 optional int64 pull_timeout = 10; 525 optional int64 pull_exceed_max_delay = 11; 526 optional int64 pull_failed = 12; 527 optional int64 stats_companion_pull_failed = 13 [deprecated = true]; 528 optional int64 stats_companion_pull_binder_transaction_failed = 14 [deprecated = true]; 529 optional int64 empty_data = 15; 530 optional int64 registered_count = 16; 531 optional int64 unregistered_count = 17; 532 optional int32 atom_error_count = 18; 533 optional int64 binder_call_failed = 19; 534 optional int64 failed_uid_provider_not_found = 20; 535 optional int64 puller_not_found = 21; 536 message PullTimeoutMetadata { 537 optional int64 pull_timeout_uptime_millis = 1; 538 optional int64 pull_timeout_elapsed_millis = 2; 539 } 540 repeated PullTimeoutMetadata pull_atom_metadata = 22; 541 } 542 repeated PulledAtomStats pulled_atom_stats = 10; 543 544 message AtomMetricStats { 545 optional int64 metric_id = 1; 546 optional int64 hard_dimension_limit_reached = 2; 547 optional int64 late_log_event_skipped = 3; 548 optional int64 skipped_forward_buckets = 4; 549 optional int64 bad_value_type = 5; 550 optional int64 condition_change_in_next_bucket = 6; 551 optional int64 invalidated_bucket = 7; 552 optional int64 bucket_dropped = 8; 553 optional int64 min_bucket_boundary_delay_ns = 9; 554 optional int64 max_bucket_boundary_delay_ns = 10; 555 optional int64 bucket_unknown_condition = 11; 556 optional int64 bucket_count = 12; 557 reserved 13 to 15; 558 } 559 repeated AtomMetricStats atom_metric_stats = 17; 560 561 message LoggerErrorStats { 562 optional int32 logger_disconnection_sec = 1; 563 optional int32 error_code = 2; 564 } 565 repeated LoggerErrorStats logger_error_stats = 11; 566 567 message PeriodicAlarmStats { 568 optional int32 alarms_registered = 1; 569 } 570 optional PeriodicAlarmStats periodic_alarm_stats = 12; 571 572 message SkippedLogEventStats { 573 optional int32 tag = 1; 574 optional int64 elapsed_timestamp_nanos = 2; 575 } 576 repeated SkippedLogEventStats skipped_log_event_stats = 13; 577 578 repeated int64 log_loss_stats = 14; 579 580 repeated int32 system_restart_sec = 15; 581 582 message LogLossStats { 583 optional int32 detected_time_sec = 1; 584 optional int32 count = 2; 585 optional int32 last_error = 3; 586 optional int32 last_tag = 4; 587 optional int32 uid = 5; 588 optional int32 pid = 6; 589 } 590 repeated LogLossStats detected_log_loss = 16; 591 592 message EventQueueOverflow { 593 optional int32 count = 1; 594 optional int64 max_queue_history_ns = 2; 595 optional int64 min_queue_history_ns = 3; 596 } 597 598 optional EventQueueOverflow queue_overflow = 18; 599 600 message ActivationBroadcastGuardrail { 601 optional int32 uid = 1; 602 repeated int32 guardrail_met_sec = 2; 603 } 604 605 repeated ActivationBroadcastGuardrail activation_guardrail_stats = 19; 606} 607 608message AlertTriggerDetails { 609 message MetricValue { 610 optional int64 metric_id = 1; 611 optional DimensionsValue dimension_in_what = 2; 612 optional DimensionsValue dimension_in_condition = 3 [deprecated = true]; 613 optional int64 value = 4; 614 } 615 oneof value { 616 MetricValue trigger_metric = 1; 617 EventMetricData trigger_event = 2; 618 } 619 optional UidMapping.PackageInfoSnapshot package_info = 3; 620} 621