Extracting the methods of metrics_util::registry::Registry
into a trait
#481
Replies: 2 comments 1 reply
-
At the very least, I think such a trait should have the following methods:
And for each metric kind
Additionally, ideally |
Beta Was this translation helpful? Give feedback.
-
Overall, I'm in favor of trait-ifying the "backend" of an exporter, and I've talked about it a little bit in this issue: #254 (comment) I think your ideation around what the base set of functionality would be is also reasonable, too. Fallibility would also be nice because it would also for a slightly more straightforward interface around handling resource constraints and limits, instead of having to do something now like return a no-op handle, which gives no indication that the handle is actually non-functioning and has no way to even be interrogated to find that out. Happy to try and mentor this work if you're looking to contribute, as my time is very limited and working on new things from scratch is just something I can't reasonably commit to at the moment. |
Beta Was this translation helpful? Give feedback.
-
I think one of the great features of
metrics_util::layers::Layer
is how it makesRecorder
s composable. UsuallyRecorder
s hold a registry of all metrics emitted. It'd be cool if we could build and compose registry-agnosticRecorder
s, so that the sameRecorder
implementation could work with e.g. a registry backed by a hash map or by a struct.The
metrics_util::registry::Registry
struct is a building block that already offers a nice interface I'd expect an arbitrary registry to have: at the very least it needs to have methods to get and register metrics (used by theRecorder
), and methods to visit and drain metrics (used by the "exporter", the piece of code responsible for transferring the metrics out of theRecorder
and into the sink).Does this sound reasonable? Should we have a
Registry
trait, perhaps in themetrics_util
crate?Beta Was this translation helpful? Give feedback.
All reactions