Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed bug: memory usage stats wasn't updating #23

Merged
merged 1 commit into from

1 participant

@sluu

No description provided.

@sluu sluu merged commit 68a97c9 into master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 2, 2013
  1. @sluu
This page is out of date. Refresh to see the latest.
View
24 management/src/main/scala/com/gu/management/JvmMetrics.scala
@@ -67,15 +67,21 @@ object JvmMetrics {
lazy val memoryUsage =
try {
ManagementFactory.getMemoryPoolMXBeans().toList flatMap { memPool: MemoryPoolMXBean =>
- val memoryUsage = memPool.getUsage
- if (memoryUsage == null) None
- else Some(new GaugeMetric(
- group = "jvm",
- name = "%s memory usage".format(memPool.getName),
- title = "%s Memory Usage".format(memPool.getName),
- description = "%s memory usage as percentage of max value".format(memPool.getName),
- getValue = () => math.round(memoryUsage.getUsed.toFloat / memoryUsage.getMax * 100)
- ))
+ {
+ Option(memPool.getUsage) match {
+ case Some(_) => Some(new GaugeMetric(
+ group = "jvm",
+ name = "%s memory usage".format(memPool.getName),
+ title = "%s Memory Usage".format(memPool.getName),
+ description = "%s memory usage as percentage of max value".format(memPool.getName),
+ getValue = () => {
+ val currentUsage = memPool.getUsage
+ math.round(currentUsage.getUsed.toFloat / currentUsage.getMax * 100)
+ }
+ ))
+ case None => None
+ }
+ }
}
} catch {
case e: Exception =>
View
2  version.sbt
@@ -1,2 +1,2 @@
-version in ThisBuild := "5.28"
+version in ThisBuild := "5.29"
Something went wrong with that request. Please try again.