[#933][0.7] fix: incorrect metric grpc_server_connection_number (#941)
### What changes were proposed in this pull request?
Fix incorrect metric grpc_server_connection_number
### Why are the changes needed?
Fix: #933
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Existing UT
diff --git a/common/src/main/java/org/apache/uniffle/common/rpc/MonitoringServerTransportFilter.java b/common/src/main/java/org/apache/uniffle/common/rpc/MonitoringServerTransportFilter.java
index 2c29dd2..ef687ec 100644
--- a/common/src/main/java/org/apache/uniffle/common/rpc/MonitoringServerTransportFilter.java
+++ b/common/src/main/java/org/apache/uniffle/common/rpc/MonitoringServerTransportFilter.java
@@ -37,7 +37,9 @@
}
public void transportTerminated(Attributes transportAttrs) {
- grpcMetrics.decGauge(GRPC_SERVER_CONNECTION_NUMBER_KEY);
+ if (transportAttrs != null) {
+ grpcMetrics.decGauge(GRPC_SERVER_CONNECTION_NUMBER_KEY);
+ }
super.transportTerminated(transportAttrs);
}
}