Skip to content

Commit

Permalink
Add more defensives
Browse files Browse the repository at this point in the history
  • Loading branch information
burmanm committed Oct 9, 2023
1 parent c06a117 commit c4f4b22
Showing 1 changed file with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,15 @@ List<MetricFamilySamples> getCompactionStats() {
.filter(
c -> {
String taskType = c.get("taskType");
if (taskType == null) {
// DSE 6.8 renamed the column
taskType = c.get("operationType");
}

if (taskType == null) {
return false;
}

try {
OperationType operationType = OperationType.valueOf(taskType.toUpperCase());
// Ignore taskTypes: COUNTER_CACHE_SAVE, KEY_CACHE_SAVE, ROW_CACHE_SAVE (from
Expand Down Expand Up @@ -327,11 +336,24 @@ List<MetricFamilySamples> getCompactionStats() {
List<String> labelValues =
Lists.newArrayListWithCapacity(protoCompleted.getLabelValues().size() + 5);
labelValues.addAll(protoCompleted.getLabelValues());

String compactionId = c.get("compactionId");
if (compactionId == null) {
// DSE 6.8 renamed this one also
compactionId = c.get("operationId");
}

String taskType = c.get("taskType");
if (taskType == null) {
// DSE 6.8
taskType = c.get("operationType");
}

labelValues.add(c.get("keyspace"));
labelValues.add(c.get("columnfamily"));
labelValues.add(c.get("compactionId"));
labelValues.add(compactionId);
labelValues.add(c.get("unit"));
labelValues.add(c.get("taskType"));
labelValues.add(taskType);

Collector.MetricFamilySamples.Sample completeSample =
new Collector.MetricFamilySamples.Sample(
Expand Down

0 comments on commit c4f4b22

Please sign in to comment.