Skip to content

trulens.core.otel.client_hooks.tracing

trulens.core.otel.client_hooks.tracing

Assemble complete OpenTelemetry traces from hook event journals.

Classes

TurnIdentity dataclass

Run and record identity for one assembled coding-agent turn.

A turn is the unit of export and the unit of ingestion: each turn contributes exactly one record to its run. run_name is shared by every turn in a conversation, so a conversation maps to one run carrying one completed invocation per turn.

TraceAssembler

Convert one completed client turn into TruLens-compatible spans.

Functions
identify
identify(events: List[HookEvent]) -> Optional[TurnIdentity]

Resolve run and record identity for one turn.

Returns None for an empty turn. Identity is derived from the native client payloads so that it stays stable across retries: re-exporting a turn reuses the same record and run names rather than creating new ones.

assemble
assemble(
    events: List[HookEvent], *, stale: bool = False
) -> List[ReadableSpan]

Assemble root, agent, and operation spans for one turn.

Functions

stale_after_from_environment

stale_after_from_environment() -> timedelta

Read the incomplete-turn timeout from adapter configuration.