From 63e60f13c20b9fd46bf3edf1a1484cbb5501d7dd Mon Sep 17 00:00:00 2001 From: hanbingleixue Date: Tue, 28 Nov 2023 16:34:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=BC=8F=E6=B4=9E=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hanbingleixue --- .../scenarios/dubbo/visibility/action.yml | 8 +++++-- .../scenarios/spring/visibility/action.yml | 8 +++++-- .../NetInterfacesCheckException.java | 6 ++--- .../sermant-agentcore-implement/pom.xml | 2 +- .../implement/config/LoadYamlStrategy.java | 20 +++++++++------- .../converter/YamlConverterImpl.java | 3 ++- sermant-backend/pom.xml | 2 +- sermant-common/pom.xml | 1 + sermant-injector/pom.xml | 2 +- .../dubbo-test/dubbo-integration-api/pom.xml | 2 +- sermant-integration-tests/dubbo-test/pom.xml | 6 ++--- .../spring-intergration-test/pom.xml | 4 ++-- .../visibility/VisibilityTest.java | 2 +- .../dynamic-config-plugin/pom.xml | 2 +- .../flowcontrol-common/pom.xml | 12 ++++++++++ .../flowcontrol-plugin/pom.xml | 2 +- .../dubbo-loadbalancer-plugin/pom.xml | 13 +++++++++++ .../loadbalancer/cache/YamlRuleConverter.java | 3 ++- .../loadbalancer-common/pom.xml | 3 ++- .../loadbalancer/rule/RuleManagerTest.java | 3 ++- .../loadbalancer-service/pom.xml | 1 + .../loadbalancer/YamlRuleConverter.java | 3 ++- .../loadbalancer/common/SafeConstructor.java | 3 ++- .../spring-cloud-loadbalancer-plugin/pom.xml | 13 +++++++++++ .../loadbalancer/YamlRuleConverter.java | 3 ++- .../sermant-monitor/monitor-plugin/pom.xml | 12 ++++++++++ .../router-config-service/pom.xml | 1 + .../router/config/common/SafeConstructor.java | 3 ++- .../spring-router-plugin/pom.xml | 2 +- .../spring-router-service/pom.xml | 12 ++++++++++ .../spring-cloud-registry-plugin/pom.xml | 2 +- .../removal-plugin/pom.xml | 12 ++++++++++ .../removal-service/pom.xml | 1 + .../config/RemovalDynamicConfigListener.java | 3 ++- .../service-visibility-plugin/pom.xml | 2 +- .../visibility/common/CollectorCache.java | 9 +++++++- ...SpringCloudMappingRegistryInterceptor.java | 23 +++++++++++++------ .../spring-beans-deal-plugin/pom.xml | 2 +- .../springboot-registry-plugin/pom.xml | 4 ++-- ...ntsClientHttpConnectorInterceptorTest.java | 4 ++++ .../pom.xml | 12 ++++++++++ .../pom.xml | 12 ++++++++++ .../tag-transmission-dubbo3.x-plugin/pom.xml | 14 ++++++++++- .../tag-transmission-service/pom.xml | 1 + .../listener/TagConfigListener.java | 3 ++- .../pom.xml | 2 +- 46 files changed, 210 insertions(+), 53 deletions(-) diff --git a/.github/actions/scenarios/dubbo/visibility/action.yml b/.github/actions/scenarios/dubbo/visibility/action.yml index 1bed199816..81703ad810 100644 --- a/.github/actions/scenarios/dubbo/visibility/action.yml +++ b/.github/actions/scenarios/dubbo/visibility/action.yml @@ -28,9 +28,11 @@ runs: env: SERVER_PORT: 28054 DUBBO_PROTOCOL_PORT: 28854 + AGENT_SERVICE_HEARTBEAT_ENABLE: true + AGENT_SERVICE_GATEWAY_ENABLE: true + NOTIFICATION_ENABLE: true VISIBILITY_SERVICE_FLAG: true VISIBILITY_CONFIG_START_FLAG: true - AGENT_CONFIG_SERVICE_BLACK_LIST: com.huaweicloud.sermant.implement.service.tracing.TracingServiceImpl run: | nohup java -javaagent:sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar=appName=dubbo-integration-provider -jar \ sermant-integration-tests/dubbo-test/dubbo-${{ env.projectPath }}-integration-provider/target/dubbo-integration-provider.jar > ${{ env.logDir }}/visibility-provider.log 2>&1 & @@ -39,9 +41,11 @@ runs: env: SERVER_PORT: 28050 DUBBO_PROTOCOL_PORT: 28850 + AGENT_SERVICE_HEARTBEAT_ENABLE: true + AGENT_SERVICE_GATEWAY_ENABLE: true + NOTIFICATION_ENABLE: true VISIBILITY_SERVICE_VERSION: 12345 VISIBILITY_CONFIG_START_FLAG: true - AGENT_CONFIG_SERVICE_BLACK_LIST: com.huaweicloud.sermant.implement.service.tracing.TracingServiceImpl run: | nohup java -javaagent:sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar=appName=dubbo-integration-consumer -jar \ sermant-integration-tests/dubbo-test/dubbo-${{ env.projectPath }}-integration-consumer/target/dubbo-integration-consumer.jar > ${{ env.logDir }}/visibility-consumer.log 2>&1 & diff --git a/.github/actions/scenarios/spring/visibility/action.yml b/.github/actions/scenarios/spring/visibility/action.yml index 034fb71791..6c77947943 100644 --- a/.github/actions/scenarios/spring/visibility/action.yml +++ b/.github/actions/scenarios/spring/visibility/action.yml @@ -22,7 +22,9 @@ runs: env: VISIBILITY_SERVICE_FLAG: true VISIBILITY_CONFIG_START_FLAG: true - AGENT_CONFIG_SERVICE_BLACK_LIST: com.huaweicloud.sermant.implement.service.tracing.TracingServiceImpl + AGENT_SERVICE_HEARTBEAT_ENABLE: true + AGENT_SERVICE_GATEWAY_ENABLE: true + NOTIFICATION_ENABLE: true run: | nohup java -javaagent:sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar=appName=default -Dservice.meta.application=feign -Dserver.port=8013 -jar \ -Dsermant_log_dir=${{ env.logDir }}/feign-provider${{ env.tailVersion }} -Dconfig.retry.sleepMs=20 \ @@ -35,7 +37,9 @@ runs: env: VISIBILITY_SERVICE_FLAG: true VISIBILITY_CONFIG_START_FLAG: true - AGENT_CONFIG_SERVICE_BLACK_LIST: com.huaweicloud.sermant.implement.service.tracing.TracingServiceImpl + AGENT_SERVICE_HEARTBEAT_ENABLE: true + AGENT_SERVICE_GATEWAY_ENABLE: true + NOTIFICATION_ENABLE: true run: | nohup java -javaagent:sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar=appName=default -Dservice.meta.application=feign -Dserver.port=8015 -jar \ -Dsermant_log_dir=${{ env.logDir }}/feign-consumer${{ env.tailVersion }} -Dservicecomb.service.openMigration=true -Dservicecomb.service.enableSpringRegister=true \ diff --git a/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/exception/NetInterfacesCheckException.java b/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/exception/NetInterfacesCheckException.java index 0fd8fbfdba..c12036a65d 100644 --- a/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/exception/NetInterfacesCheckException.java +++ b/sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/exception/NetInterfacesCheckException.java @@ -17,7 +17,7 @@ package com.huaweicloud.sermant.core.exception; /** - * ӿڼ쳣 + * 网络接口检查异常 * * @author tangle * @since 2023-11-21 @@ -26,9 +26,9 @@ public class NetInterfacesCheckException extends RuntimeException { private static final long serialVersionUID = -5485122231044249395L; /** - * ӿڼ쳣 + * 网络接口检查异常 * - * @param message 쳣Ϣ + * @param message 异常信息 */ public NetInterfacesCheckException(String message) { super(message); diff --git a/sermant-agentcore/sermant-agentcore-implement/pom.xml b/sermant-agentcore/sermant-agentcore-implement/pom.xml index 1fe410b604..eba04b51d5 100644 --- a/sermant-agentcore/sermant-agentcore-implement/pom.xml +++ b/sermant-agentcore/sermant-agentcore-implement/pom.xml @@ -103,7 +103,7 @@ org.yaml snakeyaml - ${snake.yaml.version} + 2.0 org.apache.httpcomponents diff --git a/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/config/LoadYamlStrategy.java b/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/config/LoadYamlStrategy.java index 0ec0eca170..54bbd6ba51 100644 --- a/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/config/LoadYamlStrategy.java +++ b/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/config/LoadYamlStrategy.java @@ -26,6 +26,7 @@ import com.alibaba.fastjson.util.IOUtils; +import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.ConstructorException; import org.yaml.snakeyaml.representer.Representer; @@ -60,7 +61,8 @@ public class LoadYamlStrategy implements LoadConfigStrategy { */ private static final Logger LOGGER = LoggerFactory.getLogger(); - private static final Map, Class> BASE_TYPE_TRANSFER_MAP = new HashMap, Class>() {{ + private static final Map, Class> BASE_TYPE_TRANSFER_MAP = new HashMap, Class>() { + { put(int.class, Integer.class); put(short.class, Short.class); put(long.class, Long.class); @@ -69,7 +71,8 @@ public class LoadYamlStrategy implements LoadConfigStrategy { put(float.class, Float.class); put(double.class, Double.class); put(boolean.class, Boolean.class); - }}; + } + }; /** * Yaml对象 @@ -85,7 +88,7 @@ public class LoadYamlStrategy implements LoadConfigStrategy { * 构造函数 */ public LoadYamlStrategy() { - Representer representer = new Representer(); + Representer representer = new Representer(new DumperOptions()); representer.getPropertyUtils().setSkipMissingProperties(true); this.yaml = new Yaml(representer); } @@ -104,7 +107,7 @@ public Map getConfigHolder(File config, Map bootstreapArgsMap) { @Override public R loadConfig(Map holder, R config) { - final Class cls = config.getClass(); + final Class cls = (Class) config.getClass(); final String typeKey = ConfigKeyUtil.getTypeKey(cls); final Object typeVal = holder.get(typeKey); if (!(typeVal instanceof Map)) { @@ -123,7 +126,7 @@ public R loadConfig(Map holder, R config) { final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(cls.getClassLoader()); - return (R) yaml.loadAs(yaml.dump(fixEntry(configMap, cls)), cls); + return yaml.loadAs(yaml.dump(fixEntry(configMap, cls)), cls); } finally { Thread.currentThread().setContextClassLoader(classLoader); } @@ -226,12 +229,13 @@ public String getFixedValue(String key) { if (fixedStrValue == null) { fixedVal = null; } else { - fixedVal = yaml.loadAs(fixedStrValue, BASE_TYPE_TRANSFER_MAP.getOrDefault(field.getType(), - field.getType())); + Class fieldClass = BASE_TYPE_TRANSFER_MAP.getOrDefault(field.getType(), field.getType()); + fixedVal = yaml.loadAs(fixedStrValue, fieldClass); } } else { + Class fieldClass = subTypeVal.getClass(); fixedVal = yaml.loadAs(ConfigValueUtil.fixValue(configKey, yaml.dump(subTypeVal), argsMap, provider), - subTypeVal.getClass()); + fieldClass); } } catch (ConstructorException exception) { LOGGER.severe(String.format(Locale.ENGLISH, "Error occurs while parsing configKey: %s", configKey)); diff --git a/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/operation/converter/YamlConverterImpl.java b/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/operation/converter/YamlConverterImpl.java index a46558e46c..2342513c67 100644 --- a/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/operation/converter/YamlConverterImpl.java +++ b/sermant-agentcore/sermant-agentcore-implement/src/main/java/com/huaweicloud/sermant/implement/operation/converter/YamlConverterImpl.java @@ -19,6 +19,7 @@ import com.huaweicloud.sermant.core.common.LoggerFactory; import com.huaweicloud.sermant.core.operation.converter.api.YamlConverter; +import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.ConstructorException; import org.yaml.snakeyaml.representer.Representer; @@ -43,7 +44,7 @@ public class YamlConverterImpl implements YamlConverter { * Constructor. */ public YamlConverterImpl() { - Representer representer = new Representer(); + Representer representer = new Representer(new DumperOptions()); representer.getPropertyUtils().setSkipMissingProperties(true); yaml = new Yaml(representer); } diff --git a/sermant-backend/pom.xml b/sermant-backend/pom.xml index 44de8a2677..08a2b05971 100644 --- a/sermant-backend/pom.xml +++ b/sermant-backend/pom.xml @@ -16,7 +16,7 @@ 2.5.3 UTF-8 4.1.86.Final - 2.6.1 + 2.7.15 3.9.1 1.18.22 1.2.83 diff --git a/sermant-common/pom.xml b/sermant-common/pom.xml index 4ceb250103..d06bf2b04b 100644 --- a/sermant-common/pom.xml +++ b/sermant-common/pom.xml @@ -28,6 +28,7 @@ org.yaml snakeyaml + 2.0 io.prometheus diff --git a/sermant-injector/pom.xml b/sermant-injector/pom.xml index 3867547a17..c75825e68f 100644 --- a/sermant-injector/pom.xml +++ b/sermant-injector/pom.xml @@ -15,7 +15,7 @@ 8 8 2.11.0 - 2.7.1 + 2.7.15 diff --git a/sermant-integration-tests/dubbo-test/dubbo-integration-api/pom.xml b/sermant-integration-tests/dubbo-test/dubbo-integration-api/pom.xml index 83a5a3ab4b..b14dec52a5 100644 --- a/sermant-integration-tests/dubbo-test/dubbo-integration-api/pom.xml +++ b/sermant-integration-tests/dubbo-test/dubbo-integration-api/pom.xml @@ -38,7 +38,7 @@ org.springframework.cloud - spring-cloud-starter-netflix-ribbon + spring-cloud-starter-loadbalancer org.springframework.boot diff --git a/sermant-integration-tests/dubbo-test/pom.xml b/sermant-integration-tests/dubbo-test/pom.xml index 767d0512cf..93796f59b3 100644 --- a/sermant-integration-tests/dubbo-test/pom.xml +++ b/sermant-integration-tests/dubbo-test/pom.xml @@ -20,7 +20,7 @@ org.springframework.boot spring-boot-starter-parent - 2.3.4.RELEASE + 2.7.15 4.0.0 @@ -54,7 +54,7 @@ org.springframework.cloud spring-cloud-dependencies - Hoxton.RELEASE + 2021.0.3 pom import @@ -97,7 +97,7 @@ com.101tec zkclient - ${zkclient.version} + 0.10 diff --git a/sermant-integration-tests/spring-test/spring-intergration-test/pom.xml b/sermant-integration-tests/spring-test/spring-intergration-test/pom.xml index 65e899e86a..af03efd1fa 100644 --- a/sermant-integration-tests/spring-test/spring-intergration-test/pom.xml +++ b/sermant-integration-tests/spring-test/spring-intergration-test/pom.xml @@ -22,7 +22,7 @@ org.springframework.boot spring-boot-starter-parent - 2.2.0.RELEASE + 2.7.15 4.0.0 @@ -37,7 +37,7 @@ org.springframework.boot spring-boot-starter-web - 2.2.0.RELEASE + 2.7.15 test diff --git a/sermant-integration-tests/spring-test/spring-intergration-test/src/test/java/com/huaweicloud/intergration/visibility/VisibilityTest.java b/sermant-integration-tests/spring-test/spring-intergration-test/src/test/java/com/huaweicloud/intergration/visibility/VisibilityTest.java index e67cfcf949..03968285d6 100644 --- a/sermant-integration-tests/spring-test/spring-intergration-test/src/test/java/com/huaweicloud/intergration/visibility/VisibilityTest.java +++ b/sermant-integration-tests/spring-test/spring-intergration-test/src/test/java/com/huaweicloud/intergration/visibility/VisibilityTest.java @@ -47,7 +47,7 @@ public class VisibilityTest { @Test public void testVisibility() throws InterruptedException { RequestUtils.get(TEST_URL, new HashMap<>(), String.class); - Thread.sleep(30000); + Thread.sleep(60000); String string = RequestUtils.get(URL, new HashMap<>(), String.class); Assertions.assertNotNull(string, "服务信息采集失败"); List serverInfos = JSONArray.parseArray(string, ServerInfo.class); diff --git a/sermant-plugins/sermant-dynamic-config/dynamic-config-plugin/pom.xml b/sermant-plugins/sermant-dynamic-config/dynamic-config-plugin/pom.xml index 0543609ff0..c5954d4fdf 100644 --- a/sermant-plugins/sermant-dynamic-config/dynamic-config-plugin/pom.xml +++ b/sermant-plugins/sermant-dynamic-config/dynamic-config-plugin/pom.xml @@ -34,7 +34,7 @@ false plugin - 5.3.14 + 5.3.29 3.0.0 3.0.0 2.2.0.RELEASE diff --git a/sermant-plugins/sermant-flowcontrol/flowcontrol-common/pom.xml b/sermant-plugins/sermant-flowcontrol/flowcontrol-common/pom.xml index ee00533be2..3ce6d76f39 100644 --- a/sermant-plugins/sermant-flowcontrol/flowcontrol-common/pom.xml +++ b/sermant-plugins/sermant-flowcontrol/flowcontrol-common/pom.xml @@ -64,6 +64,18 @@ dubbo 2.5.7 provided + + + org.springframework + spring-expression + + + + + org.springframework + spring-expression + 5.3.29 + provided org.apache.dubbo diff --git a/sermant-plugins/sermant-flowcontrol/flowcontrol-plugin/pom.xml b/sermant-plugins/sermant-flowcontrol/flowcontrol-plugin/pom.xml index 6735901f16..252ad05bb5 100644 --- a/sermant-plugins/sermant-flowcontrol/flowcontrol-plugin/pom.xml +++ b/sermant-plugins/sermant-flowcontrol/flowcontrol-plugin/pom.xml @@ -17,7 +17,7 @@ false plugin - 2.5.2 + 2.7.15 1.7.1 4.0.1 2.5.7 diff --git a/sermant-plugins/sermant-loadbalancer/dubbo-loadbalancer-plugin/pom.xml b/sermant-plugins/sermant-loadbalancer/dubbo-loadbalancer-plugin/pom.xml index 92e62fa2fb..1320a948c1 100644 --- a/sermant-plugins/sermant-loadbalancer/dubbo-loadbalancer-plugin/pom.xml +++ b/sermant-plugins/sermant-loadbalancer/dubbo-loadbalancer-plugin/pom.xml @@ -53,12 +53,25 @@ org.yaml snakeyaml + 2.0 test org.apache.dubbo dubbo 2.7.3 + + + org.springframework + spring-expression + + + test + + + org.springframework + spring-expression + 5.3.29 test diff --git a/sermant-plugins/sermant-loadbalancer/dubbo-loadbalancer-plugin/src/test/java/com/huaweicloud/loadbalancer/cache/YamlRuleConverter.java b/sermant-plugins/sermant-loadbalancer/dubbo-loadbalancer-plugin/src/test/java/com/huaweicloud/loadbalancer/cache/YamlRuleConverter.java index a49cf84666..75933d63f4 100644 --- a/sermant-plugins/sermant-loadbalancer/dubbo-loadbalancer-plugin/src/test/java/com/huaweicloud/loadbalancer/cache/YamlRuleConverter.java +++ b/sermant-plugins/sermant-loadbalancer/dubbo-loadbalancer-plugin/src/test/java/com/huaweicloud/loadbalancer/cache/YamlRuleConverter.java @@ -22,6 +22,7 @@ import com.huaweicloud.sermant.core.plugin.service.PluginService; import com.huaweicloud.sermant.core.utils.StringUtils; +import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.error.YAMLException; import org.yaml.snakeyaml.representer.Representer; @@ -46,7 +47,7 @@ public class YamlRuleConverter implements RuleConverter, PluginService { * 构造器 */ public YamlRuleConverter() { - Representer representer = new Representer(); + Representer representer = new Representer(new DumperOptions()); representer.getPropertyUtils().setSkipMissingProperties(true); yaml = new Yaml(representer); } diff --git a/sermant-plugins/sermant-loadbalancer/loadbalancer-common/pom.xml b/sermant-plugins/sermant-loadbalancer/loadbalancer-common/pom.xml index d333deeade..e2576c239c 100644 --- a/sermant-plugins/sermant-loadbalancer/loadbalancer-common/pom.xml +++ b/sermant-plugins/sermant-loadbalancer/loadbalancer-common/pom.xml @@ -15,7 +15,7 @@ 8 8 UTF-8 - 5.3.0 + 5.3.29 1.3.2 @@ -60,6 +60,7 @@ org.yaml snakeyaml + 2.0 test diff --git a/sermant-plugins/sermant-loadbalancer/loadbalancer-common/src/test/java/com/huaweicloud/loadbalancer/rule/RuleManagerTest.java b/sermant-plugins/sermant-loadbalancer/loadbalancer-common/src/test/java/com/huaweicloud/loadbalancer/rule/RuleManagerTest.java index 9cccb6af20..ea1d533799 100644 --- a/sermant-plugins/sermant-loadbalancer/loadbalancer-common/src/test/java/com/huaweicloud/loadbalancer/rule/RuleManagerTest.java +++ b/sermant-plugins/sermant-loadbalancer/loadbalancer-common/src/test/java/com/huaweicloud/loadbalancer/rule/RuleManagerTest.java @@ -28,6 +28,7 @@ import org.junit.Assert; import org.junit.Test; import org.mockito.Mockito; +import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.error.YAMLException; import org.yaml.snakeyaml.representer.Representer; @@ -116,7 +117,7 @@ static class YamlRuleConverter implements RuleConverter, PluginService { * 构造器 */ public YamlRuleConverter() { - Representer representer = new Representer(); + Representer representer = new Representer(new DumperOptions()); representer.getPropertyUtils().setSkipMissingProperties(true); yaml = new Yaml(representer); } diff --git a/sermant-plugins/sermant-loadbalancer/loadbalancer-service/pom.xml b/sermant-plugins/sermant-loadbalancer/loadbalancer-service/pom.xml index 37a4d1d063..1ff4d41057 100644 --- a/sermant-plugins/sermant-loadbalancer/loadbalancer-service/pom.xml +++ b/sermant-plugins/sermant-loadbalancer/loadbalancer-service/pom.xml @@ -33,6 +33,7 @@ org.yaml snakeyaml + 2.0 junit diff --git a/sermant-plugins/sermant-loadbalancer/loadbalancer-service/src/main/java/com/huaweicloud/loadbalancer/YamlRuleConverter.java b/sermant-plugins/sermant-loadbalancer/loadbalancer-service/src/main/java/com/huaweicloud/loadbalancer/YamlRuleConverter.java index 7eae4b45d6..47d79f4c3f 100644 --- a/sermant-plugins/sermant-loadbalancer/loadbalancer-service/src/main/java/com/huaweicloud/loadbalancer/YamlRuleConverter.java +++ b/sermant-plugins/sermant-loadbalancer/loadbalancer-service/src/main/java/com/huaweicloud/loadbalancer/YamlRuleConverter.java @@ -24,6 +24,7 @@ import com.huaweicloud.sermant.core.plugin.service.PluginService; import com.huaweicloud.sermant.core.utils.StringUtils; +import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.error.YAMLException; import org.yaml.snakeyaml.representer.Representer; @@ -50,7 +51,7 @@ public class YamlRuleConverter implements RuleConverter, PluginService { * 构造器 */ public YamlRuleConverter() { - Representer representer = new Representer(); + Representer representer = new Representer(new DumperOptions()); representer.getPropertyUtils().setSkipMissingProperties(true); List whiteList = new ArrayList<>(); whiteList.add(LoadbalancerRule.class.getCanonicalName()); diff --git a/sermant-plugins/sermant-loadbalancer/loadbalancer-service/src/main/java/com/huaweicloud/loadbalancer/common/SafeConstructor.java b/sermant-plugins/sermant-loadbalancer/loadbalancer-service/src/main/java/com/huaweicloud/loadbalancer/common/SafeConstructor.java index 41b6c3fb93..521d5f1888 100644 --- a/sermant-plugins/sermant-loadbalancer/loadbalancer-service/src/main/java/com/huaweicloud/loadbalancer/common/SafeConstructor.java +++ b/sermant-plugins/sermant-loadbalancer/loadbalancer-service/src/main/java/com/huaweicloud/loadbalancer/common/SafeConstructor.java @@ -16,6 +16,7 @@ package com.huaweicloud.loadbalancer.common; +import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.constructor.Constructor; import org.yaml.snakeyaml.nodes.Tag; @@ -35,7 +36,7 @@ public class SafeConstructor extends Constructor { * @param whiteList 白名单 */ public SafeConstructor(List whiteList) { - super(); + super(new LoaderOptions()); this.yamlConstructors.put(null, undefinedConstructor); this.yamlConstructors.put(new Tag(Tag.PREFIX + Map.class.getCanonicalName()), new SafeConstructObject()); this.yamlConstructors.put(new Tag(Tag.PREFIX + List.class.getCanonicalName()), new SafeConstructObject()); diff --git a/sermant-plugins/sermant-loadbalancer/spring-cloud-loadbalancer-plugin/pom.xml b/sermant-plugins/sermant-loadbalancer/spring-cloud-loadbalancer-plugin/pom.xml index f05e057903..2c42fd4d15 100644 --- a/sermant-plugins/sermant-loadbalancer/spring-cloud-loadbalancer-plugin/pom.xml +++ b/sermant-plugins/sermant-loadbalancer/spring-cloud-loadbalancer-plugin/pom.xml @@ -30,6 +30,18 @@ org.springframework.cloud spring-cloud-loadbalancer ${spring.cloud.version} + + + org.springframework + spring-expression + + + provided + + + org.springframework + spring-expression + 5.3.29 provided @@ -66,6 +78,7 @@ org.yaml snakeyaml + 2.0 test diff --git a/sermant-plugins/sermant-loadbalancer/spring-cloud-loadbalancer-plugin/src/test/java/com/huaweicloud/loadbalancer/YamlRuleConverter.java b/sermant-plugins/sermant-loadbalancer/spring-cloud-loadbalancer-plugin/src/test/java/com/huaweicloud/loadbalancer/YamlRuleConverter.java index 4756a3d937..2744c7b475 100644 --- a/sermant-plugins/sermant-loadbalancer/spring-cloud-loadbalancer-plugin/src/test/java/com/huaweicloud/loadbalancer/YamlRuleConverter.java +++ b/sermant-plugins/sermant-loadbalancer/spring-cloud-loadbalancer-plugin/src/test/java/com/huaweicloud/loadbalancer/YamlRuleConverter.java @@ -22,6 +22,7 @@ import com.huaweicloud.sermant.core.plugin.service.PluginService; import com.huaweicloud.sermant.core.utils.StringUtils; +import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.error.YAMLException; import org.yaml.snakeyaml.representer.Representer; @@ -46,7 +47,7 @@ public class YamlRuleConverter implements RuleConverter, PluginService { * 构造器 */ public YamlRuleConverter() { - Representer representer = new Representer(); + Representer representer = new Representer(new DumperOptions()); representer.getPropertyUtils().setSkipMissingProperties(true); yaml = new Yaml(representer); } diff --git a/sermant-plugins/sermant-monitor/monitor-plugin/pom.xml b/sermant-plugins/sermant-monitor/monitor-plugin/pom.xml index 8e8383e5f3..aa3a941aac 100644 --- a/sermant-plugins/sermant-monitor/monitor-plugin/pom.xml +++ b/sermant-plugins/sermant-monitor/monitor-plugin/pom.xml @@ -32,6 +32,18 @@ com.alibaba dubbo ${alibaba.dubbo.version} + + + org.springframework + spring-expression + + + provided + + + org.springframework + spring-expression + 5.3.29 provided diff --git a/sermant-plugins/sermant-router/router-config-service/pom.xml b/sermant-plugins/sermant-router/router-config-service/pom.xml index 13c8b4ae8f..ab2e41ac90 100644 --- a/sermant-plugins/sermant-router/router-config-service/pom.xml +++ b/sermant-plugins/sermant-router/router-config-service/pom.xml @@ -49,6 +49,7 @@ org.yaml snakeyaml + 2.0 com.alibaba diff --git a/sermant-plugins/sermant-router/router-config-service/src/main/java/com/huaweicloud/sermant/router/config/common/SafeConstructor.java b/sermant-plugins/sermant-router/router-config-service/src/main/java/com/huaweicloud/sermant/router/config/common/SafeConstructor.java index c2e6ed3ae3..781fba4db4 100644 --- a/sermant-plugins/sermant-router/router-config-service/src/main/java/com/huaweicloud/sermant/router/config/common/SafeConstructor.java +++ b/sermant-plugins/sermant-router/router-config-service/src/main/java/com/huaweicloud/sermant/router/config/common/SafeConstructor.java @@ -16,6 +16,7 @@ package com.huaweicloud.sermant.router.config.common; +import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.constructor.Constructor; import org.yaml.snakeyaml.nodes.Tag; @@ -35,7 +36,7 @@ public class SafeConstructor extends Constructor { * @param whiteList 白名单 */ public SafeConstructor(List whiteList) { - super(); + super(new LoaderOptions()); this.yamlConstructors.put(null, undefinedConstructor); this.yamlConstructors.put(new Tag(Tag.PREFIX + Map.class.getCanonicalName()), new SafeConstructObject()); this.yamlConstructors.put(new Tag(Tag.PREFIX + List.class.getCanonicalName()), new SafeConstructObject()); diff --git a/sermant-plugins/sermant-router/spring-router-plugin/pom.xml b/sermant-plugins/sermant-router/spring-router-plugin/pom.xml index 727a18cc02..f2de400c93 100644 --- a/sermant-plugins/sermant-router/spring-router-plugin/pom.xml +++ b/sermant-plugins/sermant-router/spring-router-plugin/pom.xml @@ -14,7 +14,7 @@ plugin 2.2.5.RELEASE - 5.2.0.RELEASE + 5.3.29 9.5.0 2.2.5 1.10.7 diff --git a/sermant-plugins/sermant-router/spring-router-service/pom.xml b/sermant-plugins/sermant-router/spring-router-service/pom.xml index 6d4c3fc6b4..460f6e696a 100644 --- a/sermant-plugins/sermant-router/spring-router-service/pom.xml +++ b/sermant-plugins/sermant-router/spring-router-service/pom.xml @@ -89,6 +89,18 @@ org.springframework.cloud spring-cloud-starter-netflix-eureka-client ${spring.cloud.version} + + + org.springframework + spring-expression + + + test + + + org.springframework + spring-expression + 5.3.29 test diff --git a/sermant-plugins/sermant-service-registry/spring-cloud-registry-plugin/pom.xml b/sermant-plugins/sermant-service-registry/spring-cloud-registry-plugin/pom.xml index 55ad24cd5b..70399ed494 100644 --- a/sermant-plugins/sermant-service-registry/spring-cloud-registry-plugin/pom.xml +++ b/sermant-plugins/sermant-service-registry/spring-cloud-registry-plugin/pom.xml @@ -17,7 +17,7 @@ false plugin - 2.3.4.RELEASE + 2.7.15 2.2.1.RELEASE 10.0.0 1.3.0 diff --git a/sermant-plugins/sermant-service-removal/removal-plugin/pom.xml b/sermant-plugins/sermant-service-removal/removal-plugin/pom.xml index 8969573266..dd35356973 100644 --- a/sermant-plugins/sermant-service-removal/removal-plugin/pom.xml +++ b/sermant-plugins/sermant-service-removal/removal-plugin/pom.xml @@ -34,6 +34,18 @@ com.alibaba dubbo ${alibaba.dubbo.version} + + + org.springframework + spring-expression + + + provided + + + org.springframework + spring-expression + 5.3.29 provided diff --git a/sermant-plugins/sermant-service-removal/removal-service/pom.xml b/sermant-plugins/sermant-service-removal/removal-service/pom.xml index 8226e41577..33278d148d 100644 --- a/sermant-plugins/sermant-service-removal/removal-service/pom.xml +++ b/sermant-plugins/sermant-service-removal/removal-service/pom.xml @@ -33,6 +33,7 @@ org.yaml snakeyaml + 2.0 junit diff --git a/sermant-plugins/sermant-service-removal/removal-service/src/main/java/com/huaweicloud/sermant/config/RemovalDynamicConfigListener.java b/sermant-plugins/sermant-service-removal/removal-service/src/main/java/com/huaweicloud/sermant/config/RemovalDynamicConfigListener.java index bb8c5c827c..9d323d2d90 100644 --- a/sermant-plugins/sermant-service-removal/removal-service/src/main/java/com/huaweicloud/sermant/config/RemovalDynamicConfigListener.java +++ b/sermant-plugins/sermant-service-removal/removal-service/src/main/java/com/huaweicloud/sermant/config/RemovalDynamicConfigListener.java @@ -24,6 +24,7 @@ import com.huaweicloud.sermant.core.service.dynamicconfig.common.DynamicConfigListener; import com.huaweicloud.sermant.core.utils.StringUtils; +import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.representer.Representer; @@ -42,7 +43,7 @@ public class RemovalDynamicConfigListener implements DynamicConfigListener { * 构造方法 */ public RemovalDynamicConfigListener() { - Representer representer = new Representer(); + Representer representer = new Representer(new DumperOptions()); representer.getPropertyUtils().setSkipMissingProperties(true); yaml = new Yaml(representer); } diff --git a/sermant-plugins/sermant-service-visibility/service-visibility-plugin/pom.xml b/sermant-plugins/sermant-service-visibility/service-visibility-plugin/pom.xml index e24e049d45..7e4ef81ee7 100644 --- a/sermant-plugins/sermant-service-visibility/service-visibility-plugin/pom.xml +++ b/sermant-plugins/sermant-service-visibility/service-visibility-plugin/pom.xml @@ -17,7 +17,7 @@ UTF-8 false plugin - 2.3.4.RELEASE + 2.7.15 2.2.1.RELEASE 2.3.0 2.7.15 diff --git a/sermant-plugins/sermant-service-visibility/service-visibility-plugin/src/main/java/com/huaweicloud/visibility/common/CollectorCache.java b/sermant-plugins/sermant-service-visibility/service-visibility-plugin/src/main/java/com/huaweicloud/visibility/common/CollectorCache.java index 2444be9502..f1146206eb 100644 --- a/sermant-plugins/sermant-service-visibility/service-visibility-plugin/src/main/java/com/huaweicloud/visibility/common/CollectorCache.java +++ b/sermant-plugins/sermant-service-visibility/service-visibility-plugin/src/main/java/com/huaweicloud/visibility/common/CollectorCache.java @@ -17,6 +17,7 @@ package com.huaweicloud.visibility.common; +import com.huaweicloud.sermant.core.utils.StringUtils; import com.huaweicloud.visibility.entity.BaseInfo; import com.huaweicloud.visibility.entity.Consanguinity; import com.huaweicloud.visibility.entity.Contract; @@ -54,8 +55,13 @@ private CollectorCache() { * 保存契约信息 * * @param contract 契约信息 + * @return 保存结果 */ - public static void saveContractInfo(Contract contract) { + public static boolean saveContractInfo(Contract contract) { + if (StringUtils.isEmpty(contract.getServiceKey()) || StringUtils.isEmpty(contract.getInterfaceName()) + || contract.getMethodInfoList() == null || contract.getMethodInfoList().isEmpty()) { + return false; + } if (!CONTRACT_MAP.containsKey(contract.getServiceKey())) { CONTRACT_MAP.putIfAbsent(contract.getServiceKey(), contract); } else if (Objects.equals(contract.getServiceType(), ServiceType.DUBBO.getType())) { @@ -65,6 +71,7 @@ public static void saveContractInfo(Contract contract) { Contract oldContract = CONTRACT_MAP.get(contract.getServiceKey()); oldContract.getMethodInfoList().addAll(contract.getMethodInfoList()); } + return true; } /** diff --git a/sermant-plugins/sermant-service-visibility/service-visibility-plugin/src/main/java/com/huaweicloud/visibility/interceptor/SpringCloudMappingRegistryInterceptor.java b/sermant-plugins/sermant-service-visibility/service-visibility-plugin/src/main/java/com/huaweicloud/visibility/interceptor/SpringCloudMappingRegistryInterceptor.java index f52203ca13..39451f43b4 100644 --- a/sermant-plugins/sermant-service-visibility/service-visibility-plugin/src/main/java/com/huaweicloud/visibility/interceptor/SpringCloudMappingRegistryInterceptor.java +++ b/sermant-plugins/sermant-service-visibility/service-visibility-plugin/src/main/java/com/huaweicloud/visibility/interceptor/SpringCloudMappingRegistryInterceptor.java @@ -18,6 +18,7 @@ package com.huaweicloud.visibility.interceptor; import com.huaweicloud.sermant.core.plugin.agent.entity.ExecuteContext; +import com.huaweicloud.sermant.core.utils.StringUtils; import com.huaweicloud.visibility.common.CollectorCache; import com.huaweicloud.visibility.common.OperateType; import com.huaweicloud.visibility.common.ServiceType; @@ -55,7 +56,13 @@ public ExecuteContext after(ExecuteContext context) { for (Object object : context.getArguments()) { if (object instanceof RequestMappingInfo) { RequestMappingInfo requestMappingInfo = (RequestMappingInfo) object; - contract.setUrl((String) requestMappingInfo.getPatternsCondition().getPatterns().toArray()[0]); + if (requestMappingInfo.getPatternsCondition() == null + || requestMappingInfo.getPatternsCondition().getPatterns() == null + || requestMappingInfo.getPatternsCondition().getPatterns().isEmpty()) { + continue; + } + Object url = requestMappingInfo.getPatternsCondition().getPatterns().toArray()[0]; + contract.setUrl(StringUtils.getString(url)); } if (object instanceof Method) { Method method = (Method) object; @@ -70,12 +77,14 @@ public ExecuteContext after(ExecuteContext context) { } } contract.setServiceType(ServiceType.SPRING_CLOUD.getType()); - CollectorCache.saveContractInfo(contract); - ServerInfo serverinfo = new ServerInfo(); - serverinfo.setContractList(new ArrayList<>()); - serverinfo.getContractList().add(contract); - serverinfo.setOperateType(OperateType.ADD.getType()); - collectorService.sendServerInfo(serverinfo); + boolean flag = CollectorCache.saveContractInfo(contract); + if (flag) { + ServerInfo serverinfo = new ServerInfo(); + serverinfo.setContractList(new ArrayList<>()); + serverinfo.getContractList().add(contract); + serverinfo.setOperateType(OperateType.ADD.getType()); + collectorService.sendServerInfo(serverinfo); + } return context; } } diff --git a/sermant-plugins/sermant-spring-beans-deal/spring-beans-deal-plugin/pom.xml b/sermant-plugins/sermant-spring-beans-deal/spring-beans-deal-plugin/pom.xml index c73526b00d..ca1cf704d8 100644 --- a/sermant-plugins/sermant-spring-beans-deal/spring-beans-deal-plugin/pom.xml +++ b/sermant-plugins/sermant-spring-beans-deal/spring-beans-deal-plugin/pom.xml @@ -14,7 +14,7 @@ false plugin - 5.3.14 + 5.3.29 diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/pom.xml b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/pom.xml index 849847fa25..f8a30422a4 100644 --- a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/pom.xml +++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/pom.xml @@ -37,13 +37,13 @@ org.springframework spring-web - ${spring.version} + 5.3.29 provided org.springframework spring-context - ${spring.version} + 5.3.29 provided diff --git a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/test/java/com/huawei/discovery/interceptors/HttpComponentsClientHttpConnectorInterceptorTest.java b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/test/java/com/huawei/discovery/interceptors/HttpComponentsClientHttpConnectorInterceptorTest.java index e383cc371b..c514f23b5f 100644 --- a/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/test/java/com/huawei/discovery/interceptors/HttpComponentsClientHttpConnectorInterceptorTest.java +++ b/sermant-plugins/sermant-springboot-registry/springboot-registry-plugin/src/test/java/com/huawei/discovery/interceptors/HttpComponentsClientHttpConnectorInterceptorTest.java @@ -194,6 +194,10 @@ public URI getURI() { return uri; } + public T getNativeRequest() { + return (T) this.httpRequest; + } + @Override public DataBufferFactory bufferFactory() { return dataBufferFactory; diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo2.6.x-plugin/pom.xml b/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo2.6.x-plugin/pom.xml index f23e6cad42..012bbaf281 100644 --- a/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo2.6.x-plugin/pom.xml +++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo2.6.x-plugin/pom.xml @@ -34,6 +34,18 @@ dubbo ${alibaba.dubbo.version} provided + + + org.springframework + spring-expression + + + + + org.springframework + spring-expression + 5.3.29 + provided junit diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo2.7.x-plugin/pom.xml b/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo2.7.x-plugin/pom.xml index bdbdb729a0..2326b3f519 100644 --- a/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo2.7.x-plugin/pom.xml +++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo2.7.x-plugin/pom.xml @@ -34,6 +34,18 @@ dubbo ${apache.dubbo.version} provided + + + org.springframework + spring-expression + + + + + org.springframework + spring-expression + 5.3.29 + provided junit diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo3.x-plugin/pom.xml b/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo3.x-plugin/pom.xml index 59db5f1a04..70bb469d3f 100644 --- a/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo3.x-plugin/pom.xml +++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-dubbo3.x-plugin/pom.xml @@ -16,7 +16,7 @@ 8 false plugin - 3.2.0 + 3.2.5 @@ -33,6 +33,18 @@ org.apache.dubbo dubbo ${apache.dubbo.version} + + + org.springframework + spring-expression + + + provided + + + org.springframework + spring-expression + 5.3.29 provided diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-service/pom.xml b/sermant-plugins/sermant-tag-transmission/tag-transmission-service/pom.xml index ae05738f40..1bd0c07c54 100644 --- a/sermant-plugins/sermant-tag-transmission/tag-transmission-service/pom.xml +++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-service/pom.xml @@ -22,6 +22,7 @@ org.yaml snakeyaml + 2.0 com.alibaba diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-service/src/main/java/com/huaweicloud/sermant/tag/transmission/listener/TagConfigListener.java b/sermant-plugins/sermant-tag-transmission/tag-transmission-service/src/main/java/com/huaweicloud/sermant/tag/transmission/listener/TagConfigListener.java index 0a715c4117..80bfb5eb1a 100644 --- a/sermant-plugins/sermant-tag-transmission/tag-transmission-service/src/main/java/com/huaweicloud/sermant/tag/transmission/listener/TagConfigListener.java +++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-service/src/main/java/com/huaweicloud/sermant/tag/transmission/listener/TagConfigListener.java @@ -23,6 +23,7 @@ import com.huaweicloud.sermant.core.service.dynamicconfig.common.DynamicConfigListener; import com.huaweicloud.sermant.tag.transmission.config.TagTransmissionConfig; +import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.error.YAMLException; import org.yaml.snakeyaml.representer.Representer; @@ -47,7 +48,7 @@ public class TagConfigListener implements DynamicConfigListener { * 构造方法 */ public TagConfigListener() { - Representer representer = new Representer(); + Representer representer = new Representer(new DumperOptions()); representer.getPropertyUtils().setSkipMissingProperties(true); this.yaml = new Yaml(representer); this.tagTransmissionConfig = PluginConfigManager.getPluginConfig(TagTransmissionConfig.class); diff --git a/sermant-plugins/sermant-tag-transmission/tag-transmission-servicecomb-plugin/pom.xml b/sermant-plugins/sermant-tag-transmission/tag-transmission-servicecomb-plugin/pom.xml index 18014e5afd..6ae5ef96ae 100644 --- a/sermant-plugins/sermant-tag-transmission/tag-transmission-servicecomb-plugin/pom.xml +++ b/sermant-plugins/sermant-tag-transmission/tag-transmission-servicecomb-plugin/pom.xml @@ -16,7 +16,7 @@ 8 false plugin - 2.6.0 + 2.8.10