Skip to content

Commit 910e837

Browse files
committed
Thread count related metrics fixed after code review
1 parent 816b9ed commit 910e837

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

instrumentation/jmx-metrics/library/src/main/resources/jmx/rules/tomcat.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,15 @@ rules:
6464
- Catalina:type=ThreadPool,name=*
6565
- Tomcat:type=ThreadPool,name=*
6666
unit: "{thread}"
67-
prefix: tomcat.
67+
prefix: tomcat.thread.
6868
type: updowncounter
6969
metricAttribute:
7070
tomcat.thread_pool.name: param(name)
7171
mapping:
7272
currentThreadCount:
73-
metric: &metric thread.count
74-
desc: &desc Thread count of the thread pool.
75-
metricAttribute:
76-
tomcat.thread.state: const(idle)
73+
metric: count
74+
desc: Total thread count of the thread pool.
7775
currentThreadsBusy:
78-
metric: *metric
79-
desc: *desc
80-
metricAttribute:
81-
tomcat.thread.state: const(busy)
76+
metric: busy.count
77+
desc: Number of busy threads in the thread pool.
8278

instrumentation/jmx-metrics/library/src/test/java/io/opentelemetry/instrumentation/jmx/rules/TomcatIntegrationTest.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,17 @@ private static MetricsVerifier createMetricsVerifier() {
122122
"tomcat.thread.count",
123123
metric ->
124124
metric
125-
.hasDescription("Thread count of the thread pool.")
125+
.hasDescription("Total thread count of the thread pool.")
126126
.hasUnit("{thread}")
127127
.isUpDownCounter()
128-
.hasDataPointsWithAttributes(
129-
attributeGroup(
130-
attribute("tomcat.thread.state", "idle"), threadPoolNameAttribute),
131-
attributeGroup(
132-
attribute("tomcat.thread.state", "busy"), threadPoolNameAttribute)));
128+
.hasDataPointsWithOneAttribute(threadPoolNameAttribute))
129+
.add(
130+
"tomcat.thread.busy.count",
131+
metric ->
132+
metric
133+
.hasDescription("Number of busy threads in the thread pool.")
134+
.hasUnit("{thread}")
135+
.isUpDownCounter()
136+
.hasDataPointsWithOneAttribute(threadPoolNameAttribute));
133137
}
134138
}

0 commit comments

Comments
 (0)