influxdata/telegraf

Support pod name as additional tag in Prometheus input plugin

Open

#16192 opened on Nov 14, 2024

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Go (9,892 stars) (4,161 forks)batch import
feature requesthelp wantedsize/s

Description

Use Case

We deploy telegraf to scrape istio metrics in the prometheus format and forward them to our internal metric system. The Istio metrics come from multiple istio ingressgateway pods but Istio metrics do not have any existing tag to indicate which source pod they come from. In this case, our internal metric system would automatically aggregate metrics from different pods in a weird way so that the metric become basically unavailable.

I am aware that the Prometheus input plugin supports pod annotation and pod label as extra tag, but not pod name, which seems as useful as labels/annotations to me. Therefore I would like to suggest adding a configuration that injects pod name as an extra metric tag for the prometheus input plugin.

Expected behavior

Have a configuration for the prometheus input plugin called something like pod_name_tag, which takes a boolean value and defaults to false. If it is enabled, pod name is injected to all metrics collected by the prometheus input plugin, for example, source_pod_name: istio-ingressgateway-ase33.

Actual behavior

Pod name cannot be configured to be an extra tag on metrics collected by the prometheus plugin.

Additional info

I am glad to contribute if the community finds this feature request useful and would like to move forward with it. Thanks!

Contributor guide