Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow push monitors to update prometheus #4318

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions server/model/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,10 @@ class Monitor extends BeanModel {
retries = 0;
log.debug("monitor", `[${this.name}] timeout = ${timeout}`);
this.heartbeatInterval = setTimeout(safeBeat, timeout);

bean.status = UP;
this.prometheus?.update(bean, tlsInfo);

return;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure if this return statement is correct in the first place.
This shortcuts a lot of logic, for example
https://github.com/louislam/uptime-kuma/blame/0060e46b91b108c6960858e12da5c2f312437a1b/server/model/monitor.js#L979

CC @kaysond you added this in #1428

I dont quite get why No need to insert successful heartbeat for push type, so end here. Could you explain this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't actually add it, just moved it. See: https://github.com/louislam/uptime-kuma/pull/1428/files

But I think it's there because for push type monitors, the API call to the push URL adds the heartbeat to the DB. There's no need for the monitor to add the heartbeat, so everything else is skipped on purpose

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case maybe we should update the Prometheus metrics in the push route handler instead.

}
} else {
Expand Down