Skip to content

Fix the tracing example in the reference documentation - #5476

Open
benelog wants to merge 1 commit into
spring-projects:mainfrom
benelog:GH-5475
Open

Fix the tracing example in the reference documentation#5476
benelog wants to merge 1 commit into
spring-projects:mainfrom
benelog:GH-5475

Conversation

@benelog

@benelog benelog commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Resolves #5475

The example now registers a DefaultTracingObservationHandler, and the sentence above it no longer presents TracingAwareMeterObservationHandler as a handler that supports tracing on its own.

I kept the metrics handler in the example rather than replacing it, because both sections define a bean named observationRegistry: a tracing-only snippet here would quietly drop the metrics from the section above. Happy to reduce it to the tracing handler alone if you prefer the shorter example.

Handler order is not a requirement, the reversed order produced the same spans and meters, but I registered the tracing handler first to match TracingAndMeterObservationHandlerGroup in Spring Boot.

The Tracing section presented TracingAwareMeterObservationHandler as an
ObservationHandler that supports tracing. That handler does not create spans:
it wraps a MeterObservationHandler to make tracing data available to it.
Registering it alone, as the example did, creates no span and fails the job,
because its onStop requires a TracingContext that only a
TracingObservationHandler puts into the observation context.

The example now registers a DefaultTracingObservationHandler next to the
metrics handler, so the same registry collects both metrics and traces, and a
note explains what the wrapper is for.

Resolves spring-projects#5475

Signed-off-by: Sanghyuk Jung <sanghyuk.jung@navercorp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reference documentation's tracing example registers a handler that creates no spans and fails the job

1 participant