[Push monitor] Fix: Prometheus update with incorrect value (#6436)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Louis Lam
2025-11-28 20:41:44 +08:00
committed by GitHub
parent 6e49601eed
commit f4ff234ec8
2 changed files with 11 additions and 2 deletions

View File

@@ -359,7 +359,11 @@ class Monitor extends BeanModel {
let previousBeat = null;
let retries = 0;
this.prometheus = new Prometheus(this, await this.getTags());
try {
this.prometheus = new Prometheus(this, await this.getTags());
} catch (e) {
log.error("prometheus", "Please submit an issue to our GitHub repo. Prometheus update error: ", e.message);
}
const beat = async () => {

View File

@@ -119,7 +119,12 @@ router.all("/api/push/:pushToken", async (request, response) => {
io.to(monitor.user_id).emit("heartbeat", bean.toJSON());
Monitor.sendStats(io, monitor.id, monitor.user_id);
new Prometheus(monitor).update(bean, undefined);
try {
new Prometheus(monitor, []).update(bean, undefined);
} catch (e) {
log.error("prometheus", "Please submit an issue to our GitHub repo. Prometheus update error: ", e.message);
}
response.json({
ok: true,