Preserve distributed job context and expose grade 4 operational signals
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from collections.abc import AsyncIterator, Sequence
|
||||
from contextlib import AbstractAsyncContextManager
|
||||
from dataclasses import dataclass
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Protocol, runtime_checkable
|
||||
from uuid import UUID
|
||||
@@ -33,6 +33,7 @@ class OutboxEntry:
|
||||
id: int
|
||||
job_id: UUID
|
||||
body: bytes
|
||||
trace_context: dict[str, str] = field(default_factory=dict)
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
@@ -77,7 +78,9 @@ class VariantRenderer(Protocol):
|
||||
|
||||
@runtime_checkable
|
||||
class JobPublisher(Protocol):
|
||||
async def publish(self, job_id: UUID, body: bytes) -> None: ...
|
||||
async def publish(
|
||||
self, job_id: UUID, body: bytes, trace_context: dict[str, str] | None = None
|
||||
) -> None: ...
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
@@ -179,6 +182,8 @@ class AttachmentDirectory(Protocol):
|
||||
|
||||
@runtime_checkable
|
||||
class JobObserver(Protocol):
|
||||
def active(self, delta: int) -> None: ...
|
||||
|
||||
def observe(self, job: Job, outcome: str, seconds: float) -> None: ...
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user