-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcollector-values.yaml
186 lines (183 loc) · 9.31 KB
/
collector-values.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
mode: deployment
image:
repository: ghcr.io/dynatrace/dynatrace-otel-collector/dynatrace-otel-collector
tag: latest
command:
name: dynatrace-otel-collector
extraEnvs:
- name: DT_API_TOKEN
valueFrom:
secretKeyRef:
name: dynatrace-otelcol-dt-api-credentials
key: DT_API_TOKEN
- name: DT_ENDPOINT
valueFrom:
secretKeyRef:
name: dynatrace-otelcol-dt-api-credentials
key: DT_ENDPOINT
resources:
limits:
memory: 512Mi
config:
receivers:
jaeger: null
prometheus: null
zipkin: null
otlp:
protocols:
grpc:
endpoint: ${env:MY_POD_IP}:4317
http:
endpoint: ${env:MY_POD_IP}:4318
filelog: null
processors:
cumulativetodelta:
k8sattributes:
extract:
metadata:
- k8s.pod.name
- k8s.pod.uid
- k8s.deployment.name
- k8s.statefulset.name
- k8s.daemonset.name
- k8s.cronjob.name
- k8s.namespace.name
- k8s.node.name
- k8s.cluster.uid
annotations:
- tag_name: $$1
key_regex: metadata.dynatrace.com/(.*)
from: pod
# Extracts the value of a pod annotation with key `ownedBy` and inserts it as a resource attribute with key `dt.owner`
# see otel-demo-values.yaml for where `ownedBy` is set as a custom annotation only on the `cartservice` pods
- tag_name: dt.owner
key: ownedBy
from: pod
# Extracts the value of a pod annotation with key `product` and inserts it as a resource attribute with key `dt.cost.product`
# see otel-demo-values.yaml for where `product` is set as a custom annotation only on the `cartservice` pods
- tag_name: dt.cost.product
key: product
from: pod
# Extracts the value of a pod annotation with key `costCentre` and inserts it as a resource attribute with key `dt.cost.costcenter`
# Notice the deliberate English / US spelling differences to emphasis that `costCentre` is a custom annotation
# set in otel-demo-values.yaml
- tag_name: dt.cost.costcenter
key: costCentre
from: pod
- tag_name: supportInfo
key: supportInfo
from: pod
- tag_name: deployment.release_product
key: product
from: pod
- tag_name: deployment.release_stage
key: environment
from: pod
# How to associate the data to a pod (order matters)
pod_association:
- sources:
- from: resource_attribute
name: k8s.pod.name
- from: resource_attribute
name: k8s.namespace.name
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: connection
transform:
error_mode: ignore
trace_statements:
- context: resource
statements: &k8s-statements
- set(attributes["k8s.workload.kind"], "job") where IsString(attributes["k8s.job.name"])
- set(attributes["k8s.workload.name"], attributes["k8s.job.name"]) where IsString(attributes["k8s.job.name"])
- set(attributes["k8s.workload.kind"], "cronjob") where IsString(attributes["k8s.cronjob.name"])
- set(attributes["k8s.workload.name"], attributes["k8s.cronjob.name"]) where IsString(attributes["k8s.cronjob.name"])
- set(attributes["k8s.workload.kind"], "daemonset") where IsString(attributes["k8s.daemonset.name"])
- set(attributes["k8s.workload.name"], attributes["k8s.daemonset.name"]) where IsString(attributes["k8s.daemonset.name"])
- set(attributes["k8s.workload.kind"], "statefulset") where IsString(attributes["k8s.statefulset.name"])
- set(attributes["k8s.workload.name"], attributes["k8s.statefulset.name"]) where IsString(attributes["k8s.statefulset.name"])
- set(attributes["k8s.workload.kind"], "replicaset") where IsString(attributes["k8s.replicaset.name"])
- set(attributes["k8s.workload.name"], attributes["k8s.replicaset.name"]) where IsString(attributes["k8s.replicaset.name"])
- set(attributes["k8s.workload.kind"], "deployment") where IsString(attributes["k8s.deployment.name"])
- set(attributes["k8s.workload.name"], attributes["k8s.deployment.name"]) where IsString(attributes["k8s.deployment.name"])
- delete_key(attributes, "k8s.deployment.name")
- delete_key(attributes, "k8s.replicaset.name")
- delete_key(attributes, "k8s.statefulset.name")
- delete_key(attributes, "k8s.daemonset.name")
- delete_key(attributes, "k8s.cronjob.name")
- delete_key(attributes, "k8s.job.name")
log_statements:
- context: resource
statements:
- set(attributes["dt.kubernetes.workload.kind"], "statefulset") where IsString(attributes["k8s.statefulset.name"])
- set(attributes["dt.kubernetes.workload.name"], attributes["k8s.statefulset.name"]) where IsString(attributes["k8s.statefulset.name"])
- set(attributes["dt.kubernetes.workload.kind"], "deployment") where IsString(attributes["k8s.deployment.name"])
- set(attributes["dt.kubernetes.workload.name"], attributes["k8s.deployment.name"]) where IsString(attributes["k8s.deployment.name"])
- set(attributes["dt.kubernetes.workload.kind"], "daemonset") where IsString(attributes["k8s.daemonset.name"])
- set(attributes["dt.kubernetes.workload.name"], attributes["k8s.daemonset.name"]) where IsString(attributes["k8s.daemonset.name"])
- set(attributes["dt.kubernetes.cluster.id"], attributes["k8s.cluster.uid"]) where IsString(attributes["k8s.cluster.uid"])
- context: log
# statements:
# - set(attributes["alertlevel"], "p4") where attributes["service.name"] == "cartservice"
statements:
# Use string "true" here
# not boolean as it is more flexible in the future
# Case insensitive match
# - set(attributes["alertme"], "true")
# where resource.attributes["service.name"] == "cartservice"
# and IsMatch(body, "(?i)getcartasync.*")
- set(attributes["k8s.workload.kind"], "job") where IsString(attributes["k8s.job.name"])
- set(attributes["k8s.workload.name"], attributes["k8s.job.name"]) where IsString(attributes["k8s.job.name"])
- set(attributes["k8s.workload.kind"], "cronjob") where IsString(attributes["k8s.cronjob.name"])
- set(attributes["k8s.workload.name"], attributes["k8s.cronjob.name"]) where IsString(attributes["k8s.cronjob.name"])
- set(attributes["k8s.workload.kind"], "daemonset") where IsString(attributes["k8s.daemonset.name"])
- set(attributes["k8s.workload.name"], attributes["k8s.daemonset.name"]) where IsString(attributes["k8s.daemonset.name"])
- set(attributes["k8s.workload.kind"], "statefulset") where IsString(attributes["k8s.statefulset.name"])
- set(attributes["k8s.workload.name"], attributes["k8s.statefulset.name"]) where IsString(attributes["k8s.statefulset.name"])
- set(attributes["k8s.workload.kind"], "replicaset") where IsString(attributes["k8s.replicaset.name"])
- set(attributes["k8s.workload.name"], attributes["k8s.replicaset.name"]) where IsString(attributes["k8s.replicaset.name"])
- set(attributes["k8s.workload.kind"], "deployment") where IsString(attributes["k8s.deployment.name"])
- set(attributes["k8s.workload.name"], attributes["k8s.deployment.name"]) where IsString(attributes["k8s.deployment.name"])
- delete_key(attributes, "k8s.deployment.name")
- delete_key(attributes, "k8s.replicaset.name")
- delete_key(attributes, "k8s.statefulset.name")
- delete_key(attributes, "k8s.daemonset.name")
- delete_key(attributes, "k8s.cronjob.name")
- delete_key(attributes, "k8s.job.name")
- set(attributes["alertmessage"], "Critical Redis connection error!")
where resource.attributes["service.name"] == "cartservice"
and resource.attributes["deployment.release_stage"] == "production"
and IsMatch(body, "(?i)wasn't able to connect to redis.*")
- set(attributes["priority"], "1")
where resource.attributes["service.name"] == "cartservice"
and resource.attributes["deployment.release_stage"] == "production"
and IsMatch(body, "(?i)wasn't able to connect to redis.*")
metric_statements:
- context: resource
statements: *k8s-statements
exporters:
debug:
verbosity: detailed
otlphttp:
endpoint: "${env:DT_ENDPOINT}"
headers:
Authorization: "Api-Token ${env:DT_API_TOKEN}"
service:
pipelines:
metrics:
receivers: [otlp]
processors: [k8sattributes, cumulativetodelta]
exporters: [debug, otlphttp]
traces:
receivers: [otlp]
processors: [k8sattributes, transform]
exporters: [debug, otlphttp]
logs:
receivers: [otlp]
processors: [k8sattributes, transform]
exporters: [debug, otlphttp]