Worldmap panel not picking up custom jsonp endpoint
See original GitHub issueHi 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):

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)?

Thanks for any help you can provide!
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
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:
The field that is used to match to the key in the json is the one specified in the
Alias By
field:Also, are you getting any errors in the console in the Chrome/Firefox Developer Tools?
@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.