You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ma...@apache.org on 2023/04/25 07:53:37 UTC

[iotdb] branch IOTDB-5819 created (now e7e4833c5d)

This is an automated email from the ASF dual-hosted git repository.

marklau99 pushed a change to branch IOTDB-5819
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at e7e4833c5d fix npe when booting net metrics

This branch includes the following new commits:

     new e7e4833c5d fix npe when booting net metrics

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: fix npe when booting net metrics

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

marklau99 pushed a commit to branch IOTDB-5819
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit e7e4833c5d7d09d2525ab7b3feaf2ca446338bef
Author: Liu Xuxin <li...@outlook.com>
AuthorDate: Tue Apr 25 15:53:15 2023 +0800

    fix npe when booting net metrics
---
 .../org/apache/iotdb/metrics/metricsets/net/NetMetrics.java    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/net/NetMetrics.java b/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/net/NetMetrics.java
index 223808976f..2562437b92 100644
--- a/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/net/NetMetrics.java
+++ b/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/net/NetMetrics.java
@@ -56,7 +56,7 @@ public class NetMetrics implements IMetricSet {
           RECEIVED_BYTES,
           MetricLevel.IMPORTANT,
           netMetricManager,
-          x -> x.getReceivedByte().get(iface),
+          x -> x.getReceivedByte().getOrDefault(iface, 0L).doubleValue(),
           TYPE,
           RECEIVE,
           IFACE_NAME,
@@ -65,7 +65,7 @@ public class NetMetrics implements IMetricSet {
           TRANSMITTED_BYTES,
           MetricLevel.IMPORTANT,
           netMetricManager,
-          x -> x.getTransmittedBytes().get(iface),
+          x -> x.getTransmittedBytes().getOrDefault(iface, 0L).doubleValue(),
           TYPE,
           TRANSMIT,
           IFACE_NAME,
@@ -74,7 +74,7 @@ public class NetMetrics implements IMetricSet {
           RECEIVED_PACKETS,
           MetricLevel.IMPORTANT,
           netMetricManager,
-          x -> x.getReceivedPackets().get(iface),
+          x -> x.getReceivedPackets().getOrDefault(iface, 0L).doubleValue(),
           TYPE,
           RECEIVE,
           IFACE_NAME,
@@ -83,7 +83,7 @@ public class NetMetrics implements IMetricSet {
           TRANSMITTED_PACKETS,
           MetricLevel.IMPORTANT,
           netMetricManager,
-          x -> x.getTransmittedPackets().get(iface),
+          x -> x.getTransmittedPackets().getOrDefault(iface, 0L).doubleValue(),
           TYPE,
           TRANSMIT,
           IFACE_NAME,
@@ -93,7 +93,7 @@ public class NetMetrics implements IMetricSet {
         CONNECTION_NUM,
         MetricLevel.IMPORTANT,
         netMetricManager,
-        x -> x.getConnectionNum(),
+        INetMetricManager::getConnectionNum,
         PROCESS_NAME,
         this.processName);
   }