Skip to content

Commit 676b634

Browse files
committed
fix tomcat integration test
1 parent dd5058d commit 676b634

File tree

1 file changed

+56
-32
lines changed

1 file changed

+56
-32
lines changed

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

Lines changed: 56 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -49,73 +49,97 @@ protected JmxScraperContainer customizeScraperContainer(
4949
protected MetricsVerifier createMetricsVerifier() {
5050
return MetricsVerifier.create()
5151
.add(
52-
"tomcat.sessions",
52+
"tomcat.session.active.count",
5353
metric ->
5454
metric
55-
.hasDescription("The number of active sessions")
55+
.hasDescription("The number of currently active sessions.")
5656
.hasUnit("{session}")
57-
.isGauge()
58-
.hasDataPointsWithOneAttribute(attributeWithAnyValue("context")))
57+
.isUpDownCounter()
58+
.hasDataPointsWithOneAttribute(attributeWithAnyValue("tomcat.context")))
5959
.add(
60-
"tomcat.errors",
60+
"tomcat.error.count",
6161
metric ->
6262
metric
63-
.hasDescription("The number of errors encountered")
63+
.hasDescription("The number of errors.")
6464
.hasUnit("{error}")
6565
.isCounter()
66-
.hasDataPointsWithOneAttribute(attribute("proto_handler", "\"http-nio-8080\"")))
66+
.hasDataPointsWithOneAttribute(attribute("tomcat.request.processor.name", "\"http-nio-8080\"")))
6767
.add(
68-
"tomcat.processing_time",
68+
"tomcat.request.duration.sum",
6969
metric ->
7070
metric
71-
.hasDescription("The total processing time")
72-
.hasUnit("ms")
71+
.hasDescription("Total time of processing all requests.")
72+
.hasUnit("s")
7373
.isCounter()
74-
.hasDataPointsWithOneAttribute(attribute("proto_handler", "\"http-nio-8080\"")))
74+
.hasDataPointsWithOneAttribute(attribute("tomcat.request.processor.name", "\"http-nio-8080\"")))
7575
.add(
76-
"tomcat.traffic",
76+
"tomcat.network.io",
7777
metric ->
7878
metric
79-
.hasDescription("The number of bytes transmitted and received")
79+
.hasDescription("The number of bytes transmitted.")
8080
.hasUnit("By")
8181
.isCounter()
8282
.hasDataPointsWithAttributes(
8383
attributeGroup(
84-
attribute("direction", "sent"),
85-
attribute("proto_handler", "\"http-nio-8080\"")),
84+
attribute("network.io.direction", "transmit"),
85+
attribute("tomcat.request.processor.name", "\"http-nio-8080\"")),
8686
attributeGroup(
87-
attribute("direction", "received"),
88-
attribute("proto_handler", "\"http-nio-8080\""))))
87+
attribute("network.io.direction", "receive"),
88+
attribute("tomcat.request.processor.name", "\"http-nio-8080\""))))
8989
.add(
90-
"tomcat.threads",
90+
"tomcat.thread.count",
9191
metric ->
9292
metric
93-
.hasDescription("The number of threads")
93+
.hasDescription("Total thread count of the thread pool.")
9494
.hasUnit("{thread}")
95-
.isGauge()
95+
.isUpDownCounter()
9696
.hasDataPointsWithAttributes(
97+
// attributeGroup(
98+
// attribute("state", "idle"),
99+
// attribute("tomcat.thread.pool.name", "\"http-nio-8080\"")),
97100
attributeGroup(
98-
attribute("state", "idle"),
99-
attribute("proto_handler", "\"http-nio-8080\"")),
100-
attributeGroup(
101-
attribute("state", "busy"),
102-
attribute("proto_handler", "\"http-nio-8080\""))))
101+
// attribute("state", "busy"),
102+
attribute("tomcat.thread.pool.name", "\"http-nio-8080\""))))
103103
.add(
104-
"tomcat.max_time",
104+
"tomcat.request.duration.max",
105105
metric ->
106106
metric
107-
.hasDescription("Maximum time to process a request")
108-
.hasUnit("ms")
107+
.hasDescription("The longest request processing time.")
108+
.hasUnit("s")
109109
.isGauge()
110-
.hasDataPointsWithOneAttribute(attribute("proto_handler", "\"http-nio-8080\"")))
110+
.hasDataPointsWithOneAttribute(attribute("tomcat.request.processor.name", "\"http-nio-8080\"")))
111111
.add(
112-
"tomcat.request_count",
112+
"tomcat.request.count",
113113
metric ->
114114
metric
115-
.hasDescription("The total requests")
115+
.hasDescription("The number of requests processed.")
116116
.hasUnit("{request}")
117117
.isCounter()
118118
.hasDataPointsWithOneAttribute(
119-
attribute("proto_handler", "\"http-nio-8080\"")));
119+
attribute("tomcat.request.processor.name", "\"http-nio-8080\"")))
120+
.add("tomcat.thread.busy.count",
121+
metric ->
122+
metric
123+
.hasDescription("Number of busy threads in the thread pool.")
124+
.hasUnit("{thread}")
125+
.isUpDownCounter()
126+
.hasDataPointsWithOneAttribute(
127+
attribute("tomcat.thread.pool.name", "\"http-nio-8080\"")))
128+
.add("tomcat.session.active.limit",
129+
metric ->
130+
metric
131+
.hasDescription("Maximum possible number of active sessions.")
132+
.hasUnit("{session}")
133+
.isUpDownCounter()
134+
.hasDataPointsWithOneAttribute(
135+
attribute("tomcat.context", "/")))
136+
.add("tomcat.thread.limit",
137+
metric ->
138+
metric
139+
.hasDescription("Maximum possible number of threads in the thread pool.")
140+
.hasUnit("{thread}")
141+
.isUpDownCounter()
142+
.hasDataPointsWithOneAttribute(
143+
attribute("tomcat.thread.pool.name", "\"http-nio-8080\"")));
120144
}
121145
}

0 commit comments

Comments
 (0)