[REFACTOR] Webhook delivery 계층 분리 및 structured log 전환#97
Open
minyongP wants to merge 1 commit into
Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
관련 작업 / 이슈
이번 PR의 중점
WebhookAlertService에 몰려 있던 예약/수정/취소 와 delivery worker 책임을 분리했습니다.webhook_alert_log테이블 의존을 제거하고 SLF4J structured log 기반 운영 추적으로 전환했습니다.내용 요약 (Description)
WebhookAlertNotifier,WebhookAlertDeliveryService,WebhookAlertMessageResolver,WebhookAlertEventLogger로 책임을 분리했습니다.webhook_alert_log관련 엔티티/리포지토리/테스트를 제거하고webhook_alert.last_error+ Flyway migration으로 정리했습니다.nextScheduledAt전략은 유지하면서 전송 전/후 deferred schedule 우선 적용 흐름을 보존했습니다.WebhookAlertDeliveryService내부로 흡수해 과설계를 줄였습니다.WebhookAlertScheduler,WebhookAlertSchedulerProperties를 infrastructure 패키지로 이동했습니다.알림 서비스 아키텍처
flowchart TD A["WorkspaceProblemService"] --> B["WebhookAlertNotifier"] C["WebhookAlertScheduler"] --> D["WebhookAlertDeliveryService"] D --> E["WebhookAlertMessageResolver"] D --> F["WebhookSender"] D --> G["WebhookAlertEventLogger"] F --> H["TemplatedWebhookSender"] H --> I["WebhookAlertTemplateRenderer"] H --> J["MattermostWebhookSender"] J --> K["RestTemplateWebhookTransport"]클래스 다이어그램
classDiagram class WebhookAlertNotifier { +reserveOrUpdate(...) +deactivate(...) +cancel(...) } class WebhookAlertDeliveryService { +recoverStuckProcessing(now) +reserveDueAlertIds(now, limit) +deliver(alertId, now) } class WebhookAlertMessageResolver { +resolve(alert) } class WebhookAlertEventLogger { +logCreated(...) +logDelivered(...) +logRetryScheduled(...) +logFailed(...) } class WebhookSender { <<interface>> +send(hookUrl, message) } class TemplatedWebhookSender class MattermostWebhookSender class RestTemplateWebhookTransport class WebhookAlert WebhookAlertNotifier --> WebhookAlert WebhookAlertDeliveryService --> WebhookAlert WebhookAlertDeliveryService --> WebhookAlertMessageResolver WebhookAlertDeliveryService --> WebhookSender WebhookAlertDeliveryService --> WebhookAlertEventLogger WebhookSender <|.. TemplatedWebhookSender TemplatedWebhookSender --> MattermostWebhookSender MattermostWebhookSender --> RestTemplateWebhookTransport작업 근거
테스트
./gradlew verify통과./gradlew test --tests 'com.ujax.domain.webhook.WebhookAlertTest' --tests 'com.ujax.domain.webhook.WebhookAlertRepositoryTest' --tests 'com.ujax.application.webhook.WebhookAlertNotifierTest' --tests 'com.ujax.application.webhook.WebhookAlertDeliveryServiceTest' --tests 'com.ujax.application.webhook.WebhookAlertEventLoggerTest' --tests 'com.ujax.infrastructure.scheduling.webhook.WebhookAlertSchedulerTest' --tests 'com.ujax.application.problem.WorkspaceProblemServiceTest'PROCESSING_STARTED/DELIVEREDstructured log 확인webhook_alertrow 삭제 확인PR 체크리스트
./gradlew verify를 로컬에서 실행해 모두 통과함.Breaking Change 여부
webhook_alert_log테이블이 제거됩니다.V6__drop_webhook_alert_log_and_add_last_error.sql적용이 필요합니다.webhook_alert_log조회에 의존하는 코드/쿼리가 있다면 structured log(Loki) 기반 조회로 전환해야 합니다.로그 / 스크린샷 (선택)
event=webhook_alert eventType=PROCESSING_STARTED,eventType=DELIVERED로그를 확인했습니다.기타 정보 / 의존성 (선택)
WebhookAlertMessageResolver를 별도 query/use-case로 더 명확히 분리할 수 있음WorkspaceProblemService가WebhookAlertNotifier를 사용하도록 변경됨