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 Classes
    Modifier and Type
    Class
    Description
    static enum 
    Meter 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

    Constructors
    Constructor
    Description
    Creates the handler with the default configuration.
    Creates the handler with the defined IgnoredMeters to use when the handler processes the Observations.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onEvent(io.micrometer.observation.Observation.Event event, io.micrometer.observation.Observation.Context context)
     
    void
    onStart(io.micrometer.observation.Observation.Context context)
     
    void
    onStop(io.micrometer.observation.Observation.Context context)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface MeterObservationHandler

    supportsContext

    Methods inherited from interface io.micrometer.observation.ObservationHandler

    onError, onScopeClosed, onScopeOpened, onScopeReset
  • Constructor Details

    • DefaultMeterObservationHandler

      public DefaultMeterObservationHandler(MeterRegistry meterRegistry)
      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 use
      metersToIgnore - 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:
      onStart in interface io.micrometer.observation.ObservationHandler<io.micrometer.observation.Observation.Context>
    • onStop

      public void onStop(io.micrometer.observation.Observation.Context context)
      Specified by:
      onStop in interface io.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:
      onEvent in interface io.micrometer.observation.ObservationHandler<io.micrometer.observation.Observation.Context>