knightss27 / grafana-network-weathermap

A fully featured and customizable network weathermap plugin for Grafana (9.0+).
https://grafana.com/grafana/plugins/knightss27-weathermap-panel/
Apache License 2.0
132 stars 6 forks source link

Map breaks when a query does not work #46

Closed ladvocat closed 1 year ago

ladvocat commented 1 year ago

Describe the problem When a router is down and the query fails to retrieve data, the map crashes. The issue #40 seems to address the same problem.

To Reproduce To replicate this behavior is as easy as to add a link connected to a "broken" query.

Expected behavior When a router or a link is unavailable, the map should remain functioning with the links with broken queries painted black.

Screenshots Screenshot from 2023-03-03 15-16-46 Screenshot from 2023-03-03 15-16-32

VERSIONS!

knightss27 commented 1 year ago

If this is easy to replicate for you, would you be able to send the DataFrame JSON for when this error occurs. At the top of the panel where you click to edit, you can instead click Inspect > Panel JSON and then at the top of the dropdown choose "Dataframe JSON" and just paste it here / attach it if it's too large.

ladvocat commented 1 year ago

Hi @knightss27 ,

See one part of this export. I think the problem is when Fields and Values are equal to Null.

[ { "schema": { "refId": "CMA1-MXDF2", "meta": { "executedQueryString": "from(bucket: \"telemetry\")\r\n |> range(start: 2023-03-15T23:40:17.012Z, stop: 2023-03-16T00:10:17.012Z)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"/interfaces/\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"/interfaces/interface/subinterfaces/subinterface/state/counters/out-octets\")\r\n |> filter(fn: (r) => r[\"device\"] == \"cma1\")\r\n |> filter(fn: (r) => r[\"interface_name\"] == \"et-0/1/9\")\r\n |> filter(fn: (r) => r[\"subinterface_index\"] == \"3002\")\r\n |> map(fn: (r) => ({r with _value: r._value * 8}))\r\n |> derivative(nonNegative: true, unit: 1s)\r\n |> set(key: \"_field\", value: \"cma1-mxdf2\")" }, "fields": [] }, "data": { "values": [] } },

ZacharyPuls commented 1 year ago

This issue appears to still be present in v0.3.6: DIA-Weathermap-Error.txt DIA-Weathermap.json.zip

Error output and dashboard json attached.

knightss27 commented 1 year ago

Are you able to replicate this easily? And if so write out how to do so?

ladvocat commented 1 year ago

Are you able to replicate this easily? And if so write out how to do so?

Just create a query with a non-existing interface to have a return equals to empty [].

knightss27 commented 1 year ago

Only with InfluxDB datasource? Or can you replicate it with a different datasource?

ladvocat commented 1 year ago

Only with InfluxDB datasource? Or can you replicate it with a different datasource?

I use only InfluxDB.

ladvocat commented 1 year ago

I just updated my plugin to version 0.4.2 and the issue is still occurring. The problem is that when a router goes down, due to a connectivity problem, the queries to my database (InfluxDB) get no data in response, and then crashes the plugin.

image

There should be a condition like that: if there is no data returned to a query, displays n/a in the link. This already happens when we hide a query.

image

knightss27 commented 1 year ago

I think I actually fixed it finally. Sneaky little error (actually tested it with an InfluxDB instance to find this). Will submit the next release to Grafana early this week.

knightss27 commented 1 year ago

@ladvocat Have you had the time to update? Does this appear fixed to you?

ladvocat commented 1 year ago

@knightss27 Awesome! It worked! Thanks a lot!