Class MicrometerHolder

java.lang.Object
org.springframework.kafka.support.micrometer.MicrometerHolder

public final class MicrometerHolder extends Object
A wrapper for micrometer timers when available on the class path.
Since:
2.5
  • Constructor Details

    • MicrometerHolder

      public MicrometerHolder(@Nullable org.springframework.context.ApplicationContext context, String name, String timerName, String timerDesc, Function<Object,Map<String,String>> tagsProvider)
      Create an instance with the provided properties.
      Parameters:
      context - the application context from which to obtain the meter registry.
      name - the value of the 'name' tag.
      timerName - the timer name.
      timerDesc - the timer description.
      tagsProvider - the tags provider.
      Since:
      2.9.7
  • Method Details

    • start

      public Object start()
      Start the timer.
      Returns:
      the sample.
    • success

      public void success(Object sample)
      Record success.
      Parameters:
      sample - the sample.
      See Also:
    • failure

      public void failure(Object sample, String exception)
      Record failure.
      Parameters:
      sample - the sample.
      exception - the exception name.
      See Also:
    • success

      public void success(Object sample, Object record)
      Record success.
      Parameters:
      sample - the sample.
      record - the consumer record.
      See Also:
    • failure

      public void failure(Object sample, String exception, Object record)
      Record failure.
      Parameters:
      sample - the sample.
      exception - the exception name.
      record - the consumer record.
      See Also:
    • destroy

      public void destroy()
      Remove the timers.