Skip to content

api

etrack.logic.api

logic/api: Tracker — the public surface: one run tracked from a host's config, its frames on the channel.

track(thread, config) opens a run: a fresh RunScope (uuid7, the trace id too), a fold whose frames go to the channel, the source's hook bound into the host's config, and run_id/thread_id bound in structlog's contextvars for every log line of the block. The host runs its framework with the config it gets back; the Tracked it holds also reaches the fold for spans and facts of its own code (tracked.fold.span(…), tracked.fold.instant(…)); the code the run calls reaches the same fold through etrack.logic.handle.run, bound in a context variable for the block.

Tracked dataclass

Tracked(scope: RunScope, config: C, fold: FoldProcessor)

A run in progress: its scope, the host's config with the source bound, and the fold behind it.

Tracker

Tracker(
    channel: EventChannel,
    source: SourcePort[C],
    redact: Redact | None = None,
    *,
    propagate: bool = False,
    pricer: Pricer | None = None,
)

Runs of one framework, tracked onto one channel; redact is the project's mask over every payload; propagate puts the run's root attributes (the host's app.*) on every frame of the run; pricer prices each model call.

track

track(
    thread: str, config: C, run_id: str | None = None
) -> Generator[Tracked[C]]

One run on thread: the scope, the bound config and the fold, with the run's ids bound for the block.