Class DefaultMeterObservationHandler
java.lang.Object
io.micrometer.core.instrument.observation.DefaultMeterObservationHandler
- All Implemented Interfaces:
MeterObservationHandler<io.micrometer.observation.Observation.Context>, io.micrometer.observation.ObservationHandler<io.micrometer.observation.Observation.Context>
public class DefaultMeterObservationHandler
extends Object
implements MeterObservationHandler<io.micrometer.observation.Observation.Context>
Handler for
Timer.Sample and Counter.
WARNING: Since the LongTaskTimer needs to be created in the onStart
method, it can only contain tags that are available by that time. This means that if
you add a lowCardinalityKeyValue after calling start on the
Observation, that KeyValue will not be translated as a Tag on
the LongTaskTimer. Likewise, since the KeyValuesProvider is evaluated
in the stop method of the Observation (after start), those
KeyValue instances will not be used for the LongTaskTimer.- Since:
- 1.10.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumMeter types to ignore.Nested classes/interfaces inherited from interface io.micrometer.observation.ObservationHandler
io.micrometer.observation.ObservationHandler.AllMatchingCompositeObservationHandler, io.micrometer.observation.ObservationHandler.CompositeObservationHandler, io.micrometer.observation.ObservationHandler.FirstMatchingCompositeObservationHandler -
Constructor Summary
ConstructorsConstructorDescriptionDefaultMeterObservationHandler(MeterRegistry meterRegistry) Creates the handler with the default configuration.DefaultMeterObservationHandler(MeterRegistry meterRegistry, DefaultMeterObservationHandler.IgnoredMeters... metersToIgnore) Creates the handler with the defined IgnoredMeters to use when the handler processes the Observations. -
Method Summary
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MeterObservationHandler
supportsContextMethods inherited from interface io.micrometer.observation.ObservationHandler
onError, onScopeClosed, onScopeOpened, onScopeReset
-
Constructor Details
-
DefaultMeterObservationHandler
Creates the handler with the default configuration.- Parameters:
meterRegistry- the MeterRegistry to use
-
DefaultMeterObservationHandler
public DefaultMeterObservationHandler(MeterRegistry meterRegistry, DefaultMeterObservationHandler.IgnoredMeters... metersToIgnore) Creates the handler with the defined IgnoredMeters to use when the handler processes the Observations.- Parameters:
meterRegistry- the MeterRegistry to usemetersToIgnore- the Meters that should not be created when Observations are handled- Since:
- 1.13.0
-
-
Method Details
-
onStart
public void onStart(io.micrometer.observation.Observation.Context context) - Specified by:
onStartin interfaceio.micrometer.observation.ObservationHandler<io.micrometer.observation.Observation.Context>
-
onStop
public void onStop(io.micrometer.observation.Observation.Context context) - Specified by:
onStopin interfaceio.micrometer.observation.ObservationHandler<io.micrometer.observation.Observation.Context>
-
onEvent
public void onEvent(io.micrometer.observation.Observation.Event event, io.micrometer.observation.Observation.Context context) - Specified by:
onEventin interfaceio.micrometer.observation.ObservationHandler<io.micrometer.observation.Observation.Context>
-