alloy 가 textfile 지표를 수집하게 한다 - #36
Merged
Merged
Conversation
- 배치성 작업은 상시 노출할 엔드포인트가 없어 스크랩 대상이 못 된다. 결과를 .prom 파일로 써 두면 호스트 메트릭에 얹혀 함께 전송되도록, node_exporter 의 textfile collector 를 켠다 - 첫 소비자는 core 의 DB 백업이다(TeamPiKi/core#905). 마지막 성공 시각을 지표로 남겨야 "며칠째 성공하지 못했다"를 판단할 수 있다 - 실패 알림만으로는 스크립트가 아예 실행되지 않은 침묵을 못 잡는다 - provision-alloy.sh 가 호스트 디렉터리를 미리 만들고 읽기 전용으로 마운트한다. mkdir 을 먼저 하는 이유는, 없는 경로를 -v 로 넘기면 docker 가 root 소유로 만들어 버려 지표를 쓰는 쪽이 권한에 걸릴 수 있어서다 - 다른 박스에는 영향이 없다. 디렉터리가 비어 있으면 collector 가 아무 지표도 안 읽고 넘어간다 - 검증: 운영과 같은 v1.16.1 로 validate 통과(틀린 키를 넣으면 exit 1 이 나오는 것까지 대조), DB 박스에 적용 후 마운트가 ro 로 붙은 것과 collector 활성화 로그 확인. 임시 지표 파일을 넣자 전송 series 가 532 에서 534 로 늘고 지우자 원복되는 것으로 실제 수집을 실증했다
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough호스트 textfile 메트릭 디렉터리를 생성하고 Alloy 컨테이너에 읽기 전용으로 마운트한다. Unix exporter는 Changes호스트 textfile 메트릭 수집
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 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 |
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.
Situation
Task
Action
config.alloy의 호스트 메트릭 수집기에 textfile collector 를 켰다. node_exporter 의 표준 기능으로, 시스템이 직접 주지 않는 값을 파일에서 받아 함께 내보내는 자리다.provision-alloy.sh가 호스트 디렉터리를 미리 만들고 읽기 전용으로 마운트한다.mkdir을 먼저 하는 이유: 없는 경로를-v로 넘기면 docker 가 호스트에 root 소유 디렉터리를 만들어 버린다. 그러면 지표를 쓰는 쪽(백업 스크립트 등)이 권한에 걸릴 수 있어, 소유·권한을 예측 가능하게 두려고 먼저 만든다.Result
운영과 같은 버전(v1.16.1)으로 검증하고, DB 박스에 실제 적용해 확인했다.
exit 1이 나오는 것까지 대조해 검사가 성립함을 확인/var/lib/node_exporter/textfile -> /host/textfile읽기 전용으로 붙음collector=textfile연관 이슈
Summary by CodeRabbit
.prom파일)를 시스템 메트릭과 함께 수집합니다.