MasamiYui commented on code in PR #3328: URL: https://github.com/apache/hertzbeat/pull/3328#discussion_r2083699328
########## hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/component/sd/ServiceDiscoveryWorker.java: ########## @@ -128,10 +116,26 @@ public void run() { if (FILED_HOST.equals(newParam.getField())) { newParam.setParamValue(host); } else if (FILED_PORT.equals(newParam.getField())) { - newParam.setParamValue(port); + // when ds cannot get port, the port will use user filled at configuration page. + if (port == null || port.isEmpty()) { + port = newParam.getParamValue(); + } } newParams.add(newParam); } + final String keyStr = host + ":" + port; + if (subMonitorBindMap.containsKey(keyStr)) { + subMonitorBindMap.remove(keyStr); + continue; + } + Monitor newMonitor = mainMonitor.clone(); + newMonitor.setId(null); + newMonitor.setHost(host); + newMonitor.setName(newMonitor.getName() + "-" + host + ":" + port); + newMonitor.setScrape(CommonConstants.SCRAPE_STATIC); + newMonitor.setGmtCreate(LocalDateTime.now()); + newMonitor.setGmtUpdate(LocalDateTime.now()); Review Comment: yes, rollback changed logic, and add get default value -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@hertzbeat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@hertzbeat.apache.org For additional commands, e-mail: notifications-h...@hertzbeat.apache.org