Add gauges for queue channel size (#3349)
* Add gauges for queue channel size
The `QueueChannel` provides a current size and remaining capacity metrics
* Add Micrometer gauges into `QueueChannel` to expose the current values
of the size and remaining capacity
**Cherry-pick to 5.3.x, 5.2.x & 5.1.x**
* * Revert `@SuppressWarnings("unchecked")` for test
* Document new gauges for queue channel
* * Fix IntegrationManagementConfigurer for NPE on `metricsCaptor`
* Fix wording in meter descriptions
Co-authored-by: Michel Jung <michel.jung89@gmail.com>
Co-authored-by: Michel Jung <michel.jung89@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018-2019 the original author or authors.
|
||||
* Copyright 2018-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -94,7 +94,7 @@ public class MicrometerMetricsTests {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testSend() {
|
||||
public void testMicrometerMetrics() {
|
||||
GenericMessage<String> message = new GenericMessage<>("foo");
|
||||
this.channel.send(message);
|
||||
assertThatExceptionOfType(MessagingException.class)
|
||||
@@ -162,6 +162,16 @@ public class MicrometerMetricsTests {
|
||||
.tag("result", "success")
|
||||
.counter().count()).isEqualTo(1);
|
||||
|
||||
this.queue.send(message);
|
||||
|
||||
assertThat(registry.get("spring.integration.channel.queue.size")
|
||||
.tag("name", "queue")
|
||||
.gauge().value()).isEqualTo(2d);
|
||||
|
||||
assertThat(registry.get("spring.integration.channel.queue.remaining.capacity")
|
||||
.tag("name", "queue")
|
||||
.gauge().value()).isEqualTo(8d);
|
||||
|
||||
assertThat(registry.get("spring.integration.send")
|
||||
.tag("name", "nullChannel")
|
||||
.tag("result", "success")
|
||||
@@ -260,7 +270,7 @@ public class MicrometerMetricsTests {
|
||||
|
||||
@Bean
|
||||
public QueueChannel queue() {
|
||||
return new QueueChannel();
|
||||
return new QueueChannel(10);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user