mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
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 {
|
||||
|
||||
private final MetricReader reader;
|
||||
private long timestamp;
|
||||
|
||||
public VanillaPublicMetrics(MetricReader reader) {
|
||||
Assert.notNull(reader, "MetricReader must not be null");
|
||||
this.reader = reader;
|
||||
this.timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -75,6 +77,8 @@ public class VanillaPublicMetrics implements PublicMetrics {
|
||||
// Add JVM uptime in ms
|
||||
result.add(new Metric<Long>("uptime", new Long(ManagementFactory
|
||||
.getRuntimeMXBean().getUptime())));
|
||||
result.add(new Metric<Long>("instance.uptime", System.currentTimeMillis()
|
||||
- this.timestamp));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user