-
Notifications
You must be signed in to change notification settings - Fork 1
/
buoyant-cloud-metrics.yaml
362 lines (337 loc) · 13.3 KB
/
buoyant-cloud-metrics.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
apiVersion: v1
data:
agent.yml: |
server:
log_level: debug
metrics:
wal_directory: /tmp/wal
global:
scrape_interval: 10s
external_labels:
cluster_id: ${AGENT_ID}
cluster_name: ${AGENT_NAME}
configs:
- host_filter: true
name: buoyant-cloud-metrics
wal_truncate_frequency: "1m"
remote_write:
- url: https://api.buoyant.cloud:443/remote-write
oauth2:
client_id: ${BUOYANT_CLOUD_CLIENT_ID}
client_secret: ${BUOYANT_CLOUD_CLIENT_SECRET}
token_url: https://api.buoyant.cloud:443/agent-token?agent_id=${AGENT_ID}
queue_config:
capacity: 1500
max_shards: 20
max_backoff: 10s
scrape_configs:
- job_name: 'buoyant-cloud-agent'
kubernetes_sd_configs:
- role: pod
namespaces:
names:
- 'linkerd-buoyant'
relabel_configs:
- source_labels: [__meta_kubernetes_pod_container_port_name]
regex: ^buoyant-admin$
action: keep
- source_labels: [__meta_kubernetes_pod_container_name]
regex: ^buoyant-cloud-agent|buoyant-cloud-metrics|linkerd-control-plane-operator|linkerd-data-plane-operator$
action: keep
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: namespace
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: pod
- action: labelmap
regex: __meta_kubernetes_pod_label_(.+)
# scrape_configs copied from `linkerd install`
- job_name: 'kubernetes-nodes-cadvisor'
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
kubernetes_sd_configs:
- role: node
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
- target_label: __address__
replacement: kubernetes.default.svc:443
- source_labels: [__meta_kubernetes_node_name]
regex: (.+)
target_label: __metrics_path__
replacement: /api/v1/nodes/$1/proxy/metrics/cadvisor
metric_relabel_configs:
- source_labels: [__name__]
regex: ^container_cpu_usage_seconds_total|container_memory_working_set_bytes|machine_cpu_cores|machine_memory_bytes$
action: keep
- source_labels: [pod]
target_label: workload_kind
regex: ^(.*)-[bcdfghjklmnpqrstvwxz2456789]{5,15}$
action: replace
replacement: Deployment
- source_labels: [pod]
target_label: workload_kind
regex: ^(.*)-[0-9]+$
action: replace
replacement: StatefulSet
- source_labels: [pod]
target_label: workload_kind
regex: ^(.*)-[bcdfghjklmnpqrstvwxz2456789]{5}$
action: replace
replacement: DaemonSet
- source_labels: [pod]
target_label: workload_kind
regex: ^(.*)-[456789bcdf]{1,10}-[bcdfghjklmnpqrstvwxz2456789]{5}$
action: replace
replacement: Deployment
- source_labels: [pod]
target_label: workload_name
regex: ^(.*)-[bcdfghjklmnpqrstvwxz2456789]{5,15}$
action: replace
replacement: $1
- source_labels: [pod]
target_label: workload_name
regex: ^(.*)-[0-9]+$
action: replace
replacement: $1
- source_labels: [pod]
target_label: workload_name
regex: ^(.*)-[bcdfghjklmnpqrstvwxz2456789]{5}$
action: replace
replacement: $1
- source_labels: [pod]
target_label: workload_name
regex: ^(.*)-[456789bcdf]{1,10}-[bcdfghjklmnpqrstvwxz2456789]{5}$
action: replace
replacement: $1
- job_name: 'linkerd-controller'
kubernetes_sd_configs:
- role: pod
namespaces:
names:
- 'linkerd'
relabel_configs:
- source_labels:
- __meta_kubernetes_pod_container_port_name
action: keep
regex: admin-http
- source_labels: [__meta_kubernetes_pod_container_name]
action: replace
target_label: component
- job_name: 'linkerd-proxy'
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels:
- __meta_kubernetes_pod_container_name
- __meta_kubernetes_pod_container_port_name
action: keep
regex: ^linkerd-proxy;linkerd-admin$
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: namespace
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: pod
# special case k8s' "job" label, to not interfere with prometheus' "job"
# label
# __meta_kubernetes_pod_label_linkerd_io_proxy_job=foo =>
# k8s_job=foo
- source_labels: [__meta_kubernetes_pod_label_linkerd_io_proxy_job]
action: replace
target_label: k8s_job
# drop __meta_kubernetes_pod_label_linkerd_io_proxy_job
- action: labeldrop
regex: __meta_kubernetes_pod_label_linkerd_io_proxy_job
# __meta_kubernetes_pod_label_linkerd_io_proxy_deployment=foo =>
# deployment=foo
- action: labelmap
regex: __meta_kubernetes_pod_label_linkerd_io_proxy_(.+)
# drop all labels that we just made copies of in the previous labelmap
- action: labeldrop
regex: __meta_kubernetes_pod_label_linkerd_io_proxy_(.+)
# __meta_kubernetes_pod_label_linkerd_io_foo=bar =>
# foo=bar
- action: labelmap
regex: __meta_kubernetes_pod_label_linkerd_io_(.+)
# __meta_kubernetes_pod_controller_kind=DaemonSet => workload_kind=DaemonSet
# __meta_kubernetes_pod_controller_name=foo => workload_name=foo
- source_labels: [__meta_kubernetes_pod_controller_kind]
action: replace
target_label: workload_kind
- source_labels: [__meta_kubernetes_pod_controller_name]
action: replace
target_label: workload_name
# __meta_kubernetes_pod_controller_kind=ReplicaSet => workload_kind=Deployment
# __meta_kubernetes_pod_controller_name=foo-bar-123 => workload_name=foo-bar
- source_labels: [__meta_kubernetes_pod_controller_kind]
action: replace
regex: ^ReplicaSet$
target_label: workload_kind
replacement: Deployment
- source_labels:
- __meta_kubernetes_pod_controller_kind
- __meta_kubernetes_pod_controller_name
action: replace
regex: ^ReplicaSet;(.*)-[^-]+$
target_label: workload_name
# __meta_kubernetes_pod_controller_kind=ReplicaSet => workload_kind=Rollout
# __meta_kubernetes_pod_controller_name=foo-bar-123 => workload_name=foo-bar
- source_labels:
- __meta_kubernetes_pod_controller_kind
- __meta_kubernetes_pod_labelpresent_rollouts_pod_template_hash
action: replace
regex: ^ReplicaSet;true$
target_label: workload_kind
replacement: Rollout
- source_labels:
- __meta_kubernetes_pod_controller_kind
- __meta_kubernetes_pod_controller_name
- __meta_kubernetes_pod_labelpresent_rollouts_pod_template_hash
action: replace
regex: ^ReplicaSet;(.*)-[^-]+;true$
target_label: workload_name
metric_relabel_configs:
# keep linkerd metrics relevant to buoyant cloud
- source_labels: [__name__]
regex: ^route_actual_response_total|response_total|response_latency_ms_bucket|route_response_total|route_response_latency_ms_bucket|tcp_open_connections|tcp_open_total|tcp_read_bytes_total|tcp_write_bytes_total|inbound_http_authz_allow_total|inbound_http_authz_deny_total|inbound_tcp_authz_allow_total|inbound_tcp_authz_deny_total|inbound_http_errors_total|inbound_tcp_errors_total|outbound_http_errors_total|outbound_tcp_errors_total$
action: keep
# drop some latency buckets
- source_labels:
- le
regex: ^2.*|3.*|4.*$
action: drop
# drop high-cardinality outbound tcp open connections
- source_labels:
- __name__
- direction
regex: 'tcp_open_connections;outbound'
action: drop
# drop high-cardinality outbound tcp open total
- source_labels:
- __name__
- direction
regex: 'tcp_open_total;outbound'
action: drop
# drop linkerd workload labels (superseded by workload_kind, workload_name)
- action: labeldrop
regex: 'deployment'
- action: labeldrop
regex: 'daemonset'
- action: labeldrop
regex: 'statefulset'
- action: labeldrop
regex: 'replicaset'
# foo{direction="outbound"} => outbound_foo{}
- source_labels:
- __name__
- direction
regex: ^(.+);(inbound|outbound)$
action: replace
target_label: __name__
replacement: $${2}_$${1}
- action: labeldrop
regex: direction
# dst_replicaset=foo-123 => dst_workload_name=foo
# dst_replicaset=foo-123 => dst_workload_kind=Rollout
- source_labels: [dst_replicaset]
regex: ^(.*)-[^-]+$
action: replace
target_label: dst_workload_name
- source_labels: [dst_replicaset]
regex: (.+)
action: replace
target_label: dst_workload_kind
replacement: Rollout
- action: labeldrop
regex: 'dst_replicaset'
# dst_daemonset=foo => dst_workload_name=foo
# dst_daemonset=foo => dst_workload_kind=DaemonSet
- source_labels: [dst_daemonset]
regex: (.+)
action: replace
target_label: dst_workload_name
- source_labels: [dst_daemonset]
regex: (.+)
action: replace
target_label: dst_workload_kind
replacement: DaemonSet
- action: labeldrop
regex: 'dst_daemonset'
# dst_deployment=foo => dst_workload_name=foo
# dst_deployment=foo => dst_workload_kind=Deployment
- source_labels: [dst_deployment]
regex: (.+)
action: replace
target_label: dst_workload_name
- source_labels: [dst_deployment]
regex: (.+)
action: replace
target_label: dst_workload_kind
replacement: Deployment
- action: labeldrop
regex: 'dst_deployment'
# dst_statefulset=foo => dst_workload_name=foo
# dst_statefulset=foo => dst_workload_kind=StatefulSet
- source_labels: [dst_statefulset]
regex: (.+)
action: replace
target_label: dst_workload_name
- source_labels: [dst_statefulset]
regex: (.+)
action: replace
target_label: dst_workload_kind
replacement: StatefulSet
- action: labeldrop
regex: 'dst_statefulset'
# drop remaining high-cardinality linkerd metrics and labels
- action: labeldrop
regex: 'pod_template_hash'
- action: labeldrop
regex: 'dst_pod_template_hash'
- action: labeldrop
regex: 'dst_serviceaccount'
- action: labeldrop
regex: 'server_id'
- action: labeldrop
regex: 'control_plane_ns'
- action: labeldrop
regex: 'dst_control_plane_ns'
- action: labeldrop
regex: 'workload_ns'
- job_name: 'multicluster-link'
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels:
- __meta_kubernetes_pod_container_name
- __meta_kubernetes_pod_container_port_name
action: keep
regex: ^service-mirror;admin-http$
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: namespace
metric_relabel_configs:
# keep link metrics relevant to buoyant cloud
- source_labels: [__name__]
regex: ^gateway_alive|gateway_probe_latency_ms_bucket$
action: keep
# drop some latency buckets
- source_labels:
- le
regex: ^2.*|3.*|4.*$
action: drop
kind: ConfigMap
metadata:
annotations:
meta.helm.sh/release-name: linkerd-buoyant
meta.helm.sh/release-namespace: linkerd-buoyant
labels:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/part-of: linkerd-buoyant
name: buoyant-cloud-metrics
namespace: linkerd-buoyant