-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Extend Prometheus Labels to include tags (requires restart for NEW labels on the monitor to be visible) #4704
Extend Prometheus Labels to include tags (requires restart for NEW labels on the monitor to be visible) #4704
Conversation
I didn't had time to retest after fixing the merge conflicts... Edit(CommanderStorm):
|
ec822e6
to
78fddc7
Compare
did some basic tests and works for me as expected. After saving, the tags are immediately visible on the |
I also just did, but I cannot reproduce this working. I am missing some part. Mine is:
|
Did the same, but didn't use docker. In the repo and my PR branch |
Yes, master and all further feature development is v2.0 only.
|
Then I can't explain the difference between our both test setup's. 🤔 |
Could reproduce it after fresh config and no data. It's a feature 😉 Needs a server restart for new tag's. Edit: |
3.5 sounds fine by me.. |
Tested it again with the premise of restarting to see the monitor tags:
Looks good to me and works as intended. |
renamed PR in case title finds it's way into the changelogs, so the behaviour is noted there:
|
78fddc7
to
6c21c04
Compare
Hey! Thanks for the MR, that's exactly what I wished to have! 🙏 Is there any chance for this MR to get reviewed? I don't know anything about JS 😓 but I think this MR could be a great addition to the project, since that would help using it better with prometheus/grafana and associated dashboards. Looking forward to it whenever someone have time! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the bugfix/new feature! 🎉
Note
This PR is part of the v2.0
merge window => see #4500 for the bugs that need to be addressed before we can ship this release ^^
All changes in this PR are small and uncontroversial ⇒ merging with junior maintainer approval
@xlr-8 |
Thanks for the heads up, you're right. I've tried now but can't seem to make it work based on your insight and README. I've just:
Whenever going onto the http://0.0.0.0:3001/setup-database, I hit a blank page no matter the browser / private window or not. I don't see much on the network tab either; is there something I'm missing? Perhaps I could help by providing a docker-compose, Makefile or something like this if you judge it relevant ? And thank you for the quick review/merge 🙏 |
Skip the first two lines (the docker image already does that) Thanks for testing this PR. Much appreciated 👍 PS: yea, I know. We should likely redirect users in dev mode when they connect to the API server on the most common route that is only used by the webclient |
@@ -336,7 +336,7 @@ class Monitor extends BeanModel { | |||
let previousBeat = null; | |||
let retries = 0; | |||
|
|||
this.prometheus = new Prometheus(this); | |||
this.prometheus = await Prometheus.createAndInitMetrics(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could possibly throws an exception:
Trace: Error: Invalid label name
at async Proxy.start (C:\Users\louis\Dropbox\My Projects\uptime-kuma\server\model\monitor.js:348:27)
at async startMonitors (C:\Users\louis\Dropbox\My Projects\uptime-kuma\server\server.js:1801:9)
at process.unexpectedErrorHandler (C:\Users\louis\Dropbox\My Projects\uptime-kuma\server\server.js:1855:13)
at process.emit (node:events:520:28)
at emitUnhandledRejection (node:internal/process/promises:250:13)
at throwUnhandledRejectionsMode (node:internal/process/promises:385:19)
at processPromiseRejections (node:internal/process/promises:470:17)
at process.processTicksAndRejections (node:internal/process/task_queues:96:32)
If you keep encountering errors, please report to https://github.com/louislam/uptime-kuma/issues
Actually, I have no idea how to fix #5096, if it is not fixed before 2.0.0-beta.0 release, it will be reverted and postpone to a later version. |
Since Prometheus does only allow ASCII label names (thus handling of the client library is correct) we need to trim these chars out of the labels and only add a label if one is left afterwards. Alternatively, we can just limit ourselves to labels which match the regex |
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]:
Description
adds dynamic prometheus labels
fixes #680
replaces #898
Type of change
Please delete any options that are not relevant.
Checklist
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.