[FLINK-40208] Add JobMdcRegistry for config-driven MDC enrichment#28799
Open
Izeren wants to merge 1 commit into
Open
[FLINK-40208] Add JobMdcRegistry for config-driven MDC enrichment#28799Izeren wants to merge 1 commit into
Izeren wants to merge 1 commit into
Conversation
Izeren
marked this pull request as ready for review
July 22, 2026 10:26
Collaborator
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
Izeren
force-pushed
the
FLINK-40208/job-mdc-registry
branch
from
July 23, 2026 08:53
cc38d54 to
ef23cd8
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