Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wxbty committed Jan 31, 2023
1 parent 5f5959b commit 6616818
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ private void addJvmMetrics() {
Optional.ofNullable(applicationModel.getApplicationName()).orElse(""));
new ClassLoaderMetrics(extraTags).bindTo(compositeRegistry);
new JvmMemoryMetrics(extraTags).bindTo(compositeRegistry);

@SuppressWarnings("java:S2095")
// Do not change JvmGcMetrics to try-with-resources as the JvmGcMetrics will not be available after (auto-)closing.
// See https://github.com/micrometer-metrics/micrometer/issues/1492
JvmGcMetrics jvmGcMetrics = new JvmGcMetrics(extraTags);
jvmGcMetrics.bindTo(compositeRegistry);
Runtime.getRuntime().addShutdownHook(new Thread(jvmGcMetrics::close));
Expand Down

0 comments on commit 6616818

Please sign in to comment.