-
Notifications
You must be signed in to change notification settings - Fork 65
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
Sharing dynamically dispatched registry in web framework state #57
Comments
Good catch. Thanks @sd2k. This is related to #55. E.g. when you wrap the
I would be OK, extending the super trait If you agree, want to provide a patch @sd2k? While wrapping |
This will allow the default `Registry` to be used in multi-threaded environments (e.g. web servers) where the registry needs to be shared between threads. Closes prometheus#57.
This will allow the default `Registry` to be used in multi-threaded environments (e.g. web servers) where the registry needs to be shared between threads. Closes prometheus#57. Signed-off-by: Ben Sully <ben.sully@grafana.com>
This will allow the default `Registry` to be used in multi-threaded environments (e.g. web servers) where a ref to the registry needs to be shared between threads. Closes #57. Signed-off-by: Ben Sully <ben.sully@grafana.com> Signed-off-by: Max Inden <mail@max-inden.de> Co-authored-by: Max Inden <mail@max-inden.de>
Any chance of getting a release with this fix in? It's also biting me on a Rocket project. |
TYVM! |
This will allow the default `Registry` to be used in multi-threaded environments (e.g. web servers) where a ref to the registry needs to be shared between threads. Closes prometheus#57. Signed-off-by: Ben Sully <ben.sully@grafana.com> Signed-off-by: Max Inden <mail@max-inden.de> Co-authored-by: Max Inden <mail@max-inden.de> Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
I may be missing something but it seems like it's not possible to use the
Registry
with the defaultM = SendEncodeMetric
type as shared state in web frameworks (e.g.tide::with_state
), because those require that the state is allSync
butSendEncodeMetric
is notSync
. If I update thetide
example to use a dynamically dispatchedRegistry
then it fails to compile:It's fixed by adding a
Sync
bound toSendEncodeMetric
but it feels like this is a common use case so I imagine it's come up before and I'm doing something silly - am I?Thanks!
The text was updated successfully, but these errors were encountered: