Skip to content

Commit 20354af

Browse files
committed
all but session metrics covered
1 parent 7dbafa8 commit 20354af

File tree

2 files changed

+82
-11
lines changed

2 files changed

+82
-11
lines changed

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

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package io.opentelemetry.contrib.jmxscraper.target_systems;
77

8+
import static io.opentelemetry.contrib.jmxscraper.target_systems.MetricAssertions.assertSum;
89
import static io.opentelemetry.contrib.jmxscraper.target_systems.MetricAssertions.assertSumWithAttributes;
910
import static org.assertj.core.api.Assertions.entry;
1011

@@ -126,6 +127,39 @@ protected void verifyMetrics() {
126127
attrs.containsOnly(
127128
entry("server", "default-server"),
128129
entry("listener", "default"),
129-
entry("state", "out"))));
130+
entry("state", "out"))),
131+
metric ->
132+
assertSumWithAttributes(
133+
metric,
134+
"wildfly.jdbc.connection.open",
135+
"The number of open jdbc connections.",
136+
"{connection}",
137+
attrs ->
138+
attrs.containsOnly(entry("data_source", "ExampleDS"), entry("state", "active")),
139+
attrs ->
140+
attrs.containsOnly(entry("data_source", "ExampleDS"), entry("state", "idle"))),
141+
metric ->
142+
assertSumWithAttributes(
143+
metric,
144+
"wildfly.jdbc.request.wait",
145+
"The number of jdbc connections that had to wait before opening.",
146+
"{request}",
147+
attrs -> attrs.containsOnly(entry("data_source", "ExampleDS"))),
148+
metric ->
149+
assertSum(
150+
metric,
151+
"wildfly.jdbc.transaction.count",
152+
"The number of transactions created.",
153+
"{transaction}"),
154+
metric ->
155+
assertSumWithAttributes(
156+
metric,
157+
"wildfly.jdbc.rollback.count",
158+
"The number of transactions rolled back.",
159+
"{transaction}",
160+
attrs -> attrs.containsOnly(entry("cause", "system")),
161+
attrs -> attrs.containsOnly(entry("cause", "resource")),
162+
attrs -> attrs.containsOnly(entry("cause", "application")))
163+
);
130164
}
131165
}

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

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22

33
rules:
44

5-
# TODO: sessions are not tested in the original groovy implementation
6-
- bean: jboss.as:deployment=*,subsystem=undertow
7-
metricAttribute:
8-
deployment: param(deployment)
9-
mapping:
10-
sessionsCreated:
11-
metric: wildfly.session.count
12-
unit: "{session}"
13-
desc: The number of sessions created.
14-
155
- bean: jboss.as:subsystem=undertow,server=*,http-listener=*
166
metricAttribute:
177
server: param(server)
@@ -43,3 +33,50 @@ rules:
4333
desc: "The number of bytes transmitted."
4434
metricAttribute:
4535
state: const(in)
36+
37+
- bean: jboss.as:subsystem=datasources,data-source=*,statistics=pool
38+
metricAttribute:
39+
data_source: param(data-source)
40+
type: counter
41+
prefix: wildfly.jdbc.
42+
mapping:
43+
ActiveCount:
44+
metric: connection.open
45+
unit: "{connection}"
46+
desc: The number of open jdbc connections.
47+
metricAttribute:
48+
state: const(active)
49+
IdleCount:
50+
metric: connection.open
51+
unit: "{connection}"
52+
desc: The number of open jdbc connections.
53+
metricAttribute:
54+
state: const(idle)
55+
WaitCount:
56+
metric: request.wait
57+
unit: "{request}"
58+
desc: The number of jdbc connections that had to wait before opening.
59+
60+
- bean: jboss.as:subsystem=transactions
61+
prefix: wildfly.jdbc.
62+
unit: "{transaction}"
63+
type: counter
64+
mapping:
65+
numberOfTransactions:
66+
metric: transaction.count
67+
desc: The number of transactions created.
68+
numberOfSystemRollbacks:
69+
metric: rollback.count
70+
desc: The number of transactions rolled back.
71+
metricAttribute:
72+
cause: const(system)
73+
numberOfResourceRollbacks:
74+
metric: rollback.count
75+
desc: The number of transactions rolled back.
76+
metricAttribute:
77+
cause: const(resource)
78+
numberOfApplicationRollbacks:
79+
metric: rollback.count
80+
desc: The number of transactions rolled back.
81+
metricAttribute:
82+
cause: const(application)

0 commit comments

Comments
 (0)