List of usage examples for org.springframework.integration.support.management DefaultMetricsFactory DefaultMetricsFactory
DefaultMetricsFactory
From source file:com.netflix.spring.sample.membership.Membership.java
@Bean public MetricsFactory metricsFactory() { return new DefaultMetricsFactory(); }
From source file:org.springframework.integration.config.IntegrationManagementConfigurer.java
@Override public void afterSingletonsInstantiated() { Assert.state(this.applicationContext != null, "'applicationContext' must not be null"); Assert.state(MANAGEMENT_CONFIGURER_NAME.equals(this.beanName), getClass().getSimpleName() + " bean name must be " + MANAGEMENT_CONFIGURER_NAME); if (ClassUtils.isPresent("io.micrometer.core.instrument.MeterRegistry", this.applicationContext.getClassLoader())) { this.metricsCaptor = MicrometerMetricsCaptor.loadCaptor(this.applicationContext); }/*from www . ja va2 s .co m*/ if (this.metricsCaptor != null) { injectCaptor(); registerComponentGauges(); } if (this.metricsFactory == null && StringUtils.hasText(this.metricsFactoryBeanName)) { this.metricsFactory = this.applicationContext.getBean(this.metricsFactoryBeanName, MetricsFactory.class); } if (this.metricsFactory == null) { Map<String, MetricsFactory> factories = this.applicationContext.getBeansOfType(MetricsFactory.class); if (factories.size() == 1) { this.metricsFactory = factories.values().iterator().next(); } } if (this.metricsFactory == null) { this.metricsFactory = new DefaultMetricsFactory(); } this.sourceConfigurers.putAll(this.applicationContext.getBeansOfType(MessageSourceMetricsConfigurer.class)); Map<String, IntegrationManagement> managed = this.applicationContext .getBeansOfType(IntegrationManagement.class); for (Entry<String, IntegrationManagement> entry : managed.entrySet()) { IntegrationManagement bean = entry.getValue(); if (!bean.getOverrides().loggingConfigured) { bean.setLoggingEnabled(this.defaultLoggingEnabled); } String name = entry.getKey(); doConfigureMetrics(bean, name); } this.singletonsInstantiated = true; }
From source file:org.springframework.integration.support.management.IntegrationManagementConfigurer.java
@Override public void afterSingletonsInstantiated() { Assert.state(this.applicationContext != null, "'applicationContext' must not be null"); Assert.state(MANAGEMENT_CONFIGURER_NAME.equals(this.beanName), getClass().getSimpleName() + " bean name must be " + MANAGEMENT_CONFIGURER_NAME); if (this.metricsFactory == null && StringUtils.hasText(this.metricsFactoryBeanName)) { this.metricsFactory = this.applicationContext.getBean(this.metricsFactoryBeanName, MetricsFactory.class); }/*from ww w . j a v a 2 s . co m*/ if (this.metricsFactory == null) { this.metricsFactory = new DefaultMetricsFactory(); } Map<String, IntegrationManagement> managed = this.applicationContext .getBeansOfType(IntegrationManagement.class); for (Entry<String, IntegrationManagement> entry : managed.entrySet()) { IntegrationManagement bean = entry.getValue(); bean.setLoggingEnabled(this.defaultLoggingEnabled); if (bean instanceof MessageChannelMetrics) { configureChannelMetrics(entry.getKey(), (MessageChannelMetrics) bean); } else if (bean instanceof MessageHandlerMetrics) { configureHandlerMetrics(entry.getKey(), (MessageHandlerMetrics) bean); } else if (bean instanceof MessageSourceMetrics) { configureSourceMetrics(entry.getKey(), (MessageSourceMetrics) bean); } } }