Repository: huaweicloud/sermant
Issue: 【bug】fix the registry plugin bugs

### What happened?

can not work

### How can we reproduce it (as minimally and precisely as possible)?

no

### Anything else we need to know?

_No response_

### Sermant version

<details>
0.6.0
</details>


### OS version

<details>

```console
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
```
</details>


Changed files:
sermant-plugins/sermant-springboot-registry/springboot-registry-service/src/main/java/com/huawei/discovery/service/lb/DiscoveryManager.java
sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/utils/RequestInterceptorUtils.java
sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpclient/HttpClient4xInterceptor.java
sermant-agentcore/sermant-agentcore-premain/src/main/java/com/huawei/sermant/premain/AgentPremain.java
sermant-plugins/sermant-springboot-registry/springboot-registry-service/src/main/java/com/huawei/discovery/service/retry/RetryServiceImpl.java
sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/retry/RetryConfig.java

diff --git a/sermant-agentcore/sermant-agentcore-premain/src/main/java/com/huawei/sermant/premain/AgentPremain.java b/sermant-agentcore/sermant-agentcore-premain/src/main/java/com/huawei/sermant/premain/AgentPremain.java
index 1844d8f1..f29440dd 100644
--- a/sermant-agentcore/sermant-agentcore-premain/src/main/java/com/huawei/sermant/premain/AgentPremain.java
+++ b/sermant-agentcore/sermant-agentcore-premain/src/main/java/com/huawei/sermant/premain/AgentPremain.java
@@ -74,6 +74,8 @@ public class AgentPremain {
             // agent core入口
             LOGGER.info("Loading sermant agent... ");
             AgentCoreEntrance.run(argsMap, instrumentation);
+
+            LOGGER.info("Load sermant done. ");
         } catch (Exception e) {
             LOGGER.severe(
                 String.format(Locale.ROOT, "Loading sermant agent failed, %s. ", e));
diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpclient/HttpClient4xInterceptor.java b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpclient/HttpClient4xInterceptor.java
index 464d7b58..ed6ef173 100644
--- a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpclient/HttpClient4xInterceptor.java
+++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/interceptors/httpclient/HttpClient4xInterceptor.java
@@ -16,7 +16,6 @@
 
 package com.huawei.discovery.interceptors.httpclient;
 
-import com.huawei.discovery.entity.SimpleRequestRecorder;
 import com.huawei.discovery.interceptors.MarkInterceptor;
 import com.huawei.discovery.retry.InvokerContext;
 import com.huawei.discovery.service.InvokerService;
@@ -60,8 +59,6 @@ public class HttpClient4xInterceptor extends MarkInterceptor {
 
     private final AtomicBoolean isLoaded = new AtomicBoolean();
 
-    private final SimpleRequestRecorder requestRecorder = new SimpleRequestRecorder();
-
     @Override
     public ExecuteContext doBefore(ExecuteContext context) {
         final InvokerService invokerService = PluginServiceManager.getPluginService(InvokerService.class);
@@ -77,7 +74,6 @@ public class HttpClient4xInterceptor extends MarkInterceptor {
             return context;
         }
         RequestInterceptorUtils.printRequestLog("HttpClient", hostAndPath);
-        requestRecorder.beforeRequest();
         invokerService.invoke(
                 buildInvokerFunc(hostAndPath, uri, httpRequest, context),
                 buildExFunc(httpRequest),
diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/retry/RetryConfig.java b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/retry/RetryConfig.java
index 40771082..335aa246 100644
--- a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/retry/RetryConfig.java
+++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/retry/RetryConfig.java
@@ -127,10 +127,17 @@ public class RetryConfig {
         this.name = name;
     }
 
-    private Predicate<Throwable> buildThrowPredicate(List<Class<? extends Throwable>> retryEx,
+    /**
+     * 构建异常判断器
+     *
+     * @param retryEx 类型判断
+     * @param rawRetryEx 类全限定名判断
+     * @return Predicate
+     */
+    public static Predicate<Throwable> buildThrowPredicate(List<Class<? extends Throwable>> retryEx,
             List<String> rawRetryEx) {
         final Predicate<Throwable> assignableEx = ex -> {
-            if (ex == null) {
+            if (ex == null || retryEx == null) {
                 return false;
             }
             for (Class<? extends Throwable> cur : retryEx) {
@@ -144,10 +151,7 @@ public class RetryConfig {
             return false;
         };
         final Predicate<Throwable> rawEx = ex -> {
-            if (ex == null) {
-                return false;
-            }
-            if (rawRetryEx == null) {
+            if (ex == null || rawRetryEx == null) {
                 return false;
             }
             return rawRetryEx.stream().anyMatch(clazz -> isAssignableFrom(clazz, ex.getClass()));
@@ -155,7 +159,7 @@ public class RetryConfig {
         return assignableEx.or(rawEx);
     }
 
-    private boolean isAssignableFrom(String clazz, Class<?> ex) {
+    private static boolean isAssignableFrom(String clazz, Class<?> ex) {
         if (clazz.equals(ex.getName())) {
             return true;
         }
diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/utils/RequestInterceptorUtils.java b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/utils/RequestInterceptorUtils.java
index f26d6bb5..0ed24ac4 100644
--- a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/utils/RequestInterceptorUtils.java
+++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/main/java/com/huawei/discovery/utils/RequestInterceptorUtils.java
@@ -142,7 +142,7 @@ public class RequestInterceptorUtils {
             } catch (InvocationTargetException e) {
                 invokerContext.setEx(e.getTargetException());
                 LOGGER.log(Level.FINE, String.format(Locale.ENGLISH, "invoke method [%s] failed",
-                        context.getMethod().getName()), e);
+                        context.getMethod().getName()), e.getTargetException());
             }
             return Optional.empty();
         };
diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-service/src/main/java/com/huawei/discovery/service/lb/DiscoveryManager.java b/sermant-plugins/sermant-springboot-registry/springboot-registry-service/src/main/java/com/huawei/discovery/service/lb/DiscoveryManager.java
index 92fe7357..985a0ed7 100644
--- a/sermant-plugins/sermant-springboot-registry/springboot-registry-service/src/main/java/com/huawei/discovery/service/lb/DiscoveryManager.java
+++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-service/src/main/java/com/huawei/discovery/service/lb/DiscoveryManager.java
@@ -219,6 +219,9 @@ public enum DiscoveryManager {
     private Loadbalancer getLoadbalancer(String serviceName) {
         checkStats();
         return serviceLbCache.computeIfAbsent(serviceName, curService -> {
+            LOGGER.info(String.format(Locale.ENGLISH,
+                    "Use the loadbalancer [%s], if the lb does not support, it will replace by RoundRobin",
+                    lbConfig.getLbType()));
             final Class<? extends AbstractLoadbalancer> lbClazz = lbCache
                     .getOrDefault(lbConfig.getLbType(), RoundRobinLoadbalancer.class);
             return createLb(lbClazz).orElse(null);
diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-service/src/main/java/com/huawei/discovery/service/retry/RetryServiceImpl.java b/sermant-plugins/sermant-springboot-registry/springboot-registry-service/src/main/java/com/huawei/discovery/service/retry/RetryServiceImpl.java
index 454ca55e..5e868aa5 100644
--- a/sermant-plugins/sermant-springboot-registry/springboot-registry-service/src/main/java/com/huawei/discovery/service/retry/RetryServiceImpl.java
+++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-service/src/main/java/com/huawei/discovery/service/retry/RetryServiceImpl.java
@@ -135,10 +135,10 @@ public class RetryServiceImpl implements InvokerService {
             throws Exception {
         final RetryContext<Recorder> context = retry.context();
         final InvokerContext invokerContext = new InvokerContext();
-        boolean isRetry = false;
+        boolean isInRetry = false;
         do {
             final long start = System.currentTimeMillis();
-            final Optional<ServiceInstance> instance = choose(serviceName, isRetry,
+            final Optional<ServiceInstance> instance = choose(serviceName, isInRetry,
                     invokerContext.getServiceInstance());
             if (!instance.isPresent()) {
                 throw new ProviderException("Can not found provider service named: " + serviceName);
@@ -149,7 +149,7 @@ public class RetryServiceImpl implements InvokerService {
             long consumeTimeMs;
             try {
                 final Object result = invokeFunc.apply(invokerContext);
-                isRetry = true;
+                isInRetry = true;
                 consumeTimeMs = System.currentTimeMillis() - start;
                 if (invokerContext.getEx() != null) {
                     // 此处调用器, 若调用出现异常, 则以异常结果返回
@@ -163,7 +163,7 @@ public class RetryServiceImpl implements InvokerService {
                     return Optional.ofNullable(result);
                 }
             } catch (Exception ex) {
-                isRetry = true;
+                isInRetry = true;
                 handleEx(ex, context, stats, System.currentTimeMillis() - start);
             }
         } while (true);