Fix the tracing example in the reference documentation - #5476
Open
benelog wants to merge 1 commit into
Open
Conversation
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>
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.
Resolves #5475
The example now registers a
DefaultTracingObservationHandler, and the sentence above it no longer presentsTracingAwareMeterObservationHandleras 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
TracingAndMeterObservationHandlerGroupin Spring Boot.