Summary: This post explains how to compute a rate (per second, per minute, etc.) within a DQL timeseries query. It includes example syntax and considerations for correct rate calculation.
data record(timestamp = now(), duration = 60000, event = "A"),
record(timestamp = now()-10m, duration = 30000, event = "B"),
record(timestamp = now()-20m, duration = 30000, event = "C"),
record(timestamp = now()-30m, duration = 45000, event = "A"),
record(timestamp = now()-40m, duration = 15000, event = "B"),
record(timestamp = now()-50m, duration = 10000, event = "C")
| summarize by: { event }, { Duration = toLong(sum(toDouble(duration)/1000)) }
| summarize Aduration = toLong(sum(if(event == "A", Duration, else:0))),
Bduration = toLong(sum(if(event == "B", Duration, else:0))),
Cduration = toLong(sum(if(event == "C", Duration, else:0)))
| fieldsAdd Brate = toDouble(Bduration) / Aduration * 100, Crate = toDouble(Cduration) / Bduration * 100
How can I get the Rate displayed on line chart via makeTimeseries, interval: 10m?

