File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -649,13 +649,14 @@ func (api *API) GetDefaultInterval() time.Duration {
649649 return defaultStatsInterval
650650}
651651
652- // instanceStatsQuery returns a SelectDataset prepared to return all active instances within a time period.
652+ // instanceStatsQuery returns a SelectDataset to estimate the active fleet size at a given point in time.
653+ // It answers "how many instances were part of the active fleet on day X",
654+ // not "how many instances specifically checked in on day X".
653655//
654- // This is somewhat complicated by the fact that an instance created _before_ or _during_ our window
655- // can have checked in _after_ the window we're supposed to check. last_check_for_updates gets updated every
656- // time an instance checks for an update. Hence we filter for instances that:
657- // 1. have been created before timestamp 't'
658- // 2. have checked in _during_ or _after_ the time period
656+ // Since last_check_for_updates gets overwritten on every check-in, we cannot determine
657+ // whether an instance was active on a specific past day. Instead, we count instances that:
658+ // 1. existed at the time (created_ts <= timestamp)
659+ // 2. are still alive (last_check_for_updates > timestamp - duration)
659660func (api * API ) instanceStatsQuery (t * time.Time , duration * time.Duration ) * goqu.SelectDataset {
660661 if t == nil {
661662 now := time .Now ().UTC ()
You can’t perform that action at this time.
0 commit comments