Have a look at the "Status > Targets" menu of the prometheus web interface. 
It may tell you of scraping errors. For example, I think it's very likely 
with that renaming rule that you could end up with duplicate metrics after 
the renaming, and that will cause scrapes to fail (and therefore drop the 
metrics).

e.g.

metric_one{col="a"} 1
metric_two{col="a"} 2

would become:

a{col="a"} 1
a{col="a"} 2   << ERROR, duplicate metric

Otherwise, Googling suggests that it works for other people, 
e.g. https://alexandre-vazquez.com/prometheus-metrics-howto-change-name/. 
You'll need to give more info to reproduce the problem:
1. What version of prometheus are you using?
2. Show examples of the raw metrics that you are trying to modify

However, in any case I would strongly advise against having dynamic metric 
names. The metric name is the type of thing being measured, and the labels 
distinguish which instance of that thing. I think you should therefore also 
describe *why* you want to change the metric names - there is almost 
certainly a better way to achieve what you're trying to achieve.

On Sunday 13 October 2024 at 14:34:00 UTC+1 M shr wrote:

> i have the folling configuretion:
>   - job_name: "sql_exporter"
>     scrape_interval: 1m
>     metrics_path: /metrics
>     static_configs:
>       - targets: ["127.0.0.1:9237"]
>         labels:
>           instance: "sql_exporter"
>     metric_relabel_configs:
>       - action: replace
>         source_labels: [col]
>         target_label: __name__
>         replacement: "${1}"
>         separator: ""
> i want to change the "col" label to metric name . 
>
> it does not put "col" label  as the name of the metric and it willl 
> completely remove the metric. what is the issue here?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/09b85a02-707a-4dc8-9069-43df59de2db8n%40googlegroups.com.

Reply via email to