• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/invalid_config_reason_enum.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 ValueBucketInfo {
131  optional int64 start_bucket_elapsed_nanos = 1;
132
133  optional int64 end_bucket_elapsed_nanos = 2;
134
135  optional int64 value = 3 [deprecated = true];
136
137  oneof single_value {
138      int64 value_long = 7 [deprecated = true];
139
140      double value_double = 8 [deprecated = true];
141  }
142
143  message Value {
144      optional int32 index = 1;
145      oneof value {
146          int64 value_long = 2;
147          double value_double = 3;
148      }
149      optional int32 sample_size = 4;
150  }
151
152  repeated Value values = 9;
153
154  optional int64 bucket_num = 4;
155
156  optional int64 start_bucket_elapsed_millis = 5;
157
158  optional int64 end_bucket_elapsed_millis = 6;
159
160  optional int64 condition_true_nanos = 10;
161
162  optional int64 condition_correction_nanos = 11;
163}
164
165message ValueMetricData {
166  optional DimensionsValue dimensions_in_what = 1;
167
168  repeated StateValue slice_by_state = 6;
169
170  repeated ValueBucketInfo bucket_info = 3;
171
172  repeated DimensionsValue dimension_leaf_values_in_what = 4;
173
174  optional DimensionsValue dimensions_in_condition = 2 [deprecated = true];
175
176  repeated DimensionsValue dimension_leaf_values_in_condition = 5 [deprecated = true];
177}
178
179message KllBucketInfo {
180    optional int64 start_bucket_elapsed_nanos = 1;
181
182    optional int64 end_bucket_elapsed_nanos = 2;
183
184    message KllSketch {
185        optional int32 index = 1;
186        optional bytes kll_sketch = 2;
187    }
188
189    repeated KllSketch sketches = 3;
190
191    optional int64 bucket_num = 4;
192
193    optional int64 start_bucket_elapsed_millis = 5;
194
195    optional int64 end_bucket_elapsed_millis = 6;
196
197    optional int64 condition_true_nanos = 7;
198}
199
200message KllMetricData {
201    optional DimensionsValue dimensions_in_what = 1;
202
203    repeated StateValue slice_by_state = 6;
204
205    repeated KllBucketInfo bucket_info = 3;
206
207    repeated DimensionsValue dimension_leaf_values_in_what = 4;
208
209    reserved 2, 5;
210}
211
212message GaugeBucketInfo {
213  optional int64 start_bucket_elapsed_nanos = 1;
214
215  optional int64 end_bucket_elapsed_nanos = 2;
216
217  repeated Atom atom = 3;
218
219  repeated int64 elapsed_timestamp_nanos = 4;
220
221  repeated int64 wall_clock_timestamp_nanos = 5 [deprecated = true];
222
223  optional int64 bucket_num = 6;
224
225  optional int64 start_bucket_elapsed_millis = 7;
226
227  optional int64 end_bucket_elapsed_millis = 8;
228
229  repeated AggregatedAtomInfo aggregated_atom_info = 9;
230}
231
232message GaugeMetricData {
233  optional DimensionsValue dimensions_in_what = 1;
234
235  // Currently unsupported
236  repeated StateValue slice_by_state = 6;
237
238  repeated GaugeBucketInfo bucket_info = 3;
239
240  repeated DimensionsValue dimension_leaf_values_in_what = 4;
241
242  optional DimensionsValue dimensions_in_condition = 2 [deprecated = true];
243
244  repeated DimensionsValue dimension_leaf_values_in_condition = 5 [deprecated = true];
245}
246
247message StatsLogReport {
248  optional int64 metric_id = 1;
249
250  // Deprecated.
251  reserved 2, 3;
252
253  // Keep this in sync with BucketDropReason enum in MetricProducer.h.
254  enum BucketDropReason {
255      // For ValueMetric, a bucket is dropped during a dump report request iff
256      // current bucket should be included, a pull is needed (pulled metric and
257      // condition is true), and we are under fast time constraints.
258      DUMP_REPORT_REQUESTED = 1;
259      EVENT_IN_WRONG_BUCKET = 2;
260      CONDITION_UNKNOWN = 3;
261      PULL_FAILED = 4;
262      PULL_DELAYED = 5;
263      DIMENSION_GUARDRAIL_REACHED = 6;
264      MULTIPLE_BUCKETS_SKIPPED = 7;
265      // Not an invalid bucket case, but the bucket is dropped.
266      BUCKET_TOO_SMALL = 8;
267      // Not an invalid bucket case, but the bucket is skipped.
268      NO_DATA = 9;
269  };
270
271  message DropEvent {
272      optional BucketDropReason drop_reason = 1;
273
274      optional int64 drop_time_millis = 2;
275  }
276
277  message SkippedBuckets {
278      optional int64 start_bucket_elapsed_nanos = 1;
279
280      optional int64 end_bucket_elapsed_nanos = 2;
281
282      optional int64 start_bucket_elapsed_millis = 3;
283
284      optional int64 end_bucket_elapsed_millis = 4;
285
286      // The number of drop events is capped by StatsdStats::kMaxLoggedBucketDropEvents.
287      // The current maximum is 10 drop events.
288      repeated DropEvent drop_event = 5;
289  }
290
291  message EventMetricDataWrapper {
292    repeated EventMetricData data = 1;
293  }
294
295  message CountMetricDataWrapper {
296    repeated CountMetricData data = 1;
297  }
298
299  message DurationMetricDataWrapper {
300    repeated DurationMetricData data = 1;
301  }
302
303  message ValueMetricDataWrapper {
304    repeated ValueMetricData data = 1;
305    repeated SkippedBuckets skipped = 2;
306  }
307
308  message GaugeMetricDataWrapper {
309    repeated GaugeMetricData data = 1;
310    repeated SkippedBuckets skipped = 2;
311  }
312
313  message KllMetricDataWrapper {
314      repeated KllMetricData data = 1;
315      repeated SkippedBuckets skipped = 2;
316  }
317
318  oneof data {
319    EventMetricDataWrapper event_metrics = 4;
320    CountMetricDataWrapper count_metrics = 5;
321    DurationMetricDataWrapper duration_metrics = 6;
322    ValueMetricDataWrapper value_metrics = 7;
323    GaugeMetricDataWrapper gauge_metrics = 8;
324    KllMetricDataWrapper kll_metrics = 16;
325  }
326
327  optional int64 time_base_elapsed_nano_seconds = 9;
328
329  optional int64 bucket_size_nano_seconds = 10;
330
331  optional DimensionsValue dimensions_path_in_what = 11;
332
333  optional DimensionsValue dimensions_path_in_condition = 12 [deprecated = true];
334
335  optional bool is_active = 14;
336
337  // Do not use.
338  reserved 13, 15;
339}
340
341message UidMapping {
342    message PackageInfoSnapshot {
343        message PackageInfo {
344            optional string name = 1;
345
346            optional int64 version = 2;
347
348            optional int32 uid = 3;
349
350            optional bool deleted = 4;
351
352            optional uint64 name_hash = 5;
353
354            optional string version_string = 6;
355
356            optional uint64 version_string_hash = 7;
357
358            optional string installer = 8;
359
360            optional uint64 installer_hash = 9;
361
362            optional uint32 installer_index = 10;
363
364            optional bytes truncated_certificate_hash = 11;
365        }
366        optional int64 elapsed_timestamp_nanos = 1;
367
368        repeated PackageInfo package_info = 2;
369    }
370    repeated PackageInfoSnapshot snapshots = 1;
371
372    message Change {
373        optional bool deletion = 1;
374
375        optional int64 elapsed_timestamp_nanos = 2;
376        optional string app = 3;
377        optional int32 uid = 4;
378
379        optional int64 new_version = 5;
380        optional int64 prev_version = 6;
381        optional uint64 app_hash = 7;
382        optional string new_version_string = 8;
383        optional string prev_version_string = 9;
384        optional uint64 new_version_string_hash = 10;
385        optional uint64 prev_version_string_hash = 11;
386    }
387    repeated Change changes = 2;
388
389    // Populated when StatsdConfig.hash_strings_in_metric_reports = true
390    repeated uint64 installer_hash = 3;
391
392    // Populated when StatsdConfig.hash_strings_in_metric_reports = false
393    repeated string installer_name = 4;
394}
395
396message ConfigMetricsReport {
397  repeated StatsLogReport metrics = 1;
398
399  optional UidMapping uid_map = 2;
400
401  optional int64 last_report_elapsed_nanos = 3;
402
403  optional int64 current_report_elapsed_nanos = 4;
404
405  optional int64 last_report_wall_clock_nanos = 5;
406
407  optional int64 current_report_wall_clock_nanos = 6;
408
409  message Annotation {
410      optional int64 field_int64 = 1;
411      optional int32 field_int32 = 2;
412  }
413  repeated Annotation annotation = 7;
414
415  enum DumpReportReason {
416      DEVICE_SHUTDOWN = 1;
417      CONFIG_UPDATED = 2;
418      CONFIG_REMOVED = 3;
419      GET_DATA_CALLED = 4;
420      ADB_DUMP = 5;
421      CONFIG_RESET = 6;
422      STATSCOMPANION_DIED = 7;
423      TERMINATION_SIGNAL_RECEIVED = 8;
424  }
425  optional DumpReportReason dump_report_reason = 8;
426
427  repeated string strings = 9;
428}
429
430message ConfigMetricsReportList {
431  message ConfigKey {
432    optional int32 uid = 1;
433    optional int64 id = 2;
434  }
435  optional ConfigKey config_key = 1;
436
437  repeated ConfigMetricsReport reports = 2;
438
439  reserved 10 to 13, 101;
440}
441
442message StatsdStatsReport {
443    optional int32 stats_begin_time_sec = 1;
444
445    optional int32 stats_end_time_sec = 2;
446
447    message InvalidConfigReason {
448      optional InvalidConfigReasonEnum reason = 1;
449      optional int64 metric_id = 2;
450      optional int64 state_id = 3;
451      optional int64 alert_id = 4;
452      optional int64 alarm_id = 5;
453      optional int64 subscription_id = 6;
454      repeated int64 matcher_id = 7;
455      repeated int64 condition_id = 8;
456    }
457
458    message MatcherStats {
459        optional int64 id = 1;
460        optional int32 matched_times = 2;
461    }
462
463    message ConditionStats {
464        optional int64 id = 1;
465        optional int32 max_tuple_counts = 2;
466    }
467
468    message MetricStats {
469        optional int64 id = 1;
470        optional int32 max_tuple_counts = 2;
471    }
472
473    message AlertStats {
474        optional int64 id = 1;
475        optional int32 alerted_times = 2;
476    }
477
478    message ConfigStats {
479        optional int32 uid = 1;
480        optional int64 id = 2;
481        optional int32 creation_time_sec = 3;
482        optional int32 deletion_time_sec = 4;
483        optional int32 reset_time_sec = 19;
484        optional int32 metric_count = 5;
485        optional int32 condition_count = 6;
486        optional int32 matcher_count = 7;
487        optional int32 alert_count = 8;
488        optional bool is_valid = 9;
489        optional InvalidConfigReason invalid_config_reason = 24;
490        repeated int32 broadcast_sent_time_sec = 10;
491        repeated int32 data_drop_time_sec = 11;
492        repeated int64 data_drop_bytes = 21;
493        repeated int32 dump_report_time_sec = 12;
494        repeated int32 dump_report_data_size = 20;
495        repeated MatcherStats matcher_stats = 13;
496        repeated ConditionStats condition_stats = 14;
497        repeated MetricStats metric_stats = 15;
498        repeated AlertStats alert_stats = 16;
499        repeated MetricStats metric_dimension_in_condition_stats = 17 [deprecated = true];
500        message Annotation {
501            optional int64 field_int64 = 1;
502            optional int32 field_int32 = 2;
503        }
504        repeated Annotation annotation = 18;
505        repeated int32 activation_time_sec = 22;
506        repeated int32 deactivation_time_sec = 23;
507        repeated RestrictedMetricStats restricted_metric_stats = 25;
508        optional bool device_info_table_creation_failed = 26;
509        optional int32 restricted_db_corrupted_count = 27;
510        repeated int64 restricted_flush_latency = 28;
511        repeated int64 restricted_db_size_time_sec = 29;
512        repeated int64 restricted_db_size_bytes = 30;
513    }
514
515    repeated ConfigStats config_stats = 3;
516
517    message AtomStats {
518        optional int32 tag = 1;
519        optional int32 count = 2;
520        optional int32 error_count = 3;
521        optional int32 dropped_count = 4;
522        optional int32 skip_count = 5;
523    }
524
525    repeated AtomStats atom_stats = 7;
526
527    message UidMapStats {
528        optional int32 changes = 1;
529        optional int32 bytes_used = 2;
530        optional int32 dropped_changes = 3;
531        optional int32 deleted_apps = 4;
532    }
533    optional UidMapStats uidmap_stats = 8;
534
535    message AnomalyAlarmStats {
536        optional int32 alarms_registered = 1;
537    }
538    optional AnomalyAlarmStats anomaly_alarm_stats = 9;
539
540    message PulledAtomStats {
541        optional int32 atom_id = 1;
542        optional int64 total_pull = 2;
543        optional int64 total_pull_from_cache = 3;
544        optional int64 min_pull_interval_sec = 4;
545        optional int64 average_pull_time_nanos = 5;
546        optional int64 max_pull_time_nanos = 6;
547        optional int64 average_pull_delay_nanos = 7;
548        optional int64 max_pull_delay_nanos = 8;
549        optional int64 data_error = 9;
550        optional int64 pull_timeout = 10;
551        optional int64 pull_exceed_max_delay = 11;
552        optional int64 pull_failed = 12;
553        optional int64 stats_companion_pull_failed = 13 [deprecated = true];
554        optional int64 stats_companion_pull_binder_transaction_failed = 14 [deprecated = true];
555        optional int64 empty_data = 15;
556        optional int64 registered_count = 16;
557        optional int64 unregistered_count = 17;
558        optional int32 atom_error_count = 18;
559        optional int64 binder_call_failed = 19;
560        optional int64 failed_uid_provider_not_found = 20;
561        optional int64 puller_not_found = 21;
562        message PullTimeoutMetadata {
563          optional int64 pull_timeout_uptime_millis = 1;
564          optional int64 pull_timeout_elapsed_millis = 2;
565        }
566        repeated PullTimeoutMetadata pull_atom_metadata = 22;
567    }
568    repeated PulledAtomStats pulled_atom_stats = 10;
569
570    message AtomMetricStats {
571      optional int64 metric_id = 1;
572      optional int64 hard_dimension_limit_reached = 2;
573      optional int64 late_log_event_skipped = 3;
574      optional int64 skipped_forward_buckets = 4;
575      optional int64 bad_value_type = 5;
576      optional int64 condition_change_in_next_bucket = 6;
577      optional int64 invalidated_bucket = 7;
578      optional int64 bucket_dropped = 8;
579      optional int64 min_bucket_boundary_delay_ns = 9;
580      optional int64 max_bucket_boundary_delay_ns = 10;
581      optional int64 bucket_unknown_condition = 11;
582      optional int64 bucket_count = 12;
583      reserved 13 to 15;
584    }
585    repeated AtomMetricStats atom_metric_stats = 17;
586
587    message LoggerErrorStats {
588        optional int32 logger_disconnection_sec = 1;
589        optional int32 error_code = 2;
590    }
591    repeated LoggerErrorStats logger_error_stats = 11;
592
593    message PeriodicAlarmStats {
594        optional int32 alarms_registered = 1;
595    }
596    optional PeriodicAlarmStats periodic_alarm_stats = 12;
597
598    message  SkippedLogEventStats {
599        optional int32 tag = 1;
600        optional int64 elapsed_timestamp_nanos = 2;
601    }
602    repeated SkippedLogEventStats skipped_log_event_stats = 13;
603
604    repeated int64 log_loss_stats = 14;
605
606    repeated int32 system_restart_sec = 15;
607
608    message LogLossStats {
609        optional int32 detected_time_sec = 1;
610        optional int32 count = 2;
611        optional int32 last_error = 3;
612        optional int32 last_tag = 4;
613        optional int32 uid = 5;
614        optional int32 pid = 6;
615    }
616    repeated LogLossStats detected_log_loss = 16;
617
618    message EventQueueOverflow {
619        optional int32 count = 1;
620        optional int64 max_queue_history_ns = 2;
621        optional int64 min_queue_history_ns = 3;
622    }
623
624    optional EventQueueOverflow queue_overflow = 18;
625
626    message ActivationBroadcastGuardrail {
627        optional int32 uid = 1;
628        repeated int32 guardrail_met_sec = 2;
629    }
630
631    repeated ActivationBroadcastGuardrail activation_guardrail_stats = 19;
632
633    message RestrictedMetricStats {
634      optional int64 restricted_metric_id = 1;
635      optional int64 insert_error = 2;
636      optional int64 table_creation_error = 3;
637      optional int64 table_deletion_error = 4;
638      repeated int64 flush_latency_ns = 5;
639      optional int64 category_changed_count = 6;
640    }
641
642    message RestrictedMetricQueryStats {
643      optional int32 calling_uid = 1;
644      optional int64 config_id = 2;
645      optional int32 config_uid = 3;
646      optional string config_package = 4;
647
648      enum InvalidQueryReason {
649        UNKNOWN_REASON = 0;
650        FLAG_DISABLED = 1;
651        UNSUPPORTED_SQLITE_VERSION = 2;
652        AMBIGUOUS_CONFIG_KEY = 3;
653        CONFIG_KEY_NOT_FOUND = 4;
654        CONFIG_KEY_WITH_UNMATCHED_DELEGATE = 5;
655        QUERY_FAILURE = 6;
656        INCONSISTENT_ROW_SIZE = 7;
657        NULL_CALLBACK = 8;
658      }
659
660      optional InvalidQueryReason invalid_query_reason = 5;
661      optional int64 query_wall_time_ns = 6;
662      optional bool has_error = 7;
663      optional string query_error = 8;
664      optional int64 query_latency_ns = 9;
665    }
666    repeated RestrictedMetricQueryStats restricted_metric_query_stats = 20;
667    optional uint32 shard_offset = 21;
668}
669
670message AlertTriggerDetails {
671    message MetricValue {
672        optional int64 metric_id = 1;
673        optional DimensionsValue dimension_in_what = 2;
674        optional DimensionsValue dimension_in_condition = 3 [deprecated = true];
675        optional int64 value = 4;
676    }
677    oneof value {
678        MetricValue trigger_metric = 1;
679        EventMetricData trigger_event = 2;
680    }
681    optional UidMapping.PackageInfoSnapshot package_info = 3;
682}
683