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



##########
File path: CHANGES.md
##########
@@ -8,7 +8,7 @@ Release Notes.
 #### Project
 
 #### Java Agent
-
+* Support Multiple DNS period resolving mechanism
 #### OAP-Backend

Review comment:
       ```suggestion
   * Support Multiple DNS period resolving mechanism
   
   #### OAP-Backend
   ```

##########
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:
       Don't log debug with a new exception, this is pointless.




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