-
Notifications
You must be signed in to change notification settings - Fork 424
introduces worker name option, use label on worker metrics instead #1376
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
Conversation
|
Couldn't we generate a name using the file path instead? I would like to keep the public API surface as small as possible. |
|
Currently, it just uses the path of the worker as the name. This is probably fine 99% of the time. This is also a change I originally had in the original metrics PR (to make the metrics output prettier) -- the only real usecase here is when you have the same worker script for multiple endpoints (but even that doesn't really make sense IMHO). I'm not really a fan of this approach though; this is much more than just adding support for names and is a pretty major refactor. |
withinboredom
left a comment
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.
This is a good step in the right direction. A couple things:
- it seems to hardcode prometheus as the metrics implementation.
- it may be better to allow dynamically renaming worker names via the admin api -- this would allow decoupling devops (monitoring) from application development, which I am all for.
- it causes a BC break.
| workerCrashes *prometheus.CounterVec | ||
| workerRestarts *prometheus.CounterVec | ||
| workerRequestTime *prometheus.CounterVec | ||
| workerRequestCount *prometheus.CounterVec |
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.
At least until 2.0, we will need to probably support both ways for BC. Otherwise, anyone using the current metrics will have no metrics on the next release.
Ultimately, it's @dunglas's call though.
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.
v1.4.0 was released last month, and since then no metrics, i didn't see anyone raise an issue (it is maybe user who utilizes metrics is in a small percentage or have not upgraded to v1.4) hence i think modifying the metrics quite safe, i know in semver it is BC break
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.
That is a fair assessment. :)
We should probably update the documentation in this PR too.
At least to make it symlink safe: #1373 (comment) |
It doesn't actually read the files, so symlinks don't matter (so long as Frankenphp is consistently using the same path). It's just the only key available. |
Of course I know this and there is no reason the read the files. But as you see here: #1373 (comment), there was an issue. In case I ever find time again to check it, I will deep dive into it, but something like this was the case. One of the both paths must have been resolved otherwise the comparision would match and it would have been working without any issues in first place. |
|
Maybe should we just resolve the worker path early to prevent this issue. |
I just tested it again and as I received the So yes, resolving the worker paths from symlink to the actual one on the start must be the solution. 👍 |
|
the initial idea was to link Caddy metrics and FrankenPHP metrics Caddy generates metrics and FrankenPHP generates metrics so in grafana, i can select 1 label all the related metrics will be displayed.
@withinboredom, i have limited knowledge about Caddy. for my knowledge, Can admin API change variable value or do we still need to expose the config and then admin api modify the config? |
|
Ok interesting, why not then. |
withinboredom
left a comment
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.
ok ... I'm tentatively approving this one. Let's wait until #1266 is merged and then we can see what we need to change here -- if anything.
|
this PR should be ready for review |
|
@IndraGunawan can you rebase this to fix the conflicts? |
| # TYPE frankenphp_busy_threads gauge | ||
| frankenphp_busy_threads 2 | ||
| # HELP frankenphp_testdata_index_php_busy_workers Number of busy PHP workers for this worker |
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.
Maybe could you keep the old test as is to ensure that there is no breaking change?
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.
@withinboredom has concerns about this as well #1376 (comment)
|
Thank you! |
this PR introduces a new optional
nameconfig underfrankenphp.workerthis change is inspired by Caddy server name (https://caddyserver.com/docs/caddyfile/options#name), and thisnameconfig will be used in metrics and logs related to workeras this config is optional, the default value is
worker.filethis also changes the metrics from
frankenphp_{worker.file}_worker_request_counttofrankenphp_worker_request_count{name="worker.name"}, by changing the metrics name for each worker to use label, it can use the same visualization dashboard for multiple apps