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

Conversation

wishdev
Copy link

@wishdev wishdev commented Jan 3, 2024

⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules:
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma

Tick the checkbox if you understand [x]:

  • I have read and understand the pull request rules.

Description

Fixes #2946
The push style of monitor was returning prior to update prometheus which did not allow it to get on the /metrics endpoint.

Type of change

Please delete any options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • My code follows the style guidelines of this project
  • I ran ESLint and other linters for modified files
  • I have performed a self-review of my own code and tested it
  • I have commented my code, particularly in hard-to-understand areas (including JSDoc for methods)
  • My changes generates no new warnings
  • My code needed automated testing. I have added them (this is optional task)

Screenshots (if any)

Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.


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.

@CommanderStorm CommanderStorm added the question Further information is requested label Jan 5, 2024
@CommanderStorm CommanderStorm changed the title Fix #2946 - allow push monitors to update prometheus allow push monitors to update prometheus Jan 5, 2024
@CommanderStorm CommanderStorm added the area:core issues describing changes to the core of uptime kuma label Jan 5, 2024
@CommanderStorm CommanderStorm added area:metrics related to monitoring metrics pr:please address review comments this PR needs a bit more work to be mergable and removed question Further information is requested labels May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core issues describing changes to the core of uptime kuma area:metrics related to monitoring metrics pr:please address review comments this PR needs a bit more work to be mergable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Push monitors do not show up in /metrics when online
4 participants