use of io.micrometer.api.instrument.Counter in project reactor-netty by reactor.
the class UdpMetricsTests method checkCounter.
private void checkCounter(String name, String[] tags, boolean exists) {
Counter counter = registry.find(name).tags(tags).counter();
if (exists) {
assertThat(counter).isNotNull();
assertThat(counter.count()).isEqualTo(0);
} else {
assertThat(counter).isNull();
}
}
use of io.micrometer.api.instrument.Counter in project reactor-netty by reactor.
the class HttpMetricsHandlerTests method checkCounter.
void checkCounter(String name, String[] tags, boolean exists, double expectedCount) {
Counter counter = registry.find(name).tags(tags).counter();
if (exists) {
assertThat(counter).isNotNull();
assertThat(counter.count() >= expectedCount).isTrue();
} else {
assertThat(counter).isNull();
}
}
use of io.micrometer.api.instrument.Counter in project reactor-netty by reactor.
the class MicrometerChannelMetricsRecorder method incrementErrorsCount.
@Override
public void incrementErrorsCount(SocketAddress remoteAddress) {
String address = reactor.netty.Metrics.formatSocketAddress(remoteAddress);
Counter c = MapUtils.computeIfAbsent(errorsCache, address, key -> filter(Counter.builder(name + ERRORS).tags(ChannelMeters.ChannelMetersTags.URI.getKey(), protocol, ChannelMeters.ChannelMetersTags.REMOTE_ADDRESS.getKey(), address).register(REGISTRY)));
if (c != null) {
c.increment();
}
}
use of io.micrometer.api.instrument.Counter in project reactor-netty by reactor.
the class MicrometerHttpMetricsRecorder method incrementErrorsCount.
@Override
public void incrementErrorsCount(SocketAddress remoteAddress, String uri) {
String address = Metrics.formatSocketAddress(remoteAddress);
MeterKey meterKey = new MeterKey(uri, address, null, null);
Counter errors = MapUtils.computeIfAbsent(errorsCache, meterKey, key -> filter(Counter.builder(name() + ERRORS).tags(REMOTE_ADDRESS.getKey(), address, URI.getKey(), uri).register(REGISTRY)));
if (errors != null) {
errors.increment();
}
}
use of io.micrometer.api.instrument.Counter in project reactor-netty by reactor.
the class TcpMetricsTests method checkCounter.
void checkCounter(String name, String[] tags, double expectedCount, boolean exists) {
Counter counter = registry.find(name).tags(tags).counter();
if (exists) {
assertThat(counter).isNotNull();
assertThat(counter.count() >= expectedCount).isTrue();
} else {
assertThat(counter).isNull();
}
}