• Stars
    star
    306
  • Rank 136,456 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

Build Status

Note: Support for this repository has ended and it will be archived. Please see Geomap Panel for ongoing development and support.

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 data in the Table format.

Worldmap

How The Worldmap Works (Theory and Examples)

The Worldmap panel needs two sources of data:

  • a location (latitude and longitude)
  • data that has a link to a location

The data comes from a database query: Prometheus, InfluxDB, Graphite, Elasticsearch, MySQL etc. It can be in the Time Series format or in the Table format.

Time Series Format

If it is in the Time Series format then the metric name needs to match a key from a list of locations. That key is usually a country code or city name. The list of locations can come from a file or an HTTP endpoint.

The list of locations can be provided in several ways:

  • json files with locations and their coordinates (the plugin includes list for countries and US states)
  • json endpoints that return a list of locations and their coordinates

Time Series data contains a timestamp, a metric name and a numeric value. In other words, a typical query for a time series database. Here is some time series data from Graphite:

[
  {"target": "SE", "datapoints": [[183255.0, 1529755200]]},
  {"target": "US", "datapoints": [[192224.0, 1529755200]]}
]

Location data should be in the JSON format and should be an array of JSON objects with four properties:

[
  {
    "key": "SE",
    "latitude": 60.128161,
    "longitude": 18.643501,
    "name": "Sweden"
  },
  {
    "key": "US",
    "latitude": 37.09024,
    "longitude": -95.712891,
    "name": "United States"
  }
]

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.

Table Format

If the data is in the Table format then it should have a column that is a geohash or two columns that contain the latitude and longitude (together with the columns for the data).

Table data is tabular data with columns and rows. Here is an example of Table data from InfluxDB:

"series": [
  {
    "name": "logins.count",
    "tags": {
      "geohash": "9wvfgzurfzb"
    },
    "columns": [
      "time",
      "metric"
    ],
    "values": [
      [
        1529762933815,
        75.654324173059
      ]
    ]
  }
]

This query contains both data (the value 75.654324173059) and a location (the geohash 9wvfgzurfzb which is in Colorado). So using these, the Worldmap panel will draw one circle in Colorado, USA with the value 75.654324173059.

Time Series Data as the Data Source

Supported Databases:

  • Graphite
  • InfluxDB
  • OpenTSDB
  • Prometheus
  • MySQL
  • Postgres
  • MSSQL
  • Elasticsearch

The following location files are included in the plugin:

  • Countries (2 letter codes)
  • Countries (3 letter codes)
  • US states

Alternatively, you can provide your own location lists by using:

  • A JSON endpoint that returns a list of locations
  • A JSONP endpoint that returns a list of locations

This works by matching country codes (like US or GB or FR) or US state codes (TX or NY) to a metric name. If a metric name matches a country in the list of countries then a circle will be drawn at that 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.

Time Series - Graphite and InfluxDB

Here are some examples of Time Series Queries

Graphite Query

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

Example dashboard for Worldmap with Graphite queries on the Grafana play site.

InfluxDB Query

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

Elasticsearch Query for Countries

Use a Group By clause on the field containing the country code and a Then by clause with Date Histogram by @timestamp (or corresponding date field).

Elasticsearch Query for Countries

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://worldpingdemo.grafana.net/api/plugin-proxy/raintank-worldping-app/api/v2/probes/locations. If you have your own endpoint defined it must be reachable from the client side, as it is approached by client's browser.

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

Worldmap Options for JSONP

For some details on troubleshooting JSON/JSONP check #47.

Geohashes as the Data Source

Supported Databases:

  • 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:

  • A metric. This is free text and should match the aggregation used (Count, Average, Sum, Unique Count etc.)
  • Location Name (optional - geohash value will be shown if not chosen)
  • geo_point field that provides the geohash value.

Elasticsearch Query for Worldmap

Table Data as the Data Source

Supported Databases:

  • InfluxDB
  • Elasticsearch
  • MySQL, Postgres, MSSQL
  • Any database that can return data in Table Format

If a datasource can return Table Data then on the Metrics tab in Grafana choose the FORMAT AS Table option.

Table Data with a Geohash Column

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

  • A metric field. This is used to give the circle a value and determines how large the circle is.
  • A geohash field. This is used to calculate where the circle should be drawn.
  • an optional location name field (shown in the mouse over). Used to label each circle on the map. If it is empty then the geohash value is used as the label.

The field mappings have to be specified on the Worldmap settings tab.

Example influxdb query

Table Data with Latitude and Longitude Columns

The Table Data format also works with two columns for latitude and longitude instead of a geohash column.

  • A metric field. This is used to give the circle a value and determines how large the circle is.
  • Latitude/Longitude Fields. These are used to calculate where the circle should be drawn.
  • an optional location name field (shown in the mouse over). Used to label each circle on the map. If it is empty then the geohash value is used as the label.

JSON result as the Data Source

Supported Databases:

It supports any datasource capable of generating a JSON response with a a custom list of locations (the same format that for the JSON enpoint).

Map Data Options

Location Data

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
  • 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 or this list of cities.
  • 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. For example: London -> "gcpvh3zgu992".

Aggregation

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

For Graphite, be aware that the default value for Max Data Points is 1. This is to aggregate data points per country to one value in the most accurate way. This will by default, consolidate by average. To change the consolidation, use the consolidateBy function like so:

Graphite Consolidate By

Or just remove the 1 from the Max Data Point field and use the consolidation functions in Map Data Options (though depending on the timerange and amount of data points, this will be usually less accurate due to Graphite consolidation).

Graphite Max Data Points

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.

  • The Metric in Elasticsearch is one of Count, Average, Sum etc.
  • Location Name is the field that gives the circle a name. If it is blank, then the geohash value is shown in the popover instead of the location.
  • geo_point is the GeoHashGrid field that provides the geohash value.

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 or last GeoHash 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. Last GeoHash center will centered the map on the last GeoHash received from the data.

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.

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

More Repositories

1

grafana

The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
TypeScript
64,527
star
2

k6

A modern load testing tool, using Go and JavaScript - https://k6.io
Go
24,182
star
3

loki

Like Prometheus, but for logs.
Go
23,635
star
4

pyroscope

Continuous Profiling Platform. Debug performance issues down to a single line of code
Go
9,970
star
5

mimir

Grafana Mimir provides horizontally scalable, highly available, multi-tenant, long-term storage for Prometheus.
Go
3,925
star
6

tempo

Grafana Tempo is a high volume, minimal dependency distributed tracing backend.
Go
3,866
star
7

oncall

Developer-friendly incident response with brilliant Slack integration
Python
3,275
star
8

tanka

Flexible, reusable and concise configuration for Kubernetes
Go
2,379
star
9

grafana-zabbix

Zabbix plugin for Grafana dashboard
TypeScript
2,066
star
10

phlare

๐Ÿ”ฅ horizontally-scalable, highly-available, multi-tenant continuous profiling aggregation system
Go
2,056
star
11

helm-charts

Smarty
1,627
star
12

agent

Vendor-neutral programmable observability pipelines.
Go
1,592
star
13

alloy

OpenTelemetry Collector distribution with programmable pipelines
Go
1,357
star
14

beyla

eBPF-based autoinstrumentation of web applications and network metrics
C
1,289
star
15

grafonnet-lib

Jsonnet library for generating Grafana dashboard files.
Jsonnet
1,079
star
16

grafana-operator

An operator for Grafana that installs and manages Grafana instances, Dashboards and Datasources through Kubernetes/OpenShift CRs
Go
861
star
17

faro-web-sdk

The Grafana Faro Web SDK, part of the Grafana Faro project, is a highly configurable web SDK for real user monitoring (RUM) that instruments browser frontend applications to capture observability signals. Frontend telemetry can then be correlated with backend and infrastructure data for full-stack observability.
TypeScript
751
star
18

grafana-infinity-datasource

CSV, JSON, GraphQL, XML and HTML datasource for grafana.
TypeScript
739
star
19

grafana-docker

Grafana docker container
Shell
638
star
20

metrictank

metrics2.0 based, multi-tenant timeseries store for Graphite and friends.
Go
622
star
21

k6-operator

An operator for running distributed k6 tests.
Go
586
star
22

awesome-k6

A curated list of awesome tools, content and projects using k6
566
star
23

jsonnet-libs

Grafana Labs' Jsonnet libraries
Jsonnet
516
star
24

grizzly

A utility for managing Jsonnet dashboards against the Grafana API
Go
513
star
25

simple-json-datasource

Datasource that sends generic http requests to give url
JavaScript
502
star
26

carbon-relay-ng

Fast carbon relay+aggregator with admin interfaces for making changes online - production ready
Go
455
star
27

terraform-provider-grafana

Terraform Grafana provider
Go
408
star
28

grafana-image-renderer

A Grafana backend plugin that handles rendering of panels & dashboards to PNGs using headless browser (Chromium/Chrome)
TypeScript
363
star
29

xk6-dashboard

A k6 extension that makes k6 metrics available on a web-based dashboard.
HTML
347
star
30

grafana-kiosk

Kiosk Utility for Grafana
Go
346
star
31

xk6-browser

k6 extension that adds support for browser automation and end-to-end web testing via the Chrome Devtools Protocol
Go
339
star
32

dskit

Distributed systems kit
Go
316
star
33

intro-to-mltp

Introduction to Metrics, Logs, Traces and Profiles session companion code.
JavaScript
312
star
34

k6-learn

JavaScript
309
star
35

explore-logs

Repo for the Loki log exploration app
TypeScript
291
star
36

postman-to-k6

Converts Postman collections to k6 script code
JavaScript
287
star
37

k6-template-typescript

Template to use TypeScript with k6
TypeScript
275
star
38

grafana-json-datasource

A data source plugin for loading JSON APIs into Grafana.
TypeScript
269
star
39

docker-otel-lgtm

Dockerfile
242
star
40

grafonnet

Jsonnet library for generating Grafana dashboards.
Jsonnet
229
star
41

k8s-monitoring-helm

Smarty
204
star
42

xk6

Build k6 with extensions
Go
192
star
43

dashboard-linter

A tool to lint Grafana dashboards
Go
187
star
44

strava-datasource

Strava datasource for Grafana dashboard
TypeScript
185
star
45

django-saml2-auth

Django SAML2 Authentication Made Easy. Easily integrate with SAML2 SSO identity providers like Okta, Azure AD and others.
Python
185
star
46

thema

A CUE-based framework for portable, evolvable schema
Go
185
star
47

tns

Observability Demo App
Jsonnet
185
star
48

jsonnet-language-server

A Language Server Protocol (LSP) server for Jsonnet (https://jsonnet.org)
Go
171
star
49

github-datasource

Grafana data source plugin using the Github API to retrieve and visualize Github data.
Go
169
star
50

grafana-plugin-sdk-go

A Go SDK for building backend plugins for Grafana
Go
165
star
51

synthetic-monitoring-agent

Synthetic Monitoring Agent
Go
157
star
52

cortex-tools

If you're using this tool with Grafana Mimir, please switch to "mimirtool" instead: https://github.com/grafana/mimir
Go
156
star
53

xk6-output-prometheus-remote

k6 extension to output real-time test metrics using Prometheus Remote Write.
Go
156
star
54

grafana-plugin-examples

Shell
152
star
55

piechart-panel

Pie Chart Panel Plugin
JavaScript
151
star
56

grafana-plugin-repository

The plugin repository for plugins that are published on grafana.com.
JavaScript
147
star
57

mqtt-datasource

MQTT Datasource for Grafana allows streaming data from any MQTT broker running either locally or remotely.
Go
143
star
58

pyroscope-rs

Pyroscope Profiler for Rust. Profile your Rust applications.
Rust
136
star
59

grafana-ansible-collection

grafana.grafana Ansible collection provides modules and roles for managing various resources on Grafana Cloud and roles to manage and deploy Grafana Agent and Grafana
Python
130
star
60

clickhouse-datasource

Grafana Plugin for ClickHouse
TypeScript
126
star
61

google-sheets-datasource

Load Google Sheets in grafana
Go
126
star
62

har-to-k6

JSON config representation of K6 script
JavaScript
124
star
63

scribe

A tool for building elaborate CI pipelines using a familiar programming language
Go
124
star
64

kubernetes-diff-logger

Logs updates to Kubernetes Objects for storing and querying with Loki
Go
123
star
65

k6-action

[Archived] Legacy k6 GitHub Action
JavaScript
122
star
66

scenes

Build Grafana dashboards directly in your Grafana app plugins.
TypeScript
114
star
67

faro

Grafana Faro is a project for frontend application observability. It includes a highly configurable web SDK that instruments browser frontend applications to capture observability signals.
113
star
68

tutorials

A series of tutorials for helping you make the most out of Grafana.
Makefile
111
star
69

synthetic-monitoring-app

Synthetic Monitoring frontend application
TypeScript
107
star
70

cuetsy

Experimental CUE->TypeScript exporter
Go
105
star
71

grafana-api-golang-client

Grafana HTTP API Client for Go
Go
105
star
72

rollout-operator

Kubernetes Rollout Operator
Go
96
star
73

pyroscope-go

This is the golang client integration for Pyroscope
Go
94
star
74

grafana-polystat-panel

D3-Based hexagon layout multi-stat panel
TypeScript
93
star
75

xk6-disruptor

Extension for injecting faults into k6 tests
Go
93
star
76

azure-monitor-datasource

Grafana data source for Azure Monitor/Application Insights (deprecated - now included in core Grafana)
TypeScript
92
star
77

dashboard-spec

Go
91
star
78

clock-panel

Clock Panel Plugin for Grafana
TypeScript
88
star
79

k6-studio

Desktop application for Mac and Windows (Linux coming soon) designed to help you generate k6 test scripts
TypeScript
87
star
80

k6-docs

The k6 documentation website.
JavaScript
84
star
81

k6-template-es6

Template using Webpack and Babel to enable ES6 features in k6 tests
JavaScript
84
star
82

otel-profiling-go

Open Telemetry integration for Grafana Pyroscope and tracing solutions such as Grafana Tempo, Honeycomb, or Jaeger
Go
76
star
83

doom-datasource

Hackathon project
C
75
star
84

pyroscope-java

pyroscope java integration
Java
74
star
85

cortex-jsonnet

Deprecated: see https://github.com/grafana/mimir/tree/main/operations/mimir instead
Jsonnet
74
star
86

grafana-csv-datasource

A data source for loading CSV data into Grafana.
TypeScript
73
star
87

tutorial-environment

Environment for tutorial excercises
Go
70
star
88

JPProf

Go Pprof but for Java runtime.
Java
68
star
89

database-migrator

Code to export grafana.db (sqlite) to MySQL-compatible SQL file, to assist in migration of Grafana data to MySQL-compatible DB.
Shell
67
star
90

memo

easily save grafana annotations from slack mentions and the cli
Go
67
star
91

jmeter-to-k6

Converts JMeter .jmx files to k6 JS code
JavaScript
67
star
92

grafana-starter-panel

A starter for Grafana panel plugins
TypeScript
66
star
93

mimir-proxies

Proxies to help you ingest your metrics into Grafana Mimir.
Go
65
star
94

vscode-jsonnet

Full code support (formatting, highlighting, navigation, etc) for Jsonnet
JavaScript
65
star
95

xk6-sql

k6 extension to load test RDBMSs (PostgreSQL, MySQL, MS SQL and SQLite3)
Go
64
star
96

xk6-distributed-tracing

A k6 extension for distributed tracing.
Go
63
star
97

xk6-kubernetes

Client extension for interacting with Kubernetes clusters from your k6 tests.
Go
62
star
98

grafana-plugin-sdk-rust

Grafana Plugin SDK for Rust
Rust
60
star
99

regexp

Faster version of the Go regexp package
Go
60
star
100

quickpizza

Pizza, pizza, pizza!
Go
58
star