Search in sources :

Example 1 with ConfigurableMetricsAware

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);
}
Also used : ConfigurableMetricsAware(org.springframework.integration.support.management.ConfigurableMetricsAware) AbstractMessageHandlerMetrics(org.springframework.integration.support.management.AbstractMessageHandlerMetrics) ManagementOverrides(org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides)

Example 2 with ConfigurableMetricsAware

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);
}
Also used : ConfigurableMetricsAware(org.springframework.integration.support.management.ConfigurableMetricsAware) AbstractMessageChannelMetrics(org.springframework.integration.support.management.AbstractMessageChannelMetrics) PollableChannelManagement(org.springframework.integration.support.management.PollableChannelManagement) ManagementOverrides(org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides)

Aggregations

ConfigurableMetricsAware (org.springframework.integration.support.management.ConfigurableMetricsAware)2 ManagementOverrides (org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides)2 AbstractMessageChannelMetrics (org.springframework.integration.support.management.AbstractMessageChannelMetrics)1 AbstractMessageHandlerMetrics (org.springframework.integration.support.management.AbstractMessageHandlerMetrics)1 PollableChannelManagement (org.springframework.integration.support.management.PollableChannelManagement)1