generated from pricelees/issue-pr-template
refactor: Actuator 트레이싱 제외 로직 common.web 모듈 이동 및 service 모듈에서의 스케쥴링 작업 제외
This commit is contained in:
parent
7ce6fce8f5
commit
31f15aa80c
@ -1,28 +1,20 @@
|
|||||||
package com.sangdol.roomescape.common.config
|
package com.sangdol.roomescape.common.config
|
||||||
|
|
||||||
import io.micrometer.observation.ObservationPredicate
|
import io.micrometer.observation.ObservationPredicate
|
||||||
import jakarta.servlet.http.HttpServletRequest
|
|
||||||
import org.springframework.beans.factory.annotation.Value
|
|
||||||
import org.springframework.context.annotation.Bean
|
import org.springframework.context.annotation.Bean
|
||||||
import org.springframework.context.annotation.Configuration
|
import org.springframework.context.annotation.Configuration
|
||||||
import org.springframework.http.server.observation.ServerRequestObservationContext
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
class TraceConfig(
|
class TraceConfig {
|
||||||
@Value("\${management.endpoints.web.base-path}") private val actuatorPath: String
|
|
||||||
) {
|
|
||||||
|
|
||||||
@Bean
|
companion object {
|
||||||
fun excludeActuatorPredicate(): ObservationPredicate {
|
val scheduleTaskName = "tasks.scheduled.execution"
|
||||||
return ObservationPredicate { _, context ->
|
|
||||||
if (context !is ServerRequestObservationContext) {
|
|
||||||
return@ObservationPredicate true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val servletRequest: HttpServletRequest = context.carrier
|
@Bean
|
||||||
val requestUri = servletRequest.requestURI
|
fun excludeSchedulerPredicate(): ObservationPredicate {
|
||||||
|
return ObservationPredicate { name, context ->
|
||||||
!requestUri.contains(actuatorPath)
|
!name.equals(scheduleTaskName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user