fix(otel): ExtendedTask's otel enabled status set during init#4334
Merged
fix(otel): ExtendedTask's otel enabled status set during init#4334
Conversation
Collaborator
Author
|
Debugged IRL w/ @elnelson575 |
a4f2d59 to
194685c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes how
ExtendedTaskdetermines whether to record OpenTelemetry spans. Previously,ExtendedTaskchecked the OpenTelemetry collection state atinvoke()time, which could lead to inconsistent behavior. Now, the OTel recording state is captured when theExtendedTaskis initialized (new()), ensuring consistent span recording behavior regardless of runtime configuration changes.Changes
ExtendedTasknow captures theis_recording_otelflag at initialization time rather than checking at invocation timetest-otel-extended-task.Rwith 219 lines of tests covering various OTel collection scenariosExtendedTaskdocumentation explaining the initialization-time behaviorhelper-otel.Rfor reuse across test filesTechnical Details
The key change is in
R/extended-task.R:169-170, whereprivate$is_recording_otelis now set during initialization:And at invocation time in
R/extended-task.R:204, we now check the captured value:Test Coverage
New tests verify:
all,reactivity,session,none)is_recording_otelisTRUE