Skip to content

Fix filter_ai_spans bypass for root spans#124

Merged
David Elner (delner) merged 1 commit intobraintrustdata:mainfrom
chidiwilliams:fix-filter-ai-spans-root-bypass
Mar 18, 2026
Merged

Fix filter_ai_spans bypass for root spans#124
David Elner (delner) merged 1 commit intobraintrustdata:mainfrom
chidiwilliams:fix-filter-ai-spans-root-bypass

Conversation

@chidiwilliams
Copy link
Contributor

@chidiwilliams Chidi Williams (chidiwilliams) commented Mar 18, 2026

  • Remove the unconditional return true if is_root in SpanProcessor#should_forward_span? so that configured filters (including filter_ai_spans) are applied to root spans
  • This aligns the Ruby SDK with the Python and JS SDKs, which do not bypass filters for root spans
  • Updates tests to verify non-AI root spans are filtered and AI root spans are kept

Remove the unconditional `return true if is_root` check in
SpanProcessor#should_forward_span? so that filters (including
filter_ai_spans) are applied to root spans as well. This aligns the
Ruby SDK behavior with the Python and JS SDKs.

Fixes braintrustdata#123
@delner David Elner (delner) self-requested a review March 18, 2026 18:00
@delner David Elner (delner) added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels Mar 18, 2026
Copy link
Collaborator

@delner David Elner (delner) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty straightforward to me. Thanks for the contribution! :)

@delner David Elner (delner) merged commit f818a21 into braintrustdata:main Mar 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants