Skip to content

Schedule traced callbacks eagerly with scoped shutdown writes - #135

Closed
Stephen Belanger (Qard) wants to merge 1 commit into
refactor/eager-client-span-updatesfrom
refactor/eager-traced-callbacks
Closed

Stephen Belanger (Qard) wants to merge 1 commit into
refactor/eager-client-span-updatesfrom
refactor/eager-traced-callbacks

Conversation

@Qard

Copy link
Copy Markdown
Contributor

Experiment::traced previously started only when polled and ran its callback on the awaiting task. It now admits one owned callback immediately and returns a completion token; dropping that observer leaves accepted work running on the selected execution binding. Callback inputs, futures and results require Send + 'static.

Accepted callbacks receive a bounded, private write scope so their root and child spans can finish dependent writes after shutdown closes ordinary admission. Callbacks run outside queue preparation, allowing nested awaited writes to make progress. Completion, panic, runtime loss and deadline cancellation revoke the scope even when span handles escape. SpanHandle::child_builder preserves the parent context and scoped submission while keeping child finish state independent.

Shutdown waits for these scopes and their dependent writes. Ordinary flushes retain fixed cutoffs, and terminal batch failures still retire without replay or poisoning subsequent flushes. Scope admission shares the existing delivery capacity controls; it adds no public cancellation API.

Validation: cargo test --all-features passed 352 unit/integration tests and 9 doctests (existing 1 integration test and 4 doctests remain ignored). Strict all-target/all-feature Clippy, rustdoc, formatting and diff checks passed. Nine new tests cover shutdown before first poll, nested writes, escaped handles, observer drop from a plain thread, bounded admission, callback panic, runtime loss, deadline cancellation and terminal failure retirement.

Stacked on #134. The standalone direct API completion facade and evaluator decomposition remain subsequent layers. Planning documents are excluded.

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