Transformations randomly don't work properly

Grafana 9.1.1
InfluxDB 1.8.3
Ubuntu 22.04

Hello,

I am using Stat Panel, with two queries, A and B.
In transformation tab I use “Binary operation” B / A.
Transformations are randomly not working, showing NaN as value, mostly when I select time period “Last X hours / Last X days”.

When this occurs, in debug window is visible that there is one empty value in values buffer which are used in Binary operation.

Instead of a Transformation, have you tried using an expression? (see example below)

I tried, and it works. But it does not work as transformations, if query returns results from multiple measurements.
In transformation, data from multiple measurements can be combined to one value, and than do the math.
Using expression, it will do math with on every A value and every B value.

A was able to reproduce this issue also on https://play.grafana.org/ in “InfluxDB Templated” dashboard, so I attach here panel JSON.
When I select “Last 15 minutes” panel returns “NaN” from B/A operation.
When I select “Yesterday” panel returns correct number value from B/A operation.

image

image

{ "id": 3, "gridPos": { "x": 0, "y": 0, "w": 24, "h": 5 }, "type": "stat", "title": "Panel Title", "targets": [ { "refId": "A", "datasource": { "type": "influxdb", "uid": "000000002" }, "policy": "default", "resultFormat": "time_series", "orderByTime": "ASC", "tags": [ { "key": "hostname", "value": "server1", "operator": "=" } ], "groupBy": [], "select": [ [ { "type": "field", "params": [ "value" ] }, { "type": "count", "params": [] } ] ], "measurement": "cpu", "alias": "A" }, { "refId": "B", "datasource": { "type": "influxdb", "uid": "000000002" }, "policy": "default", "resultFormat": "time_series", "orderByTime": "ASC", "tags": [ { "key": "hostname", "value": "server2", "operator": "=" } ], "groupBy": [], "select": [ [ { "type": "field", "params": [ "value" ] }, { "type": "count", "params": [] } ] ], "measurement": "cpu", "hide": false, "alias": "B" } ], "options": { "reduceOptions": { "values": false, "calcs": [ "lastNotNull" ], "fields": "" }, "orientation": "auto", "textMode": "auto", "colorMode": "value", "graphMode": "area", "justifyMode": "auto" }, "fieldConfig": { "defaults": { "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "value": null, "color": "green" }, { "value": 80, "color": "red" } ] }, "color": { "mode": "thresholds" }, "decimals": 2 }, "overrides": [] }, "datasource": { "uid": "000000002", "type": "influxdb" }, "pluginVersion": "9.1.3-e1f2f3c", "transformations": [ { "id": "calculateField", "options": { "mode": "binary", "reduce": { "reducer": "sum" }, "binary": { "operator": "/", "reducer": "sum", "left": "B", "right": "A" } } } ] }