Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ee2bbf7e8 | ||
|
|
02b5639666 | ||
|
|
f82dd6c311 | ||
|
|
5017887429 | ||
|
|
fa2aec3502 | ||
|
|
5d0bf94dff | ||
|
|
e91797d9ac | ||
|
|
6952ba6975 | ||
|
|
83b66ce262 | ||
|
|
1bad62513f | ||
|
|
50840bdfb7 | ||
|
|
f91d289d8a | ||
|
|
aca7a81ad3 | ||
|
|
dc539e83d1 | ||
|
|
ec07769ff8 | ||
|
|
b2558b8855 | ||
|
|
58e692833e | ||
|
|
2648897197 | ||
|
|
7f48256f7d | ||
|
|
79a83d3c1c | ||
|
|
3be6e7e18c |
@@ -23,7 +23,7 @@ jobs:
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
node-version: 22.14.0
|
||||
|
||||
- name: Install Node dependencies
|
||||
run: npm install
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FROM gradle:8.6-jdk21
|
||||
FROM gradle:9.3-jdk21
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ http:
|
||||
metrics:
|
||||
enable_jvm: true
|
||||
enable_process: true
|
||||
entity_snapshot_interval_seconds: 15
|
||||
movement:
|
||||
count_block_changes_only: true
|
||||
```
|
||||
@@ -77,7 +78,7 @@ The Gitea workflow expects these secrets/variables:
|
||||
|
||||
## Metrics
|
||||
|
||||
Some metrics depend on server implementations (TPS/MSPT, player ping, tile entities). If a method is unavailable on your server build, those metrics are omitted.
|
||||
Some metrics depend on server implementations (TPS/MSPT, player ping, tile entities). If a method is unavailable on your server build, those metrics are omitted. Entity and tile counts are updated on a periodic main-thread snapshot.
|
||||
|
||||
| Metric | Type | Labels | Description |
|
||||
| --- | --- | --- | --- |
|
||||
@@ -91,6 +92,9 @@ Some metrics depend on server implementations (TPS/MSPT, player ping, tile entit
|
||||
| spigot_plugin_enable_total | counter | none | Total plugin enable events |
|
||||
| spigot_plugin_disable_total | counter | none | Total plugin disable events |
|
||||
| spigot_blocks_broken_total | counter | material | Blocks broken by material |
|
||||
| spigot_blocks_placed_total | counter | material | Blocks placed by material |
|
||||
| spigot_items_crafted_total | counter | material | Items crafted by material |
|
||||
| spigot_entities_killed_total | counter | entity,killer | Entities killed by player |
|
||||
| spigot_player_deaths_total | counter | cause | Player deaths by cause |
|
||||
| spigot_player_logins_failed_total | counter | reason | Failed player logins by reason |
|
||||
| spigot_commands_blocked_total | counter | command | Blocked commands by name |
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -114,7 +114,6 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -172,7 +171,6 @@ fi
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
@@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
|
||||
Vendored
+1
-2
@@ -70,11 +70,10 @@ goto fail
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
@@ -0,0 +1,930 @@
|
||||
{
|
||||
"__inputs": [
|
||||
{
|
||||
"name": "DS_PROMETHEUS",
|
||||
"label": "Prometheus",
|
||||
"description": "",
|
||||
"type": "datasource",
|
||||
"pluginId": "prometheus",
|
||||
"pluginName": "Prometheus"
|
||||
}
|
||||
],
|
||||
"__requires": [
|
||||
{
|
||||
"type": "grafana",
|
||||
"id": "grafana",
|
||||
"name": "Grafana",
|
||||
"version": "10.4.0"
|
||||
},
|
||||
{
|
||||
"type": "datasource",
|
||||
"id": "prometheus",
|
||||
"name": "Prometheus",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
],
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
}
|
||||
]
|
||||
},
|
||||
"editable": true,
|
||||
"fiscalYearStartMonth": 0,
|
||||
"graphTooltip": 0,
|
||||
"id": null,
|
||||
"links": [],
|
||||
"panels": [
|
||||
{
|
||||
"collapsed": false,
|
||||
"gridPos": {
|
||||
"h": 1,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"id": 1,
|
||||
"panels": [],
|
||||
"title": "Overview",
|
||||
"type": "row"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"decimals": 0,
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 6,
|
||||
"w": 8,
|
||||
"x": 0,
|
||||
"y": 1
|
||||
},
|
||||
"id": 2,
|
||||
"options": {
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"textMode": "auto"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "spigot_players_online{instance=~\"$server\"}",
|
||||
"legendFormat": "online",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Players Online",
|
||||
"type": "stat"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"decimals": 2,
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 6,
|
||||
"w": 8,
|
||||
"x": 8,
|
||||
"y": 1
|
||||
},
|
||||
"id": 3,
|
||||
"options": {
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"textMode": "auto"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "spigot_tps{instance=~\"$server\",interval=\"1m\"}",
|
||||
"legendFormat": "tps",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "TPS (1m)",
|
||||
"type": "stat"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"decimals": 2,
|
||||
"unit": "ms"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 6,
|
||||
"w": 8,
|
||||
"x": 16,
|
||||
"y": 1
|
||||
},
|
||||
"id": 4,
|
||||
"options": {
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"textMode": "auto"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "spigot_mspt{instance=~\"$server\"}",
|
||||
"legendFormat": "mspt",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "MSPT",
|
||||
"type": "stat"
|
||||
},
|
||||
{
|
||||
"collapsed": false,
|
||||
"gridPos": {
|
||||
"h": 1,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 7
|
||||
},
|
||||
"id": 5,
|
||||
"panels": [],
|
||||
"title": "Activity",
|
||||
"type": "row"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 8
|
||||
},
|
||||
"id": 6,
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "rate(spigot_chat_messages_total{instance=~\"$server\"}[5m])",
|
||||
"legendFormat": "chat/s",
|
||||
"refId": "A"
|
||||
},
|
||||
{
|
||||
"expr": "rate(spigot_players_joined_total{instance=~\"$server\"}[5m])",
|
||||
"legendFormat": "joins/s",
|
||||
"refId": "B"
|
||||
},
|
||||
{
|
||||
"expr": "rate(spigot_players_quit_total{instance=~\"$server\"}[5m])",
|
||||
"legendFormat": "quits/s",
|
||||
"refId": "C"
|
||||
}
|
||||
],
|
||||
"title": "Chat + Joins/Quits",
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"decimals": 2,
|
||||
"unit": "ops"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 6,
|
||||
"x": 12,
|
||||
"y": 8
|
||||
},
|
||||
"id": 7,
|
||||
"options": {
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"textMode": "auto"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "rate(spigot_player_movements_total{instance=~\"$server\"}[5m])",
|
||||
"legendFormat": "moves/s",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Movement Rate",
|
||||
"type": "stat"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"decimals": 2,
|
||||
"unit": "ops"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 6,
|
||||
"x": 18,
|
||||
"y": 8
|
||||
},
|
||||
"id": 8,
|
||||
"options": {
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"textMode": "auto"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "sum(rate(spigot_commands_executed_total{instance=~\"$server\"}[5m]))",
|
||||
"legendFormat": "commands/s",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Command Rate",
|
||||
"type": "stat"
|
||||
},
|
||||
{
|
||||
"collapsed": false,
|
||||
"gridPos": {
|
||||
"h": 1,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 16
|
||||
},
|
||||
"id": 9,
|
||||
"panels": [],
|
||||
"title": "Blocks & Crafting",
|
||||
"type": "row"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 9,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 17
|
||||
},
|
||||
"id": 10,
|
||||
"options": {
|
||||
"displayMode": "gradient",
|
||||
"minVizWidth": 0,
|
||||
"minVizHeight": 10,
|
||||
"orientation": "horizontal",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"showUnfilled": true
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "topk(10, sum by (material) (rate(spigot_blocks_broken_total{instance=~\"$server\"}[5m])))",
|
||||
"legendFormat": "{{material}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Blocks Broken (Top 10)",
|
||||
"type": "bargauge"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 9,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 17
|
||||
},
|
||||
"id": 11,
|
||||
"options": {
|
||||
"displayMode": "gradient",
|
||||
"minVizWidth": 0,
|
||||
"minVizHeight": 10,
|
||||
"orientation": "horizontal",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"showUnfilled": true
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "topk(10, sum by (material) (rate(spigot_blocks_placed_total{instance=~\"$server\"}[5m])))",
|
||||
"legendFormat": "{{material}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Blocks Placed (Top 10)",
|
||||
"type": "bargauge"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 9,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 26
|
||||
},
|
||||
"id": 12,
|
||||
"options": {
|
||||
"displayMode": "gradient",
|
||||
"minVizWidth": 0,
|
||||
"minVizHeight": 10,
|
||||
"orientation": "horizontal",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"showUnfilled": true
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "topk(10, sum by (material) (rate(spigot_items_crafted_total{instance=~\"$server\"}[5m])))",
|
||||
"legendFormat": "{{material}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Items Crafted (Top 10)",
|
||||
"type": "bargauge"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 9,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 26
|
||||
},
|
||||
"id": 13,
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "sum by (cause) (rate(spigot_player_deaths_total{instance=~\"$server\"}[5m]))",
|
||||
"legendFormat": "{{cause}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Player Deaths by Cause",
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
"collapsed": false,
|
||||
"gridPos": {
|
||||
"h": 1,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 35
|
||||
},
|
||||
"id": 14,
|
||||
"panels": [],
|
||||
"title": "World & Tasks",
|
||||
"type": "row"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"decimals": 0,
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 6,
|
||||
"w": 6,
|
||||
"x": 0,
|
||||
"y": 36
|
||||
},
|
||||
"id": 15,
|
||||
"options": {
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"textMode": "auto"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "spigot_chunks_loaded{instance=~\"$server\"}",
|
||||
"legendFormat": "chunks",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Chunks Loaded",
|
||||
"type": "stat"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"decimals": 0,
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 6,
|
||||
"w": 6,
|
||||
"x": 6,
|
||||
"y": 36
|
||||
},
|
||||
"id": 16,
|
||||
"options": {
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"textMode": "auto"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "spigot_worlds_loaded{instance=~\"$server\"}",
|
||||
"legendFormat": "worlds",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Worlds Loaded",
|
||||
"type": "stat"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"decimals": 0,
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 6,
|
||||
"w": 6,
|
||||
"x": 12,
|
||||
"y": 36
|
||||
},
|
||||
"id": 17,
|
||||
"options": {
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"textMode": "auto"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "spigot_tasks_running{instance=~\"$server\"}",
|
||||
"legendFormat": "running",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Tasks Running",
|
||||
"type": "stat"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"decimals": 0,
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 6,
|
||||
"w": 6,
|
||||
"x": 18,
|
||||
"y": 36
|
||||
},
|
||||
"id": 18,
|
||||
"options": {
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"textMode": "auto"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "spigot_tasks_pending{instance=~\"$server\"}",
|
||||
"legendFormat": "pending",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Tasks Pending",
|
||||
"type": "stat"
|
||||
},
|
||||
{
|
||||
"collapsed": false,
|
||||
"gridPos": {
|
||||
"h": 1,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 42
|
||||
},
|
||||
"id": 19,
|
||||
"panels": [],
|
||||
"title": "Entities",
|
||||
"type": "row"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 9,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 43
|
||||
},
|
||||
"id": 20,
|
||||
"options": {
|
||||
"displayMode": "gradient",
|
||||
"minVizWidth": 0,
|
||||
"minVizHeight": 10,
|
||||
"orientation": "horizontal",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"showUnfilled": true
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "topk(10, spigot_entities_total{instance=~\"$server\"})",
|
||||
"legendFormat": "{{type}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Entities by Type (Top 10)",
|
||||
"type": "bargauge"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 9,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 43
|
||||
},
|
||||
"id": 21,
|
||||
"options": {
|
||||
"showHeader": true
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "topk(10, sum by (entity, killer) (rate(spigot_entities_killed_total{instance=~\"$server\"}[5m])))",
|
||||
"format": "table",
|
||||
"legendFormat": "{{entity}} by {{killer}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Entity Kills (Top 10)",
|
||||
"type": "table"
|
||||
},
|
||||
{
|
||||
"collapsed": false,
|
||||
"gridPos": {
|
||||
"h": 1,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 52
|
||||
},
|
||||
"id": 22,
|
||||
"panels": [],
|
||||
"title": "Performance",
|
||||
"type": "row"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "bytes"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 53
|
||||
},
|
||||
"id": 23,
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "jvm_memory_used_bytes{instance=~\"$server\"}",
|
||||
"legendFormat": "used {{area}}",
|
||||
"refId": "A"
|
||||
},
|
||||
{
|
||||
"expr": "jvm_memory_max_bytes{instance=~\"$server\"}",
|
||||
"legendFormat": "max {{area}}",
|
||||
"refId": "B"
|
||||
}
|
||||
],
|
||||
"title": "JVM Memory",
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"decimals": 0,
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 6,
|
||||
"x": 12,
|
||||
"y": 53
|
||||
},
|
||||
"id": 24,
|
||||
"options": {
|
||||
"colorMode": "value",
|
||||
"graphMode": "none",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"textMode": "auto"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "jvm_threads{instance=~\"$server\"}",
|
||||
"legendFormat": "threads",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "JVM Threads",
|
||||
"type": "stat"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 6,
|
||||
"x": 18,
|
||||
"y": 53
|
||||
},
|
||||
"id": 25,
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "sum by (gc) (rate(jvm_gc_pause_seconds_count{instance=~\"$server\"}[5m]))",
|
||||
"legendFormat": "{{gc}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "GC Pause Rate",
|
||||
"type": "timeseries"
|
||||
}
|
||||
],
|
||||
"refresh": "30s",
|
||||
"schemaVersion": 38,
|
||||
"style": "dark",
|
||||
"tags": [
|
||||
"minecraft",
|
||||
"spigot",
|
||||
"prometheus"
|
||||
],
|
||||
"templating": {
|
||||
"list": [
|
||||
{
|
||||
"current": {},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "${DS_PROMETHEUS}"
|
||||
},
|
||||
"definition": "label_values(jvm_gc_pause_seconds_count, instance)",
|
||||
"hide": 0,
|
||||
"includeAll": false,
|
||||
"label": "Server",
|
||||
"multi": false,
|
||||
"name": "server",
|
||||
"query": {
|
||||
"query": "label_values(jvm_gc_pause_seconds_count, instance)",
|
||||
"refId": "StandardVariableQuery"
|
||||
},
|
||||
"refresh": 1,
|
||||
"sort": 1,
|
||||
"type": "query"
|
||||
}
|
||||
]
|
||||
},
|
||||
"time": {
|
||||
"from": "now-6h",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {},
|
||||
"timezone": "browser",
|
||||
"title": "Prometheus Spigot",
|
||||
"uid": "prometheus-spigot",
|
||||
"version": 3,
|
||||
"weekStart": ""
|
||||
}
|
||||
+4
-4
@@ -2,10 +2,10 @@
|
||||
"name": "prometheus-spigot",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^19.5.0",
|
||||
"@commitlint/config-conventional": "^19.5.0",
|
||||
"@semantic-release/exec": "^6.0.3",
|
||||
"@commitlint/cli": "^20.0.0",
|
||||
"@commitlint/config-conventional": "^20.0.0",
|
||||
"@semantic-release/exec": "^7.0.0",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"semantic-release": "^23.1.1"
|
||||
"semantic-release": "^25.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,14 @@ package com.prometheus.spigot;
|
||||
|
||||
import com.prometheus.spigot.http.MetricsHttpHandler;
|
||||
import com.prometheus.spigot.listeners.BlockBreakListener;
|
||||
import com.prometheus.spigot.listeners.BlockPlaceListener;
|
||||
import com.prometheus.spigot.listeners.ChatListener;
|
||||
import com.prometheus.spigot.listeners.ChunkListener;
|
||||
import com.prometheus.spigot.listeners.CommandListener;
|
||||
import com.prometheus.spigot.listeners.ConnectionListener;
|
||||
import com.prometheus.spigot.listeners.CraftListener;
|
||||
import com.prometheus.spigot.listeners.DeathListener;
|
||||
import com.prometheus.spigot.listeners.EntityKillListener;
|
||||
import com.prometheus.spigot.listeners.MoveListener;
|
||||
import com.prometheus.spigot.listeners.PluginListener;
|
||||
import com.prometheus.spigot.metrics.MetricsRegistry;
|
||||
@@ -17,7 +20,9 @@ import java.net.InetSocketAddress;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public final class PrometheusSpigotPlugin extends JavaPlugin {
|
||||
private HttpServer httpServer;
|
||||
@@ -25,6 +30,7 @@ public final class PrometheusSpigotPlugin extends JavaPlugin {
|
||||
private MetricsRegistry metricsRegistry;
|
||||
private String bearerToken;
|
||||
private boolean countBlockMovementOnly;
|
||||
private BukkitTask snapshotTask;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
@@ -43,6 +49,8 @@ public final class PrometheusSpigotPlugin extends JavaPlugin {
|
||||
|
||||
metricsRegistry = new MetricsRegistry(getServer(), enableJvm, enableProcess);
|
||||
|
||||
scheduleSnapshotTask();
|
||||
|
||||
registerListeners();
|
||||
startHttpServer();
|
||||
}
|
||||
@@ -57,11 +65,16 @@ public final class PrometheusSpigotPlugin extends JavaPlugin {
|
||||
httpExecutor.shutdownNow();
|
||||
httpExecutor = null;
|
||||
}
|
||||
if (snapshotTask != null) {
|
||||
snapshotTask.cancel();
|
||||
snapshotTask = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void registerListeners() {
|
||||
var pluginManager = getServer().getPluginManager();
|
||||
pluginManager.registerEvents(new BlockBreakListener(metricsRegistry), this);
|
||||
pluginManager.registerEvents(new BlockPlaceListener(metricsRegistry), this);
|
||||
pluginManager.registerEvents(new DeathListener(metricsRegistry), this);
|
||||
pluginManager.registerEvents(new ChatListener(metricsRegistry), this);
|
||||
pluginManager.registerEvents(new MoveListener(metricsRegistry, countBlockMovementOnly), this);
|
||||
@@ -69,6 +82,8 @@ public final class PrometheusSpigotPlugin extends JavaPlugin {
|
||||
pluginManager.registerEvents(new CommandListener(metricsRegistry), this);
|
||||
pluginManager.registerEvents(new ChunkListener(metricsRegistry), this);
|
||||
pluginManager.registerEvents(new PluginListener(metricsRegistry), this);
|
||||
pluginManager.registerEvents(new CraftListener(metricsRegistry), this);
|
||||
pluginManager.registerEvents(new EntityKillListener(metricsRegistry), this);
|
||||
}
|
||||
|
||||
private void startHttpServer() {
|
||||
@@ -95,4 +110,12 @@ public final class PrometheusSpigotPlugin extends JavaPlugin {
|
||||
httpServer.start();
|
||||
getLogger().info(String.format(Locale.ROOT, "Prometheus endpoint listening on http://%s:%d%s", bindAddress, port, path));
|
||||
}
|
||||
|
||||
private void scheduleSnapshotTask() {
|
||||
int intervalSeconds = getConfig().getInt("metrics.entity_snapshot_interval_seconds", 15);
|
||||
long intervalTicks = Math.max(20L, intervalSeconds * 20L);
|
||||
|
||||
metricsRegistry.refreshEntitySnapshots();
|
||||
snapshotTask = Bukkit.getScheduler().runTaskTimer(this, metricsRegistry::refreshEntitySnapshots, intervalTicks, intervalTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.prometheus.spigot.listeners;
|
||||
|
||||
import com.prometheus.spigot.metrics.MetricsRegistry;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
|
||||
public final class BlockPlaceListener implements Listener {
|
||||
private final MetricsRegistry registry;
|
||||
|
||||
public BlockPlaceListener(MetricsRegistry registry) {
|
||||
this.registry = registry;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
registry.incrementBlocksPlaced(event.getBlockPlaced().getType());
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.prometheus.spigot.listeners;
|
||||
|
||||
import com.prometheus.spigot.metrics.MetricsRegistry;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
@@ -12,7 +13,7 @@ public final class ChatListener implements Listener {
|
||||
this.registry = registry;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onChat(AsyncPlayerChatEvent event) {
|
||||
registry.incrementChatMessages();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.prometheus.spigot.listeners;
|
||||
|
||||
import com.prometheus.spigot.metrics.MetricsRegistry;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.CraftItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public final class CraftListener implements Listener {
|
||||
private final MetricsRegistry registry;
|
||||
|
||||
public CraftListener(MetricsRegistry registry) {
|
||||
this.registry = registry;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCraft(CraftItemEvent event) {
|
||||
ItemStack result = event.getRecipe() != null ? event.getRecipe().getResult() : null;
|
||||
if (result == null || result.getType() == Material.AIR) {
|
||||
return;
|
||||
}
|
||||
registry.incrementItemsCrafted(result.getType());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.prometheus.spigot.listeners;
|
||||
|
||||
import com.prometheus.spigot.metrics.MetricsRegistry;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
|
||||
public final class EntityKillListener implements Listener {
|
||||
private final MetricsRegistry registry;
|
||||
|
||||
public EntityKillListener(MetricsRegistry registry) {
|
||||
this.registry = registry;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
Player killer = event.getEntity().getKiller();
|
||||
String killerLabel = killer != null ? killer.getName() : "null";
|
||||
registry.incrementEntityKill(event.getEntity().getType(), killerLabel);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import java.lang.management.MemoryUsage;
|
||||
import java.lang.management.ThreadMXBean;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -31,6 +32,8 @@ public final class MetricsRegistry {
|
||||
private final Method serverMsptMethod;
|
||||
private final Method playerPingMethod;
|
||||
private final Method chunkTileEntitiesMethod;
|
||||
private volatile Map<String, Long> entityCountsSnapshot = Collections.emptyMap();
|
||||
private volatile Map<String, Long> tileEntityCountsSnapshot = Collections.emptyMap();
|
||||
|
||||
private final LongAdder chatMessages = new LongAdder();
|
||||
private final LongAdder playerMovements = new LongAdder();
|
||||
@@ -41,11 +44,14 @@ public final class MetricsRegistry {
|
||||
private final LongAdder chunkGenerations = new LongAdder();
|
||||
private final LongAdder pluginEnables = new LongAdder();
|
||||
private final LongAdder pluginDisables = new LongAdder();
|
||||
private final ConcurrentHashMap<String, LongAdder> blocksPlacedByMaterial = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<String, LongAdder> blocksBrokenByMaterial = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<String, LongAdder> deathsByCause = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<String, LongAdder> loginFailuresByReason = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<String, LongAdder> commandsBlocked = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<LabelPair, LongAdder> commandsExecuted = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<String, LongAdder> itemsCraftedByMaterial = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<LabelPair, LongAdder> entityKills = new ConcurrentHashMap<>();
|
||||
|
||||
public MetricsRegistry(Server server, boolean enableJvm, boolean enableProcess) {
|
||||
this.server = server;
|
||||
@@ -82,6 +88,10 @@ public final class MetricsRegistry {
|
||||
incrementLabeledCounter(blocksBrokenByMaterial, material.name());
|
||||
}
|
||||
|
||||
public void incrementBlocksPlaced(Material material) {
|
||||
incrementLabeledCounter(blocksPlacedByMaterial, material.name());
|
||||
}
|
||||
|
||||
public void incrementPlayerDeath(EntityDamageEvent.DamageCause cause) {
|
||||
incrementLabeledCounter(deathsByCause, cause.name());
|
||||
}
|
||||
@@ -120,6 +130,47 @@ public final class MetricsRegistry {
|
||||
pluginDisables.increment();
|
||||
}
|
||||
|
||||
public void incrementItemsCrafted(Material material) {
|
||||
incrementLabeledCounter(itemsCraftedByMaterial, material.name());
|
||||
}
|
||||
|
||||
public void incrementEntityKill(EntityType entityType, String killer) {
|
||||
String normalizedEntity = normalizeLabel(entityType.name());
|
||||
String normalizedKiller = normalizeLabel(killer);
|
||||
entityKills.computeIfAbsent(new LabelPair(normalizedEntity, normalizedKiller), key -> new LongAdder()).increment();
|
||||
}
|
||||
|
||||
public void refreshEntitySnapshots() {
|
||||
Map<String, Long> entityCounts = new HashMap<>();
|
||||
Map<String, Long> tileCounts = new HashMap<>();
|
||||
|
||||
for (var world : server.getWorlds()) {
|
||||
for (Entity entity : world.getEntities()) {
|
||||
EntityType type = entity.getType();
|
||||
String label = normalizeLabel(type.name());
|
||||
entityCounts.merge(label, 1L, Long::sum);
|
||||
}
|
||||
|
||||
if (chunkTileEntitiesMethod != null) {
|
||||
for (Chunk chunk : world.getLoadedChunks()) {
|
||||
Object result = invoke(chunkTileEntitiesMethod, chunk);
|
||||
if (!(result instanceof Object[] states)) {
|
||||
continue;
|
||||
}
|
||||
for (Object state : states) {
|
||||
if (state instanceof BlockState blockState) {
|
||||
String label = normalizeLabel(blockState.getType().name());
|
||||
tileCounts.merge(label, 1L, Long::sum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
entityCountsSnapshot = Collections.unmodifiableMap(entityCounts);
|
||||
tileEntityCountsSnapshot = Collections.unmodifiableMap(tileCounts);
|
||||
}
|
||||
|
||||
public String render() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
@@ -134,10 +185,13 @@ public final class MetricsRegistry {
|
||||
appendCounter(builder, "spigot_plugin_disable_total", "Total plugin disable events", pluginDisables.sum());
|
||||
|
||||
appendLabeledCounterAdder(builder, "spigot_blocks_broken_total", "Blocks broken by material", "material", blocksBrokenByMaterial);
|
||||
appendLabeledCounterAdder(builder, "spigot_blocks_placed_total", "Blocks placed by material", "material", blocksPlacedByMaterial);
|
||||
appendLabeledCounterAdder(builder, "spigot_player_deaths_total", "Player deaths by cause", "cause", deathsByCause);
|
||||
appendLabeledCounterAdder(builder, "spigot_player_logins_failed_total", "Failed player logins by reason", "reason", loginFailuresByReason);
|
||||
appendLabeledCounterAdder(builder, "spigot_commands_blocked_total", "Blocked commands by name", "command", commandsBlocked);
|
||||
appendLabeledCounterAdder(builder, "spigot_commands_executed_total", "Commands executed by source", "command", "source", commandsExecuted);
|
||||
appendLabeledCounterAdder(builder, "spigot_items_crafted_total", "Items crafted by material", "material", itemsCraftedByMaterial);
|
||||
appendLabeledCounterAdder(builder, "spigot_entities_killed_total", "Entities killed by player", "entity", "killer", entityKills);
|
||||
|
||||
appendGauge(builder, "spigot_players_online", "Online player count", server.getOnlinePlayers().size());
|
||||
appendGauge(builder, "spigot_players_max", "Max player slots", server.getMaxPlayers());
|
||||
@@ -226,37 +280,14 @@ public final class MetricsRegistry {
|
||||
}
|
||||
|
||||
private void appendEntityMetrics(StringBuilder builder) {
|
||||
Map<String, Long> entityCounts = new HashMap<>();
|
||||
for (var world : server.getWorlds()) {
|
||||
for (Entity entity : world.getEntities()) {
|
||||
EntityType type = entity.getType();
|
||||
String label = normalizeLabel(type.name());
|
||||
entityCounts.merge(label, 1L, Long::sum);
|
||||
}
|
||||
}
|
||||
appendLabeledGauge(builder, "spigot_entities_total", "Entities by type", "type", entityCounts);
|
||||
appendLabeledGauge(builder, "spigot_entities_total", "Entities by type", "type", entityCountsSnapshot);
|
||||
}
|
||||
|
||||
private void appendTileEntityMetrics(StringBuilder builder) {
|
||||
if (chunkTileEntitiesMethod == null) {
|
||||
return;
|
||||
}
|
||||
Map<String, Long> tileCounts = new HashMap<>();
|
||||
for (var world : server.getWorlds()) {
|
||||
for (Chunk chunk : world.getLoadedChunks()) {
|
||||
Object result = invoke(chunkTileEntitiesMethod, chunk);
|
||||
if (!(result instanceof Object[] states)) {
|
||||
continue;
|
||||
}
|
||||
for (Object state : states) {
|
||||
if (state instanceof BlockState blockState) {
|
||||
String label = normalizeLabel(blockState.getType().name());
|
||||
tileCounts.merge(label, 1L, Long::sum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
appendLabeledGauge(builder, "spigot_tile_entities_total", "Tile entities by type", "type", tileCounts);
|
||||
appendLabeledGauge(builder, "spigot_tile_entities_total", "Tile entities by type", "type", tileEntityCountsSnapshot);
|
||||
}
|
||||
|
||||
private void appendPlayerPingMetrics(StringBuilder builder) {
|
||||
|
||||
@@ -6,5 +6,6 @@ http:
|
||||
metrics:
|
||||
enable_jvm: true
|
||||
enable_process: true
|
||||
entity_snapshot_interval_seconds: 15
|
||||
movement:
|
||||
count_block_changes_only: true
|
||||
|
||||
Reference in New Issue
Block a user