Removal of "id"

85 views
Skip to first unread message

Senthil

unread,
Jun 23, 2022, 12:07:17 PM6/23/22
to Prometheus Users
We noticed that Prometheus is taking huge memory and slow. So by referring to the internet [https://www.robustperception.io/dropping-metrics-at-scrape-time-with-prometheus/] we removed the "id" using the below lines. 

    metric_relabel_configs:
    - source_labels: ['id']
      regex: '.*'
      action: drop

But that removed all columns, how we can remove only the Id? 

Thanks

Julien Pivotto

unread,
Jun 23, 2022, 12:11:44 PM6/23/22
to Senthil, Prometheus Users
Please try

- regex: 'id'
action: labeldrop


but make sure the metrics stays unique after removing the label.


Regards,

>
> --
> 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-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/38da0cf5-bb4c-488e-ab6b-08fdca0af0a4n%40googlegroups.com.


--
Julien Pivotto
@roidelapluie

Senthil

unread,
Jun 23, 2022, 12:13:48 PM6/23/22
to Prometheus Users
So like this?

    metric_relabel_configs:
    - source_labels: ['id']
      regex: 'id'
      action: labeldrop

Julien Pivotto

unread,
Jun 23, 2022, 12:18:44 PM6/23/22
to Senthil, Prometheus Users
On 23 Jun 09:13, Senthil wrote:
> So like this?
>
> metric_relabel_configs:
> - source_labels: ['id']
> regex: 'id'
> action: labeldrop


Source labels is not used with labeldrop.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/8024bcff-3538-4cbf-aa43-177a981d145an%40googlegroups.com.


--
Julien Pivotto
@roidelapluie

Senthil

unread,
Jun 23, 2022, 12:50:23 PM6/23/22
to Prometheus Users
So, what will be the correct syntax? How to drop "id" alone? any document link to refer. 


    metric_relabel_configs:
    - source_labels: ['id']
      regex: 'id'
      action: labeldrop

or
    metric_relabel_configs:
    - regex: 'id'
      action: labeldrop

Brian Candler

unread,
Jun 24, 2022, 3:16:08 AM6/24/22
to Prometheus Users
> So, what will be the correct syntax? How to drop "id" alone? any document link to refer.

The correct syntax is exactly what Julien posted before, under the heading "Please try".  This will drop the "id" label only.


<relabel_action> determines the relabeling action to take:

    ...
  • labeldrop: Match regex against all label names. Any label that matches will be removed from the set of labels.
Reply all
Reply to author
Forward
0 new messages