public class MetricsMap extends Object implements com.codahale.metrics.Gauge<Map<String,Object>>, DynamicMBean
MetricSet
where each metric had to be known in advance and registered separately in MetricRegistry
.
Note: this awkwardly extends Gauge
and not Metric
because awkwardly Metric
instances
are not supported by MetricRegistryListener
:(
Note 2: values added to this metric map should belong to the list of types supported by JMX:
OpenType.ALLOWED_CLASSNAMES_LIST
, otherwise only their toString()
representation will be shown in JConsole.
Constructor and Description |
---|
MetricsMap(BiConsumer<Boolean,Map<String,Object>> initializer) |
Modifier and Type | Method and Description |
---|---|
Object |
getAttribute(String attribute) |
AttributeList |
getAttributes(String[] attributes) |
MBeanInfo |
getMBeanInfo() |
Map<String,Object> |
getValue() |
Map<String,Object> |
getValue(boolean detailed) |
Object |
invoke(String actionName,
Object[] params,
String[] signature) |
void |
setAttribute(Attribute attribute) |
AttributeList |
setAttributes(AttributeList attributes) |
String |
toString() |
public MetricsMap(BiConsumer<Boolean,Map<String,Object>> initializer)
public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException
getAttribute
in interface DynamicMBean
AttributeNotFoundException
MBeanException
ReflectionException
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
setAttribute
in interface DynamicMBean
AttributeNotFoundException
InvalidAttributeValueException
MBeanException
ReflectionException
public AttributeList getAttributes(String[] attributes)
getAttributes
in interface DynamicMBean
public AttributeList setAttributes(AttributeList attributes)
setAttributes
in interface DynamicMBean
public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException
invoke
in interface DynamicMBean
MBeanException
ReflectionException
public MBeanInfo getMBeanInfo()
getMBeanInfo
in interface DynamicMBean
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.