Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jmx-scraper] Update Cassandra units to match semconv #1591

Merged
merged 3 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,39 +86,39 @@ void endToEnd() {
metric,
"cassandra.compaction.tasks.completed",
"Number of completed compactions since server [re]start",
"1"),
"{task}"),
metric ->
assertGauge(
metric,
"cassandra.compaction.tasks.pending",
"Estimated number of compactions remaining to perform",
"1"),
"{task}"),
metric ->
assertSum(
metric,
"cassandra.storage.load.count",
"Size of the on disk data size this node manages",
"by",
"By",
/* isMonotonic= */ false),
metric ->
assertSum(
metric,
"cassandra.storage.total_hints.count",
"Number of hint messages written to this node since [re]start",
"1"),
"{hint}"),
metric ->
assertSum(
metric,
"cassandra.storage.total_hints.in_progress.count",
"Number of hints attempting to be sent currently",
"1",
"{hint}",
/* isMonotonic= */ false),
metric ->
assertSumWithAttributes(
metric,
"cassandra.client.request.count",
"Number of requests by operation",
"1",
"{request}",
attrs -> attrs.containsOnly(entry("operation", "RangeSlice")),
attrs -> attrs.containsOnly(entry("operation", "Read")),
attrs -> attrs.containsOnly(entry("operation", "Write"))),
Expand All @@ -127,7 +127,7 @@ void endToEnd() {
metric,
"cassandra.client.request.error.count",
"Number of request errors by operation",
"1",
"{error}",
getRequestErrorCountAttributes()));
}

Expand Down
14 changes: 7 additions & 7 deletions jmx-metrics/src/main/resources/target-systems/cassandra.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -72,33 +72,33 @@ def storage = "${cassandraMetrics}:type=Storage"
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",
"Size of the on disk data size this node manages", "By", "Count",
otel.&longUpDownCounterCallback)

def storageTotalHints = otel.mbean("${storage},name=TotalHints")
otel.instrument(storageTotalHints,
"cassandra.storage.total_hints.count",
"Number of hint messages written to this node since [re]start", "1", "Count",
"Number of hint messages written to this node since [re]start", "{hint}", "Count",
otel.&longCounterCallback)

def storageTotalHintsInProgress = otel.mbean("${storage},name=TotalHintsInProgress")
otel.instrument(storageTotalHintsInProgress,
"cassandra.storage.total_hints.in_progress.count",
"Number of hints attempting to be sent currently", "1", "Count",
"Number of hints attempting to be sent currently", "{hint}", "Count",
otel.&longUpDownCounterCallback)


def compaction = "${cassandraMetrics}:type=Compaction"
def compactionPendingTasks = otel.mbean("${compaction},name=PendingTasks")
otel.instrument(compactionPendingTasks,
"cassandra.compaction.tasks.pending",
"Estimated number of compactions remaining to perform", "1", "Value",
"Estimated number of compactions remaining to perform", "{task}", "Value",
otel.&longValueCallback)

def compactionCompletedTasks = otel.mbean("${compaction},name=CompletedTasks")
otel.instrument(compactionCompletedTasks,
"cassandra.compaction.tasks.completed",
"Number of completed compactions since server [re]start", "1", "Value",
"Number of completed compactions since server [re]start", "{task}", "Value",
otel.&longCounterCallback)


Expand All @@ -111,7 +111,7 @@ def clientRequests = otel.mbeans([
otel.instrument(clientRequests,
"cassandra.client.request.count",
"Number of requests by operation",
"1",
"{request}",
[
"operation" : { mbean -> mbean.name().getKeyProperty("scope") },
],
Expand All @@ -132,7 +132,7 @@ def clientRequestErrors = otel.mbeans([
otel.instrument(clientRequestErrors,
"cassandra.client.request.error.count",
"Number of request errors by operation",
"1",
"{error}",
[
"operation" : { mbean -> mbean.name().getKeyProperty("scope") },
"status" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,47 +118,47 @@ protected MetricsVerifier createMetricsVerifier() {
metric ->
metric
.hasDescription("Number of completed compactions since server [re]start")
.hasUnit("1")
.hasUnit("{task}")
.isCounter()
.hasDataPointsWithoutAttributes())
.add(
"cassandra.compaction.tasks.pending",
metric ->
metric
.hasDescription("Estimated number of compactions remaining to perform")
.hasUnit("1")
.hasUnit("{task}")
.isGauge()
.hasDataPointsWithoutAttributes())
.add(
"cassandra.storage.load.count",
metric ->
metric
.hasDescription("Size of the on disk data size this node manages")
.hasUnit("by")
.hasUnit("By")
.isUpDownCounter()
.hasDataPointsWithoutAttributes())
.add(
"cassandra.storage.total_hints.count",
metric ->
metric
.hasDescription("Number of hint messages written to this node since [re]start")
.hasUnit("1")
.hasUnit("{hint}")
.isCounter()
.hasDataPointsWithoutAttributes())
.add(
"cassandra.storage.total_hints.in_progress.count",
metric ->
metric
.hasDescription("Number of hints attempting to be sent currently")
.hasUnit("1")
.hasUnit("{hint}")
.isUpDownCounter()
.hasDataPointsWithoutAttributes())
.add(
"cassandra.client.request.count",
metric ->
metric
.hasDescription("Number of requests by operation")
.hasUnit("1")
.hasUnit("{request}")
.isCounter()
.hasDataPointsWithAttributes(
attributeGroup(attribute("operation", "RangeSlice")),
Expand All @@ -169,7 +169,7 @@ protected MetricsVerifier createMetricsVerifier() {
metric ->
metric
.hasDescription("Number of request errors by operation")
.hasUnit("1")
.hasUnit("{error}")
.isCounter()
.hasDataPointsWithAttributes(
errorCountAttributes("RangeSlice", "Timeout"),
Expand Down
18 changes: 9 additions & 9 deletions jmx-scraper/src/main/resources/cassandra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ rules:
Value:
metric: cassandra.compaction.tasks.completed
type: counter
unit: "1"
unit: "{task}"
desc: Number of completed compactions since server [re]start

- bean: org.apache.cassandra.metrics:type=Compaction,name=PendingTasks
mapping:
Value:
metric: cassandra.compaction.tasks.pending
type: gauge
unit: "1"
unit: "{task}"
desc: Estimated number of compactions remaining to perform

# Storage
Expand All @@ -23,23 +23,23 @@ rules:
Count:
metric: cassandra.storage.load.count
type: updowncounter
unit: by
unit: By
desc: Size of the on disk data size this node manages

- bean: org.apache.cassandra.metrics:type=Storage,name=TotalHints
mapping:
Count:
metric: cassandra.storage.total_hints.count
type: counter
unit: "1"
unit: "{hint}"
desc: Number of hint messages written to this node since [re]start

- bean: org.apache.cassandra.metrics:type=Storage,name=TotalHintsInProgress
mapping:
Count:
metric: cassandra.storage.total_hints.in_progress.count
type: updowncounter
unit: "1"
unit: "{hint}"
desc: Number of hints attempting to be sent currently

# Client latency
Expand Down Expand Up @@ -99,7 +99,7 @@ rules:
Count:
metric: cassandra.client.request.count
type: counter
unit: "1"
unit: "{request}"
desc: Number of requests by operation

# Client error count
Expand All @@ -114,7 +114,7 @@ rules:
Count:
metric: cassandra.client.request.error.count
type: counter
unit: "1"
unit: "{error}"
desc: Number of request errors by operation

- beans:
Expand All @@ -128,7 +128,7 @@ rules:
Count:
metric: cassandra.client.request.error.count
type: counter
unit: "1"
unit: "{error}"
desc: Number of request errors by operation

- beans:
Expand All @@ -142,5 +142,5 @@ rules:
Count:
metric: cassandra.client.request.error.count
type: counter
unit: "1"
unit: "{error}"
desc: Number of request errors by operation
Loading