SIGN IN SIGN UP

ref(dynamic-sampling): add a TTL to the latest release date key (#122746)

Problem: `LatestReleaseBias` keeps one Redis key per project which holds
the date of the newest release seen for that project. That key is
written without expiry and nothing deleted it, so every project that has
ever had a release observed keeps a key forever.

Fix: write the value and the expiry in the same command. A project that
keeps shipping releases rewrites the key and gets a full lifetime each
time, so nothing changes for a live project.

Notes:
- Context: a "boost" means we keep a larger share of events for that
release instead of letting normal sampling throw them away. We boost new
releases while the adoption curve settles down.
- 90 days because we want the expiry to be longer than a normal gap
between two releases. Otherwise - if a key expires between two releases,
the next event on the older release will appear like a new latest
release.
- There was a problem with naively adding a TTL here: old releases could
have their keys dropped due to an expiry, resulting in that old release
to get boosted. Added a check that determines if a release is _actually_
new enough to warrant a boost.
- This ^ does come with some small behavioral changes: e.g. dormant
projects with really old stored release dates will no longer get boosted
when an event comes through

Refs INFRENG-474
S
Scott Strong committed
6346b65853b9a7cb2b1bd856a4e1725fb63aac56
Parent: c6eef15
Committed by GitHub <noreply@github.com> on 8/28/2026, 4:47:42 PM