spring-projects / spring-projects/spring-security
Multiple traces are generated for failing requests
@jzheaux is already working on this.
Since Feb 2, 2023.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
Describe the bug
When a REST request fails, duplicate traces are generated. This behavior exists for authentication errors (e.g. unauthenticated -> 401), as well as for other errors dispatching to the error page (e.g. wrong URL -> 404).
It seems that requests which are dispatched to the error page by the framework, get a fresh observation and thus traceId, instead of taking any existing observation which was generated by the initial request handling.
The result in Grafana looks similar to this:
example with 404

Tested with SpringBoot 3.0.2, Spring Security 6.0.1
To Reproduce
Fire a request against a secured RestController method, without authentication token.
or
Fire a request with a wrong URL which will result in a 404.
Expected behavior
A single traceId should be generated, dispatched requests should reuse the original traceId
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.