Conversation
[518] mongo policy 반복/즉시/관리자 mongo db 로그 생성
[516] 회선 별 제한 정책 관련 변경 이력 mongodb 저장
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (24)
📝 WalkthroughWalkthroughThis PR introduces a MongoDB-backed policy history and audit logging system, integrating audit trails across policy services. It adds MongoDB dependencies, new PolicyHistory entity and repository, PolicyHistoryService and PolicyWriteAuditService implementations, and incorporates history logging into AdminPolicyServiceImpl and UserPolicyServiceImpl. Concurrently, it refactors traffic service logging by removing traceId from log statements and enhances TrafficStreamConsumerRunner with MDC-based trace context propagation and deduplication handling. Changes
Sequence Diagram(s)sequenceDiagram
participant Admin as Admin Service
participant DB as RDB/Repository
participant HS as HistoryService
participant MR as MongoRepository
participant MDB as MongoDB
Admin->>DB: Create/Update/Delete Policy
activate DB
DB->>DB: Execute operation
deactivate DB
Admin->>DB: Re-fetch updated state
activate DB
DB-->>Admin: Return refreshed entity
deactivate DB
Admin->>HS: log(tableName, event, targetId, before, after)
activate HS
HS->>HS: Extract user from auth
HS->>HS: Compute diff (before/after)
HS->>MR: save(PolicyHistory)
activate MR
MR->>MDB: Insert audit document
MDB-->>MR: Confirm
deactivate MR
deactivate HS
Admin-->>Admin: Return response with updatedAt
sequenceDiagram
participant Consumer as StreamConsumerRunner
participant MDC as MDC Context
participant Dedupe as InFlightDedupeService
participant Orch as OrchestratorService
participant Store as Persistence
participant ACK as Kafka ACK
Consumer->>MDC: put(TRACE_ID, payload.traceId)
Consumer->>Store: Check DONE entry exists
alt DONE exists
Consumer-->>ACK: Acknowledge record
else DONE not found
Consumer->>Dedupe: tryClaim(traceId)
alt Already claimed
Consumer-->>Store: Check DONE again
Consumer-->>ACK: Acknowledge record
else Claim successful
Consumer->>Orch: Run 10-tick deduction
Orch-->>Consumer: Return result
Consumer->>Store: saveIfAbsent(DONE)
Consumer-->>ACK: Acknowledge record
Consumer->>Dedupe: Release lock
end
end
Consumer->>MDC: remove(TRACE_ID)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Misu0616
left a comment
There was a problem hiding this comment.
제발 프론트에게 피드백이 안 왔으면 좋겠어요ㅠㅠ
개요
관련 BackLog
Resolves: (Backlog Number, ...)
PR 유형
PR Checklist
Summary by CodeRabbit
New Features
Improvements