Package org.apache.solr.metrics
Class MetricsMap
java.lang.Object
org.apache.solr.metrics.MetricsMap
- All Implemented Interfaces:
com.codahale.metrics.Gauge<Map<String,,Object>> com.codahale.metrics.Metric,DynamicMBean,org.apache.solr.common.MapSerializable,org.apache.solr.common.MapWriter,org.apache.solr.common.NavigableObject,org.noggit.JSONWriter.Writable
public class MetricsMap
extends Object
implements com.codahale.metrics.Gauge<Map<String,Object>>, org.apache.solr.common.MapWriter, DynamicMBean
Dynamically constructed map of metrics, intentionally different from
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter
org.apache.solr.common.MapWriter.EntryWriter -
Field Summary
Fields inherited from interface org.apache.solr.common.MapWriter
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionMetricsMap(org.apache.solr.common.MapWriter initializer) Create an instance that reports values to a MapWriter. -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String attribute) getAttributes(String[] attributes) getValue()getValue(boolean detailed) voidsetAttribute(Attribute attribute) setAttributes(AttributeList attributes) toString()voidwriteMap(org.apache.solr.common.MapWriter.EntryWriter ew) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.solr.common.MapWriter
append, jsonStr, toMap, writeMethods inherited from interface org.apache.solr.common.NavigableObject
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _get, _getStr, _getStr, _getStr, _size
-
Constructor Details
-
MetricsMap
public MetricsMap(org.apache.solr.common.MapWriter initializer) Create an instance that reports values to a MapWriter.- Parameters:
initializer- function to populate the MapWriter result.
-
-
Method Details
-
getValue
-
getValue
-
toString
-
getAttribute
public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException - Specified by:
getAttributein interfaceDynamicMBean- Throws:
AttributeNotFoundExceptionMBeanExceptionReflectionException
-
setAttribute
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException - Specified by:
setAttributein interfaceDynamicMBean- Throws:
AttributeNotFoundExceptionInvalidAttributeValueExceptionMBeanExceptionReflectionException
-
getAttributes
- Specified by:
getAttributesin interfaceDynamicMBean
-
setAttributes
- Specified by:
setAttributesin interfaceDynamicMBean
-
invoke
public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException - Specified by:
invokein interfaceDynamicMBean- Throws:
MBeanExceptionReflectionException
-
getMBeanInfo
- Specified by:
getMBeanInfoin interfaceDynamicMBean
-
writeMap
- Specified by:
writeMapin interfaceorg.apache.solr.common.MapWriter- Throws:
IOException
-