Grafana geomap

When setting up a new panel in Grafana that displayed metrics from Prometheus containing geohash I realized I had forgotten how I did it last time, the documentation I found online was not about the geomap or it was not about Prometheus metrics, thus I struggled a lot until I figured it out. Just to document the steps for myself – for the next time I would need it – I write down the steps here.

The metrics

The metrics – a prometheus counter with the geohash as a label “geohash”

The metrics is collected as a Prometheus counter where the geohash is a label. Each microservice instance will calculate the geohash based on the ip address of the client doing the request.

The query

The counter in this example is called “customers”. The prometheus query of the geomap panel is simply to sum all counters grouped by the geohash ip, like so:

sum by (geohash) (customers) * 100

One thing that I missed though when setting this up was to set the “Format” to “table”. It did not work with the default “time series” for some reason and nothing was displayed.

Set “Format” to “Table”

Geomap settings

Then, for this example, I set the settings to Heatmap, Location mode to “Auto” and Weight value to “Value”, like so:

Heatmap, weight values, radius and blur


This renders a map, like below, where you can see where all the requests are coming from.

The result

Author: peffis

I was Slashdotted in 2004. After that, not much.