I am generating a Histogram using a prometheus client. The metric name is retrieve_stripe_subscription_latency_ms. Since Histogram generates additional metrics with suffixes _sum and _count, can I calculate the average using the below query in Grafana?
sum(retrieve_stripe_subscription_latency_ms_sum)/sum(retrieve_stripe_subscription_latency_ms_count)
I think official Prometheus documentation address this. Having your metric name:
To calculate the average [...put here a metric meaning...] during the last 5 minutes from a histogram or summary called
retrieve_stripe_subscription_latency_ms, use the following expression:rate(retrieve_stripe_subscription_latency_ms_sum[5m]) / rate(retrieve_stripe_subscription_latency_ms_count[5m])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With