fix: Alloy storage(positions)를 호스트 볼륨으로 영속화 - #32
Conversation
- 매 배포의 rm -f 재기동이 컨테이너 내부 positions 를 유실해, 새 수집기가 떠 있는 앱 컨테이너 로그를 처음부터 재전송했다. 도착 시점 40분을 넘긴 라인은 Grafana Cloud 가 __time_shard__ 스트림으로 받아 원본과 별개로 저장돼 로그가 약 1.4배 중복됐다(2026-08 core 실측) - 고정 경로 /var/lib/piki-alloy/data 를 /var/lib/alloy/data 로 마운트하고 --storage.path 를 명시. 미지정 기본값이 CWD 상대(data-alloy/)라 이미지 내부 구조에 묶이기 때문 - 컨테이너가 root 로 돌아(실측 uid=0) chown 은 두지 않았다
|
Warning Review limit reached
Next review available in: 58 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAlloy positions 데이터의 호스트 저장 경로를 추가했다. 컨테이너에 해당 경로를 마운트했다. Alloy 실행 시 ChangesAlloy 영속 데이터 저장
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@blocks/alloy/provision-alloy.sh`:
- Around line 129-132: Update the container replacement flow before docker run:
first attempt docker stop --timeout 15 "$NAME" for graceful shutdown, then use
docker rm -f "$NAME" only as the fallback when stopping fails or the container
remains. Preserve the existing error-tolerant behavior and volume mounts.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 048380cb-0bf2-435e-bed4-d6723d253c03
📒 Files selected for processing (1)
blocks/alloy/provision-alloy.sh
- rm -f 단독은 SIGKILL 이라 positions 마지막 sync(10s 주기) 이후 오프셋과 loki.write 미전송 배치가 유실된다. stop(timeout 15s)이 종료 flush 를 보장하고 rm -f 는 fallback 으로 남긴다 - CodeRabbit 리뷰 수용
Situation
__time_shard__라벨 복사본" 조합이었다.docker rm -f재생성하는데, 읽기 위치(loki.source.docker 의 positions.yml)가 컨테이너 내부에만 있어 함께 유실된다. 새 수집기는 그 시점에 떠 있는 옛 색(blue/green) 앱 컨테이너의 로그를 처음부터 전량 재전송하고, 도착 시점 기준 40분(time_sharding_ignore_recent)을 넘긴 라인은 Grafana Cloud 가__time_shard__별도 스트림으로 받아 원본 스트림의 exact-dup 드롭을 우회해 중복 저장된다.Task
Action
/var/lib/piki-alloy/data를 만들어 컨테이너의/var/lib/alloy/data로 마운트했다.run명령에--storage.path=/var/lib/alloy/data를 명시했다. 미지정 시 기본값이 CWD 상대 경로(data-alloy/)라 이미지 내부 구조(작업 디렉터리)에 묶여 마운트 대상이 흔들리기 때문이다(v1.16.1run --help실측: default "data-alloy/").Result
--storage.path플래그 존재 확인, 마운트+플래그 조합으로 스모크 기동해 스토리지 파일이 호스트 경로에 실제 생성됨을 확인했다.연관 이슈
Summary by CodeRabbit