grafana / alloy

OpenTelemetry Collector distribution with programmable pipelines
https://grafana.com/oss/alloy
Apache License 2.0
968 stars 103 forks source link

[prometheus.operator.probes] add namespace label #1049

Open ToonTijtgat2 opened 1 week ago

ToonTijtgat2 commented 1 week ago

What's wrong?

When using the prometheus probe scraper, the namespace label is added to the scraped metrics. When using the alloy component named prometheus.operator.probes to scrape probes, this label is not accessible. In the debug/info the namespace is listed, so the data is there but not added as a label in the metrics.

I tried to add a rule to add the label.

rule {
          source_labels = ["__meta_kubernetes_namespace"]
          target_label = "namespace"
        }

But without any succes.

could it be possible to add the label via relabeling or via code to the metrics?

Steps to reproduce

Add a probe in kuberentes and use the alloy component to scrape the probe. look for the namespace label.

System information

Kubernetes

Software version

Alloy v1.1.1

Configuration

No response

Logs

No response