Skip to content

Add tracing span for full snapshot creation duration#3867

Draft
alco wants to merge 1 commit intomainfrom
alco/snapshot-duration-span
Draft

Add tracing span for full snapshot creation duration#3867
alco wants to merge 1 commit intomainfrom
alco/snapshot-duration-span

Conversation

@alco
Copy link
Member

@alco alco commented Feb 18, 2026

Summary

  • We previously had no tracing span that covered the full duration of initial snapshot building, making it impossible to get historical data on how long snapshots take for any customers
  • Added a new shape_snapshot.stream_and_store span that wraps the entire snapshot streaming and storage process, including the DB query execution, data streaming, and writing to storage
  • The OTel context is propagated from the Snapshotter process into the spawned task to maintain the correct parent-child span hierarchy

The updated span hierarchy is now:

shape_snapshot.create_snapshot_task
  ├─ shape_snapshot.prepare_tables
  │    ├─ shape_snapshot.start_readonly_txn
  │    ├─ shape_snapshot.get_pg_snapshot
  │    └─ shape_snapshot.set_display_settings
  └─ shape_snapshot.stream_and_store        ← NEW (runs in spawned task)
       └─ shape_read.stream_initial_data

Test plan

  • All existing unit tests pass (443 tests, 0 failures)
  • Verify the new span appears in traces when creating a shape snapshot

🤖 Generated with Claude Code

@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.22%. Comparing base (03943ad) to head (a083448).
⚠️ Report is 4 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3867      +/-   ##
==========================================
+ Coverage   87.16%   87.22%   +0.06%     
==========================================
  Files          25       25              
  Lines        2314     2325      +11     
  Branches      580      583       +3     
==========================================
+ Hits         2017     2028      +11     
  Misses        295      295              
  Partials        2        2              
Flag Coverage Δ
packages/experimental 87.73% <ø> (ø)
packages/react-hooks 86.48% <ø> (ø)
packages/start 82.83% <ø> (ø)
packages/typescript-client 92.09% <ø> (+0.05%) ⬆️
packages/y-electric 56.05% <ø> (ø)
typescript 87.22% <ø> (+0.06%) ⬆️
unit-tests 87.22% <ø> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

We didn't have any span covering the actual snapshot streaming and
storage, making it impossible to track how long initial snapshots take
for customers. Add a `shape_snapshot.stream_and_store` span that wraps
the entire snapshot creation process in the spawned task, propagating the
OTel context from the parent process.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@alco alco force-pushed the alco/snapshot-duration-span branch from efee3e9 to a083448 Compare February 18, 2026 17:08
@blacksmith-sh
Copy link
Contributor

blacksmith-sh bot commented Feb 18, 2026

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
Elixir.Electric.Replication.PublicationManagerTest/
test component restarts handles relation tracker restart
View Logs

Fix in Cursor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments