From 1015c69e32e6a34847c60a69a12cf82b3f6e167d Mon Sep 17 00:00:00 2001 From: HMYDK Date: Fri, 5 Jul 2024 13:53:02 +0800 Subject: [PATCH] [ISSUE #12282]Fix the issue where monitoring data cannot be found through the IP dimension in the ListeningQuery --- .../config/server/service/ConfigSubService.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/ConfigSubService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/ConfigSubService.java index 31b2a2c9234..ebf7afabb1a 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/ConfigSubService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/ConfigSubService.java @@ -83,6 +83,11 @@ private List runConfigListenerCollectionJob(Map pa return new ClusterListenerJob(params, completionService, memberManager).runJobs(); } + private List runConfigListenerByIpCollectionJob(Map params, + CompletionService completionService) { + return new ClusterListenerByIpJob(params, completionService, memberManager).runJobs(); + } + static class ClusterListenerJob extends ClusterJob { static final String URL = Constants.COMMUNICATION_CONTROLLER_PATH + "/configWatchers"; @@ -93,6 +98,16 @@ static class ClusterListenerJob extends ClusterJob { } } + static class ClusterListenerByIpJob extends ClusterJob { + + static final String URL = Constants.COMMUNICATION_CONTROLLER_PATH + "/watcherConfigs"; + + ClusterListenerByIpJob(Map params, CompletionService completionService, + ServerMemberManager serverMemberManager) { + super(URL, params, completionService, serverMemberManager); + } + } + private List runHasCheckListenerCollectionJob(Map params, CompletionService completionService) { return new ClusterCheckHasListenerJob(params, completionService, memberManager).runJobs(); @@ -324,7 +339,7 @@ public SampleResult getCollectSampleResultByIp(String ip, int sampleTime) { SampleResult sampleCollectResult = new SampleResult(); for (int i = 0; i < sampleTime; i++) { - List sampleResults = runConfigListenerCollectionJob(params, completionService); + List sampleResults = runConfigListenerByIpCollectionJob(params, completionService); if (sampleResults != null) { sampleCollectResult = mergeSampleResult(sampleCollectResult, sampleResults); }