Trace function calls
Braintrust SDKs provide tools to trace function execution and capture inputs, outputs, and errors:- Python SDK uses the
@traceddecorator to automatically wrap functions - TypeScript SDK uses
wrapTraced()to create traced function wrappers - Go SDK uses OpenTelemetry’s manual span management with
tracer.Start()andspan.End()
- Function name as the span name
- Function arguments as input
- Return value as output
- Any errors that occur
Add metadata and tags
Enrich spans with custom metadata to make them easier to filter and analyze:Manual spans
For more control, create spans manually usinglogger.traced() or startSpan():
Nest spans
Spans automatically nest when called within other spans, creating a hierarchy that represents your application’s execution flow:Next steps
- Advanced tracing patterns and techniques
- Capture user feedback like thumbs up/down
- View your logs in the Braintrust dashboard