Make QueryAnalyzers to hold a state and hook to middleware
What does this MR do and why?
This is based on top of !74078 (merged), which needs to be merged first.
The prior fully dynamic approach for QueryAnalyzer
was complex to get it right
as presented by prior state of and random failures: !73839 (merged).
This extends the top of !73827 (merged).
One of the problems of QueryAnalyzers is that their state is evaluated each time. This is problematic for various reasons as we need to re-evaluate feature flags, or other dynamic conditions. Sometimes we cannot simply access the feature flag.
This makes QueryAnalyzers behavior sticky. The enabled flag is checked exactly once for each request/worker/spec. If it resolves to true, the query analyzer will be enabled for the whole execution of a job.
This makes also QueryAnalyzer to hold a context that is set/reset on boundaries of job execution.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.