use of io.micrometer.api.instrument.DistributionSummary in project reactor-netty by reactor.
the class MicrometerChannelMetricsRecorder method recordDataReceived.
@Override
public void recordDataReceived(SocketAddress remoteAddress, long bytes) {
String address = reactor.netty.Metrics.formatSocketAddress(remoteAddress);
DistributionSummary ds = MapUtils.computeIfAbsent(dataReceivedCache, address, key -> filter(DistributionSummary.builder(name + DATA_RECEIVED).baseUnit(ChannelMeters.DATA_RECEIVED.getBaseUnit()).tags(ChannelMeters.ChannelMetersTags.URI.getKey(), protocol, ChannelMeters.ChannelMetersTags.REMOTE_ADDRESS.getKey(), address).register(REGISTRY)));
if (ds != null) {
ds.record(bytes);
}
}
use of io.micrometer.api.instrument.DistributionSummary in project reactor-netty by reactor.
the class HttpMetricsHandlerTests method checkDistributionSummary.
private void checkDistributionSummary(String name, String[] tags, long expectedCount, double expectedAmount) {
DistributionSummary summary = registry.find(name).tags(tags).summary();
assertThat(summary).isNotNull();
assertThat(summary.count()).isEqualTo(expectedCount);
assertThat(summary.totalAmount() >= expectedAmount).isTrue();
}
Aggregations