Hello,
I’m using Prometheus as a data source, and I have a query to display the maximum latency within a given time interval. The query works well for intervals less than 24 hours, but when I use a 24-hour or longer interval, the gauge keeps increasing.
Here’s the query I’m using:
PromQL code
max_over_time(chronos_histogram_latency_seconds{from="kafka_phlegethon", env="prod", NAME="SG", quantile="0.99"}[15m])
After checking the network response, I realized that the response is divided into multiple frames, and as a result, I’m getting multiple gauge values.
How can I consolidate all these values into one and find the maximum latency for longer intervals?
Sharing example, I tried to replicate to Grafana
Interesting, if you are getting multiple frames, It’s because response has different labels, I’d suggest switching to time series panel to see what are the different labels and update query accordingly.
You won’t be able to see all labels for both frames in stat panel.
Yes, I saw after the instance restart name was changed and came multiple labels.
Thank you @tanmaybhat24
1 Like
@tanmaybhat24 The below query combined the result based on the instance name and showed one value. However not clear how to make it dynamic.
How does Grafana send interval to Prometheus?
max_over_time(max by (pod_name) (chronos_histogram_latency_seconds{from="kafka_phlegethon", NAME ="LD11X",env="uat", quantile="0.99"})[24h:15m])
Not sure what you mean by dynamic. If you’d like to set the value to be the same as the range you query in grafana, you can use $__range
Ref : Prometheus template variables | Grafana documentation
1 Like