Sueta
PR

Prometheus Exporter

0.0.1-beta.1

A PaperMC plugin that exposes server metrics to Prometheus via an HTTP endpoint.

·Plugin

Prometheus Exporter

A PaperMC plugin that exposes server metrics to Prometheus via an HTTP endpoint.

The metrics endpoint starts automatically on port 9940.

Configuration

plugins/PrometheusExporter/config.yml:

metrics-port: 9940
collection-interval-ticks: 20   # 20 ticks = 1 second

Scraping

Point Prometheus at:

http://<server-ip>:9940/metrics

Example prometheus.yml:

scrape_configs:
  - job_name: minecraft
    static_configs:
      - targets: ["<server-ip>:9940"]

Metrics

Server

MetricLabelsDescription
mc_tpswindow (1m, 5m, 15m)Server ticks per second
mc_mspt_milliseconds—Average milliseconds per tick (last 100 ticks)
mc_tick_time_millisecondsquantile (max, p95)Tick duration quantiles over the last 100 ticks
mc_players_online—Current online player count
mc_players_max—Maximum player slots
mc_current_tick—Monotonically increasing tick counter
mc_worlds—Number of currently loaded worlds

Per-world

MetricLabelsDescription
mc_world_playersworldPlayers per world
mc_world_loaded_chunksworldLoaded chunks per world
mc_world_entitiesworldTotal entity count per world
mc_world_entities_by_typeworld, typeEntity count broken down by type (e.g. zombie, cow) per world
mc_world_tile_entitiesworldTile entity count per world
mc_world_ticking_tile_entitiesworldTicking tile entity count per world
mc_world_timeworldIn-game clock (0–24000); tracks day/night cycle
mc_world_stormworld1 if a storm is active, 0 otherwise
mc_world_thunderingworld1 if a thunderstorm is active, 0 otherwise

Per-player

MetricLabelsDescription
mc_player_ping_millisecondsplayerLatency per player
mc_player_healthplayerCurrent health per player
mc_player_max_healthplayerMax health per player (useful when custom attributes are applied)
mc_player_food_levelplayerHunger level per player (0–20)
mc_player_saturationplayerSaturation per player (0.0–20.0+)
mc_player_xp_levelplayerXP level per player
mc_player_xp_progressplayerFractional XP progress within current level (0.0–1.0)
mc_player_total_experienceplayerTotal accumulated XP per player
mc_player_flyingplayer1 if the player is flying, 0 otherwise
mc_player_gamemodeplayerNumeric active gamemode (0 = survival, 1 = creative, 2 = adventure, 3 = spectator)

JVM

MetricLabelsDescription
jvm_*variousJVM heap, GC, threads, classloaders

Similar projects

Plugin →