[REFAC#370] retry scheduler heartbeat 로그 압축 — 매 tick → 주기적 요약 - #371
Conversation
- RedisRetrySchedulerConfig.HeartbeatEveryNIdleTicks 신규 필드 (default 60) - "retry peek returned no due items" → "retry pipeline idle heartbeat" 로 변경 - 매 1s tick 마다 찍히던 메시지를 60 tick (=1분) 마다 1회로 압축 - consecutive_idle_ticks 필드로 idle 지속 시간 노출 - due 발견 시점 로그에 previous_idle_ticks 필드 추가 — 얼마나 idle 후 처리됐는지 가시화 - cmd/issuetracker wiring + .env.example RETRY_HEARTBEAT_EVERY_N_IDLE_TICKS 추가 - 0 = legacy 동작 보존 (매 tick)
- TestRedisDelayedRetryScheduler_IdleHeartbeat_CompressedEveryN - N=5 설정 시 12 tick 동안 heartbeat 가 N 압축으로 4회 이하 emit - 구 메시지 "retry peek returned no due items" 가 더 이상 emit 안 됨 확인 - TestRedisDelayedRetryScheduler_IdleHeartbeat_LegacyEveryTick - N=0 시 매 tick heartbeat (legacy 동작 보존) - TestRedisDelayedRetryScheduler_IdleTicksResetOnDue - due 발견 시 idleTicks 가 0 reset + previous_idle_ticks 필드 노출 - safeBuffer helper — concurrent log write/read race 회피
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR implements configurable idle heartbeat log compression for the Redis delayed retry scheduler. It adds a ChangesIdle Heartbeat Compression
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Pull request overview
이 PR은 RedisDelayedRetryScheduler의 idle 상태 DEBUG 로그(heartbeat)를 매 tick 1줄에서 N tick마다 주기적으로 요약 출력하도록 변경해 운영 로그 노이즈를 줄이려는 리팩토링입니다.
Changes:
RedisRetrySchedulerConfig.HeartbeatEveryNIdleTicks설정 추가 및 기본값(60) 부여, idle tick 누적 카운터(idleTicks) 도입- idle 로그 메시지를
"retry pipeline idle heartbeat"로 명확화하고,consecutive_idle_ticks/previous_idle_ticks필드 추가 cmd/issuetracker에서RETRY_HEARTBEAT_EVERY_N_IDLE_TICKS환경변수로 설정 override 및.env.example반영- 관련 단위 테스트 추가(압축 동작/legacy 동작/idle reset 검증)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
internal/processor/fetcher/worker/retry_scheduler.go |
idle heartbeat 로그 압축 로직과 설정 필드/카운터 추가 |
cmd/issuetracker/main.go |
RETRY_HEARTBEAT_EVERY_N_IDLE_TICKS env를 스케줄러 config에 와이어링 |
test/internal/processor/fetcher/worker/retry_scheduler_test.go |
heartbeat 압축/legacy/reset 동작을 검증하는 테스트 및 로그 캡처 헬퍼 추가 |
.env.example |
신규 환경변수 문서화 및 기본값 추가 |
There was a problem hiding this comment.
Code Review
This pull request implements heartbeat log compression for the Redis delayed retry scheduler to reduce log noise during idle periods. It introduces a new configuration setting, RETRY_HEARTBEAT_EVERY_N_IDLE_TICKS, which defaults to 60 ticks. The reviewer suggested centralizing the environment variable loading into the existing configuration package for consistency with the rest of the codebase.
- NewRedisDelayedRetryScheduler docstring 갱신 - 0 = legacy 의미로 보존 — 음수만 default 보정한다는 사실 명시 (Copilot 피드백) - TestRedisDelayedRetryScheduler_IdleHeartbeat_CompressedEveryN - time.Sleep 추정 → Eventually 패턴으로 변경 - heartbeat 횟수 ≤ peek 호출 횟수 / 2 (압축 비율 검증) - TestRedisDelayedRetryScheduler_IdleHeartbeat_LegacyEveryTick - 동일하게 Eventually 도입 + heartbeat ≈ peek (1:1 ±1 delta) 검증 - TestRedisDelayedRetryScheduler_IdleTicksResetOnDue - previous_idle_ticks 정규식 [1-9] → [1-9][0-9]* (두 자릿수 이상 매칭)
- gemini-code-assist 지적: main.go 가 os.Getenv 직접 호출하는 패턴은 나머지 cmd 가 config.LoadX 사용하는 일관성을 깸 - pkg/config 에 RetrySchedulerConfig + LoadRetryScheduler 추가 - 음수 / 비숫자 / float 입력 명시 reject (LoadRedis 등과 동일 패턴) - 0 은 legacy 모드로 유효 - cmd/issuetracker: strconv import 제거 + config.LoadRetryScheduler() 사용 - TestLoadRetryScheduler_* 3건 신규 (default / override / invalid)
연관 이슈
구현 내용
라이브 로그 분석 결과 `retry peek returned no due items` 가 175분 동안 10,464건 (debug.log 의 24%) emit — heartbeat 의도였으나 매 tick 마다 1줄로 노이즈 큼.
변경
RedisRetrySchedulerConfig.HeartbeatEveryNIdleTicks신규 필드 (default60)0→ legacy 동작 (매 tick) 보존"retry peek returned no due items"→"retry pipeline idle heartbeat"(heartbeat 임을 명시)consecutive_idle_ticks— idle 누적 tick 수previous_idle_ticks— 얼마나 idle 후 처리됐는지cmd/issuetracker와이어링 +.env.example에RETRY_HEARTBEAT_EVERY_N_IDLE_TICKS추가테스트
TestRedisDelayedRetryScheduler_IdleHeartbeat_CompressedEveryN— N 압축 동작TestRedisDelayedRetryScheduler_IdleHeartbeat_LegacyEveryTick— N=0 legacyTestRedisDelayedRetryScheduler_IdleTicksResetOnDue— due 발견 시 reset + previous_idle_ticks 필드safeBufferhelper — concurrent log capture race 회피CI / 머지 게이트 점검
변경 영향 범위
Required Status Checks
롤백 계획
TODO
논의 사항
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests