temporalio / sdk-java

Temporal Java SDK
https://temporal.io
Apache License 2.0
221 stars 147 forks source link

Clear MDC context after each Task #2314

Open Quinn-With-Two-Ns opened 1 week ago

Quinn-With-Two-Ns commented 1 week ago

Is your feature request related to a problem? Please describe. Users may set MDC context during activity or nexus task execution and not unset them after the activity code completes. Users may not clear them because they wanted them to be applied to SDK loggers or they just forgot. Since the SDK may use thread pools to execute tasks this risks leaking context between unrelated tasks.

Describe the solution you'd like Automatically clear MDC context after each Task