feat: add auto-flush for periodic background metric emission#54
Conversation
MichelMajdalani
commented
Jan 24, 2026
- Add Builder::with_auto_flush() with 30s default interval
- Add Builder::with_auto_flush_interval() for custom intervals
- Spawn tokio background task with MissedTickBehavior::Skip
- Add tokio dependency (time, rt features)
- Refactor Builder::build() to return Collector directly
- Update documentation and examples
|
Thank you for the contribution, nothing stood out as an issue, will look it over again tomorrow and likely merge it. |
|
Should this also use |
Is flushing on the service being |
You're absolutely right, I initially interpreted the feature as replacing the per-invocation flushing with periodic flushing, should have reviewed it completely before commenting. |
- Add Builder::with_auto_flush() with 30s default interval - Add Builder::with_auto_flush_interval() for custom intervals - Add Builder::with_auto_flush_writer() for custom output destinations - Add AutoFlushWriterFactory type alias for writer factory pattern - Spawn tokio background task with MissedTickBehavior::Skip - Defaults to stdout, but allows testing and non-Lambda use cases - Add tokio dependency (time, rt features) - Refactor Builder::build() to return Collector directly - Update documentation and examples - Add unit test for custom writer output capture
b01ae7a to
935a132
Compare