Search in sources :

Example 1 with SpectatorMetricCollector

use of com.netflix.spectator.aws.SpectatorMetricCollector in project iep by Netflix.

the class AwsMetricsModuleTest method withRegistryBinding.

@Test
public void withRegistryBinding() {
    AwsSdkMetrics.setMetricCollector(null);
    Assert.assertFalse(AwsSdkMetrics.getMetricCollector() instanceof SpectatorMetricCollector);
    final Registry registry = new DefaultRegistry();
    Guice.createInjector(new AwsMetricsModule(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(Registry.class).toInstance(registry);
        }
    });
    Assert.assertTrue(AwsSdkMetrics.getMetricCollector() instanceof SpectatorMetricCollector);
}
Also used : SpectatorMetricCollector(com.netflix.spectator.aws.SpectatorMetricCollector) DefaultRegistry(com.netflix.spectator.api.DefaultRegistry) DefaultRegistry(com.netflix.spectator.api.DefaultRegistry) Registry(com.netflix.spectator.api.Registry) AbstractModule(com.google.inject.AbstractModule) Test(org.junit.Test)

Example 2 with SpectatorMetricCollector

use of com.netflix.spectator.aws.SpectatorMetricCollector in project kork by spinnaker.

the class AwsComponents method spectatorMetricsCollector.

@Bean
@ConditionalOnProperty(value = "aws.metrics.enabled", matchIfMissing = true)
SpectatorMetricCollector spectatorMetricsCollector(Registry registry) {
    SpectatorMetricCollector collector = new SpectatorMetricCollector(registry);
    AwsSdkMetrics.setMetricCollector(collector);
    return collector;
}
Also used : SpectatorMetricCollector(com.netflix.spectator.aws.SpectatorMetricCollector) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean) ConditionalOnProperty(org.springframework.boot.autoconfigure.condition.ConditionalOnProperty)

Aggregations

SpectatorMetricCollector (com.netflix.spectator.aws.SpectatorMetricCollector)2 AbstractModule (com.google.inject.AbstractModule)1 DefaultRegistry (com.netflix.spectator.api.DefaultRegistry)1 Registry (com.netflix.spectator.api.Registry)1 Test (org.junit.Test)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 ConditionalOnProperty (org.springframework.boot.autoconfigure.condition.ConditionalOnProperty)1 Bean (org.springframework.context.annotation.Bean)1