mirror of
				https://github.com/janderedev/automod.git
				synced 2025-11-04 10:34:50 +00:00 
			
		
		
		
	make commands_executed metric return labels
This commit is contained in:
		
							parent
							
								
									69f05dc184
								
							
						
					
					
						commit
						43d136a967
					
				| 
						 | 
					@ -73,7 +73,7 @@ let commands: Command[];
 | 
				
			||||||
        let cmd = commands.find(c => c.name == cmdName || (c.aliases?.indexOf(cmdName!) ?? -1) > -1);
 | 
					        let cmd = commands.find(c => c.name == cmdName || (c.aliases?.indexOf(cmdName!) ?? -1) > -1);
 | 
				
			||||||
        if (!cmd) return;
 | 
					        if (!cmd) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        metrics.commands.inc();
 | 
					        metrics.commands.inc({ command: cmd.name });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (isSudo(msg.author!)) updateSudoTimeout(msg.author!);
 | 
					        if (isSudo(msg.author!)) updateSudoTimeout(msg.author!);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@ const PORT = Number(process.env.BOT_METRICS_PORT);
 | 
				
			||||||
prom.collectDefaultMetrics({ prefix: 'automod_' });
 | 
					prom.collectDefaultMetrics({ prefix: 'automod_' });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const metrics = {
 | 
					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' }),
 | 
					    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' }),
 | 
					    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' }),
 | 
					    msgPing: new prom.Gauge({ name: 'msg_ping', help: 'Amount of time it takes for the bot to send a message' }),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue