-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Closed
Description
Hi,
Micrometer metrics for RabbitMQ are instantiated too late which leads that metrics are never updated. Instead a NoOpMetricsCollector
is used and it's methods are invoked. It seems that rabbitmq connection is created before in com.rabbitmq.client.ConnectionFactory
.
public Connection newConnection(ExecutorService executor, AddressResolver addressResolver, String clientProvidedName)
throws IOException, TimeoutException {
if(this.metricsCollector == null) {
this.metricsCollector = new NoOpMetricsCollector();
}
Workaround that works for me now is to create a RabbitMQConfiguration class with:
@PostConstruct
public void init() {
com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = this.connectionFactory.getRabbitConnectionFactory();
rabbitConnectionFactory.setMetricsCollector(new MicrometerMetricsCollector(registry));
}
spring-boot: 2.0.1.RELEASE
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug