diff --git a/hermes-common/src/main/java/pl/allegro/tech/hermes/common/di/factories/PrometheusMeterRegistryFactory.java b/hermes-common/src/main/java/pl/allegro/tech/hermes/common/di/factories/PrometheusMeterRegistryFactory.java index 6a06ec5eba..d2849d9cb1 100644 --- a/hermes-common/src/main/java/pl/allegro/tech/hermes/common/di/factories/PrometheusMeterRegistryFactory.java +++ b/hermes-common/src/main/java/pl/allegro/tech/hermes/common/di/factories/PrometheusMeterRegistryFactory.java @@ -1,6 +1,10 @@ package pl.allegro.tech.hermes.common.di.factories; import io.micrometer.core.instrument.Meter; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.binder.jvm.JvmGcMetrics; +import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics; +import io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics; import io.micrometer.core.instrument.config.MeterFilter; import io.micrometer.core.instrument.distribution.DistributionStatisticConfig; import io.micrometer.prometheus.PrometheusConfig; @@ -31,6 +35,7 @@ public PrometheusMeterRegistry provide() { if (parameters.zookeeperReporterEnabled()) { registerZookeeperReporter(meterRegistry); } + registerJvmMetrics(meterRegistry); return meterRegistry; } @@ -55,4 +60,10 @@ private void registerZookeeperReporter(PrometheusMeterRegistry meterRegistry) { new ZookeeperCounterReporter(meterRegistry, counterStorage, prefix) .start(parameters.zookeeperReportPeriod().toSeconds(), TimeUnit.SECONDS); } + + private void registerJvmMetrics(MeterRegistry meterRegistry) { + new JvmMemoryMetrics().bindTo(meterRegistry); + new JvmGcMetrics().bindTo(meterRegistry); + new JvmThreadMetrics().bindTo(meterRegistry); + } } diff --git a/hermes-common/src/main/java/pl/allegro/tech/hermes/common/metric/executor/InstrumentedExecutorServiceFactory.java b/hermes-common/src/main/java/pl/allegro/tech/hermes/common/metric/executor/InstrumentedExecutorServiceFactory.java index 5b20ea30b5..a9b03796b3 100644 --- a/hermes-common/src/main/java/pl/allegro/tech/hermes/common/metric/executor/InstrumentedExecutorServiceFactory.java +++ b/hermes-common/src/main/java/pl/allegro/tech/hermes/common/metric/executor/InstrumentedExecutorServiceFactory.java @@ -1,11 +1,8 @@ package pl.allegro.tech.hermes.common.metric.executor; import com.google.common.util.concurrent.ThreadFactoryBuilder; -import pl.allegro.tech.hermes.common.metric.HermesMetrics; -import java.util.concurrent.BlockingQueue; import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.RejectedExecutionHandler; import java.util.concurrent.ScheduledExecutorService; @@ -14,8 +11,6 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import static java.util.concurrent.Executors.newScheduledThreadPool; - public class InstrumentedExecutorServiceFactory { private final ThreadPoolMetrics threadPoolMetrics;