Explanation of Apdex calculation #2304
-
https://github.com/prometheus/docs/blob/main/content/docs/practices/histograms.md?plain=1#L93 The docs currently say:
This doesn't make sense - dividing by 2 has nothing to do with whether the histogram buckets are cumulative. Rather it looks like the 1/2 factor is meant as the weight of "tolerable" instances in the Apdex score. To correct for the fact that the le=1.2 bucket contains the le=0.3 bucket, you need to instead subtract the latter from the former. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Since this question has come up several times before, I'll try to give a comprehensive explanation here. The original formula for the Apdex score according to Wikipedia is:
As you can see, the translation of Now we can construct the full humungus Apdex query, in canonical formatting:
Of course, we can use normal algebraic operations to simplify the query. First we can push the
Now it's easy to dissolve the
Since
Now we can pull the
Multiplying by 0.5 is the same as dividing by 2, so we can also write:
Which is precisely the query from the docs, just with different indentation and line breaks. |
Beta Was this translation helpful? Give feedback.
-
Thanks! I am wondering if we should add this to the docs, or make a footnote. |
Beta Was this translation helpful? Give feedback.
Since this question has come up several times before, I'll try to give a comprehensive explanation here.
The original formula for the Apdex score according to Wikipedia is:
FrustratedCount
is multiplied away, so we don't need to query it in PromQL. Directly translating all the other components into PromQL yields the following, using the thresholds from the example (300ms target, 1.2s tolerated):SatisfiedCount
→sum(rate(http_request_duration_seconds_bucket{le="0.3"}[5m])) by (job)
ToleratingCount
→