Add systemload.average to SystemPublicMetrics

Fixes gh-1865
pull/1860/head
Johannes Stelzer 10 years ago committed by Phillip Webb
parent 55ccd07ace
commit 7770b92411

@ -35,6 +35,7 @@ import org.springframework.util.StringUtils;
* @author Dave Syer
* @author Christian Dupuis
* @author Stephane Nicoll
* @author Johannes Stelzer
* @since 1.2.0
*/
public class SystemPublicMetrics implements PublicMetrics, Ordered {
@ -74,6 +75,8 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered {
.getUptime()));
result.add(new Metric<Long>("instance.uptime", System.currentTimeMillis()
- this.timestamp));
result.add(new Metric<Double>("systemload.average", ManagementFactory
.getOperatingSystemMXBean().getSystemLoadAverage()));
}
/**

@ -42,6 +42,7 @@ public class SystemPublicMetricsTests {
assertTrue(results.containsKey("mem.free"));
assertTrue(results.containsKey("processors"));
assertTrue(results.containsKey("uptime"));
assertTrue(results.containsKey("systemload.average"));
assertTrue(results.containsKey("heap.committed"));
assertTrue(results.containsKey("heap.init"));

Loading…
Cancel
Save