Add adhoc REST call debug stats
This commit is contained in:
parent
3bc0015dbe
commit
07f23d4137
6 changed files with 79 additions and 8 deletions
|
@ -1,23 +0,0 @@
|
|||
import { TextChannel } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { createChunkedMessage, formatNumber, resolveInvite, sorter, verboseUserMention } from "../../../utils";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const PerformanceCmd = botControlCmd({
|
||||
trigger: ["performance"],
|
||||
permission: "can_performance",
|
||||
|
||||
signature: {},
|
||||
|
||||
async run({ pluginData, message: msg, args }) {
|
||||
const stats = pluginData.getKnubInstance().getPluginPerformanceStats();
|
||||
const averageLoadTimeEntries = Object.entries(stats.averageLoadTimes);
|
||||
averageLoadTimeEntries.sort(sorter((v) => v[1].time, "DESC"));
|
||||
const lines = averageLoadTimeEntries.map(
|
||||
([pluginName, { time }]) => `${pluginName}: **${formatNumber(Math.round(time))}ms**`,
|
||||
);
|
||||
const fullStats = `Average plugin load times:\n\n${lines.join("\n")}`;
|
||||
createChunkedMessage(msg.channel as TextChannel, fullStats);
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue