Package io.helidon.metrics
Class RegistryFactory
- java.lang.Object
-
- io.helidon.metrics.RegistryFactory
-
- All Implemented Interfaces:
io.helidon.common.metrics.InternalBridge.MetricRegistry.RegistryFactory
public final class RegistryFactory extends Object implements io.helidon.common.metrics.InternalBridge.MetricRegistry.RegistryFactory
Access point to all registries. There are two options to use the factory:- A singleton instance, obtained through
getInstance()
orgetInstance(io.helidon.config.Config)
. This instance is lazily initialized - the latest call that provides a config instance before aMetricRegistry.Type.BASE
registry is obtained would be used to configure the base registry (as that is the only configurable registry in current implementation) - A custom instance, obtained through
create(Config)
orcreate()
. This would create a new instance of a registry factory (in case multiple instances are desired), independent on the singleton instance and on other instances provided by these methods.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static RegistryFactory
create()
Create a new factory with default configuration, with pre-filledMetricRegistry.Type.VENDOR
andMetricRegistry.Type.BASE
metrics.static RegistryFactory
create(Config config)
Create a new factory with provided configuration, with pre filledMetricRegistry.Type.VENDOR
andMetricRegistry.Type.BASE
metrics.static RegistryFactory
createSeFactory(Config config)
Deprecated.usecreate()
orcreate(io.helidon.config.Config)
instead when a new registry factory instance is needed.io.helidon.common.metrics.InternalBridge.MetricRegistry
getBridgeRegistry(MetricRegistry.Type type)
Returns the MicroProfile metricMetricRegistry
of the indicated registry type typed as the internal abstraction.static RegistryFactory
getInstance()
Get a singleton instance of the registry factory.static RegistryFactory
getInstance(Config config)
Get a singleton instance of the registry factory for and update it with provided configuration.MetricRegistry
getRegistry(MetricRegistry.Type type)
Get a registry based on its type.static Supplier<RegistryFactory>
getRegistryFactory()
Deprecated.useRegistryFactory::getInstance
instead.
-
-
-
Method Detail
-
create
public static RegistryFactory create()
Create a new factory with default configuration, with pre-filledMetricRegistry.Type.VENDOR
andMetricRegistry.Type.BASE
metrics.- Returns:
- a new registry factory
-
create
public static RegistryFactory create(Config config)
Create a new factory with provided configuration, with pre filledMetricRegistry.Type.VENDOR
andMetricRegistry.Type.BASE
metrics.- Parameters:
config
- configuration to use- Returns:
- a new registry factory
-
getRegistryFactory
@Deprecated public static Supplier<RegistryFactory> getRegistryFactory()
Deprecated.useRegistryFactory::getInstance
instead.Get a supplier for registry factory. The supplier will return the singleton isntance that is created.- Returns:
- supplier of registry factory (to bind as late as possible)
-
createSeFactory
@Deprecated public static RegistryFactory createSeFactory(Config config)
Deprecated.usecreate()
orcreate(io.helidon.config.Config)
instead when a new registry factory instance is needed. UsegetInstance()
orgetInstance(io.helidon.config.Config)
to retrieve the shared (singleton) instance.Create a registry factory for systems without CDI.- Parameters:
config
- configuration to load the factory config from- Returns:
- a new registry factory to obtain application registry (and other registries)
-
getInstance
public static RegistryFactory getInstance()
Get a singleton instance of the registry factory.- Returns:
- registry factory singleton
-
getInstance
public static RegistryFactory getInstance(Config config)
Get a singleton instance of the registry factory for and update it with provided configuration. Note that the config is used only if nobody access the base registry.- Parameters:
config
- configuration of the registry factory used to update behavior of the instance returned- Returns:
- registry factory singleton
-
getRegistry
public MetricRegistry getRegistry(MetricRegistry.Type type)
Get a registry based on its type. ForMetricRegistry.Type.APPLICATION
andMetricRegistry.Type.VENDOR
returns a modifiable registry, forMetricRegistry.Type.BASE
returns a final registry (cannot register new metrics).- Parameters:
type
- type of registry- Returns:
- MetricRegistry for the type defined.
-
getBridgeRegistry
public io.helidon.common.metrics.InternalBridge.MetricRegistry getBridgeRegistry(MetricRegistry.Type type)
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistry.RegistryFactory
Returns the MicroProfile metricMetricRegistry
of the indicated registry type typed as the internal abstraction.- Specified by:
getBridgeRegistry
in interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry.RegistryFactory
- Parameters:
type
- registry type selected- Returns:
MetricRegistry
of the selected type
-
-