Skip to content

feat: rebuild Grafana dashboards for new multi-protocol dual-stack tracker #6

Description

@josecelano

Overview

The demo was deployed using the Torrust Tracker Deployer, which
includes a basic Grafana configuration with two provisioned dashboards (stats.json and
metrics.json). These dashboards were designed for the old Torrust Index + Tracker
demo
, which ran a single UDP tracker with IPv4 only.

The tracker exposes metrics via two endpoints:

  • Stats (/api/v1/stats) — the legacy endpoint, still available.
  • Metrics (/api/v1/metrics) — the newer, extensible metrics endpoint.

In the old demo, both dashboards existed solely to verify that the two endpoints
produced the same data. In this demo we only need the Metrics endpoint. The Stats
dashboard and the Stats Prometheus scrape job can be removed.

Current Configuration

Tracker services (from tracker.toml)

Service Bind Address Public Endpoint
UDP Tracker 1 [::]:6969 udp://udp1.torrust-tracker-demo.com:6969/announce
UDP Tracker 2 [::]:6868 udp://udp1.torrust-tracker-demo.com:6868/announce
HTTP Tracker 1 [::]:7070 https://http1.torrust-tracker-demo.com
HTTP Tracker 2 [::]:7071 https://http2.torrust-tracker-demo.com

All services bind to [::], meaning they accept both IPv4 (inet) and IPv6 (inet6)
connections.

Existing dashboards (from deployer)

File Endpoint used Covers
metrics.json /api/v1/metrics UDP IPv4 only
stats.json /api/v1/stats UDP IPv4 only

Available metric labels

The Metrics endpoint exposes per-service metrics with labels:

  • server_binding_address_ip_familyinet (IPv4) or inet6 (IPv6)
  • request_kindconnect, announce, scrape (UDP) or announce, scrape (HTTP)
  • peer_roleseeder, leecher

Proposed New Dashboard Structure

Replace the two existing provisioned dashboards with three new dashboards
created directly in the Grafana UI. All use the Metrics endpoint only.

Each timeseries panel will use two series (IPv4 and IPv6) on the same graph, rather
than separate side-by-side panels. This halves the number of panels per dashboard while
making it easy to compare IP families at a glance.

1. Tracker Overview

Global aggregate metrics that are shared across all protocols and IP families:

  • Completed downloads (stat)
  • Torrents (stat)
  • Seeders (stat)
  • Leechers (stat)

2. UDP Tracker

UDP request/response metrics with IPv4 and IPv6 as separate series on the same graph:

  • Connections (per sec) — inet + inet6 series
  • Announces (per sec) — inet + inet6 series
  • Scrapes (per sec) — inet + inet6 series
  • Errors (per sec) — inet + inet6 series
  • Avg connect time — inet + inet6 series
  • Avg announce time — inet + inet6 series
  • Avg scrape time — inet + inet6 series
  • Banned requests (per sec) — inet + inet6 series
  • Requests & responses (per sec) — inet req + inet resp + inet6 req + inet6 resp
  • Banned IPs (timeseries)
  • Aborted requests (per sec) — inet + inet6 series

3. HTTP Tracker

HTTP request/response metrics (same approach, no "connect" since that's UDP-only):

  • Announces (per sec) — inet + inet6 series
  • Scrapes (per sec) — inet + inet6 series
  • Errors (per sec) — inet + inet6 series
  • Avg announce time — inet + inet6 series
  • Avg scrape time — inet + inet6 series
  • Banned requests (per sec) — inet + inet6 series
  • Requests & responses (per sec) — inet req + inet resp + inet6 req + inet6 resp
  • Banned IPs (timeseries)
  • Aborted requests (per sec) — inet + inet6 series

Implementation approach

  1. Create dashboard JSON files locally for import into Grafana UI (not provisioned).
  2. Import and verify on the live Grafana instance.
  3. Iterate until dashboards display data correctly.
  4. Once verified, export final versions from Grafana and store as backups in this repo.
  5. Remove old provisioned dashboards (stats.json, metrics.json) from the server
    config and restart Grafana to remove them from the panel.

Notes

  • The initial JSON files use assumed metric names for the HTTP tracker
    (http_tracker_server_*), based on the known UDP naming pattern
    (udp_tracker_server_*). These may need adjustment after checking the actual
    /api/v1/metrics output.
  • Queries currently do not filter by port/bind address, so they aggregate across
    all instances of each protocol (UDP1 + UDP2, HTTP1 + HTTP2). Per-instance filtering
    can be added once the exact label names are verified from the live metrics.

File Changes

Dashboards to remove from provisioning (on server)

File Reason
metrics.json Replaced by the three new dashboards
stats.json Stats endpoint is no longer needed in this demo

Prometheus config update

Consider removing the tracker_stats scrape job from prometheus.yml since the Stats
endpoint is no longer needed.

Tasks

  • Create overview.json draft dashboard JSON for import
  • Create udp-tracker.json draft dashboard JSON for import
  • Create http-tracker.json draft dashboard JSON for import
  • Import dashboards into Grafana and verify they display data
  • Verify/correct HTTP tracker metric names from live /api/v1/metrics
  • Add per-instance port filtering if needed (UDP1 vs UDP2, HTTP1 vs HTTP2)
  • Remove provisioned metrics.json and stats.json from server and restart Grafana
  • Optionally remove the tracker_stats scrape job from prometheus.yml
  • Export final verified dashboards from Grafana and store backups in this repo

Acceptance Criteria

  • Old stats.json and metrics.json provisioned dashboards are removed
  • Three new dashboards are created in Grafana UI and display data
  • Each protocol dashboard shows IPv4 and IPv6 metrics as dual series on the same graphs
  • All dashboards use the Metrics (/api/v1/metrics) endpoint only
  • Final verified dashboard JSON backups are stored in this repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions