Skip to content
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

Is there a way to pass a context across the layers? #18

Open
jcchavezs opened this issue Jan 23, 2020 · 2 comments
Open

Is there a way to pass a context across the layers? #18

jcchavezs opened this issue Jan 23, 2020 · 2 comments

Comments

@jcchavezs
Copy link

Use case:

I want to introduce distributed tracing to my service. The main issue is that on every request I need to hold a context where I can store information provided by every layer (every layer is going to contribute to the distributed trace).

Problem:

The main issue is that most implementations for distributes tracing hold that context in a global state. This is not an issue for traditional web servers because every request happens in a execution where the global state is local to the request. When having async in place the problem is that the global state is share across the requests. Other languages (like golang for example) solve this by having a context object that can be passed from the controller to the all the involved entities (application service, domain service, repository, etc.) and that works because is a standard object part of the standard library.

Do you have any idea on how can this be addressed?

@mmoreram
Copy link
Member

Hello @jcchavezs

Let's think a solution for this.
Thanks for taking care of that :D

@mmoreram
Copy link
Member

A PR is presented here - #19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants