Conversation
Summary of ChangesHello @youyeon11, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 GPU 환경에서 애플리케이션의 성능과 상태를 모니터링하기 위한 기반을 마련합니다. Prometheus와 Grafana를 통합하여 FastAPI 애플리케이션의 메트릭을 수집하고 시각화할 수 있도록 하며, 이를 통해 시스템의 안정성과 운영 효율성을 향상시키는 것을 목표로 합니다. Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🤖 Gemini 코드 리뷰 결과네, 시니어 개발자로서 제출된 PR에 대한 코드 리뷰를 작성하겠습니다. 안녕하세요, [동료 개발자 이름]님. Prometheus/Grafana 모니터링 환경을 추가하는 PR 잘 확인했습니다. 우리 서비스의 관측 가능성(Observability)을 높이는 중요한 첫걸음이네요! 전체적으로 모니터링 스택의 기본 구조를 잘 구성해 주셨습니다. 몇 가지 개선점을 더하면 앞으로 더 안정적이고 확장성 있게 운영할 수 있을 것 같아 아래와 같이 피드백을 정리했습니다. 1) PR 의도 요약이 PR은 GPU 기반 서비스 환경의 안정성과 성능을 지속적으로 추적하기 위해 모니터링 시스템을 도입하는 것을 목표로 합니다. FastAPI 애플리케이션에 2) 전반적 평가 (품질/가독성/테스트/아키텍처)
3) 우선순위별 피드백 목록[P1] Prometheus 알림 규칙(Rule) 표현식 오류
[P2] Docker Compose 내 호스트 경로 하드코딩
[P2] 비효율적인 서비스 디스커버리 방식
[P3] Prometheus Scrape Job 설정 중복
[P3] 환경 변수 관리 방안 부재
[P4] Docker 네트워크 이름 구체화 제안
다시 한번 좋은 작업에 감사드립니다. 위에 제안된 내용들을 검토해 보시고 궁금한 점이 있다면 언제든지 편하게 이야기 나눠요 |
| monitor: 'codelab-monitor' | ||
| query_log_file: query_log_file.log | ||
| rule_files: | ||
| - "prometheus-rule.yml" |
There was a problem hiding this comment.
| 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.
prometheus-fastapi-instrumentator 라이브러리는 기본적으로 Histogram 타입의 http_requests_latency_seconds 메트릭을 생성합니다. 현재 사용된 api_http_request_latencies_second{quantile="0.5"} 표현식은 Summary 타입의 메트릭을 위한 것이므로, 이 경고 규칙은 동작하지 않습니다. Histogram 메트릭에서 분위수(quantile)를 계산하려면 histogram_quantile 함수를 사용해야 합니다. 또한 메트릭 이름도 http_requests_latency_seconds로 수정이 필요해 보입니다.
expr: histogram_quantile(0.5, sum(rate(http_requests_latency_seconds_bucket[5m])) by (le, job, instance)) > 1| metrics_path: '/actuator/prometheus' | ||
| scrape_interval: 1m | ||
| static_configs: | ||
| - targets: [ 'app-green:8001' ] No newline at end of file |
| - /home/ubuntu/dearbelly/deployment/prometheus.yml:/etc/prometheus/prometheus.yml:ro | ||
| - /home/ubuntu/prometheus/volume:/prometheus/data |
There was a problem hiding this comment.
|
|
||
| grafana: | ||
| user: ${GRAFANA_USER} | ||
| image: grafana/grafana:latest |
| metrics_path: '/actuator/prometheus' | ||
| scrape_interval: 1m | ||
| static_configs: | ||
| - targets: [ 'app-green:8001' ] No newline at end of file |
| evaluation_interval: 2m | ||
| external_labels: | ||
| monitor: 'codelab-monitor' | ||
| query_log_file: query_log_file.log |
| @@ -0,0 +1,17 @@ | |||
| groups: | |||
| - name: example | |||
| for: 10m | ||
| annotations: | ||
| summary: "High request latency on {{ $labels.instance }}" | ||
| description: "{{ $labels.instance }} has a median request latency above 1s (current value: {{ $value }}s)" No newline at end of file |
| logging No newline at end of file | ||
| logging | ||
| prometheus-client==0.19.0 | ||
| prometheus-fastapi-instrumentator==6.1.0 No newline at end of file |
📌 작업 목적
GPU 환경에서의 모니터링 추가를 위하여 Prometheus와 Grafana를 추가했습니다.
🗂 작업 유형
🔨 주요 작업 내용
📎 관련 이슈