Search in sources :

Example 1 with Timer

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

the class MicrometerHttpClientMetricsRecorder method recordResponseTime.

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

Example 2 with Timer

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

the class AddressResolverGroupMetricsTest method getTimerValue.

private double getTimerValue(String address) {
    MeterRegistryAssert.assertThat(registry).hasTimerWithNameAndTags("reactor.netty.http.client.address.resolver", Tags.of(REMOTE_ADDRESS, address, STATUS, SUCCESS));
    Timer timer = registry.find("reactor.netty.http.client.address.resolver").tags(REMOTE_ADDRESS, address, STATUS, SUCCESS).timer();
    double result = -1;
    if (timer != null) {
        result = timer.totalTime(TimeUnit.NANOSECONDS);
    }
    return result;
}
Also used : Timer(io.micrometer.api.instrument.Timer)

Example 3 with Timer

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

the class UdpMetricsTests method checkClientConnectTime.

private void checkClientConnectTime(String[] tags) {
    MeterRegistryAssert.assertThat(registry).hasTimerWithNameAndTags(CLIENT_CONNECT_TIME, Tags.of(tags));
    Timer timer = registry.find(CLIENT_CONNECT_TIME).tags(tags).timer();
    assertThat(timer).isNotNull();
    assertThat(timer.count()).isEqualTo(1);
    assertThat(timer.totalTime(TimeUnit.NANOSECONDS) > 0).isTrue();
}
Also used : Timer(io.micrometer.api.instrument.Timer)

Example 4 with Timer

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

the class MicrometerChannelMetricsRecorder method recordTlsHandshakeTime.

@Override
public void recordTlsHandshakeTime(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(tlsHandshakeTimeCache, meterKey, key -> filter(Timer.builder(name + TLS_HANDSHAKE_TIME).description(TLS_HANDSHAKE_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 5 with Timer

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

the class MicrometerHttpServerMetricsRecorder method recordDataSentTime.

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

Aggregations

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