Skip to content

Commit 6c3add9

Browse files
authored
[jmx-scraper] Update Cassandra units to match semconv (#1591)
1 parent 10e8994 commit 6c3add9

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

jmx-metrics/src/integrationTest/java/io/opentelemetry/contrib/jmxmetrics/target_systems/CassandraIntegrationTest.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -86,39 +86,39 @@ void endToEnd() {
8686
metric,
8787
"cassandra.compaction.tasks.completed",
8888
"Number of completed compactions since server [re]start",
89-
"1"),
89+
"{task}"),
9090
metric ->
9191
assertGauge(
9292
metric,
9393
"cassandra.compaction.tasks.pending",
9494
"Estimated number of compactions remaining to perform",
95-
"1"),
95+
"{task}"),
9696
metric ->
9797
assertSum(
9898
metric,
9999
"cassandra.storage.load.count",
100100
"Size of the on disk data size this node manages",
101-
"by",
101+
"By",
102102
/* isMonotonic= */ false),
103103
metric ->
104104
assertSum(
105105
metric,
106106
"cassandra.storage.total_hints.count",
107107
"Number of hint messages written to this node since [re]start",
108-
"1"),
108+
"{hint}"),
109109
metric ->
110110
assertSum(
111111
metric,
112112
"cassandra.storage.total_hints.in_progress.count",
113113
"Number of hints attempting to be sent currently",
114-
"1",
114+
"{hint}",
115115
/* isMonotonic= */ false),
116116
metric ->
117117
assertSumWithAttributes(
118118
metric,
119119
"cassandra.client.request.count",
120120
"Number of requests by operation",
121-
"1",
121+
"{request}",
122122
attrs -> attrs.containsOnly(entry("operation", "RangeSlice")),
123123
attrs -> attrs.containsOnly(entry("operation", "Read")),
124124
attrs -> attrs.containsOnly(entry("operation", "Write"))),
@@ -127,7 +127,7 @@ void endToEnd() {
127127
metric,
128128
"cassandra.client.request.error.count",
129129
"Number of request errors by operation",
130-
"1",
130+
"{error}",
131131
getRequestErrorCountAttributes()));
132132
}
133133

jmx-metrics/src/main/resources/target-systems/cassandra.groovy

+7-7
Original file line numberDiff line numberDiff line change
@@ -72,33 +72,33 @@ def storage = "${cassandraMetrics}:type=Storage"
7272
def storageLoad = otel.mbean("${storage},name=Load")
7373
otel.instrument(storageLoad,
7474
"cassandra.storage.load.count",
75-
"Size of the on disk data size this node manages", "by", "Count",
75+
"Size of the on disk data size this node manages", "By", "Count",
7676
otel.&longUpDownCounterCallback)
7777

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

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

9090

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

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

104104

@@ -111,7 +111,7 @@ def clientRequests = otel.mbeans([
111111
otel.instrument(clientRequests,
112112
"cassandra.client.request.count",
113113
"Number of requests by operation",
114-
"1",
114+
"{request}",
115115
[
116116
"operation" : { mbean -> mbean.name().getKeyProperty("scope") },
117117
],
@@ -132,7 +132,7 @@ def clientRequestErrors = otel.mbeans([
132132
otel.instrument(clientRequestErrors,
133133
"cassandra.client.request.error.count",
134134
"Number of request errors by operation",
135-
"1",
135+
"{error}",
136136
[
137137
"operation" : { mbean -> mbean.name().getKeyProperty("scope") },
138138
"status" : {

jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/CassandraIntegrationTest.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -118,47 +118,47 @@ protected MetricsVerifier createMetricsVerifier() {
118118
metric ->
119119
metric
120120
.hasDescription("Number of completed compactions since server [re]start")
121-
.hasUnit("1")
121+
.hasUnit("{task}")
122122
.isCounter()
123123
.hasDataPointsWithoutAttributes())
124124
.add(
125125
"cassandra.compaction.tasks.pending",
126126
metric ->
127127
metric
128128
.hasDescription("Estimated number of compactions remaining to perform")
129-
.hasUnit("1")
129+
.hasUnit("{task}")
130130
.isGauge()
131131
.hasDataPointsWithoutAttributes())
132132
.add(
133133
"cassandra.storage.load.count",
134134
metric ->
135135
metric
136136
.hasDescription("Size of the on disk data size this node manages")
137-
.hasUnit("by")
137+
.hasUnit("By")
138138
.isUpDownCounter()
139139
.hasDataPointsWithoutAttributes())
140140
.add(
141141
"cassandra.storage.total_hints.count",
142142
metric ->
143143
metric
144144
.hasDescription("Number of hint messages written to this node since [re]start")
145-
.hasUnit("1")
145+
.hasUnit("{hint}")
146146
.isCounter()
147147
.hasDataPointsWithoutAttributes())
148148
.add(
149149
"cassandra.storage.total_hints.in_progress.count",
150150
metric ->
151151
metric
152152
.hasDescription("Number of hints attempting to be sent currently")
153-
.hasUnit("1")
153+
.hasUnit("{hint}")
154154
.isUpDownCounter()
155155
.hasDataPointsWithoutAttributes())
156156
.add(
157157
"cassandra.client.request.count",
158158
metric ->
159159
metric
160160
.hasDescription("Number of requests by operation")
161-
.hasUnit("1")
161+
.hasUnit("{request}")
162162
.isCounter()
163163
.hasDataPointsWithAttributes(
164164
attributeGroup(attribute("operation", "RangeSlice")),
@@ -169,7 +169,7 @@ protected MetricsVerifier createMetricsVerifier() {
169169
metric ->
170170
metric
171171
.hasDescription("Number of request errors by operation")
172-
.hasUnit("1")
172+
.hasUnit("{error}")
173173
.isCounter()
174174
.hasDataPointsWithAttributes(
175175
errorCountAttributes("RangeSlice", "Timeout"),

jmx-scraper/src/main/resources/cassandra.yaml

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ rules:
66
Value:
77
metric: cassandra.compaction.tasks.completed
88
type: counter
9-
unit: "1"
9+
unit: "{task}"
1010
desc: Number of completed compactions since server [re]start
1111

1212
- bean: org.apache.cassandra.metrics:type=Compaction,name=PendingTasks
1313
mapping:
1414
Value:
1515
metric: cassandra.compaction.tasks.pending
1616
type: gauge
17-
unit: "1"
17+
unit: "{task}"
1818
desc: Estimated number of compactions remaining to perform
1919

2020
# Storage
@@ -23,23 +23,23 @@ rules:
2323
Count:
2424
metric: cassandra.storage.load.count
2525
type: updowncounter
26-
unit: by
26+
unit: By
2727
desc: Size of the on disk data size this node manages
2828

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

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

4545
# Client latency
@@ -99,7 +99,7 @@ rules:
9999
Count:
100100
metric: cassandra.client.request.count
101101
type: counter
102-
unit: "1"
102+
unit: "{request}"
103103
desc: Number of requests by operation
104104

105105
# Client error count
@@ -114,7 +114,7 @@ rules:
114114
Count:
115115
metric: cassandra.client.request.error.count
116116
type: counter
117-
unit: "1"
117+
unit: "{error}"
118118
desc: Number of request errors by operation
119119

120120
- beans:
@@ -128,7 +128,7 @@ rules:
128128
Count:
129129
metric: cassandra.client.request.error.count
130130
type: counter
131-
unit: "1"
131+
unit: "{error}"
132132
desc: Number of request errors by operation
133133

134134
- beans:
@@ -142,5 +142,5 @@ rules:
142142
Count:
143143
metric: cassandra.client.request.error.count
144144
type: counter
145-
unit: "1"
145+
unit: "{error}"
146146
desc: Number of request errors by operation

0 commit comments

Comments
 (0)