module-ballerinax-prometheus
module-ballerinax-prometheus copied to clipboard
Grafana Dashboard metrics query issue
Description: Grafana dashboard queries use min_over_time, max_over_time to get the difference of a range vector to produce outputs such as req/min, errors/min. This breaks at the initial phase as the minimum and maximum of the initial query execution is the same.
But this issue resolves as the time flows because in the next 1 minute period there are min max values.
eg :
sum(max_over_time(requests_total_value{instance=~"$instance",protocol=~"$protocol",http_method=~"$http_method",http_url=~"$http_url",service=~"$service",resource=~"$resource",connector_name="http"}[1m])-min_over_time(requests_total_value{instance=~"$instance",protocol=~"$protocol",http_method=~"$http_method",http_url=~"$http_url",service=~"$service",resource=~"$resource",connector_name="http"}[1m]))
Sugeestions
Instead of using min,max of a range vector use the rate function to calculate the floor( sum(rate(requests_total_value{connector_name="http"}[1m])*60))