Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions monitoring/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Monitoring stack

Ephemeral Prometheus + Grafana for local stress and soak runs
(paritytech/web3-storage#267). Brings up dashboards for chain health,
economics, and protocol activity against a running chain and the domain-state
exporter.

## Scrape targets

| Target | Source | Port |
| --- | --- | --- |
| `web3-storage-chain` | `examples/papi/chain-exporter.ts` (domain state) | 9700 |
| `parachain-node` | collator's built-in Substrate metrics | 9615 |
| `relay-node` | relay validator's Substrate metrics (optional) | 9616 |

The collator and relay Prometheus ports are pinned in `zombienet.toml`
(zombienet otherwise assigns a random port each run).

## Run it

```bash
# 1. chain + provider (from repo root)
just start-chain
just start-provider inmemory 3333 ./provider-data "" true

# 2. domain-state exporter
pnpm --filter web3-storage-papi-demo run chain-exporter

# 3. monitoring stack
cd monitoring && docker compose up -d
```

- Grafana: http://localhost:3000 (anonymous viewer; admin/admin to edit)
- Prometheus: http://localhost:9090

Dashboards are provisioned automatically under the "Web3 Storage" folder.

Generate some load to watch, e.g. the challenge sweep:

```bash
pnpm --filter web3-storage-papi-demo run lower-timeouts -- --set ChallengeTimeout=30
pnpm --filter web3-storage-papi-demo run challenge-saturation -- --count 800
```

## Dashboards

- **Chain Health** — block height (best vs finalized), finality lag, block
production rate, txpool, peers, and per-class block weight (the mandatory
class spikes at a challenge-deadline block, PoV budget 5 MiB).
- **Economics** — provider stake, free/reserved balance, cumulative slashes,
checkpoint rewards and pool.
- **Protocol Activity** — agreements active vs expired (the lazy-cleanup
residual), pending challenges, challenge lifecycle (created/defended/slashed)
and rate, checkpoints submitted/missed, provider/bucket counts.

The dashboard JSON is generated by `grafana/gen-dashboards.mjs`; edit that and
re-run `node grafana/gen-dashboards.mjs grafana/dashboards` rather than hand-
editing the JSON.

## Pointing at a different target (e.g. PreviewNet)

The containers reach the host via `host.docker.internal`. To scrape a remote
chain or exporter instead, edit the target addresses in
`prometheus/prometheus.yml`.
47 changes: 47 additions & 0 deletions monitoring/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Ephemeral monitoring stack for local stress/soak runs (paritytech/web3-storage#267).
#
# Prometheus + Grafana that scrape three targets on the host:
# - the parachain collator's Substrate Prometheus endpoint (pinned to :9615
# in zombienet.toml)
# - the relay validator's endpoint (:9616, optional)
# - the domain-state exporter (examples/papi/chain-exporter.ts, :9700)
#
# The nodes and the exporter run on the host (zombienet native), so the
# containers reach them via host.docker.internal; the extra_hosts mapping makes
# that resolve on Linux too. To point at a different target (e.g. PreviewNet),
# edit prometheus/prometheus.yml.
services:
prometheus:
image: prom/prometheus:v3.1.0
container_name: w3s-prometheus
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.retention.time=30d
ports:
- "9090:9090"
volumes:
- ./prometheus:/etc/prometheus:ro
- prometheus-data:/prometheus
extra_hosts:
- "host.docker.internal:host-gateway"

grafana:
image: grafana/grafana:11.4.0
container_name: w3s-grafana
depends_on:
- prometheus
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Viewer
volumes:
- ./grafana/provisioning:/etc/grafana/provisioning:ro
- ./grafana/dashboards:/var/lib/grafana/dashboards:ro
- grafana-data:/var/lib/grafana

volumes:
prometheus-data:
grafana-data:
Loading