Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Mar 2, 2023

Conversation

amotl
Copy link
Member

@amotl amotl commented Mar 2, 2023

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
Copy link
Member Author

amotl commented Mar 2, 2023

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