trulens.core.otel.client_hooks.service¶
trulens.core.otel.client_hooks.service
¶
End-to-end hook event ingestion service.
Classes¶
HookService
¶
Normalize, sanitize, journal, assemble, and export hook events.
Functions¶
ingest
¶
ingest(
client: str,
payload: Mapping[str, Any],
*,
environ: Optional[Mapping[str, str]] = None
) -> Tuple[str, bool]
Normalize and durably journal one hook payload without exporting.
Any trace context the agent exported to this process is captured here, while the hook is still running, because export happens later and often from a different process that no longer has that environment.
| PARAMETER | DESCRIPTION |
|---|---|
client
|
Name of the coding-agent client the payload came from.
TYPE:
|
payload
|
The raw hook payload. |
environ
|
Environment to read trace context from. Defaults to this process's environment. |
| RETURNS | DESCRIPTION |
|---|---|
Tuple[str, bool]
|
The journal's |
flush
¶
flush() -> bool
Export all complete, retryable, or stale turns in the journal.
Each turn's run is created before its spans are exported, because the spans carry the run name, and its ingestion is started afterwards, which is what drives the turn's invocation to a terminal status. A turn is only marked exported once both have succeeded; otherwise it is released for retry, since spans without ingestion would leave the run in-progress forever.