use of com.hotels.styx.api.MicrometerRegistry in project styx by ExpediaGroup.
the class StyxServerComponentsTest method loadsServices.
@Test
public void loadsServices() {
StyxServerComponents components = new StyxServerComponents.Builder().registry(new MicrometerRegistry(new CompositeMeterRegistry())).styxConfig(new StyxConfig()).services((env, routeDb) -> 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 InstrumentedPluginTest method setUp.
@BeforeEach
public void setUp() {
registry = new MicrometerRegistry(new SimpleMeterRegistry());
environment = new Environment.Builder().registry(registry).build();
someRequest = get("/").build();
chain = mock(Chain.class);
}
use of com.hotels.styx.api.MicrometerRegistry in project styx by ExpediaGroup.
the class UrlRequestHealthCheckTest method setUp.
@BeforeEach
public void setUp() {
metrics = new CentralisedMetrics(new MicrometerRegistry(new SimpleMeterRegistry()));
originState = null;
requestedUrl = null;
}
use of com.hotels.styx.api.MicrometerRegistry in project styx by ExpediaGroup.
the class FileBackedBackendServicesRegistryFactoryTest method setUp.
@BeforeEach
public void setUp() throws Exception {
tempDir = createTempDirectory("");
monitoredFile = Paths.get(tempDir.toString(), "origins.yml");
write(monitoredFile, "content-v1");
environment = new com.hotels.styx.Environment.Builder().registry(new MicrometerRegistry(new SimpleMeterRegistry())).build();
}
use of com.hotels.styx.api.MicrometerRegistry in project styx by ExpediaGroup.
the class BackendServicesRouterTest method deregistersAndReregistersMetricsAppropriately.
// This test exists due to a real bug we had when reloading in prod
@Test
public void deregistersAndReregistersMetricsAppropriately() {
MeterRegistry metrics = new MicrometerRegistry(new SimpleMeterRegistry());
Environment environment = new Environment.Builder().registry(metrics).build();
MeterRegistry meterRegistry = environment.meterRegistry();
BackendServicesRouter router = new BackendServicesRouter(new StyxBackendServiceClientFactory(environment), environment, executor);
router.onChange(added(backendService(APP_B, "/appB/", 9094, "appB-01", 9095, "appB-02")));
Tags tags01 = Tags.of(APPID_TAG, APP_B, ORIGINID_TAG, "appB-01");
Tags tags02 = Tags.of(APPID_TAG, APP_B, ORIGINID_TAG, "appB-02");
assertThat(meterRegistry.find("proxy.client.originHealthStatus").tags(tags01).gauge().value(), is(1.0));
assertThat(meterRegistry.find("proxy.client.originHealthStatus").tags(tags02).gauge().value(), is(1.0));
BackendService appMinusOneOrigin = backendService(APP_B, "/appB/", 9094, "appB-01");
router.onChange(updated(appMinusOneOrigin));
assertThat(meterRegistry.find("proxy.client.originHealthStatus").tags(tags01).gauge().value(), is(1.0));
assertThat(meterRegistry.find("proxy.client.originHealthStatus").tags(tags02).gauge(), is(nullValue()));
}
Aggregations