Commit c6f43e35 by 姜海波

prometheus 监控增加

parent 9029c5e9
...@@ -327,6 +327,13 @@ ...@@ -327,6 +327,13 @@
<artifactId>apm-toolkit-logback-1.x</artifactId> <artifactId>apm-toolkit-logback-1.x</artifactId>
</dependency> </dependency>
<!-- promtheus -->
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_spring_boot</artifactId>
<version>0.6.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
......
...@@ -15,6 +15,8 @@ package cn.freemud; ...@@ -15,6 +15,8 @@ package cn.freemud;
import cn.freemud.core.db.DataSourcesConfig; import cn.freemud.core.db.DataSourcesConfig;
import com.freemud.application.sdk.api.log.LogThreadLocal; import com.freemud.application.sdk.api.log.LogThreadLocal;
import feign.RequestInterceptor; import feign.RequestInterceptor;
import io.prometheus.client.spring.boot.EnablePrometheusEndpoint;
import io.prometheus.client.spring.boot.EnableSpringBootMetricsCollector;
import org.jasypt.encryption.StringEncryptor; import org.jasypt.encryption.StringEncryptor;
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor; import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig; import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
...@@ -43,6 +45,8 @@ import tk.mybatis.spring.annotation.MapperScan; ...@@ -43,6 +45,8 @@ import tk.mybatis.spring.annotation.MapperScan;
@MapperScan({"cn.freemud.*.dao","com.freemud.sdk.api.assortment.orderdistributor.mapper","com.freemud.api.assortment.datamanager.manager", @MapperScan({"cn.freemud.*.dao","com.freemud.sdk.api.assortment.orderdistributor.mapper","com.freemud.api.assortment.datamanager.manager",
"com.freemud.api.assortment.datamanager.queue.dao","com.freemud.api.assortment.datamanager.rbac.dao","com.freemud.api.assortment.datamanager.queue.entity"}) "com.freemud.api.assortment.datamanager.queue.dao","com.freemud.api.assortment.datamanager.rbac.dao","com.freemud.api.assortment.datamanager.queue.entity"})
@EnableFeignClients({"cn.freemud.service.thirdparty","com.freemud.sdk.api.assortment.message"}) @EnableFeignClients({"cn.freemud.service.thirdparty","com.freemud.sdk.api.assortment.message"})
@EnablePrometheusEndpoint
@EnableSpringBootMetricsCollector
@EnableAutoConfiguration @EnableAutoConfiguration
public class OrderApplication { public class OrderApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -13,3 +13,14 @@ apollo.bootstrap.namespaces=micro_progeram_commons,order_service ...@@ -13,3 +13,14 @@ apollo.bootstrap.namespaces=micro_progeram_commons,order_service
eureka.client.enabled=false eureka.client.enabled=false
#-Dapollo.configService=http://172.81.231.147 #-Dapollo.configService=http://172.81.231.147
endpoints.metrics.enabled=true
endpoints.health.sensitive=false
endpoints.health.enabled=true
management.endpoint.health.show-details=always
management.endpoints.web.base-path=/
management.endpoints.web.exposure.include=prometheus,info,health,shutdown
management.metrics.tags.application=${spring.application.name}
management.endpoint.shutdown.enabled=true
management.security.enabled=false
management.health.rabbit.enabled=false
\ No newline at end of file
...@@ -290,6 +290,24 @@ ...@@ -290,6 +290,24 @@
<groupId>org.apache.skywalking</groupId> <groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-logback-1.x</artifactId> <artifactId>apm-toolkit-logback-1.x</artifactId>
</dependency> </dependency>
<!-- promtheus -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-spring-legacy</artifactId>
</dependency>
<!-- promtheus -->
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_spring_boot</artifactId>
<version>0.6.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
......
...@@ -15,6 +15,8 @@ package cn.freemud; ...@@ -15,6 +15,8 @@ package cn.freemud;
import cn.freemud.core.db.DataSourcesConfig; import cn.freemud.core.db.DataSourcesConfig;
import com.freemud.application.sdk.api.log.LogThreadLocal; import com.freemud.application.sdk.api.log.LogThreadLocal;
import feign.RequestInterceptor; import feign.RequestInterceptor;
import io.prometheus.client.spring.boot.EnablePrometheusEndpoint;
import io.prometheus.client.spring.boot.EnableSpringBootMetricsCollector;
import org.jasypt.encryption.StringEncryptor; import org.jasypt.encryption.StringEncryptor;
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor; import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig; import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
...@@ -46,6 +48,8 @@ import tk.mybatis.spring.annotation.MapperScan; ...@@ -46,6 +48,8 @@ import tk.mybatis.spring.annotation.MapperScan;
"com.freemud.api.assortment.datamanager.manager"}) "com.freemud.api.assortment.datamanager.manager"})
@EnableFeignClients @EnableFeignClients
@EnableAsync @EnableAsync
@EnablePrometheusEndpoint
@EnableSpringBootMetricsCollector
public class ShoppingCartApplication { public class ShoppingCartApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(ShoppingCartApplication.class, args); SpringApplication.run(ShoppingCartApplication.class, args);
......
...@@ -11,8 +11,16 @@ apollo.cluster=local ...@@ -11,8 +11,16 @@ apollo.cluster=local
apollo.bootstrap.enabled=true apollo.bootstrap.enabled=true
apollo.bootstrap.namespaces=micro_progeram_commons,shopping_cart apollo.bootstrap.namespaces=micro_progeram_commons,shopping_cart
management.endpoints.web.exposure.include=health,info,env,metrics,prometheus
management.health.rabbit.enabled=false endpoints.metrics.enabled=true
management.endpoints.web.base-path=/ endpoints.health.sensitive=false
endpoints.health.enabled=true
management.endpoint.health.show-details=always management.endpoint.health.show-details=always
management.endpoints.web.base-path=/
management.endpoints.web.exposure.include=prometheus,info,health,shutdown
management.metrics.tags.application=${spring.application.name} management.metrics.tags.application=${spring.application.name}
management.endpoint.shutdown.enabled=true
management.security.enabled=false
management.health.rabbit.enabled=false
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment