[ 
https://issues.apache.org/jira/browse/FLINK-1550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15352695#comment-15352695
 ] 

ASF GitHub Bot commented on FLINK-1550:
---------------------------------------

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?


> Show JVM Metrics for JobManager
> -------------------------------
>
>                 Key: FLINK-1550
>                 URL: https://issues.apache.org/jira/browse/FLINK-1550
>             Project: Flink
>          Issue Type: Sub-task
>          Components: JobManager, Metrics
>            Reporter: Robert Metzger
>            Assignee: Chesnay Schepler
>             Fix For: pre-apache
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to