use of com.hotels.styx.metrics.CentralisedMetrics in project styx by ExpediaGroup.
the class HttpPipelineHandlerTest method decrementsRequestsOngoingCountOnChannelInactiveWhenRequestIsOngoing.
@Test
public void decrementsRequestsOngoingCountOnChannelInactiveWhenRequestIsOngoing() throws Exception {
MeterRegistry registry = new MicrometerRegistry(new SimpleMeterRegistry());
HttpPipelineHandler adapter = handlerWithMocks(doNotRespondHandler).responseEnhancer(DO_NOT_MODIFY_RESPONSE).progressListener(new RequestStatsCollector(new CentralisedMetrics(registry))).build();
ChannelHandlerContext ctx = mockCtx();
adapter.channelActive(ctx);
adapter.channelRead0(ctx, get("/foo").build());
assertThat(requestOutstandingValue(registry), is(1.0));
adapter.channelInactive(ctx);
assertThat(requestOutstandingValue(registry), is(0.0));
}
use of com.hotels.styx.metrics.CentralisedMetrics in project styx by ExpediaGroup.
the class CoreMetricsTest method registersOperatingSystemMetrics.
@Test
public void registersOperatingSystemMetrics() {
MeterRegistry registry = new MicrometerRegistry(new SimpleMeterRegistry());
CoreMetricsKt.registerCoreMetrics(new CentralisedMetrics(registry));
List<String> gauges = registry.getMeters().stream().map(meter -> meter.getId().getName()).collect(Collectors.toList());
assertThat(gauges, hasItems("os.process.cpu.load", "os.process.cpu.time", "os.system.cpu.load", "os.memory.physical.free", "os.memory.physical.total", "os.memory.virtual.committed", "os.swapSpace.free", "os.swapSpace.total"));
}
use of com.hotels.styx.metrics.CentralisedMetrics in project styx by ExpediaGroup.
the class CoreMetricsTest method registersJvmMetrics.
@Test
public void registersJvmMetrics() {
MeterRegistry registry = new MicrometerRegistry(new SimpleMeterRegistry());
CoreMetricsKt.registerCoreMetrics(new CentralisedMetrics(registry));
assertThat(registry.find("jvm.uptime").gauges(), hasSize(1));
assertThat(registry.find("proxy.netty.buffers.memory").tags("allocator", "pooled", "memoryType", "direct").gauges(), hasSize(1));
assertThat(registry.find("proxy.netty.buffers.memory").tags("allocator", "pooled", "memoryType", "heap").gauges(), hasSize(1));
assertThat(registry.find("proxy.netty.buffers.memory").tags("allocator", "unpooled", "memoryType", "direct").gauges(), hasSize(1));
assertThat(registry.find("proxy.netty.buffers.memory").tags("allocator", "unpooled", "memoryType", "heap").gauges(), hasSize(1));
}
use of com.hotels.styx.metrics.CentralisedMetrics in project styx by ExpediaGroup.
the class ChannelStatisticsHandlerTest method createHandler.
@BeforeEach
public void createHandler() {
this.meterRegistry = new MicrometerRegistry(new SimpleMeterRegistry());
this.handler = new ChannelStatisticsHandler(new CentralisedMetrics(this.meterRegistry));
}
use of com.hotels.styx.metrics.CentralisedMetrics in project styx by ExpediaGroup.
the class RequestStatsCollectorTest method setUp.
@BeforeEach
public void setUp() {
metrics = new MicrometerRegistry(new SimpleMeterRegistry(SimpleConfig.DEFAULT, clock));
clock.setNanoTime(0);
CentralisedMetrics centralisedMetrics = new CentralisedMetrics(metrics);
sink = new RequestStatsCollector(centralisedMetrics);
}
Aggregations