Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2146#discussion_r68728510
  
    --- Diff: 
flink-runtime/src/main/scala/org/apache/flink/runtime/taskmanager/TaskManager.scala
 ---
    @@ -2325,55 +2326,65 @@ object TaskManager {
         })
         heap.gauge("Committed", new FlinkGauge[Long] {
             override def getValue: Long = 
mxBean.getHeapMemoryUsage.getCommitted
    -      })
    +    })
         heap.gauge("Max", new FlinkGauge[Long] {
             override def getValue: Long = mxBean.getHeapMemoryUsage.getMax
    -      })
    +    })
     
         val nonHeap = metrics.addGroup("NonHeap")
         nonHeap.gauge("Used", new FlinkGauge[Long] {
             override def getValue: Long = mxBean.getNonHeapMemoryUsage.getUsed
    -      })
    +    })
         nonHeap.gauge("Committed", new FlinkGauge[Long] {
             override def getValue: Long = 
mxBean.getNonHeapMemoryUsage.getCommitted
    -      })
    +    })
         nonHeap.gauge("Max", new FlinkGauge[Long] {
             override def getValue: Long = mxBean.getNonHeapMemoryUsage.getMax
    -      })
    +    })
     
         val con = ManagementFactory.getPlatformMBeanServer;
     
         val directObjectName = new 
ObjectName("java.nio:type=BufferPool,name=direct")
     
    -    val direct = metrics.addGroup("Direct")
    -    direct.gauge("Count", new FlinkGauge[Long] {
    +    try {
    +      val direct = metrics.addGroup("Direct")
    +      direct.gauge("Count", new FlinkGauge[Long] {
             override def getValue: Long = con
               .getAttribute(directObjectName, "Count").asInstanceOf[Long]
           })
    -    direct.gauge("MemoryUsed", new FlinkGauge[Long] {
    +      direct.gauge("MemoryUsed", new FlinkGauge[Long] {
             override def getValue: Long = con
               .getAttribute(directObjectName, "MemoryUsed").asInstanceOf[Long]
           })
    -    direct.gauge("TotalCapacity", new FlinkGauge[Long] {
    +      direct.gauge("TotalCapacity", new FlinkGauge[Long] {
             override def getValue: Long = con
               .getAttribute(directObjectName, 
"TotalCapacity").asInstanceOf[Long]
           })
    +    } catch {
    +      case e: Exception =>
    --- End diff --
    
    Which exception are you catching here? Shouldn't they surround the 
`con.getAttribute` call in the gauges?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to