knightss27/grafana-network-weathermap

Map breaks when a query does not work

ladvocat opened this issue · 11 comments

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! **

  • Browser chrome and firefox
  • Grafana Version 9.3.1
  • Plugin Version 0.3.5
  • Influxdb v2

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.

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": []
}
},

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.

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

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 [].

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

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

I use only InfluxDB.

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

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.

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

@knightss27 Awesome! It worked! Thanks a lot!