Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased] - 2024-01-02

Special thanks to all new and old contributors :star:

### Fixed
- [#197](https://github.com/sladkoff/minecraft-prometheus-exporter/issues/197): Plugin crashes on Azul JVM


## [v2.5.0] - 2022-04-11

Special thanks to all new and old contributors :star:
Expand Down
20 changes: 13 additions & 7 deletions src/main/java/de/sldk/mc/config/PrometheusExporterConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,22 @@ public void loadDefaultsAndSave() {
public void enableConfiguredMetrics() {
PrometheusExporterConfig.METRICS
.forEach(metricConfig -> {
Metric metric = metricConfig.getMetric(prometheusExporter);
Boolean enabled = get(metricConfig);
String metricName = metricConfig.getClass().getSimpleName();
try {
Metric metric = metricConfig.getMetric(prometheusExporter);
Boolean enabled = get(metricConfig);

if (Boolean.TRUE.equals(enabled)) {
metric.enable();
}
if (Boolean.TRUE.equals(enabled)) {
metric.enable();
}

prometheusExporter.getLogger().fine("Metric " + metric.getClass().getSimpleName() + " enabled: " + enabled);
prometheusExporter.getLogger().fine("Metric " + metricName + " enabled: " + enabled);

MetricRegistry.getInstance().register(metric);
MetricRegistry.getInstance().register(metric);
} catch (Exception e) {
prometheusExporter.getLogger().warning("Failed to enable metric " + metricName + ": " + e.getMessage());
prometheusExporter.getLogger().log(java.util.logging.Level.FINE, "Failed to enable metric " + metricName, e);
}
});
}

Expand Down