TableMetrics: bugfix: local metrics registry is a proxy. It must proxy
Refs scylladb/scylla#2340 (trunk/1.7) Must proxy "register" call, otherwise unregistration of mbeans will instead try to double-register. Code for this somehow fell away. Message-Id: <1494417610-9720-1-git-send-email-calle@scylladb.com>
This commit is contained in:
parent
fa72ea29d3
commit
e954db8444
@ -21,11 +21,13 @@ import static com.scylladb.jmx.api.APIClient.getReader;
|
|||||||
|
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import javax.management.MalformedObjectNameException;
|
import javax.management.MalformedObjectNameException;
|
||||||
import javax.management.ObjectName;
|
import javax.management.ObjectName;
|
||||||
|
|
||||||
import org.apache.cassandra.db.ColumnFamilyStore;
|
import org.apache.cassandra.db.ColumnFamilyStore;
|
||||||
|
import org.apache.cassandra.metrics.MetricsRegistry.MetricMBean;
|
||||||
|
|
||||||
import com.scylladb.jmx.api.APIClient;
|
import com.scylladb.jmx.api.APIClient;
|
||||||
|
|
||||||
@ -110,15 +112,22 @@ public class TableMetrics implements Metrics {
|
|||||||
final MetricNameFactory factory;
|
final MetricNameFactory factory;
|
||||||
final MetricNameFactory aliasFactory;
|
final MetricNameFactory aliasFactory;
|
||||||
final String cfName;
|
final String cfName;
|
||||||
|
final MetricsRegistry other;
|
||||||
|
|
||||||
public Registry(MetricsRegistry other, MetricNameFactory factory, MetricNameFactory aliasFactory,
|
public Registry(MetricsRegistry other, MetricNameFactory factory, MetricNameFactory aliasFactory,
|
||||||
String cfName) {
|
String cfName) {
|
||||||
super(other);
|
super(other);
|
||||||
|
this.other = other;
|
||||||
this.cfName = cfName;
|
this.cfName = cfName;
|
||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
this.aliasFactory = aliasFactory;
|
this.aliasFactory = aliasFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register(Supplier<MetricMBean> f, ObjectName... objectNames) {
|
||||||
|
other.register(f, objectNames);
|
||||||
|
}
|
||||||
|
|
||||||
public void createTableGauge(String name, String uri) throws MalformedObjectNameException {
|
public void createTableGauge(String name, String uri) throws MalformedObjectNameException {
|
||||||
createTableGauge(name, name, uri);
|
createTableGauge(name, name, uri);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user