Merge pull request #1856 from joshiste/systemLoad

* systemLoad:
  Add systemload.average to SystemPublicMetrics
pull/1860/head
Phillip Webb 10 years ago
commit 91fb4f22bd

@ -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