Repository navigation
fix(rum): keep remote settings across releases of the application - #48
Conversation
The stored remote settings were keyed by application version as well as site, application and environment. Every deploy therefore started with no entry: each visitor's first session on the new release was drawn on the init settings and reported no remote configuration version, and the fetch it triggered only applied to the session after it. The key no longer includes the application version, so the settings the previous release stored are read by the next one. Releases of one site live at the same time share the entry, which is right as long as they are given the same settings, and is still the latest decision on record if they ever are not: the fetch every page makes stores its own release's answer for its next draw. The SDK keeps sending app_version on the request. Entries written by earlier builds carry the version in their key and are no longer read; the existing age-based sweep removes them after two days. The first session after upgrading the SDK uses the init settings once.
|
Reviewed as part of this week's SDK/component-library review. The mechanism checks out against the merged code:
One documentation gap in the released changelog, not a code change request: The v0.3.1 entry covers "entries left by earlier builds are no longer read and are swept after two days", but not the consequence you spell out in the PR body — releases of one site live at the same time now share one entry. For a site on a rolling deploy or a canary where two releases are served at once and the settings are targeted per Worth one clause in the v0.3.1 entry ("releases served at the same time share one entry, so settings targeted per application version can apply to the first session of the other release"), so a site running canary rollouts can decide whether it is affected. |
Problem
The remote settings cache in
localStoragewas keyed bysite | applicationId | env | version, withversionbeing the application's own version. Every deploy therefore started with no entry. Each visitor's first session on the new release was drawn on the init settings and carried no_dd.configuration.rc_version. The fetch that session triggered only applied to the session after it.Change
buildStoreKeyno longer includes the application version, so the settings stored by one release are read by the next. This matches the iOS SDK, whose cache key leaves the application version out for the same reason.app_versionis still sent on the config request.Verification
yarn test:unit: 3189 passed.Supersedes #47.
🤖 Generated with Claude Code