Class MeterRegistryFactory
- java.lang.Object
- 
- io.helidon.integrations.micrometer.MeterRegistryFactory
 
- 
 public final class MeterRegistryFactory extends Object Provides access to theMeterRegistryHelidon SE uses to collect meters and report their metrics.In reality, we use a CompositeMeterRegistryto which we, by default, add aPrometheusMeterRegistryand to which the developer can add, via either configuration or builder, otherMeterRegistryinstances.Using the factoryUse this factory in either of two ways: - 
             Access the singleton instance via getInstance()orgetInstance(Builder). The factory remembers the factory instance, lazily instantiated by the most recent invocation of either method.
- 
             A custom instance via create()orcreate(Config). Instances of the factory created this way are independent of the singleton created bygetInstance()orgetInstance(Builder).
 Adding developer-requested registriesIn Micrometer, different registries report their contents in different formats. Further, there is no common abstract method defined on MeterRegistrywhich all implementations override; eachMeterRegistryhas its own particular way of furnishing metrics output. By default, we use aPrometheusMeterRegistryto support Prometheus/OpenMetrics format. Developers can enroll other registries to support other formats. We need to know which registry to use in response to receiving an HTTP request for Micrometer metrics output.To allow us to do this, when our code or developer's enrolls a registry, it also passes a function that accepts a ServerRequestand returns anOptional<Handler>. The function is expected to inspect the request, and if it wants to process that request (which means, if that registry should be used to respond to that request), it returns anOptional.ofaHandler. The handler uses the registry-specific mechanism for retrieving formatted meter and metrics information and sets and returns the HTTP response. If the function decides that its corresponding meter registry is not suitable for that particular request, it returns anOptional.empty().When a Micrometer request arrives, the Helidon code invokes the functions associated with all enrolled registries, in the order of enrollment. The first function that returns a non-empty Optionalwins and must populate and return theServerResponse.
- 
             Access the singleton instance via 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classMeterRegistryFactory.BuilderBuilder for constructingMeterRegistryFactoryinstances.static classMeterRegistryFactory.BuiltInRegistryTypeAvailable built-in registry types.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MeterRegistryFactory.Builderbuilder()Returns a newBuilderfor constructing aMeterRegistryFactory.static MeterRegistryFactorycreate()Creates a new factory using default settings (no config).static MeterRegistryFactorycreate(Config config)Creates a new factory using the specified config.static MeterRegistryFactorygetInstance()Returns the singleton instance of the factory.static MeterRegistryFactorygetInstance(MeterRegistryFactory.Builder builder)Creates and saves as the singleton a new factory.io.micrometer.core.instrument.MeterRegistrymeterRegistry()Returns theMeterRegistryassociated with this factory instance.
 
- 
- 
- 
Method Detail- 
createpublic static MeterRegistryFactory create() Creates a new factory using default settings (no config).- Returns:
- initialized MeterRegistryFactory
 
 - 
createpublic static MeterRegistryFactory create(Config config) Creates a new factory using the specified config.- Parameters:
- config- the config to use in initializing the factory
- Returns:
- initialized MeterRegistryFactory
 
 - 
getInstancepublic static MeterRegistryFactory getInstance() Returns the singleton instance of the factory.- Returns:
- factory singleton
 
 - 
getInstancepublic static MeterRegistryFactory getInstance(MeterRegistryFactory.Builder builder) Creates and saves as the singleton a new factory.- Parameters:
- builder- the Builder to use in constructing the new singleton instance
- Returns:
- MeterRegistryFactory using the Builder
 
 - 
builderpublic static MeterRegistryFactory.Builder builder() Returns a newBuilderfor constructing aMeterRegistryFactory.- Returns:
- initialized builder
 
 - 
meterRegistrypublic io.micrometer.core.instrument.MeterRegistry meterRegistry() Returns theMeterRegistryassociated with this factory instance.- Returns:
- the meter registry
 
 
- 
 
-