-
Notifications
You must be signed in to change notification settings - Fork 0
[FEATURE] Prometheus/Grafana 환경 추가 #30
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
Changes from all commits
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,33 @@ | ||
| services: | ||
| prometheus: | ||
| user: ${PROMETHEUS_USER} | ||
| image: prom/prometheus:latest | ||
| container_name: prometheus | ||
| volumes: | ||
| - /home/ubuntu/dearbelly/deployment/prometheus.yml:/etc/prometheus/prometheus.yml:ro | ||
| - /home/ubuntu/prometheus/volume:/prometheus/data | ||
|
Comment on lines
+7
to
+8
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. |
||
| ports: | ||
| - 9090:9090 | ||
| command: | ||
| - '--web.enable-lifecycle' | ||
| - '--config.file=/etc/prometheus/prometheus.yml' | ||
| - '--storage.tsdb.retention.time=15d' | ||
| restart: always | ||
| networks: | ||
| - mynetwork | ||
|
|
||
| grafana: | ||
| user: ${GRAFANA_USER} | ||
| image: grafana/grafana:latest | ||
|
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. |
||
| container_name: grafana | ||
| ports: | ||
| - 3000:3000 | ||
| volumes: | ||
| - /home/ubuntu/grafana/volume:/var/lib/grafana | ||
|
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. |
||
| restart: always | ||
| networks: | ||
| - mynetwork | ||
|
|
||
| networks: | ||
| mynetwork: | ||
| driver: bridge | ||
|
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. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| groups: | ||
| - name: example | ||
|
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. |
||
| rules: | ||
| - alert: InstanceDown | ||
| expr: up == 0 | ||
| for: 5m | ||
| labels: | ||
| severity: page | ||
| annotations: | ||
| summary: "Instance {{ $labels.instance }} down" | ||
| description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes." | ||
| - alert: APIHighRequestLatency | ||
| expr: api_http_request_latencies_second{quantile="0.5"} > 1 | ||
|
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.
expr: histogram_quantile(0.5, sum(rate(http_requests_latency_seconds_bucket[5m])) by (le, job, instance)) > 1 |
||
| for: 10m | ||
| annotations: | ||
| summary: "High request latency on {{ $labels.instance }}" | ||
| description: "{{ $labels.instance }} has a median request latency above 1s (current value: {{ $value }}s)" | ||
|
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. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| global: | ||
| scrape_interval: 15s | ||
| scrape_timeout: 15s | ||
| evaluation_interval: 2m | ||
| external_labels: | ||
| monitor: 'codelab-monitor' | ||
| query_log_file: query_log_file.log | ||
|
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. |
||
| rule_files: | ||
| - "prometheus-rule.yml" | ||
|
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. |
||
| scrape_configs: | ||
| - job_name: 'prometheus' | ||
| scrape_interval: 10s | ||
| scrape_timeout: 10s | ||
| metrics_path: '/metrics' | ||
| honor_labels: false | ||
| honor_timestamps: false | ||
| scheme: 'http' | ||
| static_configs: | ||
| - targets: ['${REMOTE_HOST}:9090'] | ||
| labels: | ||
| service: 'monitor-1' | ||
| - job_name: 'node' | ||
| static_configs: | ||
| - targets: ['${REMOTE_HOST}:9090'] | ||
|
Comment on lines
+22
to
+24
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. |
||
| - job_name: 'fastapi-actuator-blue' | ||
| metrics_path: '/actuator/prometheus' | ||
| scrape_interval: 1m | ||
| static_configs: | ||
| - targets: [ 'app-blue:8000' ] | ||
| - job_name: 'fastapi-actuator-green' | ||
| metrics_path: '/actuator/prometheus' | ||
| scrape_interval: 1m | ||
| static_configs: | ||
| - targets: [ 'app-green:8001' ] | ||
|
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. 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. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,4 +10,6 @@ Pillow==11.3.0 | |
| dotenv | ||
| openai | ||
| timm | ||
| logging | ||
| logging | ||
| prometheus-client==0.19.0 | ||
| prometheus-fastapi-instrumentator==6.1.0 | ||
|
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. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker 이미지에
:latest태그를 사용하는 것은 예기치 않은 버전 업데이트로 인한 장애를 유발할 수 있습니다. 프로덕션 환경에서는 특정 버전을 명시하여 안정성을 확보하는 것이 좋습니다. 예를 들어prom/prometheus:v2.51.2와 같이 구체적인 버전을 사용해주세요.