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"; 25import "packages/modules/StatsD/statsd/src/guardrail/stats_log_enums.proto"; 26 27message DimensionsValue { 28 optional int32 field = 1; 29 30 oneof value { 31 string value_str = 2; 32 int32 value_int = 3; 33 int64 value_long = 4; 34 bool value_bool = 5; 35 float value_float = 6; 36 DimensionsValueTuple value_tuple = 7; 37 uint64 value_str_hash = 8; 38 } 39} 40 41message DimensionsValueTuple { 42 repeated DimensionsValue dimensions_value = 1; 43} 44 45message StateValue { 46 optional int32 atom_id = 1; 47 48 oneof contents { 49 int64 group_id = 2; 50 int32 value = 3; 51 } 52} 53 54message AggregatedAtomInfo { 55 optional Atom atom = 1; 56 57 repeated int64 elapsed_timestamp_nanos = 2; 58} 59 60message EventMetricData { 61 optional int64 elapsed_timestamp_nanos = 1; 62 63 optional Atom atom = 2; 64 65 optional int64 wall_clock_timestamp_nanos = 3 [deprecated = true]; 66 67 optional AggregatedAtomInfo aggregated_atom_info = 4; 68} 69 70message CountBucketInfo { 71 optional int64 start_bucket_elapsed_nanos = 1; 72 73 optional int64 end_bucket_elapsed_nanos = 2; 74 75 optional int64 count = 3; 76 77 optional int64 bucket_num = 4; 78 79 optional int64 start_bucket_elapsed_millis = 5; 80 81 optional int64 end_bucket_elapsed_millis = 6; 82 83 optional int64 condition_true_nanos = 7; 84} 85 86message CountMetricData { 87 optional DimensionsValue dimensions_in_what = 1; 88 89 repeated StateValue slice_by_state = 6; 90 91 repeated CountBucketInfo bucket_info = 3; 92 93 repeated DimensionsValue dimension_leaf_values_in_what = 4; 94 95 optional DimensionsValue dimensions_in_condition = 2 [deprecated = true]; 96 97 repeated DimensionsValue dimension_leaf_values_in_condition = 5 [deprecated = true]; 98} 99 100message DurationBucketInfo { 101 optional int64 start_bucket_elapsed_nanos = 1; 102 103 optional int64 end_bucket_elapsed_nanos = 2; 104 105 optional int64 duration_nanos = 3; 106 107 optional int64 bucket_num = 4; 108 109 optional int64 start_bucket_elapsed_millis = 5; 110 111 optional int64 end_bucket_elapsed_millis = 6; 112 113 optional int64 condition_true_nanos = 7; 114} 115 116message DurationMetricData { 117 optional DimensionsValue dimensions_in_what = 1; 118 119 repeated StateValue slice_by_state = 6; 120 121 repeated DurationBucketInfo bucket_info = 3; 122 123 repeated DimensionsValue dimension_leaf_values_in_what = 4; 124 125 optional DimensionsValue dimensions_in_condition = 2 [deprecated = true]; 126 127 repeated DimensionsValue dimension_leaf_values_in_condition = 5 [deprecated = true]; 128} 129 130message Histogram { 131 // Counts for histogram bins. 132 // Encoding is as follows: 133 // * n >= 0 represents the actual count 134 // * n == -1 should not be used 135 // * n <= -2 represents -n consecutive bins with count of 0 136 repeated sint32 count = 1; 137} 138 139message ValueBucketInfo { 140 optional int64 start_bucket_elapsed_nanos = 1; 141 142 optional int64 end_bucket_elapsed_nanos = 2; 143 144 optional int64 value = 3 [deprecated = true]; 145 146 oneof single_value { 147 int64 value_long = 7 [deprecated = true]; 148 149 double value_double = 8 [deprecated = true]; 150 } 151 152 message Value { 153 optional int32 index = 1; 154 oneof value { 155 int64 value_long = 2; 156 double value_double = 3; 157 Histogram histogram = 5; 158 } 159 optional int32 sample_size = 4; 160 } 161 162 repeated Value values = 9; 163 164 optional int64 bucket_num = 4; 165 166 optional int64 start_bucket_elapsed_millis = 5; 167 168 optional int64 end_bucket_elapsed_millis = 6; 169 170 optional int64 condition_true_nanos = 10; 171 172 optional int64 condition_correction_nanos = 11; 173} 174 175message ValueMetricData { 176 optional DimensionsValue dimensions_in_what = 1; 177 178 repeated StateValue slice_by_state = 6; 179 180 repeated ValueBucketInfo bucket_info = 3; 181 182 repeated DimensionsValue dimension_leaf_values_in_what = 4; 183 184 optional DimensionsValue dimensions_in_condition = 2 [deprecated = true]; 185 186 repeated DimensionsValue dimension_leaf_values_in_condition = 5 [deprecated = true]; 187} 188 189message KllBucketInfo { 190 optional int64 start_bucket_elapsed_nanos = 1; 191 192 optional int64 end_bucket_elapsed_nanos = 2; 193 194 message KllSketch { 195 optional int32 index = 1; 196 optional bytes kll_sketch = 2; 197 } 198 199 repeated KllSketch sketches = 3; 200 201 optional int64 bucket_num = 4; 202 203 optional int64 start_bucket_elapsed_millis = 5; 204 205 optional int64 end_bucket_elapsed_millis = 6; 206 207 optional int64 condition_true_nanos = 7; 208} 209 210message KllMetricData { 211 optional DimensionsValue dimensions_in_what = 1; 212 213 repeated StateValue slice_by_state = 6; 214 215 repeated KllBucketInfo bucket_info = 3; 216 217 repeated DimensionsValue dimension_leaf_values_in_what = 4; 218 219 reserved 2, 5; 220} 221 222message GaugeBucketInfo { 223 optional int64 start_bucket_elapsed_nanos = 1; 224 225 optional int64 end_bucket_elapsed_nanos = 2; 226 227 repeated Atom atom = 3; 228 229 repeated int64 elapsed_timestamp_nanos = 4; 230 231 repeated int64 wall_clock_timestamp_nanos = 5 [deprecated = true]; 232 233 optional int64 bucket_num = 6; 234 235 optional int64 start_bucket_elapsed_millis = 7; 236 237 optional int64 end_bucket_elapsed_millis = 8; 238 239 repeated AggregatedAtomInfo aggregated_atom_info = 9; 240} 241 242message GaugeMetricData { 243 optional DimensionsValue dimensions_in_what = 1; 244 245 // Currently unsupported 246 repeated StateValue slice_by_state = 6; 247 248 repeated GaugeBucketInfo bucket_info = 3; 249 250 repeated DimensionsValue dimension_leaf_values_in_what = 4; 251 252 optional DimensionsValue dimensions_in_condition = 2 [deprecated = true]; 253 254 repeated DimensionsValue dimension_leaf_values_in_condition = 5 [deprecated = true]; 255} 256 257message StatsLogReport { 258 optional int64 metric_id = 1; 259 260 // Deprecated. 261 reserved 2, 3; 262 263 message DropEvent { 264 optional BucketDropReason drop_reason = 1; 265 266 optional int64 drop_time_millis = 2; 267 } 268 269 message SkippedBuckets { 270 optional int64 start_bucket_elapsed_nanos = 1; 271 272 optional int64 end_bucket_elapsed_nanos = 2; 273 274 optional int64 start_bucket_elapsed_millis = 3; 275 276 optional int64 end_bucket_elapsed_millis = 4; 277 278 // The number of drop events is capped by StatsdStats::kMaxLoggedBucketDropEvents. 279 // The current maximum is 10 drop events. 280 repeated DropEvent drop_event = 5; 281 } 282 283 message EventMetricDataWrapper { 284 repeated EventMetricData data = 1; 285 } 286 287 message CountMetricDataWrapper { 288 repeated CountMetricData data = 1; 289 } 290 291 message DurationMetricDataWrapper { 292 repeated DurationMetricData data = 1; 293 } 294 295 message ValueMetricDataWrapper { 296 repeated ValueMetricData data = 1; 297 repeated SkippedBuckets skipped = 2; 298 } 299 300 message GaugeMetricDataWrapper { 301 repeated GaugeMetricData data = 1; 302 repeated SkippedBuckets skipped = 2; 303 } 304 305 message KllMetricDataWrapper { 306 repeated KllMetricData data = 1; 307 repeated SkippedBuckets skipped = 2; 308 } 309 310 oneof data { 311 EventMetricDataWrapper event_metrics = 4; 312 CountMetricDataWrapper count_metrics = 5; 313 DurationMetricDataWrapper duration_metrics = 6; 314 ValueMetricDataWrapper value_metrics = 7; 315 GaugeMetricDataWrapper gauge_metrics = 8; 316 KllMetricDataWrapper kll_metrics = 16; 317 } 318 319 optional int64 time_base_elapsed_nano_seconds = 9; 320 321 optional int64 bucket_size_nano_seconds = 10; 322 323 optional DimensionsValue dimensions_path_in_what = 11; 324 325 optional DimensionsValue dimensions_path_in_condition = 12 [deprecated = true]; 326 327 optional bool is_active = 14; 328 329 optional bool dimension_guardrail_hit = 17; 330 331 optional int64 estimated_data_bytes = 18; 332 333 repeated DataCorruptedReason data_corrupted_reason = 19; 334 335 // Do not use. 336 reserved 13, 15; 337} 338 339message UidMapping { 340 message PackageInfoSnapshot { 341 message PackageInfo { 342 optional string name = 1; 343 344 optional int64 version = 2; 345 346 optional int32 uid = 3; 347 348 optional bool deleted = 4; 349 350 optional uint64 name_hash = 5; 351 352 optional string version_string = 6; 353 354 optional uint64 version_string_hash = 7; 355 356 optional string installer = 8; 357 358 optional uint64 installer_hash = 9; 359 360 optional uint32 installer_index = 10; 361 362 optional bytes truncated_certificate_hash = 11; 363 } 364 optional int64 elapsed_timestamp_nanos = 1; 365 366 repeated PackageInfo package_info = 2; 367 } 368 repeated PackageInfoSnapshot snapshots = 1; 369 370 message Change { 371 optional bool deletion = 1; 372 373 optional int64 elapsed_timestamp_nanos = 2; 374 optional string app = 3; 375 optional int32 uid = 4; 376 377 optional int64 new_version = 5; 378 optional int64 prev_version = 6; 379 optional uint64 app_hash = 7; 380 optional string new_version_string = 8; 381 optional string prev_version_string = 9; 382 optional uint64 new_version_string_hash = 10; 383 optional uint64 prev_version_string_hash = 11; 384 } 385 repeated Change changes = 2; 386 387 // Populated when StatsdConfig.hash_strings_in_metric_reports = true 388 repeated uint64 installer_hash = 3; 389 390 // Populated when StatsdConfig.hash_strings_in_metric_reports = false 391 repeated string installer_name = 4; 392} 393 394message ConfigMetricsReport { 395 repeated StatsLogReport metrics = 1; 396 397 optional UidMapping uid_map = 2; 398 399 optional int64 last_report_elapsed_nanos = 3; 400 401 optional int64 current_report_elapsed_nanos = 4; 402 403 optional int64 last_report_wall_clock_nanos = 5; 404 405 optional int64 current_report_wall_clock_nanos = 6; 406 407 message Annotation { 408 optional int64 field_int64 = 1; 409 optional int32 field_int32 = 2; 410 } 411 repeated Annotation annotation = 7; 412 413 optional DumpReportReason dump_report_reason = 8; 414 415 repeated string strings = 9; 416 417 reserved 10; 418 419 repeated DataCorruptedReason data_corrupted_reason = 11; 420 421 optional int64 estimated_data_bytes = 12; 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 optional int32 report_number = 3; 434 435 optional int32 statsd_stats_id = 4; 436 437 reserved 10 to 13, 101; 438} 439 440message StatsdStatsReport { 441 optional int32 stats_begin_time_sec = 1; 442 443 optional int32 stats_end_time_sec = 2; 444 445 message InvalidConfigReason { 446 optional InvalidConfigReasonEnum reason = 1; 447 optional int64 metric_id = 2; 448 optional int64 state_id = 3; 449 optional int64 alert_id = 4; 450 optional int64 alarm_id = 5; 451 optional int64 subscription_id = 6; 452 repeated int64 matcher_id = 7; 453 repeated int64 condition_id = 8; 454 } 455 456 message MatcherStats { 457 optional int64 id = 1; 458 optional int32 matched_times = 2; 459 } 460 461 message ConditionStats { 462 optional int64 id = 1; 463 optional int32 max_tuple_counts = 2; 464 } 465 466 message MetricStats { 467 optional int64 id = 1; 468 optional int32 max_tuple_counts = 2; 469 } 470 471 message AlertStats { 472 optional int64 id = 1; 473 optional int32 alerted_times = 2; 474 } 475 476 message ConfigStats { 477 optional int32 uid = 1; 478 optional int64 id = 2; 479 optional int32 creation_time_sec = 3; 480 optional int32 deletion_time_sec = 4; 481 optional int32 reset_time_sec = 19; 482 optional int32 metric_count = 5; 483 optional int32 condition_count = 6; 484 optional int32 matcher_count = 7; 485 optional int32 alert_count = 8; 486 optional bool is_valid = 9; 487 optional InvalidConfigReason invalid_config_reason = 24; 488 repeated int32 broadcast_sent_time_sec = 10; 489 repeated int32 data_drop_time_sec = 11; 490 repeated int64 data_drop_bytes = 21; 491 repeated int32 dump_report_time_sec = 12; 492 repeated int32 dump_report_data_size = 20; 493 repeated MatcherStats matcher_stats = 13; 494 repeated ConditionStats condition_stats = 14; 495 repeated MetricStats metric_stats = 15; 496 repeated AlertStats alert_stats = 16; 497 repeated MetricStats metric_dimension_in_condition_stats = 17 [deprecated = true]; 498 message Annotation { 499 optional int64 field_int64 = 1; 500 optional int32 field_int32 = 2; 501 } 502 repeated Annotation annotation = 18; 503 repeated int32 activation_time_sec = 22; 504 repeated int32 deactivation_time_sec = 23; 505 repeated RestrictedMetricStats restricted_metric_stats = 25; 506 optional bool device_info_table_creation_failed = 26; 507 optional int32 restricted_db_corrupted_count = 27; 508 repeated int64 restricted_flush_latency = 28; 509 repeated int64 restricted_db_size_time_sec = 29; 510 repeated int64 restricted_db_size_bytes = 30; 511 repeated int32 dump_report_number = 31; 512 optional int32 db_deletion_stat_failed = 32; 513 optional int32 db_deletion_size_exceeded_limit = 33; 514 optional int32 db_deletion_config_invalid = 34; 515 optional int32 db_deletion_too_old = 35; 516 optional int32 db_deletion_config_removed = 36; 517 optional int32 db_deletion_config_updated = 37; 518 optional int32 config_metadata_provider_promotion_failed = 38; 519 } 520 521 repeated ConfigStats config_stats = 3; 522 523 message AtomStats { 524 optional int32 tag = 1; 525 optional int32 count = 2; 526 optional int32 error_count = 3; 527 optional int32 dropped_count = 4; 528 optional int32 skip_count = 5; 529 } 530 531 repeated AtomStats atom_stats = 7; 532 533 message UidMapStats { 534 optional int32 changes = 1; 535 optional int32 bytes_used = 2; 536 optional int32 dropped_changes = 3; 537 optional int32 deleted_apps = 4; 538 } 539 optional UidMapStats uidmap_stats = 8; 540 541 message AnomalyAlarmStats { 542 optional int32 alarms_registered = 1; 543 } 544 optional AnomalyAlarmStats anomaly_alarm_stats = 9; 545 546 message PulledAtomStats { 547 optional int32 atom_id = 1; 548 optional int64 total_pull = 2; 549 optional int64 total_pull_from_cache = 3; 550 optional int64 min_pull_interval_sec = 4; 551 optional int64 average_pull_time_nanos = 5; 552 optional int64 max_pull_time_nanos = 6; 553 optional int64 average_pull_delay_nanos = 7; 554 optional int64 max_pull_delay_nanos = 8; 555 optional int64 data_error = 9; 556 optional int64 pull_timeout = 10; 557 optional int64 pull_exceed_max_delay = 11; 558 optional int64 pull_failed = 12; 559 optional int64 stats_companion_pull_failed = 13 [deprecated = true]; 560 optional int64 stats_companion_pull_binder_transaction_failed = 14 [deprecated = true]; 561 optional int64 empty_data = 15; 562 optional int64 registered_count = 16; 563 optional int64 unregistered_count = 17; 564 optional int32 atom_error_count = 18; 565 optional int64 binder_call_failed = 19; 566 optional int64 failed_uid_provider_not_found = 20; 567 optional int64 puller_not_found = 21; 568 message PullTimeoutMetadata { 569 optional int64 pull_timeout_uptime_millis = 1; 570 optional int64 pull_timeout_elapsed_millis = 2; 571 } 572 repeated PullTimeoutMetadata pull_atom_metadata = 22; 573 optional int32 subscription_pull_count = 23; 574 } 575 repeated PulledAtomStats pulled_atom_stats = 10; 576 577 message AtomMetricStats { 578 optional int64 metric_id = 1; 579 optional int64 hard_dimension_limit_reached = 2; 580 optional int64 late_log_event_skipped = 3; 581 optional int64 skipped_forward_buckets = 4; 582 optional int64 bad_value_type = 5; 583 optional int64 condition_change_in_next_bucket = 6; 584 optional int64 invalidated_bucket = 7; 585 optional int64 bucket_dropped = 8; 586 optional int64 min_bucket_boundary_delay_ns = 9; 587 optional int64 max_bucket_boundary_delay_ns = 10; 588 optional int64 bucket_unknown_condition = 11; 589 optional int64 bucket_count = 12; 590 reserved 13 to 15; 591 } 592 repeated AtomMetricStats atom_metric_stats = 17; 593 594 message LoggerErrorStats { 595 optional int32 logger_disconnection_sec = 1; 596 optional int32 error_code = 2; 597 } 598 repeated LoggerErrorStats logger_error_stats = 11; 599 600 message PeriodicAlarmStats { 601 optional int32 alarms_registered = 1; 602 } 603 optional PeriodicAlarmStats periodic_alarm_stats = 12; 604 605 message SkippedLogEventStats { 606 optional int32 tag = 1; 607 optional int64 elapsed_timestamp_nanos = 2; 608 } 609 repeated SkippedLogEventStats skipped_log_event_stats = 13; 610 611 repeated int64 log_loss_stats = 14; 612 613 repeated int32 system_restart_sec = 15; 614 615 message LogLossStats { 616 optional int32 detected_time_sec = 1; 617 optional int32 count = 2; 618 optional int32 last_error = 3; 619 optional int32 last_tag = 4; 620 optional int32 uid = 5; 621 optional int32 pid = 6; 622 } 623 repeated LogLossStats detected_log_loss = 16; 624 625 message EventQueueOverflow { 626 optional int32 count = 1; 627 optional int64 max_queue_history_ns = 2; 628 optional int64 min_queue_history_ns = 3; 629 } 630 631 optional EventQueueOverflow queue_overflow = 18; 632 633 message ActivationBroadcastGuardrail { 634 optional int32 uid = 1; 635 repeated int32 guardrail_met_sec = 2; 636 } 637 638 repeated ActivationBroadcastGuardrail activation_guardrail_stats = 19; 639 640 message RestrictedMetricStats { 641 optional int64 restricted_metric_id = 1; 642 optional int64 insert_error = 2; 643 optional int64 table_creation_error = 3; 644 optional int64 table_deletion_error = 4; 645 repeated int64 flush_latency_ns = 5; 646 optional int64 category_changed_count = 6; 647 } 648 649 message RestrictedMetricQueryStats { 650 optional int32 calling_uid = 1; 651 optional int64 config_id = 2; 652 optional int32 config_uid = 3; 653 optional string config_package = 4; 654 optional InvalidQueryReason invalid_query_reason = 5; 655 optional int64 query_wall_time_ns = 6; 656 optional bool has_error = 7; 657 optional string query_error = 8; 658 optional int64 query_latency_ns = 9; 659 } 660 repeated RestrictedMetricQueryStats restricted_metric_query_stats = 20; 661 optional uint32 shard_offset = 21; 662 optional int32 statsd_stats_id = 22; 663 664 message SubscriptionStats { 665 message PerSubscriptionStats { 666 optional int32 id = 1; 667 optional int32 pushed_atom_count = 2; 668 optional int32 pulled_atom_count = 3; 669 optional int32 start_time_sec = 4; 670 optional int32 end_time_sec = 5; 671 optional int32 flush_count = 6; 672 } 673 repeated PerSubscriptionStats per_subscription_stats = 1; 674 optional int32 pull_thread_wakeup_count = 2; 675 } 676 677 optional SubscriptionStats subscription_stats = 23; 678 679 message SocketLossStats { 680 message LossStatsPerUid { 681 message AtomIdLossStats { 682 optional int32 atom_id = 1; 683 optional int32 error = 2; 684 optional int32 count = 3; 685 } 686 optional int32 uid = 1; 687 optional int64 first_timestamp_nanos = 2; 688 optional int64 last_timestamp_nanos = 3; 689 repeated AtomIdLossStats atom_id_loss_stats = 4; 690 } 691 692 repeated LossStatsPerUid loss_stats_per_uid = 1; 693 694 // tracks overflow of stats container on the libstatssocket side per logging application 695 message LossStatsOverflowCounters { 696 optional int32 uid = 1; 697 optional int32 count = 2; 698 } 699 700 repeated LossStatsOverflowCounters loss_stats_overflow_counters = 2; 701 } 702 703 optional SocketLossStats socket_loss_stats = 24; 704 705 message EventQueueStats { 706 optional int32 max_size_observed = 1; 707 optional int64 max_size_observed_elapsed_nanos = 2; 708 } 709 710 optional EventQueueStats event_queue_stats = 25; 711 712 // Tracks info about reads from the socket. 713 message SocketReadStats { 714 // This is a histogram of sizes of the batched reads. The bins are as follows: 715 // [0, 1, 2, 3, 4, 5-9, 10-19, 20-29, 30-39, 40-49, 50-59, 60-69, 70-79, 80-89, 90-99, 716 // 100-199, 200-299, 300-399, 400-499, 500-599, 600-699, 700-799, 800-899, 900-999, 717 // 1000-1199, 1200-1399, 1400-1599, 1600-1799, 1800-1999, 2000+] 718 repeated int64 batched_read_size = 1; 719 720 message LargeBatchReadStats { 721 optional int64 last_read_time_elapsed_ns = 1; 722 optional int64 curr_read_time_elapsed_ns = 2; 723 optional int64 min_atom_time_elapsed_ns = 3; 724 optional int64 max_atom_time_elapsed_ns = 4; 725 optional int64 total_atoms_read = 5; 726 727 message BatchedAtomReadStats { 728 optional int32 atom_id = 1; 729 optional int32 count = 2; 730 } 731 repeated BatchedAtomReadStats atom_stats = 6; 732 } 733 repeated LargeBatchReadStats large_batch_read_stats = 2; 734 } 735 736 optional SocketReadStats socket_read_stats = 26; 737} 738 739message AlertTriggerDetails { 740 message MetricValue { 741 optional int64 metric_id = 1; 742 optional DimensionsValue dimension_in_what = 2; 743 optional DimensionsValue dimension_in_condition = 3 [deprecated = true]; 744 optional int64 value = 4; 745 } 746 oneof value { 747 MetricValue trigger_metric = 1; 748 EventMetricData trigger_event = 2; 749 } 750 optional UidMapping.PackageInfoSnapshot package_info = 3; 751} 752