Package org.apache.solr.metrics
Class SolrMetricReporter
- java.lang.Object
-
- org.apache.solr.metrics.SolrMetricReporter
-
- All Implemented Interfaces:
Closeable,AutoCloseable,PluginInfoInitialized
- Direct Known Subclasses:
FilteringSolrMetricReporter,SolrCoreContainerReporter
public abstract class SolrMetricReporter extends Object implements Closeable, PluginInfoInitialized
Interface for 'pluggable' metric reporters.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanenabledprotected SolrMetricManagermetricManagerprotected intperiodprotected PluginInfopluginInfoprotected StringregistryName
-
Constructor Summary
Constructors Modifier Constructor Description protectedSolrMetricReporter(SolrMetricManager metricManager, String registryName)Create a reporter for metrics managed in a named registry.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voiddoInit()Reporter initialization implementation.intgetPeriod()PluginInfogetPluginInfo()Get the effectivePluginInfoinstance that was used for initialization of this plugin.voidinit(PluginInfo pluginInfo)Initializes aSolrMetricReporterwith the plugin's configuration.voidsetEnabled(Boolean enabled)Enable reporting, defaults to true.voidsetPeriod(int period)StringtoString()protected abstract voidvalidate()Validates that the reporter has been correctly configured.
-
-
-
Field Detail
-
registryName
protected final String registryName
-
metricManager
protected final SolrMetricManager metricManager
-
pluginInfo
protected PluginInfo pluginInfo
-
enabled
protected boolean enabled
-
period
protected int period
-
-
Constructor Detail
-
SolrMetricReporter
protected SolrMetricReporter(SolrMetricManager metricManager, String registryName)
Create a reporter for metrics managed in a named registry.- Parameters:
registryName- registry to use, one of registries managed bySolrMetricManager
-
-
Method Detail
-
init
public void init(PluginInfo pluginInfo)
Initializes aSolrMetricReporterwith the plugin's configuration.- Specified by:
initin interfacePluginInfoInitialized- Parameters:
pluginInfo- the plugin's configuration
-
doInit
protected abstract void doInit()
Reporter initialization implementation.
-
setEnabled
public void setEnabled(Boolean enabled)
Enable reporting, defaults to true.init(PluginInfo)checks this flag before callingdoInit()to initialize reporting.- Parameters:
enabled- - whether or not reporting is to be enabled
-
setPeriod
public void setPeriod(int period)
- Parameters:
period- - in seconds
-
getPeriod
public int getPeriod()
- Returns:
- period, in seconds
-
getPluginInfo
public PluginInfo getPluginInfo()
Get the effectivePluginInfoinstance that was used for initialization of this plugin.- Returns:
- plugin info, or null if not yet initialized.
-
validate
protected abstract void validate() throws IllegalStateExceptionValidates that the reporter has been correctly configured.- Throws:
IllegalStateException- if the reporter is not properly configured
-
-