stats_log.proto revision 9f089f60eba28c1e6b107c260623ab99567d1e4f
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";
18option optimize_for = LITE_RUNTIME;
19
20package android.os.statsd;
21
22option java_package = "com.android.os";
23option java_outer_classname = "StatsLog";
24
25import "frameworks/base/cmds/statsd/src/atoms_copy.proto";
26
27message KeyValuePair {
28  optional int32 key = 1;
29
30  oneof value {
31    string value_str = 2;
32    int64 value_int = 3;
33    bool value_bool = 4;
34    float value_float = 5;
35  }
36}
37
38message EventMetricData {
39  optional int64 timestamp_nanos = 1;
40
41  optional Atom atom = 2;
42}
43
44message CountBucketInfo {
45  optional int64 start_bucket_nanos = 1;
46
47  optional int64 end_bucket_nanos = 2;
48
49  optional int64 count = 3;
50}
51
52message CountMetricData {
53  repeated KeyValuePair dimension = 1;
54
55  repeated CountBucketInfo bucket_info = 2;
56}
57
58message DurationBucketInfo {
59  optional int64 start_bucket_nanos = 1;
60
61  optional int64 end_bucket_nanos = 2;
62
63  optional int64 duration_nanos = 3;
64}
65
66message DurationMetricData {
67  repeated KeyValuePair dimension = 1;
68
69  repeated DurationBucketInfo bucket_info = 2;
70}
71
72message ValueBucketInfo {
73  optional int64 start_bucket_nanos = 1;
74
75  optional int64 end_bucket_nanos = 2;
76
77  optional int64 value = 3;
78}
79
80message ValueMetricData {
81  repeated KeyValuePair dimension = 1;
82
83  repeated ValueBucketInfo bucket_info = 2;
84}
85
86message GaugeBucketInfo {
87  optional int64 start_bucket_nanos = 1;
88
89  optional int64 end_bucket_nanos = 2;
90
91  optional int64 gauge = 3;
92}
93
94message GaugeMetricData {
95  repeated KeyValuePair dimension = 1;
96
97  repeated GaugeBucketInfo bucket_info = 2;
98}
99
100message UidMapping {
101  message PackageInfoSnapshot {
102    message PackageInfo {
103      optional string name = 1;
104
105      optional int32 version = 2;
106
107      optional int32 uid = 3;
108    }
109    optional int64 timestamp_nanos = 1;
110
111    repeated PackageInfo package_info = 2;
112  }
113  repeated PackageInfoSnapshot snapshots = 1;
114
115  message Change {
116    optional bool deletion = 1;
117
118    optional int64 timestamp_nanos = 2;
119    optional string app = 3;
120    optional int32 uid = 4;
121
122    optional int32 version = 5;
123  }
124  repeated Change changes = 2;
125}
126
127message StatsLogReport {
128  optional string metric_name = 1;
129
130  optional int64 start_report_nanos = 2;
131
132  optional int64 end_report_nanos = 3;
133
134  message EventMetricDataWrapper {
135    repeated EventMetricData data = 1;
136  }
137  message CountMetricDataWrapper {
138    repeated CountMetricData data = 1;
139  }
140  message DurationMetricDataWrapper {
141    repeated DurationMetricData data = 1;
142  }
143  message ValueMetricDataWrapper {
144    repeated ValueMetricData data = 1;
145  }
146
147  message GaugeMetricDataWrapper {
148    repeated GaugeMetricData data = 1;
149  }
150
151  oneof data {
152    EventMetricDataWrapper event_metrics = 4;
153    CountMetricDataWrapper count_metrics = 5;
154    DurationMetricDataWrapper duration_metrics = 6;
155    ValueMetricDataWrapper value_metrics = 7;
156    GaugeMetricDataWrapper gauge_metrics = 8;
157  }
158}
159
160message ConfigMetricsReport {
161  message ConfigKey {
162    optional int32 uid = 1;
163    optional string name = 2;
164  }
165  optional ConfigKey config_key = 1;
166
167  repeated StatsLogReport metrics = 2;
168
169  optional UidMapping uid_map = 3;
170}
171