-
Notifications
You must be signed in to change notification settings - Fork 3
#540 Kubernetes 관측성 개선 #707
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
Merged
Merged
Changes from 27 commits
Commits
Show all changes
147 commits
Select commit
Hold shift + click to select a range
83f774a
Traefik ingress 알림 label 수정
Neibce d5997d0
Grafana 대시보드 운영 지표 정리
Neibce a61eb8c
플랫폼과 데이터스토어 관측 지표 보강
Neibce 38eb41e
관측성 알림 대응 runbook 추가
Neibce 203b580
Sentry 기본 개인정보 전송 비활성화
Neibce 179644f
트레이싱 도입 전제 조건 문서화
Neibce 0c062cd
Loki와 Alloy 로그 수집 설정 추가
Neibce dfea20c
로그 스택 관측 알림과 대시보드 보강
Neibce 8e8be19
관측성 매니페스트 검증 스크립트 추가
Neibce 6fa61b5
데이터스토어 세부 관측 지표 보강
Neibce 999be2d
Redis 메모리 알림 오탐 방지
Neibce 9a9780d
Sentry 이벤트 민감정보 필터링 보강
Neibce 1d8ecc6
Sentry 릴리즈 태그 배포 연동
Neibce e8e3a55
프론트 요청 ID 전파 추가
Neibce 01bf747
알림 이메일 fallback 예시 추가
Neibce ee2e225
관측성 로그와 요청 ID 테스트 추가
Neibce 41f539e
트레이싱 비활성 경로 안전화
Neibce a0adaab
관측성 매니페스트 검증 강화
Neibce 71191bf
Judge 서버 관측 지표 회귀 테스트 추가
Neibce 86702e9
관측성 실클러스터 점검 스크립트 추가
Neibce 5eaeb90
관측성 selector 검증 보강
Neibce 06b943d
로그 저장소 운영 전제 검증 보강
Neibce b4edefa
관측성 검증 CI 추가
Neibce 44969cb
깃허브 액션 제거와 메트릭 테스트 추가
Neibce d802e39
온프레미스 트레이싱 스택 추가
Neibce 6b66ee5
로그와 트레이스 상관관계 추가
Neibce 3d39fb8
Celery 작업 관측 지표 추가
Neibce eb7f405
Celery 작업 request ID 전파 추가
Neibce aac001e
프론트 nginx 요청 로그 상관관계 추가
Neibce 0f14c15
Ingress 로그 수집 관측성 추가
Neibce 798a0d9
Longhorn 스토리지 관측성 추가
Neibce a350d3e
공개 엔드포인트 관측성 추가
Neibce 07b3887
vLLM AI 추론 관측성 추가
Neibce 7548395
hub-auth 관측성 추가
Neibce f236011
GPU 관측성 추가
Neibce 8a6b4bb
프론트엔드 오류 관측성 추가
Neibce 5778e17
모니터링 스택 관측성 추가
Neibce a1c1e36
쿠버네티스 이벤트 관측성 추가
Neibce b56560c
관측 파이프라인 실패 알림 보강
Neibce e4eff0c
데이터스토어 병목 관측성 추가
Neibce bb8a8d2
채점 중단 관측성 추가
Neibce cbdb1aa
배포 롤아웃 관측성 추가
Neibce 620d7c9
로그 파이프라인 장애 관측성 추가
Neibce fb3c03c
그라파나 공개 경로 관측성 추가
Neibce f75b941
채점 경로 추적 구간 보강
Neibce c489eea
운영 요약 기록 규칙 추가
Neibce 374f083
핵심 P0 알림 누락 조건 보강
Neibce e32953f
서비스 엔드포인트 관측성 추가
Neibce 96b1590
AI 힌트 백엔드 관측성 추가
Neibce 7c25879
AI 힌트 API 결과 관측성 추가
Neibce aa9520a
제출 생성 경로 관측성 추가
Neibce bc39238
채점 작업 결과 관측성 추가
Neibce 6f56294
정기 작업 신선도 관측성 추가
Neibce f1792a6
모니터링 검증 범위 보강
Neibce c9e8164
모니터링 스모크 체크 범위 보강
Neibce 0d8f27f
앱 관측성 배선 검증 추가
Neibce dbcd5c5
서비스 엔드포인트 스모크 체크 보강
Neibce e4a1999
트래픽 인그레스 메트릭 수집 추가
Neibce 775507f
관측성 런북 알림명 정리
Neibce 1c825f2
셀러리 관측성 메트릭 수집 안정화
Neibce cc7a39e
프로메테우스 룰 검증 방식 수정
Neibce 7ced7ec
인그레스 5xx 알림 라벨 호환성 보강
Neibce 388618b
개요 대시보드 인그레스 지표 추가
Neibce 1671407
로그 스택 스모크 체크 필수화
Neibce 7f6c01d
그라파나 데이터소스 검증 강화
Neibce 32120d3
모니터링 헬름 차트 버전 고정
Neibce aaf8d5e
알림 라우팅 네임스페이스 매처 해제
Neibce 83e866c
알림 매처 스모크 체크 보강
Neibce 9916167
그라파나 데이터소스 스모크 체크 보강
Neibce a707e0d
Alloy 파드 로그 경로 마운트 추가
Neibce 9fe8490
프론트엔드 nginx 로그 검증 보강
Neibce 0cf92d4
모니터링 selector 검증 보강
Neibce e9410ca
Loki 차트 배포 모드 정정
Neibce 95adf0b
Alloy 로그 수집 범위 보강
Neibce d33b003
로그 스택 스모크 체크 보강
Neibce fcef109
로그 대시보드 네임스페이스 범위 정리
Neibce 6e08419
로그 대시보드 빈 패널 방지
Neibce d839034
요청 ID 헤더 안전성 보강
Neibce 3bf7860
프론트엔드 로그 민감 URL 제거
Neibce 12bcad0
관측성 운영 문서 최신화
Neibce 816dcf0
알림 SealedSecret 운영 절차 보강
Neibce 3edf6d8
트레이스 대시보드 검증 보강
Neibce 802e974
트레이스 쿠버네티스 메타데이터 보강
Neibce 27eef1c
관측성 검증 스크립트 제거와 컬렉터 분산 보강
Neibce 64539fe
공개 엔드포인트 프로브 분산 보강
Neibce bbc40ee
모니터링 스택 상태 저장 보강
Neibce b832c3f
Longhorn 매니저 부분 장애 관측 보강
Neibce 0e03428
누적 메트릭 카운터 타입 정합성 보강
Neibce 0611776
공개 엔드포인트 프로브 누락 알림 보강
Neibce 8ea437f
데이터스토어 HA 알림 등급 정리
Neibce 57e6ebd
알림 경로와 Loki 게이트웨이 HA 보강
Neibce 24454c7
관측 스택 unavailable 알림 기준 정리
Neibce 049d0fc
모니터링 설정 reload 실패 감지 보강
Neibce d6aa459
dev P1 외부 알림 라우팅 분리
Neibce 06a540a
핵심 작업 엔드포인트 결측 알림 보강
Neibce 2ca6071
GitHub Actions 변경 제외
Neibce 274b7b8
Prometheus 고가용성 관측 기준 보강
Neibce 860be56
Grafana 메트릭 관측 경로 보강
Neibce 4cf0495
모니터링 서비스 target 장애 감지 보강
Neibce 9f57e6e
모니터링 target 알림 범위 정교화
Neibce 09d3c5f
관측 알림 runbook 검색성 보강
Neibce 8784d2a
Trace 대시보드 조회 패널 보강
Neibce 10c6d99
로그 유입 대시보드 세분화
Neibce 07af749
알림 메시지 진단 링크 보강
Neibce 4b3a7f1
Frontend readiness probe 보강
Neibce 6f09295
사용자 경로 PDB 보강
Neibce a06bb70
PDB 위험 상태 관측 보강
Neibce 6b140fa
Grafana 관측 대상 정규화
Neibce 614cb88
로그 노드별 관측 보강
Neibce b5f3067
채점 소요 시간 관측 기준 보정
Neibce 06191a2
스케줄 작업 미관측 알림 보강
Neibce 2313d14
채점 완료 시간 관측 인덱스 추가
Neibce 478903f
제출 대기 관측 인덱스 추가
Neibce 61ff394
Alloy 노드 로그 수집 범위 보강
Neibce 6ca85d7
Tempo PVC 롤아웃 전략 보강
Neibce 21b6a78
제출 테이블 관측 조회 제거
Neibce 1526adb
불필요한 제출 관측 인덱스 제거
Neibce f3930f5
백엔드 메트릭의 DB 직접 조회 제거
Neibce ae5c36e
Loki 게이트웨이 메트릭 대상 정정
Neibce 21685cd
알림 라우팅 기본 수신자 무해화
Neibce 72a2c01
judge 서버 관측 DB 조회 제거
Neibce 3815830
Redis 관측 수집 성공 판정 보정
Neibce 9a15919
Overview 대시보드 Prometheus 명시
Neibce 853d9bb
judge 서버 관측 스냅샷 정리
Neibce 6e37405
Alloy 로그 수집 설정 문법 정리
Neibce a90d8e4
Alertmanager 웹훅 시크릿 감시 추가
Neibce 5cb9a6d
서비스 endpoint 관측 메트릭 정정
Neibce f79e9be
모니터링 Helm 설치 절차 보강
Neibce fd57d99
OTel Collector 메트릭 엔드포인트 명시
Neibce e7db2e9
OpenTelemetry 초기화 중복 방지
Neibce 2daad2e
노드 압력 알림 라벨 보강
Neibce bed6630
공개 엔드포인트 알림 범위 제한
Neibce e4c5257
관측성 문서와 미사용 메트릭 정리
Neibce 7065c80
Alertmanager 이메일 예시 제거
Neibce bf022c2
Sentry 릴리즈 하드코딩 제거
Neibce 80ae303
불필요한 관측성 예외처리 제거
Neibce 753a9dd
과한 관측성 알림 제거
Neibce 582d02c
judge 서버 우회 메트릭 제거
Neibce e1ee6f5
Redis 누적 Celery 상세 메트릭 제거
Neibce bc8f42e
Sentry 릴리즈 값을 배포 SHA로 갱신
Neibce 66bf6ad
Sentry 프론트엔드 빌드 설정 연결
Neibce 4c102ec
Sentry 릴리즈 설정 단일화
Neibce def0ed6
Sentry 릴리즈를 APP_VERSION으로 통일
Neibce e3f6556
APP_VERSION 주입 방식 정리
Neibce 83e525e
내부 frontend error 수집 제거
Neibce b3a80c2
과한 Redis 관측 메트릭 제거
Neibce 8733744
불필요한 관측성 코드 정리
Neibce File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| import logging | ||
| import time | ||
|
|
||
| from celery import signals | ||
|
|
||
| from utils.cache import cache | ||
|
|
||
| logger = logging.getLogger("codeplace.celery_task") | ||
|
|
||
| CELERY_TASK_TOTAL_KEY = "observability:celery:task_total" | ||
| CELERY_TASK_RUNTIME_BUCKET_KEY = "observability:celery:task_runtime_bucket" | ||
| CELERY_TASK_RUNTIME_COUNT_KEY = "observability:celery:task_runtime_count" | ||
| CELERY_TASK_RUNTIME_SUM_KEY = "observability:celery:task_runtime_sum" | ||
| CELERY_TASK_RUNTIME_LAST_KEY = "observability:celery:task_runtime_last" | ||
| CELERY_TASK_RUNTIME_BUCKETS = (1, 3, 5, 10, 30, 60, 120, 300, 600, float("inf")) | ||
|
|
||
| _task_start_times = {} | ||
| _configured = False | ||
|
|
||
|
|
||
| def configure_celery_observability(): | ||
| global _configured | ||
| if _configured: | ||
| return | ||
| signals.task_prerun.connect(_on_task_prerun, weak=False) | ||
| signals.task_postrun.connect(_on_task_postrun, weak=False) | ||
| signals.task_retry.connect(_on_task_retry, weak=False) | ||
| _configured = True | ||
|
github-code-quality[bot] marked this conversation as resolved.
Fixed
|
||
|
|
||
|
|
||
| def _task_name(task): | ||
| return getattr(task, "name", None) or getattr(task, "__name__", None) or "unknown" | ||
|
|
||
|
|
||
| def _field(*parts): | ||
| return "|".join(str(part) for part in parts) | ||
|
|
||
|
|
||
| def _hincrbyfloat(key, field, amount): | ||
| client = cache.client.get_client(write=True) | ||
| return client.hincrbyfloat(key, field, amount) | ||
|
|
||
|
|
||
| def _hsetfloat(key, field, value): | ||
| client = cache.client.get_client(write=True) | ||
| return client.hset(key, field, value) | ||
|
|
||
|
|
||
| def _record_task(task_name, status, duration_seconds=None): | ||
| status = (status or "unknown").lower() | ||
| try: | ||
| cache.hincrby(CELERY_TASK_TOTAL_KEY, _field(task_name, status), 1) | ||
| if duration_seconds is not None: | ||
| _hincrbyfloat(CELERY_TASK_RUNTIME_SUM_KEY, task_name, duration_seconds) | ||
| cache.hincrby(CELERY_TASK_RUNTIME_COUNT_KEY, task_name, 1) | ||
| _hsetfloat(CELERY_TASK_RUNTIME_LAST_KEY, _field(task_name, status), duration_seconds) | ||
| for bucket in CELERY_TASK_RUNTIME_BUCKETS: | ||
| if duration_seconds <= bucket: | ||
| bucket_label = "+Inf" if bucket == float("inf") else str(bucket) | ||
| cache.hincrby(CELERY_TASK_RUNTIME_BUCKET_KEY, _field(task_name, bucket_label), 1) | ||
| except Exception: | ||
| logger.exception("failed to record celery task metric", extra={ | ||
| "task_name": task_name, | ||
| "task_status": status, | ||
| }) | ||
|
|
||
|
|
||
| def _on_task_prerun(task_id=None, task=None, **kwargs): | ||
| if task_id: | ||
| _task_start_times[task_id] = time.monotonic() | ||
|
|
||
|
|
||
| def _on_task_postrun(task_id=None, task=None, state=None, **kwargs): | ||
| task_name = _task_name(task) | ||
| started_at = _task_start_times.pop(task_id, None) | ||
| duration_seconds = None | ||
| if started_at is not None: | ||
| duration_seconds = max(time.monotonic() - started_at, 0) | ||
| _record_task(task_name, state, duration_seconds) | ||
| logger.info("celery task completed", extra={ | ||
| "task_id": task_id, | ||
| "task_name": task_name, | ||
| "task_status": (state or "unknown").lower(), | ||
| "duration_ms": round(duration_seconds * 1000, 2) if duration_seconds is not None else None, | ||
| }) | ||
|
|
||
|
|
||
| def _on_task_retry(request=None, reason=None, **kwargs): | ||
| task_name = getattr(request, "task", None) or "unknown" | ||
| task_id = getattr(request, "id", None) | ||
| _record_task(task_name, "retry") | ||
| logger.warning("celery task retry", extra={ | ||
| "task_id": task_id, | ||
| "task_name": task_name, | ||
| "task_status": "retry", | ||
| "retry_reason": str(reason) if reason else None, | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.