Class MetricsUtils


  • public final class MetricsUtils
    extends java.lang.Object
    Utility methods for metrics.
    Since:
    3.1.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addFailureTagsWithException​(java.util.Set<io.micrometer.core.instrument.Tag> tags, java.lang.Throwable throwable)
      Convenience method to add failure status and exception cause to an existing set of tags.
      static void addSuccessTags​(java.util.Set<io.micrometer.core.instrument.Tag> tags)
      Convenience method to add success tag to an existing set of tags.
      static java.util.Set<io.micrometer.core.instrument.Tag> newFailureTagsSetForException​(java.lang.Throwable t)
      Convenience method that creates a tag set pre-populated with failure status and exception details.
      static java.util.Set<io.micrometer.core.instrument.Tag> newSuccessTagsSet()
      Convenience method that creates a tag set pre-populated with success status.
      • Methods inherited from class java.lang.Object

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

      • newSuccessTagsSet

        public static java.util.Set<io.micrometer.core.instrument.Tag> newSuccessTagsSet()
        Convenience method that creates a tag set pre-populated with success status.
        Returns:
        a new set containing success tags
      • addSuccessTags

        public static void addSuccessTags​(java.util.Set<io.micrometer.core.instrument.Tag> tags)
        Convenience method to add success tag to an existing set of tags.
        Parameters:
        tags - the set of tags to add success tags to
      • newFailureTagsSetForException

        public static java.util.Set<io.micrometer.core.instrument.Tag> newFailureTagsSetForException​(java.lang.Throwable t)
        Convenience method that creates a tag set pre-populated with failure status and exception details.
        Parameters:
        t - the exception
        Returns:
        a new set containing failure tags
      • addFailureTagsWithException

        public static void addFailureTagsWithException​(java.util.Set<io.micrometer.core.instrument.Tag> tags,
                                                       java.lang.Throwable throwable)
        Convenience method to add failure status and exception cause to an existing set of tags.
        Parameters:
        tags - the set of existing tags
        throwable - the exception to be tagged