You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TrackedResourceRecord.FirstSeen is reset on every normal update #5
The normal OnUpdate path appears to overwrite TrackedResourceRecord.FirstSeen with time.Now() instead of preserving the original first-seen timestamp.
I am not sure that this is consistent with the drift-recovery path in OnAdd, which explicitly preserves the original value with FirstSeen: existing.FirstSeen.
Let me try and explain why this is important FirstSeen should represent when the resource was first observed, while LastSeen should move forward as updates happen. Resetting FirstSeen on every update makes the metadata inaccurate.
Current behavior
In resourceEventHandler.OnUpdate: FirstSeen: now, LastSeen: now,
Expected behavior
Let's say the tracked resource already exists, OnUpdate should preserve existing.FirstSeen and only update LastSeen. If no record exists yet, then it can stay to now.
Suggested fix
In OnUpdate, have something like: firstSeen := now if existing != nil && !existing.FirstSeen.IsZero() { firstSeen = existing.FirstSeen }
and then use FirstSeen: firstSeen in the inserted or updated record.
Activity
fatkobra commentedon Apr 20, 2026
I have a fix for in
resource_watcher.goplus a regression test forOnUpdatesoFirstSeenis preserved.