flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmetzger <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-1792] TM Monitoring: CPU utilization, h...
Date Thu, 07 May 2015 07:26:42 GMT
Github user rmetzger commented on the pull request:

    The code looks much better now. The only thing that makes me still unhappy is the following
    +       override def getValue: Double = {
    +        try{
    +          val osMXBean = ManagementFactory.getOperatingSystemMXBean().
    +            asInstanceOf[com.sun.management.OperatingSystemMXBean]
    +          fetchCPULoad.map(_.invoke(osMXBean).asInstanceOf[Double]).getOrElse(-1)
    +        } catch {
    +          case t: Throwable => {
    +            LOG.warn("Error retrieving CPU Load through OperatingSystemMXBean", t)
    +            -1
    +          }
    +        }
    +      }
    This `getValue()` method is called every 5 seconds to get the metrics from each machine.
Users using Java 6 will get the WARN in their log + the exception because the cast to `com.sun.management.OperatingSystemMXBean`
will fail every time.
    I would do the following: If you detect that fetchCpuLoad is null, register a gauge which
is always returning -1. Otherwise, register the gauge which is calling fetchCpuLoad.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message