Skip to content

Commit 8a9bb0f

Browse files
committed
Test fixed.
Tomcat metrics description md file moved to library Code review followup
1 parent 185e60d commit 8a9bb0f

File tree

6 files changed

+25
-20
lines changed

6 files changed

+25
-20
lines changed

instrumentation/jmx-metrics/javaagent/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ No targets are enabled by default. The supported target environments are listed
2929
- [camel](camel.md)
3030
- [jetty](jetty.md)
3131
- [kafka-broker](kafka-broker.md)
32-
- [tomcat](tomcat.md)
32+
- [tomcat](../library/tomcat.md)
3333
- [wildfly](wildfly.md)
3434
- [hadoop](hadoop.md)
3535

instrumentation/jmx-metrics/javaagent/src/test/java/io/opentelemetry/instrumentation/javaagent/jmx/JmxMetricInsightInstallerTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
import java.util.Set;
2323
import org.junit.jupiter.api.Test;
2424

25+
/**
26+
* TODO: This test will eventually go away when all yaml files are moved from javaagent to library
27+
* directory. When yaml file is moved from javaagent to library then appropriate item must be
28+
* removed from JmxMetricInsightInstallerTest#FILES_TO_BE_TESTED and corresponding test must be
29+
* added in the library.
30+
*/
2531
class JmxMetricInsightInstallerTest {
2632
private static final String PATH_TO_ALL_EXISTING_RULES = "src/main/resources/jmx/rules";
2733
private static final Set<String> FILES_TO_BE_TESTED =
@@ -32,7 +38,6 @@ class JmxMetricInsightInstallerTest {
3238
"hadoop.yaml",
3339
"jetty.yaml",
3440
"kafka-broker.yaml",
35-
"tomcat.yaml",
3641
"wildfly.yaml"));
3742

3843
@Test

instrumentation/jmx-metrics/javaagent/tomcat.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@ rules:
3838
unit: &unit By
3939
desc: &desc The number of bytes transmitted.
4040
metricAttribute:
41-
tomcat.network.io.direction: const(received)
41+
network.io.direction: const(receive)
4242
bytesSent:
4343
metric: *metric
4444
type: *type
4545
unit: *unit
4646
desc: *desc
4747
metricAttribute:
48-
tomcat.network.io.direction: const(sent)
48+
network.io.direction: const(transmit)
4949

5050
- beans:
5151
- Catalina:type=Manager,host=localhost,context=*
5252
- Tomcat:type=Manager,host=localhost,context=*
5353
prefix: tomcat.
5454
metricAttribute:
55-
tomcat.web_app_context: param(context)
55+
tomcat.context: param(context)
5656
mapping:
5757
activeSessions:
5858
metric: active_session.count

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ private static MetricsVerifier createMetricsVerifier() {
105105
.isCounter()
106106
.hasDataPointsWithAttributes(
107107
attributeGroup(
108-
attribute("tomcat.network.io.direction", "sent"),
108+
attribute("network.io.direction", "receive"),
109109
requestProcessorNameAttribute),
110110
attributeGroup(
111-
attribute("tomcat.network.io.direction", "received"),
111+
attribute("network.io.direction", "transmit"),
112112
requestProcessorNameAttribute)))
113113
.add(
114114
"tomcat.active_session.count",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Tomcat Metrics
2+
3+
Here is the list of metrics based on MBeans exposed by Tomcat.
4+
5+
| Metric Name | Type | Attributes | Description |
6+
|--------------------------------|---------------|-----------------------------------------------------|-----------------------------------------|
7+
| tomcat.active_session.count | UpDownCounter | tomcat.context | The number of active sessions. |
8+
| tomcat.error.count | Counter | tomcat.request_processor.name | The number of errors. |
9+
| tomcat.request.count | Counter | tomcat.request_processor.name | The number of requests processed. |
10+
| tomcat.request.duration.max | Gauge | tomcat.request_processor.name | The longest request processing time. |
11+
| tomcat.request.processing_time | Counter | tomcat.request_processor.name | Total time for processing all requests. |
12+
| tomcat.network.io | Counter | tomcat.request_processor.name, network.io.direction | The number of bytes transmitted. |
13+
| tomcat.thread.count | UpDownCounter | tomcat.thread_pool.name, tomcat.thread.state | Thread Count of the Thread Pool |

0 commit comments

Comments
 (0)