You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NullObservation doesn't cause ObservationValidator to fail.
Additional context
The issue is that NullObservation doesn't launch handlers for most events (e.g. start) but it launches handlers for scope opening and closing events. Combined with ObservationValidator being implemented as a handler this always causes NullObservation to trigger a failure.
Ideas, notes
It is crucial that NullObservation doesn't do unnecessary work as it is often on the hot path in reactive chains.
Therefore, perhaps it's worth considering an alternative implementation only created at test runtime which fires up all handlers. That code would need to interact with ObservationThreadLocalAccessor.
Another idea would be to skip validation on NullObservation, e.g. by providing
context -> !"null".equals(context.getName())
as supportsContextPredicate argument to ObservationValidator.
The text was updated successfully, but these errors were encountered:
NullObservation is a special case for context propagation. It's not
fully an Observation since it is only for scope handling which can
happen outside of "normal" Observations, therefore we not necessarily
need to validate it.
Closesmicrometer-metricsgh-5388
Describe the bug
When empty scopes are present thanks to
NullObservation
, the validation withObservationValidator
fails.To Reproduce
micrometer-metrics/tracing#810
Expected behavior
NullObservation
doesn't causeObservationValidator
to fail.Additional context
The issue is that
NullObservation
doesn't launch handlers for most events (e.g. start) but it launches handlers for scope opening and closing events. Combined withObservationValidator
being implemented as a handler this always causesNullObservation
to trigger a failure.Ideas, notes
It is crucial that
NullObservation
doesn't do unnecessary work as it is often on the hot path in reactive chains.Therefore, perhaps it's worth considering an alternative implementation only created at test runtime which fires up all handlers. That code would need to interact with
ObservationThreadLocalAccessor
.Another idea would be to skip validation on
NullObservation
, e.g. by providingas
supportsContextPredicate
argument toObservationValidator
.The text was updated successfully, but these errors were encountered: