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/04/26 08:49:00 UTC
[iotdb] branch master updated: [IOTDB-5819] Fix npe when booting net metrics (#9698)
This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new c7a6184c01 [IOTDB-5819] Fix npe when booting net metrics (#9698)
c7a6184c01 is described below
commit c7a6184c01d95621550a7add8482dcbd4c7bb081
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)
---
.../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);
}