Open lh123 opened 2 months ago
This capability was intentionally removed here to keep 1.0 scope minimal. We can consider adding this post 1.0, as this would be a additive change.
@stormshield-fabs Also raised interest in making this happen.
// call an expensive API to get some values. // let value = expensive_api_call(); // observer.observer(value); // call an expensive API to get some values and cache it // if cache is old, call expensive API again. // { // let cache = expensive_api_call(); // } // observer.observer(cache);
One suggested alternate. Not as elegant.
Consider reprioritizing this for 1.0 itself given there are many asks.
Related Problems?
No response
Describe the solution you'd like:
Currently, when there are multiple
AsyncInstrument
, each metric has its own independentwith_callback
to set an update callback. I would like to be able to update multiple related metrics in a single callback. For example, when retrieving Linux memory information, we typically only need to read from/proc
once to get bothtotal memory
andfree memory
. However, currently, I have to register separate callbacks fortotal memory
andfree memory
, which leads to multiple reads from/proc
.See:
batchCallback
See: multiple-instrument-callbacks
Considered Alternatives
No response
Additional Context
No response