Skip to content

Commit 443af50

Browse files
committed
Merge branch 'release/3.0.0'
2 parents 6cdd3c6 + bc3730a commit 443af50

File tree

5 files changed

+66
-46
lines changed

5 files changed

+66
-46
lines changed

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [v3.0.0] - 2024-02-29
9+
10+
### Added
11+
- [#198](https://github.com/sladkoff/minecraft-prometheus-exporter/issues/198): Add rudimentary support for Folia (see README.md for limitations)
12+
13+
### Changed
14+
- [#228](https://github.com/sladkoff/minecraft-prometheus-exporter/pull/228): [Breaking] Update minimum Java version to 17
15+
16+
### Fixed
17+
- [#155](https://github.com/sladkoff/minecraft-prometheus-exporter/issues/155): World size metric lags server with big world
18+
- [#208](https://github.com/sladkoff/minecraft-prometheus-exporter/issues/208): Failed to find tick times buffer via reflection in 1.20.4
19+
- [#226](https://github.com/sladkoff/minecraft-prometheus-exporter/pull/226): Server lags when exporting chunk and player metrics
20+
821
## [v2.6.0] - 2024-01-02
922

1023
Special thanks to all new and old contributors :star:
@@ -158,6 +171,7 @@ Special thanks to all new and old contributors :star:
158171
### Added
159172
- Initial exporter
160173

174+
[v3.0.0]: https://github.com/sladkoff/minecraft-prometheus-exporter/compare/v2.6.0...v3.0.0
161175
[v2.6.0]: https://github.com/sladkoff/minecraft-prometheus-exporter/compare/v2.5.0...v2.6.0
162176
[v2.5.0]: https://github.com/sladkoff/minecraft-prometheus-exporter/compare/v2.4.2...v2.5.0
163177
[v2.4.2]: https://github.com/sladkoff/minecraft-prometheus-exporter/compare/v2.4.1...v2.4.2

README.md

+44-39
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,25 @@
88

99
# Minecraft Prometheus Exporter
1010

11-
A **Bukkit plugin** which exports Minecraft server stats for Prometheus.
11+
A **Bukkit plugin** to exports Minecraft server metrics to Prometheus.
12+
13+
Built for Paper, Spigot, Bukkit, Folia (experimental) and other forks.
1214

1315
If you're running multiple Minecraft servers behind a BungeeCord proxy, you might also be interested in [Bungeecord Prometheus Exporter](https://github.com/weihao/bungeecord-prometheus-exporter) for additional metrics!
1416

1517
## Quick Start
1618

17-
Drop the prometheus-exporter.jar into your Bukkit plugins directory and start your Minecraft server.
19+
Copy the prometheus-exporter.jar into your Bukkit plugins directory and start your Minecraft server.
1820

1921
After startup, the Prometheus metrics endpoint should be available at ``localhost:9940/metrics`` (assuming localhost is the server hostname).
2022

2123
The metrics port can be customized in the plugin's config.yml (a default config will be created after the first use).
2224

23-
## Plugin config
25+
## Installation & Configuration
26+
27+
### Plugin config
2428

25-
Here's a default config with annotations.
29+
The default configuration file will be created after the first use of the plugin.
2630

2731
```yml
2832
# Note that the HTTP server binds to localhost by default.
@@ -53,11 +57,11 @@ enable_metrics:
5357
player_statistic: false
5458
```
5559
56-
## Prometheus config
60+
### Prometheus config
5761
5862
Add the following job to the ``scrape_configs`` section of your Prometheus configuration:
5963
60-
### Single server
64+
#### Single server
6165
6266
```yml
6367
- job_name: 'minecraft'
@@ -67,7 +71,7 @@ Add the following job to the ``scrape_configs`` section of your Prometheus confi
6771
server_name: 'my-awesome-server'
6872
```
6973
70-
### Multiple servers
74+
#### Multiple servers
7175
7276
You can use labels in your Prometheus scrape configuration to distinguish between multiple servers:
7377
@@ -82,16 +86,18 @@ You can use labels in your Prometheus scrape configuration to distinguish betwee
8286
server_name: 'server2'
8387
```
8488
85-
## Import Grafana Dashboard
89+
### Import Grafana Dashboard
8690
8791
1. Navigate to Grafana -> Dashboards -> Import
8892
1. Paste in or upload [minecraft-server-dashboard.json](https://raw.githubusercontent.com/sladkoff/minecraft-prometheus-exporter/master/dashboards/minecraft-server-dashboard.json)
8993
1. Update "JVM Memory Used" to reflect your server max memory (Default 8G)
9094
1. Edit (bottom right widget) -> Options -> Gauage -> Max
9195
92-
## Available metrics
96+
You can also build your own dashboards using the metrics exported by the plugin. See [available metrics](#available-metrics) for a list of all the metrics exported by the plugin.
97+
98+
### Available metrics
9399
94-
These are the stats that are currently exported by the plugin.
100+
The following metrics are exported by the plugin:
95101
96102
| Label | Description | Folia Support |
97103
|--------------------------|----------------------------------------------------|---------------|
@@ -110,7 +116,7 @@ These are the stats that are currently exported by the plugin.
110116
| mc_tick_duration_min | Min Tick Duration (ns, usually last 100 ticks) | ❌ |
111117
| mc_tick_duration_max | Max Tick Duration (ns, usually last 100 ticks) | ❌ |
112118
113-
## Player metrics (experimental!)
119+
### Player metrics (experimental!)
114120
115121
:warning: **The following feature is against Prometheus best-practices and is not recommended for production servers!**
116122
@@ -136,18 +142,38 @@ This will enable the additional metrics.
136142
| mc_player_statistic | Player statistics | ❌ |
137143
| mc_player_online | Online state by player name | ❌ |
138144
139-
There's a sample [dashboard](https://raw.githubusercontent.com/sladkoff/minecraft-prometheus-exporter/master/dashboards/minecraft-players-dashboard.json)
140-
available to get you started.
145+
There's an additional sample [Grafana dashboard](https://raw.githubusercontent.com/sladkoff/minecraft-prometheus-exporter/master/dashboards/minecraft-players-dashboard.json)
146+
with player statistics enabled to get you started.
141147
142148
You can find the full list [here](https://minecraft.fandom.com/wiki/Statistics#List_of_custom_statistic_names).
143149
Use the "Resource location" for the metrics label with removing the "minecraft:" part and converted to uppercase.
144150
This doesn't support all statistics in the list because they are provided by the upstream Spigot libraries.
145151
146-
## Collect metrics about your own plugin
152+
### Compatibility
153+
154+
| Plugin version | Min Minecraft version | Min Java version |
155+
|----------------|-----------------------|------------------|
156+
| 3.x.x | 1.17.1 | 17 |
157+
| 1.0.0 - 2.x.x | 1.11.x | 11 |
158+
159+
#### Notes
160+
161+
– Java 17 is required for the latest version of the plugin.
162+
- There is a known [issue](https://github.com/sladkoff/minecraft-prometheus-exporter/issues/197) with Azul JVM.
163+
- There is currently rudimentary support for Folia servers. Only selected metrics are supported.
164+
- The plugin has been tested recently on
165+
- Minecraft 1.20.1
166+
- Minecraft 1.20.4
167+
168+
## Plugin Integration
169+
170+
By integrating your own plugin with the Minecraft Prometheus Exporter, you can **monitor your plugin**: Collect metrics about your plugin's performance or usage.
171+
172+
### Collect metrics about your own plugin
147173
148174
You can easily collect metrics about your own plugin.
149175
150-
### Include the Prometheus dependency
176+
#### Include the Prometheus dependency
151177
152178
```xml
153179
<dependency>
@@ -157,9 +183,9 @@ You can easily collect metrics about your own plugin.
157183
</dependency>
158184
```
159185

160-
### Collect metrics
186+
#### Collect metrics
161187

162-
This pseudo code shows how you would count invocations of a plugin command.
188+
This pseudocode shows how you would count invocations of a plugin command.
163189

164190
```java
165191
public class MyPluginCommand extends PluginCommand {
@@ -171,7 +197,7 @@ public class MyPluginCommand extends PluginCommand {
171197
.register();
172198

173199
@Override
174-
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
200+
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
175201

176202
// Increment your counter;
177203
commandCounter.inc();
@@ -183,24 +209,3 @@ public class MyPluginCommand extends PluginCommand {
183209

184210
}
185211
```
186-
187-
### Compatibility
188-
189-
#### Minecraft Server
190-
191-
##### Officially supported
192-
193-
> 1.11.x – 1.20.x
194-
195-
##### Tested
196-
- 1.20.1
197-
- 1.20.4
198-
199-
#### Java
200-
201-
- Java 11 or higher is required (Java 8 is not supported due to [this issue](https://github.com/sladkoff/minecraft-prometheus-exporter/issues/161))
202-
- There is a known [issue](https://github.com/sladkoff/minecraft-prometheus-exporter/issues/197) with Azul JVM
203-
204-
#### Folia
205-
206-
There is currently rudimentary support for Folia servers. Only selected metrics are supported.

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>de.sldk.mc</groupId>
88
<artifactId>minecraft-prometheus-exporter</artifactId>
9-
<version>2.6.1-SNAPSHOT</version>
9+
<version>3.0.0</version>
1010
<packaging>jar</packaging>
1111

1212
<properties>

src/main/java/de/sldk/mc/MetricsController.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.eclipse.jetty.server.Response;
1111
import org.eclipse.jetty.util.Callback;
1212

13+
import java.io.IOException;
1314
import java.io.OutputStreamWriter;
1415
import java.nio.charset.StandardCharsets;
1516
import java.util.logging.Level;
@@ -25,7 +26,7 @@ public MetricsController(PrometheusExporter exporter) {
2526

2627

2728
@Override
28-
public boolean handle(Request request, Response response, Callback callback) throws Exception {
29+
public boolean handle(Request request, Response response, Callback callback) {
2930
try {
3031
metricRegistry.collectMetrics().get();
3132

@@ -44,9 +45,9 @@ public boolean handle(Request request, Response response, Callback callback) thr
4445
return true;
4546
}
4647

47-
private void writeMetricsToResponse(Request request, Response response) throws Exception {
48-
try (var out = Response.asBufferedOutputStream(request, response);
49-
var writer = new OutputStreamWriter(out, StandardCharsets.UTF_8)) {
48+
private void writeMetricsToResponse(Request request, Response response) throws IOException {
49+
var out = Response.asBufferedOutputStream(request, response);
50+
try (var writer = new OutputStreamWriter(out, StandardCharsets.UTF_8)) {
5051
TextFormat.write004(writer, CollectorRegistry.defaultRegistry.metricFamilySamples());
5152
writer.flush();
5253
}

src/main/resources/plugin.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: PrometheusExporter
2-
version: 2.6.1-SNAPSHOT
2+
version: 3.0.0
33
author: sldk
44
main: de.sldk.mc.PrometheusExporter
5-
website: sldk.de
5+
website: https://github.com/sladkoff/minecraft-prometheus-exporter
66
api-version: 1.16
77
folia-supported: true

0 commit comments

Comments
 (0)