SOLR-12765: Incorrect format of JMX cache stats.

This commit is contained in:
Andrzej Bialecki 2018-09-17 14:40:36 +02:00
parent ac7969e3c0
commit 36eae57163
2 changed files with 9 additions and 3 deletions

View File

@ -355,6 +355,8 @@ Bug Fixes
* SOLR-11836: FacetStream works with bucketSizeLimit of -1 which will fetch all the buckets.
(Alfonso Muñoz-Pomer Fuentes, Amrit Sarkar via Varun Thacker)
* SOLR-12765: Incorrect format of JMX cache stats. (Bojan Smid, ab)
Optimizations
----------------------

View File

@ -50,6 +50,7 @@ import com.codahale.metrics.ObjectNameFactory;
import com.codahale.metrics.Reporter;
import com.codahale.metrics.Timer;
import org.apache.solr.metrics.MetricsMap;
import org.apache.solr.metrics.SolrMetricManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -558,9 +559,12 @@ public class JmxMetricsReporter implements Reporter, Closeable {
try {
if (filter.matches(name, gauge)) {
final ObjectName objectName = createName("gauges", name);
if (gauge instanceof MetricsMap) {
((MetricsMap)gauge).setAttribute(new Attribute(INSTANCE_TAG, tag));
registerMBean(gauge, objectName);
if (gauge instanceof SolrMetricManager.GaugeWrapper &&
((SolrMetricManager.GaugeWrapper)gauge).getGauge() instanceof MetricsMap) {
MetricsMap mm = (MetricsMap)((SolrMetricManager.GaugeWrapper)gauge).getGauge();
mm.setAttribute(new Attribute(INSTANCE_TAG, tag));
// don't wrap it in a JmxGauge, it already supports all necessary JMX attributes
registerMBean(mm, objectName);
} else {
registerMBean(new JmxGauge(gauge, objectName, tag), objectName);
}