Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip Automatic Context Propagation in special operators #3845

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

chemicL
Copy link
Member

@chemicL chemicL commented Jul 11, 2024

This change should improve performance of Automatic Context Propagation in certain cases when doOnDiscard, onErrorContinue, and onErrorStop are used.

The context-propagation integration requires contextWrite and tap operators to be barriers for restoring ThreadLocal values. Some internal usage of contextWrite does not require us to treat the operators the same way and we can skip the ceremony of restoring ThreadLocal state as we know that no ThreadLocalAccessor can be registered for them. Therefore, a private variant is introduced to avoid unnecessary overhead when not required.

Related #3840

@chemicL chemicL added area/context This issue is related to the Context area/observability labels Jul 11, 2024
@chemicL chemicL added this to the 3.5.20 milestone Jul 11, 2024
@chemicL chemicL self-assigned this Jul 11, 2024
@chemicL chemicL requested a review from a team as a code owner July 11, 2024 15:22
@chemicL chemicL added the type/enhancement A general enhancement label Jul 11, 2024
@chemicL chemicL force-pushed the special-operators-skip-context-propagation branch from 048d8e3 to 9fead48 Compare July 12, 2024 07:31
@chemicL chemicL changed the base branch from 3.5.x to 3.6.x July 12, 2024 07:31
This change should improve performance of Automatic Context Propagation
in certain cases when doOnDiscard, onErrorContinue, and onErrorStop are
used.

The context-propagation integration requires contextWrite and tap
operators to be barriers for restoring ThreadLocal values. Some internal
usage of contextWrite does not require us to treat the operators the
same way and we can skip the ceremony of restoring ThreadLocal state as
we know that no ThreadLocalAccessor can be registered for them.
Therefore, a private variant is introduced to avoid unnecessary overhead
when not required.

Related #3840
@chemicL chemicL force-pushed the special-operators-skip-context-propagation branch from 9fead48 to b125b40 Compare July 12, 2024 07:44
@chemicL chemicL modified the milestones: 3.5.20, 3.6.9 Jul 12, 2024
@chemicL chemicL changed the title Skip Context Propagation in special operators Skip Automatic Context Propagation in special operators Jul 12, 2024
@chemicL chemicL merged commit ebded61 into 3.6.x Jul 12, 2024
8 checks passed
@chemicL chemicL deleted the special-operators-skip-context-propagation branch July 12, 2024 11:51
@chemicL
Copy link
Member Author

chemicL commented Jul 12, 2024

@violetagg thank you for the review!

chemicL added a commit that referenced this pull request Jul 12, 2024
@chemicL chemicL mentioned this pull request Jul 25, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/context This issue is related to the Context area/observability type/enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants