question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Worldmap panel not picking up custom jsonp endpoint

See original GitHub issue

Hi there,

I’ve been using Grafana 4.1 for a while, and recently came across a use case for the worldmap panel. Initially, I was able to use ES as a datasource and use a geohash; however, I now need to use InfluxDb and map my “apregion” tag to a custom json file. Below is an sanitised example of the file in terms of its structure:

[{
	"key": "ABC",
	"latitude": 38.858868066651645,
	"longitude": -106.60410427663172,
	"name": "ABC"
}, {
	"key": "XYZ",
	"latitude": 41.6908947939931,
	"longitude": -84.52139427176928,
	"name": "XYZ"
}, {
	"key": "RFC",
	"latitude": 38.67701147764007,
	"longitude": -77.10139768555358,
	"name": "RFC"
}]

I can’t share the exact file I’m using as its confidential, but the file successfully loads when I inspect the Sources tab in developer tools. Below is a screenshot of my configuration for the ‘Worldmap’ section (let’s call the file http://abc.com/file.json):

screen shot 2017-01-23 at 22 59 42

The documentation is not very clear in regards to using InfluxDb as a datasource with a custom json endpoint; from this point, I’m not entirely sure how to build my query. The measurement I am using is called ‘nb_transactions’, the field is ‘Success’, and the tag which maps to the custom json file endpoint is called “apregion”. Any advice as to how to build the query from here (sum of the “Success” field)?

screen shot 2017-01-24 at 11 49 50

Thanks for any help you can provide!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
danielleecommented, Jan 24, 2017

The documentation is not very clear about InfluxDb and a custom JSON endpoint because I’ve never tried it 😃 But it should work, it is almost the same as matching against the list of countries.

My first thought is that I don’t see the Jsonp callback in the file? You should wrap the json in the callback like this:

jsonp([{
	"key": "ABC",
	"latitude": 38.858868066651645,
	"longitude": -106.60410427663172,
	"name": "ABC"
}, {
	"key": "XYZ",
	"latitude": 41.6908947939931,
	"longitude": -84.52139427176928,
	"name": "XYZ"
}, {
	"key": "RFC",
	"latitude": 38.67701147764007,
	"longitude": -77.10139768555358,
	"name": "RFC"
}]);

The field that is used to match to the key in the json is the one specified in the Alias By field:

image

Also, are you getting any errors in the console in the Chrome/Firefox Developer Tools?

0reactions
danielleecommented, Apr 19, 2017

@sLuvpreet33 This JSON file is a list of locations. It is used when you have measurements that do not contain a latitude and longitude.

A key from the time series data (can be from InfluxDB or any other time series db) is matched against the JSON endpoint to get the coordinates for that key. For example, if you have a measurement in InfluxDB for NY (New York) then you can match this key against the JSON endpoint to get the longitude and latitude for New York to be able to draw it on the map.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Worldmap with custom JSON endpoint - Grafana Community
I am using the worldmap panel with an custom JSON endpoint and have that working fine under Grafana Version 5.
Read more >
Using JSON on Grafana's Worldmap Panel - Stack Overflow
I've tried inputting data by using a Zabbix data source and a JSON/JSONP endpoint under the panel's "Map Data Options".
Read more >
Custom-worldmap-panel NPM | npm.io
Check Custom-worldmap-panel 1.2.9 package - Last release 1.2.9 with MIT licence at our NPM ... Using a JSON endpoint to return a custom...
Read more >
Grafana Worldmap Panel | MetricFire Blog
Introduction. Grafana Worldmap is a free-of-cost panel used to display time-series metrics over a world map. Users can choose to visualize ...
Read more >
Worldmap Panel Plugin for Grafana - Corvus
The Worldmap Panel is a tile map of the world that can be overlaid with circles representing ... Using a JSON endpoint to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found