Package org.jmxtrans.embedded
Class EmbeddedJmxTrans
java.lang.Object
org.jmxtrans.embedded.EmbeddedJmxTrans
- All Implemented Interfaces:
EmbeddedJmxTransMBean
- Direct Known Subclasses:
SpringEmbeddedJmxTrans
public class EmbeddedJmxTrans extends Object implements EmbeddedJmxTransMBean
JMX Queries
If the JMX query returns several mbeans (thanks to '*' or '?' wildcards), then the configured attributes are collected on all the returned mbeans.Output Writers
OutputWriters can be defined at the query level or globally at theEmbeddedJmxTrans level.
The OutputWriters that are effective for a Query are accessible
via Query.getEffectiveOutputWriters()
Collected Metrics / Query Results
Default behavior is to store the query results at the query level (see Query.queryResults) to resolve the effective OutputWriters at result export time (Query.getEffectiveOutputWriters()). The drawback is to limit the benefits of batching result to a backend (seeQuery.exportCollectedMetrics()) and the size limit of the results list to prevent
OutOfMemoryError in case of export slowness.
An optimization would be, if only one OutputWriter is defined in the whole EmbeddedJmxTrans, to
replace all the query-local result queues by one global result-queue.- Author:
- Cyrille Le Clerc, Jon Stevens
-
Constructor Summary
Constructors Constructor Description EmbeddedJmxTrans()EmbeddedJmxTrans(MBeanServer mbeanServer) -
Method Summary
Modifier and Type Method Description voidaddQuery(Query query)voidcollectMetrics()Exposed for manual / JMX invocationvoidexportCollectedMetrics()Exposed for manual / JMX invocationintgetCollectedMetricsCount()intgetCollectionCount()longgetCollectionDurationInMillis()longgetCollectionDurationInNanos()intgetDiscardedResultsCount()intgetExportBatchSize()Max number of QueryResult exported at each call ofOutputWriter.write(Iterable)intgetExportCount()longgetExportDurationInMillis()longgetExportDurationInNanos()intgetExportedMetricsCount()intgetExportIntervalInSeconds()MBeanServergetMbeanServer()intgetNumExportThreads()intgetNumQueryThreads()Set<OutputWriter>getOutputWriters()List<Query>getQueries()intgetQueryIntervalInSeconds()StringgetState()voidsetExportBatchSize(int exportBatchSize)voidsetExportIntervalInSeconds(int exportIntervalInSeconds)voidsetNumExportThreads(int numExportThreads)voidsetNumQueryThreads(int numQueryThreads)voidsetQueryIntervalInSeconds(int queryIntervalInSeconds)voidstart()Start the exporter: initialize underlying queries, start scheduled executors, register shutdown hookvoidstop()Stop scheduled executors and collect-and-export metrics one last time.StringtoString()
-
Constructor Details
-
EmbeddedJmxTrans
public EmbeddedJmxTrans() -
EmbeddedJmxTrans
-
-
Method Details
-
start
Start the exporter: initialize underlying queries, start scheduled executors, register shutdown hook- Specified by:
startin interfaceEmbeddedJmxTransMBean- Throws:
Exception
-
stop
Stop scheduled executors and collect-and-export metrics one last time.- Specified by:
stopin interfaceEmbeddedJmxTransMBean
-
collectMetrics
public void collectMetrics()Exposed for manual / JMX invocation- Specified by:
collectMetricsin interfaceEmbeddedJmxTransMBean
-
exportCollectedMetrics
public void exportCollectedMetrics()Exposed for manual / JMX invocation- Specified by:
exportCollectedMetricsin interfaceEmbeddedJmxTransMBean
-
getQueries
-
addQuery
-
toString
-
getNumQueryThreads
public int getNumQueryThreads()- Specified by:
getNumQueryThreadsin interfaceEmbeddedJmxTransMBean
-
setNumQueryThreads
public void setNumQueryThreads(int numQueryThreads) -
getQueryIntervalInSeconds
public int getQueryIntervalInSeconds()- Specified by:
getQueryIntervalInSecondsin interfaceEmbeddedJmxTransMBean
-
setQueryIntervalInSeconds
public void setQueryIntervalInSeconds(int queryIntervalInSeconds) -
getExportIntervalInSeconds
public int getExportIntervalInSeconds()- Specified by:
getExportIntervalInSecondsin interfaceEmbeddedJmxTransMBean
-
setExportIntervalInSeconds
public void setExportIntervalInSeconds(int exportIntervalInSeconds) -
getNumExportThreads
public int getNumExportThreads()- Specified by:
getNumExportThreadsin interfaceEmbeddedJmxTransMBean
-
setNumExportThreads
public void setNumExportThreads(int numExportThreads) -
getOutputWriters
-
getExportBatchSize
public int getExportBatchSize()Max number of QueryResult exported at each call ofOutputWriter.write(Iterable) -
setExportBatchSize
public void setExportBatchSize(int exportBatchSize) -
getMbeanServer
-
getCollectedMetricsCount
public int getCollectedMetricsCount()- Specified by:
getCollectedMetricsCountin interfaceEmbeddedJmxTransMBean
-
getCollectionDurationInNanos
public long getCollectionDurationInNanos()- Specified by:
getCollectionDurationInNanosin interfaceEmbeddedJmxTransMBean
-
getCollectionDurationInMillis
public long getCollectionDurationInMillis()- Specified by:
getCollectionDurationInMillisin interfaceEmbeddedJmxTransMBean
-
getCollectionCount
public int getCollectionCount()- Specified by:
getCollectionCountin interfaceEmbeddedJmxTransMBean
-
getExportedMetricsCount
public int getExportedMetricsCount()- Specified by:
getExportedMetricsCountin interfaceEmbeddedJmxTransMBean
-
getExportDurationInNanos
public long getExportDurationInNanos()- Specified by:
getExportDurationInNanosin interfaceEmbeddedJmxTransMBean
-
getExportDurationInMillis
public long getExportDurationInMillis()- Specified by:
getExportDurationInMillisin interfaceEmbeddedJmxTransMBean
-
getExportCount
public int getExportCount()- Specified by:
getExportCountin interfaceEmbeddedJmxTransMBean
-
getDiscardedResultsCount
public int getDiscardedResultsCount()- Specified by:
getDiscardedResultsCountin interfaceEmbeddedJmxTransMBean
-
getState
- Specified by:
getStatein interfaceEmbeddedJmxTransMBean
-