Skip to content

Commit

Permalink
[processor/k8sattributes] Add resource_attributes to metadata.yaml (o…
Browse files Browse the repository at this point in the history
…pen-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.
  • Loading branch information
mackjmr authored and Caleb-Hurshman committed Jul 6, 2023
1 parent 330e109 commit 1aed350
Show file tree
Hide file tree
Showing 7 changed files with 459 additions and 12 deletions.
2 changes: 1 addition & 1 deletion processor/k8sattributesprocessor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sat
go 1.19

require (
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.3.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.79.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8stest v0.0.0-unpublished
Expand Down Expand Up @@ -46,7 +47,6 @@ require (
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand Down
101 changes: 101 additions & 0 deletions processor/k8sattributesprocessor/internal/metadata/generated_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
default:
all_set:
resource_attributes:
container.id:
enabled: true
container.image.name:
enabled: true
container.image.tag:
enabled: true
k8s.container.name:
enabled: true
k8s.cronjob.name:
enabled: true
k8s.daemonset.name:
enabled: true
k8s.daemonset.uid:
enabled: true
k8s.deployment.name:
enabled: true
k8s.deployment.uid:
enabled: true
k8s.job.name:
enabled: true
k8s.job.uid:
enabled: true
k8s.namespace.name:
enabled: true
k8s.node.name:
enabled: true
k8s.pod.hostname:
enabled: true
k8s.pod.name:
enabled: true
k8s.pod.start_time:
enabled: true
k8s.pod.uid:
enabled: true
k8s.replicaset.name:
enabled: true
k8s.replicaset.uid:
enabled: true
k8s.statefulset.name:
enabled: true
k8s.statefulset.uid:
enabled: true
none_set:
resource_attributes:
container.id:
enabled: false
container.image.name:
enabled: false
container.image.tag:
enabled: false
k8s.container.name:
enabled: false
k8s.cronjob.name:
enabled: false
k8s.daemonset.name:
enabled: false
k8s.daemonset.uid:
enabled: false
k8s.deployment.name:
enabled: false
k8s.deployment.uid:
enabled: false
k8s.job.name:
enabled: false
k8s.job.uid:
enabled: false
k8s.namespace.name:
enabled: false
k8s.node.name:
enabled: false
k8s.pod.hostname:
enabled: false
k8s.pod.name:
enabled: false
k8s.pod.start_time:
enabled: false
k8s.pod.uid:
enabled: false
k8s.replicaset.name:
enabled: false
k8s.replicaset.uid:
enabled: false
k8s.statefulset.name:
enabled: false
k8s.statefulset.uid:
enabled: false
87 changes: 87 additions & 0 deletions processor/k8sattributesprocessor/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,90 @@ status:
stability:
beta: [logs, metrics, traces]
distributions: [contrib, splunk, observiq, sumo]

# resource attributes are exposed through a different configuration interface (extract::metadata).
resource_attributes:
k8s.namespace.name:
description: The name of the namespace that the pod is running in.
type: string
enabled: true
k8s.pod.name:
description: The name of the Pod.
type: string
enabled: true
k8s.pod.uid:
description: The UID of the Pod.
type: string
enabled: true
k8s.pod.hostname:
description: The hostname of the Pod.
type: string
enabled: false
k8s.pod.start_time:
description: The start time of the Pod.
type: string
enabled: true
k8s.deployment.name:
description: The name of the Deployment.
type: string
enabled: true
k8s.deployment.uid:
description: The UID of the Deployment.
type: string
enabled: false
k8s.replicaset.name:
description: The name of the ReplicaSet.
type: string
enabled: false
k8s.replicaset.uid:
description: The UID of the ReplicaSet.
type: string
enabled: false
k8s.daemonset.name:
description: The name of the DaemonSet.
type: string
enabled: false
k8s.daemonset.uid:
description: The UID of the DaemonSet.
type: string
enabled: false
k8s.statefulset.name:
description: The name of the StatefulSet.
type: string
enabled: false
k8s.statefulset.uid:
description: The UID of the StatefulSet.
type: string
enabled: false
k8s.container.name:
description: The name of the Container in a Pod template. Requires container.id.
type: string
enabled: false
k8s.job.name:
description: The name of the Job.
type: string
enabled: false
k8s.job.uid:
description: The UID of the Job.
type: string
enabled: false
k8s.cronjob.name:
description: The name of the CronJob.
type: string
enabled: false
k8s.node.name:
description: The name of the Node.
type: string
enabled: true
container.id:
description: Container ID. Usually a UUID, as for example used to identify Docker containers. The UUID might be abbreviated. Requires k8s.container.restart_count.
type: string
enabled: false
container.image.name:
description: Name of the image the container was built on. Requires container.id or k8s.container.name.
type: string
enabled: true
container.image.tag:
description: Container image tag. Requires container.id or k8s.container.name.
type: string
enabled: true
Loading

0 comments on commit 1aed350

Please sign in to comment.