Package io.micrometer.observation
Class ObservationHandler.FirstMatchingCompositeObservationHandler
java.lang.Object
io.micrometer.observation.ObservationHandler.FirstMatchingCompositeObservationHandler
- All Implemented Interfaces:
ObservationHandler<Observation.Context>
,ObservationHandler.CompositeObservationHandler
- Enclosing interface:
ObservationHandler<T extends Observation.Context>
public static class ObservationHandler.FirstMatchingCompositeObservationHandler
extends Object
implements ObservationHandler.CompositeObservationHandler
Handler picking the first matching handler from the list.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micrometer.observation.ObservationHandler
ObservationHandler.AllMatchingCompositeObservationHandler, ObservationHandler.CompositeObservationHandler, ObservationHandler.FirstMatchingCompositeObservationHandler
-
Constructor Summary
ConstructorsConstructorDescriptionFirstMatchingCompositeObservationHandler
(ObservationHandler<? extends Observation.Context>... handlers) Creates a new instance ofFirstMatchingCompositeObservationHandler
.FirstMatchingCompositeObservationHandler
(List<? extends ObservationHandler<? extends Observation.Context>> handlers) Creates a new instance ofFirstMatchingCompositeObservationHandler
. -
Method Summary
Modifier and TypeMethodDescriptionReturns the registered handlers.void
onError
(Observation.Context context) Reacts to an error during anObservation
.void
onEvent
(Observation.Event event, Observation.Context context) Reacts to arbitraryObservation.Event
.void
onScopeClosed
(Observation.Context context) Reacts to closing of anObservation.Scope
.void
onScopeOpened
(Observation.Context context) Reacts to opening of anObservation.Scope
.void
onScopeReset
(Observation.Context context) Reacts to resetting of scopes.void
onStart
(Observation.Context context) Reacts to starting of anObservation
.void
onStop
(Observation.Context context) Reacts to stopping of anObservation
.boolean
supportsContext
(Observation.Context context) Tells the registry whether this handler should be applied for a givenObservation.Context
.
-
Constructor Details
-
FirstMatchingCompositeObservationHandler
@SafeVarargs public FirstMatchingCompositeObservationHandler(ObservationHandler<? extends Observation.Context>... handlers) Creates a new instance ofFirstMatchingCompositeObservationHandler
.- Parameters:
handlers
- the handlers that are registered under the composite
-
FirstMatchingCompositeObservationHandler
public FirstMatchingCompositeObservationHandler(List<? extends ObservationHandler<? extends Observation.Context>> handlers) Creates a new instance ofFirstMatchingCompositeObservationHandler
.- Parameters:
handlers
- the handlers that are registered under the composite
-
-
Method Details
-
getHandlers
Description copied from interface:ObservationHandler.CompositeObservationHandler
Returns the registered handlers.- Specified by:
getHandlers
in interfaceObservationHandler.CompositeObservationHandler
- Returns:
- registered handlers
-
onStart
Description copied from interface:ObservationHandler
Reacts to starting of anObservation
.- Specified by:
onStart
in interfaceObservationHandler<Observation.Context>
- Parameters:
context
- anObservation.Context
-
onError
Description copied from interface:ObservationHandler
Reacts to an error during anObservation
.- Specified by:
onError
in interfaceObservationHandler<Observation.Context>
- Parameters:
context
- anObservation.Context
-
onEvent
Description copied from interface:ObservationHandler
Reacts to arbitraryObservation.Event
.- Specified by:
onEvent
in interfaceObservationHandler<Observation.Context>
- Parameters:
event
- theObservation.Event
that was signaledcontext
- anObservation.Context
-
onScopeOpened
Description copied from interface:ObservationHandler
Reacts to opening of anObservation.Scope
.- Specified by:
onScopeOpened
in interfaceObservationHandler<Observation.Context>
- Parameters:
context
- anObservation.Context
-
onScopeClosed
Description copied from interface:ObservationHandler
Reacts to closing of anObservation.Scope
.- Specified by:
onScopeClosed
in interfaceObservationHandler<Observation.Context>
- Parameters:
context
- anObservation.Context
-
onScopeReset
Description copied from interface:ObservationHandler
Reacts to resetting of scopes. If your handler uses aThreadLocal
value, this method should clear thatThreadLocal
or any other scoped variable.- Specified by:
onScopeReset
in interfaceObservationHandler<Observation.Context>
- Parameters:
context
- anObservation.Context
-
onStop
Description copied from interface:ObservationHandler
Reacts to stopping of anObservation
.- Specified by:
onStop
in interfaceObservationHandler<Observation.Context>
- Parameters:
context
- anObservation.Context
-
supportsContext
Description copied from interface:ObservationHandler
Tells the registry whether this handler should be applied for a givenObservation.Context
.- Specified by:
supportsContext
in interfaceObservationHandler<Observation.Context>
- Parameters:
context
- anObservation.Context
- Returns:
true
when this handler should be used
-