Package io.dropwizard.metrics5
Class SharedMetricRegistries
- java.lang.Object
-
- io.dropwizard.metrics5.SharedMetricRegistries
-
public class SharedMetricRegistries extends Object
A map of shared, named metric registries.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MetricRegistryadd(String name, MetricRegistry registry)static voidclear()static MetricRegistrygetDefault()Gets the name of the default registry, if it has been setstatic MetricRegistrygetOrCreate(String name)static Set<String>names()static voidremove(String key)static MetricRegistrysetDefault(String name)Creates a new registry and sets it as the default one under the provided name.static MetricRegistrysetDefault(String name, MetricRegistry metricRegistry)Sets the provided registry as the default one under the provided namestatic MetricRegistrytryGetDefault()Same asgetDefault()except returns null when the default registry has not been set.
-
-
-
Method Detail
-
clear
public static void clear()
-
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 namemetricRegistry- 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 asgetDefault()except returns null when the default registry has not been set.- Returns:
- the default registry or null
-
-