kikinteractive/worldmap-panel

Name: worldmap-panel

Owner: Kik Interactive

Description: Worldmap panel plugin for Grafana 3.0 that can be overlaid with circles for data points.

Forked from: MobilityWare/worldmap-panel

Created: 2016-12-12 09:38:04.0

Updated: 2017-05-21 16:54:27.0

Pushed: 2016-12-12 15:43:40.0

Homepage: null

Size: 1546

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Worldmap Panel Plugin for Grafana

The Worldmap Panel is a tile map of the world that can be overlaid with circles representing data points from a query. It can be used with time series metrics, with geohash data from Elasticsearch or Table Data.

Worldmap

Time Series Data as the Data Source

Supported Databases:

Included location data:

This works by matching country codes (like US or GB or FR) or US state codes (TX or NY) to a node or a wildcard in a metric namespace. If there is a match in the list of countries or states then a circle will be drawn at the location.

If you want to match to other data than countries or states, then you will have to provide custom location data. The current way to do that is via a JSON endpoint that returns a json file with location data (See Map Data Options)

The size of the circle depends on the value of the matched metric. Circle size is relative e.g. if you have 3 countries with values 1, 2 and 3 or 100, 200 and 300 then you will get one small circle, one medium circle and one large circle.

Query Examples Graphite Query for Countries

Use the aliasByNode function to point to the field containing the country code. See the image below for an example of a graphite query.

Graphite Query for Countries

Influx Query for Countries

The Group By clause should be the country code and an alias is needed too. The alias should be in the form $tag_<field name>.

Influx Query for Countries

Prometheus Query for Countries or States

someMetricWithACountryIsoTag {
    ... insert your filters here ...
}
 (countryIso)

When you query Prometheus directly to test your query, the resulting data set should resemble: | Element | Value | | — | — | | {countryIso="US"} | 123456 | | {countryIso="CA"} | 987654 |

Map Data Options for Time Series Data

Under the Worldmap tab, choose either the countries or states option.

Worldmap Options for Countries

Using a JSON endpoint to return a custom list of locations:

Worldmap Options for JSON

The endpoint used here is for the demo version of worldPing - https://worldping-demo.raintank.io/api/plugin-proxy/raintank-worldping-app/api/v2/probes/locations

Using a JSONP endpoint (if you need to wrap the JSON to get around CORS problems):

Worldmap Options for JSONP

Geohashes as the Data Source

Supported Databases:

Query Configuration for Geohashes in ElasticSearch

The Geo-point data type with geohash indexing in Elasticsearch can also be used as a datasource for the worldmap panel. Grafana has a new bucket aggregate for Elasticsearch queries - Geo Hash Grid that allows grouping of coordinates. The Geo Hash Grid has a precision option where 1 is the highest level and 7 is the lowest.

Elasticsearch Query for Worldmap

Three fields need to be provided by the ElasticSearch query:

Elasticsearch Query for Worldmap

Query Configuration for Geohashes in Prometheus

someMetricWithAGeohashTag {
    ... insert your filters here ...
}
 (geohash)

When you query Prometheus directly to test your query, the resulting data set should resemble: | Element | Value | | — | — | | {geohash="9muqgny7v0dz"} | 123456 | | {geohash="dr5r8ptq9ucg"} | 987654 |

Table Data as the Data Source for Geohashes

Supported Databases:

An example of Table Data would using InfluxDB and then formatting the data returned from the metric query as Table.

Similar to the Elasticsearch query above, 3 fields are expected (2 of them are mandatory)

Example influxdb query

Map Visual Option Settings

Center

This settings configures the default center of the map. There are 5 centers to choose from or you can choose a custom center..For a custom center there are two fields: latitude and longitude. Examples of values are 37.09024, -95.712891 for the center of the US or 55.378051, -3.435973 for Great Britain.

Initial Zoom

The initial zoom factor for the map. This is a value between 1 and 18 where 1 is the most zoomed out.

Min Circle Size

This is minimum size for a circle in pixels.

Max Circle Size

This is the maximum size for a circle in pixels. Depending on the zoom level you might want a larger or smaller max circle size to avoid overlapping.

Unit

The Unit is shown in the popover when you hover over a circle. There are two fields the singular form and the plural form. E.g. visit/visits or error/errors

Show Legend

Shows/hide the legend on the bottom left that shows the threshold ranges and their associated colors.

Map Data Options

Location Data

There are four ways to provide data for the worldmap panel:

Aggregation

If you chose countries or table as the source of the location data then you can choose an aggregation here: avg, total etc.

ES Metric/Location Name/geo_point Field

Three fields need to be provided by the ElasticSearch query. They are text fields and should be the field names from the query under the Metrics tab.

Threshold Options

Thresholds control the color of the circles.

If one value is specified then two colors are used. For example, if the threshold is set to 10 then values under 10 get the first color and values that are 10 or more get the second color.

The threshold field also accepts 2 or more comma-separated values. For example, if you have 2 values that represents 3 ranges that correspond to the three colors. For example: if the thresholds are 70, 90 then the first color represents < 70, the second color represents between 70 and 90 and the third color represents > 90.

CHANGELOG

The latest changes can be found here: CHANGELOG.md


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.