Skip to content

Conversation

@ggamnunq
Copy link
Contributor

@ggamnunq ggamnunq commented Sep 6, 2025

  • 스웨거 요청은 aop 제외
  • 로그인 필요없는 요청(스웨거)에서 getCurrentUser() null 안전처리

Summary by CodeRabbit

  • Bug Fixes

    • Improved stability by preventing rare errors during request handling when user information is unavailable.
  • Chores

    • Reduced logging noise by excluding system and documentation endpoints from request logs.
    • Updated logging to handle missing user context gracefully without impacting normal operations.

  - 스웨거 요청은 aop 제외
  - 로그인 필요없는 요청(스웨거)에서 getCurrentUser() null 안전처리
@ggamnunq ggamnunq self-assigned this Sep 6, 2025
@ggamnunq ggamnunq merged commit 742ada3 into main Sep 6, 2025
1 check passed
@coderabbitai
Copy link

coderabbitai bot commented Sep 6, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The aspect for API request logging was updated to safely retrieve the current user using runCatching, make user references nullable in logs, and skip logging for Swagger, API docs, and actuator endpoints by early-returning in the around advice.

Changes

Cohort / File(s) Summary of Changes
AOP Logging
src/main/kotlin/busanVibe/busan/global/aop/logging/ApiRequestLogAspect.kt
- Wrap current user retrieval with runCatching; use nullable user in logs
- Add URI guards to bypass logging for /swagger, /v3/api-docs, /actuator paths
- Update before/after log lines to use currentUser?.id
- Preserve method signature fun logApiRequest(jp: ProceedingJoinPoint): Any

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant Aspect as ApiRequestLogAspect
  participant Controller

  Client->>Aspect: HTTP Request
  rect rgba(200,200,255,0.2)
    Note over Aspect: Around advice entry
    Aspect->>Aspect: Check URI prefix (/swagger, /v3/api-docs, /actuator)
    alt Excluded endpoint
      Aspect->>Controller: proceed()
      Controller-->>Aspect: result
      Aspect-->>Client: result
    else Logged endpoint
      Aspect->>Aspect: runCatching { AuthService().getCurrentUser() }
      Note over Aspect: currentUser may be null
      Aspect->>Aspect: Log "start" with currentUser?.id
      Aspect->>Controller: proceed()
      Controller-->>Aspect: result
      Aspect->>Aspect: Log "end" with currentUser?.id
      Aspect-->>Client: result
    end
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I hop through logs with gentle cheer,
Skipping docs and health checks near;
If user’s shy, I won’t insist—
A nullable wink in the request list.
Start, end, proceed—so neat, so bright—
Carrots for clean control flow tonight! 🥕✨


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 65ef569 and 4127d26.

📒 Files selected for processing (1)
  • src/main/kotlin/busanVibe/busan/global/aop/logging/ApiRequestLogAspect.kt (2 hunks)

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants