feat: also track errors

This commit is contained in:
Naomi Carrigan 2024-08-13 08:40:55 -07:00
parent ebb549953f
commit 623b6a0a83
Signed by: naomi
SSH Key Fingerprint: SHA256:rca1iUI2OhAM6n4FIUaFcZcicmri0jgocqKiTTAfrt8
2 changed files with 10 additions and 0 deletions

View File

@ -8,6 +8,7 @@ export class Prometheus {
private entitled: Gauge;
private commands: Counter;
private users: Gauge;
private errors: Counter;
constructor(bot: ExtendedClient) {
this.guilds = new Gauge({
@ -28,6 +29,10 @@ export class Prometheus {
help: "The number of users the bot knows."
});
this.users.set(bot.users.cache.size);
this.errors = new Counter({
name: "errors",
help: "The number of errors handled by the process."
});
this.client.collectDefaultMetrics();
}
@ -49,4 +54,8 @@ export class Prometheus {
);
this.entitled.set(entitled.size);
}
public errorHandled() {
this.errors.inc();
}
}

View File

@ -37,5 +37,6 @@ export const errorHandler = async (
username: bot.user?.username ?? "Mod bot"
});
}
bot.analytics.errorHandled();
return id;
};