feat(phase-5-3): Logger, Metrics, 알림 시스템 통합

Phase 5-3 모니터링 강화 작업의 통합을 완료했습니다.

변경사항:
- Logger 통합: console.log를 구조화된 로깅으로 전환 (9개 파일)
  - JSON 기반 로그, 환경별 자동 전환 (개발/프로덕션)
  - 타입 안전성 보장, 성능 측정 타이머 내장

- Metrics 통합: 실시간 성능 모니터링 시스템 연결 (3개 파일)
  - Circuit Breaker 상태 추적 (api_call_count, error_count, state)
  - Retry 재시도 횟수 추적 (retry_count)
  - OpenAI API 응답 시간 측정 (api_call_duration)

- 알림 통합: 장애 자동 알림 시스템 구현 (2개 파일)
  - Circuit Breaker OPEN 상태 → 관리자 Telegram 알림
  - 재시도 실패 → 관리자 Telegram 알림
  - Rate Limiting 적용 (1시간에 1회)

- 문서 업데이트:
  - CLAUDE.md: coder 에이전트 설명 강화 (20년+ 시니어 전문가)
  - README.md, docs/: 아키텍처 문서 추가

영향받은 파일: 16개 (수정 14개, 신규 2개)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
kappa
2026-01-19 21:23:38 +09:00
parent 410676e322
commit eee934391a
16 changed files with 675 additions and 777 deletions

View File

@@ -1,4 +1,7 @@
// Tool Registry - All tools exported from here
import { createLogger } from '../utils/logger';
const logger = createLogger('tools');
import { weatherTool, executeWeather } from './weather-tool';
import { searchWebTool, lookupDocsTool, executeSearchWeb, executeLookupDocs } from './search-tool';
@@ -48,7 +51,7 @@ export function selectToolsForMessage(message: string): typeof tools {
// 패턴 매칭 없으면 전체 도구 사용 (폴백)
if (selectedCategories.size === 1) {
console.log('[ToolSelector] 패턴 매칭 없음 → 전체 도구 사용');
logger.info('패턴 매칭 없음 → 전체 도구 사용');
return tools;
}
@@ -58,9 +61,11 @@ export function selectToolsForMessage(message: string): typeof tools {
const selectedTools = tools.filter(t => selectedNames.has(t.function.name));
console.log('[ToolSelector] 메시지:', message);
console.log('[ToolSelector] 카테고리:', [...selectedCategories].join(', '));
console.log('[ToolSelector] 선택된 도구:', selectedTools.map(t => t.function.name).join(', '));
logger.info('도구 선택 완료', {
message,
categories: [...selectedCategories].join(', '),
selectedTools: selectedTools.map(t => t.function.name).join(', ')
});
return selectedTools;
}