- Fix memory leak.

- Add code's line-numbers in the logs.
This commit is contained in:
Lampros Smyrnaios 2022-11-18 12:21:56 +02:00
parent 83c77670ab
commit dbe13a7ed1
2 changed files with 6 additions and 2 deletions

View File

@ -51,7 +51,11 @@ public class PrometheusController { // TODO: remove this with migration to Sprin
public String getMetrics() {
PrometheusMeterRegistry registry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
new JvmThreadMetrics().bindTo(registry);
new JvmGcMetrics().bindTo(registry);
try (JvmGcMetrics jvmGcMetrics = new JvmGcMetrics() ) {
jvmGcMetrics.bindTo(registry);
} catch (Exception e) {
LOGGER.error("", e);
}
new JvmMemoryMetrics().bindTo(registry);
new DiskSpaceMetrics(new File("/")).bindTo(registry);
new ProcessorMetrics().bindTo(registry); // metrics related to the CPU stats

View File

@ -2,7 +2,7 @@
<Configuration status="DEBUG">
<Appenders>
<Console name="LogToConsole" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %highlight{%-5level} %logger{36} - %msg%n"/>
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %highlight{%-5level} %logger{36}.%M\(@%line\) - %msg%n"/>
</Console>
</Appenders>
<Loggers>