Description
We want to align the service_name
logic of the K8s Monitoring Helm Chart Pod Logs feature on OpenTelemetry resource attributes specs on Kubernetes.
For this, we need to retrieve the deployment/cronjob/job
of the pods through the "controller-by" attribute.
If the OpenTelemetry Collector K8s Processor is capable of retrieving these metadata, it's not clear if Alloy's discovery.relabel
can also do it.
- https://github.com/grafana/k8s-monitoring-helm/blob/v2.0.28/charts/k8s-monitoring/charts/feature-pod-logs/templates/_common_pod_discovery.alloy.tpl
- The source code of the logic to etrive pod metadata seems to be https://github.com/prometheus/prometheus/blob/main/discovery/kubernetes/pod.go
OpenTelemetry logc logic for service.name
Choose the first value found:
pod.annotation[resource.opentelemetry.io/service.name]
pod.label[app.kubernetes.io/instance]
(well-known label app.kubernetes.io/instance)pod.label[app.kubernetes.io/name]
(well-known label app.kubernetes.io/name)k8s.deployment.name
k8s.replicaset.name
k8s.statefulset.name
k8s.daemonset.name
k8s.cronjob.name
k8s.job.name
k8s.pod.name
k8s.container.name
See also
Metadata
Metadata
Assignees
Labels
No labels