Class SharedMetricRegistries

java.lang.Object
io.dropwizard.metrics5.SharedMetricRegistries

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

    • clear

      public static void clear()
    • names

      public static Set<String> names()
    • remove

      public static void remove(String key)
    • add

      public static MetricRegistry add(String name, MetricRegistry registry)
    • getOrCreate

      public static MetricRegistry getOrCreate(String name)
    • 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