Skip to content

Commit

Permalink
Fixes issue where client_request_latency metric families were includi…
Browse files Browse the repository at this point in the history
…ng aggregate totals per operation (missing the "consistency" label). These are now ignored.

Added some TODOs.
  • Loading branch information
zegelin committed Nov 22, 2019
1 parent f8f4f12 commit 034c598
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,17 @@ private Factory clientRequestMetricFactory(final FactoryBuilder.CollectorConstru

final ImmutableMap.Builder<String, String> labelsBuilder = ImmutableMap.builder();

labelsBuilder.put("operation", matcher.group("operation").toLowerCase());
final String operation = matcher.group("operation").toLowerCase();
final String consistency = matcher.group("consistency");

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

if (consistency == null && (operation.equals("read") || operation.equals("write"))) {
// read/write without a consistency level is a total -- exclude
return null;

} else if (consistency != null) {
labelsBuilder.put("consistency", consistency);
}

return labelsBuilder.build();
Expand Down Expand Up @@ -514,6 +518,7 @@ public List<Factory> get() {

// org.apache.cassandra.metrics.CommitLogMetrics
{
// TODO: Rename completed_tasks_total and pending_tasks to something more appropriate
builder.add(commitLogMetricFactory(functionalCollectorConstructor(numericGaugeAsCounter()), "CompletedTasks", "completed_tasks_total", "Total number of commit log messages written (since server start)."));
builder.add(commitLogMetricFactory(functionalCollectorConstructor(numericGaugeAsGauge()), "PendingTasks", "pending_tasks", "Number of commit log messages written not yet fsync’d."));
builder.add(commitLogMetricFactory(functionalCollectorConstructor(numericGaugeAsGauge()), "TotalCommitLogSize", "size_bytes", "Total size used by all current commit log segments."));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ private StorageServiceMBeanMetricFamilyCollector(final StorageServiceMBean stora

final Map<Labels, FileStore> labeledFileStores = new HashMap<>();

// TODO: make available the directory name and type (data, commitlog, etc)

for (final String directory : directories) {
try {
final FileStore fileStore = Files.getFileStore(Paths.get(directory));
Expand Down

0 comments on commit 034c598

Please sign in to comment.