Search in sources :

Example 1 with InstrumentationProvider

use of org.apache.knox.gateway.services.metrics.InstrumentationProvider in project knox by apache.

the class DefaultMetricsServiceTest method instrumentationProvidersLoading.

@Test
public void instrumentationProvidersLoading() throws Exception {
    DefaultMetricsService service = new DefaultMetricsService();
    GatewayConfigImpl config = new GatewayConfigImpl();
    config.set(GatewayConfigImpl.METRICS_ENABLED, "true");
    service.init(config, null);
    Map<Class<?>, InstrumentationProvider> map = service.getInstrumentationProviders();
    Assert.assertTrue(map.entrySet().size() >= 2);
    Assert.assertNotNull(service.getInstrumented(HttpClientBuilder.class));
}
Also used : InstrumentationProvider(org.apache.knox.gateway.services.metrics.InstrumentationProvider) HttpClientBuilder(org.apache.http.impl.client.HttpClientBuilder) GatewayConfigImpl(org.apache.knox.gateway.config.impl.GatewayConfigImpl) Test(org.junit.Test)

Example 2 with InstrumentationProvider

use of org.apache.knox.gateway.services.metrics.InstrumentationProvider in project knox by apache.

the class DefaultMetricsServiceTest method instrumentationProvidersLoadingDefaultIsEmpty.

@Test
public void instrumentationProvidersLoadingDefaultIsEmpty() throws Exception {
    DefaultMetricsService service = new DefaultMetricsService();
    service.init(new GatewayConfigImpl(), null);
    Map<Class<?>, InstrumentationProvider> map = service.getInstrumentationProviders();
    Assert.assertTrue(map.entrySet().isEmpty());
    Assert.assertNull(service.getInstrumented(HttpClientBuilder.class));
}
Also used : InstrumentationProvider(org.apache.knox.gateway.services.metrics.InstrumentationProvider) HttpClientBuilder(org.apache.http.impl.client.HttpClientBuilder) GatewayConfigImpl(org.apache.knox.gateway.config.impl.GatewayConfigImpl) Test(org.junit.Test)

Aggregations

HttpClientBuilder (org.apache.http.impl.client.HttpClientBuilder)2 GatewayConfigImpl (org.apache.knox.gateway.config.impl.GatewayConfigImpl)2 InstrumentationProvider (org.apache.knox.gateway.services.metrics.InstrumentationProvider)2 Test (org.junit.Test)2