Replies: 1 comment
-
I've decided to just stick the iterator in a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to export metrics about
tokio
tasks/runtime fromtokio-metrics
. It provides an interval iterator to get metrics concerning the time period since the previous interval. My understanding is that these sort of use-cases are what theObservableXXX
Instruments are for. However, this did not work sinceMeter::register_callback
takes anFn(&dyn Observer) + Send + Sync + 'static
, which does not allow mutating the iterator required to callIterator::next
. The only workaround I could think of is to:This feels a bit unfortunate, especially since the number of metrics is quite high (> 40). Additionally this introduces inaccuracy w.r.t. the timing of the data. Am I going about this the wrong way? And is there a particular reason callbacks can't be
FnMut
?Beta Was this translation helpful? Give feedback.
All reactions