Package org.jmxtrans.agent
Class Query
java.lang.Object
org.jmxtrans.agent.Query
- All Implemented Interfaces:
Collector
- Direct Known Subclasses:
DiscoveryQuery
public class Query extends java.lang.Object implements Collector
- Author:
- Cyrille Le Clerc
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.lang.String>attributesThe attribute(s) to retrieve (MBeanServer.getAttribute(javax.management.ObjectName, String)) If empty, will fetch all attributes of the MBean.protected java.lang.StringkeyIf the MBean attribute value is aCompositeData, the key to lookup.protected javax.management.ObjectNameobjectNameprotected java.lang.IntegerpositionIf the returned value is aCollectionor an array, the position of the entry to lookup.protected java.lang.StringresultAliasprotected ResultNameStrategyresultNameStrategy -
Constructor Summary
Constructors Constructor Description Query(java.lang.String objectName, java.lang.String attribute, int position, ResultNameStrategy resultNameStrategy)Query(java.lang.String objectName, java.lang.String attribute, java.lang.String key, java.lang.Integer position, java.lang.String type, java.lang.String resultAlias, ResultNameStrategy resultNameStrategy)Creates a Query with no collectInterval overide.Query(java.lang.String objectName, java.lang.String attribute, java.lang.String key, java.lang.Integer position, java.lang.String type, java.lang.String resultAlias, ResultNameStrategy resultNameStrategy, java.lang.Integer collectInterval)Query(java.lang.String objectName, java.lang.String attribute, java.lang.String resultAlias, ResultNameStrategy resultNameStrategy)Query(java.lang.String objectName, java.lang.String attribute, ResultNameStrategy resultNameStrategy)Query(java.lang.String objectName, java.util.List<java.lang.String> attributes, java.lang.String key, java.lang.Integer position, java.lang.String type, java.lang.String resultAlias, ResultNameStrategy resultNameStrategy, java.lang.Integer collectInterval)Creates a query that accepts a list of attributes to collect. -
Method Summary
Modifier and Type Method Description voidcollectAndExport(javax.management.MBeanServer mbeanServer, OutputWriter outputWriter)java.util.List<java.lang.String>getAttributes()java.lang.IntegergetCollectIntervalOverrideOrNull()java.lang.StringgetKey()javax.management.ObjectNamegetObjectName()java.lang.IntegergetPosition()java.lang.StringgetResultAlias()java.lang.StringgetType()java.lang.StringtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
resultNameStrategy
-
objectName
@Nonnull protected final javax.management.ObjectName objectName -
attributes
@Nonnull protected java.util.List<java.lang.String> attributesThe attribute(s) to retrieve (MBeanServer.getAttribute(javax.management.ObjectName, String)) If empty, will fetch all attributes of the MBean. -
resultAlias
@Nullable protected final java.lang.String resultAlias -
key
@Nullable protected final java.lang.String keyIf the MBean attribute value is aCompositeData, the key to lookup.- See Also:
CompositeData.get(String)
-
position
@Nullable protected final java.lang.Integer positionIf the returned value is aCollectionor an array, the position of the entry to lookup.
-
-
Constructor Details
-
Query
public Query(@Nonnull java.lang.String objectName, @Nullable java.lang.String attribute, @Nonnull ResultNameStrategy resultNameStrategy) -
Query
public Query(@Nonnull java.lang.String objectName, @Nullable java.lang.String attribute, int position, @Nonnull ResultNameStrategy resultNameStrategy) -
Query
public Query(@Nonnull java.lang.String objectName, @Nullable java.lang.String attribute, @Nullable java.lang.String resultAlias, @Nonnull ResultNameStrategy resultNameStrategy) -
Query
public Query(@Nonnull java.lang.String objectName, @Nullable java.lang.String attribute, @Nullable java.lang.String key, @Nullable java.lang.Integer position, @Nullable java.lang.String type, @Nullable java.lang.String resultAlias, @Nonnull ResultNameStrategy resultNameStrategy)Creates a Query with no collectInterval overide. -
Query
public Query(@Nonnull java.lang.String objectName, @Nullable java.lang.String attribute, @Nullable java.lang.String key, @Nullable java.lang.Integer position, @Nullable java.lang.String type, @Nullable java.lang.String resultAlias, @Nonnull ResultNameStrategy resultNameStrategy, @Nullable java.lang.Integer collectInterval)- Parameters:
objectName- TheObjectNameto search for (MBeanServer.queryMBeans(javax.management.ObjectName, javax.management.QueryExp)), can contain wildcards and return several entries.attribute- The attribute to retrieve (MBeanServer.getAttribute(javax.management.ObjectName, String))key- if the MBean attribute value is aCompositeData, the key to lookup.position- if the returned value is aCollectionor an array, the position of the entry to lookup.type- type of the metric ('counter', 'gauge', ...)resultAlias-resultNameStrategy- theResultNameStrategyused during thecollectAndExport(javax.management.MBeanServer, OutputWriter)phase.
-
Query
public Query(@Nonnull java.lang.String objectName, @Nonnull java.util.List<java.lang.String> attributes, @Nullable java.lang.String key, @Nullable java.lang.Integer position, @Nullable java.lang.String type, @Nullable java.lang.String resultAlias, @Nonnull ResultNameStrategy resultNameStrategy, @Nullable java.lang.Integer collectInterval)Creates a query that accepts a list of attributes to collect. If the list is empty, all attributes will be collected.- Parameters:
collectInterval-- See Also:
Query(String, String, String, Integer, String, String, ResultNameStrategy)
-
-
Method Details
-
collectAndExport
public void collectAndExport(@Nonnull javax.management.MBeanServer mbeanServer, @Nonnull OutputWriter outputWriter)- Specified by:
collectAndExportin interfaceCollector
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
getObjectName
@Nonnull public javax.management.ObjectName getObjectName() -
getResultAlias
@Nullable public java.lang.String getResultAlias() -
getAttributes
@Nullable public java.util.List<java.lang.String> getAttributes() -
getKey
@Nullable public java.lang.String getKey() -
getPosition
@Nullable public java.lang.Integer getPosition() -
getType
@Nullable public java.lang.String getType() -
getCollectIntervalOverrideOrNull
@Nullable public java.lang.Integer getCollectIntervalOverrideOrNull()
-