mirror of
https://github.com/fastapi-practices/fastapi-best-architecture.git
synced 2026-09-21 21:15:13 +00:00
* Update request state usage to context variable * Update context to custom ctx * Fix the exception interception in opera log * restore elapsed
8 lines
250 B
Python
8 lines
250 B
Python
from backend.common.context import ctx
|
|
from backend.core.conf import settings
|
|
|
|
|
|
def get_request_trace_id() -> str:
|
|
"""从请求头中获取追踪 ID"""
|
|
return ctx.get(settings.TRACE_ID_REQUEST_HEADER_KEY, settings.TRACE_ID_LOG_DEFAULT_VALUE)
|