Package io.smallrye.metrics
Class SharedMetricRegistries
- java.lang.Object
-
- io.smallrye.metrics.SharedMetricRegistries
-
public class SharedMetricRegistries extends Object
SharedMetricRegistries is used to create/retrieve a MicroProfile Metric's MetricRegistry instance of a provided scope. For each "scope" there exists an individual MicroProfile Metric MetricRegistry which is associated to an single "underlying" Micrometer MeterRegistry that is registered to the Micrometer global registry. This is either a Prometheus MeterRegistry or a "simple" MeterRegistry. By default, it is the Prometheus MeterRegistry unless the MP Config "mp.metrics.prometheus.enabled" is set to false. In which case the simple MeterRegistry is used. Alternatively, if the Prometheus MeterRegistry is not detected on the classpath the simple Meter Registry will be used.
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringGLOBAL_TAG_MALFORMED_EXCEPTIONprotected static StringGLOBAL_TAGS_VARIABLE
-
Constructor Summary
Constructors Constructor Description SharedMetricRegistries()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleandoesScopeExist(String scope)Returns true/false if registry with this scope existsstatic voiddrop(String scope)Drops a particular registry.static voiddropAll()Drops all registries.static org.eclipse.microprofile.metrics.MetricRegistrygetOrCreate(String scope)static org.eclipse.microprofile.metrics.MetricRegistrygetOrCreate(String scope, ApplicationNameResolver anr)static Set<String>getRegistryScopeNames()static voidsetAppNameResolver(ApplicationNameResolver anr)
-
-
-
Field Detail
-
GLOBAL_TAG_MALFORMED_EXCEPTION
protected static final String GLOBAL_TAG_MALFORMED_EXCEPTION
- See Also:
- Constant Field Values
-
GLOBAL_TAGS_VARIABLE
protected static final String GLOBAL_TAGS_VARIABLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setAppNameResolver
public static void setAppNameResolver(ApplicationNameResolver anr)
-
getOrCreate
public static org.eclipse.microprofile.metrics.MetricRegistry getOrCreate(String scope)
-
getOrCreate
public static org.eclipse.microprofile.metrics.MetricRegistry getOrCreate(String scope, ApplicationNameResolver anr)
-
drop
public static void drop(String scope)
Drops a particular registry. If a reference to the same registry type is requested later, a new empty registry will be created for that purpose.- Parameters:
scope- The scope of registry that should be dropped.
-
dropAll
public static void dropAll()
Drops all registries. If a reference to a registry is requested later, a new empty registry will be created for that purpose.
-
doesScopeExist
public static boolean doesScopeExist(String scope)
Returns true/false if registry with this scope exists- Parameters:
scope- name of scope- Returns:
- true/false if registry with this scope exists
-
-