public class MetricsMap extends Object implements com.codahale.metrics.Gauge<Map<String,Object>>, MapWriter, 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.
MapWriter.EntryWriter
Constructor and Description |
---|
MetricsMap(BiConsumer<Boolean,Map<String,Object>> mapInitializer)
Deprecated.
use
MetricsMap(MapWriter) instead. |
MetricsMap(MapWriter initializer)
Create an instance that reports values to a MapWriter.
|
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() |
void |
writeMap(MapWriter.EntryWriter ew) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size
@Deprecated public MetricsMap(BiConsumer<Boolean,Map<String,Object>> mapInitializer)
MetricsMap(MapWriter)
instead.mapInitializer
- function to populate the Map result.public MetricsMap(MapWriter initializer)
initializer
- function to populate the MapWriter result.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
public void writeMap(MapWriter.EntryWriter ew) throws IOException
writeMap
in interface MapWriter
IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.