Skip to content

Grafana: Only permit numeric fields to be established on Graph panels - #126

Merged
amotl merged 1 commit into
mainfrom
fix-grafana-fields
Mar 2, 2023
Merged

Grafana: Only permit numeric fields to be established on Graph panels#126
amotl merged 1 commit into
mainfrom
fix-grafana-fields

Conversation

@amotl

@amotl amotl commented Mar 2, 2023

Copy link
Copy Markdown
Member

Hi again,

when testing GH-125 in production, we discovered at 1 that Grafana would croak on non-numeric fields being established on the Graph panel. They will make the panel croak like InfluxDB Error: unsupported mean iterator type: *query.stringInterruptIterator or InfluxDB Error: not executed 2.

image image

While the ecowitt2mqtt decoder strips all text fields like PASSKEY, stationtype, and model from the original data, it adds a few other text fields through its computed data:

{
  "batt1": "OFF",
  "wh65batt": "OFF",
  "wh25batt": "OFF",
  "frostrisk": "No risk",
  "humidex_perception": "Comfortable",
  "thermalperception": "Dry"
}

This patch fixes it, by skipping all non-numeric fields when provisioning the Grafana panel.

With kind regards,
Andreas.

Footnotes

  1. https://climart.hiveeyes.org/grafana/d/climart-testdrive/climart-testdrive

  2. Did anyone of you observe this flaw in the past already, @Tonkenfo, @wetterfrosch, or @ClemensGruber?

Other types will make the panel croak like `InfluxDB Error: unsupported
mean iterator type: *query.stringInterruptIterator` or `InfluxDB Error:
not executed`.
@amotl
amotl marked this pull request as ready for review March 2, 2023 00:25
@amotl
amotl merged commit fa580a6 into main Mar 2, 2023
@amotl
amotl deleted the fix-grafana-fields branch March 2, 2023 00:25
@amotl

amotl commented Mar 2, 2023

Copy link
Copy Markdown
Member Author

A corresponding test case for this issue is part of GH-125.

# Verify that text fields are not part of the graph. Otherwise, Grafana would croak like:
# - InfluxDB Error: unsupported mean iterator type: *query.stringInterruptIterator
# - InfluxDB Error: not executed
assert "batt1" not in fieldnames, "'batt1' should have been removed, because it is a text field"
assert "frostrisk" not in fieldnames, "'frostrisk' should have been removed, because it is a text field"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant