feat: enhance migration resilience with improved error handling and …#3
Open
jamesdelbarco wants to merge 2 commits intobraintrustdata:mainfrom
Open
feat: enhance migration resilience with improved error handling and …#3jamesdelbarco wants to merge 2 commits intobraintrustdata:mainfrom
jamesdelbarco wants to merge 2 commits intobraintrustdata:mainfrom
Conversation
added 2 commits
January 29, 2026 15:07
…filtering
Add comprehensive resiliency improvements to handle edge cases during migration:
- Add --created-before flag for inclusive end-date filtering
- Extend rate limit (429) retry attempts to 30 with enhanced jitter (10-50%)
to prevent thundering herd and allow recovery from sustained rate limiting
- Make 413 (Payload Too Large) errors retryable with automatic batch bisection
and optional oversized item skipping
- Fix BTQL created_before filter from exclusive (<) to inclusive (<=)
- Remove tags from non-root spans per API constraints
- Add skipped_oversize tracking to migration state
These changes significantly improve migration success rates for large datasets
and high-traffic scenarios.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enhanced migration resilience with improved error handling and date filtering capabilities.
Changes
🔄 Error Handling Improvements
skip_single_413parameter allows migration to continue when individual items are too large, tracking them separately📅 Date Filtering Enhancements
--created-before: Changed from exclusive (<) to inclusive (<=) for more intuitive date range behavior--created-beforenow represent end-of-day (23:59:59.999999 UTC)created_after(start-of-day) vscreated_before(end-of-day)🐛 Data Quality Fixes
tagsfield from non-root spans to comply with Braintrust API validation requirements✅ Testing
created_beforecanonicalization logicFiles Changed
braintrust_migrate/client.py- Enhanced retry logic with extended 429 handlingbraintrust_migrate/config.py- Separate date canonicalization functionsbraintrust_migrate/insert_bisect.py- Skip oversized items optionbraintrust_migrate/streaming_utils.py- Track skipped oversized itemsbraintrust_migrate/resources/logs.py- Strip tags from non-root spanstests/unit/test_logs_btql_sorted_fetch.py- New comprehensive test suiteImpact