Hi,
I´m working with a SQL server, and I wanted to do some porcentages with the gauge tool. I did my querys to get 1 value per query, I reduced the query to an expression (max, mode strict) and I operated them with operation: math.
I´m new working with SQL and Grafana, and probably exists ways to improve my code.
Each gauge has 14 querys similar to:
declare @1d datetime
set @1d = DATEADD(day,-1, GETDATE())
SELECT TAG AS METRIC, TEP AS VALUE,
CAST (TMDT as datetime) as time
FROM DATOS
WHERE TAG = ‘XX’ and tmdt < @1d
ORDER BY time
and retorn values, 14 reduce expressions and 1 math expression. 5 gauges.
All those operations worked well for some minutes, but I´m having problems when I reduce some of this values, getting me NaN values. I´m not sure if it´s happen because of a bug (If i do 3-4 querys, reduces, etc, it works fine, but with all operations that i need the wrong values happen), or i´m overcharging the tool, or any other error you can see.
I have just 1 visual gauge per graphic, but I need to do some querys, reduces expressions and math expressions to get what I need. My skills on SQL are poor, because of that I do so many querys in Grafana.
Yes, my “XXX” refers to diferent Tags. I simply did “copy and paste” my query. Actually I do 2 differents querys for the same Tag, with different range of time, to compare their values.
I´ve done some changes in the operations, and I saw if I reduce a math expression it works better than reduce a query. I don´t know if the problem is for working reducing querys, or simply for so many expressions in the same gauge.