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) - [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) - [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) - [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> <groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-tencent-dependencies</artifactId> <artifactId>spring-cloud-tencent-dependencies</artifactId>
<!--version number--> <!--version number-->
<version>${version}</version> <version>1.7.0-Hoxton.SR12</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>

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

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

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

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

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

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

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

@ -61,6 +61,14 @@ public class StatConfigModifier implements PolarisConfigModifier {
configuration.getGlobal().getStatReporter() configuration.getGlobal().getStatReporter()
.setPluginConfig(DEFAULT_REPORTER_PROMETHEUS, prometheusHandlerConfig); .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 @Override

Loading…
Cancel
Save