Skip to content

Conversation

@DingWoonee
Copy link
Contributor

@DingWoonee DingWoonee commented Jan 1, 2026

서버 트레이싱 분석

image

티어표 화면을 요청하면 "티어표 식당 데이터 조회(1번)"와 "지도 데이터 조회(2번)"가 순차적으로 이루어짐.

  • 티어표 화면에서 처음부터 지도 데이터가 필요하지 않음 → 지도 데이터는 js로 받아오자.
  • 현재 테이블에 걸려있는 인덱스는 PK 밖에 없음 ㅋㅋ → 최소한의 인덱스만 추가하자

DB 접근 개선

@DingWoonee DingWoonee self-assigned this Jan 1, 2026
@DingWoonee DingWoonee added AI Review Request coderabbitai 리뷰 요청 performance Performance problem detected labels Jan 1, 2026
@DingWoonee DingWoonee linked an issue Jan 1, 2026 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Jan 1, 2026

📝 Walkthrough

Walkthrough

이 변경은 애플리케이션에 Micrometer Observations(Observed) 기반 계측과 Zipkin 분산 추적을 통합합니다. 주요 변경 사항: GitHub Actions의 pull_request 트리거 활성화, Docker Compose에 Zipkin 서비스 추가, Gradle에 Brave/Zipkin 관련 의존성 추가, 컨트롤러·서비스·레포지토리 메서드에 @Observed 주석 추가, application.yml 및 환경별 설정(application-local.yml, application-prod.yml)에 관찰·Zipkin 설정 추가.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Client as 클라이언트
    participant Controller as RestaurantChartController
    participant Service as RestaurantChartService
    participant Repository as Repository (Chart/CoreInfo)
    participant Zipkin as Zipkin

    rect rgb(240,248,255)
    Note over Client,Controller: HTTP 요청
    Client->>Controller: tier() 엔드포인트 호출
    end

    rect rgb(245,255,240)
    Note over Controller,Service: `@Observed` 계측 적용
    Controller->>Service: 비즈니스 로직 호출
    Service->>Repository: DB 조회 (Observed)
    Repository-->>Service: 쿼리 결과 반환
    Service-->>Controller: 응답 생성
    end

    rect rgb(255,250,240)
    Note over Service,Zipkin: Micrometer Tracing -> Zipkin 전송
    Service->>Zipkin: 스팬 전송 (HTTP /api/v2/spans)
    Zipkin-->>Service: 수신 확인
    end

    Controller->>Client: HTTP 응답 반환
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive PR 설명이 부분적으로 작성되었으나 필수 섹션인 'PR 유형'이 누락되어 있습니다. PR 설명 템플릿의 'PR 유형' 섹션을 완성하여 변경사항의 카테고리(기능 추가, 버그 수정, 리팩토링 등)를 명확하게 표시해주세요.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목은 '티어표 로딩 속도'로 성능 개선에 대한 내용을 담고 있으며, 변경 사항의 핵심(Zipkin 추적 및 Micrometer 계측 도입을 통한 성능 모니터링)을 부분적으로 반영합니다.
✨ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Jan 1, 2026

🧪 소형(단위) 테스트 결과

106 tests   106 ✅  2s ⏱️
 28 suites    0 💤
 28 files      0 ❌

Results for commit c148025.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Jan 1, 2026

🚀 중형(통합) 테스트 결과

9 tests   9 ✅  0s ⏱️
1 suites  0 💤
1 files    0 ❌

Results for commit c148025.

♻️ This comment has been updated with latest results.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
infra/docker/kustaurant/docker-compose.yml (1)

69-74: Zipkin 서비스 설정 확인 - 버전 고정 권장

Zipkin 서비스가 올바르게 설정되었습니다. 포트 9411은 표준이며, application.yml의 엔드포인트 설정과 일치합니다.

프로덕션 환경의 안정성과 재현성을 위해 :latest 태그 대신 특정 버전을 고정하는 것을 권장합니다:

🔎 제안하는 변경사항
  zipkin:
-    image: openzipkin/zipkin:latest
+    image: openzipkin/zipkin:3.4
    container_name: kustaurant-zipkin
    ports:
      - "9411:9411"
    restart: unless-stopped
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61c0286 and b104d0a.

📒 Files selected for processing (8)
  • .github/workflows/deploy.yml
  • infra/docker/kustaurant/docker-compose.yml
  • server/kustaurant/build.gradle
  • server/kustaurant/src/main/java/com/kustaurant/kustaurant/restaurant/query/chart/controller/RestaurantChartController.java
  • server/kustaurant/src/main/java/com/kustaurant/kustaurant/restaurant/query/chart/service/RestaurantChartService.java
  • server/kustaurant/src/main/java/com/kustaurant/kustaurant/restaurant/query/common/infrastructure/repository/RestaurantChartRepositoryImpl.java
  • server/kustaurant/src/main/java/com/kustaurant/kustaurant/restaurant/query/common/infrastructure/repository/RestaurantCoreInfoRepository.java
  • server/kustaurant/src/main/resources/application.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 🛠️ 변경된 경우 Kustaurant 빌드 및 푸쉬
  • GitHub Check: 🚀 중형 테스트
  • GitHub Check: 🧪 소형 테스트
🔇 Additional comments (7)
infra/docker/kustaurant/docker-compose.yml (1)

67-67: 재시작 정책 추가 - 좋습니다

mysqld-exporter 서비스에 재시작 정책을 추가한 것은 다른 서비스들과의 일관성을 유지하고 안정성을 향상시킵니다.

server/kustaurant/src/main/resources/application.yml (1)

2-2: 애플리케이션 이름 설정 - 좋습니다

분산 트레이싱을 위한 필수 설정입니다. Zipkin에서 서비스를 식별하는 데 사용됩니다.

server/kustaurant/src/main/java/com/kustaurant/kustaurant/restaurant/query/chart/controller/RestaurantChartController.java (1)

11-11: 관찰성 애노테이션의 일관된 적용 확인

@Observed 애노테이션이 tier() 컨트롤러 메서드에 적절히 추가되었으며, 코드베이스 전반에 걸쳐 네이밍 컨벤션이 일관성 있게 적용되어 있습니다.

검증된 패턴:

  • 컨트롤러: tier.controller
  • 서비스: tier.service.findBasePage, tier.service.findByConditions, tier.service.getRestaurantTierMapDto
  • 리포지토리: tier.repository.getRestaurantIdsWithPage, tier.repository.getRestaurantTiersBase

PR 목적(티어표 로딩 속도 개선)에 부합하는 성능 모니터링 구성입니다.

server/kustaurant/build.gradle (1)

83-86: 트레이싱 의존성 추가 확인

Micrometer와 Zipkin 트레이싱을 위한 표준 의존성이 올바르게 추가되었습니다. Spring Boot 3.5.6의 의존성 관리를 통해 버전이 자동으로 관리되며, io.micrometer:micrometer-tracing-bridge-brave와 io.zipkin.reporter2:zipkin-reporter-brave는 Spring Boot 공식 문서에서 권장하는 표준 조합입니다.

server/kustaurant/src/main/java/com/kustaurant/kustaurant/restaurant/query/common/infrastructure/repository/RestaurantChartRepositoryImpl.java (1)

14-14: 관찰성 계층 추가 승인

리포지토리 메서드에 @Observed 어노테이션을 추가하여 성능 모니터링을 위한 트레이싱을 활성화한 것은 적절합니다. 네이밍 컨벤션도 일관성 있게 적용되었습니다.

Also applies to: 36-36

server/kustaurant/src/main/java/com/kustaurant/kustaurant/restaurant/query/common/infrastructure/repository/RestaurantCoreInfoRepository.java (1)

23-23: 리포지토리 관찰성 계층 추가 승인

복잡한 조인 쿼리를 수행하는 메서드에 @Observed 어노테이션을 추가한 것은 성능 병목 지점을 파악하는 데 도움이 됩니다. 구현이 정확합니다.

Also applies to: 39-39

server/kustaurant/src/main/java/com/kustaurant/kustaurant/restaurant/query/chart/service/RestaurantChartService.java (1)

55-55: 서비스 계층 관찰성 추가 승인

서비스 메서드들에 @Observed 어노테이션을 추가하여 리포지토리 계층과 함께 전체 호출 체인을 추적할 수 있게 되었습니다. 네이밍 컨벤션이 일관되게 적용되었습니다.

단, 캐시 비활성화 이슈가 해결되어야 전체 성능 최적화 목표를 달성할 수 있습니다.

Also applies to: 85-85

Comment on lines +7 to +8
pull_request:
types: [ opened, reopened, synchronize, ready_for_review ]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/deploy.yml

Repository: kustaurant/BackEnd-integration

Length of output: 12225


🏁 Script executed:

git log --oneline --all -20 -- .github/workflows/deploy.yml

Repository: kustaurant/BackEnd-integration

Length of output: 536


PR 이벤트로 인한 의도하지 않은 배포 위험 (확인됨)

라인 7-8의 pull_request 트리거는 kustaurant-deploy(라인 128)와 crawler-deploy(라인 215)의 배포 작업을 실행합니다. 이 배포 작업들은 if: needs.detect-changes.outputs.kustaurant == 'true'와 같은 경로 기반 조건만 가지고 있으며, 이벤트 타입 검증(if: github.event_name == 'push')이 없습니다. 따라서 PR에서 관련 파일이 변경되면 프로덕션 배포가 실행됩니다.

추가적으로, detect-changes 작업(라인 24)이 github.event.before를 사용하는데, 이는 PR 이벤트에서 정의되지 않아 경로 감지 로직이 의도대로 작동하지 않을 수 있습니다.

커밋 메시지에서 "임시로"라고 명시되었으므로, 이 PR을 머지하기 전에 반드시 제거되거나 다음과 같이 수정되어야 합니다:

  • 배포 작업에 if: github.event_name == 'push' 조건 추가
  • 또는 PR 환경에서 경로 감지가 올바르게 작동하도록 detect-changes 작업 수정
🤖 Prompt for AI Agents
.github/workflows/deploy.yml lines 7-8: the pull_request trigger combined with
deployment jobs that only check path-based outputs can cause unintended
deployments on PRs and detect-changes uses github.event.before which is
undefined for PRs; update the workflow so deployment jobs include an explicit
event check (e.g., add if: github.event_name == 'push' to kustaurant-deploy and
crawler-deploy) OR change detect-changes to reliably handle PRs (use
github.event.pull_request.base.sha/ head.sha or adjust the action inputs to
compare against the correct refs) so path detection works in PRs, and remove the
temporary "임시로" behavior before merging.

Comment on lines 58 to 67
# tracing
tracing:
sampling:
probability: 1.0
zipkin:
tracing:
endpoint: http://localhost:9411/api/v2/spans
observations:
annotations:
enabled: true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

트레이싱 샘플링 비율 - 프로덕션 환경 고려 필요

트레이싱 설정이 올바르게 구성되었습니다. 하지만 probability: 1.0 (100% 샘플링)은 개발/디버깅 환경에는 적합하지만, 프로덕션 환경에서는 다음과 같은 문제를 야기할 수 있습니다:

  • 높은 성능 오버헤드 (모든 요청에 대한 트레이스 수집)
  • Zipkin 스토리지 및 네트워크 부하 증가
  • 트레이싱 자체가 성능 병목이 될 수 있음
🔎 프로덕션 환경을 위한 권장 설정

프로필별로 샘플링 비율을 다르게 설정하는 것을 권장합니다:

application-prod.yml 파일 생성:

management:
  tracing:
    sampling:
      probability: 0.1  # 프로덕션: 10% 샘플링

application-dev.yml 또는 기본 설정 유지:

management:
  tracing:
    sampling:
      probability: 1.0  # 개발: 100% 샘플링

또는 환경 변수로 제어:

management:
  tracing:
    sampling:
      probability: ${TRACING_SAMPLING_PROBABILITY:0.1}
🤖 Prompt for AI Agents
In server/kustaurant/src/main/resources/application.yml around lines 58 to 67,
the tracing sampling is set to probability: 1.0 which is unsafe for production;
update configuration to use profile-specific or environment-controlled sampling
(e.g., move sampling under management.tracing.sampling and create an
application-prod.yml that sets a lower probability such as 0.1, keep 1.0 for dev
or default, or reference an environment variable like
${TRACING_SAMPLING_PROBABILITY:0.1}) so production traffic is sampled at a lower
rate while development can retain full sampling.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b104d0a and b780f67.

📒 Files selected for processing (3)
  • server/kustaurant/src/main/resources/application-local.yml
  • server/kustaurant/src/main/resources/application-prod.yml
  • server/kustaurant/src/main/resources/application.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • server/kustaurant/src/main/resources/application.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: 🛠️ 변경된 경우 Kustaurant 빌드 및 푸쉬
  • GitHub Check: 🚀 중형 테스트
🔇 Additional comments (1)
server/kustaurant/src/main/resources/application-local.yml (1)

28-31: Zipkin 로컬 개발 환경 설정 확인 완료

Zipkin 트레이싱 설정이 올바르게 구성되었습니다:

  • Docker Compose에 Zipkin 서비스가 9411 포트로 정의됨
  • application.yml에 샘플링 확률 1.0으로 설정됨
  • application-local.yml에서 올바른 엔드포인트(http://localhost:9411/api/v2/spans) 지정됨

로컬 개발 시 docker-compose up으로 Zipkin이 함께 구동되므로 추가 설정 불필요합니다.

Comment on lines +34 to +37
management:
zipkin:
tracing:
endpoint: http://zipkin:9411/api/v2/spans
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Explore repository structure to understand the project layout
echo "=== Repository structure ==="
find . -type f -name "*.yml" -o -name "*.yaml" | grep -E "(docker|compose|kube|manifest|prod)" | head -20

Repository: kustaurant/BackEnd-integration

Length of output: 446


🏁 Script executed:

#!/bin/bash
# Check if the application-prod.yml file exists and view context around lines 34-37
if [ -f "server/kustaurant/src/main/resources/application-prod.yml" ]; then
  echo "=== application-prod.yml (full file) ==="
  cat -n "server/kustaurant/src/main/resources/application-prod.yml"
else
  echo "File not found at specified path"
  find . -name "application-prod.yml" -type f 2>/dev/null
fi

Repository: kustaurant/BackEnd-integration

Length of output: 1140


🏁 Script executed:

#!/bin/bash
# Search for Docker Compose files
echo "=== Docker Compose files ==="
fd -e yml -e yaml | grep -iE "(docker-compose|compose)" | head -10

# Search for Kubernetes manifests
echo -e "\n=== Kubernetes manifest files ==="
fd -e yml -e yaml | grep -iE "(deployment|service|manifest|kube)" | head -10

Repository: kustaurant/BackEnd-integration

Length of output: 313


🏁 Script executed:

#!/bin/bash
# Search for tracing and sampling configurations across the codebase
echo "=== Sampling configurations in application files ==="
fd "application" -e yml -e yaml --exec grep -l "sampling\|sampler" {} \;

echo -e "\n=== Zipkin-related properties ==="
fd "application" -e yml -e yaml --exec grep -i "zipkin" {} \; -print

Repository: kustaurant/BackEnd-integration

Length of output: 464


🏁 Script executed:

#!/bin/bash
# View the Docker Compose production file for kustaurant to check zipkin service
echo "=== Docker Compose Production File ==="
cat -n "infra/docker/kustaurant/docker-compose.prod.yml"

Repository: kustaurant/BackEnd-integration

Length of output: 506


🏁 Script executed:

#!/bin/bash
# View application.yml to check for sampling configuration
echo "=== application.yml (default profile) ==="
cat -n "server/kustaurant/src/main/resources/application.yml"

Repository: kustaurant/BackEnd-integration

Length of output: 3086


🏁 Script executed:

#!/bin/bash
# Search for all zipkin-related configurations
echo "=== Searching for zipkin configurations ==="
rg -i "zipkin" --type yml

Repository: kustaurant/BackEnd-integration

Length of output: 162


🏁 Script executed:

#!/bin/bash
# Search for tracing and sampling configurations
echo "=== Searching for sampling/tracing configurations ==="
rg -i "sampling|sampler|tracing" --type yml

Repository: kustaurant/BackEnd-integration

Length of output: 172


🏁 Script executed:

#!/bin/bash
# Search for zipkin configurations without type filter
echo "=== Searching for zipkin configurations ==="
rg -i "zipkin" .

echo -e "\n=== Searching for sampling configurations ==="
rg -i "sampling|sampler" .

Repository: kustaurant/BackEnd-integration

Length of output: 50387


🏁 Script executed:

#!/bin/bash
# Check if there are other docker-compose files or if zipkin is defined elsewhere
echo "=== All docker-compose files content ==="
for file in $(find . -name "docker-compose*.yml" -o -name "docker-compose*.yaml"); do
  echo "=== File: $file ==="
  cat "$file"
  echo ""
done

Repository: kustaurant/BackEnd-integration

Length of output: 3654


프로덕션 환경에서 트레이싱 샘플링 비율 조정 필수

Zipkin 엔드포인트 설정은 올바르게 구성되었으며, Docker Compose에서 zipkin 서비스가 올바르게 정의되고 9411 포트가 노출되어 있습니다. 다만 프로덕션 배포 전에 다음을 반드시 처리해야 합니다:

샘플링 설정 문제: application.ymlmanagement.tracing.sampling.probability: 1.0 (100% 샘플링)이 application-prod.yml에서 오버라이드되지 않아, 프로덕션 환경에서도 모든 트레이스를 수집하게 됩니다. 이는 성능에 심각한 영향을 미칩니다.

필요한 조치:

  • application-prod.yml에서 샘플링 비율을 프로덕션 수준으로 명시 설정 (예: 0.1~0.2)
management:
  tracing:
    sampling:
      probability: 0.1
  zipkin:
    tracing:
      endpoint: http://zipkin:9411/api/v2/spans
🤖 Prompt for AI Agents
In server/kustaurant/src/main/resources/application-prod.yml around lines 34-37,
the production config sets the Zipkin endpoint but does not override sampling,
so the global 100% sampling remains active; update the prod YAML to explicitly
set management.tracing.sampling.probability to a production-appropriate value
(e.g., 0.1–0.2) under the management.tracing.sampling path so sampling is
reduced in production while keeping the existing zipkin endpoint configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Review Request coderabbitai 리뷰 요청 performance Performance problem detected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[perf] 티어표 로딩 속도

2 participants