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 boolean
enabled
protected SolrMetricManager
metricManager
protected int
period
protected PluginInfo
pluginInfo
protected String
registryName
-
Constructor Summary
Constructors Modifier Constructor Description protected
SolrMetricReporter(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 void
doInit()
Reporter initialization implementation.int
getPeriod()
PluginInfo
getPluginInfo()
Get the effectivePluginInfo
instance that was used for initialization of this plugin.void
init(PluginInfo pluginInfo)
Initializes aSolrMetricReporter
with the plugin's configuration.void
setEnabled(Boolean enabled)
Enable reporting, defaults to true.void
setPeriod(int period)
String
toString()
protected abstract void
validate()
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 aSolrMetricReporter
with the plugin's configuration.- Specified by:
init
in 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 effectivePluginInfo
instance that was used for initialization of this plugin.- Returns:
- plugin info, or null if not yet initialized.
-
validate
protected abstract void validate() throws IllegalStateException
Validates that the reporter has been correctly configured.- Throws:
IllegalStateException
- if the reporter is not properly configured
-
-