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:38 UTC
[iotdb] 01/01: fix npe when booting net metrics
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);
}