Grafana worldmap panel configured for fly requests

Hi all,

I’ve seen an example for how to use the world map panel in Grafana to display data here in this old thread: Early access: build Grafana dashboard from Fly metrics - #2 by kurt.

I’ve attempted to replicate it. I have Grafana working and hooked up to my org’s data source. I can see metrics on the Fly dashboard which I imported. I can also run my own queries and get results back.

When I take this query, that works, and put it into a world map panel, I see no data at all.

sum by(region)(fly_edge_http_responses_count{app="$app"}[$__rate_interval])

I’m using the regions JSON endpoint: https://api.fly.io/meta/regions.json

Here’s a screen grab:

Is there anything I need to do to hook this up typically?

Leigh

I’m not too familiar with Grafana, but there’s a Fly dashboard at Fly App dashboard for Grafana | Grafana Labs that you can just customise the data source for. That should get you running with data on the screen, and give you a good starting point.

It’ll try figuring out a start from scratch approach and maybe try writing docs as well.

1 Like

Yup I’m using the Fly dashboard, it works well. And I’m able to view the above metrics too. But I can’t get the world map panel to work. Which I saw you folks demoing in that other thread.

Ah, nice. Let me check if @kurt can help while I get up to speed on Grafana.

Do you have an $app variable configured on the dashboard?

Yup. I’m using the $app variable in other panels. If I hardcode an app name it doesn’t display data either. I can view data in the explorer for the same query, and it isn’t displaying an error about the region JSON endpoint. I was wondering if I need to tell it how to lookup the region lat long?

This is my panel JSON which I still can’t seem to get to work:

{
  "id": 36,
  "gridPos": {
    "h": 5,
    "w": 18,
    "x": 6,
    "y": 1
  },
  "type": "grafana-worldmap-panel",
  "title": "Edge HTTP Count by Region (2xx)",
  "pluginVersion": "8.2.2-39068",
  "maxDataPoints": 1,
  "targets": [
    {
      "expr": "sort_desc(\n  sum(\n    increase(fly_edge_http_responses_count{app=\"$app\",status=~\"2[0-9][0-9]\"}[$__range])\n  )by(region)\n)",
      "legendFormat": "{{region}}",
      "interval": "",
      "exemplar": true,
      "format": "time_series",
      "hide": false,
      "instant": true,
      "intervalFactor": 1,
      "refId": "A"
    }
  ],
  "interval": null,
  "timeFrom": null,
  "timeShift": null,
  "mapCenter": "(0°, 0°)",
  "mapCenterLatitude": 0,
  "mapCenterLongitude": 0,
  "initialZoom": 1,
  "valueName": "total",
  "circleMinSize": 2,
  "circleMaxSize": 30,
  "locationData": "json endpoint",
  "thresholds": "0,10",
  "colors": [
    "rgba(245, 54, 54, 0.9)",
    "rgba(237, 129, 40, 0.89)",
    "rgba(50, 172, 45, 0.97)"
  ],
  "unitSingle": "",
  "unitPlural": "",
  "showLegend": true,
  "mouseWheelZoom": false,
  "esMetric": "Count",
  "decimals": 0,
  "hideEmpty": false,
  "hideZero": false,
  "stickyLabels": false,
  "tableQueryOptions": {
    "queryType": "geohash",
    "geohashField": "geohash",
    "latitudeField": "latitude",
    "longitudeField": "longitude",
    "metricField": "metric"
  },
  "jsonUrl": "https://api.fly.io/meta/regions.json",
  "datasource": null
}

Anyone have any ideas what is missing?

@leighmcculloch fly_edge_http_responses_count seems only to be available if you are using the http handler. See Metrics on Fly

Try using fly_app_tcp_connects_count which works fine for me. My query is

sum(rate(fly_app_tcp_connects_count{app=~"$app", region=~"$region", host=~"$host"}[$__interval])) by(region)

Note that I have added variables for app, region, host, and instance, there also seems to be a variable for proxy called proxy_id which I don’t now what it means, not using that.

Try this: