MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / extract_from_pgwire_params

Function extract_from_pgwire_params

nodedb/src/control/trace_context.rs:53–60  ·  view source on GitHub ↗

Extract a `TraceId` from a pgwire startup parameter map. PostgreSQL clients can pass custom parameters during connection: `options=-c trace_id=<32 hex chars>`

(params: &std::collections::HashMap<String, String>)

Source from the content-addressed store, hash-verified

51/// PostgreSQL clients can pass custom parameters during connection:
52/// `options=-c trace_id=<32 hex chars>`
53pub fn extract_from_pgwire_params(params: &std::collections::HashMap<String, String>) -> TraceId {
54 if let Some(val) = params.get("trace_id")
55 && let Ok(tid) = val.parse::<TraceId>()
56 {
57 return tid;
58 }
59 TraceId::generate()
60}
61
62/// Create a tracing span with the `trace_id` attached via its `Display` form
63/// (32 lowercase hex chars).

Calls 1

getMethod · 0.45