snowflake-grafana-datasource icon indicating copy to clipboard operation
snowflake-grafana-datasource copied to clipboard

Why does the query create a new series name for each combination of labels?

Open jschulte-maxmine opened this issue 8 months ago • 1 comments

Using this query in timeseries mode

    SELECT $__timeGroup(TIME,'2m') AS TIME, AVG(WIFI_RSSI) AS avg_wifi_rssi, name
    FROM table WHERE $__timeFilter(TIME)
    AND WIFI_RSSI <> -1
    GROUP BY TIME, name
    ORDER BY TIME

I get results which are avg_wifi_rssi_<name>_<name> whereas a native timeseries would have avg_wifi_rssi{name=<value>}

Image

Looking at the code here seems relevant, but I don't understand why this is being done?

jschulte-maxmine avatar Apr 04 '25 04:04 jschulte-maxmine

If the question is about the duplicate label in the column name, yes I agree, that should be fixed.

As for the rest — yes, the general behavior is expected. Since you’re grouping by both TIME and name, Grafana needs to create a distinct series per name to show their individual RSSI evolution over time. That’s exactly how time series mode is meant to work.

A native time series format (like from Prometheus or InfluxDB) returns series with labels (e.g., avg_wifi_rssi{name="device1"}), which Grafana handles more gracefully. But with SQL-based sources, Grafana builds those labels manually from the columns.

devnied avatar Apr 04 '25 09:04 devnied

Great, thanks for the quick response.

jschulte-maxmine avatar Apr 06 '25 22:04 jschulte-maxmine