[FLINK-40208] Add JobMdcRegistry for config-driven MDC enrichment - #28799
Merged
Conversation
Izeren
marked this pull request as ready for review
July 22, 2026 10:26
Collaborator
Izeren
force-pushed
the
FLINK-40208/job-mdc-registry
branch
from
July 23, 2026 08:53
cc38d54 to
ef23cd8
Compare
rkhachatryan
approved these changes
Jul 27, 2026
rkhachatryan
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the PR, LGTM!
I have a couple of NITs;
Plus I think it now deserves a documentation page somewhere under Operations (near https://nightlies.apache.org/flink/flink-docs-release-2.3/docs/ops/metrics/ ).
I'd prefer it to be a follow-up PR under the same ticket though.
WDYT?
Izeren
force-pushed
the
FLINK-40208/job-mdc-registry
branch
from
July 29, 2026 15:46
ef23cd8 to
f008ef4
Compare
Introduce JobMdcRegistry, a process-wide registry mapping JobID to an enriched MDC context built from job configuration. Add MdcOptions with the mdc.job-configuration-to-mdc-keys config option (@PublicEvolving). Wire in mdc enrichment on the job/task submission paths. Generated-by: Claude Code
Generated-by: Claude Code
Izeren
force-pushed
the
FLINK-40208/job-mdc-registry
branch
from
July 29, 2026 21:06
f008ef4 to
a3cd0e2
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.
What is the purpose of the change
Add
JobMdcRegistry, a process-wide registry that mapsJobIDto an enriched MDC context derived from job configuration. This enables operators to surface custom job config values (e.g. org ID, environment) in Flink's JVM logs via MDC.Brief change log
MdcOptionswithmdc.job-configuration-to-mdc-keys(Map<String,String>) config optionJobMdcRegistry: static registry populated inDispatcherandTaskExecutorMdcUtils.asContextData(JobID)to consult the registry before falling back to the plain job-id singletonJobIDLoggingITCase.testEnrichedMdcLoggingto verify enriched keys appear in log outputVerifying this change
This change added tests and can be verified as follows:
JobMdcRegistryTestcovering register, overwrite, unregister, and isolation between jobsMdcUtilsTestwith parameterized tests for config extraction and registry-first lookupJobIDLoggingITCase.testEnrichedMdcLoggingas an end-to-end integration testDoes this pull request potentially affect one of the following parts:
@Public(Evolving): yes (MdcOptionsis@PublicEvolving)Documentation
ConfigOptionWas generative AI tooling used to co-author this PR?
Generated-by: Claude Code