[Improvement] Correlate error responses with server logs via request IDs
- Dominant language
- Java
- Stars
- 3.2k
- Forks
- 935
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 298
Description
### What would you like to be improved?
#12728 set two conditions for omitting stack traces from error responses (https://github.com/apache/gravitino/issues/12728#issuecomment-5531267707 by @markhoerth):
1. When the stack is omitted from the response, it must be logged server-side at the point the exception is mapped.
2. The log line and the response carry a shared request ID, so a user report can be tied to the server log entry.
#13057 makes stack traces configurable and adds server-side logging on some paths (unexpected authentication failures, the authorization path), but it does not deliver either condition in full, and nothing tracks them yet.
The desired outcome is the two conditions from #12728: a reported error response can be matched to its server log entry through a shared request ID, and every path that omits the stack from a response still logs the underlying exception server-side.
It is not yet clear whether Gravitino supports request IDs or log correlation today. A search of `server`, `server-common` and `core` main code found no request ID in error responses and no MDC-based log correlation.
### How should we improve?
Open questions for triage:
- Does Gravitino already have, or want, a per-request ID (for example an `X-Request-Id` header) that can appear in both the error response and the log line?
- Which error paths should log the underlying exception when the stack is omitted? Paths noted during #13057 that currently don't log it include the Jersey 4xx exception mappers (JSON parse/mapping, not found, parameter, `WebApplicationException`), the `VersioningFilter` 406, and the known-exception branches of `LanceExceptionMapper`.
- Should this be solved per server, or together with the error-mapping discussion in #13107?
Related: #12728, #13057, #13107.
Contributor guide
Assessment
This issue has not been assessed yet.