pentium100 commented on code in PR #4101:
URL: https://github.com/apache/hertzbeat/pull/4101#discussion_r3037891264


##########
hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/service/impl/MonitorServiceImpl.java:
##########
@@ -382,22 +382,28 @@ public void modifyMonitor(Monitor monitor, List<Param> 
params, String collector,
             labelDao.saveAll(addLabels);
         }
 
+        boolean isStatic = 
CommonConstants.SCRAPE_STATIC.equals(monitor.getScrape())
+            || !StringUtils.hasText(monitor.getScrape());
+        if (!isStatic && !StringUtils.hasText(monitor.getInstance())) {
+            monitor.setInstance("unknown");
+        }
+
         String instance = monitor.getInstance();
         // The port field may be null
         Param portParam = params.stream()
-                .filter(param -> PARAM_FIELD_PORT.equals(param.getField()))
-                .findFirst()
-                .orElse(null);
+            .filter(param -> PARAM_FIELD_PORT.equals(param.getField()))
+            .findFirst()
+            .orElse(null);
         String portWithMark = (Objects.isNull(portParam) || 
!StringUtils.hasText(portParam.getParamValue()))
-                ? ""
-                : SignConstants.DOUBLE_MARK + portParam.getParamValue();
-        if (Objects.nonNull(instance)) {
+            ? ""
+            : SignConstants.DOUBLE_MARK + portParam.getParamValue();
+        if (Objects.nonNull(instance) && 
!IpDomainUtil.isHasPortWithMark(instance)) {

Review Comment:
   i have modified the code , check if instance contains port at first, if so  
then remove it.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to