From 59f1152871093b41b71cd94f091ba411272b9f2b Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Thu, 26 Dec 2019 01:49:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20prometheus=20=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + lab-36/lab-36-prometheus-demo/pom.xml | 35 +++++++++++++++++++ .../lab36/prometheusdemo/Application.java | 13 +++++++ .../src/main/resources/application.yaml | 14 ++++++++ lab-36/pom.xml | 19 ++++++++++ pom.xml | 1 + 6 files changed, 83 insertions(+) create mode 100644 lab-36/lab-36-prometheus-demo/pom.xml create mode 100644 lab-36/lab-36-prometheus-demo/src/main/java/cn/iocoder/springboot/lab36/prometheusdemo/Application.java create mode 100644 lab-36/lab-36-prometheus-demo/src/main/resources/application.yaml create mode 100644 lab-36/pom.xml diff --git a/README.md b/README.md index 88944446..bac66881 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ * [《芋道 Spring Boot Dubbo 入门》](http://www.iocoder.cn/Spring-Boot/Dubbo/?github) 对应 [lab-30](https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-30) 。 * 《芋道 Spring Boot Motan 入门》计划中... +* 《芋道 Spring Boot WebService 入门》计划中... * 《芋道 Spring Boot SOFARPC 入门》计划中... * 《芋道 Spring Boot gRPC 入门》计划中... * 《芋道 Spring Boot RSocket 入门》计划中... diff --git a/lab-36/lab-36-prometheus-demo/pom.xml b/lab-36/lab-36-prometheus-demo/pom.xml new file mode 100644 index 00000000..db2a7271 --- /dev/null +++ b/lab-36/lab-36-prometheus-demo/pom.xml @@ -0,0 +1,35 @@ + + + + org.springframework.boot + spring-boot-starter-parent + 2.2.2.RELEASE + + + 4.0.0 + + lab-36-prometheus-demo + + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + io.micrometer + micrometer-registry-prometheus + + + + diff --git a/lab-36/lab-36-prometheus-demo/src/main/java/cn/iocoder/springboot/lab36/prometheusdemo/Application.java b/lab-36/lab-36-prometheus-demo/src/main/java/cn/iocoder/springboot/lab36/prometheusdemo/Application.java new file mode 100644 index 00000000..5f359782 --- /dev/null +++ b/lab-36/lab-36-prometheus-demo/src/main/java/cn/iocoder/springboot/lab36/prometheusdemo/Application.java @@ -0,0 +1,13 @@ +package cn.iocoder.springboot.lab36.prometheusdemo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/lab-36/lab-36-prometheus-demo/src/main/resources/application.yaml b/lab-36/lab-36-prometheus-demo/src/main/resources/application.yaml new file mode 100644 index 00000000..a9e3cfda --- /dev/null +++ b/lab-36/lab-36-prometheus-demo/src/main/resources/application.yaml @@ -0,0 +1,14 @@ +spring: + application: + name: demo-application # 应用名 + +management: + endpoints: + # Actuator HTTP 配置项,对应 WebEndpointProperties 配置类 + web: + exposure: + include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 + + metrics: + tags: # 通用标签 + application: ${spring.application.name} diff --git a/lab-36/pom.xml b/lab-36/pom.xml new file mode 100644 index 00000000..67cebb44 --- /dev/null +++ b/lab-36/pom.xml @@ -0,0 +1,19 @@ + + + + labs-parent + cn.iocoder.springboot.labs + 1.0-SNAPSHOT + + 4.0.0 + + lab-36 + pom + + lab-36-prometheus-demo + + + + diff --git a/pom.xml b/pom.xml index 700345aa..8fb37919 100644 --- a/pom.xml +++ b/pom.xml @@ -44,6 +44,7 @@ lab-33 lab-34 lab-35 + lab-36