Skip to content

Commit e121891

Browse files
authored
Forenkle MetricsUtils (#1397)
1 parent 017c131 commit e121891

File tree

1 file changed

+6
-31
lines changed

1 file changed

+6
-31
lines changed

felles/log/src/main/java/no/nav/vedtak/log/metrics/MetricsUtil.java

+6-31
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import static io.micrometer.prometheusmetrics.PrometheusConfig.DEFAULT;
55

66
import io.micrometer.core.instrument.Metrics;
7-
import io.micrometer.core.instrument.Timer;
87
import io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics;
98
import io.micrometer.core.instrument.binder.jvm.JvmGcMetrics;
109
import io.micrometer.core.instrument.binder.jvm.JvmInfoMetrics;
@@ -24,48 +23,24 @@ private MetricsUtil() {
2423

2524
static {
2625
Metrics.addRegistry(REGISTRY);
26+
// JVM
2727
new ClassLoaderMetrics().bindTo(globalRegistry);
2828
new JvmMemoryMetrics().bindTo(globalRegistry);
2929
new JvmGcMetrics().bindTo(globalRegistry);
30-
new ProcessorMetrics().bindTo(globalRegistry);
3130
new JvmThreadMetrics().bindTo(globalRegistry);
3231
new JvmInfoMetrics().bindTo(globalRegistry);
32+
// System
33+
new ProcessorMetrics().bindTo(globalRegistry);
3334
new UptimeMetrics().bindTo(globalRegistry);
35+
// Logging
3436
new LogbackMetrics().bindTo(globalRegistry);
3537
}
3638

3739
public static String scrape() {
3840
return REGISTRY.scrape();
3941
}
4042

41-
public static void timerUtenHistogram(String navn) {
42-
timerMedPercentiler(navn, 0.5, 0.95, 0.99);
43-
}
44-
45-
public static void timerMedianUtenHistogram(String navn) {
46-
timerMedPercentiler(navn, 0.5);
47-
}
48-
49-
public static void timerMedPercentiler(String navn, double... percentiles) {
50-
Timer.builder(navn)
51-
.publishPercentiles(percentiles)
52-
.publishPercentileHistogram(false)
53-
.register(globalRegistry);
54-
}
55-
56-
public static void timerMedHistogram(String navn) {
57-
timerMedHistogram(navn, 0.5, 0.95, 0.99);
58-
}
59-
60-
public static void timerMedianMedHistogram(String navn) {
61-
timerMedHistogram(navn, 0.5);
62-
}
63-
64-
public static void timerMedHistogram(String navn, double... percentiles) {
65-
Timer.builder(navn)
66-
.publishPercentiles(percentiles)
67-
.publishPercentileHistogram(true)
68-
.register(globalRegistry);
69-
}
43+
// Til info Eksempel på timer med percentiler
44+
// Timer.builder(navn).publishPercentiles(double... percentiles).publishPercentileHistogram(boolean).register(globalRegistry);
7045

7146
}

0 commit comments

Comments
 (0)