55
66package io .opentelemetry .contrib .jmxscraper .target_systems ;
77
8- import io .opentelemetry .contrib .jmxscraper .JmxScraperContainer ;
9- import org .testcontainers .containers .GenericContainer ;
10- import org .testcontainers .containers .wait .strategy .Wait ;
11- import java .time .Duration ;
12-
138import static io .opentelemetry .contrib .jmxscraper .target_systems .MetricAssertions .assertGauge ;
149import static io .opentelemetry .contrib .jmxscraper .target_systems .MetricAssertions .assertGaugeWithAttributes ;
1510import static io .opentelemetry .contrib .jmxscraper .target_systems .MetricAssertions .assertSum ;
1611import static io .opentelemetry .contrib .jmxscraper .target_systems .MetricAssertions .assertSumWithAttributes ;
1712import static org .assertj .core .data .MapEntry .entry ;
1813
14+ import io .opentelemetry .contrib .jmxscraper .JmxScraperContainer ;
15+ import java .time .Duration ;
16+ import org .testcontainers .containers .GenericContainer ;
17+ import org .testcontainers .containers .wait .strategy .Wait ;
18+
1919public class HBaseIntegrationTest extends TargetSystemIntegrationTest {
20+ private static final int DEFAULT_MASTER_SERVICE_PORT = 16000 ;
2021
2122 @ Override
2223 protected GenericContainer <?> createTargetContainer (int jmxPort ) {
@@ -25,8 +26,8 @@ protected GenericContainer<?> createTargetContainer(int jmxPort) {
2526 .withEnv ("HBASE_OPTS" , "-XX:+UseConcMarkSweepGC" )
2627 .withEnv ("HBASE_MASTER_OPTS" , genericJmxJvmArguments (jmxPort ))
2728 .withStartupTimeout (Duration .ofMinutes (2 ))
28- .withExposedPorts (jmxPort )
29- .waitingFor (Wait .forListeningPort ( ));
29+ .withExposedPorts (jmxPort , DEFAULT_MASTER_SERVICE_PORT )
30+ .waitingFor (Wait .forListeningPorts ( jmxPort , DEFAULT_MASTER_SERVICE_PORT ));
3031 }
3132
3233 @ Override
@@ -156,7 +157,6 @@ protected void verifyMetrics() {
156157 "Percent of store file data that can be read from the local." ,
157158 "%" ,
158159 attrs -> attrs .containsKey ("region_server" )),
159-
160160 metric ->
161161 assertGaugeWithAttributes (
162162 metric ,
@@ -192,7 +192,6 @@ protected void verifyMetrics() {
192192 "Append operation median latency." ,
193193 "ms" ,
194194 attrs -> attrs .containsKey ("region_server" )),
195-
196195 metric ->
197196 assertGaugeWithAttributes (
198197 metric ,
@@ -228,7 +227,6 @@ protected void verifyMetrics() {
228227 "Delete operation median latency." ,
229228 "ms" ,
230229 attrs -> attrs .containsKey ("region_server" )),
231-
232230 metric ->
233231 assertGaugeWithAttributes (
234232 metric ,
@@ -264,7 +262,6 @@ protected void verifyMetrics() {
264262 "Put operation median latency." ,
265263 "ms" ,
266264 attrs -> attrs .containsKey ("region_server" )),
267-
268265 metric ->
269266 assertGaugeWithAttributes (
270267 metric ,
@@ -300,7 +297,6 @@ protected void verifyMetrics() {
300297 "Get operation median latency." ,
301298 "ms" ,
302299 attrs -> attrs .containsKey ("region_server" )),
303-
304300 metric ->
305301 assertGaugeWithAttributes (
306302 metric ,
@@ -336,7 +332,6 @@ protected void verifyMetrics() {
336332 "Replay operation median latency." ,
337333 "ms" ,
338334 attrs -> attrs .containsKey ("region_server" )),
339-
340335 metric ->
341336 assertGaugeWithAttributes (
342337 metric ,
@@ -384,7 +379,6 @@ protected void verifyMetrics() {
384379 attrs -> attrs .contains (entry ("operation" , "get" )),
385380 attrs -> attrs .contains (entry ("operation" , "put" )),
386381 attrs -> attrs .contains (entry ("operation" , "increment" ))),
387-
388382 metric ->
389383 assertSumWithAttributes (
390384 metric ,
@@ -420,7 +414,6 @@ protected void verifyMetrics() {
420414 /* isMonotonic= */ false ,
421415 attrs -> attrs .contains (entry ("state" , "successes" )),
422416 attrs -> attrs .contains (entry ("state" , "failures" ))),
423-
424417 metric ->
425418 assertSumWithAttributes (
426419 metric ,
@@ -441,7 +434,6 @@ protected void verifyMetrics() {
441434 "hbase.region_server.gc.old_gen.time" ,
442435 "Time spent in garbage collection of the old generation." ,
443436 "ms" ,
444- attrs -> attrs .containsKey ("region_server" ))
445- );
437+ attrs -> attrs .containsKey ("region_server" )));
446438 }
447439}
0 commit comments