Search in sources :

Example 6 with Timer

use of io.micrometer.api.instrument.Timer in project reactor-netty by reactor.

the class MicrometerChannelMetricsRecorder method recordResolveAddressTime.

@Override
public void recordResolveAddressTime(SocketAddress remoteAddress, Duration time, String status) {
    String address = reactor.netty.Metrics.formatSocketAddress(remoteAddress);
    MeterKey meterKey = new MeterKey(null, address, null, status);
    Timer timer = MapUtils.computeIfAbsent(addressResolverTimeCache, meterKey, key -> filter(Timer.builder(name + ADDRESS_RESOLVER).description(ADDRESS_RESOLVER_TIME_DESCRIPTION).tags(REMOTE_ADDRESS, address, STATUS, status).register(REGISTRY)));
    if (timer != null) {
        timer.record(time);
    }
}
Also used : Timer(io.micrometer.api.instrument.Timer)

Example 7 with Timer

use of io.micrometer.api.instrument.Timer in project reactor-netty by reactor.

the class MicrometerChannelMetricsRecorder method recordConnectTime.

@Override
public void recordConnectTime(SocketAddress remoteAddress, Duration time, String status) {
    String address = reactor.netty.Metrics.formatSocketAddress(remoteAddress);
    MeterKey meterKey = new MeterKey(null, address, null, status);
    Timer timer = MapUtils.computeIfAbsent(connectTimeCache, meterKey, key -> filter(Timer.builder(name + CONNECT_TIME).description(CONNECT_TIME_DESCRIPTION).tags(REMOTE_ADDRESS, address, STATUS, status).register(REGISTRY)));
    if (timer != null) {
        timer.record(time);
    }
}
Also used : Timer(io.micrometer.api.instrument.Timer)

Example 8 with Timer

use of io.micrometer.api.instrument.Timer in project reactor-netty by reactor.

the class MicrometerHttpClientMetricsRecorder method recordDataReceivedTime.

@Override
public void recordDataReceivedTime(SocketAddress remoteAddress, String uri, String method, String status, Duration time) {
    String address = Metrics.formatSocketAddress(remoteAddress);
    MeterKey meterKey = new MeterKey(uri, address, method, status);
    Timer dataReceivedTime = MapUtils.computeIfAbsent(dataReceivedTimeCache, meterKey, key -> filter(Timer.builder(name() + DATA_RECEIVED_TIME).tags(HttpClientMeters.DataReceivedTimeTags.REMOTE_ADDRESS.getKey(), address, HttpClientMeters.DataReceivedTimeTags.URI.getKey(), uri, HttpClientMeters.DataReceivedTimeTags.METHOD.getKey(), method, HttpClientMeters.DataReceivedTimeTags.STATUS.getKey(), status).register(REGISTRY)));
    if (dataReceivedTime != null) {
        dataReceivedTime.record(time);
    }
}
Also used : MeterKey(reactor.netty.channel.MeterKey) Timer(io.micrometer.api.instrument.Timer)

Example 9 with Timer

use of io.micrometer.api.instrument.Timer in project reactor-netty by reactor.

the class MicrometerHttpClientMetricsRecorder method recordDataSentTime.

@Override
public void recordDataSentTime(SocketAddress remoteAddress, String uri, String method, Duration time) {
    String address = Metrics.formatSocketAddress(remoteAddress);
    MeterKey meterKey = new MeterKey(uri, address, method, null);
    Timer dataSentTime = MapUtils.computeIfAbsent(dataSentTimeCache, meterKey, key -> filter(Timer.builder(name() + DATA_SENT_TIME).tags(HttpClientMeters.DataSentTimeTags.REMOTE_ADDRESS.getKey(), address, HttpClientMeters.DataSentTimeTags.URI.getKey(), uri, HttpClientMeters.DataSentTimeTags.METHOD.getKey(), method).register(REGISTRY)));
    if (dataSentTime != null) {
        dataSentTime.record(time);
    }
}
Also used : MeterKey(reactor.netty.channel.MeterKey) Timer(io.micrometer.api.instrument.Timer)

Example 10 with Timer

use of io.micrometer.api.instrument.Timer in project reactor-netty by reactor.

the class TcpMetricsTests method checkTimer.

void checkTimer(String name, String[] tags, boolean exists) {
    Timer timer = registry.find(name).tags(tags).timer();
    if (exists) {
        MeterRegistryAssert.assertThat(registry).hasTimerWithNameAndTags(name, Tags.of(tags));
        assertThat(timer).isNotNull();
        assertThat(timer.count()).isEqualTo(1);
        assertThat(timer.totalTime(TimeUnit.NANOSECONDS) >= 0).isTrue();
    } else {
        assertThat(timer).isNull();
    }
}
Also used : Timer(io.micrometer.api.instrument.Timer)

Aggregations

Timer (io.micrometer.api.instrument.Timer)13 MeterKey (reactor.netty.channel.MeterKey)6