Skip to content

No transactionId anymore in implementation classes of ErrorWebExceptionHandler #3564

Open
@sigriswil

Description

@sigriswil

Spring boot version: 3.3.2
Spring cloud dependencies version: 2023.0.3
sample issue spring cloud gateway repository: https://github.com/sigriswil/spring-gateway-sample

It contains a SpringBoot application that can be started locally. When reaching the endpoint /, it raises an exception which triggers the class GlobalErrorWebExceptionHandler which implements ErrorWebExceptionHandler.

In the main method, Hooks.enableAutomaticContextPropagation() and ContextRegistry.getInstance().registerThreadLocalAccessor(...) are called in FirstGatewayFilter.

Add the MDC's trasactionId to the FirstGatewayFilter, An exception occurs in the SecondGatewayFilterFactory.
transactionId is output from SecondGatewayFilterFactory and FirstGatewayFilter, but transactionId is not output from GlobalErrorWebExceptionHandler.

INFO 48248 --- c.e.s.FirstGatewayFilter: transactionId created. MDC: {transactionId=2e58da57-2f01-4d29-b63d-61b2e9682301}
INFO 48248 --- c.e.s.SecondGatewayFilterFactory: MDC: {transactionId=2e58da57-2f01-4d29-b63d-61b2e9682301}
ERROR 48248 --- c.e.s.GlobalErrorWebExceptionHandler: MDC: null
...
INFO 48248 --- c.e.s.FirstGatewayFilter: doFinally, MDC: {transactionId=2e58da57-2f01-4d29-b63d-61b2e9682301}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions