From d862f166a1cf659734797266b6699846aad8982b Mon Sep 17 00:00:00 2001 From: bitgorust Date: Thu, 1 Feb 2024 10:36:27 +0800 Subject: [PATCH 1/2] fix: delete outdated metrics port assertions --- .../dubbo/config/AbstractInterfaceConfig.java | 19 ------------------- .../apache/dubbo/config/MetricsConfig.java | 15 --------------- .../apache/dubbo/config/ReferenceConfig.java | 1 - .../apache/dubbo/config/ServiceConfig.java | 1 - 4 files changed, 36 deletions(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java index 154e33af146..9eec9c55d84 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java @@ -21,7 +21,6 @@ import org.apache.dubbo.common.config.ConfigurationUtils; import org.apache.dubbo.common.config.Environment; import org.apache.dubbo.common.config.InmemoryConfiguration; -import org.apache.dubbo.common.utils.Assert; import org.apache.dubbo.common.utils.ClassUtils; import org.apache.dubbo.common.utils.CollectionUtils; import org.apache.dubbo.common.utils.ConfigUtils; @@ -54,7 +53,6 @@ import static org.apache.dubbo.common.constants.CommonConstants.TAG_KEY; import static org.apache.dubbo.common.constants.CommonConstants.TIMESTAMP_KEY; import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_NO_METHOD_FOUND; -import static org.apache.dubbo.common.constants.MetricsConstants.PROTOCOL_PROMETHEUS; /** * AbstractDefaultConfig @@ -267,23 +265,6 @@ public static void appendRuntimeParameters(Map map) { } } - /** - * @deprecated After metrics config is refactored. - * This method should no longer use and will be deleted in the future. - */ - @Deprecated - protected void appendMetricsCompatible(Map map) { - MetricsConfig metricsConfig = getConfigManager().getMetrics().orElse(null); - if (metricsConfig != null) { - String protocol = Optional.ofNullable(metricsConfig.getProtocol()).orElse(PROTOCOL_PROMETHEUS); - if (!StringUtils.isEquals(protocol, PROTOCOL_PROMETHEUS)) { - Assert.notEmptyString(metricsConfig.getPort(), "Metrics port cannot be null"); - map.put("metrics.protocol", protocol); - map.put("metrics.port", metricsConfig.getPort()); - } - } - } - /** * To obtain the method list in the port, use reflection when in native mode and javassist otherwise. * diff --git a/dubbo-common/src/main/java/org/apache/dubbo/config/MetricsConfig.java b/dubbo-common/src/main/java/org/apache/dubbo/config/MetricsConfig.java index dee55c87eba..15506fa3de4 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/config/MetricsConfig.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/config/MetricsConfig.java @@ -76,13 +76,6 @@ public class MetricsConfig extends AbstractConfig { */ private Integer collectorSyncPeriod; - /** - * @deprecated After metrics config is refactored. - * This parameter should no longer use and will be deleted in the future. - */ - @Deprecated - private String port; - /** * The prometheus metrics config */ @@ -166,14 +159,6 @@ public void setEnableRegistry(Boolean enableRegistry) { this.enableRegistry = enableRegistry; } - public String getPort() { - return port; - } - - public void setPort(String port) { - this.port = port; - } - public PrometheusConfig getPrometheus() { return prometheus; } diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java index 4132922051a..fe9f2cdacc8 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java @@ -442,7 +442,6 @@ private Map appendConfig() { AbstractConfig.appendParameters(map, getModule()); AbstractConfig.appendParameters(map, consumer); AbstractConfig.appendParameters(map, this); - appendMetricsCompatible(map); String hostToRegistry = ConfigUtils.getSystemProperty(DUBBO_IP_TO_REGISTRY); if (StringUtils.isEmpty(hostToRegistry)) { diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java index 2d23af3d859..e77c9e2e820 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java @@ -663,7 +663,6 @@ private Map buildAttributes(ProtocolConfig protocolConfig) { AbstractConfig.appendParameters(map, provider); AbstractConfig.appendParameters(map, protocolConfig); AbstractConfig.appendParameters(map, this); - appendMetricsCompatible(map); // append params with method configs, if (CollectionUtils.isNotEmpty(getMethods())) { From d34de3c7007594fb8b14a02f67f05979d9b30b94 Mon Sep 17 00:00:00 2001 From: bitgorust Date: Thu, 1 Feb 2024 19:42:21 +0800 Subject: [PATCH 2/2] chore: remove outdated port attribute in metricsType --- .../src/main/resources/META-INF/dubbo.xsd | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd index 411f55a3c49..97625834ad3 100644 --- a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd +++ b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd @@ -1103,12 +1103,6 @@ - - - - - -