Skip to content

Tracking peak/max value #358

Open
Open
@kornelski

Description

@kornelski

I'd like to have a gauge that precisely tracks a peak value of another gauge (I have a gauge that goes up and down, and its temporary peak value is more interesting than current value at any time). I'm not sure what's the best way to implement it.

Currently gauges have only inc/get/set, so I have something like this:

val.inc();
if val.get() > peak.get() {
   peak.set(val);
}
// later
val.dec();

but the get+set doesn't seem elegant, and isn't atomic. Maybe you could expose fetch_max?

If inc() returned current value I could even do:

peak.max(val.inc());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions