Skip to content

Context forking hook where context can be manipulated #10691

Answered by laurit
adinauer asked this question in Q&A
Discussion options

You must be logged in to vote

Ideally we'd be interested not only in context.makeCurrent() but also in things like Context.with(...) which I call context forking (as opposed to context storing).

you can probably do this when you provide your own ContextStorage and override https://github.com/open-telemetry/opentelemetry-java/blob/62a4810145eec10abda6b023a70f7e9252ca217c/context/src/main/java/io/opentelemetry/context/ContextStorage.java#L112 then you can return a custom Context that can track calls to with.

We believe that creating a new Context without making it the current one is more of a power user thing where they choose to manage context themselves. If a user does that their modified Context also shouldn't be …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@adinauer
Comment options

@laurit
Comment options

Answer selected by adinauer
@adinauer
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants