Skip to content

Commit

Permalink
Fixed issue where client_request metrics were not exported for 3.0.x …
Browse files Browse the repository at this point in the history
…clusters.
  • Loading branch information
zegelin committed Dec 17, 2018
1 parent 42930cd commit 5d963c2
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private Factory clientMetricFactory(final FactoryBuilder.CollectorConstructor co
}

private Factory clientRequestMetricFactory(final FactoryBuilder.CollectorConstructor collectorConstructor, final String jmxName, final String familyNameSuffix, final String help) {
final ObjectName objectNamePattern = format("org.apache.cassandra.metrics:type=ClientRequest,name=%s,scope=*-*", jmxName);
final ObjectName objectNamePattern = format("org.apache.cassandra.metrics:type=ClientRequest,name=%s,scope=*", jmxName);
final String metricFamilyName = String.format("client_request_%s", familyNameSuffix);

return new FactoryBuilder(collectorConstructor, objectNamePattern, metricFamilyName)
Expand All @@ -182,13 +182,18 @@ private Factory clientRequestMetricFactory(final FactoryBuilder.CollectorConstru
if (!matcher.matches())
throw new IllegalStateException();

final String operation = matcher.group("operation").toLowerCase();
final String consistency = matcher.group("consistency");
final ImmutableMap.Builder<String, String> labelsBuilder = ImmutableMap.builder();

return ImmutableMap.of(
"operation", operation,
"consistency", consistency
);
labelsBuilder.put("operation", matcher.group("operation").toLowerCase());

{
final String consistency = matcher.group("consistency");
if (consistency != null) {
labelsBuilder.put("consistency", consistency);
}
}

return labelsBuilder.build();
})
.build();
}
Expand Down

0 comments on commit 5d963c2

Please sign in to comment.