close
Skip to content

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

Merged
hailin0 merged 2 commits into
apache:devfrom
hailin0:dev-fix-log
Jan 7, 2025
Merged

[Hotfix][Zeta][Log] Fix zeta parallelStream log trace for job#8456
hailin0 merged 2 commits into
apache:devfrom
hailin0:dev-fix-log

Conversation

@hailin0

@hailin0 hailin0 commented Jan 5, 2025

Copy link
Copy Markdown
Member

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
Copy Markdown
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.

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
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

add testcase

private final Long jobId;
private final Long pipelineId;
private final Long taskId;
private transient volatile MDCContext toRestore;

Copy link
Copy Markdown
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
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