Skip to main content

Module corr

Module corr 

Source
Expand description

Server correlation-id (x-request-id) capture for the CLI trace (gh#85).

Every TaskFast response carries an x-request-id header that the server’s mix taskfast.trace <task_id> joins on. The CLI needs that value to write a correlated trace line, but ~50 call sites discard the response headers at ResponseValue::into_inner(). Rather than thread the header through each one, record_corr is wired as progenitor’s post-hook (see build.rs), so it fires for every generated request — success or error — at one place. Hand-rolled reqwest calls capture via record_corr_response.

Storage is a process-global “last seen” cell. One CLI process runs exactly one command, so the most recent HTTP call’s id is the right corr for that command’s trace line.

Functions§

record_corr
Progenitor post-hook: records the correlation id from a completed request.
record_corr_response
Capture the correlation header from a raw response. Used by the few hand-rolled reqwest calls that bypass the generated client.
take_last_corr
Take and clear the last captured correlation id.