Search in sources :

Example 1 with MeterKey

use of reactor.netty.channel.MeterKey in project reactor-netty by reactor.

the class MicrometerHttpMetricsRecorder method recordDataSent.

@Override
public void recordDataSent(SocketAddress remoteAddress, String uri, long bytes) {
    String address = Metrics.formatSocketAddress(remoteAddress);
    MeterKey meterKey = new MeterKey(uri, address, null, null);
    DistributionSummary dataSent = MapUtils.computeIfAbsent(dataSentCache, meterKey, key -> filter(DistributionSummary.builder(name() + DATA_SENT).baseUnit(ChannelMeters.DATA_SENT.getBaseUnit()).tags(REMOTE_ADDRESS.getKey(), address, URI.getKey(), uri).register(REGISTRY)));
    if (dataSent != null) {
        dataSent.record(bytes);
    }
}
Also used : MeterKey(reactor.netty.channel.MeterKey) DistributionSummary(io.micrometer.api.instrument.DistributionSummary)

Example 2 with MeterKey

use of reactor.netty.channel.MeterKey in project reactor-netty by reactor.

the class MicrometerHttpMetricsRecorder method recordDataReceived.

@Override
public void recordDataReceived(SocketAddress remoteAddress, String uri, long bytes) {
    String address = Metrics.formatSocketAddress(remoteAddress);
    MeterKey meterKey = new MeterKey(uri, address, null, null);
    DistributionSummary dataReceived = MapUtils.computeIfAbsent(dataReceivedCache, meterKey, key -> filter(DistributionSummary.builder(name() + DATA_RECEIVED).baseUnit(ChannelMeters.DATA_RECEIVED.getBaseUnit()).tags(REMOTE_ADDRESS.getKey(), address, URI.getKey(), uri).register(REGISTRY)));
    if (dataReceived != null) {
        dataReceived.record(bytes);
    }
}
Also used : MeterKey(reactor.netty.channel.MeterKey) DistributionSummary(io.micrometer.api.instrument.DistributionSummary)

Example 3 with MeterKey

use of reactor.netty.channel.MeterKey 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 4 with MeterKey

use of reactor.netty.channel.MeterKey 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)

Example 5 with MeterKey

use of reactor.netty.channel.MeterKey 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)

Aggregations

MeterKey (reactor.netty.channel.MeterKey)9 Timer (io.micrometer.api.instrument.Timer)6 DistributionSummary (io.micrometer.api.instrument.DistributionSummary)2 Counter (io.micrometer.api.instrument.Counter)1