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
ASolrMetricReporter
that finds (or creates) a MBeanServer from the given configuration and registers metrics to it with JMX.NOTE:
JmxReporter
that 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 void
close()
Stops the reporter from publishing metrics.protected void
doInit()
Reporter initialization implementation.String
getAgentId()
Return configured agentId or null.String
getDomain()
Return configured domain or null.String
getInstanceTag()
For unit tests.MBeanServer
getMBeanServer()
Return the reporter's MBeanServer.String
getServiceUrl()
Return configured serviceUrl or null.boolean
isActive()
For unit tests.boolean
isStarted()
For unit tests.void
setAgentId(String agentId)
Sets the agent id for a JMX server.void
setDomain(String domain)
Sets the domain with which MBeans are published.void
setRootName(String rootName)
Set root name of the JMX hierarchy for this reporter.void
setServiceUrl(String serviceUrl)
Sets the service url for a JMX server.String
toString()
protected void
validate()
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:SolrMetricReporter
Reporter initialization implementation.- Specified by:
doInit
in classSolrMetricReporter
-
getInstanceTag
public String getInstanceTag()
For unit tests.
-
close
public void close()
Stops the reporter from publishing metrics.
-
validate
protected void validate() throws IllegalStateException
Validates that the reporter has been correctly configured. Note that all configurable arguments are currently optional.- Specified by:
validate
in 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:
toString
in classSolrMetricReporter
-
-