Prometheus Config for Otel-Collector not dropping labels as expected

51 Views Asked by At

I'm trying to drop some metrics and labels while configuring my otel-collector

metric_relabel_configs:
  - source_labels: [__name__]
    regex: "(http_request_queue_duration_seconds_bucket|http_request_sql_duration_seconds_bucket|http_request_redis_duration_seconds_bucket|sidekiq_job_duration_seconds_bucket|otelcol_processor_batch_batch_send_size_bytes_bucket|http_request_queue_duration_seconds_count|http_request_queue_duration_seconds_sum|http_request_sql_duration_seconds_count|http_request_sql_duration_seconds_sum|otelcol_processor_batch_batch_send_size_bucket)"
    action: drop

But for some reason only a few labels are being dropped - the ones I could confirm are gone are:

  • http_request_sql_duration_seconds_bucket
  • http_request_redis_duration_seconds_bucket
  • http_request_sql_duration_seconds_count
  • http_request_sql_duration_seconds_sum

What is wrong with my regex?

1

There are 1 best solutions below

0
angelov_georgi On

Apparently you should drop the () when writing regex for specific matches.