[HSC-418] Pinpoint 설정 및 의존성 추가#62
Conversation
There was a problem hiding this comment.
Code Review
This pull request integrates Pinpoint monitoring into the application by adding necessary configuration settings, a dedicated infrastructure module for agent initialization, and FastAPI middleware. It also introduces an app_mode setting to conditionally enable CDC analysis. The review feedback suggests improving the robustness of the new Pinpoint infrastructure by adding unit tests for edge cases, such as missing dependencies or empty configurations, and recommends sorting the requirements.txt file alphabetically for better maintainability.
| _PINPOINT_INITIALIZED = False | ||
|
|
||
|
|
||
| def build_fastapi_pinpoint_middleware(settings: Settings) -> list[Any]: |
There was a problem hiding this comment.
이 모듈은 Pinpoint 초기화와 관련된 중요한 로직을 포함하고 있습니다. 특히, 설정 플래그에 따른 조건부 초기화, 지연 로딩, 스레드 안전성(_initialize_pinpoint) 등이 구현되어 있습니다. 이 로직의 정확성과 견고성을 보장하기 위해 단위 테스트를 추가하는 것을 강력히 권장합니다. 예를 들어, 다음과 같은 시나리오들을 테스트할 수 있습니다:
pinpoint_enabled가False일 때build_fastapi_pinpoint_middleware가 빈 리스트를 반환하는지 확인pinpoint_enabled는True이지만pinpoint_collector_agent_uri가 비어있을 때 빈 리스트를 반환하고 경고 로그가 남는지 확인pinpointPy의존성이 설치되지 않았을 때 (ImportError), 예외가 로깅되고 빈 리스트를 반환하는지 확인 (mock 사용)- 성공적으로 초기화될 때,
_initialize_pinpoint가 올바른 인자들로 호출되는지 확인 (mock 사용) _initialize_pinpoint가 여러 번 호출되어도 실제 초기화는 한 번만 수행되는지 확인
| pinpointPy==1.3.1 | ||
| starlette-context==0.4.0 |
📝작업 내용
👀변경 사항
🎫 Jira Ticket
#️⃣관련 이슈