You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sukun af2042c2ce
swarm: add a peer dial latency metric (#2959)
3 weeks ago
..
autonat metrics: update dashboard names from libp2p to go-libp2p (#2512) 1 year ago
autonatv2 autonatv2: add server metrics for dial requests (#2848) 4 months ago
autorelay metrics: make it possible to spin up Grafana using docker-compose (#2383) 1 year ago
eventbus metrics: update dashboard names from libp2p to go-libp2p (#2512) 1 year ago
holepunch metrics: update dashboard names from libp2p to go-libp2p (#2512) 1 year ago
identify metrics: update dashboard names from libp2p to go-libp2p (#2512) 1 year ago
relaysvc metrics: update dashboard names from libp2p to go-libp2p (#2512) 1 year ago
resource-manager metrics: update dashboard names from libp2p to go-libp2p (#2512) 1 year ago
swarm swarm: add a peer dial latency metric (#2959) 3 weeks ago
README.md chore: be more descriptive about where public dashboards come from (#2508) 1 year ago
dashboard.yml metrics: make it possible to spin up Grafana using docker-compose (#2383) 1 year ago
datasources.yml metrics: deduplicate code in examples (#2404) 1 year ago
docker-compose-linux.yml metrics: deduplicate code in examples (#2404) 1 year ago
docker-compose.base.yml chore: add resource manager dashboard to docker-compose (#2641) 12 months ago
prometheus.yml metrics: make it possible to spin up Grafana using docker-compose (#2383) 1 year ago

README.md

Grafana Dashboards

This directory contains prebuilt dashboards (provided as JSON files) for various components. For steps on how to import and use them please read the official Grafana documentation.

Public dashboards

You can check the following prebuilt dashboards in action:

  1. AutoNAT
  2. Auto Relay
  3. Eventbus
  4. Identify
  5. Relay Service
  6. Swarm

These metrics come from one of the public IPFS DHT bootstrap nodes run by Protocol Labs. At the time of writing (2023-08), these nodes handle many connections across various libp2p implementations, versions, and configurations (they don't handle large file transfers).

Using locally

For local development and debugging, it can be useful to spin up a local Prometheus and Grafana instance.

To expose metrics, we first need to expose a metrics collection endpoint. Add this to your code:

import "github.com/prometheus/client_golang/prometheus/promhttp"

go func() {
    http.Handle("/debug/metrics/prometheus", promhttp.Handler())
    log.Fatal(http.ListenAndServe(":5001", nil))
}()

This exposes a metrics collection endpoint at http://localhost:5001/debug/metrics/prometheus. Note that this is the same endpoint that Kubo uses, so if you want to gather metrics from Kubo, you can skip this step.

On macOS:

docker compose -f docker-compose.base.yml up

On Linux, dashboards can be inspected locally by running:

docker compose -f docker-compose.base.yml -f docker-compose-linux.yml up

and opening Grafana at http://localhost:3000.

Making Dashboards usable with Provisioning

The following section is only relevant for creators of dashboards.

Due to a bug in Grafana, it's not possible to provision dashboards shared for external use directly. We need to apply the workaround described in https://github.com/grafana/grafana/issues/10786#issuecomment-568788499 (adding a few lines in the dashboard JSON file).