Ignores the "job_name" relabling setting

I will keep it simple: Why does it ignore the “Nodes” label, but it applies the “Routers” label for “job_name”? At least that is how I see it on Grafana.

1 │ // For a full configuration reference, see Grafana Alloy | Grafana Alloy documentation
2 │ logging {
3 │ level = “warn”
4 │ }
5 │
6 │ prometheus.exporter.unix “lapi” {}
7 │
8 │ prometheus.scrape “nodes” {
9 │ targets = prometheus.exporter.unix.lapi.targets
10 │ scrape_interval=“15s”
11 │ forward_to = [prometheus.remote_write.writer.receiver]
12 │ job_name = “Nodes”
13 │ }
14 │
15 │ prometheus.scrape “routers” {
16 │ targets = [{“_address_” = “192.168.8.1:9100”, “instance” = “Physical”}]
17 │ scrape_interval=“15s”
18 │ forward_to = [prometheus.remote_write.writer.receiver]
19 │ job_name = “Routers”
20 │ }
21 │
22 │
23 │ prometheus.remote_write “writer” {
24 │ endpoint {
25 │ url = “http://localhost:9090/api/v1/write
26 │ }
27 │ }

image

image

Thank you in advance.

Because job_name is an argument for the prometheus.scrape component that tells it what to set the job_name label to on all resulting metrics.

prometheus.exporter.* has no such corresponding argument.

To do this, you’ll need to adjust your pipeline by creating a prometheus.relabel component with a rule that replaces the job_name label with the new value and then fowards to your remote write component, and also set prometheus.exporter.unix to forward to the relabel component.

To me, the question remains unanswered. Why does it ignore the “Nodes” label, but it applies the “Routers” label for “job_name”?