Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 0 additions & 3 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from app.core.lifespan import lifespan
from app.api.endpoints import predictions
from app.core.logging_config import setup_logging
from prometheus_fastapi_instrumentator import Instrumentator

setup_logging()
app = FastAPI(
Expand All @@ -12,8 +11,6 @@
lifespan=lifespan
)

instrumentator = Instrumentator().instrument(app)
instrumentator.expose(app, include_in_schema=False, endpoint="/actuator/prometheus")
app.include_router(predictions.router, prefix="/api/v1", tags=["Prediction"])

@app.get("/health")
Expand Down
19 changes: 19 additions & 0 deletions deployment/docker-compose.monitoring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,25 @@ services:
networks:
- mynetwork

dcgm-exporter:
image: nvcr.io/nvidia/k8s/dcgm-exporter:latest

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Docker 이미지에 latest 태그를 사용하는 것은 프로덕션 환경에서 위험할 수 있습니다. latest 태그는 언제든지 변경될 수 있어, 예기치 않은 버전이 배포되어 장애를 유발할 수 있습니다. 안정적인 배포를 위해 3.3.5-3.4.2-ubuntu22.04와 같이 구체적인 버전 태그를 사용해주세요.

      image: nvcr.io/nvidia/k8s/dcgm-exporter:3.3.5-3.4.2-ubuntu22.04

container_name: dcgm-exporter
ports:
- "9400:9400"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
environment:
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=utility,compute
restart: unless-stopped
networks:
- mynetwork

networks:
mynetwork:
driver: bridge
10 changes: 9 additions & 1 deletion deployment/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ services:
count: 1
capabilities: [gpu]
container_name: app-blue
networks:
- mynetwork

app-green:
image: ${ECR_URI}/dearbelly-cv:latest
Expand All @@ -27,4 +29,10 @@ services:
- driver: nvidia
count: 1
capabilities: [ gpu ]
container_name: app-green
container_name: app-green
networks:
- mynetwork

networks:
mynetwork:
driver: bridge

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

파일 끝에 새 줄(newline)이 없습니다. POSIX 호환성을 위해, 그리고 일부 텍스트 처리 도구와의 예기치 않은 문제를 방지하기 위해 파일 끝에 새 줄을 추가하는 것이 좋습니다.

2 changes: 1 addition & 1 deletion deployment/generate_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def send_prompt():

# Gemini에 전달할 프롬프트 구성
prompt = f"""
당신은 시니어 개발자입니다. 제출된 Pull Request(PR)에 대해 동료 개발자에게 건설적이고 상세한 코드 리뷰를 제공합니다.
너는 시니어 개발자다. 제출된 Pull Request(PR)에 대해 건설적이고 상세한 코드 리뷰를 제공해주세요.
리뷰는 반드시 '우선순위 레벨(P1~P5)'로 분류해 주세요.

[우선순위 정의]
Expand Down
18 changes: 7 additions & 11 deletions deployment/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,15 @@ scrape_configs:
honor_timestamps: false
scheme: 'http'
static_configs:
- targets: ['${REMOTE_HOST}:9090']
- targets: ['127.0.0.1:9090']
labels:
service: 'monitor-1'
- job_name: 'node'
static_configs:
- targets: ['${REMOTE_HOST}:9090']
- job_name: 'fastapi-actuator-blue'
metrics_path: '/actuator/prometheus'
scrape_interval: 1m
- targets: ['127.0.0.1:9090']
Comment on lines +19 to +24

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

127.0.0.1:9090으로 타겟을 하드코딩하면 다른 환경에서 재사용하거나 구성을 변경할 때 유연성이 떨어집니다. 이전처럼 ${REMOTE_HOST}와 같은 환경 변수를 사용하거나, 이것이 의도된 변경이라면 왜 하드코딩이 필요한지에 대한 주석을 추가하는 것을 고려해 보세요.

- job_name: 'dcgm'
scrape_interval: 15s
static_configs:
- targets: [ 'app-blue:8000' ]
- job_name: 'fastapi-actuator-green'
metrics_path: '/actuator/prometheus'
scrape_interval: 1m
static_configs:
- targets: [ 'app-green:8001' ]
- targets: ['dcgm-exporter:9400']
labels:
exporter: 'dcgm'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

파일 끝에 새 줄(newline)이 없습니다. POSIX 호환성을 위해, 그리고 일부 텍스트 처리 도구와의 예기치 않은 문제를 방지하기 위해 파일 끝에 새 줄을 추가하는 것이 좋습니다.

4 changes: 1 addition & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ Pillow==11.3.0
dotenv
openai
timm
logging
prometheus-client==0.19.0
prometheus-fastapi-instrumentator==6.1.0
logging

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

logging은 Python의 표준 내장 모듈이므로 requirements.txt에 명시할 필요가 없습니다. 오히려 PyPI에 등록된 logging이라는 이름의 다른 패키지가 설치되어 의도치 않은 동작을 유발할 수 있습니다. 이 줄을 제거해주세요.

Loading