|
14 | 14 |
|
15 | 15 | package stackdriver |
16 | 16 |
|
| 17 | +import google_api5 "google.golang.org/genproto/googleapis/api/metric" |
| 18 | + |
17 | 19 | var ( |
18 | 20 | // Known metrics metadata |
19 | 21 |
|
20 | 22 | // Container metrics |
21 | 23 |
|
22 | 24 | containerUptimeMD = &metricMetadata{ |
23 | | - MetricKind: "GAUGE", |
24 | | - ValueType: "DOUBLE", |
| 25 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 26 | + ValueType: google_api5.MetricDescriptor_DOUBLE, |
25 | 27 | Name: "kubernetes.io/container/uptime", |
26 | 28 | } |
27 | 29 |
|
28 | 30 | cpuContainerCoreUsageTimeMD = &metricMetadata{ |
29 | | - MetricKind: "CUMULATIVE", |
30 | | - ValueType: "DOUBLE", |
| 31 | + MetricKind: google_api5.MetricDescriptor_CUMULATIVE, |
| 32 | + ValueType: google_api5.MetricDescriptor_DOUBLE, |
31 | 33 | Name: "kubernetes.io/container/cpu/core_usage_time", |
32 | 34 | } |
33 | 35 |
|
34 | 36 | cpuRequestedCoresMD = &metricMetadata{ |
35 | | - MetricKind: "GAUGE", |
36 | | - ValueType: "DOUBLE", |
| 37 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 38 | + ValueType: google_api5.MetricDescriptor_DOUBLE, |
37 | 39 | Name: "kubernetes.io/container/cpu/request_cores", |
38 | 40 | } |
39 | 41 |
|
40 | 42 | cpuLimitCoresMD = &metricMetadata{ |
41 | | - MetricKind: "GAUGE", |
42 | | - ValueType: "DOUBLE", |
| 43 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 44 | + ValueType: google_api5.MetricDescriptor_DOUBLE, |
43 | 45 | Name: "kubernetes.io/container/cpu/limit_cores", |
44 | 46 | } |
45 | 47 |
|
46 | 48 | memoryContainerUsedBytesMD = &metricMetadata{ |
47 | | - MetricKind: "GAUGE", |
48 | | - ValueType: "INT64", |
| 49 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 50 | + ValueType: google_api5.MetricDescriptor_INT64, |
49 | 51 | Name: "kubernetes.io/container/memory/used_bytes", |
50 | 52 | } |
51 | 53 |
|
52 | 54 | memoryRequestedBytesMD = &metricMetadata{ |
53 | | - MetricKind: "GAUGE", |
54 | | - ValueType: "INT64", |
| 55 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 56 | + ValueType: google_api5.MetricDescriptor_INT64, |
55 | 57 | Name: "kubernetes.io/container/memory/request_bytes", |
56 | 58 | } |
57 | 59 |
|
58 | 60 | memoryLimitBytesMD = &metricMetadata{ |
59 | | - MetricKind: "GAUGE", |
60 | | - ValueType: "INT64", |
| 61 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 62 | + ValueType: google_api5.MetricDescriptor_INT64, |
61 | 63 | Name: "kubernetes.io/container/memory/limit_bytes", |
62 | 64 | } |
63 | 65 |
|
64 | 66 | restartCountMD = &metricMetadata{ |
65 | | - MetricKind: "CUMULATIVE", |
66 | | - ValueType: "INT64", |
| 67 | + MetricKind: google_api5.MetricDescriptor_CUMULATIVE, |
| 68 | + ValueType: google_api5.MetricDescriptor_INT64, |
67 | 69 | Name: "kubernetes.io/container/restart_count", |
68 | 70 | } |
69 | 71 |
|
70 | 72 | // Pod metrics |
71 | 73 |
|
72 | 74 | volumeUsedBytesMD = &metricMetadata{ |
73 | | - MetricKind: "GAUGE", |
74 | | - ValueType: "INT64", |
| 75 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 76 | + ValueType: google_api5.MetricDescriptor_INT64, |
75 | 77 | Name: "kubernetes.io/pod/volume/used_bytes", |
76 | 78 | } |
77 | 79 |
|
78 | 80 | volumeTotalBytesMD = &metricMetadata{ |
79 | | - MetricKind: "GAUGE", |
80 | | - ValueType: "INT64", |
| 81 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 82 | + ValueType: google_api5.MetricDescriptor_INT64, |
81 | 83 | Name: "kubernetes.io/pod/volume/total_bytes", |
82 | 84 | } |
83 | 85 |
|
84 | 86 | networkPodReceivedBytesMD = &metricMetadata{ |
85 | | - MetricKind: "CUMULATIVE", |
86 | | - ValueType: "INT64", |
| 87 | + MetricKind: google_api5.MetricDescriptor_CUMULATIVE, |
| 88 | + ValueType: google_api5.MetricDescriptor_INT64, |
87 | 89 | Name: "kubernetes.io/pod/network/received_bytes_count", |
88 | 90 | } |
89 | 91 |
|
90 | 92 | networkPodSentBytesMD = &metricMetadata{ |
91 | | - MetricKind: "CUMULATIVE", |
92 | | - ValueType: "INT64", |
| 93 | + MetricKind: google_api5.MetricDescriptor_CUMULATIVE, |
| 94 | + ValueType: google_api5.MetricDescriptor_INT64, |
93 | 95 | Name: "kubernetes.io/pod/network/sent_bytes_count", |
94 | 96 | } |
95 | 97 |
|
96 | 98 | // Node metrics |
97 | 99 |
|
98 | 100 | cpuNodeCoreUsageTimeMD = &metricMetadata{ |
99 | | - MetricKind: "CUMULATIVE", |
100 | | - ValueType: "DOUBLE", |
| 101 | + MetricKind: google_api5.MetricDescriptor_CUMULATIVE, |
| 102 | + ValueType: google_api5.MetricDescriptor_DOUBLE, |
101 | 103 | Name: "kubernetes.io/node/cpu/core_usage_time", |
102 | 104 | } |
103 | 105 |
|
104 | 106 | cpuTotalCoresMD = &metricMetadata{ |
105 | | - MetricKind: "GAUGE", |
106 | | - ValueType: "DOUBLE", |
| 107 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 108 | + ValueType: google_api5.MetricDescriptor_DOUBLE, |
107 | 109 | Name: "kubernetes.io/node/cpu/total_cores", |
108 | 110 | } |
109 | 111 |
|
110 | 112 | cpuAllocatableCoresMD = &metricMetadata{ |
111 | | - MetricKind: "GAUGE", |
112 | | - ValueType: "DOUBLE", |
| 113 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 114 | + ValueType: google_api5.MetricDescriptor_DOUBLE, |
113 | 115 | Name: "kubernetes.io/node/cpu/allocatable_cores", |
114 | 116 | } |
115 | 117 |
|
116 | 118 | memoryNodeUsedBytesMD = &metricMetadata{ |
117 | | - MetricKind: "GAUGE", |
118 | | - ValueType: "INT64", |
| 119 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 120 | + ValueType: google_api5.MetricDescriptor_INT64, |
119 | 121 | Name: "kubernetes.io/node/memory/used_bytes", |
120 | 122 | } |
121 | 123 |
|
122 | 124 | memoryTotalBytesMD = &metricMetadata{ |
123 | | - MetricKind: "GAUGE", |
124 | | - ValueType: "INT64", |
| 125 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 126 | + ValueType: google_api5.MetricDescriptor_INT64, |
125 | 127 | Name: "kubernetes.io/node/memory/total_bytes", |
126 | 128 | } |
127 | 129 |
|
128 | 130 | memoryAllocatableBytesMD = &metricMetadata{ |
129 | | - MetricKind: "GAUGE", |
130 | | - ValueType: "INT64", |
| 131 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 132 | + ValueType: google_api5.MetricDescriptor_INT64, |
131 | 133 | Name: "kubernetes.io/node/memory/allocatable_bytes", |
132 | 134 | } |
133 | 135 |
|
134 | 136 | networkNodeReceivedBytesMD = &metricMetadata{ |
135 | | - MetricKind: "CUMULATIVE", |
136 | | - ValueType: "INT64", |
| 137 | + MetricKind: google_api5.MetricDescriptor_CUMULATIVE, |
| 138 | + ValueType: google_api5.MetricDescriptor_INT64, |
137 | 139 | Name: "kubernetes.io/node/network/received_bytes_count", |
138 | 140 | } |
139 | 141 |
|
140 | 142 | networkNodeSentBytesMD = &metricMetadata{ |
141 | | - MetricKind: "CUMULATIVE", |
142 | | - ValueType: "INT64", |
| 143 | + MetricKind: google_api5.MetricDescriptor_CUMULATIVE, |
| 144 | + ValueType: google_api5.MetricDescriptor_INT64, |
143 | 145 | Name: "kubernetes.io/node/network/sent_bytes_count", |
144 | 146 | } |
145 | 147 |
|
146 | 148 | cpuNodeDaemonCoreUsageTimeMD = &metricMetadata{ |
147 | | - MetricKind: "CUMULATIVE", |
148 | | - ValueType: "DOUBLE", |
| 149 | + MetricKind: google_api5.MetricDescriptor_CUMULATIVE, |
| 150 | + ValueType: google_api5.MetricDescriptor_DOUBLE, |
149 | 151 | Name: "kubernetes.io/node_daemon/cpu/core_usage_time", |
150 | 152 | } |
151 | 153 |
|
152 | 154 | memoryNodeDaemonUsedBytesMD = &metricMetadata{ |
153 | | - MetricKind: "GAUGE", |
154 | | - ValueType: "INT64", |
| 155 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 156 | + ValueType: google_api5.MetricDescriptor_INT64, |
155 | 157 | Name: "kubernetes.io/node_daemon/memory/used_bytes", |
156 | 158 | } |
157 | 159 |
|
158 | 160 | // Old resource model metrics |
159 | 161 |
|
160 | 162 | legacyUptimeMD = &metricMetadata{ |
161 | | - MetricKind: "CUMULATIVE", |
162 | | - ValueType: "DOUBLE", |
| 163 | + MetricKind: google_api5.MetricDescriptor_CUMULATIVE, |
| 164 | + ValueType: google_api5.MetricDescriptor_DOUBLE, |
163 | 165 | Name: "container.googleapis.com/container/uptime", |
164 | 166 | } |
165 | 167 |
|
166 | 168 | legacyCPUReservedCoresMD = &metricMetadata{ |
167 | | - MetricKind: "GAUGE", |
168 | | - ValueType: "DOUBLE", |
| 169 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 170 | + ValueType: google_api5.MetricDescriptor_DOUBLE, |
169 | 171 | Name: "container.googleapis.com/container/cpu/reserved_cores", |
170 | 172 | } |
171 | 173 |
|
172 | 174 | legacyCPUUsageTimeMD = &metricMetadata{ |
173 | | - MetricKind: "CUMULATIVE", |
174 | | - ValueType: "DOUBLE", |
| 175 | + MetricKind: google_api5.MetricDescriptor_CUMULATIVE, |
| 176 | + ValueType: google_api5.MetricDescriptor_DOUBLE, |
175 | 177 | Name: "container.googleapis.com/container/cpu/usage_time", |
176 | 178 | } |
177 | 179 |
|
178 | 180 | legacyNetworkRxMD = &metricMetadata{ |
179 | | - MetricKind: "CUMULATIVE", |
180 | | - ValueType: "INT64", |
| 181 | + MetricKind: google_api5.MetricDescriptor_CUMULATIVE, |
| 182 | + ValueType: google_api5.MetricDescriptor_INT64, |
181 | 183 | Name: "container.googleapis.com/container/network/received_bytes_count", |
182 | 184 | } |
183 | 185 |
|
184 | 186 | legacyNetworkTxMD = &metricMetadata{ |
185 | | - MetricKind: "CUMULATIVE", |
186 | | - ValueType: "INT64", |
| 187 | + MetricKind: google_api5.MetricDescriptor_CUMULATIVE, |
| 188 | + ValueType: google_api5.MetricDescriptor_INT64, |
187 | 189 | Name: "container.googleapis.com/container/network/sent_bytes_count", |
188 | 190 | } |
189 | 191 |
|
190 | 192 | legacyMemoryLimitMD = &metricMetadata{ |
191 | | - MetricKind: "GAUGE", |
192 | | - ValueType: "INT64", |
| 193 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 194 | + ValueType: google_api5.MetricDescriptor_INT64, |
193 | 195 | Name: "container.googleapis.com/container/memory/bytes_total", |
194 | 196 | } |
195 | 197 |
|
196 | 198 | legacyMemoryBytesUsedMD = &metricMetadata{ |
197 | | - MetricKind: "GAUGE", |
198 | | - ValueType: "INT64", |
| 199 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 200 | + ValueType: google_api5.MetricDescriptor_INT64, |
199 | 201 | Name: "container.googleapis.com/container/memory/bytes_used", |
200 | 202 | } |
201 | 203 |
|
202 | 204 | legacyMemoryPageFaultsMD = &metricMetadata{ |
203 | | - MetricKind: "CUMULATIVE", |
204 | | - ValueType: "INT64", |
| 205 | + MetricKind: google_api5.MetricDescriptor_CUMULATIVE, |
| 206 | + ValueType: google_api5.MetricDescriptor_INT64, |
205 | 207 | Name: "container.googleapis.com/container/memory/page_fault_count", |
206 | 208 | } |
207 | 209 |
|
208 | 210 | legacyDiskBytesUsedMD = &metricMetadata{ |
209 | | - MetricKind: "GAUGE", |
210 | | - ValueType: "INT64", |
| 211 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 212 | + ValueType: google_api5.MetricDescriptor_INT64, |
211 | 213 | Name: "container.googleapis.com/container/disk/bytes_used", |
212 | 214 | } |
213 | 215 |
|
214 | 216 | legacyDiskBytesTotalMD = &metricMetadata{ |
215 | | - MetricKind: "GAUGE", |
216 | | - ValueType: "INT64", |
| 217 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 218 | + ValueType: google_api5.MetricDescriptor_INT64, |
217 | 219 | Name: "container.googleapis.com/container/disk/bytes_total", |
218 | 220 | } |
219 | 221 |
|
220 | 222 | legacyAcceleratorMemoryTotalMD = &metricMetadata{ |
221 | | - MetricKind: "GAUGE", |
222 | | - ValueType: "INT64", |
| 223 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 224 | + ValueType: google_api5.MetricDescriptor_INT64, |
223 | 225 | Name: "container.googleapis.com/container/accelerator/memory_total", |
224 | 226 | } |
225 | 227 |
|
226 | 228 | legacyAcceleratorMemoryUsedMD = &metricMetadata{ |
227 | | - MetricKind: "GAUGE", |
228 | | - ValueType: "INT64", |
| 229 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 230 | + ValueType: google_api5.MetricDescriptor_INT64, |
229 | 231 | Name: "container.googleapis.com/container/accelerator/memory_used", |
230 | 232 | } |
231 | 233 |
|
232 | 234 | legacyAcceleratorDutyCycleMD = &metricMetadata{ |
233 | | - MetricKind: "GAUGE", |
234 | | - ValueType: "INT64", |
| 235 | + MetricKind: google_api5.MetricDescriptor_GAUGE, |
| 236 | + ValueType: google_api5.MetricDescriptor_INT64, |
235 | 237 | Name: "container.googleapis.com/container/accelerator/duty_cycle", |
236 | 238 | } |
237 | 239 | ) |
0 commit comments