Skip to content

Commit c929265

Browse files
authored
fix: 프로메테우스 수집 타겟 포트 오설정 수정 및 서버 역할별 수집 최적화 (#213)
* fix: 프로메테우스 수집 타겟 포트 오설정 수정 및 서버 역할별 수집 최적화
1 parent abd6225 commit c929265

1 file changed

Lines changed: 25 additions & 11 deletions

File tree

prometheus-grafana/prometheus/config/prometheus.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ global:
66
monitor: 'trainus-monitor'
77

88
scrape_configs:
9-
# 프로메테우스 모니터링
9+
# 프로메테우스 자기 자신 모니터링
1010
- job_name: 'prometheus'
1111
static_configs:
1212
- targets: ['localhost:9090']
@@ -19,28 +19,42 @@ scrape_configs:
1919
labels:
2020
env: 'local'
2121

22-
# AWS 오토스케일링 환경 (오토스케일링 그룹 내 자동 수집)
23-
- job_name: 'spring-boot-app-aws'
22+
# API 서버 수집
23+
- job_name: 'trainus-api-apps'
2424
metrics_path: '/actuator/prometheus'
25-
26-
# AWS EC2 Service Discovery 설정
2725
ec2_sd_configs:
2826
- region: ap-northeast-2
2927
port: 8082
28+
relabel_configs:
29+
# 'Name' 태그가 'TrainUs-Api'로 시작하는 인스턴스
30+
- source_labels: [__meta_ec2_tag_Name]
31+
regex: TrainUs-Api.*
32+
action: keep
33+
34+
# 그라파나 대시보드용 라벨 추가
35+
- source_labels: [__meta_ec2_instance_id]
36+
target_label: instance_id
37+
- target_label: env
38+
replacement: 'production'
39+
- target_label: role
40+
replacement: 'api'
41+
42+
# Consumer 서버 수집
43+
- job_name: 'trainus-consumer-apps'
44+
metrics_path: '/actuator/prometheus'
45+
ec2_sd_configs:
3046
- region: ap-northeast-2
3147
port: 8083
32-
33-
# 필터링 및 라벨 재구성
3448
relabel_configs:
35-
# 'Name' 태그가 'TrainUs-App'으로 시작하는 인스턴스만 수집
49+
# 'Name' 태그가 'TrainUs-Consumer'로 시작하는 인스턴스
3650
- source_labels: [__meta_ec2_tag_Name]
37-
regex: TrainUs-App.*
51+
regex: TrainUs-Consumer.*
3852
action: keep
3953

4054
# 그라파나 대시보드용 라벨 추가
4155
- source_labels: [__meta_ec2_instance_id]
4256
target_label: instance_id
43-
- source_labels: [__meta_ec2_private_ip]
44-
target_label: private_ip
4557
- target_label: env
4658
replacement: 'production'
59+
- target_label: role
60+
replacement: 'consumer'

0 commit comments

Comments
 (0)