Package org.jmxtrans.embedded
Class QueryAttribute
java.lang.Object
org.jmxtrans.embedded.QueryAttribute
public class QueryAttribute extends Object
Describe a JMX MBean attribute to collect and hold the attribute collection logic.
Collected values are sent to a BlockingQueue
for later export to the target monitoring systems
(see
collectMetrics(javax.management.ObjectName, Object, long, java.util.Queue)).- Author:
- Cyrille Le Clerc, Jon Stevens
-
Field Summary
Fields Modifier and Type Field Description protected ResultNameStrategyresultNameStrategy -
Constructor Summary
Constructors Constructor Description QueryAttribute(String name, String type, String resultAlias)QueryAttribute(String name, String type, String resultAlias, Collection<String> keys) -
Method Summary
Modifier and Type Method Description QueryAttributeaddKeys(Collection<String> newKeys)intcollectMetrics(ObjectName objectName, Object value, long epochInMillis, Queue<QueryResult> results)StringgetName()QuerygetQuery()StringgetResultAlias()StringgetType()voidsetQuery(Query query)StringtoString()QueryAttributewithResultNameStrategy(ResultNameStrategy strategy)
-
Field Details
-
resultNameStrategy
-
-
Constructor Details
-
QueryAttribute
- Parameters:
name- name of the JMX attributetype- type of the metric (e.g. "counter", "gauge", ...)resultAlias- name of the result that will be exported
-
QueryAttribute
public QueryAttribute(@Nonnull String name, @Nullable String type, @Nullable String resultAlias, @Nullable Collection<String> keys)- Parameters:
name- name of the JMX attributetype- type of the metric (e.g. "counter", "gauge", ...)resultAlias- name of the result that will be exportedkeys- of theCompositeDatato collect
-
-
Method Details
-
getQuery
- Returns:
- parent query
- See Also:
Query.addAttribute(QueryAttribute)
-
setQuery
-
getName
-
getResultAlias
-
getType
-
withResultNameStrategy
-
collectMetrics
public int collectMetrics(@Nonnull ObjectName objectName, @Nonnull Object value, long epochInMillis, @Nonnull Queue<QueryResult> results)- Parameters:
objectName-objectNameon which theattributewas obtained.value- value of the given attribute. A 'simple' value (String, Number, Date) or aCompositeDataepochInMillis- time at which the metric was collectedresults- queue to which the the computed result(s) must be added- Returns:
- collected metrics count
-
addKeys
- Returns:
this
-
toString
-