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