Tracing

Tracing is an invaluable tool for exploring the sub-components of your program which produce each top-level input and output. We currently support tracing in logging and evaluations.

Trace Screenshot

Anatomy of a trace

A trace represents a single independent request, and is made up of several spans.

Anatomy of a trace

A span represents a unit of work, with a start and end time, and optional fields like input, output, metadata, scores, and metrics (the same fields you can log in an experiment). Each span contains one or more children that are usually run within their parent span, like for example, a nested function call. Common examples of spans include LLM calls, vector searches, the steps of an agent chain, and model evaluations.

Each trace can be expanded to view all of the spans inside. Well-designed traces make it easy to understand the flow of your application, and to debug issues when they arise. The tracing API works the same way whether you are logging online (production logging) or offline (evaluations).

Where to go from here

Learn more about tracing in Braintrust: