Search in sources :

Example 11 with Timer

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

the class HttpMetricsHandlerTests method checkTimer.

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

Example 12 with Timer

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

the class MicrometerHttpServerMetricsRecorder method recordResponseTime.

@Override
public void recordResponseTime(String uri, String method, String status, Duration time) {
    MeterKey meterKey = new MeterKey(uri, null, method, status);
    Timer responseTime = MapUtils.computeIfAbsent(responseTimeCache, meterKey, key -> filter(Timer.builder(name() + RESPONSE_TIME).description(RESPONSE_TIME_DESCRIPTION).tags(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 13 with Timer

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

the class MicrometerHttpServerMetricsRecorder method recordDataReceivedTime.

@Override
public void recordDataReceivedTime(String uri, String method, Duration time) {
    MeterKey meterKey = new MeterKey(uri, null, method, null);
    Timer dataReceivedTime = MapUtils.computeIfAbsent(dataReceivedTimeCache, meterKey, key -> filter(Timer.builder(name() + DATA_RECEIVED_TIME).tags(HttpServerMeters.DataReceivedTimeTags.URI.getKey(), uri, HttpServerMeters.DataReceivedTimeTags.METHOD.getKey(), method).register(REGISTRY)));
    if (dataReceivedTime != null) {
        dataReceivedTime.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