dist-avg
Input Stack:
|
⇨ | Output Stack:
|
Compute the average recorded value for timers and distribution summaries. This is calculated by dividing the total amount recorded by the number of recorded values.
For [Timer] and Distribution Summary metrics, the totalTime
(timers) /totalAmount
(distributions)
and count
are collected each time a measurement is taken. If this technique was applied to a
request latency metric, then you would have the average latency per request for an arbitrary
grouping. These types of metrics have an explicit count based on activity. To get an average
per measurement manually:
statistic,totalTime,:eq, :sum, statistic,count,:eq, :sum, :div
This expression can be bound to a query using the :cq (common query) operator:
statistic,totalTime,:eq, :sum, statistic,count,:eq, :sum, :div, nf.cluster,foo,:eq, name,http.req.latency,:eq, :and, :cq
Using the :dist-avg
function reduces the query to:
nf.cluster,foo,:eq, name,http.req.latency,:eq, :and, :dist-avg
To compute the average by group, apply the group after the :dist-avg
function:
nf.cluster,foo,:eq, name,http.req.latency,:eq, :and, :dist-avg, (,nf.asg,),:by
Before | After |
name,playback.startLatency,:eq | name,playback.startLatency,:eq, :dist-avg |