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.registerMetric(new OnlinePlayers());
|
||||
metricUpdater.registerMetric(new TicksPerSecond());
|
||||
metricUpdater.registerMetric(new MillisPerTick());
|
||||
metricUpdater.registerMetric(new Entities());
|
||||
metricUpdater.registerMetric(new LoadedChunks());
|
||||
metricUpdater.registerMetric(new TotalLoadedChunks());
|
||||
|
||||
if (this.getConfig().shouldUseSpark()) {
|
||||
metricUpdater.registerMetric(new TicksPerSecond());
|
||||
metricUpdater.registerMetric(new MillisPerTick());
|
||||
}
|
||||
|
||||
Timer timer = new Timer();
|
||||
|
||||
ServerLifecycleEvents.SERVER_STARTING.register(this::setServer);
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Properties;
|
|||
public class MainConfig extends Config {
|
||||
private int port;
|
||||
private int updateInterval;
|
||||
private boolean useSpark;
|
||||
|
||||
public MainConfig(String name) {
|
||||
super(name);
|
||||
|
@ -19,6 +20,8 @@ public class MainConfig extends Config {
|
|||
|
||||
String updateIntervalString = properties.getProperty("update-interval", "1000");
|
||||
this.setUpdateInterval(ConvertUtil.intToStringOrDefault(updateIntervalString, 1000));
|
||||
|
||||
this.setShouldUseSpark(properties.getProperty("use-spark", "true").equalsIgnoreCase("true"));
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
|
@ -36,4 +39,12 @@ public class MainConfig extends Config {
|
|||
public void setUpdateInterval(int updateInterval) {
|
||||
this.updateInterval = updateInterval;
|
||||
}
|
||||
|
||||
public boolean shouldUseSpark() {
|
||||
return useSpark;
|
||||
}
|
||||
|
||||
public void setShouldUseSpark(boolean useSpark) {
|
||||
this.useSpark = useSpark;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
server-port=25585
|
||||
update-interval=1000
|
||||
update-interval=1000
|
||||
use-spark=true
|
Loading…
Reference in a new issue