Skip to content

Reactor 3.1: reset schedulers hook in resetOnEachOperator()#18258

Merged
laurit merged 2 commits into
open-telemetry:mainfrom
trask:reactor-schedulers-reset-hook
Apr 28, 2026
Merged

Reactor 3.1: reset schedulers hook in resetOnEachOperator()#18258
laurit merged 2 commits into
open-telemetry:mainfrom
trask:reactor-schedulers-reset-hook

Conversation

@trask
Copy link
Copy Markdown
Member

@trask trask commented Apr 24, 2026

Extracted out of #18254.

ContextPropagationOperator.registerOnEachOperator() installs two things on Reactor:

  1. An onEachOperator hook (for Mono/Flux context propagation), and
  2. A Schedulers.onScheduleHook(...) that wraps every scheduled Runnable with RunnableWrapper so the OpenTelemetry context is captured at schedule time and restored at execution time.

The matching resetOnEachOperator() method was only undoing (1) — it called Hooks.resetOnEachOperator(...) but never called Schedulers.resetOnScheduleHook(...). So after a caller "disabled" the operator, scheduled tasks were still being wrapped with RunnableWrapper, leaking instrumentation behavior into code that had explicitly opted out (and preventing a clean re-register/teardown cycle).

@trask trask force-pushed the reactor-schedulers-reset-hook branch 2 times, most recently from 5affe20 to 1f504b3 Compare April 26, 2026 00:17
Automated code review of instrumentation/reactor/reactor-3.1/library.
@trask trask force-pushed the reactor-schedulers-reset-hook branch from 1f504b3 to 1669bc4 Compare April 26, 2026 00:18
@trask trask marked this pull request as ready for review April 26, 2026 00:18
@trask trask requested a review from a team as a code owner April 26, 2026 00:18
@trask trask force-pushed the reactor-schedulers-reset-hook branch from e11f16f to 4f0779d Compare April 26, 2026 02:51
@laurit laurit merged commit 64fd980 into open-telemetry:main Apr 28, 2026
93 checks passed
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

Successfully merging this pull request may close these issues.

2 participants