[] Disk stat placeholders:

- freeDiskAverageDay _Week _Month
- freeDiskMinimumDay _Week _Month
- freeDiskMaximumDay _Week _Month
This commit is contained in:
Rsl1122 2018-12-01 12:43:18 +02:00
parent 12272f3d25
commit e9aaab608b
4 changed files with 36 additions and 8 deletions
Plan/common/src/main/java/com/djrapitops/plan
data
utilities/html/pages

@ -131,7 +131,7 @@ public class TPS implements DateHolder {
/**
* Get free megabytes of disk space on the server disk.
*
* @return Amount of megabytes in use.
* @return Amount of free megabytes available on disk.
*/
public long getFreeDiskSpace() {
return freeDiskSpace;

@ -74,7 +74,8 @@ public class AnalysisContainer extends DataContainer {
private final Accordions accordions;
private final AnalysisPluginsTabContentCreator pluginsTabContentCreator;
private static final Key<Map<UUID, String>> serverNames = new Key<>(new Type<Map<UUID, String>>() {}, "SERVER_NAMES");
private static final Key<Map<UUID, String>> serverNames = new Key<>(new Type<Map<UUID, String>>() {
}, "SERVER_NAMES");
public AnalysisContainer(
ServerContainer serverContainer,
@ -446,18 +447,29 @@ public class AnalysisContainer extends DataContainer {
putSupplier(AnalysisKeys.AVG_RAM_MONTH, () -> getUnsafe(tpsMonth).averageRAM());
putSupplier(AnalysisKeys.AVG_ENTITY_MONTH, () -> getUnsafe(tpsMonth).averageEntities());
putSupplier(AnalysisKeys.AVG_CHUNK_MONTH, () -> getUnsafe(tpsMonth).averageChunks());
putSupplier(AnalysisKeys.AVG_FREE_DISK_MONTH, () -> getUnsafe(tpsMonth).averageFreeDisk());
putSupplier(AnalysisKeys.MAX_FREE_DISK_MONTH, () -> getUnsafe(tpsMonth).maxFreeDisk());
putSupplier(AnalysisKeys.MIN_FREE_DISK_MONTH, () -> getUnsafe(tpsMonth).minFreeDisk());
putSupplier(AnalysisKeys.TPS_SPIKE_WEEK, () -> getUnsafe(tpsWeek).lowTpsSpikeCount(threshold));
putSupplier(AnalysisKeys.AVG_TPS_WEEK, () -> getUnsafe(tpsWeek).averageTPS());
putSupplier(AnalysisKeys.AVG_CPU_WEEK, () -> getUnsafe(tpsWeek).averageCPU());
putSupplier(AnalysisKeys.AVG_RAM_WEEK, () -> getUnsafe(tpsWeek).averageRAM());
putSupplier(AnalysisKeys.AVG_ENTITY_WEEK, () -> getUnsafe(tpsWeek).averageEntities());
putSupplier(AnalysisKeys.AVG_CHUNK_WEEK, () -> getUnsafe(tpsWeek).averageChunks());
putSupplier(AnalysisKeys.AVG_FREE_DISK_WEEK, () -> getUnsafe(tpsWeek).averageFreeDisk());
putSupplier(AnalysisKeys.MAX_FREE_DISK_WEEK, () -> getUnsafe(tpsWeek).maxFreeDisk());
putSupplier(AnalysisKeys.MIN_FREE_DISK_WEEK, () -> getUnsafe(tpsWeek).minFreeDisk());
putSupplier(AnalysisKeys.TPS_SPIKE_DAY, () -> getUnsafe(tpsDay).lowTpsSpikeCount(threshold));
putSupplier(AnalysisKeys.AVG_TPS_DAY, () -> getUnsafe(tpsDay).averageTPS());
putSupplier(AnalysisKeys.AVG_CPU_DAY, () -> getUnsafe(tpsDay).averageCPU());
putSupplier(AnalysisKeys.AVG_RAM_DAY, () -> getUnsafe(tpsDay).averageRAM());
putSupplier(AnalysisKeys.AVG_ENTITY_DAY, () -> getUnsafe(tpsDay).averageEntities());
putSupplier(AnalysisKeys.AVG_CHUNK_DAY, () -> getUnsafe(tpsDay).averageChunks());
putSupplier(AnalysisKeys.AVG_FREE_DISK_DAY, () -> getUnsafe(tpsDay).averageFreeDisk());
putSupplier(AnalysisKeys.MAX_FREE_DISK_DAY, () -> getUnsafe(tpsDay).maxFreeDisk());
putSupplier(AnalysisKeys.MIN_FREE_DISK_DAY, () -> getUnsafe(tpsDay).minFreeDisk());
}
private void addCommandSuppliers() {
@ -482,7 +494,8 @@ public class AnalysisContainer extends DataContainer {
private void addPluginSuppliers() {
// TODO Refactor into a system that supports running the analysis on Bungee
Key<String[]> navAndTabs = new Key<>(new Type<String[]>() {}, "NAV_AND_TABS");
Key<String[]> navAndTabs = new Key<>(new Type<String[]>() {
}, "NAV_AND_TABS");
putCachingSupplier(navAndTabs, () -> pluginsTabContentCreator.createContent(
this, getValue(AnalysisKeys.PLAYERS_MUTATOR).orElse(new PlayersMutator(new ArrayList<>()))
));

@ -136,6 +136,15 @@ public class AnalysisKeys {
public static final PlaceholderKey<Double> AVG_CHUNK_MONTH = new PlaceholderKey<>(Double.class, "chunkAverageMonth");
public static final PlaceholderKey<Double> AVG_CHUNK_WEEK = new PlaceholderKey<>(Double.class, "chunkAverageWeek");
public static final PlaceholderKey<Double> AVG_CHUNK_DAY = new PlaceholderKey<>(Double.class, "chunkAverageDay");
public static final PlaceholderKey<Double> AVG_FREE_DISK_MONTH = new PlaceholderKey<>(Double.class, "freeDiskAverageMonth");
public static final PlaceholderKey<Double> AVG_FREE_DISK_WEEK = new PlaceholderKey<>(Double.class, "freeDiskAverageWeek");
public static final PlaceholderKey<Double> AVG_FREE_DISK_DAY = new PlaceholderKey<>(Double.class, "freeDiskAverageDay");
public static final PlaceholderKey<Long> MAX_FREE_DISK_MONTH = new PlaceholderKey<>(Long.class, "freeDiskMaximumMonth");
public static final PlaceholderKey<Long> MAX_FREE_DISK_WEEK = new PlaceholderKey<>(Long.class, "freeDiskMaximumWeek");
public static final PlaceholderKey<Long> MAX_FREE_DISK_DAY = new PlaceholderKey<>(Long.class, "freeDiskMaximumDay");
public static final PlaceholderKey<Long> MIN_FREE_DISK_MONTH = new PlaceholderKey<>(Long.class, "freeDiskMinimumMonth");
public static final PlaceholderKey<Long> MIN_FREE_DISK_WEEK = new PlaceholderKey<>(Long.class, "freeDiskMinimumWeek");
public static final PlaceholderKey<Long> MIN_FREE_DISK_DAY = new PlaceholderKey<>(Long.class, "freeDiskMinimumDay");
// Data for Charts
public static final PlaceholderKey<String> WORLD_PIE_SERIES = new PlaceholderKey<>(String.class, "worldSeries");
public static final PlaceholderKey<String> GM_PIE_SERIES = new PlaceholderKey<>(String.class, "gmSeries");
@ -169,10 +178,13 @@ public class AnalysisKeys {
public static final Key<Long> ANALYSIS_TIME_DAY_AGO = new Key<>(Long.class, "ANALYSIS_TIME_DAY_AGO");
public static final Key<Long> ANALYSIS_TIME_WEEK_AGO = new Key<>(Long.class, "ANALYSIS_TIME_WEEK_AGO");
public static final Key<Long> ANALYSIS_TIME_MONTH_AGO = new Key<>(Long.class, "ANALYSIS_TIME_MONTH_AGO");
public static final Key<Map<UUID, String>> PLAYER_NAMES = new Key<>(new Type<Map<UUID, String>>() {}, "PLAYER_NAMES");
public static final Key<Map<UUID, String>> PLAYER_NAMES = new Key<>(new Type<Map<UUID, String>>() {
}, "PLAYER_NAMES");
public static final Key<TreeMap<Long, Map<String, Set<UUID>>>> ACTIVITY_DATA = CommonKeys.ACTIVITY_DATA;
public static final Key<TreeMap<Long, Integer>> UNIQUE_PLAYERS_PER_DAY = new Key<>(new Type<TreeMap<Long, Integer>>() {}, "UNIQUE_PLAYERS_PER_DAY");
public static final Key<TreeMap<Long, Integer>> NEW_PLAYERS_PER_DAY = new Key<>(new Type<TreeMap<Long, Integer>>() {}, "NEW_PLAYERS_PER_DAY");
public static final Key<TreeMap<Long, Integer>> UNIQUE_PLAYERS_PER_DAY = new Key<>(new Type<TreeMap<Long, Integer>>() {
}, "UNIQUE_PLAYERS_PER_DAY");
public static final Key<TreeMap<Long, Integer>> NEW_PLAYERS_PER_DAY = new Key<>(new Type<TreeMap<Long, Integer>>() {
}, "NEW_PLAYERS_PER_DAY");
private AnalysisKeys() {
/* Static variable class */

@ -156,13 +156,16 @@ public class AnalysisPage implements Page {
private void performanceNumbers(PlaceholderReplacer placeholderReplacer) {
timings.start(CHANNEL + " Performance Numbers");
placeholderReplacer.addAllPlaceholdersFrom(analysisContainer,
TPS_SPIKE_MONTH, TPS_SPIKE_WEEK, TPS_SPIKE_DAY
TPS_SPIKE_MONTH, TPS_SPIKE_WEEK, TPS_SPIKE_DAY,
MAX_FREE_DISK_MONTH, MAX_FREE_DISK_WEEK, MAX_FREE_DISK_DAY,
MIN_FREE_DISK_MONTH, MIN_FREE_DISK_WEEK, MIN_FREE_DISK_DAY
);
placeholderReplacer.addAllPlaceholdersFrom(analysisContainer, decimalFormatter,
AVG_TPS_MONTH, AVG_TPS_WEEK, AVG_TPS_DAY,
AVG_RAM_MONTH, AVG_RAM_WEEK, AVG_RAM_DAY,
AVG_ENTITY_MONTH, AVG_ENTITY_WEEK, AVG_ENTITY_DAY,
AVG_CHUNK_MONTH, AVG_CHUNK_WEEK, AVG_CHUNK_DAY
AVG_CHUNK_MONTH, AVG_CHUNK_WEEK, AVG_CHUNK_DAY,
AVG_FREE_DISK_MONTH, AVG_FREE_DISK_WEEK, AVG_FREE_DISK_DAY
);
placeholderReplacer.addAllPlaceholdersFrom(analysisContainer,
value -> value != -1 ? decimalFormatter.apply(value) : "Unavailable",