Tags: rust-proxy/wind
Tags
fix(core): allow App to share an externally-owned StatsCollector The App only created a private StatsCollector when a TrafficSink was registered, so an application that owns its own collector (e.g. one handed to a REST API) had no way to make the inbound hooks write into it — the inbounds saw `InboundHooks.stats == None` and traffic was never recorded. Add `App::set_stats_collector`, which injects an externally-owned collector that takes priority over the private one created inside `run`. The injected instance is used as the inbound hooks' stats handle and, when a sink is registered, as the flush task's data source, so the App, the sink, the inbound hooks, and any external reader share one collector. Add unit tests covering the injected-share and default-disabled cases. Assisted-by: Reasonix:deepseek-v4-flash