Skip to content

Conversation

@Jjiggu
Copy link
Contributor

@Jjiggu Jjiggu commented Aug 1, 2025

작업 요약

prometheus grafana 추가

Issue Link

#206

문제점 및 어려움

해결 방안

Reference

Summary by CodeRabbit

  • 신규 기능

    • Prometheus 및 Grafana를 통한 모니터링 기능이 추가되었습니다.
  • 버그 수정

    • 인증 없이 접근 가능한 URL 패턴의 오타가 수정되었습니다.
  • 배포

    • 배포 프로세스가 개선되어 여러 파일을 한 번에 전송하고, 모니터링 관련 파일과 설정이 포함되었습니다.
  • 기타

    • Spring Boot Actuator 및 Micrometer Prometheus registry가 추가되어 모니터링 및 메트릭 수집이 가능해졌습니다.

@Jjiggu Jjiggu self-assigned this Aug 1, 2025
@Jjiggu Jjiggu added the enhancement New feature or request label Aug 1, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 1, 2025

Walkthrough

이 변경사항은 사용자 API 서비스에 Prometheus 및 Grafana 기반 모니터링을 통합하기 위한 작업입니다. 배포 워크플로우와 스크립트가 수정되어 모니터링 관련 파일과 서비스를 함께 배포하며, API 모듈에 Prometheus 의존성이 추가되고, 보안 설정에 관리 엔드포인트가 공개됩니다.

Changes

Cohort / File(s) Change Summary
GitHub Actions 워크플로우 및 배포 파일 전송
.github/workflows/deploy-user-docker.yml
DockerHub 로그인 액션을 v1에서 v2로 변경, Prometheus 설정 파일을 base64로 디코딩하여 생성, 여러 파일을 한 번에 SCP로 전송하도록 수정
모듈 의존성 및 모니터링 연동
nowait-app-user-api/build.gradle
Spring Boot Actuator 및 Micrometer Prometheus registry 의존성 추가
보안 설정
nowait-app-user-api/src/main/java/com/nowait/applicationuser/config/security/SecurityConfig.java
인증 없이 접근 가능한 URL 패턴 수정 및 /nowait/management/** 엔드포인트를 공개 목록에 추가
배포 스크립트 및 서비스 통합 기동
scripts/deploy-user-docker.sh
docker-compose.user-monitoring.yml 파일 추가, Prometheus 및 Grafana 컨테이너를 함께 배포 및 기동하도록 변경

Sequence Diagram(s)

sequenceDiagram
    participant DevOps as DevOps Workflow
    participant EC2 as EC2 Server
    participant App as nowait-app-user-api
    participant Prom as Prometheus
    participant Graf as Grafana

    DevOps->>DevOps: Decode prometheus.yml from secret
    DevOps->>EC2: SCP docker-compose.user.yml, docker-compose.user-monitoring.yml, prometheus.yml, deploy-user-docker.sh
    DevOps->>EC2: SSH run deploy-user-docker.sh
    EC2->>App: docker-compose up nowait-app-user-api
    EC2->>Prom: docker-compose up prometheus
    EC2->>Graf: docker-compose up grafana
    Prom->>App: Scrape metrics via actuator/prometheus
    Graf->>Prom: Query metrics for dashboards
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–20 minutes

Possibly related PRs

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 20bb038 and 118ebbd.

📒 Files selected for processing (4)
  • .github/workflows/deploy-user-docker.yml (2 hunks)
  • nowait-app-user-api/build.gradle (1 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/config/security/SecurityConfig.java (1 hunks)
  • scripts/deploy-user-docker.sh (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/deploy-user-docker.yml

50-50: the runner of "docker/login-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


84-84: expected scalar node for string value but found sequence node with "!!seq" tag

(syntax-check)


91-91: the runner of "docker/login-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (6)
nowait-app-user-api/build.gradle (2)

77-82: Actuator·Prometheus 의존성은 BOM이 버전 관리 중 — 명시적 버전 표기는 생략하거나 platform에 맞춰 주세요
Spring Boot 3의 BOM이 이미 spring-boot-starter-actuatormicrometer-registry-prometheus 버전을 고정하고 있으므로, 별도 버전 지정이 필요 없습니다. 명시적 버전이 없는 경우에는 괜찮지만, 만약 커스텀 버전을 써야 한다면 dependencyManagement 블록에서 관리하도록 권장합니다.
[ suggest_nitpick ]


83-85: spring-boot-starter-test 가 중복 선언됨
Line 44와 Line 84에서 동일한 의존성이 두 번 추가되어 빌드 로그에 “duplicate dependency” 경고가 발생합니다. 하나만 남기고 제거하세요.

-    // test
-    testImplementation 'org.springframework.boot:spring-boot-starter-test'

[ suggest_optional_refactor ]

Also applies to: 44-45

nowait-app-user-api/src/main/java/com/nowait/applicationuser/config/security/SecurityConfig.java (1)

72-74: 관리 엔드포인트 전체 공개는 보안 위험
/nowait/management/**permitAll() 로 열어두면 Actuator / 관리 엔드포인트가 인증 없이 노출됩니다. 최소한

management.endpoints.web.exposure.include=health,info,prometheus

처럼 필요한 endpoint 만 노출하고, IP 화이트리스트·Basic Auth 등 추가 보호를 고려해 주세요.
[ raise_critical_issue ]

scripts/deploy-user-docker.sh (1)

1-8: 스크립트 실패 시 즉시 중단되도록 보호하고 최신 compose 명령 사용 고려
현재 스크립트가 중간 단계에서 실패해도 이후 단계가 계속 실행될 위험이 있습니다.

-#!/bin/bash
+#!/usr/bin/env bash
+set -euo pipefail

또한 신규 Docker CLI에서는 docker compose(공백) 사용을 권장합니다. 내부 정책에 맞춰 docker-composedocker compose 로 변경하는 것도 고려해보세요.
[ suggest_essential_refactor ]

Also applies to: 19-22

.github/workflows/deploy-user-docker.yml (2)

83-88: source 필드 YAML 형식 오류 – 배열 대신 문자열이어야 함
appleboy/scp-actionsource 는 스칼라 문자열만 허용합니다. 현재 시퀀스 형태로 작성돼 있어 워크플로가 바로 실패합니다.

-          source:
-            - "docker-compose.user.yml"
-            - "docker-compose.user-monitoring.yml"
-            - "prometheus.yml"
-            - "scripts/deploy-user-docker.sh"
+          source: |
+            docker-compose.user.yml
+            docker-compose.user-monitoring.yml
+            prometheus.yml
+            scripts/deploy-user-docker.sh

[ raise_critical_issue ]


50-51: docker/login-action 최신 버전(v3)으로 업그레이드 권장
Actionlint 경고처럼 v2 러너가 오래되었습니다. v3 로 올리면 OCI registry 지원·속도가 개선됩니다.

-        uses: docker/login-action@v2
+        uses: docker/login-action@v3

두 군데(step 50, step 91) 모두 동일하게 수정해 주세요.
[ suggest_optional_refactor ]

Also applies to: 91-92

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/#206-prometheus-grafana

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot requested a review from HyemIin August 1, 2025 05:42
@Jjiggu Jjiggu merged commit e84ef82 into develop Aug 1, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants