metrics: scope metrics to active config, add optional per-host metrics#6531
metrics: scope metrics to active config, add optional per-host metrics#6531mholt merged 15 commits intocaddyserver:masterfrom
Conversation
Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>
Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>
|
I don't fully understand the metrics aspects, but if this works, that's big if true, yeah? I will defer to others more proficient with the metrics libs, but if it works and doesn't cause significant regressions in performance, LGTM. |
There may be a small uptick in memory utilization, but should be negligible according to the discussion on #4644 (comment). I don't expect the code to be any slower than what's currently experienced in #4644. |
mholt
left a comment
There was a problem hiding this comment.
Okay. Well I'm approving for the sake of "let's try it" -- not in the sense of "I have read and understand exactly what this is doing" 😅
When someone else with more knowledge approves, then we can merge it in 👍
hairyhenderson
left a comment
There was a problem hiding this comment.
I've tested this locally and there are still references to the default registry, especially see https://github.com/caddyserver/caddy/blob/master/modules/metrics/metrics.go#L111 - the effect is that the /metrics endpoint on the admin port exposes the default metrics registered there (Go runtime metrics, for example), but none of the Caddy metrics
Co-Authored-By: Dave Henderson <dhenderson@gmail.com>
Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>
|
I'm checking out the 2.9.0 beta and I noticed that there aren't any of the Go or process metrics exposed ( |
I don't think that collector was ever used before. Why'd you assume it's included? |
|
I saw the metrics before in v2.8.4. Things like |
Ah, I'll fix it shortly. Thanks for the catch and the heads up! |
caddyserver#6531) * Add per host config * Pass host label when option is enabled * Test per host enabled * metrics: scope metrics per loaded config * doc and linter Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com> * inject the custom registry into the admin handler Co-Authored-By: Dave Henderson <dhenderson@gmail.com> * remove `TODO` comment * fixes Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com> * refactor to delay metrics admin handler provision Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com> --------- Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com> Co-authored-by: Hussam Almarzooq <me@hussam.io> Co-authored-by: Dave Henderson <dhenderson@gmail.com>
This PR builds atop @hussam-almarzoq's work in PR #6279, addresses the comments, and scopes the metrics per active config. The admin metrics are retained and not reset per config reload because they're instance/process-oriented. The HTTP metrics are reset at config reload, mostly because it's hard to know the diff to add/remove at reload, especially because radical config change may render previous metrics meaningless.
This also adds 2 more metrics:
caddy_config_last_reload_success_timestamp_seconds: records the timestamp of the last successful loadcaddy_config_last_reload_successful: records whether the last config load was successful or notSupersede #6279
Closes #3784