feat:optimize pushgateway plugin. (#530)

pull/535/head
Haotian Zhang 2 years ago committed by GitHub
parent c536c26d95
commit 0d894b6096
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -15,3 +15,4 @@
- [BugfixBeanFactoryUtils returns all beans including beans defined in ancestor bean factories](https://github.com/Tencent/spring-cloud-tencent/pull/515)
- [fix:fix only config file metadata can be used in routing bug.](https://github.com/Tencent/spring-cloud-tencent/pull/518)
- [optimizeoptimize config module code](https://github.com/Tencent/spring-cloud-tencent/pull/520)
- [feat:optimize pushgateway plugin.](https://github.com/Tencent/spring-cloud-tencent/pull/530)

@ -70,7 +70,7 @@ Spring Cloud Tencent 所有组件都已上传到 Maven 中央仓库,只需要
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-tencent-dependencies</artifactId>
<!--version number-->
<version>${version}</version>
<version>1.7.0-Hoxton.SR12</version>
<type>pom</type>
<scope>import</scope>
</dependency>

@ -72,7 +72,7 @@ For example:
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-tencent-dependencies</artifactId>
<!--version number-->
<version>${version}</version>
<version>1.7.0-Hoxton.SR12</version>
<type>pom</type>
<scope>import</scope>
</dependency>

@ -88,7 +88,7 @@
<properties>
<!-- Project revision -->
<revision>1.8.0-Hoxton.SR12-SNAPSHOT</revision>
<revision>1.7.1-Hoxton.SR12-SNAPSHOT</revision>
<!-- Spring Cloud -->
<spring.cloud.version>Hoxton.SR12</spring.cloud.version>

@ -78,7 +78,12 @@
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-tencent-gateway-plugin</artifactId>
</dependency>
</dependencies>
<dependency>
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-tencent-pushgateway-plugin</artifactId>
</dependency>
</dependencies>
<build>
<plugins>

@ -70,8 +70,8 @@
</developers>
<properties>
<revision>1.8.0-Hoxton.SR12-SNAPSHOT</revision>
<polaris.version>1.7.2</polaris.version>
<revision>1.7.1-Hoxton.SR12-SNAPSHOT</revision>
<polaris.version>1.7.3</polaris.version>
<logback.version>1.2.11</logback.version>
<mocktio.version>4.5.1</mocktio.version>
<byte-buddy.version>1.12.10</byte-buddy.version>
@ -79,6 +79,7 @@
<protobuf-java.version>3.16.1</protobuf-java.version>
<bcprov-jdk15on.version>1.69</bcprov-jdk15on.version>
<guava.version>31.0.1-jre</guava.version>
<prometheus.version>0.11.0</prometheus.version>
<!-- Maven Plugin Versions -->
<maven-source-plugin.version>3.2.0</maven-source-plugin.version>
@ -260,9 +261,9 @@
</dependency>
<dependency>
<groupId>com.tencent.polaris</groupId>
<artifactId>stat-pushgateway</artifactId>
<version>${polaris.version}</version>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_pushgateway</artifactId>
<version>${prometheus.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

@ -14,9 +14,9 @@ spring:
stat:
enabled: true
port: 28082
pushgateway:
enabled: true
address: 127.0.0.1:9091
# pushgateway:
# enabled: true
# address: 127.0.0.1:9091
tencent:
metadata:
content:

@ -18,9 +18,9 @@ spring:
stat:
enabled: true
port: 28081
pushgateway:
enabled: true
address: 127.0.0.1
# pushgateway:
# enabled: true
# address: 127.0.0.1:9091
# consul:
# port: 8500
# host: 127.0.0.1

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>spring-cloud-tencent-plugin-starters</artifactId>
@ -17,15 +17,15 @@
<groupId>com.tencent.polaris</groupId>
<artifactId>stat-pushgateway</artifactId>
</dependency>
<dependency>
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-tencent-polaris-context</artifactId>
</dependency>
<dependency>
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-tencent-polaris-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</dependencies>
</project>

@ -61,6 +61,14 @@ public class StatConfigModifier implements PolarisConfigModifier {
configuration.getGlobal().getStatReporter()
.setPluginConfig(DEFAULT_REPORTER_PROMETHEUS, prometheusHandlerConfig);
}
else {
PrometheusHandlerConfig prometheusHandlerConfig = configuration.getGlobal().getStatReporter()
.getPluginConfig(DEFAULT_REPORTER_PROMETHEUS, PrometheusHandlerConfig.class);
// Set port to -1 to disable stat plugin.
prometheusHandlerConfig.setPort(-1);
configuration.getGlobal().getStatReporter()
.setPluginConfig(DEFAULT_REPORTER_PROMETHEUS, prometheusHandlerConfig);
}
}
@Override

Loading…
Cancel
Save