Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #13684: delete outdated metrics port assertions #13717

Merged
merged 2 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number Diff line number Diff line change
Expand Up @@ -1103,12 +1103,6 @@
</xsd:annotation>
</xsd:attribute>

<xsd:attribute name="port" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[ Deprecated. No longer use. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>

<xsd:attribute name="enable-rpc" type="xsd:boolean" default="true">
<xsd:annotation>
<xsd:documentation><![CDATA[ Enable record rpc metrics. ]]></xsd:documentation>
Expand Down
Loading