In the mostrecent/livemostrecent accumulation branch, sample_timestamps
is a defaultdict(float), so the stored timestamp of a series defaults to
0.0. A gauge child that was created but never set() also has a stored
timestamp of 0, so the strict 'current_timestamp < timestamp' check was
never satisfied and the series was dropped from collection entirely.
Every other gauge mode (sum, min, max, all) reports such a child as 0,
so mostrecent silently omitting it was inconsistent. Register the sample
when it is first seen, regardless of timestamp, and still let a strictly
newer timestamp win afterwards.
Add test_gauge_mostrecent_never_set, asserting a mostrecent gauge that is
created but never set is reported as 0 rather than missing.
Signed-off-by: Sean Kim <skim8705@gmail.com>
In the mostrecent/livemostrecent accumulation branch, sample_timestamps
is a defaultdict(float), so the stored timestamp of a series defaults to
0.0. A gauge child that was created but never set() also has a stored
timestamp of 0, so the strict 'current_timestamp < timestamp' check was
never satisfied and the series was dropped from collection entirely.
Every other gauge mode (sum, min, max, all) reports such a child as 0,
so mostrecent silently omitting it was inconsistent. Register the sample
when it is first seen, regardless of timestamp, and still let a strictly
newer timestamp win afterwards.
Add test_gauge_mostrecent_never_set, asserting a mostrecent gauge that is
created but never set is reported as 0 rather than missing.
@csmarchbanks