Skip to content

Different metrics lifetime and garbage collection (forgetting outdated telemetry) #495

Open
@3g0r

Description

@3g0r

Hi, in my case I have many spawned tokio tasks that need to be measured.
Measurements for these spawned tasks unique by labels, and once solved I have to remove these measurements from the metrics registry to prevent memory leaks.
At the same time I need to keep metric COUNT_OF_ACTIVE_TASKS available while my program works.

At now I can't find any way for solving that problem using current API.

builder.idle_timeout looks good, but I have no guarantees about the interval for spawning new tasks, hence COUNT_OF_ACTIVE_TASKS could be deleted at any time and its state forgotten.

Can anyone tell me how to solve this problem without writing an absolute value to COUNT_OF_ACTIVE_TASKS on timeout in an infinite loop? 😂

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-exporterComponent: exporters such as Prometheus, TCP, etc.E-intermediateEffort: intermediate.T-ergonomicsType: ergonomics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions