> ## Documentation Index
> Fetch the complete documentation index at: https://braintrust.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure root span filter for online scoring

export const plans_0 = "Any"

export const deployments_0 = "Any"

export const data_plane_version_0 = "Data plane - v2.0.0 or later"

export const use_case_0 = "Use case - Online scoring with code-based scorers"

<Note>
  **Applies to:**

  * Plan - {plans_0}
  * Deployment - {deployments_0}
  * {data_plane_version_0}
  * {use_case_0}
</Note>

## Summary

**Goal:** Configure online scoring rules to run on trace-level data instead of individual spans.

**Features:** Online scoring rules, Scope toggle, span filtering, root span data.

## Option 1: Use the Scope toggle (recommended)

If your automation rule editor shows a **Scope** toggle with Trace/Span options, set it to **Trace**. This is the simplest way to run scorers on trace-level data.

The Scope toggle requires data plane v2.0.0+ for self-hosted deployments. If you don't see it, use Option 2 below.

## Option 2: Add "All root spans" filter

If the Scope toggle isn't available on your deployment, you can restrict scoring to root spans using the "All root spans" filter:

1. Open your project and go to **<Icon icon="settings-2" /> Settings** > [**<Icon icon="radio" /> Automations**](https://www.braintrust.dev/app/~/configuration/automations).
2. In the scoring rule, click **Add filter** and select **All root spans**.
3. Click **Test rule** to verify the scorer receives the expected data from the root span.

![All root spans filter configuration](https://assets.usepylon.com/f9e0f7c8-a513-475d-93fb-43d7cd5de18e%2F1770053072723-Screenshot2026-02-02at11.23.43AM.png?Expires=253370764800\&Signature=pB~KgrdzYVrChnAd-6sOiFcVQk-XsH6~trxdvyywMM67tPMWy7jBNoeSLlKdC-ShdWFKvfuZe6IZADMu-036FameFTtd8dMjHUkNqpDAEvn3Q~kEwM3YgZDqDeoVhD6oJeBUmOyKPiLp0xuSvnotEhT-2YfrCEpPALpwa0-KWFkr8pV8yS3RHtjt5OKx51yvyTVmgdfWG5iPCvlYCNH~5UjkMGwwcpFvYD0aT9d77UfIoSlr-VzFQPaYaIcrzkMF~5FJxWiD7jjUP8jzWc5fF0CBQKB-tohT19OVvwkbKSiUsZot9qwJS0iZXtr9ajJhznMDVcM5AFp8cB4U7FhBGw__\&Key-Pair-Id=K3NV4LZ47N8M46)

This is a span-level filter, not true trace scope. It restricts the scorer to root spans only, which typically contain the consolidated data (input, output, metadata) you need. For full trace-scoped execution, use Option 1 when available.

## Why This Is Needed

By default, scorers run on individual spans. When your data is consolidated at the trace level (root span), the scorer needs to target root spans to access it.
