Open
Description
I've encountered a scenario where certain metrics, such as allocation statistics/collections length are instantly available but are external and not directly controllable. Currently, the approach to forward these metrics to metrics is by employing tokio::spawn
with an endless loop as shown below:
tokio::spawn(async {
loop {
let data = get_value();
metrics::gauge("measurement").set(data);
tokio::time::sleep(Duration::from_secs(5));
}
});
While this method works, it's not the most efficient or elegant solution, particularly when considering that exporters may have varying scrape intervals.
Suggestion:
Would it be possible to introduce a global notification mechanism, on which all metrics will render their measurements?