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
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 fromMetricSet
where each metric had to be known in advance and registered separately inMetricRegistry
.Note: this awkwardly extends
Gauge
and notMetric
because awkwardlyMetric
instances are not supported byMetricRegistryListener
:(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 Summary
Constructors Constructor Description MetricsMap(BiConsumer<Boolean,Map<String,Object>> mapInitializer)
Deprecated.useMetricsMap(MapWriter)
instead.MetricsMap(org.apache.solr.common.MapWriter initializer)
Create an instance that reports values to a MapWriter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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(org.apache.solr.common.MapWriter.EntryWriter ew)
-
-
-
Constructor Detail
-
MetricsMap
@Deprecated(since="8.7") public MetricsMap(BiConsumer<Boolean,Map<String,Object>> mapInitializer)
Deprecated.useMetricsMap(MapWriter)
instead.Create an instance that reports values to a Map.- Parameters:
mapInitializer
- function to populate the Map result.
-
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 Detail
-
getAttribute
public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException
- Specified by:
getAttribute
in interfaceDynamicMBean
- Throws:
AttributeNotFoundException
MBeanException
ReflectionException
-
setAttribute
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
- Specified by:
setAttribute
in interfaceDynamicMBean
- Throws:
AttributeNotFoundException
InvalidAttributeValueException
MBeanException
ReflectionException
-
getAttributes
public AttributeList getAttributes(String[] attributes)
- Specified by:
getAttributes
in interfaceDynamicMBean
-
setAttributes
public AttributeList setAttributes(AttributeList attributes)
- Specified by:
setAttributes
in interfaceDynamicMBean
-
invoke
public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException
- Specified by:
invoke
in interfaceDynamicMBean
- Throws:
MBeanException
ReflectionException
-
getMBeanInfo
public MBeanInfo getMBeanInfo()
- Specified by:
getMBeanInfo
in interfaceDynamicMBean
-
writeMap
public void writeMap(org.apache.solr.common.MapWriter.EntryWriter ew) throws IOException
- Specified by:
writeMap
in interfaceorg.apache.solr.common.MapWriter
- Throws:
IOException
-
-