forked from open-telemetry/opentelemetry-helm-charts
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathconfigmap-agent.yaml
More file actions
531 lines (530 loc) · 18.1 KB
/
Copy pathconfigmap-agent.yaml
File metadata and controls
531 lines (530 loc) · 18.1 KB
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
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
---
# Source: opentelemetry-collector/templates/configmap-agent.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: example-opentelemetry-collector-agent
namespace: default
labels:
helm.sh/chart: opentelemetry-collector-0.115.24
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.126.0"
app.kubernetes.io/managed-by: Helm
data:
relay: |
connectors:
forward/db: {}
forward/sampled: {}
spanmetrics:
dimensions:
- name: http.method
- name: cgx.transaction
- name: cgx.transaction.root
- name: status_code
- name: db.namespace
- name: db.operation.name
- name: db.collection.name
- name: db.system
- name: http.response.status_code
- name: rpc.grpc.status_code
- name: service.version
histogram:
explicit:
buckets:
- 1ms
- 1s
- 10s
metrics_expiration: 5m
metrics_flush_interval: 30s
namespace: ""
spanmetrics/db:
dimensions:
- name: db.namespace
- name: db.operation.name
- name: db.collection.name
- name: db.system
- name: service.version
- name: cgx.transaction
- name: cgx.transaction.root
histogram:
explicit:
buckets:
- 100us
- 1ms
- 2ms
- 2.5ms
- 4ms
- 6ms
- 10ms
- 100ms
- 250ms
metrics_expiration: 5m
metrics_flush_interval: 30s
namespace: db
exporters:
coralogix:
application_name: otel
domain: coralogix.com
debug: {}
extensions:
health_check:
endpoint: ${env:MY_POD_IP}:13133
k8s_observer:
auth_type: serviceAccount
node: ${env:K8S_NODE_NAME}
observe_pods: true
processors:
batch:
send_batch_max_size: 2048
send_batch_size: 1024
timeout: 1s
filter/db_spanmetrics:
traces:
span:
- attributes["db.system"] == nil
filter/k8s_extra_metrics:
metrics:
metric:
- resource.attributes["service.name"] == "kubernetes-apiserver" and name !=
"kubernetes_build_info"
- resource.attributes["service.name"] == "kubernetes-cadvisor" and (name !=
"container_fs_writes_total" and name != "container_fs_reads_total" and name
!= "container_fs_writes_bytes_total" and name != "container_fs_reads_bytes_total"
and name != "container_fs_usage_bytes" and name != "container_cpu_cfs_throttled_periods_total"
and name != "container_cpu_cfs_periods_total")
k8sattributes:
extract:
metadata:
- k8s.namespace.name
- k8s.replicaset.name
- k8s.statefulset.name
- k8s.daemonset.name
- k8s.cronjob.name
- k8s.job.name
- k8s.node.name
- k8s.pod.name
- k8s.pod.uid
- k8s.pod.start_time
filter:
node_from_env_var: K8S_NODE_NAME
passthrough: false
pod_association:
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: connection
- sources:
- from: resource_attribute
name: k8s.job.name
memory_limiter:
check_interval: 5s
limit_percentage: 80
spike_limit_percentage: 25
probabilistic_sampler:
mode: proportional
sampling_percentage: 10
resourcedetection/env:
detectors:
- system
- env
override: false
system:
resource_attributes:
host.id:
enabled: true
timeout: 2s
resourcedetection/region:
detectors:
- gcp
- ec2
- azure
override: true
timeout: 2s
transform/db:
error_mode: silent
trace_statements:
- context: span
statements:
- set(attributes["db.namespace"], attributes["db.name"]) where attributes["db.namespace"]
== nil
- set(attributes["db.namespace"], attributes["server.address"]) where attributes["db.namespace"]
== nil
- set(attributes["db.namespace"], attributes["network.peer.name"]) where attributes["db.namespace"]
== nil
- set(attributes["db.namespace"], attributes["net.peer.name"]) where attributes["db.namespace"]
== nil
- set(attributes["db.namespace"], attributes["db.system"]) where attributes["db.namespace"]
== nil
- set(attributes["db.operation.name"], attributes["db.operation"]) where attributes["db.operation.name"]
== nil
- set(attributes["db.collection_name"], attributes["db.sql.table"]) where attributes["db.collection_name"]
== nil
- set(attributes["db.collection_name"], attributes["db.cassandra.table"]) where
attributes["db.collection.name"] == nil
- set(attributes["db.collection_name"], attributes["db.mongodb.collection"])
where attributes["db.collection.name"] == nil
- set(attributes["db.collection_name"], attributes["db.redis.database_index"])
where attributes["db.collection.name"] == nil
- set(attributes["db.collection_name"], attributes["db.elasticsearch.path_parts.index"])
where attributes["db.collection.name"] == nil
- set(attributes["db.collection_name"], attributes["db.cosmosdb.container"])
where attributes["db.collection.name"] == nil
- set(attributes["db.collection_name"], attributes["aws_dynamodb.table_names"])
where attributes["db.collection.name"] == nil
transform/k8s_attributes:
log_statements:
- context: resource
statements:
- set(attributes["k8s.deployment.name"], attributes["k8s.replicaset.name"])
- replace_pattern(attributes["k8s.deployment.name"], "^(.*)-[0-9a-zA-Z]+$",
"$$1") where attributes["k8s.replicaset.name"] != nil
- delete_key(attributes, "k8s.replicaset.name")
metric_statements:
- context: resource
statements:
- set(attributes["k8s.deployment.name"], attributes["k8s.replicaset.name"])
- replace_pattern(attributes["k8s.deployment.name"], "^(.*)-[0-9a-zA-Z]+$",
"$$1") where attributes["k8s.replicaset.name"] != nil
- delete_key(attributes, "k8s.replicaset.name")
trace_statements:
- context: resource
statements:
- set(attributes["k8s.deployment.name"], attributes["k8s.replicaset.name"])
- replace_pattern(attributes["k8s.deployment.name"], "^(.*)-[0-9a-zA-Z]+$",
"$$1") where attributes["k8s.replicaset.name"] != nil
- delete_key(attributes, "k8s.replicaset.name")
transform/reduce:
error_mode: ignore
metric_statements:
- context: resource
statements:
- delete_key(attributes, "container.id")
- delete_key(attributes, "k8s.pod.uid")
- delete_key(attributes, "k8s.replicaset.uid")
- delete_key(attributes, "k8s.daemonset.uid")
- delete_key(attributes, "k8s.deployment.uid")
- delete_key(attributes, "k8s.statefulset.uid")
- delete_key(attributes, "k8s.cronjob.uid")
- delete_key(attributes, "k8s.job.uid")
- delete_key(attributes, "k8s.hpa.uid")
- delete_key(attributes, "k8s.namespace.uid")
- delete_key(attributes, "k8s.node.uid")
- delete_key(attributes, "net.host.name")
- delete_key(attributes, "net.host.port")
transform/span_name:
trace_statements:
- context: span
statements:
- replace_pattern(name, "^(.*)$", "$$1")
transform/spanmetrics:
error_mode: silent
trace_statements:
- context: span
statements:
- set(attributes["http.response.status_code"], attributes["http.status_code"])
where attributes["http.response.status_code"] == nil
transform/test:
error_mode: silent
trace_statements:
- context: span
statements:
- set(attributes["http.response.status_code"], attributes["http.status_code"])
where attributes["http.response.status_code"] == nil
receivers:
filelog:
exclude: []
force_flush_period: 0
include:
- /var/log/pods/*/*/*.log
include_file_name: false
include_file_path: true
operators:
- id: get-format
routes:
- expr: body matches "^\\{"
output: parser-docker
- expr: body matches "^[^ Z]+ "
output: parser-crio
- expr: body matches "^[^ Z]+Z"
output: parser-containerd
type: router
- id: parser-crio
regex: ^(?P<time>[^ Z]+) (?P<stream>stdout|stderr) (?P<logtag>[^ ]*) ?(?P<log>.*)$
timestamp:
layout: 2006-01-02T15:04:05.999999999Z07:00
layout_type: gotime
parse_from: attributes.time
type: regex_parser
- combine_field: attributes.log
combine_with: ""
id: crio-recombine
is_last_entry: attributes.logtag == 'F'
max_batch_size: 1000
max_log_size: 1048576
output: handle_empty_log
source_identifier: attributes["log.file.path"]
type: recombine
- id: parser-containerd
regex: ^(?P<time>[^ ^Z]+Z) (?P<stream>stdout|stderr) (?P<logtag>[^ ]*) ?(?P<log>.*)$
timestamp:
layout: '%Y-%m-%dT%H:%M:%S.%LZ'
parse_from: attributes.time
type: regex_parser
- combine_field: attributes.log
combine_with: ""
id: containerd-recombine
is_last_entry: attributes.logtag == 'F'
max_batch_size: 1000
max_log_size: 1048576
output: handle_empty_log
source_identifier: attributes["log.file.path"]
type: recombine
- id: parser-docker
timestamp:
layout: '%Y-%m-%dT%H:%M:%S.%LZ'
parse_from: attributes.time
type: json_parser
- combine_field: attributes.log
combine_with: ""
id: docker-recombine
is_last_entry: attributes.log endsWith "\n"
max_batch_size: 1000
max_log_size: 1048576
output: handle_empty_log
source_identifier: attributes["log.file.path"]
type: recombine
- field: attributes.log
id: handle_empty_log
if: attributes.log == nil
type: add
value: ""
- parse_from: attributes["log.file.path"]
regex: ^.*\/(?P<namespace>[^_]+)_(?P<pod_name>[^_]+)_(?P<uid>[a-f0-9\-]+)\/(?P<container_name>[^\._]+)\/(?P<restart_count>\d+)\.log$
type: regex_parser
- from: attributes.stream
to: attributes["log.iostream"]
type: move
- from: attributes.container_name
to: resource["k8s.container.name"]
type: move
- from: attributes.namespace
to: resource["k8s.namespace.name"]
type: move
- from: attributes.pod_name
to: resource["k8s.pod.name"]
type: move
- from: attributes.restart_count
to: resource["k8s.container.restart_count"]
type: move
- from: attributes.uid
to: resource["k8s.pod.uid"]
type: move
- default: clean-up-log-record
routes:
- expr: (resource["k8s.namespace.name"]) == "kube-system" && (resource["k8s.pod.name"])
matches "app-.*" && (resource["k8s.container.name"]) == "http"
output: kube-system_app-.*_http
- expr: (resource["k8s.namespace.name"]) == "default" && (resource["k8s.pod.name"])
matches "app-.*"
output: default_app-.*
- expr: (resource["k8s.namespace.name"]) == "test"
output: test
type: router
- combine_field: attributes.log
combine_with: ""
id: kube-system_app-.*_http
is_first_entry: (attributes.log) matches "^[^\\s].*"
max_batch_size: 1000
max_log_size: 1048576
max_unmatched_batch_size: 1
output: clean-up-log-record
source_identifier: attributes["log.file.path"]
type: recombine
- combine_field: attributes.log
combine_with: ""
id: default_app-.*
is_first_entry: (attributes.log) matches "^[^\\s].*"
max_batch_size: 1000
max_log_size: 1048576
max_unmatched_batch_size: 1
output: clean-up-log-record
source_identifier: attributes["log.file.path"]
type: recombine
- combine_field: attributes.log
combine_with: ""
id: test
is_first_entry: (attributes.log) matches "^[^\\s].*"
max_batch_size: 1000
max_log_size: 1048576
max_unmatched_batch_size: 1
output: clean-up-log-record
source_identifier: attributes["log.file.path"]
type: recombine
- from: attributes.log
id: clean-up-log-record
to: body
type: move
- drop_ratio: 1
expr: (attributes["log.file.path"] matches "/var/log/pods/default_example-opentelemetry-collector.*_.*/opentelemetry-collector/.*.log")
and ((body contains "logRecord") or (body contains "ResourceLog"))
type: filter
- combine_field: body
is_first_entry: body matches "^([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}|[0-9]{2}-[0-9]{2}
[0-9]{2}:[0-9]{2}:[0-9]{2})"
source_identifier: attributes["log.file.path"]
type: recombine
retry_on_failure:
enabled: true
start_at: beginning
jaeger:
protocols:
grpc:
endpoint: ${env:MY_POD_IP}:14250
thrift_binary:
endpoint: ${env:MY_POD_IP}:6832
thrift_compact:
endpoint: ${env:MY_POD_IP}:6831
thrift_http:
endpoint: ${env:MY_POD_IP}:14268
otlp:
protocols:
grpc:
endpoint: ${env:MY_POD_IP}:4317
max_recv_msg_size_mib: 20
http:
endpoint: ${env:MY_POD_IP}:4318
prometheus/k8s_extra_metrics:
config:
scrape_configs:
- bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
honor_timestamps: true
job_name: kubernetes-cadvisor
metrics_path: /metrics/cadvisor
scheme: https
static_configs:
- targets:
- ${env:K8S_NODE_IP}:10250
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
receiver_creator/mysql:
receivers:
mysql:
config:
collection_interval: 30s
metrics:
mysql.client.network.io:
enabled: true
mysql.commands:
enabled: true
mysql.connection.errors:
enabled: true
mysql.joins:
enabled: true
mysql.query.count:
enabled: true
mysql.query.slow.count:
enabled: true
mysql.sorts:
enabled: true
mysql.table_open_cache:
enabled: true
password: ${env:MYSQL_PASSWORD}
statement_events:
digest_text_limit: 120
limit: 250
time_limit: 24h
username: root
rule: type == "port" && port == 3306 && pod.labels["env"] == "test" && pod.labels["team"]
== "teamA"
watch_observers:
- k8s_observer
zipkin:
endpoint: ${env:MY_POD_IP}:9411
service:
extensions:
- health_check
- k8s_observer
pipelines:
logs:
exporters:
- debug
processors:
- memory_limiter
- resourcedetection/region
- resourcedetection/env
- k8sattributes
- transform/k8s_attributes
- batch
receivers:
- filelog
- otlp
metrics:
exporters:
- debug
processors:
- memory_limiter
- resourcedetection/region
- resourcedetection/env
- k8sattributes
- transform/k8s_attributes
- filter/k8s_extra_metrics
- transform/reduce
- batch
receivers:
- receiver_creator/mysql
- prometheus/k8s_extra_metrics
- spanmetrics
- spanmetrics/db
- otlp
traces:
exporters:
- debug
- spanmetrics
- forward/db
- forward/sampled
processors:
- memory_limiter
- transform/span_name
- resourcedetection/region
- resourcedetection/env
- k8sattributes
- transform/k8s_attributes
- transform/spanmetrics
- transform/test
- batch
receivers:
- jaeger
- zipkin
- otlp
traces/db:
exporters:
- spanmetrics/db
processors:
- filter/db_spanmetrics
- transform/db
- batch
receivers:
- forward/db
traces/sampled:
exporters:
- coralogix
processors:
- batch
- probabilistic_sampler
receivers:
- forward/sampled
telemetry:
logs:
encoding: json
resource:
k8s.daemonset.name: example-opentelemetry-collector
k8s.namespace.name: default
k8s.node.name: ${env:KUBE_NODE_NAME}
k8s.pod.name: ${env:KUBE_POD_NAME}
service.name: opentelemetry-collector