Package io.dropwizard.metrics5
Class SharedMetricRegistries
java.lang.Object
io.dropwizard.metrics5.SharedMetricRegistries
A map of shared, named metric registries.
-
Method Summary
Modifier and TypeMethodDescriptionstatic MetricRegistryadd(String name, MetricRegistry registry) static voidclear()static MetricRegistryGets the name of the default registry, if it has been setstatic MetricRegistrygetOrCreate(String name) names()static voidstatic 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 MetricRegistrySame asgetDefault()except returns null when the default registry has not been set.
-
Method Details
-
clear
public static void clear() -
names
-
remove
-
add
-
getOrCreate
-
setDefault
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
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
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
Same asgetDefault()except returns null when the default registry has not been set.- Returns:
- the default registry or null
-