-
Notifications
You must be signed in to change notification settings - Fork 3
[FEAT/#447] 커스텀 대시보드·메트릭 및 request-id 로깅 추가 #452
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
Changes from all commits
cb0c0a0
e8fba97
206c8f5
3fc073f
f86fc0b
c30a1f5
ebcfe8c
16c2b76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package com.assu.server.global.filter; | ||
|
|
||
| import jakarta.servlet.FilterChain; | ||
| import jakarta.servlet.ServletException; | ||
| import jakarta.servlet.http.HttpServletRequest; | ||
| import jakarta.servlet.http.HttpServletResponse; | ||
| import org.slf4j.MDC; | ||
| import org.springframework.core.Ordered; | ||
| import org.springframework.core.annotation.Order; | ||
| import org.springframework.stereotype.Component; | ||
| import org.springframework.web.filter.OncePerRequestFilter; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.UUID; | ||
|
|
||
| @Component | ||
| @Order(Ordered.HIGHEST_PRECEDENCE) | ||
| public class RequestIdFilter extends OncePerRequestFilter { | ||
|
|
||
| public static final String REQUEST_ID_HEADER = "X-Request-Id"; | ||
| public static final String MDC_KEY = "requestId"; | ||
|
|
||
| @Override | ||
| protected void doFilterInternal( | ||
| HttpServletRequest request, | ||
| HttpServletResponse response, | ||
| FilterChain filterChain) | ||
| throws ServletException, IOException { | ||
| String requestId = UUID.randomUUID().toString(); | ||
| MDC.put(MDC_KEY, requestId); | ||
| response.setHeader(REQUEST_ID_HEADER, requestId); | ||
| try { | ||
| filterChain.doFilter(request, response); | ||
| } finally { | ||
| MDC.remove(MDC_KEY); | ||
|
Comment on lines
+29
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
rg -n -P 'DeferredResult|WebAsyncTask|Callable<|SseEmitter|ResponseBodyEmitter|StreamingResponseBody|CompletionStage|CompletableFuture|`@Async`|WebSocket|Stomp' src/main/java
rg -n -P 'TaskDecorator|ContextSnapshot|ThreadLocalAccessor|MDC\.|RequestIdFilter' src/main/javaRepository: ASSU-dev/ASSU_BE Length of output: 4398 🤖 get_repo_knowledge executed:
Length of output: 3766 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- RequestIdFilter ---'
cat -n src/main/java/com/assu/server/global/filter/RequestIdFilter.java
printf '%s\n' '--- async configuration and uses ---'
rg -n -C 5 '`@EnableAsync`|AsyncConfigurer|TaskDecorator|ThreadPoolTaskExecutor|`@Async`|DeferredResult|WebAsyncTask|Callable<|SseEmitter|ResponseBodyEmitter|StreamingResponseBody|CompletionStage|CompletableFuture' src/main/java
printf '%s\n' '--- filter registration and MVC configuration ---'
rg -n -C 5 'RequestIdFilter|FilterRegistrationBean|OncePerRequestFilter|WebMvcConfigurer|AsyncSupportConfigurer|setTaskExecutor|setCallableInterceptors|setDeferredResultInterceptors' src/main/javaRepository: ASSU-dev/ASSU_BE Length of output: 10078 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- filter source ---'
cat -n src/main/java/com/assu/server/global/filter/RequestIdFilter.java
printf '%s\n' '--- async methods and their callers ---'
rg -n -C 8 '`@Async`|NotificationRetryEventHandler|ReportStatusSyncService' src/main/java
printf '%s\n' '--- async/MDC infrastructure ---'
rg -n -C 5 '`@EnableAsync`|AsyncConfigurer|TaskDecorator|ThreadPoolTaskExecutor|MDC\.|RequestIdFilter' src/main/javaRepository: ASSU-dev/ASSU_BE Length of output: 10052 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- async enablement and event publication ---'
rg -n -C 6 '`@EnableAsync`|ReportProcessedEvent|NotificationFailedEvent|publishEvent|ApplicationEventPublisher' src/main/java
printf '%s\n' '--- relevant event handler bodies ---'
cat -n src/main/java/com/assu/server/domain/report/service/ReportStatusSyncService.java
cat -n src/main/java/com/assu/server/domain/notification/service/NotificationRetryEventHandler.javaRepository: ASSU-dev/ASSU_BE Length of output: 50372 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
rg -n -C 8 'ReportProcessedEvent|NotificationFailedEvent|publishEvent|ApplicationEventPublisher|Executors|schedule\(' src/main/java
rg -n '`@EnableAsync`|TaskDecorator|ContextSnapshot|MDC' src/main/javaRepository: ASSU-dev/ASSU_BE Length of output: 50372 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- report HTTP entry point and async enablement ---'
rg -n -C 6 'reportContent\(|ReportService|`@EnableAsync`|task:annotation-driven' src/main/java src/main/resourcesRepository: ASSU-dev/ASSU_BE Length of output: 27567
이 경로는 MVC 🤖 Prompt for AI AgentsSource: MCP tools |
||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
4칸 들여쓰기를 사용하세요.
Line 31의
meterRegistry필드는 탭으로 들여쓰기되어 있습니다. 탭을 4개의 공백으로 변경하세요.As per coding guidelines:
src/main/java/com/assu/server/**/*.java는 Java 17과 4-space indentation을 사용해야 합니다.🤖 Prompt for AI Agents
Source: Coding guidelines