You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using micrometer-tracing to correlate requests in Webflux applications we are able to access the underlying Observation withing the Reactor context as seen in this spring-boot issue: #33372
However, currently there's no way to access that information within a WebFilter, even though we set it up with the lowest precedence to trigger ServerHttpObservationFilter before it:
@Component
@Order(Ordered.LOWEST_PRECEDENCE)
class RequestLoggerPropagationFilter: WebFilter {
private val logger = LoggerFactory.getLogger(javaClass)
override fun filter(exchange: ServerWebExchange, chain: WebFilterChain): Mono<Void> {
return Mono.just(Unit)
.handle { t: Unit, u: SynchronousSink<Any> ->
logger.info("beginning request")
u.next(t)
}.flatMap {
chain.filter(exchange)
}
}
}
ServerHttpObservationFilter, which doesn't have any @order, is always invoked last, so there's no way the traceId/spanId can be accessed within our filters.
Would you consider adding an @ Order(X) to ServerHttpObservationFilter. This way we will be able to place our application WebFilters after it to propertly access correlation/observation info.
The text was updated successfully, but these errors were encountered:
We should update the WebFluxObservationAutoConfiguration and also ensure that the order is properly documented. As for the ordering value itself, it should probably be aligned with the MVC variant to be set ahead of the security filter.
bclozel
transferred this issue from spring-projects/spring-framework
Dec 2, 2022
bclozel
changed the title
ServerHttpObservationFilter lacks an @Order value
Reactive observation auto-configuration does not declare order for WebFilter
Dec 2, 2022
Affects: 6.0.2
When using
micrometer-tracing
to correlate requests in Webflux applications we are able to access the underlying Observation withing the Reactor context as seen in this spring-boot issue: #33372However, currently there's no way to access that information within a
WebFilter
, even though we set it up with the lowest precedence to triggerServerHttpObservationFilter
before it:ServerHttpObservationFilter
, which doesn't have any @order, is always invoked last, so there's no way the traceId/spanId can be accessed within our filters.Would you consider adding an @ Order(X) to
ServerHttpObservationFilter
. This way we will be able to place our application WebFilters after it to propertly access correlation/observation info.The text was updated successfully, but these errors were encountered: