Drop metrics on prometheus

Hi there,

I want to drop some metrics on prometheus, I have one nodejs application that export some unusually metrics:

cpf_tuya_connector:inbound_mqtt_request_duration_seconds_bucket{le=“0.5”,namespace=“tuya”,topicType=“event”,status="{“code”:-40,“data”:“Not Found, Device(s) not found, details: Error in response, third part msg: device not exist”}"} 3
cpf_tuya_connector:inbound_mqtt_request_duration_seconds_bucket{le=“1”,namespace=“tuya”,topicType=“event”,status=****"{“code”:-40,“data”:“Not Found, Device(s) not found, details: Error in response, third part msg: device not exist”}"} 3
cpf_tuya_connector:inbound_mqtt_request_duration_seconds_bucket{le=“2”,namespace=“tuya”,topicType=“event”,status="{“code”:-40,“data”:“Not Found, Device(s) not found, details: Error in response, third part msg: device not exist”}"} 3
cpf_tuya_connector:inbound_mqtt_request_duration_seconds_bucket{le=“4”,namespace=“tuya”,topicType=“event”,status="{“code”:-40,“data”:“Not Found, Device(s) not found, details: Error in response, third part msg: device not exist”}"} 3
cpf_tuya_connector:inbound_mqtt_request_duration_seconds_bucket{le=“8”,namespace=“tuya”,topicType=“event”,status="{“code”:-40,“data”:“Not Found, Device(s) not found, details: Error in response, third part msg: device not exist”}"} 3

I’ve tried with the bellow config, but not working:

metric_relabel_configs:
 - action: labeldrop
   regex: status
 - action: drop
   source_labels: [topicType]
   regex: event

When you say “not working” what are you seeing?

Doesn’t drop the metrics with values: topicType = event and the value status ="".

here is the fix:

            - source_labels: [__name__]
              regex: cpf_tuya_connector:inbound_mqtt_request_duration_seconds_bucket
              action: drop