|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2012-2022 the original author or authors. |
|
|
|
|
* Copyright 2012-2023 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -25,6 +25,7 @@ import io.micrometer.core.instrument.MeterRegistry;
@@ -25,6 +25,7 @@ import io.micrometer.core.instrument.MeterRegistry;
|
|
|
|
|
import io.micrometer.core.instrument.binder.jvm.ExecutorServiceMetrics; |
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.boot.LazyInitializationExcludeFilter; |
|
|
|
|
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration; |
|
|
|
|
import org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration; |
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfiguration; |
|
|
|
|
@ -33,6 +34,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
@@ -33,6 +34,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
|
|
|
|
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration; |
|
|
|
|
import org.springframework.boot.autoconfigure.task.TaskSchedulingAutoConfiguration; |
|
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
|
|
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; |
|
|
|
|
|
|
|
|
|
@ -63,6 +65,11 @@ public class TaskExecutorMetricsAutoConfiguration {
@@ -63,6 +65,11 @@ public class TaskExecutorMetricsAutoConfiguration {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
static LazyInitializationExcludeFilter eagerTaskExecutorMetrics() { |
|
|
|
|
return LazyInitializationExcludeFilter.forBeanTypes(TaskExecutorMetricsAutoConfiguration.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void monitor(MeterRegistry registry, ThreadPoolExecutor threadPoolExecutor, String name) { |
|
|
|
|
if (threadPoolExecutor != null) { |
|
|
|
|
new ExecutorServiceMetrics(threadPoolExecutor, name, Collections.emptyList()).bindTo(registry); |
|
|
|
|
|