From ec9349dce0227691d9fb5b690bad91b9b6b12f08 Mon Sep 17 00:00:00 2001 From: RuscalWorld Date: Sat, 26 Jun 2021 11:26:34 +0300 Subject: [PATCH] Check if spark enabled before registering metrics that require it --- .../java/ru/ruscalworld/fabricexporter/MetricRegistry.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/ruscalworld/fabricexporter/MetricRegistry.java b/src/main/java/ru/ruscalworld/fabricexporter/MetricRegistry.java index 10eb26d..0ed7dc6 100644 --- a/src/main/java/ru/ruscalworld/fabricexporter/MetricRegistry.java +++ b/src/main/java/ru/ruscalworld/fabricexporter/MetricRegistry.java @@ -34,8 +34,11 @@ public class MetricRegistry { this.registerMetric(new Entities()); this.registerMetric(new LoadedChunks()); this.registerMetric(new TotalLoadedChunks()); - this.registerMetric(new TicksPerSecond()); - this.registerMetric(new MillisPerTick()); + + if (this.getExporter().getConfig().shouldUseSpark()) { + this.registerMetric(new TicksPerSecond()); + this.registerMetric(new MillisPerTick()); + } this.registerCustomMetric("handshakes", new Counter.Builder() .name(getMetricName("handshakes"))