-
Notifications
You must be signed in to change notification settings - Fork 38
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
Keeping state in the lifecycle of a request #70
Comments
This kind of patch is certainly welcome! And I don't know if anyone is working on anything similar currently. I had started a branch (see #44), but abadoned it. It'd be cool to use @tsloughter's ctx, but I don't think we're necessarily married to it, if you have a better, reasoned idea. |
Got it. I'll try to work on a minimal version and submit a pull request for comments. |
For future reference, this kind of feature would break the API. Is this ok ? It feels like it would be quite convoluted to support both the presence and absence of state everywhere. |
We'll need a major version bump then. |
What kind of state? Because with https://github.com/open-telemetry/opentelemetry-erlang we are going with only the process dictionary for context I think we'd do well to define standards and best practices for using the pdict this way. The ctx library may still be of use but I want to switch it to storing stuff in the pdict instead of returning a record. |
I'm having issues keeping state in the lifecycle of a request. More precisely, I'd like to be able to pass data between handlers, and between
init
,preprocess
,handle
andpostprocess
in each handler.It seems to be a common pattern in Erlang to explicitely propagate state, for example in
gen_server
, but it is not the case in elli.#35 suggests that the only way is the process dictionary, but the Erlang website has good arguments not to overuse it (https://www.erlang.org/course/advanced#dict).
Is there anyone currently working on a patch to add an explicit state ? Would this kind of patch be accepted ?
The text was updated successfully, but these errors were encountered: