mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-07-29 09:26:00 +00:00
* feat(observability): add trace-id correlation and enhanced logging - add opt-in gateway request trace correlation via X-Trace-Id - enhance logging with configurable trace_id-aware formatting - propagate deerflow_trace_id into runtime context and Langfuse metadata - keep enhanced logging disabled by default to preserve existing behavior * fix: harden trace correlation wiring - Make logging enhancement a restart-required startup snapshot and remove per-request config reads from TraceMiddleware - Restrict trace ids to printable ASCII before writing them to response headers, logs, and Langfuse metadata - Gate implicit DeerFlowClient trace-id creation behind logging.enhance.enabled while preserving explicit caller opt-in - Bind embedded client trace context per stream step to avoid generator ContextVar leaks and cross-context reset errors - Rebind memory update trace ids in Timer/executor worker paths so enhanced logs keep the captured correlation id - Remove unrelated __run_journal context overwrite from the trace-correlation change set * fix(gateway): avoid eager app construction on package import * fix(gateway): avoid config load during app import Keep Gateway app construction import-safe when config.yaml is absent by disabling TraceMiddleware only for that construction-time fallback path. Startup lifespan still performs strict config loading before serving.
13 lines
446 B
Python
13 lines
446 B
Python
from .config import GatewayConfig, get_gateway_config
|
|
|
|
__all__ = ["app", "create_app", "GatewayConfig", "get_gateway_config"]
|
|
|
|
|
|
def __getattr__(name: str):
|
|
"""Lazily expose the FastAPI app without initializing it on package import."""
|
|
if name in {"app", "create_app"}:
|
|
from .app import app, create_app
|
|
|
|
return app if name == "app" else create_app
|
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|