Generate a new 12-char trace ID and bind it to the current context. Intended for background tasks that run outside HTTP/WebSocket request scopes so that all log lines produced by one task execution share the same trace_id.
()
| 36 | |
| 37 | |
| 38 | def new_trace_id() -> str: |
| 39 | """Generate a new 12-char trace ID and bind it to the current context. |
| 40 | |
| 41 | Intended for background tasks that run outside HTTP/WebSocket request |
| 42 | scopes so that all log lines produced by one task execution share the |
| 43 | same trace_id. |
| 44 | """ |
| 45 | tid = uuid4().hex[:12] |
| 46 | set_trace_id(tid) |
| 47 | return tid |
| 48 | |
| 49 | |
| 50 | def _disable_agentbay_logger_override(): |
no test coverage detected