🔥 remove unuse metrics config (#12266)

* degist-concurrency-bugfix

* stytle opt

* fix i++

* revert demo

* fix sonar

* remove apache licence

* add licence

* add testcase&& fix notice

* add notice

* add notice

* add notice

* add notice

* fix ci timeout

* fix ci timeout

* remove testcase because of timeout

* remove testcase because of timeout

* remove testcase because of timeout

* fix ci

* fix sonar

* 🔥 remove metricsPort config

* 🔥 remove metricsPath config

---------

Co-authored-by: wxbty <wxb_101@163.com>
Co-authored-by: x-shadow-man <1494445739@qq.com>
This commit is contained in:
songxiaosheng 2023-05-10 14:10:18 +08:00 committed by GitHub
parent dd44708ae7
commit 75abb01bb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 2 additions and 62 deletions

View File

@ -67,16 +67,6 @@ public class PrometheusConfig implements Serializable {
*/
private String httpServiceDiscoveryUrl;
/**
* When using pull method, which port to expose
*/
private Integer metricsPort;
/**
* When using pull mode, which path to expose metrics
*/
private String metricsPath;
public Boolean getEnabled() {
return enabled;
}
@ -100,22 +90,6 @@ public class PrometheusConfig implements Serializable {
public void setHttpServiceDiscoveryUrl(String httpServiceDiscoveryUrl) {
this.httpServiceDiscoveryUrl = httpServiceDiscoveryUrl;
}
public Integer getMetricsPort() {
return metricsPort;
}
public void setMetricsPort(Integer metricsPort) {
this.metricsPort = metricsPort;
}
public String getMetricsPath() {
return metricsPath;
}
public void setMetricsPath(String metricsPath) {
this.metricsPath = metricsPath;
}
}
public static class Pushgateway implements Serializable {

View File

@ -81,8 +81,6 @@ class MetricsConfigTest {
exporter.setEnabled(true);
exporter.setEnableHttpServiceDiscovery(true);
exporter.setHttpServiceDiscoveryUrl("localhost:8080");
exporter.setMetricsPath("/metrics");
exporter.setMetricsPort(20888);
prometheus.setExporter(exporter);
pushgateway.setEnabled(true);
@ -98,8 +96,6 @@ class MetricsConfigTest {
assertThat(metrics.getPrometheus().getExporter().getEnabled(), equalTo(true));
assertThat(metrics.getPrometheus().getExporter().getEnableHttpServiceDiscovery(), equalTo(true));
assertThat(metrics.getPrometheus().getExporter().getHttpServiceDiscoveryUrl(), equalTo("localhost:8080"));
assertThat(metrics.getPrometheus().getExporter().getMetricsPort(), equalTo(20888));
assertThat(metrics.getPrometheus().getExporter().getMetricsPath(), equalTo("/metrics"));
assertThat(metrics.getPrometheus().getPushgateway().getEnabled(), equalTo(true));
assertThat(metrics.getPrometheus().getPushgateway().getBaseUrl(), equalTo("localhost:9091"));
assertThat(metrics.getPrometheus().getPushgateway().getUsername(), equalTo("username"));

View File

@ -31,15 +31,11 @@ class PrometheusConfigTest {
exporter.setEnabled(true);
exporter.setEnableHttpServiceDiscovery(true);
exporter.setHttpServiceDiscoveryUrl("localhost:8080");
exporter.setMetricsPath("/metrics");
exporter.setMetricsPort(20888);
prometheusConfig.setExporter(exporter);
assertThat(prometheusConfig.getExporter().getEnabled(), equalTo(true));
assertThat(prometheusConfig.getExporter().getEnableHttpServiceDiscovery(), equalTo(true));
assertThat(prometheusConfig.getExporter().getHttpServiceDiscoveryUrl(), equalTo("localhost:8080"));
assertThat(prometheusConfig.getExporter().getMetricsPort(), equalTo(20888));
assertThat(prometheusConfig.getExporter().getMetricsPath(), equalTo("/metrics"));
}
@Test
@ -62,4 +58,4 @@ class PrometheusConfigTest {
assertThat(prometheusConfig.getPushgateway().getJob(), equalTo("job"));
assertThat(prometheusConfig.getPushgateway().getPushInterval(), equalTo(30));
}
}
}

View File

@ -1123,16 +1123,6 @@
<xsd:documentation><![CDATA[ Http service discovery url. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="metrics-port" type="xsd:integer">
<xsd:annotation>
<xsd:documentation><![CDATA[ When using pull method, which port to expose. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="metrics-path" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[ When using pull mode, which path to expose metrics. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="prometheusPushgatewayType">

View File

@ -59,8 +59,6 @@ import static org.apache.dubbo.common.constants.MetricsConstants.PROTOCOL_PROMET
"dubbo.metrics.prometheus.exporter.enabled=true",
"dubbo.metrics.prometheus.exporter.enable-http-service-discovery=true",
"dubbo.metrics.prometheus.exporter.http-service-discovery-url=localhost:8080",
"dubbo.metrics.prometheus.exporter.metrics-port=20888",
"dubbo.metrics.prometheus.exporter.metrics-path=/metrics",
"dubbo.metrics.aggregation.enabled=true",
"dubbo.metrics.aggregation.bucket-num=5",
"dubbo.metrics.aggregation.time-window-seconds=120",
@ -112,8 +110,6 @@ class SpringBootConfigPropsTest {
Assertions.assertTrue(metricsConfig.getPrometheus().getExporter().getEnabled());
Assertions.assertTrue(metricsConfig.getPrometheus().getExporter().getEnableHttpServiceDiscovery());
Assertions.assertEquals("localhost:8080", metricsConfig.getPrometheus().getExporter().getHttpServiceDiscoveryUrl());
Assertions.assertEquals(20888, metricsConfig.getPrometheus().getExporter().getMetricsPort());
Assertions.assertEquals("/metrics", metricsConfig.getPrometheus().getExporter().getMetricsPath());
Assertions.assertEquals(5, metricsConfig.getAggregation().getBucketNum());
Assertions.assertEquals(120, metricsConfig.getAggregation().getTimeWindowSeconds());
Assertions.assertTrue(metricsConfig.getAggregation().getEnabled());

View File

@ -45,8 +45,6 @@ import static org.apache.dubbo.common.constants.MetricsConstants.PROTOCOL_PROMET
"dubbo.metrics.prometheus.exporter.enabled=true",
"dubbo.metrics.prometheus.exporter.enable-http-service-discovery=true",
"dubbo.metrics.prometheus.exporter.http-service-discovery-url=localhost:8080",
"dubbo.metrics.prometheus.exporter.metrics-port=20888",
"dubbo.metrics.prometheus.exporter.metrics-path=/metrics",
"dubbo.metrics.aggregation.enabled=true",
"dubbo.metrics.aggregation.bucket-num=5",
"dubbo.metrics.aggregation.time-window-seconds=120",
@ -86,8 +84,6 @@ public class SpringBootConfigMetricsTest {
Assertions.assertTrue(metricsConfig.getPrometheus().getExporter().getEnabled());
Assertions.assertTrue(metricsConfig.getPrometheus().getExporter().getEnableHttpServiceDiscovery());
Assertions.assertEquals("localhost:8080", metricsConfig.getPrometheus().getExporter().getHttpServiceDiscoveryUrl());
Assertions.assertEquals(20888, metricsConfig.getPrometheus().getExporter().getMetricsPort());
Assertions.assertEquals("/metrics", metricsConfig.getPrometheus().getExporter().getMetricsPath());
Assertions.assertEquals(5, metricsConfig.getAggregation().getBucketNum());
Assertions.assertEquals(120, metricsConfig.getAggregation().getTimeWindowSeconds());
Assertions.assertTrue(metricsConfig.getAggregation().getEnabled());

View File

@ -281,8 +281,6 @@ class DubboNamespaceHandlerTest {
assertEquals(metrics.getPrometheus().getExporter().getEnabled(), true);
assertEquals(metrics.getPrometheus().getExporter().getEnableHttpServiceDiscovery(), true);
assertEquals(metrics.getPrometheus().getExporter().getHttpServiceDiscoveryUrl(), "localhost:8080");
assertEquals(metrics.getPrometheus().getExporter().getMetricsPort(), 20888);
assertEquals(metrics.getPrometheus().getExporter().getMetricsPath(), "/metrics");
assertEquals(metrics.getPrometheus().getPushgateway().getEnabled(), true);
assertEquals(metrics.getPrometheus().getPushgateway().getBaseUrl(), "localhost:9091");
assertEquals(metrics.getPrometheus().getPushgateway().getPushInterval(), 30);
@ -294,8 +292,6 @@ class DubboNamespaceHandlerTest {
assertEquals(metricsBean.getPrometheus().getExporter().getEnabled(), true);
assertEquals(metricsBean.getPrometheus().getExporter().getEnableHttpServiceDiscovery(), true);
assertEquals(metricsBean.getPrometheus().getExporter().getHttpServiceDiscoveryUrl(), "localhost:8080");
assertEquals(metricsBean.getPrometheus().getExporter().getMetricsPort(), 20888);
assertEquals(metricsBean.getPrometheus().getExporter().getMetricsPath(), "/metrics");
assertEquals(metricsBean.getPrometheus().getPushgateway().getEnabled(), true);
assertEquals(metricsBean.getPrometheus().getPushgateway().getBaseUrl(), "localhost:9091");
assertEquals(metricsBean.getPrometheus().getPushgateway().getPushInterval(), 30);

View File

@ -25,7 +25,7 @@
<dubbo:application name="demo-consumer" />
<dubbo:metrics protocol="prometheus">
<dubbo:prometheus-exporter enabled="true" enable-http-service-discovery="true" http-service-discovery-url="localhost:8080" metrics-port="20888" metrics-path="/metrics" />
<dubbo:prometheus-exporter enabled="true" enable-http-service-discovery="true" http-service-discovery-url="localhost:8080" />
<dubbo:prometheus-pushgateway enabled="true" base-url="localhost:9091" push-interval="30" username="username" password="password" job="job" />
</dubbo:metrics>

View File

@ -89,8 +89,6 @@ class PrometheusMetricsReporterTest {
// NetUtils.getAvailablePort();
PrometheusConfig prometheusConfig = new PrometheusConfig();
PrometheusConfig.Exporter exporter = new PrometheusConfig.Exporter();
exporter.setMetricsPort(port);
exporter.setMetricsPath("/metrics");
exporter.setEnabled(true);
prometheusConfig.setExporter(exporter);
metricsConfig.setPrometheus(prometheusConfig);

View File

@ -85,9 +85,7 @@ public class PrometheusMetricsThreadPoolTest {
int port = 30899;
PrometheusConfig prometheusConfig = new PrometheusConfig();
PrometheusConfig.Exporter exporter = new PrometheusConfig.Exporter();
exporter.setMetricsPort(port);
exporter.setEnabled(true);
exporter.setMetricsPath("/metrics");
prometheusConfig.setExporter(exporter);
metricsConfig.setPrometheus(prometheusConfig);