Skip to content

Conversation

@scottopell
Copy link
Contributor

What does this PR do?

A brief description of the change being made with this pull request.

Motivation

What inspired you to submit this pull request?

Related issues

A list of issues either fixed, containing architectural discussions, otherwise relevant
for this Pull Request.

Additional Notes

Anything else we should know when reviewing?

Copy link
Contributor Author

scottopell commented Jan 14, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Add rotation API to CaptureManager that allows rotating to new output
files without stopping the capture. This enables long-running capture
sessions to produce multiple readable Parquet files with valid footers.

Changes:
- Add RotationRequest/RotationSender types for async rotation requests
- Add start_with_rotation() that spawns event loop and returns (sender, JoinHandle)
- Add replace_format() to StateMachine for IO-agnostic format swapping
- Add rotate() trait method stub to OutputFormat (returns error by default)
- Add rotate_to() inherent method on parquet Format<BufWriter<File>>
- Return JoinHandle for graceful shutdown and data flush guarantees

The rotation flow:
1. Caller sends RotationRequest with new file path via RotationSender
2. CaptureManager creates new file and format
3. StateMachine.replace_format() flushes and swaps formats
4. Old format is closed (writing Parquet footer)
5. Response sent back to caller

The returned JoinHandle allows callers to await the capture task to
ensure all buffered metrics are flushed before process exit.

Combines commits d0aebbe and 0542dd6 from sopell/expose-observer-public.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@scottopell scottopell force-pushed the sopell/add-parquet-rotation branch from 83e2256 to 8bfd82e Compare January 15, 2026 18:44
@scottopell scottopell force-pushed the sopell/observer-bugfixes branch from e192e68 to 618001c Compare January 15, 2026 18:44
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.

2 participants