Monitoring

Expose Prometheus metrics

Optional statistics about your bot for monitoring tools such as Prometheus and Grafana.

This page is for people who already run a monitoring tool. You can skip it otherwise. Metrics are off by default.

Turn metrics on

Add this to the bot config.json:

{
  "metrics": { "enabled": true, "host": "127.0.0.1", "port": 9464, "token": "a-long-random-string" }
}

The statistics are then available at /metrics on that address and port. Any other address answers with "not found".

  • Keep host at 127.0.0.1 so only your own PC can read the numbers. 0.0.0.0 opens them to the whole network.
  • token is an optional password with at least 16 characters. When it is set, requests must send it as Authorization: Bearer <token>.

Prometheus setup:

scrape_configs:
  - job_name: discordmute
    metrics_path: /metrics
    authorization:
      type: Bearer
      credentials: a-long-random-string
    static_configs:
      - targets: ["127.0.0.1:9464"]

Available metrics

MetricMeaning
discordmute_plugin_events_total{type}Events from plugins by type: lobby, game-start, meeting-start, meeting-end, player-died, game-end, link-chat.
discordmute_games_muted_totalGames for which muting was started.
discordmute_plugins_connectedPlugins connected right now.
discordmute_active_gamesGames in progress right now.
discordmute_plugin_sessions{plugin_version,game_version}Connected plugins per plugin and Among Us version.
discordmute_mutes_total{action}Mutes and unmutes (mute or unmute).
discordmute_mute_failures_totalMutes and unmutes that failed.
discordmute_mute_latency_secondsHow long successful mutes and unmutes take.
discordmute_rate_limit_hits_totalTimes Discord slowed the bot down.
discordmute_guildsDiscord servers the bot is in.
discordmute_feature_guilds{feature}Servers the bot is in that have an optional feature switched on, for example ghostChat or serverLog.
discordmute_cluster_guilds{cluster}Servers per bot process.
discordmute_cluster_ws_ping_seconds{cluster}Connection delay to Discord per bot process.
discordmute_cluster_snapshot_failures_totalTimes a bot process did not answer a statistics request.
discordmute_process_resident_memory_bytes{process}Memory used per process.