Class MicrometerHolder


  • public final class MicrometerHolder
    extends java.lang.Object
    A wrapper for micrometer timers when available on the class path.
    Since:
    2.5
    Author:
    Gary Russell
    • Constructor Summary

      Constructors 
      Constructor Description
      MicrometerHolder​(org.springframework.context.ApplicationContext context, java.lang.String name, java.lang.String timerName, java.lang.String timerDesc, java.util.Map<java.lang.String,​java.lang.String> tags)
      Create an instance with the provided properties.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void destroy()
      Remove the timers.
      void failure​(java.lang.Object sample, java.lang.String exception)
      Record failure.
      java.lang.Object start()
      Start the timer.
      void success​(java.lang.Object sample)
      Record success.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MicrometerHolder

        public MicrometerHolder​(@Nullable
                                org.springframework.context.ApplicationContext context,
                                java.lang.String name,
                                java.lang.String timerName,
                                java.lang.String timerDesc,
                                java.util.Map<java.lang.String,​java.lang.String> tags)
        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.
        tags - additional tags.
    • Method Detail

      • start

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

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

        public void failure​(java.lang.Object sample,
                            java.lang.String exception)
        Record failure.
        Parameters:
        sample - the sample.
        exception - the exception name.
        See Also:
        start()
      • destroy

        public void destroy()
        Remove the timers.