Applies to:
- Plan - Any
- Deployment - Braintrust-hosted, Self-hosted
- Use case - Adding full traces to datasets via UI
Summary
The Add to dataset action adds the span you selected, not every span in the trace tree. Which approach you need depends on the row shape you want:- To capture the whole trace as a single dataset row, use Add full trace to dataset from project logs. The row’s
inputstores a reference to the trace rather than a copy of its spans. - To create one dataset row per span, insert the spans with the SDK, carrying
span_id,root_span_id, andspan_parentsin each row’s metadata.
Resolution steps
Option 1: Add the full trace by reference
- Go to Logs and select the trace or span.
- Click Add to > Add full trace to dataset, then choose the dataset.
Option 2: Add one row per span programmatically
Use this approach when you need each span to become its own dataset row.Step 1: Initialize dataset
Import the SDK and initialize your target dataset.Step 2: Insert all spans with trace metadata
Iterate through each span in the trace and insert it withspan_id, root_span_id, and span_parents fields.