wu-sheng commented on a change in pull request #7398:
URL: https://github.com/apache/skywalking/pull/7398#discussion_r680506691



##########
File path: 
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/GRPCChannelManager.java
##########
@@ -99,20 +101,28 @@ public void shutdown() {
     public void run() {
         LOGGER.debug("Selected collector grpc service running, reconnect:{}.", 
reconnect);
         if (IS_RESOLVE_DNS_PERIODICALLY && reconnect) {
-            String backendService = 
Config.Collector.BACKEND_SERVICE.split(",")[0];
-            try {
-                String[] domainAndPort = backendService.split(":");
-
-                List<String> newGrpcServers = Arrays
-                        .stream(InetAddress.getAllByName(domainAndPort[0]))
-                        .map(InetAddress::getHostAddress)
-                        .map(ip -> String.format("%s:%s", ip, 
domainAndPort[1]))
-                        .collect(Collectors.toList());
-
-                grpcServers = newGrpcServers;
-            } catch (Throwable t) {
-                LOGGER.error(t, "Failed to resolve {} of backend service.", 
backendService);
-            }
+            grpcServers = 
Arrays.stream(Config.Collector.BACKEND_SERVICE.split(","))
+                    .filter(StringUtil::isNotBlank)
+                    .map(eachBackendService -> eachBackendService.split(":"))
+                    .filter(domainPortPairs -> {
+                        if (domainPortPairs.length < 2) {
+                            LOGGER.debug(new IllegalArgumentException(), 
"Service address [{}] format error", domainPortPairs[0]);

Review comment:
       ```suggestion
                               LOGGER.debug("Service address [{}] format error. 
The expected format is IP:port", domainPortPairs[0]);
   ```




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


Reply via email to