forked from open-telemetry/opentelemetry-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-telemetry-data.yaml
More file actions
44 lines (44 loc) · 1.21 KB
/
check-telemetry-data.yaml
File metadata and controls
44 lines (44 loc) · 1.21 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
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: StepTemplate
metadata:
name: check-telemetry-data
spec:
try:
- command:
entrypoint: kubectl
env:
- name: LABEL_SELECTOR
value: ($LABEL_SELECTOR)
args:
- get
- pod
- -n
- ${NAMESPACE}
- -l
- ${LABEL_SELECTOR}
- -o
- jsonpath={.items[0].metadata.name}
outputs:
- name: podName
value: ($stdout)
- script:
env:
- name: podName
value: ($podName)
content: |
#!/bin/bash
# set -ex
kubectl get --raw /api/v1/namespaces/$NAMESPACE/pods/${podName}:8888/proxy/metrics
outputs:
- name: metrics
value: (x_metrics_decode($stdout))
check:
($error == null): true
- assert:
resource:
($metrics[?as_string(metric."__name__") == 'otelcol_exporter_sent_spans_total'].value | [0] > `1`): true
($metrics[?as_string(metric."__name__") == 'otelcol_receiver_accepted_spans_total'].value | [0] > `1`): true
catch:
- podLogs:
selector: $(LABEL_SELECTOR)
container: otc-container