Skip to content

Instant available metrics #442

Open
Open
@0xdeafbeef

Description

@0xdeafbeef

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-utilComponent: utility classes and helpers.E-intermediateEffort: intermediate.T-enhancementType: enhancement.T-requestType: request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions