Check if spark enabled before registering metrics that require it

This commit is contained in:
RuscalWorld 2021-06-26 11:26:34 +03:00
parent 0e96325c79
commit ec9349dce0
No known key found for this signature in database
GPG key ID: 4F53776031D128ED

View file

@ -34,8 +34,11 @@ public class MetricRegistry {
this.registerMetric(new Entities()); this.registerMetric(new Entities());
this.registerMetric(new LoadedChunks()); this.registerMetric(new LoadedChunks());
this.registerMetric(new TotalLoadedChunks()); this.registerMetric(new TotalLoadedChunks());
if (this.getExporter().getConfig().shouldUseSpark()) {
this.registerMetric(new TicksPerSecond()); this.registerMetric(new TicksPerSecond());
this.registerMetric(new MillisPerTick()); this.registerMetric(new MillisPerTick());
}
this.registerCustomMetric("handshakes", new Counter.Builder() this.registerCustomMetric("handshakes", new Counter.Builder()
.name(getMetricName("handshakes")) .name(getMetricName("handshakes"))