Skip to content

Commit 27f1110

Browse files
committed
Use "jvm.gc.time" for the total gc time in millis
1 parent 8c0c6a1 commit 27f1110

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/io/avaje/metrics/core/JvmGarbageCollectionMetricGroup.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static List<Metric> createGauges() {
2323

2424
for (GarbageCollectorMXBean gcMXBean : garbageCollectorMXBeans) {
2525
// modify collector name replacing spaces with hyphens.
26-
String gcName = gcMXBean.getName().toLowerCase().replace(' ', '-');
26+
String gcName = gcMXBean.getName().toLowerCase().replace(' ', '-').replace(".","");
2727
metrics.add(DefaultGaugeLongMetric.incrementing(name("count", gcName), new Count(gcMXBean)));
2828
metrics.add(DefaultGaugeLongMetric.incrementing(name("time", gcName), new Time(gcMXBean)));
2929
}
@@ -32,11 +32,11 @@ static List<Metric> createGauges() {
3232
}
3333

3434
/**
35-
* Return a Gauge for the total GC time. Gives us a single metric to measure aggregate GC activity.
35+
* Return a Gauge for the total GC time in millis. Gives us a single metric to measure aggregate GC activity.
3636
*/
3737
private static DefaultGaugeLongMetric createTotalGcTime(List<GarbageCollectorMXBean> garbageCollectorMXBeans) {
3838
GarbageCollectorMXBean[] gcBeans = garbageCollectorMXBeans.toArray(new GarbageCollectorMXBean[0]);
39-
return DefaultGaugeLongMetric.incrementing(new DefaultMetricName("jvm.gc.timeTotal"), new TotalTime(gcBeans));
39+
return DefaultGaugeLongMetric.incrementing(new DefaultMetricName("jvm.gc.time"), new TotalTime(gcBeans));
4040
}
4141

4242
private static MetricName name(String prefix, String gcName) {

0 commit comments

Comments
 (0)