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>)
| 51 | /// PostgreSQL clients can pass custom parameters during connection: |
| 52 | /// `options=-c trace_id=<32 hex chars>` |
| 53 | pub 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). |