Skip to main content

parse_traceparent

Function parse_traceparent 

Source
pub fn parse_traceparent(
    headers: &HeaderMap,
) -> Result<Option<String>, CoolError>
Expand description

Extract a W3C traceparent header, returning the trace-id portion when the header is present and well-formed. Returns Ok(None) when absent — callers should mint their own request id in that case so every audit row carries something. The trace-id is the second hyphen-delimited segment per W3C Trace Context; this implementation does not validate the flags/version segments since banks usually rebuild traceparent at the edge anyway.