Skip to content

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

@jcchavezs

Description

@jcchavezs

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions