fix: connection count of current node is not accurate (#11417)
This commit is contained in:
parent
de739e9b9c
commit
2fd002c8d1
@ -25,6 +25,7 @@ import com.alibaba.nacos.api.remote.request.ConnectResetRequest;
|
||||
import com.alibaba.nacos.common.remote.exception.ConnectionAlreadyClosedException;
|
||||
import com.alibaba.nacos.common.spi.NacosServiceLoader;
|
||||
import com.alibaba.nacos.common.utils.StringUtils;
|
||||
import com.alibaba.nacos.core.monitor.MetricsMonitor;
|
||||
import com.alibaba.nacos.plugin.control.ControlManagerCenter;
|
||||
import com.alibaba.nacos.plugin.control.Loggers;
|
||||
import com.alibaba.nacos.plugin.control.configs.ControlConfigs;
|
||||
@ -249,6 +250,7 @@ public class ConnectionManager {
|
||||
// Start UnHealthy Connection Expel Task.
|
||||
RpcScheduledExecutor.COMMON_SERVER_EXECUTOR.scheduleWithFixedDelay(() -> {
|
||||
runtimeConnectionEjector.doEject();
|
||||
MetricsMonitor.getLongConnectionMonitor().set(connections.size());
|
||||
}, 1000L, 3000L, TimeUnit.MILLISECONDS);
|
||||
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ import com.alibaba.nacos.api.remote.request.ClientDetectionRequest;
|
||||
import com.alibaba.nacos.api.remote.response.Response;
|
||||
import com.alibaba.nacos.common.remote.exception.ConnectionAlreadyClosedException;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.alibaba.nacos.core.monitor.MetricsMonitor;
|
||||
import com.alibaba.nacos.plugin.control.Loggers;
|
||||
|
||||
import java.util.HashSet;
|
||||
@ -64,7 +63,6 @@ public class NacosRuntimeConnectionEjector extends RuntimeConnectionEjector {
|
||||
|
||||
Map<String, Connection> connections = connectionManager.connections;
|
||||
int totalCount = connections.size();
|
||||
MetricsMonitor.getLongConnectionMonitor().set(totalCount);
|
||||
int currentSdkClientCount = connectionManager.currentSdkClientCount();
|
||||
|
||||
Loggers.CONNECTION.info("Long connection metrics detail ,Total count ={}, sdkCount={},clusterCount={}",
|
||||
|
Loading…
Reference in New Issue
Block a user