Skip to content

Commit

Permalink
Merge pull request #16 from zegelin/v96-wip
Browse files Browse the repository at this point in the history
3.0.17 experimental support
  • Loading branch information
zegelin authored Dec 17, 2018
2 parents 8bc0e3f + 6058d74 commit becd6fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ For example, the following PromQL query will return an estimate of the number of

| Component | Version |
|-----------------|---------------|
| Apache Cassandra| 3.11.2, 3.11.3 |
| Apache Cassandra| 3.0.17 (experimental), 3.11.2, 3.11.3 |
| Prometheus | 2.0 and later |

Other Cassandra and Prometheus versions will be tested for compatibility in the future.
Expand Down
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 becd6fe

Please sign in to comment.