Aias00 commented on code in PR #3767:
URL: https://github.com/apache/hertzbeat/pull/3767#discussion_r2370786421


##########
hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/service/impl/MonitorServiceImpl.java:
##########
@@ -276,7 +276,8 @@ public void importConfig(MultipartFile file) throws 
Exception {
     public void validate(MonitorDto monitorDto, Boolean isModify) throws 
IllegalArgumentException {
         // The request monitoring parameter matches the monitoring parameter 
definition mapping check
         Monitor monitor = monitorDto.getMonitor();
-        monitor.setHost(monitor.getHost().trim());
+        // The Service Discovery host field may be null
+        monitor.setHost(monitor.getHost() != null ? monitor.getHost().trim() : 
"");

Review Comment:
   StringUtils.isBlank



##########
hertzbeat-collector/hertzbeat-collector-collector/src/main/java/org/apache/hertzbeat/collector/metrics/HertzBeatMetricsCollector.java:
##########
@@ -58,6 +58,10 @@ public void recordCollectMetrics(Job job, long 
durationMillis, String status) {
         Map<String, String> metadata = job.getMetadata();
         String monitorName = metadata != null ? metadata.get("instancename") : 
"unknown";
         String monitorTarget = metadata != null ? metadata.get("instancehost") 
: "unknown";
+        // todo can not get the host from service discovery
+        if (monitorTarget == null) {

Review Comment:
   StringUtils.isBlank



-- 
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