Search in sources :

Example 1 with DistributionSummary

use of io.micrometer.api.instrument.DistributionSummary 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 DistributionSummary

use of io.micrometer.api.instrument.DistributionSummary 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 DistributionSummary

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

the class UdpMetricsTests method checkDistributionSummary.

private void checkDistributionSummary(String name, String[] tags) {
    DistributionSummary summary = registry.find(name).tags(tags).summary();
    assertThat(summary).isNotNull();
    assertThat(summary.count()).isEqualTo(1);
    assertThat(summary.totalAmount() >= 5).isTrue();
}
Also used : DistributionSummary(io.micrometer.api.instrument.DistributionSummary)

Example 4 with DistributionSummary

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

the class TcpMetricsTests method checkDistributionSummary.

void checkDistributionSummary(String name, String[] tags, long expectedCount, int expectedAmount, boolean exists) {
    DistributionSummary summary = registry.find(name).tags(tags).summary();
    if (exists) {
        assertThat(summary).isNotNull();
        assertThat(summary.count()).isEqualTo(expectedCount);
        assertThat(summary.totalAmount() >= expectedAmount).isTrue();
    } else {
        assertThat(summary).isNull();
    }
}
Also used : DistributionSummary(io.micrometer.api.instrument.DistributionSummary)

Example 5 with DistributionSummary

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

the class MicrometerChannelMetricsRecorder method recordDataSent.

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

Aggregations

DistributionSummary (io.micrometer.api.instrument.DistributionSummary)7 MeterKey (reactor.netty.channel.MeterKey)2