API Reference — Overview

On this page

This section documents every public symbol exported from zerda.observability (i.e. everything listed in __init__'s __all__), plus the exporter subpackage.

Public surface (observability/__init__)

APITypeDescription
SpandataclassThe unit of tracing data.
SpanTypestr enumWell-known span category labels.
TokenUsagedataclassToken accounting for an LLM span.
TracerclassProcess-wide span lifecycle manager and exporter dispatcher.
get_tracer()functionReturns the global Tracer singleton.
trace()decorator factoryWraps a whole function in a span.
BaseExporterabstract classContract every exporter implements.
ConsoleExporterclassPrints spans as human-readable lines.
JSONExporterclassSerializes spans to a JSONL file or in-memory buffer.
enable_langsmith()functionRegisters a LangSmithExporter with the global tracer.
enable_console()functionRegisters a ConsoleExporter with the global tracer.
enable_json()functionRegisters a JSONExporter with the global tracer.
disable_tracing()functionTurns the global tracer into a no-op, keeping exporters registered.
is_tracing_enabled()functionReturns whether the global tracer is currently enabled.

observability.exporters

APITypeDescription
BaseExporterabstract classexport(span) contract; optional shutdown().
ConsoleExporterclassHuman-readable stdout/stream output.
JSONExporterclassJSONL file, or in-memory buffer with to_json().
LangSmithExporterclassSends spans to LangSmith as runs. Requires the optional langsmith package.

Not re-exported from the top level

LangSmithExporter is available from observability.exporters (and its own module), but is not listed in observability/__init__.py's __all__ and is not imported at the top of that file — the public, zero-extra-import way to use it is via enable_langsmith(), which imports it lazily inside the function body.

Notes on scope and accuracy

  • Every signature on the following pages is copied verbatim from the source, not reconstructed from usage.
  • Version history (added-in / deprecated-in / breaking changes) cannot be determined from the provided repository — there is no CHANGELOG, git history, or version-tagged docstring anywhere in the source. Each reference page notes this explicitly rather than guessing.
  • Private members (leading underscore, e.g. Tracer._enqueue, Tracer._drain_loop) are described only where understanding them is necessary to explain a public method's behavior (see Architecture); they are not documented as public API.

Related pages