Developer stats & metrics

Pionia records per-request metrics for Moonlight API calls and exposes them through a web dashboard and CLI.

Web dashboard

URLFormat
/statsHTML health dashboard
/stats.jsonSame data as JSON

Enabled when DEBUG=true by default, or explicitly:

# environment/settings.ini
STATS_ENABLED = true
# environment/.env — generate your own token; never commit a shared docs example
STATS_TOKEN=

Generate a token locally:

openssl rand -hex 32

Access the dashboard with ?token=<your-token> or header X-Stats-Token: <your-token>.

Disable stats in production or require a strong STATS_TOKEN. Do not leave /stats open without authentication when DEBUG=false.

CLI snapshot

php pionia stats:view              # human-readable table
php pionia stats:view --json       # JSON export
php pionia stats:view --reset      # clear storage/metrics/requests.jsonl

Aliases: stats, viewstats.

Disabling writes

To stop writing metrics while keeping the stats page:

[metrics]
ENABLED = false

What is collected

  • Request count, average duration, slow endpoints
  • Grouping by service/action where applicable
  • Framework static assets (/__pionia/*) are excluded
  • OPcache — hit rate, cached scripts, preload memory, JIT status
  • Framework version — resolved from installed pionia/pionia-core Composer package

When [performance] RECORD_OPCACHE_SNAPSHOT=true, workers also write storage/metrics/opcache-snapshot.json for stats-driven preload generation (see Production performance).