use of com.sedmelluq.discord.lavaplayer.remote.RemoteNode in project lavaplayer by sedmelluq.
the class MusicController method buildReportForNode.
private String buildReportForNode(RemoteNode node) {
StringBuilder builder = new StringBuilder();
builder.append("--- ").append(node.getAddress()).append(" ---\n");
builder.append("Connection state: ").append(node.getConnectionState()).append("\n");
NodeStatisticsMessage statistics = node.getLastStatistics();
builder.append("Node global statistics: \n").append(statistics == null ? "unavailable" : "");
if (statistics != null) {
builder.append(" playing tracks: ").append(statistics.playingTrackCount).append("\n");
builder.append(" total tracks: ").append(statistics.totalTrackCount).append("\n");
builder.append(" system CPU usage: ").append(statistics.systemCpuUsage).append("\n");
builder.append(" process CPU usage: ").append(statistics.processCpuUsage).append("\n");
}
builder.append("Minimum tick interval: ").append(node.getTickMinimumInterval()).append("\n");
builder.append("Tick history capacity: ").append(node.getTickHistoryCapacity()).append("\n");
List<RemoteNode.Tick> ticks = node.getLastTicks(false);
builder.append("Number of ticks in history: ").append(ticks.size()).append("\n");
if (ticks.size() > 0) {
int tail = Math.min(ticks.size(), 3);
builder.append("Last ").append(tail).append(" ticks:\n");
for (int i = ticks.size() - tail; i < ticks.size(); i++) {
RemoteNode.Tick tick = ticks.get(i);
builder.append(" [duration ").append(tick.endTime - tick.startTime).append("]\n");
builder.append(" start time: ").append(tick.startTime).append("\n");
builder.append(" end time: ").append(tick.endTime).append("\n");
builder.append(" response code: ").append(tick.responseCode).append("\n");
builder.append(" request size: ").append(tick.requestSize).append("\n");
builder.append(" response size: ").append(tick.responseSize).append("\n");
}
}
List<AudioTrack> tracks = node.getPlayingTracks();
builder.append("Number of playing tracks: ").append(tracks.size()).append("\n");
if (tracks.size() > 0) {
int head = Math.min(tracks.size(), 3);
builder.append("First ").append(head).append(" tracks:\n");
for (int i = 0; i < head; i++) {
AudioTrack track = tracks.get(i);
builder.append(" [identifier ").append(track.getInfo().identifier).append("]\n");
builder.append(" name: ").append(track.getInfo().author).append(" - ").append(track.getInfo().title).append("\n");
builder.append(" progress: ").append(track.getPosition()).append(" / ").append(track.getDuration()).append("\n");
}
}
builder.append("Balancer penalties: ").append(tracks.size()).append("\n");
for (Map.Entry<String, Integer> penalty : node.getBalancerPenaltyDetails().entrySet()) {
builder.append(" ").append(penalty.getKey()).append(": ").append(penalty.getValue()).append("\n");
}
return builder.toString();
}
use of com.sedmelluq.discord.lavaplayer.remote.RemoteNode in project lavaplayer by sedmelluq.
the class MusicController method nodeinfo.
@BotCommandHandler
private void nodeinfo(Message message) {
for (RemoteNode node : manager.getRemoteNodeRegistry().getNodes()) {
String report = buildReportForNode(node);
message.getChannel().sendMessage(report).queue();
}
}
Aggregations