@EnableDynamicThreadPool controls MicrometerMonitorAutoConfiguration (#1413)

pull/1412/merge
zjHe 2 years ago committed by GitHub
parent 1b744ac91f
commit 1e95ce8fb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -45,8 +45,7 @@ public class ThreadPoolExecutorUtilTest {
maxPoolSize, maxPoolSize,
1L, 1L,
TimeUnit.SECONDS, TimeUnit.SECONDS,
new ArrayBlockingQueue<>(10) new ArrayBlockingQueue<>(10));
);
} }
@Test @Test

@ -27,7 +27,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
/** /**
* Micrometer monitor auto configuration. * Micrometer monitor auto configuration.

@ -58,8 +58,10 @@ public class AdapterThreadPoolMicrometerMonitorHandler extends AbstractAdapterTh
Tag.of(APPLICATION_NAME_TAG, applicationName)); Tag.of(APPLICATION_NAME_TAG, applicationName));
Metrics.gauge(metricName("core.size"), tags, threadPoolAdapterState, ThreadPoolAdapterState::getCoreSize); Metrics.gauge(metricName("core.size"), tags, threadPoolAdapterState, ThreadPoolAdapterState::getCoreSize);
Metrics.gauge(metricName("maximum.size"), tags, threadPoolAdapterState, ThreadPoolAdapterState::getMaximumSize); Metrics.gauge(metricName("maximum.size"), tags, threadPoolAdapterState, ThreadPoolAdapterState::getMaximumSize);
if (threadPoolAdapterState.getBlockingQueueCapacity() != null) {
Metrics.gauge(metricName("queue.capacity"), tags, threadPoolAdapterState, ThreadPoolAdapterState::getBlockingQueueCapacity); Metrics.gauge(metricName("queue.capacity"), tags, threadPoolAdapterState, ThreadPoolAdapterState::getBlockingQueueCapacity);
} }
}
private String metricName(String name) { private String metricName(String name) {
return String.join(".", METRIC_NAME_PREFIX, name); return String.join(".", METRIC_NAME_PREFIX, name);

Loading…
Cancel
Save