Repository navigation
fix(otel-plugin): clear MDC spanId when an attempt ends in ExecutionOtelPlugin - #896
Merged
Merged
Conversation
…telPlugin Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Alex Castillo <alex.castillog33@gmail.com>
pcbeingused333
deployed
to
ai-pr-review-runtime
November 19, 2026 12:12 — with
GitHub Actions
Active
zhongkechen
reviewed
Nov 19, 2026
Contributor
Author
This comment was drafted with Claude Code. |
zhongkechen
approved these changes
Nov 19, 2026
Contributor
|
@pcbeingused333 Thank you for your contribution. Approved. |
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.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue Link, if available
Fixes #815
Description
ExecutionOtelPlugin.onUserFunctionEndclosed the attempt scope but left thespanIdMDC key set.onUserFunctionStartinjectstraceId,spanIdandotelTraceSampled, so after an attempt ended, handler-level log lines between steps carried thespanIdof the finished attempt.InvocationOtelPlugin.onUserFunctionEndalready removesspanIdthere and keepstraceId; this makesExecutionOtelPlugindo the same (guarded byenableMdc).Regression test (rule 5):
ExecutionOtelPluginTest.onUserFunctionEnd_withMdcEnabled_clearsSpanIdButKeepsTraceIdfails on currentmain(spanId should be cleared after the attempt ends) and passes with this change.Demo/Screenshots
Not applicable.
Design
InvocationOtelPluginalready has.onUserFunctionEndinExecutionOtelPluginnever touched the MDC.Assumptions
traceIdandotelTraceSampledshould persist between steps, as inInvocationOtelPlugin. Evidence:MdcSpanEnricherTest.plugin_withMdcEnabled_setsFieldsInMdc.Decisions not covered by the issue or the design note
Checklist
Testing
Unit Tests
Yes:
ExecutionOtelPluginTest.onUserFunctionEnd_withMdcEnabled_clearsSpanIdButKeepsTraceId(MDC enabled;spanIdremoved after the attempt ends,traceIdkept until the invocation ends).mvn -pl otel-plugin -am test -Dtest=ExecutionOtelPluginTestpasses.Integration Tests
No: isolated bug fix fully covered by the unit test (CONTRIBUTING step 3).
Examples
Not applicable.
Disclosure
This change was prepared with the help of an AI coding assistant (Claude). The code and tests were run locally; the final diff is submitted for maintainer review.