I believe it’s influxql.
The Issue is quite independent of the actual querie(s) and should be reproducable with any kind of query.
But i’ll try to provide some more “real-world-issue-insights”:
To stick with the initial sample data (but it affects all transformations), we have 7 queries like this:
Nothing crazy, just the fetch of a single measurement from it’s autogen table, filling nulls with it’s previous value.
These 7 queries namely are
- acpvoutl1_query
- acpvoutl2_query
- acpvoutl3_query
- acpvinl1_query
- acpvinl2_query
- acpvinl3_query
- dcpv_query
and represent the Solar-Power available on two different AC-connection points (or DC directly)
Thus, to get the total amount of solar, we just use a reduce row as follows:
Now, if we want to do some maths with that value, for example do SolarOverhead = Solar - consumption
, the transformation for that would target the joined query of the calculation, which is a wild concatenation of all the queries involved:
This is working - but what is happening now is:
When swithching to another $siteid
that returns NO DATA
for one of the queries, things start to fail. Here is an example of a site only using DC-PV.
Two things are happening:
1.) First, the queries returning NO DATA are silently dropped from the Solar-Transformation, but that one still returns the result of only DC PV series.
2.) The very long join-query is silently dropped from the Overhead-Transformation - and that one then fails to compute at all:
Looking at the filter-proposals for the Overhead transformation NOW unveils, that the Solar query is no longer referenceable by it’s long joined-name, it just keeps the name dcpv_query
as that is the only series having data for the Reduction.
In a case, where there would be two inputs available, it will be shorted from joinByField-q1-q2-q3-q4-q5-q6-q7
to joinByField-q3-q7
which also causes the long reference to be invalid and subsequent transformations to fail.
Example for a site delivering 4/7 inputs:
Here the “name of the solar transformation” is only made out of 4 joined queries, hence the reference to the name with 7 queries also becomes invalid:
For the time beeing I now have found a (dirty) workaround:
- We are doing 3 calculations using
Solar
- So, I’ve now created 3 * 7 queries and don’t reuse the computation Result of
Solar
, but rather
do all 3 mathematical transformations from the (independent) vanilla-queries.
This way, the final name of each transformation “doesn’t matter”, because it is not re-used, but ofc. is not ideal, neither for design-time, nor for performance and resource handling.
Probably a solution (Grafana side) would be to allow to specify a more compact-name for a transformation result - which then doesn’t change, based on the available input-queries.
If I for example could specify that the solar-transformation should always be called joinByFields-SolarResult
I could keep referencing that in subsequent transformations, no matter if it is made out of 1 or 7 queries delivering data.
Or, beeing able to do Alias:Solar
instead of Query:joinByField...
to define the reference.