pub fn initialize_shared_metrics_state() -> Result<SharedMetricsWorker, GenericError>Expand description
Initializes the shared metrics state, returning the worker that drives it.
Must be called after initialize_metrics has installed the global recorder, and
before any caller reaches for get_shared_metrics_state. The returned worker must be added to a
Supervisor – as a transient child, per ReflectorWorker – and until it runs,
the shared state stays empty.
The subscription to the internal metrics registry is taken here rather than when the worker starts, so flushes that land between initialization and the supervisor starting are still observed.
§Errors
If the shared metrics state was already initialized, an error is returned.