Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

Support Hierarchical and Array of Keys #312

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,47 @@
# Changelog
## Entries

## v1.1.1

- Allow the key to be an array in the location data. For example:
```json
[
{
"key": "US",
"latitude": 37.09024,
"longitude": -95.712891,
"name": "United States"
},
{
"key": [
"US.CA","US-CA","US_California"
],
"latitude": 36.17,
"longitude": -119.7462,
"name": "California"
},
{
"key": [
"US.IA","US-IA","US_Iowa"
],
"latitude": 42.0046,
"longitude": -93.214,
"name": "Iowa"
},
{
"key": "Unknown",
"latitude": 66,
"longitude": 66,
"name": "Unknown"
}
]
```
- Support hierarchical keys with segments delimited by '.-_'. The longest match at a segment boundary wins. For example, with the location data above, a key of "US.CA.PaloAlto" will be matching "US.CA". "US-Unknown" will match "US".
- If the location data has an entry with key="unknown", this entry will be returned for any un-matched input data.
- Added a built-in location data file "world_regions", with 2 letter country code and provinces in China and states in the US.
- Made circle area (instead of radius) to be linear in data value.
- Added 'kMGTP' unit to the data value

## v1.0.1

- Release for Grafana 7.0 with plugin signing
Expand Down
36 changes: 32 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ Time Series data contains a timestamp, a metric name and a numeric value. In oth
```json
[
{"target": "SE", "datapoints": [[183255.0, 1529755200]]},
{"target": "US", "datapoints": [[192224.0, 1529755200]]}
{"target": "US", "datapoints": [[192224.0, 1529755200]]},
{"target": "US.CA.PaloAlto", "datapoints": [[3922.0, 1529755200]]}
]
```

Expand All @@ -46,11 +47,37 @@ Location data should be in the JSON format and should be an array of JSON object
"latitude": 37.09024,
"longitude": -95.712891,
"name": "United States"
},
{
"key": [
"US.CA",
"US-CA",
"US_California"
],
"latitude": 36.17,
"longitude": -119.7462,
"name": "California"
},
{
"key": [
"US.IA",
"US-IA",
"US_Iowa"
],
"latitude": 42.0046,
"longitude": -93.214,
"name": "Iowa"
},
{
"key": "Unknown",
"latitude": 66,
"longitude": 66,
"name": "Unknown"
}
]
```

The Worldmap will then match the metric name (target in the example data) with a key field from the location data. With this example data there will be two circles drawn on the map, one for Sweden and one for the United States with values 183255 and 192224.
The Worldmap will then match the metric name (target in the example data) with a key field from the location data. With this example data there will be three circles drawn on the map, one for Sweden, one for the United States and one for California with values 183255, 192224 and 3922.

### Table Format

Expand Down Expand Up @@ -218,8 +245,9 @@ There are four ways to provide data for the worldmap panel:

- *countries*: This is a list of all the countries in the world. It works by matching a country code (US, FR, AU) to a node alias in a time series query.
- *states*: Similar to countries but for the states in USA e.g. CA for California
- *world_regions*: On top of countries, added states in USA and provinces in China with hierarchical keys e.g. US.CA for California, CN.GD for Guangdong.
- *geohash*: An ElasticSearch query that returns geohashes.
- *json*: A json endpoint that returns custom json. Examples of the format are the [countries data used in first option](https://github.com/grafana/worldmap-panel/blob/master/src/data/countries.json) or [this list of cities](https://github.com/grafana/worldmap-panel/blob/master/src/data/probes.json).
- *json*: A json endpoint that returns custom json. Examples of the format are the [countries data used in first option](https://github.com/mileweb/worldmap-panel/blob/master/src/data/countries.json) or [this list of world_regions](https://github.com/mileweb/worldmap-panel/blob/master/src/data/world_regions.json).
- *jsonp*: A jsonp endpoint that returns custom json wrapped as jsonp. Use this if you are having problems with CORS.
- *table*: This expects the metric query to return data points with a field named geohash or two fields/columns named `latitude` and `longitude`. This field should contain a string in the [geohash form](https://www.elastic.co/guide/en/elasticsearch/guide/current/geohashes.html). For example: London -> "gcpvh3zgu992".

Expand Down Expand Up @@ -279,4 +307,4 @@ The threshold field also accepts 2 or more comma-separated values. For example,

### CHANGELOG

The latest changes can be found here: [CHANGELOG.md](https://github.com/grafana/worldmap-panel/blob/master/CHANGELOG.md)
The latest changes can be found here: [CHANGELOG.md](https://github.com/mileweb/worldmap-panel/blob/master/CHANGELOG.md)
Loading