Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
410 views
in Technique[技术] by (71.8m points)

Unable to drop a metric in prometheus using regex in service monitor yaml on kubernetes

Team, I have metrics being pulled in prometheus successfully but i want to drop some and seems like am not able to understand how to match regex to drop a name metric. any hint? or is my syntax not right?

QUERY is below

{__name__="mslicer_read_latency_sum"}

on prometheus query result is below

mslicer_read_latency_sum{endpoint="admin",instance="11.1.1.1:8",job="tsts",namespace="tests",pod="tests",service="experiments"} 0

my servicemonitor is like this below to drop above but i see it is not getting dropped. so any hint if my regex is wrong?

  spec:
    endpoints:
    - interval: 30s
      metricRelabelings:
      - action: drop
        regex: mslicer_read_latency_sum
        sourceLabels:
        - __name__

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...