From 43d136a9672ecb744fe85e77aac4e2f3b266815e Mon Sep 17 00:00:00 2001 From: janderedev Date: Sat, 12 Feb 2022 16:50:44 +0100 Subject: [PATCH] make commands_executed metric return labels --- bot/src/bot/modules/command_handler.ts | 2 +- bot/src/bot/modules/metrics.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/src/bot/modules/command_handler.ts b/bot/src/bot/modules/command_handler.ts index b56f2f5..b5d967a 100644 --- a/bot/src/bot/modules/command_handler.ts +++ b/bot/src/bot/modules/command_handler.ts @@ -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!); diff --git a/bot/src/bot/modules/metrics.ts b/bot/src/bot/modules/metrics.ts index c31909a..e73ffa6 100644 --- a/bot/src/bot/modules/metrics.ts +++ b/bot/src/bot/modules/metrics.ts @@ -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' }),