ВМ1: реализован сбор логов

This commit is contained in:
mi
2026-09-07 12:46:45 +03:00
parent 44db38f6fe
commit 85df788f2d
42 changed files with 1669 additions and 310 deletions
@@ -58,6 +58,7 @@ from app.schemas import (
encode_cursor,
)
from app.settings import Settings
from app.telemetry import current_traceparent
MESSAGE_SAFETY_REPLIES = {
"text": (
@@ -95,6 +96,7 @@ async def ensure_delivery_outbox(
external_chat_id: uuid.UUID,
payload_json: dict[str, Any],
next_attempt_at: datetime,
traceparent: str | None = None,
) -> DeliveryOutbox:
"""Create the per-message outbox row or return the concurrent winner."""
statement = (
@@ -104,6 +106,7 @@ async def ensure_delivery_outbox(
message_id=message_id,
external_chat_id=external_chat_id,
payload_json=payload_json,
traceparent=traceparent,
next_attempt_at=next_attempt_at,
)
.on_conflict_do_nothing(index_elements=[DeliveryOutbox.message_id])
@@ -1039,6 +1042,7 @@ async def send_message(
message_id=message.id,
attachment_id=attachment.id if attachment else None,
quarantine_object_key=attachment.quarantine_object_key if attachment else None,
traceparent=current_traceparent(),
status="polling",
processing_mode=verdict["processing_mode"],
config_version=verdict["config_version"],
@@ -1133,6 +1137,7 @@ async def send_message(
# delivery worker race the synchronous first attempt.
next_attempt_at=datetime.now(UTC)
+ timedelta(seconds=settings.bitrix_local_app_http_timeout_sec + 5),
traceparent=current_traceparent(),
)
await session.commit()
await publish_message_status(fanout, message, settings)