-
Notifications
You must be signed in to change notification settings - Fork 0
Loki, Grafana 로컬 세팅 및 log 처리 #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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
kakusiA
added a commit
that referenced
this pull request
Sep 18, 2025
* feat: 유사도 torch 삭제 후 onnx 추가 * feat: 유사도 torch 삭제 후 onnx 추가 * chore: onnx 모델 저장용 볼륨 docker-composer에 추가 * chore: poetry.lock 추가 * chore: poetry.lock 추가 * chore: poetry run black & ci-python 원상 복구 * chore: ci-python 머지 테스트 추가 * typeHandler가 등록되지 않는 버그 (#88) * 기본적인 global exception handling (#90) * feat: 기본적인 global exception handling * chore: Security exception handling * feat: Duplicate Exception handling * Caddyfile copy 추가 (#89) * refactor: 필요없는 API url 삭제 * refactor: 2차 마일스톤을위한 공통 request및 response 주석 * refactor: - 2차 마일스톤을위한 공통 request및 response 주석에따른 blog코드 리펙토링 * Workflow dummy data insert sql (alpha) (#93) * chore: workflow dummy data (experimental) * chore: Super admin에 workflow 할당 * chore: v0.0.4 erd 적용 * Loki, Grafana 로컬 세팅 및 log 처리 (#95) * chore: Docker compose loki, grafana * chore: Sync appender 기반 grafana 연결 * chore: fix test * 로그아웃 api (#96) * feat: UserLogoutFlowE2eTest 초안 * feat: UserLogoutFlowE2eTest * feat: AuthController에 logout api 추가 * feat: AuthApiIntegrationTest에 Logout 추가 * feat: h2 호환 스키마 파일 * Grafana Loki 로깅 (develop) (#97) * chore: Develop logging appender 복구 * chore: Trace id, span id 도입 * chore: Source id, run id label로 분리 * Pagination dto 및 공통 service (#94) * chore: Paging request, reponse dto * chore: Pagination controller, service example * chore: workflows api 앞에 v0 추가 * refactor: 페이지네이션 구조 개선 PageService를 PageableService 인터페이스로 변경하여 트랜잭션 처리 개선 * feat: crawling_util 한개로 합침 1. service 수정 2. schemas 수정 * 블로그 자동화 배치 Job 및 Tasklet 세팅 (#91) * refactor: health관련 패키지 네이밍 및 파일 네이밍 변경 * feat(config): @ConfigurationProperties로 타입-안전한 설정 관리 도입 기존의 @value나 하드코딩 방식은 오타에 취약하고, 설정값 누락 시 런타임 오류를 유발할 수 있는 타입 불안전성 문제가 있었습니다. 이를 해결하기 위해 @ConfigurationProperties를 사용하는 `FastApiProperties` 클래스를 도입하여 FastAPI 연동 설정을 중앙화하고, 애플리케이션 시작 시점에 설정값의 타입과 유효성을 검증하도록 개선했습니다. 이를 통해 잠재적인 런타임 장애를 원천 차단하고, 코드의 안정성과 유지보수성을 크게 향상시켰습니다. * refactor: Code Formatting * feature: 블로그 자동화 배치 Job 및 Tasklet 구현 콘텐츠 자동화 워크플로우의 핵심 실행 로직인 Spring Batch Job과 그를 구성하는 7개의 Tasklet을 구현합니다. ### 주요 구현 내용: 1. **`BlogAutomationJobConfig.java`**: - 워크플로우의 전체 실행 흐름을 담당하는 두 개의 Job(`productSelectionJob`, `contentPublishingJob`)과 각 Job을 구성하는 Step들을 정의했습니다. - '상품 선정/수집'과 '콘텐츠 생성/발행'이라는 역할을 명확히 분리하여 Job의 재사용성과 독립성을 확보했습니다. 2. **7개의 Tasklet 구현**: - `ExtractTrendKeywordTasklet`: 트렌드 키워드 추출 - `SearchProductsFromMallTasklet`: 키워드로 쇼핑몰 상품 목록 검색 - `MatchProductWithKeywordTasklet`: 키워드와 상품명 매칭 - `FindSimilarProductsTasklet`: 매칭된 상품의 유사 상품 탐색 - `CrawlSelectedProductTasklet`: 최종 선택된 상품 상세 정보 크롤링 - `GenerateBlogContentTasklet`: 수집된 정보로 AI 블로그 원고 생성 - `PublishBlogPostTasklet`: 완성된 원고를 블로그에 발행 3. **Step 간 데이터 전달**: - 각 Tasklet은 `JobExecutionContext`를 통해 다음 단계로 필요한 데이터(추출된 키워드, 선택된 상품 정보, 생성된 콘텐츠 등)를 전달하도록 구현되었습니다. * chore: fastapi와 상호작용을 담당하는 external 패키지 구성 * chore: task 간에 결합도를 줄이기 위한 인터페이스 구성 - 특정 step에서 만든 데이터를 다음 step에서 사용하는 경우가 있음(`JobExecutionContext`를 통해 데이터를 주고 받음) - `JobContextKeys`라는 인터페이스를 정의해 다른 task의 내부 변수를 직접 참조하지 않도록 함 * refactor: FastApiAdapter 및 JobContextKeys 적용 * refactor: schedule 패키지 domain 밖으로 분리 * refactor: AOP를 이용한 Tasklet 실행 로깅 중앙화 각 Tasklet 클래스 내부에 흩어져 있던 시작/종료 로그는 코드 중복을 유발하고, 비즈니스 로직의 가독성을 저해하는 문제가 있었습니다. 이 문제를 해결하기 위해, AOP를 사용하여 모든 Tasklet의 실행을 자동으로 로깅하는 `LoggingAspect`를 확장 구현합니다. ### 주요 변경 사항: - `LoggingAspect.java`에 `batch.tasklet` 패키지를 대상으로 하는 새로운 Pointcut(`taskletMethods`)을 추가했습니다. - `@Around` 어드바이스를 통해 모든 Tasklet의 실행 시작, 종료, 그리고 소요 시간을 자동으로 기록하도록 구현했습니다. ### 기대 효과: - **코드 중복 제거**: 각 Tasklet 클래스에 수동으로 작성했던 시작/종료 로그를 제거하여, 비즈니스 로직의 가독성을 크게 향상시킵니다. - **관심사의 분리(SoC)**: 핵심 로직과 로깅이라는 부가 기능 로직을 완벽하게 분리했습니다. * refactor: Code Formating * chore: 코드에 있는 job_id 전부 제거 1. middleware 수정해야함(경민) 2. pytest all pass * chore: poetry run black . * Loki e2e test support (#99) * chore: e2e loki test set up * fix: E2e test 클래스 수행 전 truncate * feat: 예시 데이터로 GPT한테 콘텐츠 생성 후 blogger에 업로드 성공 * feat: rag로 콘텐츠 생성 후 blogger 포스팅 테스트 통과 * feat: poetry run black * feat: WorkflowCardDto * feat: WorkflowMapper * feat: WorkflowMapper.xml * feat: WorkflowService * feat: Workflow관련 api Security에 추가 * fix: spotlessApply * RDB Log4j2 append (experimental) (#104) * chore: Workflow history 데이터베이스 input * chore: e2e test logger 세팅 단 * chore: Workflow logging example controller 이름 변경 Changes to be committed: renamed: src/main/java/site/icebang/domain/TestController.java -> src/main/java/site/icebang/domain/WorkflowLogInsertExampleController.java * chore: Production workflow log (RDB) 작성 * feat : HTML 요소 자동 추출 Util 파일 Selenium으로 HTML 가져오기 -> HTML 불필요한 태그 삭제 -> LLM 프롬프트로 요소 추출 자동화 현재 네이버, 티스토리 블로그 작동 확인 완료. 해당 파일 사용 시, 페이지 분석 및 상세한 프롬프트 작성 필수 * refactor : FAST API Response 리펙토링 (#105) * refactoring: 사용하지 않는 url 삭제 * refactoring: - keyword Response 리펙토링 - match Response 리펙토링 - search Response 리펙토링 - 공통 Response 리펙토링및 수정중 * refactor: product response 공통화 작업 * refactor: - service단 공통 response 적용 완료 - schemas.py 사용하지않은 파라미터 삭제 - api response result -> response_data로 명명규칙 공통화 완료 * feat: 공통 응답을위한 success,error,not_found util 개발 * chore: poetry의존성 추가 * test: response변경으로인한 테스트코드 수정 완료 * style: 코드 포맷팅 * chore: poetry.lock파일 update --------- Co-authored-by: kakusia <wtecho25@gmail.com> * chore : black 적용 및 주석 변경 * feat: 블로그 Rag기반 콘텐츠 생성 * feat: 블로그 Rag기반 콘텐츠 생성 테스트 코드 작성 완료 * chore: poetry run black . * chore: poetry run black . * test: 스프링 수동실행을위한 url 개발 (#110) * test: spring Fastapi testing * refactor: test-url response refactor * style: test-url response code formating --------- Co-authored-by: kakusia <wtecho25@gmail.com> * fix : local환경 docker-compose.yml network 추가 * feat: blog rag create endpoint * refactor: blog service 리팩토링 1. endpoint에 있는 if-else 서비스로 이동 2. 현재 있는 3개의 블로그 모두 포스팅 형식이 동일해서 factory method 적용 * chore: poetry run black . * fix: 필요없는 메서드 삭제 * fix: spotlessApply * 워크플로우 실행 및 Quartz 스케줄러 연동 (#106) * chore: workflow 도메인 모델 생성 * chore: Job 도메인 모델 생성 * refactor: schedule 도메인 디렉토리 위치 이동 * chore: Workflow 도메인관련 Mapper 및 Service 설정 * chore: execution 도메인 생성 및 mapper 설정 * chore: schedule 도메인 생성 및 mapper 설정 * chore: Java 표준 라이프사이클 어노테이션 설정 추가 * refactor: workflow 도메인 디렉토리 위치 변경 * refactor: ScheduleMapper 메서드명 변경 * feature: Workflow 수동 실행(REST API) * fix: 불필요한 주석 제거 * chore: 불필요한 의존성 제거 및 Spring Quartz 의존성 추가 * fix: 불필요한 batch 패키지 삭제 * fix: 불필요한 batch 패키지 삭제 * fix(deprecated): FastApiDto 수정 예정 * refactor: Spring 내장 스케줄러 삭제 * refactor: Spring 내장 스케줄러 설정 삭제 * fix: 불필요한 WorkflowJobMapper 삭제 * chore: job 도메인 세팅 * chore: JobRun 도메인 세팅 * chore: Schedule 도메인 세팅 * chore: Task 도메인 세팅 * chore: TaskRun 도메인 세팅 * chore: WorkflowRun 도메인 세팅 * chore: Workflow 도메인 세팅 * chore: Spring Quartz 세팅 * chore: MyBatis JsonNodeTypeHandler 세팅 * refactor: Code Formatting * fix: 불필요한 import 삭제 * refactor: execution(TaskRun, JobRun, WorkflowRun) 도메인 설정 * refactor: Quartz 관련 datasource 설정 필요 * refactor: Mapper.xml 수정 * refactor: Code Formatting * feat: RDB,Loki 로그 저장 logic 개발 * refactor: loging 쓸모없는 로그 주석및 하드코딩 삭제 * Spring boot Promtail을 통해 Loki log 전송 (#115) * chore: Loki Promtail을 통해 file 전송으로 변경 * chore: Promtail을 통해 loki 전송 (local) * chore: Exception handler error, warn logging - warn: Data duplicate - error: Exception * fix: spanid logging 추가 * chore: production grafana 설정 * chore: Promtail 복사 ci 작성 * chore: User-service promtail 이 후 container화 되도록 설정 * chore: Production, grafana 연동 세팅 * refactor: _default_mappings url 추가 * fix: E2e 수행 전 truncate를 각 테스트 시 수행 * refactor: - log pre-processing-app.log에 로그가 쌓이도록 코드 수정및 개발, 기존 loki코드 수정중 * feat: - Fastapi promtail local 개발 * style: FAST API 코드 포맷팅 --------- Co-authored-by: thkim7 <xogusrla7@gmail.com> Co-authored-by: Yousung Jung <jys01012@gmail.com> Co-authored-by: kakusia <wtecho25@gmail.com> Co-authored-by: bwnfo3 <142577603+bwnfo3@users.noreply.github.com> Co-authored-by: Jihu Kim <jihu0210@naver.com> Co-authored-by: bwnfo3 <bwnfo0702@gmail.com> Co-authored-by: JiHoon <fair0838@gmail.com> Co-authored-by: 조지훈 <78245504+rll2641@users.noreply.github.com>
Closed
2 tasks
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.
📝 작업 내용
🔗 관련 이슈
💬 추가 요청사항
✅ 체크리스트
코드 품질
테스트
배포 준비