0

I'm using prometheus and grafana. I wanted to change the metric based on the Source as a variable. so If the source is source1 then I want the first metric else the second metric

src1_request1_counter1{job='$job', instance=~"localhost:8080"} 

src2_request2_counter2{job='$job', instance=~"localhost:9090"}  

Thanks In Advance Rake

Rrrrr
  • 136
  • 1
  • 7

1 Answers1

1

so I figured out two ways to do it ,I am a Posting it as it might help others 1)Use an Or Condition in the query

rate(src1_request1_counter1{job="$application", 
instance="$instance"}[1m]) or 
rate(src2_request2_counter2{job="$application", 
instance="$instance"}[1m])

2) Use Variables Ref:- Dynamically change the metric name in prometheus in grafana dashboard

FYI , I used the first option as it was simpler in my case

Rrrrr
  • 136
  • 1
  • 7