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 MetricRegistry
add
(String name, MetricRegistry registry) static void
clear()
static MetricRegistry
Gets the name of the default registry, if it has been setstatic MetricRegistry
getOrCreate
(String name) names()
static void
static MetricRegistry
setDefault
(String name) Creates a new registry and sets it as the default one under the provided name.static MetricRegistry
setDefault
(String name, MetricRegistry metricRegistry) Sets the provided registry as the default one under the provided namestatic MetricRegistry
Same 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
-