Skip to content

Commit 299b35c

Browse files
committed
Code review changes
1 parent f8cc647 commit 299b35c

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ rules:
5858
metric: session.active.count
5959
type: updowncounter
6060
unit: "{session}"
61-
desc: The number of active sessions.
61+
desc: The number of currently active sessions.
62+
maxActiveSessions:
63+
metric: session.active.limit
64+
type: updowncounter
65+
unit: "{session}"
66+
desc: Maximum number of active sessions.
6267

6368
- beans:
6469
- Catalina:type=ThreadPool,name=*
@@ -72,6 +77,9 @@ rules:
7277
currentThreadCount:
7378
metric: count
7479
desc: Total thread count of the thread pool.
80+
maxThreads:
81+
metric: limit
82+
desc: Maximum thread count of the thread pool.
7583
currentThreadsBusy:
7684
metric: busy.count
7785
desc: Number of busy threads in the thread pool.

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

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void testCollectedMetrics(String dockerImageName, String sampleWebApplicationUrl
4848

4949
startTarget(target);
5050

51-
// Deploy example web application to the tomcat to enable reporting tomcat.active_session.count
51+
// Deploy example web application to the tomcat to enable reporting tomcat.session.active.count
5252
// metric
5353
target.execInContainer("rm", "-fr", "/usr/local/tomcat/webapps/ROOT");
5454
target.execInContainer(
@@ -61,7 +61,7 @@ private static MetricsVerifier createMetricsVerifier() {
6161
AttributeMatcher requestProcessorNameAttribute =
6262
attribute("tomcat.request_processor.name", "\"http-nio-8080\"");
6363
AttributeMatcher threadPoolNameAttribute =
64-
attribute("tomcat.thread_pool.name", "\"http-nio-8080\"");
64+
attribute("tomcat.thread.pool.name", "\"http-nio-8080\"");
6565

6666
return MetricsVerifier.create()
6767
.add(
@@ -111,10 +111,18 @@ private static MetricsVerifier createMetricsVerifier() {
111111
attribute("network.io.direction", "transmit"),
112112
requestProcessorNameAttribute)))
113113
.add(
114-
"tomcat.active_session.count",
114+
"tomcat.session.active.count",
115115
metric ->
116116
metric
117-
.hasDescription("The number of active sessions.")
117+
.hasDescription("The number of currently active sessions.")
118+
.hasUnit("{session}")
119+
.isUpDownCounter()
120+
.hasDataPointsWithOneAttribute(attributeWithAnyValue("tomcat.context")))
121+
.add(
122+
"tomcat.session.active.limit",
123+
metric ->
124+
metric
125+
.hasDescription("Maximum number of active sessions.")
118126
.hasUnit("{session}")
119127
.isUpDownCounter()
120128
.hasDataPointsWithOneAttribute(attributeWithAnyValue("tomcat.context")))
@@ -126,6 +134,14 @@ private static MetricsVerifier createMetricsVerifier() {
126134
.hasUnit("{thread}")
127135
.isUpDownCounter()
128136
.hasDataPointsWithOneAttribute(threadPoolNameAttribute))
137+
.add(
138+
"tomcat.thread.limit",
139+
metric ->
140+
metric
141+
.hasDescription("Maximum thread count of the thread pool.")
142+
.hasUnit("{thread}")
143+
.isUpDownCounter()
144+
.hasDataPointsWithOneAttribute(threadPoolNameAttribute))
129145
.add(
130146
"tomcat.thread.busy.count",
131147
metric ->

0 commit comments

Comments
 (0)