I have two stat panels (let’s call them panel A and B) and each stat has different Prometheus query.
now the entire goal of the graph I’m creating is to calculate and display the value of value(A)/value(B).
I’ve been banging my head against the wall for quite some time but haven’t found anything yet.
I know there are 3rd-party panels that I can use (like singlestat math or blendstat) but I don’t think I can use them. Here’s the reason , and bear with me please:)
There is a single prometheus metric (total size of a certain directory) , let’s call it my_metric
the Grafana dashboard has one constant variable : size_threshold
Panel A : ${size_threshold} - my_metric
Grafana’s calcuulation field is set to : Last (not null)
Panel B : my_metric / (({__to} - {__from}) / 86400000))
Grafana’s calculation field for the prometheus metric is set to : Difference
Note : (({__to} - {__from}) / 86400000)) basically converts the dashboard’s timerange to “# of days” . so the calculation for Panel B is “total growth / # of days”
So in other words, Panel A is “How many more bytes until it reaches the threshold” and Panel B is “average daily growth based on the dashboard’s timerange”.
Now by dividing these two values , I will be able to know how many more days I have until I reach the threshold.
As you can see, since the two panels are using different calculations on the prometheus metric(one is Last , the other one is Difference), I can’t find a way to put them in a single panel, or run any arithmetic functions on the two values