mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-02 14:37:45 +01:00
Added config setting to disable disk gathering
'Data_gathering.Disk_space' default 'true' Also fixed all performance average calculations where -1 might be present Affects issues: - Close #1360
This commit is contained in:
parent
d6e920c31d
commit
154cfc4a2b
@ -20,6 +20,8 @@ import com.djrapitops.plan.gathering.ServerSensor;
|
|||||||
import com.djrapitops.plan.gathering.SystemUsage;
|
import com.djrapitops.plan.gathering.SystemUsage;
|
||||||
import com.djrapitops.plan.gathering.domain.builders.TPSBuilder;
|
import com.djrapitops.plan.gathering.domain.builders.TPSBuilder;
|
||||||
import com.djrapitops.plan.identification.ServerInfo;
|
import com.djrapitops.plan.identification.ServerInfo;
|
||||||
|
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||||
|
import com.djrapitops.plan.settings.config.paths.DataGatheringSettings;
|
||||||
import com.djrapitops.plan.storage.database.DBSystem;
|
import com.djrapitops.plan.storage.database.DBSystem;
|
||||||
import com.djrapitops.plan.storage.database.transactions.events.TPSStoreTransaction;
|
import com.djrapitops.plan.storage.database.transactions.events.TPSStoreTransaction;
|
||||||
import com.djrapitops.plan.utilities.analysis.Average;
|
import com.djrapitops.plan.utilities.analysis.Average;
|
||||||
@ -50,12 +52,13 @@ public class ProxyTPSCounter extends TPSCounter {
|
|||||||
@Inject
|
@Inject
|
||||||
public ProxyTPSCounter(
|
public ProxyTPSCounter(
|
||||||
ServerSensor<Object> serverSensor,
|
ServerSensor<Object> serverSensor,
|
||||||
|
PlanConfig config,
|
||||||
DBSystem dbSystem,
|
DBSystem dbSystem,
|
||||||
ServerInfo serverInfo,
|
ServerInfo serverInfo,
|
||||||
PluginLogger logger,
|
PluginLogger logger,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
super(logger, errorHandler);
|
super(config.get(DataGatheringSettings.DISK_SPACE), logger, errorHandler);
|
||||||
|
|
||||||
this.serverSensor = serverSensor;
|
this.serverSensor = serverSensor;
|
||||||
this.dbSystem = dbSystem;
|
this.dbSystem = dbSystem;
|
||||||
|
@ -20,6 +20,8 @@ import com.djrapitops.plan.gathering.ServerSensor;
|
|||||||
import com.djrapitops.plan.gathering.SystemUsage;
|
import com.djrapitops.plan.gathering.SystemUsage;
|
||||||
import com.djrapitops.plan.gathering.domain.builders.TPSBuilder;
|
import com.djrapitops.plan.gathering.domain.builders.TPSBuilder;
|
||||||
import com.djrapitops.plan.identification.ServerInfo;
|
import com.djrapitops.plan.identification.ServerInfo;
|
||||||
|
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||||
|
import com.djrapitops.plan.settings.config.paths.DataGatheringSettings;
|
||||||
import com.djrapitops.plan.storage.database.DBSystem;
|
import com.djrapitops.plan.storage.database.DBSystem;
|
||||||
import com.djrapitops.plan.storage.database.transactions.events.TPSStoreTransaction;
|
import com.djrapitops.plan.storage.database.transactions.events.TPSStoreTransaction;
|
||||||
import com.djrapitops.plan.utilities.analysis.Average;
|
import com.djrapitops.plan.utilities.analysis.Average;
|
||||||
@ -54,12 +56,13 @@ public class ServerTPSCounter<W> extends TPSCounter {
|
|||||||
@Inject
|
@Inject
|
||||||
public ServerTPSCounter(
|
public ServerTPSCounter(
|
||||||
ServerSensor<W> serverSensor,
|
ServerSensor<W> serverSensor,
|
||||||
|
PlanConfig config,
|
||||||
DBSystem dbSystem,
|
DBSystem dbSystem,
|
||||||
ServerInfo serverInfo,
|
ServerInfo serverInfo,
|
||||||
PluginLogger logger,
|
PluginLogger logger,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
super(logger, errorHandler);
|
super(config.get(DataGatheringSettings.DISK_SPACE), logger, errorHandler);
|
||||||
|
|
||||||
noDirectTPS = !serverSensor.supportsDirectTPS();
|
noDirectTPS = !serverSensor.supportsDirectTPS();
|
||||||
this.serverSensor = serverSensor;
|
this.serverSensor = serverSensor;
|
||||||
|
@ -29,15 +29,18 @@ import com.djrapitops.plugin.task.AbsRunnable;
|
|||||||
*/
|
*/
|
||||||
public abstract class TPSCounter extends AbsRunnable {
|
public abstract class TPSCounter extends AbsRunnable {
|
||||||
|
|
||||||
|
private boolean gatherDiskSpace;
|
||||||
protected final PluginLogger logger;
|
protected final PluginLogger logger;
|
||||||
protected final ErrorHandler errorHandler;
|
protected final ErrorHandler errorHandler;
|
||||||
|
|
||||||
private boolean diskErrored = false;
|
private boolean diskErrored = false;
|
||||||
|
|
||||||
public TPSCounter(
|
public TPSCounter(
|
||||||
|
boolean gatherDiskSpace,
|
||||||
PluginLogger logger,
|
PluginLogger logger,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
|
this.gatherDiskSpace = gatherDiskSpace;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
|
|
||||||
@ -64,6 +67,7 @@ public abstract class TPSCounter extends AbsRunnable {
|
|||||||
public abstract void pulse();
|
public abstract void pulse();
|
||||||
|
|
||||||
protected long getFreeDiskSpace() {
|
protected long getFreeDiskSpace() {
|
||||||
|
if (!gatherDiskSpace) return -1;
|
||||||
try {
|
try {
|
||||||
return SystemUsage.getFreeDiskSpace();
|
return SystemUsage.getFreeDiskSpace();
|
||||||
} catch (SecurityException noPermission) {
|
} catch (SecurityException noPermission) {
|
||||||
|
@ -29,6 +29,7 @@ public class DataGatheringSettings {
|
|||||||
public static final Setting<Boolean> GEOLOCATIONS = new BooleanSetting("Data_gathering.Geolocations");
|
public static final Setting<Boolean> GEOLOCATIONS = new BooleanSetting("Data_gathering.Geolocations");
|
||||||
public static final Setting<Boolean> ACCEPT_GEOLITE2_EULA = new BooleanSetting("Data_gathering.Accept_GeoLite2_EULA");
|
public static final Setting<Boolean> ACCEPT_GEOLITE2_EULA = new BooleanSetting("Data_gathering.Accept_GeoLite2_EULA");
|
||||||
public static final Setting<Boolean> PING = new BooleanSetting("Data_gathering.Ping");
|
public static final Setting<Boolean> PING = new BooleanSetting("Data_gathering.Ping");
|
||||||
|
public static final Setting<Boolean> DISK_SPACE = new BooleanSetting("Data_gathering.Disk_space");
|
||||||
public static final Setting<Boolean> LOG_UNKNOWN_COMMANDS = new BooleanSetting("Data_gathering.Commands.Log_unknown");
|
public static final Setting<Boolean> LOG_UNKNOWN_COMMANDS = new BooleanSetting("Data_gathering.Commands.Log_unknown");
|
||||||
public static final Setting<Boolean> COMBINE_COMMAND_ALIASES = new BooleanSetting("Data_gathering.Commands.Log_aliases_as_main_command");
|
public static final Setting<Boolean> COMBINE_COMMAND_ALIASES = new BooleanSetting("Data_gathering.Commands.Log_aliases_as_main_command");
|
||||||
|
|
||||||
|
@ -237,6 +237,7 @@ public class TPSQueries {
|
|||||||
public static Query<Double> averageTPS(long after, long before, UUID serverUUID) {
|
public static Query<Double> averageTPS(long after, long before, UUID serverUUID) {
|
||||||
String sql = SELECT + "AVG(" + TPS + ") as average" + FROM + TABLE_NAME +
|
String sql = SELECT + "AVG(" + TPS + ") as average" + FROM + TABLE_NAME +
|
||||||
WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID +
|
WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID +
|
||||||
|
AND + TPS + ">=0" +
|
||||||
AND + DATE + "<?" +
|
AND + DATE + "<?" +
|
||||||
AND + DATE + ">?";
|
AND + DATE + ">?";
|
||||||
return new QueryStatement<Double>(sql) {
|
return new QueryStatement<Double>(sql) {
|
||||||
@ -257,6 +258,7 @@ public class TPSQueries {
|
|||||||
public static Query<Double> averageCPU(long after, long before, UUID serverUUID) {
|
public static Query<Double> averageCPU(long after, long before, UUID serverUUID) {
|
||||||
String sql = SELECT + "AVG(" + CPU_USAGE + ") as average" + FROM + TABLE_NAME +
|
String sql = SELECT + "AVG(" + CPU_USAGE + ") as average" + FROM + TABLE_NAME +
|
||||||
WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID +
|
WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID +
|
||||||
|
AND + CPU_USAGE + ">=0" +
|
||||||
AND + DATE + "<?" +
|
AND + DATE + "<?" +
|
||||||
AND + DATE + ">?";
|
AND + DATE + ">?";
|
||||||
return new QueryStatement<Double>(sql) {
|
return new QueryStatement<Double>(sql) {
|
||||||
@ -277,6 +279,7 @@ public class TPSQueries {
|
|||||||
public static Query<Long> averageRAM(long after, long before, UUID serverUUID) {
|
public static Query<Long> averageRAM(long after, long before, UUID serverUUID) {
|
||||||
String sql = SELECT + "AVG(" + RAM_USAGE + ") as average" + FROM + TABLE_NAME +
|
String sql = SELECT + "AVG(" + RAM_USAGE + ") as average" + FROM + TABLE_NAME +
|
||||||
WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID +
|
WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID +
|
||||||
|
AND + RAM_USAGE + ">=0" +
|
||||||
AND + DATE + "<?" +
|
AND + DATE + "<?" +
|
||||||
AND + DATE + ">?";
|
AND + DATE + ">?";
|
||||||
return new QueryStatement<Long>(sql) {
|
return new QueryStatement<Long>(sql) {
|
||||||
@ -297,6 +300,7 @@ public class TPSQueries {
|
|||||||
public static Query<Long> averageChunks(long after, long before, UUID serverUUID) {
|
public static Query<Long> averageChunks(long after, long before, UUID serverUUID) {
|
||||||
String sql = SELECT + "AVG(" + CHUNKS + ") as average" + FROM + TABLE_NAME +
|
String sql = SELECT + "AVG(" + CHUNKS + ") as average" + FROM + TABLE_NAME +
|
||||||
WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID +
|
WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID +
|
||||||
|
AND + CHUNKS + ">=0" +
|
||||||
AND + DATE + "<?" +
|
AND + DATE + "<?" +
|
||||||
AND + DATE + ">?";
|
AND + DATE + ">?";
|
||||||
return new QueryStatement<Long>(sql) {
|
return new QueryStatement<Long>(sql) {
|
||||||
@ -317,6 +321,7 @@ public class TPSQueries {
|
|||||||
public static Query<Long> averageEntities(long after, long before, UUID serverUUID) {
|
public static Query<Long> averageEntities(long after, long before, UUID serverUUID) {
|
||||||
String sql = SELECT + "AVG(" + ENTITIES + ") as average" + FROM + TABLE_NAME +
|
String sql = SELECT + "AVG(" + ENTITIES + ") as average" + FROM + TABLE_NAME +
|
||||||
WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID +
|
WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID +
|
||||||
|
AND + ENTITIES + ">=0" +
|
||||||
AND + DATE + "<?" +
|
AND + DATE + "<?" +
|
||||||
AND + DATE + ">?";
|
AND + DATE + ">?";
|
||||||
return new QueryStatement<Long>(sql) {
|
return new QueryStatement<Long>(sql) {
|
||||||
@ -337,6 +342,7 @@ public class TPSQueries {
|
|||||||
public static Query<Long> maxFreeDisk(long after, long before, UUID serverUUID) {
|
public static Query<Long> maxFreeDisk(long after, long before, UUID serverUUID) {
|
||||||
String sql = SELECT + "MAX(" + FREE_DISK + ") as free" + FROM + TABLE_NAME +
|
String sql = SELECT + "MAX(" + FREE_DISK + ") as free" + FROM + TABLE_NAME +
|
||||||
WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID +
|
WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID +
|
||||||
|
AND + FREE_DISK + ">=0" +
|
||||||
AND + DATE + "<?" +
|
AND + DATE + "<?" +
|
||||||
AND + DATE + ">?";
|
AND + DATE + ">?";
|
||||||
return new QueryStatement<Long>(sql) {
|
return new QueryStatement<Long>(sql) {
|
||||||
@ -357,6 +363,7 @@ public class TPSQueries {
|
|||||||
public static Query<Long> minFreeDisk(long after, long before, UUID serverUUID) {
|
public static Query<Long> minFreeDisk(long after, long before, UUID serverUUID) {
|
||||||
String sql = SELECT + "MIN(" + FREE_DISK + ") as free" + FROM + TABLE_NAME +
|
String sql = SELECT + "MIN(" + FREE_DISK + ") as free" + FROM + TABLE_NAME +
|
||||||
WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID +
|
WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID +
|
||||||
|
AND + FREE_DISK + ">=0" +
|
||||||
AND + DATE + "<?" +
|
AND + DATE + "<?" +
|
||||||
AND + DATE + ">?";
|
AND + DATE + ">?";
|
||||||
return new QueryStatement<Long>(sql) {
|
return new QueryStatement<Long>(sql) {
|
||||||
@ -377,6 +384,7 @@ public class TPSQueries {
|
|||||||
public static Query<Long> averageFreeDisk(long after, long before, UUID serverUUID) {
|
public static Query<Long> averageFreeDisk(long after, long before, UUID serverUUID) {
|
||||||
String sql = SELECT + "AVG(" + FREE_DISK + ") as average" + FROM + TABLE_NAME +
|
String sql = SELECT + "AVG(" + FREE_DISK + ") as average" + FROM + TABLE_NAME +
|
||||||
WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID +
|
WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID +
|
||||||
|
AND + FREE_DISK + ">=0" +
|
||||||
AND + DATE + "<?" +
|
AND + DATE + "<?" +
|
||||||
AND + DATE + ">?";
|
AND + DATE + ">?";
|
||||||
return new QueryStatement<Long>(sql) {
|
return new QueryStatement<Long>(sql) {
|
||||||
|
@ -65,6 +65,7 @@ Data_gathering:
|
|||||||
# https://www.maxmind.com/en/geolite2/eula
|
# https://www.maxmind.com/en/geolite2/eula
|
||||||
Accept_GeoLite2_EULA: false
|
Accept_GeoLite2_EULA: false
|
||||||
Ping: true
|
Ping: true
|
||||||
|
Disk_space: true
|
||||||
# -----------------------------------------------------
|
# -----------------------------------------------------
|
||||||
# Supported time units: MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS
|
# Supported time units: MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS
|
||||||
# -----------------------------------------------------
|
# -----------------------------------------------------
|
||||||
|
@ -67,6 +67,7 @@ Data_gathering:
|
|||||||
# https://www.maxmind.com/en/geolite2/eula
|
# https://www.maxmind.com/en/geolite2/eula
|
||||||
Accept_GeoLite2_EULA: false
|
Accept_GeoLite2_EULA: false
|
||||||
Ping: true
|
Ping: true
|
||||||
|
Disk_space: true
|
||||||
Commands:
|
Commands:
|
||||||
Log_unknown: false
|
Log_unknown: false
|
||||||
Log_aliases_as_main_command: true
|
Log_aliases_as_main_command: true
|
||||||
|
Loading…
Reference in New Issue
Block a user