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

[Hotfix][Zeta][Log] Fix zeta parallelStream log trace for job #8456

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

hailin0
Copy link
Member

@hailin0 hailin0 commented Jan 5, 2025

Purpose of this pull request

[Zeta][Log] Fix zeta parallelStream log trace for job

Fix #8206

Does this PR introduce any user-facing change?

No

How was this patch tested?

Added
https://github.com/apache/seatunnel/pull/8456/files#diff-40f618a095529aee401bc1ec6f27e378dac5a93d606136cc40d819afae47ec6eR212

Check list

return new MDCStream<>(context, delegate.filter(new MDCPredicate<>(context, predicate)));
return new MDCStream<>(
context,
delegate.filter(new MDCPredicate<>(() -> MDCContext.of(context), predicate)));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because element iteration caused repeated execution, it was changed to lazy initialization.

@@ -169,58 +171,70 @@ public void testMDCTracedStream() throws Exception {
Assertions.assertNull(MDC.get(MDCContext.PIPELINE_ID));
Assertions.assertNull(MDC.get(MDCContext.TASK_ID));

tracedStream = MDCTracer.tracing(mdcContext, Arrays.asList(1, 2, 3).stream());
try (MDCContext ignored = MDCContext.of(1, 2, 3).activate()) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add testcase

@@ -44,55 +59,20 @@ public class MDCContext implements Serializable {
private final Long jobId;
private final Long pipelineId;
private final Long taskId;
private transient volatile MDCContext toRestore;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cache parent context

Hisoka-X
Hisoka-X previously approved these changes Jan 6, 2025
@hailin0 hailin0 merged commit adb656e into apache:dev Jan 7, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants