grafana-toolbox / panodata-map-panel

Map Panel for Grafana with improved convenience, robustness and features. Friendly fork of the original Grafana Worldmap Panel. Currently not maintained, but verified to work up to Grafana 9.

Home Page:https://community.panodata.org/t/grafana-map-panel/121

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clickthrough URLs with $__field_ variables don't work with Elasticsearch data source

amotl opened this issue · comments

@vmanju123 reported at grafana#257:

I am using 0.9.0 map panel with Grafana 6.5.2.

I am trying to pass the URL as below

https://xyz.com/d/xyz-monitor/xyz-monitor?&from=${__from}&to=${__to}&var-Filter=clientGeo|=|${__field_clientGeo}&var-Filter=applicationDescription|=|${__field_applicationDescription}

In the above URL, clientGeo is the geo hashpoint and applicationDescription is another field. Both fields coming from elastic search query.

I can see __from and __to built in variables picking up the time fields form the main panel but clientGeo and applicationDescription are not resolving to values. Both clientGeo and applicationDescription fields are in the elastic query and returning data to main panel as I can see data on map panel, but not getting resolved to values in the click through URL.

Looking at he clickthrough URL information I saw that we need to prefix with $__field_ with each data field in URL, but it does not seem to be working or I am doing something wrong. Any help is appreciated.

thanks

@vmanju123 added a remark:

The same issue is being discussed within #12.

Dear @vmanju123,

thanks for writing in. Apparently, this feature is only implemented within setTableValues, so it will probably only work when using data in table format. Bummer.

https://github.com/panodata/grafana-map-panel/blob/315f889f49d0d9ecc7381cd4804dbc3a8261d6ea/src/data_formatter.ts#L352-L357

Am I correct to assume data from Elasticsearch is not using table format?

With kind regards,
Andreas.

P.S.: If only #56 would work for you. Then you could add this feature on your own behalf and send a pull request so that we could comfort @rsaifulin, @weedaj and @krzysion, who are probably observing the same issue (#12).

I can confirm now that it is indeed working for Table format, since i have time series data in es database

78882ec adds a test for checking "clickthroughUrl" interpolation when using table format.

I can confirm now that it is indeed working for Table format, since i have time series data in es database.

Does this mean you have been able to make it work by switching to "table format" while still using the same Elasticsearch data source as before?

Dear @vmanju123,

I haven't used the Elasticsearch location data source - as of "geohash: An ElasticSearch query that returns geohashes" - yet. Now, c800ca3 improves the test suite by adding tests for checking the corresponding code path through setGeohashValues().

On top of that, 99f1810 adds the __field_ interpolation feature, now also for the Elasticsearch data source.

Would that [also] improve your situation? As we are not using Grafana with Elasticsearch, I can't tell if this makes any sense and will be happy about any feedback from you. Please let me know when I should build a new release which includes these changes.

With kind regards,
Andreas.

cc @rsaifulin, @weedaj, @krzysion

as i mentioned i am using the _field variables in URL and its working fine for my elastic queries

vamnju123

Do you have online dashboard with an example? We at Safecast tried to use the $__field variables but that did not work. See attached screenshots.
Screenshot from 2020-07-20 10-37-07

Screenshot from 2020-07-20 10-37-25
Uploading Screenshot from 2020-07-20 10-39-28.png…

Any updates on the issue?

Any updates on the issue?

Dear Rob,

I believe it would work with data coming from InfluxDB in table format as outlined within #57 (comment) already. We are using InfluxDB, so this was obvious to have at the first place.

Apart from that, I've added support for data coming from Elasticsearch the other day, see #57 (comment).

Apparently, @vmanju123 confirmed it worked for them. However, I only see now that @matschaffer replied at 99f1810#commitcomment-40707078 and that he might also be struggling. Sorry to hear that.

Maybe you can share more details from the edit screen of your dashboard?

With kind regards,
Andreas.

Hi Rob,

See attached screenshot how we implemented the setup.

Can not see it.

Cheers,
Andreas.

Andreas,

Sorry. I replied in an email with attachments. Seems that did not wok for GitHub.
Uploaded them here just before.

Regards,
rob

Thanks Rob. Is $device_urn coming from a Grafana Variable or from the database? If it is coming from the database, you probably should use $__field_device_urn there within the Clickthrough URL.

Andreas,

We tried both with and without. Same results.
Any other idea how to fix it?

regards,
rob

Andreas,

If we click on the hovering point the page opens with the following URL: instead of supplying the data from the requested field. On the table is works fine.

regards,
rob

Sorry for that. Maybe this is coming from the specific style of data source you are using here. There are many intertwingulating things within the code base...

image

Hi Rob,

I just reviewed the changelog [1] and found

  • Interpolate datapoint field values with __field prefix into transformation data, now also for elasticsearch queries. (99f1810)

apparently not to be part of an official release yet. Are you running a custom build or did you just install 0.9.0? If so, that might be an easy explanation why that would not work for you, yet.

With kind regards,
Andreas.

[1] https://github.com/panodata/grafana-map-panel/blob/develop/CHANGELOG.md

Andreas,

We are running 0.9.0 as far as I know. I will check to be sure.
Sorry for my innocent, but how to run a custom build?

regards
Rob Oudendijk

OOPs. maybe not true.

We are running a script :/usr/sbin/grafana-cli --pluginUrl https://github.com/panodata/grafana-map-panel/archive/4f4765b68b2c02ca7de2b36dcc24349b5e10ef47.zip plugins install grafana-worldmap-panel-ng

not sure what version that is.

regards,
rob

Andreas,

Installed the latest development code from https://github.com/panodata/grafana-map-panel/archive/develop.zip and restarted the Grafana server. Results are still the same.

Any other suggestions?

BTW how to check what version of the plugin the browser is using?

regards,
rob

Dear Rob,

downloading the sources will definitively not work. You will have to build/compile them. If you dare to, you might find some pointers how to do that within [1].

Sorry that I am too busy right now to deliver that for you. Please let me know how that goes for you in general. On the other hand, I will try to come back to giving some love to that repository again. There are also some great contributions from @JonasProgrammer still lingering within pull requests.

With kind regards,
Andreas.

[1] https://github.com/panodata/grafana-map-panel/blob/develop/CONTRIBUTING.md

BTW how to check what version of the plugin the browser is using?

I don't know from the top of my head. Maybe that command will also display the plugin version(s)?

grafana-cli plugins ls

I did run the command

Excellent. Now we know how one would find out about that.

However, to run the most recent development build, you will have to follow the guidelines referenced at #57 (comment).

Also, you might want to uninstall the original grafana-worldmap-panel. While I can't remember this detail exactly, it could be that they get in the way of each other (shouldn't happen, but still worth a try).

You have a link?

Downloading the sources will definitively not work. You will have to build/compile them. If you dare to, you might find some pointers how to do that within [1].

[1] https://github.com/panodata/grafana-map-panel/blob/develop/CONTRIBUTING.md

hi @amotl - thanks for the help so far. I downloaded and built 3f77d55 and it's the same behavior (looks like maybe some CSS is a little off and src/data_formatter.test.ts throws prettier warnings). Here's what it looks like.

Screen Shot 2020-10-23 at 14 32 50

The clickthrough url is set to /d/DFSxrOLWk/safecast-device-details?orgId=1&from=now-2d&to=now&var-device_urn=$__field_device_urn

and if I click on a point I get http://grafana.127.0.0.1.nip.io:8000/d/DFSxrOLWk/safecast-device-details?orgId=1&from=now-2d&to=now&var-device_urn=$__field_device_urn&refresh=15m

Looks like the replacement just doesn't happen at all.

ah.... looks like I didn't have the docker set up quite right. I think that's probably 0.9.0 still

Got the build sorted and sure enough, click through works!

Any chance of getting a pre-release? I could set up a fork with a github action, but maybe good for other people to be able to use it too.

showing-clickthrough-working-on-es

Nice job!! . One more request. to get multiple values on the hover panel. That would be a big help for me and probably also other people.

Dear @robouden and @matschaffer,

thanks a bunch for all your involvement to check the current state of the repository and for making an interim release. Sorry for missing out to bring the required features to an official release.

Now, the official release 0.10.0 has been made, see https://github.com/panodata/grafana-map-panel/releases/tag/0.10.0.

With kind regards,
Andreas.

P.S.:

One more request. to get multiple values on the hover panel. That would be a big help for me and probably also other people.

Let's track this within another issue? Maybe #28 already reflects what you are asking for?

Andreas,

Yes, that is the same request as #28.

regards,
rob

Thanks! Closing this now.