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