Search in sources :

Example 1 with Counter

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();
    }
}
Also used : Counter(io.micrometer.api.instrument.Counter)

Example 2 with Counter

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();
    }
}
Also used : Counter(io.micrometer.api.instrument.Counter)

Example 3 with Counter

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();
    }
}
Also used : Counter(io.micrometer.api.instrument.Counter)

Example 4 with Counter

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();
    }
}
Also used : MeterKey(reactor.netty.channel.MeterKey) Counter(io.micrometer.api.instrument.Counter)

Example 5 with Counter

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();
    }
}
Also used : Counter(io.micrometer.api.instrument.Counter)

Aggregations

Counter (io.micrometer.api.instrument.Counter)5 MeterKey (reactor.netty.channel.MeterKey)1