-
Notifications
You must be signed in to change notification settings - Fork 342
[Cosmos] Replace global evaluation store with pipeline-level context for fault injection diagnostics #4022
Description
The fault injection evaluation store (EVALUATION_STORE in fault_injection/mod.rs) uses a global LazyLock<Mutex<HashMap<u64, Vec<FaultInjectionEvaluation>>>> to pass evaluation results from FaultClient (at the HttpClient level) to the transport pipeline (which has access to DiagnosticsContextBuilder).
This works but is clunky — it requires a store/take contract, uses a global static, and passes correlation IDs via request headers.
When the driver has its own HTTP pipeline with a custom context object (rather than using azure_core::HttpClient trait), the evaluations should be encoded directly in the operation/transport metadata and flow through the pipeline without a side channel.
Current approach:
- Transport pipeline generates a unique request ID, adds as
x-ms-fault-injection-request-idheader FaultClientreads the ID, stores evaluations in a globalHashMapby that ID- Transport pipeline retrieves evaluations by ID after the await
Target approach:
Pass an evaluation collector (e.g., Arc<Mutex<Vec<FaultInjectionEvaluation>>>) through the pipeline context object directly, eliminating the global store and header-based correlation.
Blocked on: Custom HTTP pipeline with context passing (Transport Pipeline Spec future step).
Ref: PR #3996 review comment by @analogrelay
Metadata
Metadata
Assignees
Labels
Type
Projects
Status