Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instant available metrics #442

Open
0xdeafbeef opened this issue Jan 29, 2024 · 1 comment
Open

Instant available metrics #442

0xdeafbeef opened this issue Jan 29, 2024 · 1 comment
Labels
C-util Component: utility classes and helpers. E-intermediate Effort: intermediate. T-enhancement Type: enhancement. T-request Type: request.

Comments

@0xdeafbeef
Copy link

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?

@tobz
Copy link
Member

tobz commented Feb 3, 2024

It would likely be possible to support, yes.

We used to have support for this -- we called them proxies -- but they were removed as the crate evolved and we started to simplify the interface more and more.

I have thoughts on how I would want to see this approached if developed, but I don't have the time to work on this and it would be a lower priority than many other outstanding bugs/missing features. If you (or anyone else) would be interested in working on this, though, I would be willing to try and guide you on the work.

@tobz tobz closed this as completed Feb 3, 2024
@tobz tobz reopened this Feb 3, 2024
@tobz tobz added C-util Component: utility classes and helpers. E-intermediate Effort: intermediate. T-enhancement Type: enhancement. T-request Type: request. labels Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-util Component: utility classes and helpers. E-intermediate Effort: intermediate. T-enhancement Type: enhancement. T-request Type: request.
Projects
None yet
Development

No branches or pull requests

2 participants