Stage 6 · Operate
OpenTelemetry Pipelines
Telemetry Enrichment
Adding Kubernetes metadata, cloud resource attributes, environment labels, and deployment versions.
Why Enrich Telemetry?
Raw telemetry from applications often lacks infrastructure context. Adding Kubernetes pod names, namespace labels, cloud region, and environment information makes telemetry queryable and correlatable across services and infrastructure.
Kubernetes Metadata
The k8sattributes processor in the OTel Collector enriches telemetry with Kubernetes metadata. It queries the API server for pod, node, namespace, and deployment information based on pod UID or IP address.
processors:
k8sattributes:
extract:
metadata:
- k8s.namespace.name
- k8s.deployment.name
- k8s.replicaset.name
- k8s.pod.name
- k8s.node.name
- k8s.pod.uid
pod_association:
- sources:
- from: resource_attribute
name: k8s.pod.ip
auth_type: serviceAccountCloud Resource Attributes
Add cloud provider attributes to identify which region, account, and instance produced the telemetry. This is critical for multi-region deployments where you need to distinguish between regions.
processors:
resource:
attributes:
- key: cloud.provider
value: aws
action: upsert
- key: cloud.region
value: us-east-1
action: upsert
- key: cloud.account.id
value: "123456789012"
action: upsert
- key: host.name
value: "${HOSTNAME}"
action: upsertEnvironment Labels
The deployment environment is one of the most useful attributes. It lets you filter dashboards and alerts by environment. Always add environment, team, and service version to every telemetry signal.
processors:
resource:
attributes:
- key: deployment.environment
value: production
action: upsert
- key: service.version
value: "2.3.1"
action: upsert
- key: service.team
value: platform
action: upsertCollector Enrichment Processors
| Processor | Purpose | Source |
|---|---|---|
| k8sattributes | Kubernetes metadata | K8s API |
| resource | Static attributes | Config file |
| resourcedetection | Auto-detect env | System/cloud |
| attributes | Transform attributes | Span data |
processors:
resourcedetection:
detectors: [env, system, docker]
timeout: 5s
override: falseAdding Kubernetes and cloud metadata in the Collector keeps application code clean. The application only sets service-level attributes. Infrastructure context is added by the Collector based on where the application runs.
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.