use of org.springframework.integration.support.management.ConfigurableMetricsAware in project spring-integration by spring-projects.
the class IntegrationManagementConfigurer method configureHandlerMetrics.
@SuppressWarnings("unchecked")
private void configureHandlerMetrics(String name, MessageHandlerMetrics bean) {
AbstractMessageHandlerMetrics metrics = this.metricsFactory.createHandlerMetrics(name);
Assert.state(metrics != null, "'metrics' must not be null");
ManagementOverrides overrides = bean.getOverrides();
Boolean enabled = PatternMatchUtils.smartMatch(name, this.enabledCountsPatterns);
if (enabled != null) {
bean.setCountsEnabled(enabled);
} else {
if (!overrides.countsConfigured) {
bean.setCountsEnabled(this.defaultCountsEnabled);
}
}
enabled = PatternMatchUtils.smartMatch(name, this.enabledStatsPatterns);
if (enabled != null) {
bean.setStatsEnabled(enabled);
metrics.setFullStatsEnabled(enabled);
} else {
if (!overrides.statsConfigured) {
bean.setStatsEnabled(this.defaultStatsEnabled);
metrics.setFullStatsEnabled(this.defaultStatsEnabled);
}
}
if (bean instanceof ConfigurableMetricsAware && !overrides.metricsConfigured) {
((ConfigurableMetricsAware<AbstractMessageHandlerMetrics>) bean).configureMetrics(metrics);
}
this.handlersByName.put(bean.getManagedName() != null ? bean.getManagedName() : name, bean);
}
use of org.springframework.integration.support.management.ConfigurableMetricsAware in project spring-integration by spring-projects.
the class IntegrationManagementConfigurer method configureChannelMetrics.
@SuppressWarnings("unchecked")
private void configureChannelMetrics(String name, MessageChannelMetrics bean) {
AbstractMessageChannelMetrics metrics;
if (bean instanceof PollableChannelManagement) {
metrics = this.metricsFactory.createPollableChannelMetrics(name);
} else {
metrics = this.metricsFactory.createChannelMetrics(name);
}
Assert.state(metrics != null, "'metrics' must not be null");
ManagementOverrides overrides = bean.getOverrides();
Boolean enabled = PatternMatchUtils.smartMatch(name, this.enabledCountsPatterns);
if (enabled != null) {
bean.setCountsEnabled(enabled);
} else {
if (!overrides.countsConfigured) {
bean.setCountsEnabled(this.defaultCountsEnabled);
}
}
enabled = PatternMatchUtils.smartMatch(name, this.enabledStatsPatterns);
if (enabled != null) {
bean.setStatsEnabled(enabled);
metrics.setFullStatsEnabled(enabled);
} else {
if (!overrides.statsConfigured) {
bean.setStatsEnabled(this.defaultStatsEnabled);
metrics.setFullStatsEnabled(this.defaultStatsEnabled);
}
}
if (bean instanceof ConfigurableMetricsAware && !overrides.metricsConfigured) {
((ConfigurableMetricsAware<AbstractMessageChannelMetrics>) bean).configureMetrics(metrics);
}
this.channelsByName.put(name, bean);
}
Aggregations