Provide a robust CDI way to inject request_ids
- Dominant language
- Java
- Stars
- 2.1k
- Forks
- 522
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 137
Description
### Is your feature request related to a problem? Please describe.
Currently, there is no robust way to inject request_id using CDI. Approaches such as the following has been used in code.
https://github.com/apache/polaris/blob/64b13a9915274a04e82a12c9fdcd095d12797ca0/runtime/service/src/main/java/org/apache/polaris/service/events/PolarisEventMetadataFactory.java#L111-L120
However, they only work for REST calls.
### Describe the solution you'd like
As suggested by @dimas-b in https://github.com/apache/polaris/pull/3414/changes/BASE..4b6234774c01f3197f2aa78e79dc5d5cbe488ba7#r2692150954,
> Please see how TaskExecutorImpl deals with realm IDs. A similar CDI pattern is probably necessary for request
IDs, except that we may not have to produce a request ID for background tasks. I do not have an opinion on whether request IDs should be propagated from REST requests to related async tasks or not. However, CDI must be solid and not cause runtime exceptions even if the request ID is not propagated.
Create a CDI pattern to inject request_ids.
### Describe alternatives you've considered
Approaches tried so far include using REST context or SLF4J logging MDC, but both have their shortcomings.
https://github.com/apache/polaris/blob/64b13a9915274a04e82a12c9fdcd095d12797ca0/runtime/service/src/main/java/org/apache/polaris/service/events/PolarisEventMetadataFactory.java#L111-L120
### Additional context
_No response_
Contributor guide
Research direction
Start by reading TaskExecutorImpl for its realm-ID CDI pattern and the linked PolarisEventMetadataFactory code in runtime/service/src/main/java/org/apache/polaris/service/events/PolarisEventMetadataFactory.java. Determine how request IDs should be available for REST and background tasks, with CDI remaining safe when no request ID is propagated; the issue leaves propagation behavior unresolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100