Class SolrJmxReporter
- java.lang.Object
 - 
- org.apache.solr.metrics.SolrMetricReporter
 - 
- org.apache.solr.metrics.FilteringSolrMetricReporter
 - 
- org.apache.solr.metrics.reporters.SolrJmxReporter
 
 
 
 
- 
- All Implemented Interfaces:
 Closeable,AutoCloseable,PluginInfoInitialized
public class SolrJmxReporter extends FilteringSolrMetricReporter
ASolrMetricReporterthat finds (or creates) a MBeanServer from the given configuration and registers metrics to it with JMX.NOTE:
JmxReporterthat this class uses exports only newly added metrics (it doesn't process already existing metrics in a registry) 
- 
- 
Field Summary
- 
Fields inherited from class org.apache.solr.metrics.FilteringSolrMetricReporter
filters 
- 
Fields inherited from class org.apache.solr.metrics.SolrMetricReporter
enabled, metricManager, period, pluginInfo, registryName 
 - 
 
- 
Constructor Summary
Constructors Constructor Description SolrJmxReporter(SolrMetricManager metricManager, String registryName)Creates a new instance ofSolrJmxReporter. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Stops the reporter from publishing metrics.protected voiddoInit()Reporter initialization implementation.StringgetAgentId()Return configured agentId or null.StringgetDomain()Return configured domain or null.StringgetInstanceTag()For unit tests.MBeanServergetMBeanServer()Return the reporter's MBeanServer.StringgetServiceUrl()Return configured serviceUrl or null.booleanisActive()For unit tests.booleanisStarted()For unit tests.voidsetAgentId(String agentId)Sets the agent id for a JMX server.voidsetDomain(String domain)Sets the domain with which MBeans are published.voidsetRootName(String rootName)Set root name of the JMX hierarchy for this reporter.voidsetServiceUrl(String serviceUrl)Sets the service url for a JMX server.StringtoString()protected voidvalidate()Validates that the reporter has been correctly configured.- 
Methods inherited from class org.apache.solr.metrics.FilteringSolrMetricReporter
newMetricFilter, setFilter, setFilter 
- 
Methods inherited from class org.apache.solr.metrics.SolrMetricReporter
getPeriod, getPluginInfo, init, setEnabled, setPeriod 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
SolrJmxReporter
public SolrJmxReporter(SolrMetricManager metricManager, String registryName)
Creates a new instance ofSolrJmxReporter.- Parameters:
 registryName- name of the registry to report
 
 - 
 
- 
Method Detail
- 
doInit
protected void doInit()
Description copied from class:SolrMetricReporterReporter initialization implementation.- Specified by:
 doInitin classSolrMetricReporter
 
- 
getInstanceTag
public String getInstanceTag()
For unit tests. 
- 
close
public void close()
Stops the reporter from publishing metrics. 
- 
validate
protected void validate() throws IllegalStateExceptionValidates that the reporter has been correctly configured. Note that all configurable arguments are currently optional.- Specified by:
 validatein classSolrMetricReporter- Throws:
 IllegalStateException- if the reporter is not properly configured
 
- 
setRootName
public void setRootName(String rootName)
Set root name of the JMX hierarchy for this reporter. Default (null or empty) is none, ie. the hierarchy will start from the domain name.- Parameters:
 rootName- root name of the JMX name hierarchy, or null or empty for default.
 
- 
setDomain
public void setDomain(String domain)
Sets the domain with which MBeans are published. If none is set, the domain defaults to the name of the registry.- Parameters:
 domain- the domain
 
- 
setServiceUrl
public void setServiceUrl(String serviceUrl)
Sets the service url for a JMX server. Note that this configuration is optional.- Parameters:
 serviceUrl- the service url
 
- 
setAgentId
public void setAgentId(String agentId)
Sets the agent id for a JMX server. Note that this configuration is optional.- Parameters:
 agentId- the agent id
 
- 
getAgentId
public String getAgentId()
Return configured agentId or null. 
- 
getServiceUrl
public String getServiceUrl()
Return configured serviceUrl or null. 
- 
getDomain
public String getDomain()
Return configured domain or null. 
- 
getMBeanServer
public MBeanServer getMBeanServer()
Return the reporter's MBeanServer.- Returns:
 - the reporter's MBeanServer
 
 
- 
isActive
public boolean isActive()
For unit tests.- Returns:
 - true if this reporter is going to report metrics to JMX.
 
 
- 
isStarted
public boolean isStarted()
For unit tests.- Returns:
 - true if this reporter has been started and is reporting metrics to JMX.
 
 
- 
toString
public String toString()
- Overrides:
 toStringin classSolrMetricReporter
 
 - 
 
 -