yes you were right the problem was because not all metrics has the "col" 
label so those label didn't have any name and the whole scrape got lost 
with error  missing metric name (__name__ label)

it got fix now 
thanks
On Monday, October 14, 2024 at 1:39:53 PM UTC+3:30 Brian Candler wrote:

> 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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/44322037-068e-473a-9c05-95da96365ccfn%40googlegroups.com.

Reply via email to