maedhroz commented on code in PR #3267:
URL: https://github.com/apache/cassandra/pull/3267#discussion_r1579811401
##########
src/java/org/apache/cassandra/index/sai/metrics/AbstractMetrics.java:
##########
@@ -57,28 +55,28 @@ public abstract class AbstractMetrics
public void release()
{
- tracked.forEach(Metrics::remove);
- tracked.clear();
+ Metrics.removeIfMatch(fullName -> resolveShortMetricName(fullName,
DefaultNameFactory.GROUP_NAME, TYPE),
+ this::createMetricName, m -> {});
}
- protected CassandraMetricsRegistry.MetricName createMetricName(String name)
+ protected String metricScope()
{
- return createMetricName(name, scope);
+ return scope;
}
- protected CassandraMetricsRegistry.MetricName createMetricName(String
name, String scope)
+ protected CassandraMetricsRegistry.MetricName createMetricName(String name)
{
- String metricScope = keyspace + '.' + table;
- if (index != null)
- {
- metricScope += '.' + index;
- }
- metricScope += '.' + scope + '.' + name;
+ return createMetricName(name, metricScope());
+ }
- CassandraMetricsRegistry.MetricName metricName = new
CassandraMetricsRegistry.MetricName(DefaultNameFactory.GROUP_NAME,
-
TYPE, name, metricScope, createMBeanName(name, scope));
- tracked.add(metricName.getMetricName());
- return metricName;
+ private CassandraMetricsRegistry.MetricName createMetricName(String name,
String scope)
+ {
+ assert name.indexOf('.') == -1 : String.format("Metric name '%s'
should not contain '.'", name);
+ return new
CassandraMetricsRegistry.MetricName(DefaultNameFactory.GROUP_NAME,
+ TYPE,
+ name,
+
MetricRegistry.name(keyspace, table, index, scope, name),
Review Comment:
It feels like something around this change is causing problems w/ `index`
handling that pop up in `GuardrailNonPartitionRestrictedQueryTest`,
`IndexAvailabilityTest`, and a few other places.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]