The WebRequestTrackingFilter uses ThreadLocal to store state. This state is not cleaned up in a finally-clause, but it's cleaned up on this line. That line is never reached if chain.doFilter throws an exception since the exception handling rethrows the exception.
By the way, wouldn't the rethrow make it impossible to correlate the exception with the request? Since no telemetry in sent with request information? How does that correlation work?
By the way2: It's good practice to have classes not marked with final and use protected for fields and methods when writing libraries. When bugs such as these occur, it is much easier for clients to deal with them. With the code as it stands now, I'm left with forking the project and releasing an in-house version with a fix, or copy all the code into my code base.
The
WebRequestTrackingFilterusesThreadLocalto store state. This state is not cleaned up in afinally-clause, but it's cleaned up on this line. That line is never reached ifchain.doFilterthrows an exception since the exception handling rethrows the exception.By the way, wouldn't the rethrow make it impossible to correlate the exception with the request? Since no telemetry in sent with request information? How does that correlation work?
By the way2: It's good practice to have classes not marked with
finaland useprotectedfor fields and methods when writing libraries. When bugs such as these occur, it is much easier for clients to deal with them. With the code as it stands now, I'm left with forking the project and releasing an in-house version with a fix, or copy all the code into my code base.