diff --git a/src/modules/prometheus.ts b/src/modules/prometheus.ts index bb38146..b54584a 100644 --- a/src/modules/prometheus.ts +++ b/src/modules/prometheus.ts @@ -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(); + } } diff --git a/src/utils/errorHandler.ts b/src/utils/errorHandler.ts index e49b6ba..ae6a50a 100644 --- a/src/utils/errorHandler.ts +++ b/src/utils/errorHandler.ts @@ -37,5 +37,6 @@ export const errorHandler = async ( username: bot.user?.username ?? "Mod bot" }); } + bot.analytics.errorHandled(); return id; };