Polish
This commit is contained in:
@@ -42,7 +42,7 @@ public class RabbitMetrics implements MeterBinder {
|
||||
private final ConnectionFactory connectionFactory;
|
||||
|
||||
/**
|
||||
* Create a new meter binder recording the specified {@link ConnectionFactory}.
|
||||
* Create a new meter binder recording the specified {@link ConnectionFactory}.
|
||||
* @param connectionFactory the {@link ConnectionFactory} to instrument
|
||||
* @param name the name prefix of the metrics
|
||||
* @param tags tags to apply to all recorded metrics
|
||||
@@ -53,13 +53,13 @@ public class RabbitMetrics implements MeterBinder {
|
||||
Assert.notNull(name, "Name must not be null");
|
||||
this.connectionFactory = connectionFactory;
|
||||
this.name = name;
|
||||
this.tags = (tags != null ? tags : Collections.EMPTY_LIST);
|
||||
this.tags = (tags != null ? tags : Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindTo(MeterRegistry registry) {
|
||||
this.connectionFactory.setMetricsCollector(new MicrometerMetricsCollector(
|
||||
registry, this.name, this.tags));
|
||||
this.connectionFactory.setMetricsCollector(
|
||||
new MicrometerMetricsCollector(registry, this.name, this.tags));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,10 +45,10 @@ public class RabbitMetricsTests {
|
||||
SimpleMeterRegistry registry = new SimpleMeterRegistry();
|
||||
new RabbitMetrics(connectionFactory, "test", Tags.zip("env", "prod"))
|
||||
.bindTo(registry);
|
||||
assertThat(registry.find("test.connections")
|
||||
.tags("env", "prod").meter()).isPresent();
|
||||
assertThat(registry.find("test.connections")
|
||||
.tags("env", "dev").meter()).isNotPresent();
|
||||
assertThat(registry.find("test.connections").tags("env", "prod").meter())
|
||||
.isPresent();
|
||||
assertThat(registry.find("test.connections").tags("env", "dev").meter())
|
||||
.isNotPresent();
|
||||
}
|
||||
|
||||
private ConnectionFactory mockConnectionFactory() {
|
||||
|
||||
Reference in New Issue
Block a user