Add ability to disable spark metrics
This commit is contained in:
parent
c56b315c3e
commit
2506639051
3 changed files with 18 additions and 3 deletions
|
@ -30,12 +30,15 @@ public class FabricExporter implements ModInitializer {
|
||||||
|
|
||||||
MetricUpdater metricUpdater = new MetricUpdater(this);
|
MetricUpdater metricUpdater = new MetricUpdater(this);
|
||||||
metricUpdater.registerMetric(new OnlinePlayers());
|
metricUpdater.registerMetric(new OnlinePlayers());
|
||||||
metricUpdater.registerMetric(new TicksPerSecond());
|
|
||||||
metricUpdater.registerMetric(new MillisPerTick());
|
|
||||||
metricUpdater.registerMetric(new Entities());
|
metricUpdater.registerMetric(new Entities());
|
||||||
metricUpdater.registerMetric(new LoadedChunks());
|
metricUpdater.registerMetric(new LoadedChunks());
|
||||||
metricUpdater.registerMetric(new TotalLoadedChunks());
|
metricUpdater.registerMetric(new TotalLoadedChunks());
|
||||||
|
|
||||||
|
if (this.getConfig().shouldUseSpark()) {
|
||||||
|
metricUpdater.registerMetric(new TicksPerSecond());
|
||||||
|
metricUpdater.registerMetric(new MillisPerTick());
|
||||||
|
}
|
||||||
|
|
||||||
Timer timer = new Timer();
|
Timer timer = new Timer();
|
||||||
|
|
||||||
ServerLifecycleEvents.SERVER_STARTING.register(this::setServer);
|
ServerLifecycleEvents.SERVER_STARTING.register(this::setServer);
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Properties;
|
||||||
public class MainConfig extends Config {
|
public class MainConfig extends Config {
|
||||||
private int port;
|
private int port;
|
||||||
private int updateInterval;
|
private int updateInterval;
|
||||||
|
private boolean useSpark;
|
||||||
|
|
||||||
public MainConfig(String name) {
|
public MainConfig(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
@ -19,6 +20,8 @@ public class MainConfig extends Config {
|
||||||
|
|
||||||
String updateIntervalString = properties.getProperty("update-interval", "1000");
|
String updateIntervalString = properties.getProperty("update-interval", "1000");
|
||||||
this.setUpdateInterval(ConvertUtil.intToStringOrDefault(updateIntervalString, 1000));
|
this.setUpdateInterval(ConvertUtil.intToStringOrDefault(updateIntervalString, 1000));
|
||||||
|
|
||||||
|
this.setShouldUseSpark(properties.getProperty("use-spark", "true").equalsIgnoreCase("true"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPort() {
|
public int getPort() {
|
||||||
|
@ -36,4 +39,12 @@ public class MainConfig extends Config {
|
||||||
public void setUpdateInterval(int updateInterval) {
|
public void setUpdateInterval(int updateInterval) {
|
||||||
this.updateInterval = updateInterval;
|
this.updateInterval = updateInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean shouldUseSpark() {
|
||||||
|
return useSpark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShouldUseSpark(boolean useSpark) {
|
||||||
|
this.useSpark = useSpark;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
server-port=25585
|
server-port=25585
|
||||||
update-interval=1000
|
update-interval=1000
|
||||||
|
use-spark=true
|
Loading…
Reference in a new issue