7

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)

1 Answer 1

12

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]) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.