Class SharedMetricRegistries


  • public class SharedMetricRegistries
    extends Object
    A map of shared, named metric registries.
    • Method Detail

      • clear

        public static void clear()
      • remove

        public static void remove​(String key)
      • setDefault

        public static MetricRegistry setDefault​(String name)
        Creates a new registry and sets it as the default one under the provided name.
        Parameters:
        name - the registry name
        Returns:
        the default registry
        Throws:
        IllegalStateException - if the name has already been set
      • setDefault

        public static MetricRegistry setDefault​(String name,
                                                MetricRegistry metricRegistry)
        Sets the provided registry as the default one under the provided name
        Parameters:
        name - the default registry name
        metricRegistry - the default registry
        Throws:
        IllegalStateException - if the default registry has already been set
      • getDefault

        public static MetricRegistry getDefault()
        Gets the name of the default registry, if it has been set
        Returns:
        the default registry
        Throws:
        IllegalStateException - if the default has not been set
      • tryGetDefault

        public static MetricRegistry tryGetDefault()
        Same as getDefault() except returns null when the default registry has not been set.
        Returns:
        the default registry or null