trulens.core.otel.client_hooks.exporting¶
trulens.core.otel.client_hooks.exporting
¶
Destination configuration and span export for coding-agent hooks.
Everything here is configured through the environment; there are no arguments to pass.
TRULENS_DESTINATION selects the destination and defaults to local:
localordatabase--TRULENS_DATABASE_URLif set, otherwise a SQLite file atTRULENS_DATABASE_PATH(default~/.trulens/client-hooks.sqlite, created mode 0700).snowflake--TRULENS_SNOWFLAKE_CONNECTION(required) names the connection; the optionalTRULENS_SNOWFLAKE_DATABASEandTRULENS_SNOWFLAKE_SCHEMAoverride what it resolves to.otlp--TRULENS_OTLP_ENDPOINTis the collector to export to. Unset, the exporter falls back to its own default rather than failing here, so a typo in the variable name shows up as spans arriving somewhere unexpected rather than as an error.
Any other value of TRULENS_DESTINATION raises.
Functions¶
create_session
¶
create_session() -> TruSession
Create the configured destination TruLens session.
Supported TRULENS_DESTINATION values: local (default), database,
snowflake, otlp, and ai_gateway.
export_spans
¶
export_spans(
spans: Sequence[ReadableSpan],
*,
session: Optional[TruSession] = None
) -> bool
Synchronously export one complete trace batch.