Skip to content

Commit 04c1eb9

Browse files
authored
Change CassandraTaskExports filtering (#554)
* Change CassandraTaskExports filtering to use String instead of OperationType * Remove unused import
1 parent 2cc4fb6 commit 04c1eb9

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ Changelog for Management API, new PRs should update the `main / unreleased` sect
1010
```
1111

1212
## unreleased
13-
* [ENHANCEMENT] [#552](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/552) Improve "liveness" probe implementation
1413
* [FEATURE] [#551](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/551) Add Cassandra 5.0.2 to the build matrix
14+
* [ENHANCEMENT] [#552](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/552) Improve "liveness" probe implementation
15+
* [BUGFIX] [#553](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/553) Fix CassandraTaskExports metric filtering to make it work with 5.0.x Major compactions
1516

1617
## v0.1.87 (2024-10-02)
1718
* [FEATURE] [#535](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/535) Add Cassandra 5.0.0 to the build matrix

management-api-agent-common/src/main/java/io/k8ssandra/metrics/prometheus/CassandraTasksExports.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import java.util.List;
1818
import java.util.Map;
1919
import java.util.stream.Collectors;
20-
import org.apache.cassandra.db.compaction.OperationType;
2120
import org.slf4j.LoggerFactory;
2221

2322
/**
@@ -306,12 +305,13 @@ List<MetricFamilySamples> getCompactionStats() {
306305
}
307306

308307
try {
309-
OperationType operationType = OperationType.valueOf(taskType.toUpperCase());
308+
// Can't use OperationType since it differs between 5.0 and 4.1
309+
String operationType = taskType.toUpperCase().replaceAll(" ", "_");
310310
// Ignore taskTypes: COUNTER_CACHE_SAVE, KEY_CACHE_SAVE, ROW_CACHE_SAVE (from
311311
// Cassandra 4.1)
312-
return operationType != OperationType.COUNTER_CACHE_SAVE
313-
&& operationType != OperationType.KEY_CACHE_SAVE
314-
&& operationType != OperationType.ROW_CACHE_SAVE;
312+
return operationType != "COUNTER_CACHE_SAVE"
313+
&& operationType != "KEY_CACHE_SAVE"
314+
&& operationType != "ROW_CACHE_SAVE";
315315
} catch (IllegalArgumentException e) {
316316
return false;
317317
}

0 commit comments

Comments
 (0)