Duansg commented on code in PR #4101:
URL: https://github.com/apache/hertzbeat/pull/4101#discussion_r3017215490
##########
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 a question here: if this includes port-skipping concatenation, will
changes made by the user to the port not take effect?
--
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]