Skip to content

Commit

Permalink
fix: delete outdated metrics port assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
bitgorust committed Feb 1, 2024
1 parent 29b0c72 commit d862f16
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -267,23 +265,6 @@ public static void appendRuntimeParameters(Map<String, String> 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<String, String> 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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@ private Map<String, String> 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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,6 @@ private Map<String, String> 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())) {
Expand Down

0 comments on commit d862f16

Please sign in to comment.