Skip to content

Commit 6ad0589

Browse files
authored
[processor/k8sattributes] Add resource_attributes to metadata.yaml (open-telemetry#23213)
This PR adds the resource attributes added by the k8sattributes processor to the metadata.yaml file in the resource_attributes group. Only the attributes which are added by default (see [documentation](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/v0.79.0/processor/k8sattributesprocessor#configuration)) are marked as enabled. The default resource attributes defined in metadata.yaml are used to make the default extract::metadata list. Resource attributes are exposed through a different configuration interface. This is noted in the metadata.yaml file.
1 parent a4585ce commit 6ad0589

File tree

7 files changed

+459
-12
lines changed

7 files changed

+459
-12
lines changed

processor/k8sattributesprocessor/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sat
33
go 1.19
44

55
require (
6+
github.com/google/go-cmp v0.5.9
67
github.com/google/uuid v1.3.0
78
github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.79.0
89
github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8stest v0.0.0-unpublished
@@ -46,7 +47,6 @@ require (
4647
github.com/golang/protobuf v1.5.3 // indirect
4748
github.com/golang/snappy v0.0.4 // indirect
4849
github.com/google/gnostic v0.5.7-v3refs // indirect
49-
github.com/google/go-cmp v0.5.9 // indirect
5050
github.com/google/gofuzz v1.2.0 // indirect
5151
github.com/imdario/mergo v0.3.13 // indirect
5252
github.com/josharian/intern v1.0.0 // indirect

processor/k8sattributesprocessor/internal/metadata/generated_config.go

+101
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

processor/k8sattributesprocessor/internal/metadata/generated_config_test.go

+94
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
default:
2+
all_set:
3+
resource_attributes:
4+
container.id:
5+
enabled: true
6+
container.image.name:
7+
enabled: true
8+
container.image.tag:
9+
enabled: true
10+
k8s.container.name:
11+
enabled: true
12+
k8s.cronjob.name:
13+
enabled: true
14+
k8s.daemonset.name:
15+
enabled: true
16+
k8s.daemonset.uid:
17+
enabled: true
18+
k8s.deployment.name:
19+
enabled: true
20+
k8s.deployment.uid:
21+
enabled: true
22+
k8s.job.name:
23+
enabled: true
24+
k8s.job.uid:
25+
enabled: true
26+
k8s.namespace.name:
27+
enabled: true
28+
k8s.node.name:
29+
enabled: true
30+
k8s.pod.hostname:
31+
enabled: true
32+
k8s.pod.name:
33+
enabled: true
34+
k8s.pod.start_time:
35+
enabled: true
36+
k8s.pod.uid:
37+
enabled: true
38+
k8s.replicaset.name:
39+
enabled: true
40+
k8s.replicaset.uid:
41+
enabled: true
42+
k8s.statefulset.name:
43+
enabled: true
44+
k8s.statefulset.uid:
45+
enabled: true
46+
none_set:
47+
resource_attributes:
48+
container.id:
49+
enabled: false
50+
container.image.name:
51+
enabled: false
52+
container.image.tag:
53+
enabled: false
54+
k8s.container.name:
55+
enabled: false
56+
k8s.cronjob.name:
57+
enabled: false
58+
k8s.daemonset.name:
59+
enabled: false
60+
k8s.daemonset.uid:
61+
enabled: false
62+
k8s.deployment.name:
63+
enabled: false
64+
k8s.deployment.uid:
65+
enabled: false
66+
k8s.job.name:
67+
enabled: false
68+
k8s.job.uid:
69+
enabled: false
70+
k8s.namespace.name:
71+
enabled: false
72+
k8s.node.name:
73+
enabled: false
74+
k8s.pod.hostname:
75+
enabled: false
76+
k8s.pod.name:
77+
enabled: false
78+
k8s.pod.start_time:
79+
enabled: false
80+
k8s.pod.uid:
81+
enabled: false
82+
k8s.replicaset.name:
83+
enabled: false
84+
k8s.replicaset.uid:
85+
enabled: false
86+
k8s.statefulset.name:
87+
enabled: false
88+
k8s.statefulset.uid:
89+
enabled: false

processor/k8sattributesprocessor/metadata.yaml

+87
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,90 @@ status:
55
stability:
66
beta: [logs, metrics, traces]
77
distributions: [contrib, splunk, observiq, sumo]
8+
9+
# resource attributes are exposed through a different configuration interface (extract::metadata).
10+
resource_attributes:
11+
k8s.namespace.name:
12+
description: The name of the namespace that the pod is running in.
13+
type: string
14+
enabled: true
15+
k8s.pod.name:
16+
description: The name of the Pod.
17+
type: string
18+
enabled: true
19+
k8s.pod.uid:
20+
description: The UID of the Pod.
21+
type: string
22+
enabled: true
23+
k8s.pod.hostname:
24+
description: The hostname of the Pod.
25+
type: string
26+
enabled: false
27+
k8s.pod.start_time:
28+
description: The start time of the Pod.
29+
type: string
30+
enabled: true
31+
k8s.deployment.name:
32+
description: The name of the Deployment.
33+
type: string
34+
enabled: true
35+
k8s.deployment.uid:
36+
description: The UID of the Deployment.
37+
type: string
38+
enabled: false
39+
k8s.replicaset.name:
40+
description: The name of the ReplicaSet.
41+
type: string
42+
enabled: false
43+
k8s.replicaset.uid:
44+
description: The UID of the ReplicaSet.
45+
type: string
46+
enabled: false
47+
k8s.daemonset.name:
48+
description: The name of the DaemonSet.
49+
type: string
50+
enabled: false
51+
k8s.daemonset.uid:
52+
description: The UID of the DaemonSet.
53+
type: string
54+
enabled: false
55+
k8s.statefulset.name:
56+
description: The name of the StatefulSet.
57+
type: string
58+
enabled: false
59+
k8s.statefulset.uid:
60+
description: The UID of the StatefulSet.
61+
type: string
62+
enabled: false
63+
k8s.container.name:
64+
description: The name of the Container in a Pod template. Requires container.id.
65+
type: string
66+
enabled: false
67+
k8s.job.name:
68+
description: The name of the Job.
69+
type: string
70+
enabled: false
71+
k8s.job.uid:
72+
description: The UID of the Job.
73+
type: string
74+
enabled: false
75+
k8s.cronjob.name:
76+
description: The name of the CronJob.
77+
type: string
78+
enabled: false
79+
k8s.node.name:
80+
description: The name of the Node.
81+
type: string
82+
enabled: true
83+
container.id:
84+
description: Container ID. Usually a UUID, as for example used to identify Docker containers. The UUID might be abbreviated. Requires k8s.container.restart_count.
85+
type: string
86+
enabled: false
87+
container.image.name:
88+
description: Name of the image the container was built on. Requires container.id or k8s.container.name.
89+
type: string
90+
enabled: true
91+
container.image.tag:
92+
description: Container image tag. Requires container.id or k8s.container.name.
93+
type: string
94+
enabled: true

0 commit comments

Comments
 (0)