[ https://issues.apache.org/jira/browse/FLINK-7812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16281768#comment-16281768 ]
ASF GitHub Bot commented on FLINK-7812: --------------------------------------- Github user StephanEwen commented on a diff in the pull request: https://github.com/apache/flink/pull/4801#discussion_r155503740 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/metrics/util/MetricUtils.java --- @@ -102,37 +103,16 @@ public static void instantiateStatusMetrics( private static void instantiateNetworkMetrics( MetricGroup metrics, final NetworkEnvironment network) { - metrics.<Long, Gauge<Long>>gauge("TotalMemorySegments", new Gauge<Long> () { - @Override - public Long getValue() { - return (long) network.getNetworkBufferPool().getTotalNumberOfMemorySegments(); - } - }); - metrics.<Long, Gauge<Long>>gauge("AvailableMemorySegments", new Gauge<Long> () { - @Override - public Long getValue() { - return (long) network.getNetworkBufferPool().getNumberOfAvailableMemorySegments(); - } - }); + final NetworkBufferPool networkBufferPool = network.getNetworkBufferPool(); + metrics.<Long, Gauge<Long>>gauge("TotalMemorySegments", () -> (long) networkBufferPool.getTotalNumberOfMemorySegments()); --- End diff -- Replace with "Integer" Gauge and change to method reference? > Log system resources as metrics > ------------------------------- > > Key: FLINK-7812 > URL: https://issues.apache.org/jira/browse/FLINK-7812 > Project: Flink > Issue Type: New Feature > Components: Metrics > Reporter: Piotr Nowojski > Assignee: Piotr Nowojski > -- This message was sent by Atlassian JIRA (v6.4.14#64029)