|
17 | 17 | |
18 | 18 | package com.rabbitmq.client.amqp.metrics; |
19 | 19 |
|
| 20 | +import static com.rabbitmq.client.amqp.impl.TestUtils.waitAtMost; |
20 | 21 | import static org.assertj.core.api.Assertions.assertThat; |
21 | 22 |
|
22 | 23 | import io.micrometer.core.instrument.simple.SimpleMeterRegistry; |
23 | 24 | import io.micrometer.prometheusmetrics.PrometheusConfig; |
24 | 25 | import io.micrometer.prometheusmetrics.PrometheusMeterRegistry; |
| 26 | +import java.util.stream.Stream; |
25 | 27 | import org.junit.jupiter.api.Test; |
26 | 28 |
|
27 | 29 | public class MicrometerMetricsCollectorTest { |
@@ -125,8 +127,29 @@ void prometheus() { |
125 | 127 | collector.consumeDisposition(MetricsCollector.ConsumeDisposition.REQUEUED); |
126 | 128 | collector.consumeDisposition(MetricsCollector.ConsumeDisposition.DISCARDED); |
127 | 129 |
|
128 | | - assertThat(registry.scrape()) |
129 | | - .contains("# TYPE rabbitmq_amqp_connections gauge") |
130 | | - .contains("rabbitmq_amqp_connections 1.0"); |
| 130 | + Stream.of( |
| 131 | + "# TYPE rabbitmq_amqp_connections gauge", |
| 132 | + "rabbitmq_amqp_connections 1.0", |
| 133 | + "# TYPE rabbitmq_amqp_consumers gauge", |
| 134 | + "rabbitmq_amqp_consumers 1.0", |
| 135 | + "TYPE rabbitmq_amqp_publishers gauge", |
| 136 | + "rabbitmq_amqp_publishers 1.0", |
| 137 | + "# TYPE rabbitmq_amqp_published_total counter", |
| 138 | + "rabbitmq_amqp_published_total 2.0", |
| 139 | + "# TYPE rabbitmq_amqp_published_accepted_total counter", |
| 140 | + "rabbitmq_amqp_published_accepted_total 1.0", |
| 141 | + "# TYPE rabbitmq_amqp_published_rejected_total counter", |
| 142 | + "rabbitmq_amqp_published_rejected_total 1.0", |
| 143 | + "# TYPE rabbitmq_amqp_published_released_total counter", |
| 144 | + "rabbitmq_amqp_published_released_total 1.0", |
| 145 | + "# TYPE rabbitmq_amqp_consumed_total counter", |
| 146 | + "rabbitmq_amqp_consumed_total 3.0", |
| 147 | + "# TYPE rabbitmq_amqp_consumed_accepted_total counter", |
| 148 | + "rabbitmq_amqp_consumed_accepted_total 1.0", |
| 149 | + "# TYPE rabbitmq_amqp_consumed_discarded_total counter", |
| 150 | + "rabbitmq_amqp_consumed_discarded_total 1.0", |
| 151 | + "# TYPE rabbitmq_amqp_consumed_requeued_total counter", |
| 152 | + "rabbitmq_amqp_consumed_requeued_total 1.0") |
| 153 | + .forEach(expected -> waitAtMost(() -> registry.scrape().contains(expected))); |
131 | 154 | } |
132 | 155 | } |
0 commit comments