feat: propagate trace context through outbox and add pipeline saturation metrics

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 19:54:37 +03:00
co-authored by Claude Opus 5.5
parent ff0073e8e3
commit 72cfa9aaf6
64 changed files with 4699 additions and 552 deletions
+15
View File
@@ -29,6 +29,7 @@ from src.core.services import (
SessionService,
UserService,
)
from src.infra import telemetry
from src.infra.cache.instance import cache
from src.infra.db import ping
from src.infra.db.scope import deadline_scope
@@ -124,6 +125,20 @@ AttachmentServiceDep = Annotated[
]
async def get_trace_context() -> dataclasses.TraceContextDTO | None:
"""Контекст W3C текущего span — server span запроса — для задания
загрузки (design change `job-trace-propagation`, решение 4); без
телеметрии — `None`. Сервис телеметрию не импортирует: контекст приходит
значением, как `owner_id`."""
return telemetry.current_trace_context()
TraceContextDep = Annotated[
dataclasses.TraceContextDTO | None,
Depends(get_trace_context),
]
# схемы basicAuth и bearerAuth из contracts/openapi.json: объявлены в
# /openapi.json и дают кнопку Authorize в /docs. auto_error=False — нет
# заголовка или схема чужая даёт None, а 401 в формате контракта бросает