Package org.apache.zookeeper.metrics
Interface MetricsProvider
-
- All Known Implementing Classes:
DefaultMetricsProvider,NullMetricsProvider
public interface MetricsProviderA MetricsProvider is a system which collects Metrics and publishes current values to external facilities. The system will create an instance of the configured class using the default constructor, which must be public.
After the instantiation of the provider, the system will callconfigure(java.util.Properties)in order to provide configuration, and then when the system is ready to work it will callstart().
Providers can be used both on ZooKeeper servers and on ZooKeeper clients.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidconfigure(Properties configuration)Configure the provider.voiddump(BiConsumer<String,Object> sink)Dumps all metrics as a key-value pair.MetricsContextgetRootContext()Provides access to the root context.voidresetAllValues()Reset all values.voidstart()Start the provider.voidstop()Releases resources held by the provider.
This method must not throw exceptions.
This method can be called more than once.
-
-
-
Method Detail
-
configure
void configure(Properties configuration) throws MetricsProviderLifeCycleException
Configure the provider.- Parameters:
configuration- the configuration.- Throws:
MetricsProviderLifeCycleException- in case of invalid configuration.
-
start
void start() throws MetricsProviderLifeCycleExceptionStart the provider. For instance such method will start a network endpoint.- Throws:
MetricsProviderLifeCycleException- in case of failure
-
getRootContext
MetricsContext getRootContext()
Provides access to the root context.- Returns:
- the root context
-
stop
void stop()
Releases resources held by the provider.
This method must not throw exceptions.
This method can be called more than once.
-
dump
void dump(BiConsumer<String,Object> sink)
Dumps all metrics as a key-value pair. This method will be used in legacy monitor command.- Parameters:
sink- the receiver of all of the current values.
-
resetAllValues
void resetAllValues()
Reset all values. This method is optional and can be noop, depending on the underlying implementation.
-
-