Package com.codahale.metrics
Class SharedMetricRegistries
- java.lang.Object
-
- com.codahale.metrics.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 MetricRegistry
add(String name, MetricRegistry registry)
static void
clear()
static MetricRegistry
getDefault()
Gets the name of the default registry, if it has been setstatic MetricRegistry
getOrCreate(String name)
static Set<String>
names()
static void
remove(String key)
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
tryGetDefault()
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
-
-