Class RegistryFactory


  • public final class RegistryFactory
    extends Object
    Access point to all registries. There are two options to use the factory:
    1. A singleton instance, obtained through getInstance() or getInstance(io.helidon.config.Config). This instance is lazily initialized - the latest call that provides a config instance before a MetricRegistry.Type.BASE registry is obtained would be used to configure the base registry (as that is the only configurable registry in current implementation)
    2. A custom instance, obtained through create(Config) or create(). 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 Detail

      • create

        public static RegistryFactory create()
        Create a new factory with default configuration, with pre-filled MetricRegistry.Type.VENDOR and MetricRegistry.Type.BASE metrics.
        Returns:
        a new registry factory
      • create

        public static RegistryFactory create​(Config config)
        Create a new factory with provided configuration, with pre filled MetricRegistry.Type.VENDOR and MetricRegistry.Type.BASE metrics.
        Parameters:
        config - configuration to use
        Returns:
        a new registry factory
      • 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 org.eclipse.microprofile.metrics.MetricRegistry getRegistry​(org.eclipse.microprofile.metrics.MetricRegistry.Type type)
        Get a registry based on its type. For MetricRegistry.Type.APPLICATION and MetricRegistry.Type.VENDOR returns a modifiable registry, for MetricRegistry.Type.BASE returns a final registry (cannot register new metrics).
        Parameters:
        type - type of registry
        Returns:
        MetricRegistry for the type defined.