alexandrainst / alexandra-trackmap-panel

Grafana map plugin to visualise coordinates as markers, hexbin, ant path, or heatmap.
MIT License
78 stars 26 forks source link

Add Grafana 7 compatibility #18

Closed Alkarex closed 3 years ago

Alkarex commented 4 years ago

At the moment, it does not look like this plugin works with Grafana 7

More precisely, might be related to Removes variableSrv https://github.com/grafana/grafana/pull/24779

When coming to this plug-in, it looks like it is failing at compile time https://github.com/grafana/grafana/blob/43033ddf7471bb005a8d24f4fda137441043cd2c/public/app/features/plugins/plugin_component.ts#L223

In the Web page:

An unexpected error happened: TypeError: this.events is undefined

image

In the browser console:

Plugin component error Error: [$injector:unpr] Unknown provider: variableSrvProvider <- variableSrv
http://errors.angularjs.org/1.6.9/$injector/unpr?p0=variableSrvProvider%20%3C-%20variableSrv
    Angular 11
        i
        injector
        a
        u
        a
        s
        invoke
        get
        it
        ct
        ut
    f plugin_component.ts:219
    f plugin_component.ts:254
    link plugin_component.ts:262
plugin_component.ts:265:18
shreyasisinha commented 4 years ago

I am still facing the same issue. Has this been resolved yet?

Alkarex commented 4 years ago

There is some work in progress. Hopefully by next week.

shreyasisinha commented 3 years ago

I am still facing the same issue. Has this been resolved yet?

What is the expected date of getting this issue fixed?

Alkarex commented 3 years ago

We have a new version about to be released. However, this new version will most likely drop support for Grafana 6 and older...

Alkarex commented 3 years ago

@shreyasisinha Would you be able to test this release candidate? https://github.com/alexandrainst/alexandra-trackmap-panel/pull/24

alchuk commented 3 years ago

@Alkarex I would like to test your RC against Grafana 7.2.0. How do I do it?

Alkarex commented 3 years ago

@alchuk You can for instance download the RC from https://github.com/alexandrainst/alexandra-trackmap-panel/archive/%2318_add_grafana_7_compatibility.zip and use it to replace the old version (after doing a backup). See https://grafana.com/docs/grafana/latest/plugins/installation/

Alkarex commented 3 years ago

@alchuk We might have found an issue. Another of my colleagues is testing at the moment

alchuk commented 3 years ago

@Alkarex At least it stopped from crashing right after changing the visualisation type to TrackMap. I need to tune my backend as I have never used your plugin before. Will get back right away.

j-or commented 3 years ago

@alchuk You can put the entire plugin in the grafana/data/plugins folder and run yarn install and yarn dev (see readme) - or if it's easier, just place the dist folder in grafana/data/plugins without any need for yarn. That should work too. Note: I just updated the RC branch. install_track_map

alchuk commented 3 years ago

It doesn't seem to work for me. I'm using InfluxDB as a backend. The following query gives 't is null' under the red error triangle: SELECT median("lat") AS latitude, median("long") AS longitude FROM "Latlong" WHERE ("DID" = '117593705') AND time >= now() - 24h GROUP BY time(5m) fill(null) The query itself gives a decent looking array of data. Is Influx supported by your product?

j-or commented 3 years ago

It doesn't seem to work for me. I'm using InfluxDB as a backend. The following query gives 't is null' under the red error triangle: SELECT median("lat") AS latitude, median("long") AS longitude FROM "Latlong" WHERE ("DID" = '117593705') AND time >= now() - 24h GROUP BY time(5m) fill(null) The query itself gives a decent looking array of data. Is Influx supported by your product?

Is the query in Grafana formatted as "Table"?

alchuk commented 3 years ago

Is the query in Grafana formatted as "Table"?

Yes

ZhongyuWang commented 3 years ago

It doesn't seem to work for me. I'm using InfluxDB as a backend. The following query gives 't is null' under the red error triangle: SELECT median("lat") AS latitude, median("long") AS longitude FROM "Latlong" WHERE ("DID" = '117593705') AND time >= now() - 24h GROUP BY time(5m) fill(null) The query itself gives a decent looking array of data. Is Influx supported by your product?

I have tried with Influx with no problem. Could you please try fill(0) instead?

alchuk commented 3 years ago

I have tried with Influx with no problem. Could you please try fill(0) instead?

Yeah. Thanks. Finally it helped me to get it working. Seems to be a bug. By the way, "fill(none)" is what I've chosen to use as Influx always returns empty values for the first array entry no matter how deep I look back in time. As for fill(0), it gives a wrong starting point for the track (zero lat/zero lon).

Now there's another problem: What could be wrong with Hexbin if it throws an exception "L.HexbinLayer is not a constructor"

grootwitbaas commented 3 years ago

testing this seems there is some offset on the long Map below is centred near the location. on error i see some small red triangle with some message, and to clear this i have to deselect tracmap in visulaisation and reselect it. small extract from data in table:

Time | lat | lon
-- | -- | --
26/09/2020 12:06 | 4.113.506 | 953.636
26/09/2020 12:11 | 4.113.505 | 953.636
26/09/2020 12:16 | 4.113.506 | 953.636
26/09/2020 12:21 | 4.113.506 | 953.636
26/09/2020 12:26 | 4.113.506 | 953.636
26/09/2020 12:31 | 4.113.506 | 953.638
26/09/2020 12:36 | 4.113.505 | 953.637

image Greetings from Germany Groot

grootwitbaas commented 3 years ago

Sorry correcting the mallformated table `

Time lat lon
26/09/2020 12:06 41.135 9.536
26/09/2020 12:11 41.135 9.536
26/09/2020 12:16 41.135 9.536
26/09/2020 12:21 41.135 9.536
26/09/2020 12:26 41.135 9.536
26/09/2020 12:31 41.135 9.536
26/09/2020 12:36 41.135 9.536
26/09/2020 12:41 41.135 9.536
26/09/2020 12:46 41.135 9.536

`

ZhongyuWang commented 3 years ago

testing this seems there is some offset on the long Map below is centred near the location. on error i see some small red triangle with some message, and to clear this i have to deselect tracmap in visulaisation and reselect it. small extract from data in table:

Time | lat | lon
-- | -- | --
26/09/2020 12:06 | 4.113.506 | 953.636
26/09/2020 12:11 | 4.113.505 | 953.636
26/09/2020 12:16 | 4.113.506 | 953.636
26/09/2020 12:21 | 4.113.506 | 953.636
26/09/2020 12:26 | 4.113.506 | 953.636
26/09/2020 12:31 | 4.113.506 | 953.638
26/09/2020 12:36 | 4.113.505 | 953.637

image Greetings from Germany Groot

Could you please confirm whether the center position is wrong. I check with Google Maps and it seems to be the same place as the center in your image.

Capture
grootwitbaas commented 3 years ago

yes this is the problem the cntre of map is where the location should be ploted, but it is far to the left like you can see. google maps shows corectly. I set the centre of map so as to see where it should plot.

j-or commented 3 years ago

@grootwitbaas Have you tried switching visualisation type to Markers and clicking on a marker? That way, you can see what coordinates the data points are given on the map.

grootwitbaas commented 3 years ago

so seems my b point is not taken, it shows 0 my 2 queries: A: SELECT mean("value") AS "lat" FROM "GPS" WHERE ("metric" = 'Lat' AND "name" =~ /^somename$/) AND time >= now() - 2d GROUP BY time(5m) fill(none). B: SELECT mean("value") AS "lon" FROM "GPS" WHERE ("metric" = 'Long' AND "name" =~ /^somename$/) AND time >= now() - 2d GROUP BY time(5m) fill(none)

response:Object results:Array[2] 0:Object statement_id:0 series:Array[1] 0:Object name:"iDirect GPS" columns:Array[2] 0:"time" 1:"lat" values:Array[12] 0:Array[1601396240000,42.09065] 1:Array[1601396540000,42.09068] 2:Array[1601396840000,42.09066] 3:Array[1601397140000,42.09069] 4:Array[1601397440000,42.09068] 5:Array[1601397740000,42.09066] 6:Array[1601398040000,42.09072] 7:Array[1601398340000,42.09065] 8:Array[1601398640000,42.09069] 9:Array[1601398940000,42.09063] 10:Array[1601399240000,42.09064] 11:Array[1601399540000,42.09066] 1:Object statement_id:1 series:Array[1] 0:Object name:"iDirect GPS" columns:Array[2] 0:"time" 1:"lon" values:Array[12] 0:Array[1601396240000,11.78947] 1:Array[1601396540000,11.78948] 2:Array[1601396840000,11.78948] 3:Array[1601397140000,11.78947] 4:Array[1601397440000,11.78946] 5:Array[1601397740000,11.78948] 6:Array[1601398040000,11.78946] 7:Array[1601398340000,11.78948] 8:Array[1601398640000,11.78946] 9:Array[1601398940000,11.78948] 10:Array[1601399240000,11.78948] 11:Array[1601399540000,11.78948]

raul-parada commented 3 years ago

I still get the error An unexpected error happened TypeError: this.events is undefined I've installed the plugin through terminal

Alkarex commented 3 years ago

@raul-parada Which exact version have you installed?