generated from nhcarrigan/template
feat: also track errors
This commit is contained in:
parent
ebb549953f
commit
623b6a0a83
@ -8,6 +8,7 @@ export class Prometheus {
|
|||||||
private entitled: Gauge;
|
private entitled: Gauge;
|
||||||
private commands: Counter;
|
private commands: Counter;
|
||||||
private users: Gauge;
|
private users: Gauge;
|
||||||
|
private errors: Counter;
|
||||||
|
|
||||||
constructor(bot: ExtendedClient) {
|
constructor(bot: ExtendedClient) {
|
||||||
this.guilds = new Gauge({
|
this.guilds = new Gauge({
|
||||||
@ -28,6 +29,10 @@ export class Prometheus {
|
|||||||
help: "The number of users the bot knows."
|
help: "The number of users the bot knows."
|
||||||
});
|
});
|
||||||
this.users.set(bot.users.cache.size);
|
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();
|
this.client.collectDefaultMetrics();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,4 +54,8 @@ export class Prometheus {
|
|||||||
);
|
);
|
||||||
this.entitled.set(entitled.size);
|
this.entitled.set(entitled.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public errorHandled() {
|
||||||
|
this.errors.inc();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,5 +37,6 @@ export const errorHandler = async (
|
|||||||
username: bot.user?.username ?? "Mod bot"
|
username: bot.user?.username ?? "Mod bot"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
bot.analytics.errorHandled();
|
||||||
return id;
|
return id;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user