Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be/#269 Prometheus + Grafana 연동 #271

Merged
merged 7 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,14 @@ dependencies {
// Redis
implementation 'org.springframework.boot:spring-boot-starter-data-redis:2.3.1.RELEASE'

// Prometheus
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'io.micrometer:micrometer-registry-prometheus'

// LocalDataTime 역직렬화 문제 해결 패키지
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
implementation 'com.fasterxml.jackson.core:jackson-databind'


}

tasks.named('test') {
Expand Down
16 changes: 16 additions & 0 deletions backend/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ spring:
logging:
config: classpath:logback-spring.xml

# Prometheus
management:
endpoints:
web:
exposure:
include: health, info, metrics, prometheus
metrics:
export:
prometheus:
enabled: true
endpoint:
prometheus:
enabled: true
info:
git:
mode: full

# swaggerDOC
springdoc:
Expand Down
9 changes: 9 additions & 0 deletions datasource.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: 1

datasource:
- name: Prometheus
type: prometheus
editable: true
is_default: true
access: proxy
url: http://prometheus:9090
23 changes: 23 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,27 @@ services:
ports:
- "3000:3000"

prometheus:
container_name: prometheus
image: prom/prometheus
ports:
- 9090:9090
volumes:
- ./prometheus:/etc/prometheus
- ./prometheus/data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
depends_on:
- springboot

grafana:
container_name: grafana
image: grafana/grafana
ports:
- 3000:3000
volumes:
- ./grafana:/var/lib/grafana
- ./datasource.yml:/etc/grafana/provisioning/datasource.yml
depends_on:
- prometheus
- springboot
16 changes: 16 additions & 0 deletions prometheus/prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
global:
scrape_interval: 1s
evaluation_interval: 1s

alerting:
alertmanagers:
- static_configs:
- targets:

rule_files:

scrape_configs:
- job_name: "prometheus"
metrics_path: "/actuator/prometheus"
static_configs:
- targets: ["springboot:8080"]
Loading