Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Multiple Context objects vs using named context #126

Closed
@toumorokoshi

Description

@toumorokoshi

I was working through #89, which enabled formatters to directly read and write to context objects. One aspect there is that this requires a standard way to set and get context values within a specific namespace.

There are two examples which use that today: DistributedContextManager and Tracer. Both use the Context object under the hood, and allow the passing of a name to access the specific context.

If a user wants to pair the DistributedContext and Tracer, that would require them to create one of each with the same name. This pattern will have to be applied to every unit test that needs to work with one of these contexts.

Instead, I propose the creation of multiple Context objects. Tracers and DistributedContextManager could consume a context object. This simplifies unit testing and also allows one to have a complete context object that could be passed into propagators.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiAffects the API package.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions