Skip to content

Commit 187ca89

Browse files
committed
fix minor metrics units
1 parent a2a1c96 commit 187ca89

File tree

4 files changed

+15
-21
lines changed

4 files changed

+15
-21
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void endToEnd() throws InterruptedException {
5656
metric,
5757
"jetty.session.count",
5858
"The number of sessions established in total.",
59-
"{sessions}",
59+
"{session}",
6060
attrs -> attrs.containsKey("resource")),
6161
metric ->
6262
assertSumWithAttributes(
@@ -73,20 +73,20 @@ void endToEnd() throws InterruptedException {
7373
"s",
7474
attrs -> attrs.containsKey("resource")),
7575
metric ->
76-
assertSum(metric, "jetty.select.count", "The number of select calls.", "{operations}"),
76+
assertSum(metric, "jetty.select.count", "The number of select calls.", "{operation}"),
7777
metric ->
7878
assertGaugeWithAttributes(
7979
metric,
8080
"jetty.thread.count",
8181
"The current number of threads.",
82-
"{threads}",
82+
"{thread}",
8383
attrs -> attrs.contains(entry("state", "busy")),
8484
attrs -> attrs.contains(entry("state", "idle"))),
8585
metric ->
8686
assertGauge(
8787
metric,
8888
"jetty.thread.queue.count",
8989
"The current number of threads in the queue.",
90-
"{threads}"));
90+
"{thread}"));
9191
}
9292
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
*/
1616

1717
def beanSelector = otel.mbean("org.eclipse.jetty.io:context=*,type=managedselector,id=*")
18-
otel.instrument(beanSelector, "jetty.select.count", "The number of select calls.", "{operations}","selectCount", otel.&longCounterCallback)
18+
otel.instrument(beanSelector, "jetty.select.count", "The number of select calls.", "{operation}","selectCount", otel.&longCounterCallback)
1919

2020
def beanSessions = otel.mbean("org.eclipse.jetty.server.session:context=*,type=sessionhandler,id=*")
21-
otel.instrument(beanSessions, "jetty.session.count", "The number of sessions established in total.", "{sessions}",
21+
otel.instrument(beanSessions, "jetty.session.count", "The number of sessions established in total.", "{session}",
2222
["resource" : { mbean -> mbean.name().getKeyProperty("context") }],
2323
"sessionsCreated", otel.&longCounterCallback)
2424
otel.instrument(beanSessions, "jetty.session.time.total", "The total time sessions have been active.", "s",
@@ -29,9 +29,9 @@ otel.instrument(beanSessions, "jetty.session.time.max", "The maximum amount of t
2929
"sessionTimeMax", otel.&longValueCallback)
3030

3131
def beanThreads = otel.mbean("org.eclipse.jetty.util.thread:type=queuedthreadpool,id=*")
32-
otel.instrument(beanThreads, "jetty.thread.count", "The current number of threads.", "{threads}",
32+
otel.instrument(beanThreads, "jetty.thread.count", "The current number of threads.", "{thread}",
3333
[
3434
"busyThreads":["state" : {"busy"}],
3535
"idleThreads": ["state" : {"idle"}]
3636
], otel.&longValueCallback)
37-
otel.instrument(beanThreads, "jetty.thread.queue.count", "The current number of threads in the queue.", "{threads}","queueSize", otel.&longValueCallback)
37+
otel.instrument(beanThreads, "jetty.thread.queue.count", "The current number of threads in the queue.", "{thread}","queueSize", otel.&longValueCallback)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected void verifyMetrics() {
5757
metric,
5858
"jetty.session.count",
5959
"The number of sessions established in total.",
60-
"{sessions}",
60+
"{session}",
6161
attrs -> attrs.containsKey("resource")),
6262
metric ->
6363
assertSumWithAttributes(
@@ -78,7 +78,7 @@ protected void verifyMetrics() {
7878
metric,
7979
"jetty.select.count",
8080
"The number of select calls.",
81-
"{operations}",
81+
"{operation}",
8282
/* isMonotonic= */ true,
8383
// minor divergence from jetty.groovy with extra metrics attributes
8484
attrs -> attrs.containsKey("context").containsKey("id")),
@@ -87,14 +87,14 @@ protected void verifyMetrics() {
8787
metric,
8888
"jetty.thread.count",
8989
"The current number of threads.",
90-
"{threads}",
90+
"{thread}",
9191
attrs -> attrs.containsEntry("state", "busy"),
9292
attrs -> attrs.containsEntry("state", "idle")),
9393
metric ->
9494
assertGauge(
9595
metric,
9696
"jetty.thread.queue.count",
9797
"The current number of threads in the queue.",
98-
"{threads}"));
98+
"{thread}"));
9999
}
100100
}

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ rules:
77
selectCount:
88
metric: jetty.select.count
99
type: counter
10-
# Unit should not use a plural form, left as-is for compatibility with jetty.groovy
11-
# https://opentelemetry.io/docs/specs/semconv/general/metrics/#instrument-units
12-
unit: "{operations}"
10+
unit: "{operation}"
1311
desc: The number of select calls.
1412
metricAttribute:
1513
# minor divergence from jetty.groovy with extra attribute(s)
@@ -27,9 +25,7 @@ rules:
2725
sessionsCreated:
2826
metric: count
2927
type: counter
30-
# Unit should not use a plural form, left as-is for compatibility with jetty.groovy
31-
# https://opentelemetry.io/docs/specs/semconv/general/metrics/#instrument-units
32-
unit: "{sessions}"
28+
unit: "{session}"
3329
desc: The number of sessions established in total.
3430
sessionTimeTotal:
3531
metric: time.total
@@ -46,9 +42,7 @@ rules:
4642
- bean: org.eclipse.jetty.util.thread:type=queuedthreadpool,id=*
4743
# here the 'id' can be ignored as it's usually a single value equal to '0'
4844
prefix: jetty.thread.
49-
# Unit should not use a plural form, left as-is for compatibility with jetty.groovy
50-
# https://opentelemetry.io/docs/specs/semconv/general/metrics/#instrument-units
51-
unit: "{threads}"
45+
unit: "{thread}"
5246
mapping:
5347
busyThreads:
5448
metric: count

0 commit comments

Comments
 (0)