Skip to content

Commit

Permalink
Fix LatencyMetrics for DSE (#565)
Browse files Browse the repository at this point in the history
  • Loading branch information
emerkle826 authored Oct 30, 2024
1 parent 7ba34b3 commit b0c63bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Changelog for Management API, new PRs should update the `main / unreleased` sect
```

## unreleased
* [BUGFIX] [#564](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/564) Fix LatencyMetrics for DSE

## v0.1.88 (2024-10-28)
* [CHANGE] [#556](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/556) Update Management API dependencies to address CVEs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,12 +528,21 @@ public void onTimerRemoved(String name) {
*/
private boolean isMicrosecondLatencyBuckets() {

// This should only catch Cassandra 4.1+ and 5+ versions. DSE 6.8 reports something like
// 4.0.0.6851 and 6.9 reports something like 4.0.0.693, both of which would follow C* 4.0.x
// nanosecond buckets
if (SERVER_MAJOR_VERSION > 4 || (SERVER_MAJOR_VERSION == 4 && SERVER_MINOR_VERSION > 0)) {
// Only Cassandra 4.1 and newer should use microsecond resolution.

boolean isCassandra = false;
try {
Class.forName("org.apache.cassandra.utils.CassandraVersion");
isCassandra = true;
} catch (ClassNotFoundException cfne) {
// DSE doesn't have CassandraVersion
}
if (isCassandra
&& (SERVER_MAJOR_VERSION > 4 || (SERVER_MAJOR_VERSION == 4 && SERVER_MINOR_VERSION > 0))) {
logger.info("Server version indicates metrics are microsecond resolution");
return true;
}
logger.info("Server version indicates metrics are nanosecond resolution");
return false;
}
}

0 comments on commit b0c63bc

Please sign in to comment.