use of com.hotels.styx.api.MicrometerRegistry 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.api.MicrometerRegistry 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.api.MicrometerRegistry in project styx by ExpediaGroup.
the class StyxServerComponentsTest method exposesAdditionalServices.
@Test
public void exposesAdditionalServices() {
StyxServerComponents components = new StyxServerComponents.Builder().registry(new MicrometerRegistry((new CompositeMeterRegistry()))).styxConfig(new StyxConfig()).additionalServices(Map.of("service1", mock(StyxService.class), "service2", mock(StyxService.class))).build();
Map<String, StyxService> services = components.services();
assertThat(services.keySet(), containsInAnyOrder("service1", "service2"));
}
use of com.hotels.styx.api.MicrometerRegistry in project styx by ExpediaGroup.
the class StyxServerComponentsTest method createsEnvironment.
@Test
public void createsEnvironment() {
Configuration config = new Configuration.MapBackedConfiguration().set("foo", "abc").set("bar", "def");
StyxServerComponents components = new StyxServerComponents.Builder().registry(new MicrometerRegistry(new CompositeMeterRegistry())).styxConfig(new StyxConfig(config)).build();
Environment environment = components.environment();
assertThat(environment.configuration().get("foo", String.class), isValue("abc"));
assertThat(environment.configuration().get("bar", String.class), isValue("def"));
assertThat(environment.eventBus(), is(notNullValue()));
assertThat(environment.metricRegistry(), is(notNullValue()));
}
use of com.hotels.styx.api.MicrometerRegistry in project styx by ExpediaGroup.
the class StyxServerComponentsTest method setsUpLoggingOnBuild.
@Test
public void setsUpLoggingOnBuild() {
LoggingSetUp loggingSetUp = mock(LoggingSetUp.class);
new StyxServerComponents.Builder().registry(new MicrometerRegistry(new CompositeMeterRegistry())).styxConfig(new StyxConfig()).loggingSetUp(loggingSetUp).build();
verify(loggingSetUp).setUp(any(Environment.class));
}
Aggregations