Add instance.uptime to VanillaPublicMetrics
This commit is contained in:
parent
078e5425cd
commit
0d5c30fdcc
|
@ -40,10 +40,12 @@ import org.springframework.util.StringUtils;
|
||||||
public class VanillaPublicMetrics implements PublicMetrics {
|
public class VanillaPublicMetrics implements PublicMetrics {
|
||||||
|
|
||||||
private final MetricReader reader;
|
private final MetricReader reader;
|
||||||
|
private long timestamp;
|
||||||
|
|
||||||
public VanillaPublicMetrics(MetricReader reader) {
|
public VanillaPublicMetrics(MetricReader reader) {
|
||||||
Assert.notNull(reader, "MetricReader must not be null");
|
Assert.notNull(reader, "MetricReader must not be null");
|
||||||
this.reader = reader;
|
this.reader = reader;
|
||||||
|
this.timestamp = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -75,6 +77,8 @@ public class VanillaPublicMetrics implements PublicMetrics {
|
||||||
// Add JVM uptime in ms
|
// Add JVM uptime in ms
|
||||||
result.add(new Metric<Long>("uptime", new Long(ManagementFactory
|
result.add(new Metric<Long>("uptime", new Long(ManagementFactory
|
||||||
.getRuntimeMXBean().getUptime())));
|
.getRuntimeMXBean().getUptime())));
|
||||||
|
result.add(new Metric<Long>("instance.uptime", System.currentTimeMillis()
|
||||||
|
- this.timestamp));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue