metrics-rs / metrics

A metrics ecosystem for Rust.
MIT License
1.13k stars 157 forks source link

Routing more than one pattern to the same `Recorder` #506

Closed david-perez closed 1 month ago

david-perez commented 2 months ago

metrics_util::layers::RouterBuilder::add_route takes ownership of the recorder, which means it can only handle one pattern/mask combination.

Could we make it take in an Iterator of patterns, or an Arc<R: Recorder>?

tobz commented 2 months ago

I think all we would potentially need to do is add a blanket impl in metrics for impl<R> Recorder for Arc<R> where R: Recorder? That would satisfy needing to provide an owned recorder without messing with the current add_route signature.