-
Notifications
You must be signed in to change notification settings - Fork 1
[Feature] Prometheus + Grafana 모니터링 시스템 구축 #138
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
base: develop
Are you sure you want to change the base?
Changes from all commits
81d4fb3
212a2a3
8d72446
d2ec41c
f0b5b4b
3c918a6
b900456
2e2eae9
fd61eaa
685e0e6
f4a9448
04b468b
0956988
38658ad
25d324e
e83ba64
21b929b
4a0d26b
79af7e7
8426379
4ea8266
2b619ca
630c9b4
c0d1397
1a4c61c
438c506
1154c99
18ca48b
f34c007
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,53 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| services: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| prometheus: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| image: prom/prometheus:v3.5.1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| container_name: cherrish-prometheus | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "9090:9090" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| volumes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - ./monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - prometheus_data:/prometheus | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| command: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - '--config.file=/etc/prometheus/prometheus.yml' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - '--storage.tsdb.path=/prometheus' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - '--storage.tsdb.retention.time=15d' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - '--web.enable-lifecycle' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| healthcheck: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9090/-/healthy"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| interval: 10s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| timeout: 5s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| retries: 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| start_period: 10s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| extra_hosts: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "host.docker.internal:host-gateway" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| networks: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - monitoring | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| restart: unless-stopped | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial 프로덕션 안정성을 위해 리소스 제한 추가를 권장합니다. Prometheus 컨테이너에 메모리/CPU 제한이 없으면, 메트릭 데이터 증가 시 호스트 리소스를 과도하게 사용할 수 있습니다. 특히 15일 retention과 함께 사용하면 메모리 사용량이 점진적으로 증가할 수 있습니다. ♻️ 리소스 제한 추가 예시 prometheus:
image: prom/prometheus:v3.5.1
container_name: cherrish-prometheus
+ deploy:
+ resources:
+ limits:
+ memory: 2G
+ cpus: '1.0'
+ reservations:
+ memory: 512M
ports:
- "9090:9090"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| grafana: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| image: grafana/grafana:11.6.9 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| container_name: cherrish-grafana | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "3000:3000" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| environment: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - GF_SECURITY_ADMIN_USER=admin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Kimgyuilli marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - GF_USERS_ALLOW_SIGN_UP=false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - DISCORD_MONITORING_WEBHOOK_URL=${DISCORD_MONITORING_WEBHOOK_URL} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| volumes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - ./monitoring/grafana/provisioning:/etc/grafana/provisioning | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - grafana_data:/var/lib/grafana | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| networks: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - monitoring | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| depends_on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| prometheus: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| condition: service_healthy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| restart: unless-stopped | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+27
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Grafana 컨테이너에도 리소스 제한 추가를 권장합니다. Grafana도 대시보드 복잡도와 동시 사용자 수에 따라 리소스 사용량이 증가할 수 있습니다. ♻️ 리소스 제한 추가 예시 grafana:
image: grafana/grafana:11.6.9
container_name: cherrish-grafana
+ deploy:
+ resources:
+ limits:
+ memory: 512M
+ cpus: '0.5'
+ reservations:
+ memory: 128M
ports:
- "3000:3000"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| volumes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| prometheus_data: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| grafana_data: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| networks: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| monitoring: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| driver: bridge | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| apiVersion: 1 | ||
|
|
||
| contactPoints: | ||
| - orgId: 1 | ||
| name: discord-monitoring | ||
| receivers: | ||
| - uid: discord-monitoring | ||
| type: discord | ||
| settings: | ||
| url: ${DISCORD_MONITORING_WEBHOOK_URL} | ||
| use_discord_username: true | ||
| avatar_url: "https://grafana.com/static/assets/img/fav32.png" | ||
| title: '{{ if eq .Status "firing" }}:rotating_light: ALERT{{ else }}:white_check_mark: RESOLVED{{ end }} ({{ len .Alerts }} alerts)' | ||
| message: | | ||
| {{ range .Alerts }} | ||
| {{ if eq $.Status "firing" }}:red_circle:{{ else }}:green_circle:{{ end }} **{{ .Labels.rulename }}** | ||
| :warning: **Severity:** {{ .Labels.severity | toUpper }} | ||
| :clipboard: **Summary:** {{ .Annotations.summary }} | ||
| :memo: **Detail:** {{ .Annotations.description }} | ||
| :link: **View:** {{ .GeneratorURL }} | ||
|
|
||
| {{ end }} | ||
| disableResolveMessage: false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| apiVersion: 1 | ||
|
|
||
| policies: | ||
| - orgId: 1 | ||
| receiver: discord-monitoring | ||
| group_by: | ||
| - grafana_folder | ||
| group_wait: 60s | ||
| group_interval: 5m | ||
| repeat_interval: 4h | ||
Kimgyuilli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| apiVersion: 1 | ||
|
|
||
| groups: | ||
| - orgId: 1 | ||
| name: cherrish-alerts | ||
| folder: Cherrish | ||
| interval: 1m | ||
Kimgyuilli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| rules: | ||
| - uid: high-error-rate | ||
| title: High Error Rate | ||
| condition: C | ||
| data: | ||
| - refId: A | ||
| relativeTimeRange: | ||
| from: 300 | ||
| to: 0 | ||
| datasourceUid: prometheus | ||
| model: | ||
| expr: sum(rate(http_server_requests_seconds_count{application="cherrish", status=~"5.."}[5m])) or vector(0) | ||
| intervalMs: 1000 | ||
| maxDataPoints: 43200 | ||
| refId: A | ||
| - refId: B | ||
| relativeTimeRange: | ||
| from: 300 | ||
| to: 0 | ||
| datasourceUid: prometheus | ||
| model: | ||
| expr: sum(rate(http_server_requests_seconds_count{application="cherrish"}[5m])) or vector(1) | ||
| intervalMs: 1000 | ||
| maxDataPoints: 43200 | ||
| refId: B | ||
| - refId: C | ||
| relativeTimeRange: | ||
| from: 300 | ||
| to: 0 | ||
| datasourceUid: __expr__ | ||
| model: | ||
| conditions: | ||
| - evaluator: | ||
| params: | ||
| - 0.05 | ||
| type: gt | ||
| operator: | ||
| type: and | ||
| query: | ||
| params: | ||
| - C | ||
| reducer: | ||
| type: last | ||
| expression: $A / $B | ||
| intervalMs: 1000 | ||
| maxDataPoints: 43200 | ||
| refId: C | ||
| type: math | ||
| noDataState: NoData | ||
| execErrState: Error | ||
| for: 2m | ||
| annotations: | ||
| summary: "High error rate detected on Cherrish Server" | ||
| description: "Error rate is above 5% for the last 2 minutes" | ||
| labels: | ||
| severity: critical | ||
| rulename: "High Error Rate" | ||
| isPaused: false | ||
|
|
||
| - uid: high-latency | ||
| title: High Latency (P95) | ||
| condition: B | ||
| data: | ||
| - refId: A | ||
| relativeTimeRange: | ||
| from: 300 | ||
| to: 0 | ||
| datasourceUid: prometheus | ||
| model: | ||
| expr: histogram_quantile(0.95, sum(rate(http_server_requests_seconds_bucket{application="cherrish"}[5m])) by (le)) | ||
| intervalMs: 1000 | ||
| maxDataPoints: 43200 | ||
| refId: A | ||
| - refId: B | ||
| relativeTimeRange: | ||
| from: 300 | ||
| to: 0 | ||
| datasourceUid: __expr__ | ||
| model: | ||
| conditions: | ||
| - evaluator: | ||
| params: | ||
| - 1 | ||
| type: gt | ||
| operator: | ||
| type: and | ||
| query: | ||
| params: | ||
| - B | ||
| reducer: | ||
| type: last | ||
| expression: A | ||
| intervalMs: 1000 | ||
| maxDataPoints: 43200 | ||
| refId: B | ||
| type: threshold | ||
| noDataState: NoData | ||
| execErrState: Error | ||
| for: 5m | ||
| annotations: | ||
| summary: "High latency detected on Cherrish Server" | ||
| description: "P95 response time is above 1 second for the last 5 minutes" | ||
| labels: | ||
| severity: warning | ||
| rulename: "High Latency (P95)" | ||
| isPaused: false | ||
|
|
||
| - uid: metrics-collection-health | ||
| title: Metrics Collection Down | ||
| condition: B | ||
| data: | ||
| - refId: A | ||
| relativeTimeRange: | ||
| from: 300 | ||
| to: 0 | ||
| datasourceUid: prometheus | ||
| model: | ||
| expr: up{job="cherrish-server"} | ||
| intervalMs: 1000 | ||
| maxDataPoints: 43200 | ||
| refId: A | ||
| - refId: B | ||
| relativeTimeRange: | ||
| from: 300 | ||
| to: 0 | ||
| datasourceUid: __expr__ | ||
| model: | ||
| conditions: | ||
| - evaluator: | ||
| params: | ||
| - 1 | ||
| type: lt | ||
| operator: | ||
| type: and | ||
| query: | ||
| params: | ||
| - B | ||
| reducer: | ||
| type: last | ||
| expression: A | ||
| intervalMs: 1000 | ||
| maxDataPoints: 43200 | ||
| refId: B | ||
| type: threshold | ||
| noDataState: NoData | ||
| execErrState: Error | ||
| for: 2m | ||
| annotations: | ||
| summary: "Cherrish Server metrics collection is down" | ||
| description: "Prometheus cannot scrape metrics from Cherrish Server. The application may be down or unreachable." | ||
| labels: | ||
| severity: critical | ||
| rulename: "Metrics Collection Down" | ||
| isPaused: false | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| apiVersion: 1 | ||
|
|
||
| providers: | ||
| - name: 'Cherrish Dashboards' | ||
| orgId: 1 | ||
| folder: 'Cherrish' | ||
| type: file | ||
| disableDeletion: true | ||
| updateIntervalSeconds: 120 | ||
| options: | ||
| path: /etc/grafana/provisioning/dashboards/json | ||
Kimgyuilli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.