Skip to content
This repository was archived by the owner on Dec 1, 2018. It is now read-only.

Commit b05da47

Browse files
committed
Use grpc-based implementation of Stackdriver API.
1 parent 847771c commit b05da47

File tree

3 files changed

+186
-186
lines changed

3 files changed

+186
-186
lines changed

metrics/sinks/stackdriver/metadata.go

Lines changed: 72 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -14,224 +14,226 @@
1414

1515
package stackdriver
1616

17+
import google_api5 "google.golang.org/genproto/googleapis/api/metric"
18+
1719
var (
1820
// Known metrics metadata
1921

2022
// Container metrics
2123

2224
containerUptimeMD = &metricMetadata{
23-
MetricKind: "GAUGE",
24-
ValueType: "DOUBLE",
25+
MetricKind: google_api5.MetricDescriptor_GAUGE,
26+
ValueType: google_api5.MetricDescriptor_DOUBLE,
2527
Name: "kubernetes.io/container/uptime",
2628
}
2729

2830
cpuContainerCoreUsageTimeMD = &metricMetadata{
29-
MetricKind: "CUMULATIVE",
30-
ValueType: "DOUBLE",
31+
MetricKind: google_api5.MetricDescriptor_CUMULATIVE,
32+
ValueType: google_api5.MetricDescriptor_DOUBLE,
3133
Name: "kubernetes.io/container/cpu/core_usage_time",
3234
}
3335

3436
cpuRequestedCoresMD = &metricMetadata{
35-
MetricKind: "GAUGE",
36-
ValueType: "DOUBLE",
37+
MetricKind: google_api5.MetricDescriptor_GAUGE,
38+
ValueType: google_api5.MetricDescriptor_DOUBLE,
3739
Name: "kubernetes.io/container/cpu/request_cores",
3840
}
3941

4042
cpuLimitCoresMD = &metricMetadata{
41-
MetricKind: "GAUGE",
42-
ValueType: "DOUBLE",
43+
MetricKind: google_api5.MetricDescriptor_GAUGE,
44+
ValueType: google_api5.MetricDescriptor_DOUBLE,
4345
Name: "kubernetes.io/container/cpu/limit_cores",
4446
}
4547

4648
memoryContainerUsedBytesMD = &metricMetadata{
47-
MetricKind: "GAUGE",
48-
ValueType: "INT64",
49+
MetricKind: google_api5.MetricDescriptor_GAUGE,
50+
ValueType: google_api5.MetricDescriptor_INT64,
4951
Name: "kubernetes.io/container/memory/used_bytes",
5052
}
5153

5254
memoryRequestedBytesMD = &metricMetadata{
53-
MetricKind: "GAUGE",
54-
ValueType: "INT64",
55+
MetricKind: google_api5.MetricDescriptor_GAUGE,
56+
ValueType: google_api5.MetricDescriptor_INT64,
5557
Name: "kubernetes.io/container/memory/request_bytes",
5658
}
5759

5860
memoryLimitBytesMD = &metricMetadata{
59-
MetricKind: "GAUGE",
60-
ValueType: "INT64",
61+
MetricKind: google_api5.MetricDescriptor_GAUGE,
62+
ValueType: google_api5.MetricDescriptor_INT64,
6163
Name: "kubernetes.io/container/memory/limit_bytes",
6264
}
6365

6466
restartCountMD = &metricMetadata{
65-
MetricKind: "CUMULATIVE",
66-
ValueType: "INT64",
67+
MetricKind: google_api5.MetricDescriptor_CUMULATIVE,
68+
ValueType: google_api5.MetricDescriptor_INT64,
6769
Name: "kubernetes.io/container/restart_count",
6870
}
6971

7072
// Pod metrics
7173

7274
volumeUsedBytesMD = &metricMetadata{
73-
MetricKind: "GAUGE",
74-
ValueType: "INT64",
75+
MetricKind: google_api5.MetricDescriptor_GAUGE,
76+
ValueType: google_api5.MetricDescriptor_INT64,
7577
Name: "kubernetes.io/pod/volume/used_bytes",
7678
}
7779

7880
volumeTotalBytesMD = &metricMetadata{
79-
MetricKind: "GAUGE",
80-
ValueType: "INT64",
81+
MetricKind: google_api5.MetricDescriptor_GAUGE,
82+
ValueType: google_api5.MetricDescriptor_INT64,
8183
Name: "kubernetes.io/pod/volume/total_bytes",
8284
}
8385

8486
networkPodReceivedBytesMD = &metricMetadata{
85-
MetricKind: "CUMULATIVE",
86-
ValueType: "INT64",
87+
MetricKind: google_api5.MetricDescriptor_CUMULATIVE,
88+
ValueType: google_api5.MetricDescriptor_INT64,
8789
Name: "kubernetes.io/pod/network/received_bytes_count",
8890
}
8991

9092
networkPodSentBytesMD = &metricMetadata{
91-
MetricKind: "CUMULATIVE",
92-
ValueType: "INT64",
93+
MetricKind: google_api5.MetricDescriptor_CUMULATIVE,
94+
ValueType: google_api5.MetricDescriptor_INT64,
9395
Name: "kubernetes.io/pod/network/sent_bytes_count",
9496
}
9597

9698
// Node metrics
9799

98100
cpuNodeCoreUsageTimeMD = &metricMetadata{
99-
MetricKind: "CUMULATIVE",
100-
ValueType: "DOUBLE",
101+
MetricKind: google_api5.MetricDescriptor_CUMULATIVE,
102+
ValueType: google_api5.MetricDescriptor_DOUBLE,
101103
Name: "kubernetes.io/node/cpu/core_usage_time",
102104
}
103105

104106
cpuTotalCoresMD = &metricMetadata{
105-
MetricKind: "GAUGE",
106-
ValueType: "DOUBLE",
107+
MetricKind: google_api5.MetricDescriptor_GAUGE,
108+
ValueType: google_api5.MetricDescriptor_DOUBLE,
107109
Name: "kubernetes.io/node/cpu/total_cores",
108110
}
109111

110112
cpuAllocatableCoresMD = &metricMetadata{
111-
MetricKind: "GAUGE",
112-
ValueType: "DOUBLE",
113+
MetricKind: google_api5.MetricDescriptor_GAUGE,
114+
ValueType: google_api5.MetricDescriptor_DOUBLE,
113115
Name: "kubernetes.io/node/cpu/allocatable_cores",
114116
}
115117

116118
memoryNodeUsedBytesMD = &metricMetadata{
117-
MetricKind: "GAUGE",
118-
ValueType: "INT64",
119+
MetricKind: google_api5.MetricDescriptor_GAUGE,
120+
ValueType: google_api5.MetricDescriptor_INT64,
119121
Name: "kubernetes.io/node/memory/used_bytes",
120122
}
121123

122124
memoryTotalBytesMD = &metricMetadata{
123-
MetricKind: "GAUGE",
124-
ValueType: "INT64",
125+
MetricKind: google_api5.MetricDescriptor_GAUGE,
126+
ValueType: google_api5.MetricDescriptor_INT64,
125127
Name: "kubernetes.io/node/memory/total_bytes",
126128
}
127129

128130
memoryAllocatableBytesMD = &metricMetadata{
129-
MetricKind: "GAUGE",
130-
ValueType: "INT64",
131+
MetricKind: google_api5.MetricDescriptor_GAUGE,
132+
ValueType: google_api5.MetricDescriptor_INT64,
131133
Name: "kubernetes.io/node/memory/allocatable_bytes",
132134
}
133135

134136
networkNodeReceivedBytesMD = &metricMetadata{
135-
MetricKind: "CUMULATIVE",
136-
ValueType: "INT64",
137+
MetricKind: google_api5.MetricDescriptor_CUMULATIVE,
138+
ValueType: google_api5.MetricDescriptor_INT64,
137139
Name: "kubernetes.io/node/network/received_bytes_count",
138140
}
139141

140142
networkNodeSentBytesMD = &metricMetadata{
141-
MetricKind: "CUMULATIVE",
142-
ValueType: "INT64",
143+
MetricKind: google_api5.MetricDescriptor_CUMULATIVE,
144+
ValueType: google_api5.MetricDescriptor_INT64,
143145
Name: "kubernetes.io/node/network/sent_bytes_count",
144146
}
145147

146148
cpuNodeDaemonCoreUsageTimeMD = &metricMetadata{
147-
MetricKind: "CUMULATIVE",
148-
ValueType: "DOUBLE",
149+
MetricKind: google_api5.MetricDescriptor_CUMULATIVE,
150+
ValueType: google_api5.MetricDescriptor_DOUBLE,
149151
Name: "kubernetes.io/node_daemon/cpu/core_usage_time",
150152
}
151153

152154
memoryNodeDaemonUsedBytesMD = &metricMetadata{
153-
MetricKind: "GAUGE",
154-
ValueType: "INT64",
155+
MetricKind: google_api5.MetricDescriptor_GAUGE,
156+
ValueType: google_api5.MetricDescriptor_INT64,
155157
Name: "kubernetes.io/node_daemon/memory/used_bytes",
156158
}
157159

158160
// Old resource model metrics
159161

160162
legacyUptimeMD = &metricMetadata{
161-
MetricKind: "CUMULATIVE",
162-
ValueType: "DOUBLE",
163+
MetricKind: google_api5.MetricDescriptor_CUMULATIVE,
164+
ValueType: google_api5.MetricDescriptor_DOUBLE,
163165
Name: "container.googleapis.com/container/uptime",
164166
}
165167

166168
legacyCPUReservedCoresMD = &metricMetadata{
167-
MetricKind: "GAUGE",
168-
ValueType: "DOUBLE",
169+
MetricKind: google_api5.MetricDescriptor_GAUGE,
170+
ValueType: google_api5.MetricDescriptor_DOUBLE,
169171
Name: "container.googleapis.com/container/cpu/reserved_cores",
170172
}
171173

172174
legacyCPUUsageTimeMD = &metricMetadata{
173-
MetricKind: "CUMULATIVE",
174-
ValueType: "DOUBLE",
175+
MetricKind: google_api5.MetricDescriptor_CUMULATIVE,
176+
ValueType: google_api5.MetricDescriptor_DOUBLE,
175177
Name: "container.googleapis.com/container/cpu/usage_time",
176178
}
177179

178180
legacyNetworkRxMD = &metricMetadata{
179-
MetricKind: "CUMULATIVE",
180-
ValueType: "INT64",
181+
MetricKind: google_api5.MetricDescriptor_CUMULATIVE,
182+
ValueType: google_api5.MetricDescriptor_INT64,
181183
Name: "container.googleapis.com/container/network/received_bytes_count",
182184
}
183185

184186
legacyNetworkTxMD = &metricMetadata{
185-
MetricKind: "CUMULATIVE",
186-
ValueType: "INT64",
187+
MetricKind: google_api5.MetricDescriptor_CUMULATIVE,
188+
ValueType: google_api5.MetricDescriptor_INT64,
187189
Name: "container.googleapis.com/container/network/sent_bytes_count",
188190
}
189191

190192
legacyMemoryLimitMD = &metricMetadata{
191-
MetricKind: "GAUGE",
192-
ValueType: "INT64",
193+
MetricKind: google_api5.MetricDescriptor_GAUGE,
194+
ValueType: google_api5.MetricDescriptor_INT64,
193195
Name: "container.googleapis.com/container/memory/bytes_total",
194196
}
195197

196198
legacyMemoryBytesUsedMD = &metricMetadata{
197-
MetricKind: "GAUGE",
198-
ValueType: "INT64",
199+
MetricKind: google_api5.MetricDescriptor_GAUGE,
200+
ValueType: google_api5.MetricDescriptor_INT64,
199201
Name: "container.googleapis.com/container/memory/bytes_used",
200202
}
201203

202204
legacyMemoryPageFaultsMD = &metricMetadata{
203-
MetricKind: "CUMULATIVE",
204-
ValueType: "INT64",
205+
MetricKind: google_api5.MetricDescriptor_CUMULATIVE,
206+
ValueType: google_api5.MetricDescriptor_INT64,
205207
Name: "container.googleapis.com/container/memory/page_fault_count",
206208
}
207209

208210
legacyDiskBytesUsedMD = &metricMetadata{
209-
MetricKind: "GAUGE",
210-
ValueType: "INT64",
211+
MetricKind: google_api5.MetricDescriptor_GAUGE,
212+
ValueType: google_api5.MetricDescriptor_INT64,
211213
Name: "container.googleapis.com/container/disk/bytes_used",
212214
}
213215

214216
legacyDiskBytesTotalMD = &metricMetadata{
215-
MetricKind: "GAUGE",
216-
ValueType: "INT64",
217+
MetricKind: google_api5.MetricDescriptor_GAUGE,
218+
ValueType: google_api5.MetricDescriptor_INT64,
217219
Name: "container.googleapis.com/container/disk/bytes_total",
218220
}
219221

220222
legacyAcceleratorMemoryTotalMD = &metricMetadata{
221-
MetricKind: "GAUGE",
222-
ValueType: "INT64",
223+
MetricKind: google_api5.MetricDescriptor_GAUGE,
224+
ValueType: google_api5.MetricDescriptor_INT64,
223225
Name: "container.googleapis.com/container/accelerator/memory_total",
224226
}
225227

226228
legacyAcceleratorMemoryUsedMD = &metricMetadata{
227-
MetricKind: "GAUGE",
228-
ValueType: "INT64",
229+
MetricKind: google_api5.MetricDescriptor_GAUGE,
230+
ValueType: google_api5.MetricDescriptor_INT64,
229231
Name: "container.googleapis.com/container/accelerator/memory_used",
230232
}
231233

232234
legacyAcceleratorDutyCycleMD = &metricMetadata{
233-
MetricKind: "GAUGE",
234-
ValueType: "INT64",
235+
MetricKind: google_api5.MetricDescriptor_GAUGE,
236+
ValueType: google_api5.MetricDescriptor_INT64,
235237
Name: "container.googleapis.com/container/accelerator/duty_cycle",
236238
}
237239
)

0 commit comments

Comments
 (0)