make commands_executed metric return labels

This commit is contained in:
janderedev 2022-02-12 16:50:44 +01:00
parent 69f05dc184
commit 43d136a967
No known key found for this signature in database
GPG key ID: 5D5E18ACB990F57A
2 changed files with 2 additions and 2 deletions

View file

@ -73,7 +73,7 @@ let commands: Command[];
let cmd = commands.find(c => c.name == cmdName || (c.aliases?.indexOf(cmdName!) ?? -1) > -1);
if (!cmd) return;
metrics.commands.inc();
metrics.commands.inc({ command: cmd.name });
if (isSudo(msg.author!)) updateSudoTimeout(msg.author!);

View file

@ -8,7 +8,7 @@ const PORT = Number(process.env.BOT_METRICS_PORT);
prom.collectDefaultMetrics({ prefix: 'automod_' });
const metrics = {
commands: new prom.Counter({ name: 'commands_executed', help: 'Amount of executed commands' }),
commands: new prom.Counter({ name: 'commands_executed', help: 'Command usage stats', labelNames: [ 'command' ] }),
servers: new prom.Gauge({ name: 'server_count', help: 'Amount of servers the bot is in' }),
wsPing: new prom.Gauge({ name: 'ws_ping', help: 'WebSocket ping as returned by revolt.js' }),
msgPing: new prom.Gauge({ name: 'msg_ping', help: 'Amount of time it takes for the bot to send a message' }),