generated from pricelees/issue-pr-template
feat: 트레이싱시 actuator 관련 엔드포인트 제거 설정
This commit is contained in:
parent
f04d521029
commit
7ce6fce8f5
@ -0,0 +1,28 @@
|
|||||||
|
package com.sangdol.roomescape.common.config
|
||||||
|
|
||||||
|
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.Configuration
|
||||||
|
import org.springframework.http.server.observation.ServerRequestObservationContext
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
class TraceConfig(
|
||||||
|
@Value("\${management.endpoints.web.base-path}") private val actuatorPath: String
|
||||||
|
) {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
fun excludeActuatorPredicate(): ObservationPredicate {
|
||||||
|
return ObservationPredicate { _, context ->
|
||||||
|
if (context !is ServerRequestObservationContext) {
|
||||||
|
return@ObservationPredicate true
|
||||||
|
}
|
||||||
|
|
||||||
|
val servletRequest: HttpServletRequest = context.carrier
|
||||||
|
val requestUri = servletRequest.requestURI
|
||||||
|
|
||||||
|
!requestUri.contains(actuatorPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user