feat(gcp): move TraceSampledMdcHandler into spring-boot-autoconfigure-gcp - #453
Merged
skjolber merged 1 commit intoAug 15, 2026
Conversation
…th @AutoConfigureAfter and class-level conditions Co-authored-by: skjolber <1031478+skjolber@users.noreply.github.com>
Copilot
AI
changed the title
feat: move TraceSampledMdcHandler to spring-boot-autoconfigure-gcp (stacked on #450)
feat(gcp): move TraceSampledMdcHandler into spring-boot-autoconfigure-gcp
Aug 15, 2026
Copilot created this pull request from a session on behalf of
skjolber
August 15, 2026 10:47
View session
skjolber
marked this pull request as ready for review
August 15, 2026 14:40
skjolber
deleted the
copilot/move-tracesampledmdchandler-to-spring-boot-autocon
branch
August 15, 2026 14:40
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.
TraceSampledMdcHandlerwas hand-wired in the OTel-starter example'sLogConfiguration, requiring every consumer to copy-paste it. Move it into the autoconfigure module so it is provided automatically.Changes
gcp/spring-boot-autoconfigure-gcpTraceSampledMdcHandler— writestraceSampledMDC key consumed byStackdriverMicrometerTraceMdcJsonProvider→logging.googleapis.com/trace_sampledGcpMicrometerTraceAutoConfiguration— both suppression conditions applied at class level so the entire configuration is skipped as a unit:@ConditionalOnClass(Tracer.class)— no-op whenmicrometer-tracingis absent@Conditional(NoOpenTelemetryAgentCondition.class)— no-op when OTel Java agent is attached (agent owns MDC)@AutoConfiguration(afterName = "...TracingAutoConfiguration")—Tracerbean is resolved before this config is processedio.micrometer:micrometer-tracingadded ascompileOnly(not propagated to consumers)AutoConfiguration.importsexamples/gcp-web-without-test-artifacts-otel-starter-exampleTraceSampledMdcHandlerbean and its imports fromLogConfigurationexamples/gcp-web-without-test-artifacts-otel-agent-exampleTraceSampledMdcHandlerAbsenceTest— assertstraceSampledMdcHandlerbean is absent when agent is active (uses name-based lookup;micrometer-tracingis not on this module's classpath)