grafana / worldmap-panel

Worldmap panel plugin for Grafana 3.0 that can be overlaid with circles for data points.
MIT License
306 stars 200 forks source link

Freeze when data is empty #291

Open Hualin-AUG opened 3 years ago

Hualin-AUG commented 3 years ago

My data source is InfluxDB and I am using InfluxQL to query the data into table. I find that when the query gets nothing in return, it will show a problem

TypeError: Cannot read property 'lat' of null

And then you are not able to drag the map and move around anymore.

amotl commented 3 years ago

Hi Hualin,

can you test with our fork [1] and report back to us whether this will work better? You can find setup instructions at [2].

With kind regards, Andreas.

[1] https://github.com/panodata/grafana-map-panel [2] https://community.panodata.org/t/grafana-map-panel/121#setup

Hualin-AUG commented 3 years ago

Hi Andreas,

No it does not work. It is even crashing the page. Actually I am using Grafana Cloud, the way you give me cannot be used on Grafana Cloud. So I try on my local server, but it does not work.

Regards,

Hualin

From: Andreas Motl Sent: Tuesday, January 19, 2021 9:42 AM To: grafana/worldmap-panel worldmap-panel@noreply.github.com Cc: Hualin-AUG hualin@augsignals.com; Author author@noreply.github.com Subject: Re: [grafana/worldmap-panel] Freeze when data is empty (#291)

Hi Hualin,

can you test with our fork [1] and report back to us whether this will work better? You can find setup instructions at [2].

With kind regards, Andreas.

[1] https://github.com/panodata/grafana-map-panel [2] https://community.panodata.org/t/grafana-map-panel/121#setup

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/grafana/worldmap-panel/issues/291#issuecomment-762884161 , or unsubscribe https://github.com/notifications/unsubscribe-auth/APPLHMLG4V54USXHQ5UPKUDS2WK3NANCNFSM4UVXDOIQ .

amotl commented 3 years ago

Hi Hualin,

thanks for your response. If you are able to create an issue over at [1] and share some more insights about your data, we might be able to look into what you are observing. A minimal reproducible example in order to load a subset of the data you are handling into InfluxDB would be tremendously helpful.

With kind regards, Andreas.

[1] https://github.com/panodata/grafana-map-panel

Hualin-AUG commented 3 years ago

Hi Andreas,

Here is error jumping out:

This is the influxDB data (in table format) I get:

Field mapping:

Map data options:

Panel JSON:

{

"circleMaxSize": "10",

"circleMinSize": "10",

"colors": [

"#73BF69",

"#5794F2",

"#FADE2A",

"#FF9830",

"#B877D9",

"#F2495C"

],

"datasource": "InfluxDB-Cloud-InfluxQL",

"esMetric": "Count",

"fieldConfig": {

"defaults": {

  "custom": {

    "align": null,

    "filterable": false

  },

  "mappings": [],

  "thresholds": {

    "mode": "absolute",

    "steps": [

      {

        "color": "green",

        "value": null

      },

      {

        "color": "red",

        "value": 80

      }

    ]

  }

},

"overrides": []

},

"gridPos": {

"h": 23,

"w": 12,

"x": 12,

"y": 0

},

"id": 4,

"initialZoom": "9",

"locationData": "table",

"mapCenter": "custom",

"mapCenterLatitude": "44",

"mapCenterLongitude": "-79",

"maxDataPoints": 1,

"mouseWheelZoom": true,

"pluginVersion": "7.2.2",

"showLegend": true,

"stickyLabels": true,

"tableQueryOptions": {

"geohashField": "geohash",

"labelField": "DeviceID",

"latitudeField": "Latitude",

"longitudeField": "Longitude",

"metricField": "AQI",

"queryType": "coordinates"

},

"targets": [

{

  "groupBy": [

    {

      "params": [

        "1h"

      ],

      "type": "time"

    },

    {

      "params": [

        "none"

      ],

      "type": "fill"

    }

  ],

  "measurement": "Test",

  "orderByTime": "ASC",

  "policy": "default",

  "query": "SELECT last(\"AQI\") AS \"AQI\",\"Latitude\",\"Longitude\" FROM \"Test\" WHERE (\"DeviceID\" = '****') AND $timeFilter GROUP BY \"DeviceID\"",

  "rawQuery": true,

  "refId": "A",

  "resultFormat": "table",

  "select": [

    [

      {

        "params": [

          "AQI"

        ],

        "type": "field"

      },

      {

        "params": [],

        "type": "mean"

      }

    ]

  ],

  "tags": [

    {

      "key": "DeviceID",

      "operator": "=",

      "value": "****"

    }

  ]

}

],

"thresholds": "100,200,300,400,500",

"title": "Panel Title",

"type": "grafana-worldmap-panel",

"valueName": "avg",

"decimals": 0,

"hideEmpty": false,

"hideZero": false,

"timeFrom": null,

"timeShift": null,

"unitPlural": "",

"unitSingle": ""

}

Panel Data:

{

"state": "Done",

"series": [

{

  "fields": [

    {

      "name": "Time",

      "config": {},

      "values": [

        1611346820000

      ],

      "type": "time",

      "state": {

        "displayName": "Time",

        "scopedVars": {

          "__series": {

            "text": "Series",

            "value": {

              "name": "Series (A)"

            }

          },

          "__field": {

            "text": "Field",

            "value": {}

          }

        },

        "seriesIndex": 0

      }

    },

    {

      "name": "DeviceID",

      "config": {},

      "values": [

        "AirSENCE-1120676240063"

      ],

      "type": "string",

      "state": {

        "displayName": "DeviceID",

        "scopedVars": {

          "__series": {

            "text": "Series",

            "value": {

              "name": "Series (A)"

            }

          },

          "__field": {

            "text": "Field",

            "value": {}

          }

        },

        "seriesIndex": 1

      }

    },

    {

      "name": "AQI",

      "config": {

        "min": 303,

        "max": 303

      },

      "values": [

        303

      ],

      "type": "number",

      "state": {

        "displayName": "AQI",

        "scopedVars": {

          "__series": {

            "text": "Series",

            "value": {

              "name": "Series (A)"

            }

          },

          "__field": {

            "text": "Field",

            "value": {}

          }

        },

        "calcs": {

          "sum": 303,

          "max": 303,

          "min": 303,

          "logmin": 303,

          "mean": 303,

          "last": 303,

          "first": 303,

          "lastNotNull": 303,

          "firstNotNull": 303,

          "count": 1,

          "nonNullCount": 1,

          "allIsNull": false,

          "allIsZero": false,

          "range": 0,

          "diff": 0,

          "delta": 0,

          "step": null,

          "previousDeltaUp": true

        },

        "seriesIndex": 2

      }

    },

    {

      "name": "Latitude",

      "config": {},

      "values": [

        null

      ],

      "type": "other",

      "state": {

        "displayName": "Latitude",

        "scopedVars": {

          "__series": {

            "text": "Series",

            "value": {

              "name": "Series (A)"

            }

          },

          "__field": {

            "text": "Field",

            "value": {}

          }

        },

        "seriesIndex": 3

      }

    },

    {

      "name": "Longitude",

      "config": {},

      "values": [

        null

      ],

      "type": "other",

      "state": {

        "displayName": "Longitude",

        "scopedVars": {

          "__series": {

            "text": "Series",

            "value": {

              "name": "Series (A)"

            }

          },

          "__field": {

            "text": "Field",

            "value": {}

          }

        },

        "seriesIndex": 4

      }

    }

  ],

  "refId": "A",

  "meta": {

    "executedQueryString": "SELECT last(\"AQI\") AS \"AQI\",\"Latitude\",\"Longitude\" FROM \"Test\" WHERE (\"DeviceID\" = '****') AND time >= now() - 6h GROUP BY \"DeviceID\""

  },

  "length": 1

}

],

"annotations": [],

"request": {

"app": "dashboard",

"requestId": "Q104",

"timezone": "browser",

"panelId": 4,

"dashboardId": 12,

"range": {

  "from": "2021-01-22T14:20:30.276Z",

  "to": "2021-01-22T20:20:30.276Z",

  "raw": {

    "from": "now-6h",

    "to": "now"

  }

},

"timeInfo": "",

"interval": "6h",

"intervalMs": 21600000,

"targets": [

  {

    "groupBy": [

      {

        "params": [

          "1h"

        ],

        "type": "time"

      },

      {

        "params": [

          "none"

        ],

        "type": "fill"

      }

    ],

    "measurement": "Test",

    "orderByTime": "ASC",

    "policy": "default",

    "query": "SELECT last(\"AQI\") AS \"AQI\",\"Latitude\",\"Longitude\" FROM \"Test\" WHERE (\"DeviceID\" = '****') AND $timeFilter GROUP BY \"DeviceID\"",

    "rawQuery": true,

    "refId": "A",

    "resultFormat": "table",

    "select": [

      [

        {

          "params": [

            "AQI"

          ],

          "type": "field"

        },

        {

          "params": [],

          "type": "mean"

        }

      ]

    ],

    "tags": [

      {

        "key": "DeviceID",

        "operator": "=",

        "value": "****"

      }

    ],

    "datasource": "InfluxDB-Cloud-InfluxQL"

  }

],

"maxDataPoints": 1,

"scopedVars": {

  "__interval": {

    "text": "6h",

    "value": "6h"

  },

  "__interval_ms": {

    "text": "21600000",

    "value": 21600000

  },

  "interval": {

    "text": "6h",

    "value": "6h"

  },

  "timeFilter": {

    "value": "time >= now() - 6h"

  }

},

"startTime": 1611346830277,

"rangeRaw": {

  "from": "now-6h",

  "to": "now"

},

"endTime": 1611346830635

},

"timeRange": {

"from": "2021-01-22T14:20:30.635Z",

"to": "2021-01-22T20:20:30.635Z",

"raw": {

  "from": "now-6h",

  "to": "now"

}

},

"timings": {

"dataProcessingTime": 1.280000084079802

}

}

DataFrame structure:

[

{

"refId": "A",

"meta": {

  "executedQueryString": "SELECT last(\"AQI\") AS \"AQI\",\"Latitude\",\"Longitude\" FROM \"Test\" WHERE (\"DeviceID\" = '****') AND time >= now() - 6h GROUP BY \"DeviceID\""

},

"length": 1,

"fields": [

  {

    "name": "Time",

    "config": {},

    "type": "time"

  },

  {

    "name": "DeviceID",

    "config": {},

    "type": "string"

  },

  {

    "name": "AQI",

    "config": {

      "min": 303,

      "max": 303

    },

    "type": "number"

  },

  {

    "name": "Latitude",

    "config": {},

    "type": "other"

  },

  {

    "name": "Longitude",

    "config": {},

    "type": "other"

  }

]

}

]

After I see this error, I can draw map once and it freezes.

Regards,

Hualin

From: Andreas Motl Sent: Thursday, January 21, 2021 10:34 AM To: grafana/worldmap-panel worldmap-panel@noreply.github.com Cc: Hualin-AUG hualin@augsignals.com; Author author@noreply.github.com Subject: Re: [grafana/worldmap-panel] Freeze when data is empty (#291)

Hi Hualin,

thanks for your response. If you are able to create an issue over at [1] and share some more insights about your data, we might be able to look into what you are observing. A minimal reproducible example in order to load a subset of the data you are handling into InfluxDB would be tremendously helpful.

With kind regards, Andreas.

[1] https://github.com/panodata/grafana-map-panel

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/grafana/worldmap-panel/issues/291#issuecomment-764725791 , or unsubscribe https://github.com/notifications/unsubscribe-auth/APPLHMJH2BJ4KUNRJKPPJR3S3BCN3ANCNFSM4UVXDOIQ . https://github.com/notifications/beacon/APPLHMPPBTZHHQ2S3UDNBOTS3BCN3A5CNFSM4UVXDOI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFWKMUHY.gif

amotl commented 3 years ago

Hi Hualin,

thanks for sharing your dashboard JSON. However, this is not a repro I can reuse easily, please also share some of your data. Therefore, I humbly ask you to

  1. Export a subset of your data into InfluxDB line protocol format, e.g. by using InfluxDB Fetcher [1,2].
  2. Export your dashboard JSON into a .json file.
  3. Upload both into a gist [3].
  4. Create an appropriate issue at our repository fork [4] referencing the gist created in step 3.

Thank you in advance.

With kind regards, Andreas.

[1] https://community.panodata.org/t/influxdb-fetcher-export-data-in-influxdb-line-protocol-format/188 [2] https://github.com/daq-tools/influxdb-fetcher/ [3] https://gist.github.com/ [4] https://github.com/panodata/grafana-map-panel

dineshgowdam commented 3 years ago

hi @Hualin-AUG, Actually, I'm facing the same issue right now. Did you solve that issue?