Skip to content

Commit 2c65318

Browse files
committed
refactor activemq
1 parent 5ae735d commit 2c65318

File tree

1 file changed

+87
-47
lines changed

1 file changed

+87
-47
lines changed

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

Lines changed: 87 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -49,62 +49,102 @@ protected MetricsVerifier createMetricsVerifier() {
4949
.hasDataPointsAttributes(
5050
entry("destination", "ActiveMQ.Advisory.MasterBroker"),
5151
entry("broker", "localhost")))
52-
.assertUpDownCounterWithAttributes(
52+
.add(
5353
"activemq.producer.count",
54-
"The number of producers currently attached to the broker.",
55-
"{producer}",
56-
entry("destination", "ActiveMQ.Advisory.MasterBroker"),
57-
entry("broker", "localhost"))
58-
.assertUpDownCounterWithAttributes(
54+
metric ->
55+
metric
56+
.hasDescription("The number of producers currently attached to the broker.")
57+
.hasUnit("{producer}")
58+
.isUpDownCounter()
59+
.hasDataPointsAttributes(
60+
entry("destination", "ActiveMQ.Advisory.MasterBroker"),
61+
entry("broker", "localhost")))
62+
.add(
5963
"activemq.connection.count",
60-
"The total number of current connections.",
61-
"{connection}",
62-
entry("broker", "localhost"))
63-
.assertGaugeWithAttributes(
64+
metric ->
65+
metric
66+
.hasDescription("The total number of current connections.")
67+
.hasUnit("{connection}")
68+
.isUpDownCounter()
69+
.hasDataPointsAttributes(entry("broker", "localhost")))
70+
.add(
6471
"activemq.memory.usage",
65-
"The percentage of configured memory used.",
66-
"%",
67-
entry("destination", "ActiveMQ.Advisory.MasterBroker"),
68-
entry("broker", "localhost"))
69-
.assertGaugeWithAttributes(
72+
metric ->
73+
metric
74+
.hasDescription("The percentage of configured memory used.")
75+
.hasUnit("%")
76+
.isGauge()
77+
.hasDataPointsAttributes(
78+
entry("destination", "ActiveMQ.Advisory.MasterBroker"),
79+
entry("broker", "localhost")))
80+
.add(
7081
"activemq.disk.store_usage",
71-
"The percentage of configured disk used for persistent messages.",
72-
"%",
73-
entry("broker", "localhost"))
74-
.assertGaugeWithAttributes(
82+
metric ->
83+
metric
84+
.hasDescription(
85+
"The percentage of configured disk used for persistent messages.")
86+
.hasUnit("%")
87+
.isGauge()
88+
.hasDataPointsAttributes(entry("broker", "localhost")))
89+
.add(
7590
"activemq.disk.temp_usage",
76-
"The percentage of configured disk used for non-persistent messages.",
77-
"%",
78-
entry("broker", "localhost"))
79-
.assertUpDownCounterWithAttributes(
91+
metric ->
92+
metric
93+
.hasDescription(
94+
"The percentage of configured disk used for non-persistent messages.")
95+
.hasUnit("%")
96+
.isGauge()
97+
.hasDataPointsAttributes(entry("broker", "localhost")))
98+
.add(
8099
"activemq.message.current",
81-
"The current number of messages waiting to be consumed.",
82-
"{message}",
83-
entry("destination", "ActiveMQ.Advisory.MasterBroker"),
84-
entry("broker", "localhost"))
85-
.assertCounterWithAttributes(
100+
metric ->
101+
metric
102+
.hasDescription("The current number of messages waiting to be consumed.")
103+
.hasUnit("{message}")
104+
.isUpDownCounter()
105+
.hasDataPointsAttributes(
106+
entry("destination", "ActiveMQ.Advisory.MasterBroker"),
107+
entry("broker", "localhost")))
108+
.add(
86109
"activemq.message.expired",
87-
"The total number of messages not delivered because they expired.",
88-
"{message}",
89-
entry("destination", "ActiveMQ.Advisory.MasterBroker"),
90-
entry("broker", "localhost"))
91-
.assertCounterWithAttributes(
110+
metric ->
111+
metric
112+
.hasDescription(
113+
"The total number of messages not delivered because they expired.")
114+
.hasUnit("{message}")
115+
.isCounter()
116+
.hasDataPointsAttributes(
117+
entry("destination", "ActiveMQ.Advisory.MasterBroker"),
118+
entry("broker", "localhost")))
119+
.add(
92120
"activemq.message.enqueued",
93-
"The total number of messages received by the broker.",
94-
"{message}",
95-
entry("destination", "ActiveMQ.Advisory.MasterBroker"),
96-
entry("broker", "localhost"))
97-
.assertCounterWithAttributes(
121+
metric ->
122+
metric
123+
.hasDescription("The total number of messages received by the broker.")
124+
.hasUnit("{message}")
125+
.isCounter()
126+
.hasDataPointsAttributes(
127+
entry("destination", "ActiveMQ.Advisory.MasterBroker"),
128+
entry("broker", "localhost")))
129+
.add(
98130
"activemq.message.dequeued",
99-
"The total number of messages delivered to consumers.",
100-
"{message}",
101-
entry("destination", "ActiveMQ.Advisory.MasterBroker"),
102-
entry("broker", "localhost"))
103-
.assertGaugeWithAttributes(
131+
metric ->
132+
metric
133+
.hasDescription("The total number of messages delivered to consumers.")
134+
.hasUnit("{message}")
135+
.isCounter()
136+
.hasDataPointsAttributes(
137+
entry("destination", "ActiveMQ.Advisory.MasterBroker"),
138+
entry("broker", "localhost")))
139+
.add(
104140
"activemq.message.wait_time.avg",
105-
"The average time a message was held on a destination.",
106-
"ms",
107-
entry("destination", "ActiveMQ.Advisory.MasterBroker"),
108-
entry("broker", "localhost"));
141+
metric ->
142+
metric
143+
.hasDescription("The average time a message was held on a destination.")
144+
.hasUnit("ms")
145+
.isGauge()
146+
.hasDataPointsAttributes(
147+
entry("destination", "ActiveMQ.Advisory.MasterBroker"),
148+
entry("broker", "localhost")));
109149
}
110150
}

0 commit comments

Comments
 (0)