-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
724e1eb
commit 2c4304d
Showing
3 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
felles/log/src/main/java/no/nav/vedtak/log/metrics/MetricsUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package no.nav.vedtak.log.metrics; | ||
|
||
import static io.micrometer.core.instrument.Metrics.globalRegistry; | ||
import static io.micrometer.prometheus.PrometheusConfig.DEFAULT; | ||
|
||
import io.micrometer.core.instrument.Metrics; | ||
import io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics; | ||
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.binder.system.ProcessorMetrics; | ||
import io.micrometer.prometheus.PrometheusMeterRegistry; | ||
|
||
public class MetricsUtil { | ||
public static final PrometheusMeterRegistry REGISTRY = new PrometheusMeterRegistry(DEFAULT); | ||
|
||
static { | ||
Metrics.addRegistry(REGISTRY); | ||
new ClassLoaderMetrics().bindTo(globalRegistry); | ||
new JvmMemoryMetrics().bindTo(globalRegistry); | ||
new JvmGcMetrics().bindTo(globalRegistry); | ||
new ProcessorMetrics().bindTo(globalRegistry); | ||
new JvmThreadMetrics().bindTo(globalRegistry); | ||
} | ||
|
||
public static String scrape() { | ||
return REGISTRY.scrape(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters