This repository was archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.yaml
More file actions
52 lines (49 loc) · 1.56 KB
/
config.yaml
File metadata and controls
52 lines (49 loc) · 1.56 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
input:
schedule:
input:
kubernetes_resources:
resource:
version: v1
name: pods
namespaces:
- ${SCRAPE_NAMESPACE:default}
interval: "${SCRAPE_INTERVAL:15s}"
pipeline:
processors:
- mapping: |
root = {
"id": uuid_v4(),
"specversion": "1.0",
"type": "kube-pod-exec-time",
"source": "kubernetes-api",
"time": meta("schedule_time"),
"subject": this.metadata.annotations."openmeter.io/subject".or(this.metadata.name),
"data": this.metadata.annotations.filter(item -> item.key.has_prefix("data.openmeter.io/")).map_each_key(key -> key.trim_prefix("data.openmeter.io/")).assign({
"pod_name": this.metadata.name,
"pod_namespace": this.metadata.namespace,
"duration_seconds": (meta("schedule_interval").parse_duration() / 1000 / 1000 / 1000).round().int64(),
}),
}
- json_schema:
schema_path: "file://./cloudevents.spec.json"
- catch:
- log:
level: ERROR
message: "Schema validation failed due to: ${!error()}"
- mapping: "root = deleted()"
output:
switch:
cases:
- check: ""
continue: true
output:
openmeter:
url: "${OPENMETER_URL:https://openmeter.cloud}"
token: "${OPENMETER_TOKEN:}"
batching:
count: ${BATCH_SIZE:20}
period: ${BATCH_PERIOD:}
- check: '"${DEBUG:false}" == "true"'
output:
stdout:
codec: lines