How percent_diff () query is working in grafana

Dear Team,

Could you please explain how this percent_diff() query is working in grafana panel alert.
What’s the exact formula behind this percent_diff () query.

I am planning to use below query on my Graph panel

WHEN percent_diff () OF query (A, 45m, now-15m) IS ABOVE 50.

Please suggest.

Dear Team,

I would appreciate your support on this issue.

Regards
Arjun

Dear Team,

Awaiting for your reply and support. Below are the two sample values of percentage difference. please let me know, how grafana is conevrting into the percentage difference value.

1:Array[59.165783884444444,1587963600000]

2:Array[111.8284890311111,1587964500000]

Regards
Arjun

Hi, I hope is not too late.

(newest - oldest) / math.Abs(oldest) * 100

For example:

[[1018.75,1609419028000],
[1171.25,1609419148000],
[1283.75,1609419268000]]

value =  (1283.75-1018.75)/1018.75 * 100 ==> 26.012269938650306

More information you can find in this code

1 Like

Thank You very much for your update & support.

Hi there,

is this somehow contained in the docs? Or is there a ticket which I could vote for to encourage a better documentation of this great feature? Digging into to the sources feels suboptimal ihmo.

Thanks & kind regards,
Holger