diff --git a/CHANGES.txt b/CHANGES.txt index 6b391cc980..7ddd707989 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -40,6 +40,7 @@ * Add the ability to disable bulk loading of SSTables (CASSANDRA-18781) * Clean up obsolete functions and simplify cql_version handling in cqlsh (CASSANDRA-18787) Merged from 5.0: + * Enforce metric naming contract if scope is used in a metric name (CASSANDRA-19619) * Avoid reading of the same IndexInfo from disk many times for a large partition (CASSANDRA-19557) * Resolve the oldest hints just from descriptors and current writer if available (CASSANDRA-19600) * Optionally fail writes when SAI refuses to index a term value exceeding configured term max size (CASSANDRA-19493) diff --git a/src/java/org/apache/cassandra/index/sai/metrics/AbstractMetrics.java b/src/java/org/apache/cassandra/index/sai/metrics/AbstractMetrics.java index 17fd99291c..642cfd24fc 100644 --- a/src/java/org/apache/cassandra/index/sai/metrics/AbstractMetrics.java +++ b/src/java/org/apache/cassandra/index/sai/metrics/AbstractMetrics.java @@ -70,7 +70,7 @@ public abstract class AbstractMetrics return new CassandraMetricsRegistry.MetricName(DefaultNameFactory.GROUP_NAME, TYPE, name, - MetricRegistry.name(keyspace, table, index, scope, name), + MetricRegistry.name(keyspace, table, index, scope), createMBeanName(name, scope)); } diff --git a/src/java/org/apache/cassandra/metrics/CassandraMetricsRegistry.java b/src/java/org/apache/cassandra/metrics/CassandraMetricsRegistry.java index 2464533c99..dcd883a718 100644 --- a/src/java/org/apache/cassandra/metrics/CassandraMetricsRegistry.java +++ b/src/java/org/apache/cassandra/metrics/CassandraMetricsRegistry.java @@ -1065,6 +1065,11 @@ public class CassandraMetricsRegistry extends MetricRegistry { throw new IllegalArgumentException("Name needs to be specified"); } + if (scope != null && scope.contains(name)) + { + throw new IllegalArgumentException("Scope cannot contain name, this is not neccessary and will cause performance issues. " + + "Scope: " + scope + " Name: " + name); + } this.group = group; this.type = type; this.name = name;