#35 springboot: prometheus

This commit is contained in:
haerong22
2023-03-23 02:05:41 +09:00
parent 286fb89c2f
commit 3079b463dd
3 changed files with 28 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-actuator' //actuator 추가
implementation 'io.micrometer:micrometer-registry-prometheus'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'

View File

@@ -0,0 +1,21 @@
# docker run -p 9090:9090 -v /path/to/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
rule_files:
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['host.docker.internal:9090']
- job_name: 'actuator'
metrics_path: '/actuator/prometheus'
scrape_interval: 1s
static_configs:
- targets: ['host.docker.internal:8080']

View File

@@ -1,6 +1,6 @@
management:
server:
port: 9292
port: 8080
info:
java:
enabled: true
@@ -29,3 +29,8 @@ logging:
level:
hello.controller: debug
server:
tomcat:
mbeanregistry:
enabled: true