|
|
@@ -46,12 +46,14 @@ public final class MetricsRegistry {
|
|
|
|
private final LongAdder pluginDisables = new LongAdder();
|
|
|
|
private final LongAdder pluginDisables = new LongAdder();
|
|
|
|
private final ConcurrentHashMap<String, LongAdder> blocksPlacedByMaterial = new ConcurrentHashMap<>();
|
|
|
|
private final ConcurrentHashMap<String, LongAdder> blocksPlacedByMaterial = new ConcurrentHashMap<>();
|
|
|
|
private final ConcurrentHashMap<String, LongAdder> blocksBrokenByMaterial = new ConcurrentHashMap<>();
|
|
|
|
private final ConcurrentHashMap<String, LongAdder> blocksBrokenByMaterial = new ConcurrentHashMap<>();
|
|
|
|
|
|
|
|
private final ConcurrentHashMap<LabelPair, LongAdder> blocksBrokenByPlayerMaterial = new ConcurrentHashMap<>();
|
|
|
|
private final ConcurrentHashMap<String, LongAdder> deathsByCause = new ConcurrentHashMap<>();
|
|
|
|
private final ConcurrentHashMap<String, LongAdder> deathsByCause = new ConcurrentHashMap<>();
|
|
|
|
private final ConcurrentHashMap<String, LongAdder> loginFailuresByReason = new ConcurrentHashMap<>();
|
|
|
|
private final ConcurrentHashMap<String, LongAdder> loginFailuresByReason = new ConcurrentHashMap<>();
|
|
|
|
private final ConcurrentHashMap<String, LongAdder> commandsBlocked = new ConcurrentHashMap<>();
|
|
|
|
private final ConcurrentHashMap<String, LongAdder> commandsBlocked = new ConcurrentHashMap<>();
|
|
|
|
private final ConcurrentHashMap<LabelPair, LongAdder> commandsExecuted = new ConcurrentHashMap<>();
|
|
|
|
private final ConcurrentHashMap<LabelPair, LongAdder> commandsExecuted = new ConcurrentHashMap<>();
|
|
|
|
private final ConcurrentHashMap<String, LongAdder> itemsCraftedByMaterial = new ConcurrentHashMap<>();
|
|
|
|
private final ConcurrentHashMap<String, LongAdder> itemsCraftedByMaterial = new ConcurrentHashMap<>();
|
|
|
|
private final ConcurrentHashMap<LabelPair, LongAdder> entityKills = new ConcurrentHashMap<>();
|
|
|
|
private final ConcurrentHashMap<LabelPair, LongAdder> entityKills = new ConcurrentHashMap<>();
|
|
|
|
|
|
|
|
private final ConcurrentHashMap<String, LongAdder> playerMovementsByPlayer = new ConcurrentHashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
public MetricsRegistry(Server server, boolean enableJvm, boolean enableProcess) {
|
|
|
|
public MetricsRegistry(Server server, boolean enableJvm, boolean enableProcess) {
|
|
|
|
this.server = server;
|
|
|
|
this.server = server;
|
|
|
@@ -72,6 +74,10 @@ public final class MetricsRegistry {
|
|
|
|
playerMovements.increment();
|
|
|
|
playerMovements.increment();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void incrementPlayerMovements(String player) {
|
|
|
|
|
|
|
|
incrementLabeledCounter(playerMovementsByPlayer, player);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void incrementPlayerJoins() {
|
|
|
|
public void incrementPlayerJoins() {
|
|
|
|
playerJoins.increment();
|
|
|
|
playerJoins.increment();
|
|
|
|
}
|
|
|
|
}
|
|
|
@@ -88,6 +94,14 @@ public final class MetricsRegistry {
|
|
|
|
incrementLabeledCounter(blocksBrokenByMaterial, material.name());
|
|
|
|
incrementLabeledCounter(blocksBrokenByMaterial, material.name());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void incrementBlocksBroken(Material material, String player) {
|
|
|
|
|
|
|
|
String normalizedMaterial = normalizeLabel(material.name());
|
|
|
|
|
|
|
|
String normalizedPlayer = normalizeLabel(player);
|
|
|
|
|
|
|
|
blocksBrokenByPlayerMaterial
|
|
|
|
|
|
|
|
.computeIfAbsent(new LabelPair(normalizedPlayer, normalizedMaterial), key -> new LongAdder())
|
|
|
|
|
|
|
|
.increment();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void incrementBlocksPlaced(Material material) {
|
|
|
|
public void incrementBlocksPlaced(Material material) {
|
|
|
|
incrementLabeledCounter(blocksPlacedByMaterial, material.name());
|
|
|
|
incrementLabeledCounter(blocksPlacedByMaterial, material.name());
|
|
|
|
}
|
|
|
|
}
|
|
|
@@ -185,6 +199,8 @@ public final class MetricsRegistry {
|
|
|
|
appendCounter(builder, "spigot_plugin_disable_total", "Total plugin disable events", pluginDisables.sum());
|
|
|
|
appendCounter(builder, "spigot_plugin_disable_total", "Total plugin disable events", pluginDisables.sum());
|
|
|
|
|
|
|
|
|
|
|
|
appendLabeledCounterAdder(builder, "spigot_blocks_broken_total", "Blocks broken by material", "material", blocksBrokenByMaterial);
|
|
|
|
appendLabeledCounterAdder(builder, "spigot_blocks_broken_total", "Blocks broken by material", "material", blocksBrokenByMaterial);
|
|
|
|
|
|
|
|
appendLabeledCounterAdder(builder, "spigot_blocks_broken_by_player_total", "Blocks broken by player and material", "player",
|
|
|
|
|
|
|
|
"material", blocksBrokenByPlayerMaterial);
|
|
|
|
appendLabeledCounterAdder(builder, "spigot_blocks_placed_total", "Blocks placed by material", "material", blocksPlacedByMaterial);
|
|
|
|
appendLabeledCounterAdder(builder, "spigot_blocks_placed_total", "Blocks placed by material", "material", blocksPlacedByMaterial);
|
|
|
|
appendLabeledCounterAdder(builder, "spigot_player_deaths_total", "Player deaths by cause", "cause", deathsByCause);
|
|
|
|
appendLabeledCounterAdder(builder, "spigot_player_deaths_total", "Player deaths by cause", "cause", deathsByCause);
|
|
|
|
appendLabeledCounterAdder(builder, "spigot_player_logins_failed_total", "Failed player logins by reason", "reason", loginFailuresByReason);
|
|
|
|
appendLabeledCounterAdder(builder, "spigot_player_logins_failed_total", "Failed player logins by reason", "reason", loginFailuresByReason);
|
|
|
@@ -192,6 +208,8 @@ public final class MetricsRegistry {
|
|
|
|
appendLabeledCounterAdder(builder, "spigot_commands_executed_total", "Commands executed by source", "command", "source", commandsExecuted);
|
|
|
|
appendLabeledCounterAdder(builder, "spigot_commands_executed_total", "Commands executed by source", "command", "source", commandsExecuted);
|
|
|
|
appendLabeledCounterAdder(builder, "spigot_items_crafted_total", "Items crafted by material", "material", itemsCraftedByMaterial);
|
|
|
|
appendLabeledCounterAdder(builder, "spigot_items_crafted_total", "Items crafted by material", "material", itemsCraftedByMaterial);
|
|
|
|
appendLabeledCounterAdder(builder, "spigot_entities_killed_total", "Entities killed by player", "entity", "killer", entityKills);
|
|
|
|
appendLabeledCounterAdder(builder, "spigot_entities_killed_total", "Entities killed by player", "entity", "killer", entityKills);
|
|
|
|
|
|
|
|
appendLabeledCounterAdder(builder, "spigot_player_movements_by_player_total", "Player movements by player", "player",
|
|
|
|
|
|
|
|
playerMovementsByPlayer);
|
|
|
|
|
|
|
|
|
|
|
|
appendGauge(builder, "spigot_players_online", "Online player count", server.getOnlinePlayers().size());
|
|
|
|
appendGauge(builder, "spigot_players_online", "Online player count", server.getOnlinePlayers().size());
|
|
|
|
appendGauge(builder, "spigot_players_max", "Max player slots", server.getMaxPlayers());
|
|
|
|
appendGauge(builder, "spigot_players_max", "Max player slots", server.getMaxPlayers());
|
|
|
|