Skip to content

Commit

Permalink
Upadte cassandra counters to be non-monotonic where appopriate (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
dehaansa committed Oct 15, 2021
1 parent 323f91e commit 3627c83
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,18 @@ protected void assertGauge(Metric metric, String name, String description, Strin
}

protected void assertSum(Metric metric, String name, String description, String unit) {
assertSum(metric, name, description, unit, true);
}

protected void assertSum(
Metric metric, String name, String description, String unit, boolean isMonotonic) {
assertThat(metric.getName()).isEqualTo(name);
assertThat(metric.getDescription()).isEqualTo(description);
assertThat(metric.getUnit()).isEqualTo(unit);
assertThat(metric.hasSum()).isTrue();
assertThat(metric.getSum().getDataPointsList())
.satisfiesExactly(point -> assertThat(point.getAttributesList()).isEmpty());
assertThat(metric.getSum().getIsMonotonic()).isEqualTo(isMonotonic);
}

protected void assertTypedGauge(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ void endToEnd() {
metric,
"cassandra.storage.load.count",
"Size of the on disk data size this node manages",
"by"),
"by",
false),
metric ->
assertSum(
metric,
Expand All @@ -173,6 +174,7 @@ void endToEnd() {
metric,
"cassandra.storage.total_hints.in_progress.count",
"Number of hints attempting to be sent currently",
"1"));
"1",
false));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def storageLoad = otel.mbean("${storage},name=Load")
otel.instrument(storageLoad,
"cassandra.storage.load.count",
"Size of the on disk data size this node manages", "by", "Count",
otel.&longCounterCallback)
otel.&longUpDownCounterCallback)

def storageTotalHints = otel.mbean("${storage},name=TotalHints")
otel.instrument(storageTotalHints,
Expand All @@ -135,7 +135,7 @@ def storageTotalHintsInProgress = otel.mbean("${storage},name=TotalHintsInProgre
otel.instrument(storageTotalHintsInProgress,
"cassandra.storage.total_hints.in_progress.count",
"Number of hints attempting to be sent currently", "1", "Count",
otel.&longCounterCallback)
otel.&longUpDownCounterCallback)

def compaction = "${cassandraMetrics}:type=Compaction"
def compactionPendingTasks = otel.mbean("${compaction},name=PendingTasks")
Expand Down

0 comments on commit 3627c83

Please sign in to comment.