You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2023/06/08 09:32:21 UTC

[iotdb] branch cp_net_npe created (now 7c781f5584b)

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

tanxinyu pushed a change to branch cp_net_npe
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at 7c781f5584b  [IOTDB-5819] Fix npe when booting net metrics (#9698)

This branch includes the following new commits:

     new 7c781f5584b  [IOTDB-5819] Fix npe when booting net metrics (#9698)

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: [IOTDB-5819] Fix npe when booting net metrics (#9698)

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

tanxinyu pushed a commit to branch cp_net_npe
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 7c781f5584b78bfe1be2a5469054509588a4dc45
Author: Liu Xuxin <37...@users.noreply.github.com>
AuthorDate: Wed Apr 26 16:48:52 2023 +0800

     [IOTDB-5819] Fix npe when booting net metrics (#9698)
---
 .../java/org/apache/iotdb/metrics/metricsets/net/NetMetrics.java  | 8 ++++----
 1 file changed, 4 insertions(+), 4 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 e1e565c049c..55befc242c0 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
@@ -48,7 +48,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,
@@ -57,7 +57,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,
@@ -66,7 +66,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,
@@ -75,7 +75,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,