Skip to content

🔬 gate session renewal debug context behind a feature flag#4540

Merged
BenoitZugmeyer merged 1 commit intov7from
benoit/session-renewal-debug-context-flag
Apr 29, 2026
Merged

🔬 gate session renewal debug context behind a feature flag#4540
BenoitZugmeyer merged 1 commit intov7from
benoit/session-renewal-debug-context-flag

Conversation

@BenoitZugmeyer
Copy link
Copy Markdown
Member

Motivation

The session renewal debug context (SessionRenewalEvent payload — cookie reads, session state
snapshots, and the is_session_renewal/renew_event fields attached to view contexts) was
unconditionally collected on every session renewal. This adds unnecessary overhead and pollutes
view context for all users. Gating it behind a flag allows enabling it only when actively
investigating session lifecycle issues.

Changes

  • Add session_renewal_debug_context experimental feature flag
  • Gate collection of SessionDebugContext (cookie reads, state snapshots) behind the flag; renewObservable notifies with undefined when the flag is off
  • Gate attaching is_session_renewal / renew_event to the renewed view context behind the flag

Test instructions

  1. Run yarn dev and open the sandbox at http://localhost:8080
  2. Without the flag: trigger a session renewal (e.g. expire the session cookie and interact with the page). Confirm no renew_event or is_session_renewal fields appear on the resulting view event.
  3. With the flag enabled (add session_renewal_debug_context to enableExperimentalFeatures in sandbox/index.html): repeat and confirm renew_event with full debug context appears on the view.

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

The SessionRenewalEvent payload (cookie reads, session state snapshots)
and the associated view context fields (is_session_renewal, renew_event)
are only collected and propagated when the
`session_renewal_debug_context` experimental feature flag is enabled.
@BenoitZugmeyer BenoitZugmeyer changed the base branch from main to v7 April 29, 2026 08:49
@BenoitZugmeyer BenoitZugmeyer marked this pull request as ready for review April 29, 2026 08:51
@BenoitZugmeyer BenoitZugmeyer requested a review from a team as a code owner April 29, 2026 08:51
@cit-pr-commenter-54b7da
Copy link
Copy Markdown

cit-pr-commenter-54b7da Bot commented Apr 29, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 168.82 KiB 168.99 KiB +169 B +0.10%
Rum Profiler 6.09 KiB 6.09 KiB 0 B 0.00%
Rum Recorder 21.25 KiB 21.25 KiB 0 B 0.00%
Logs 54.37 KiB 54.55 KiB +180 B +0.32%
Rum Slim 127.19 KiB 127.34 KiB +153 B +0.12%
Worker 22.99 KiB 22.99 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base CPU Time (ms) Local CPU Time (ms) 𝚫%
addglobalcontext N/A 0.0028 N/A
addaction N/A 0.0178 N/A
adderror N/A 0.0134 N/A
addtiming N/A 0.0008 N/A
startview N/A 0.0148 N/A
startstopsessionreplayrecording N/A 0.001 N/A
logmessage N/A 0.0208 N/A
🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
addglobalcontext N/A 36.61 KiB N/A
addaction N/A 81.08 KiB N/A
addtiming N/A 37.26 KiB N/A
adderror N/A 68.58 KiB N/A
startstopsessionreplayrecording N/A 41.12 KiB N/A
startview N/A 476.41 KiB N/A
logmessage N/A 52.52 KiB N/A

🔗 RealWorld

@datadog-prod-us1-4
Copy link
Copy Markdown

datadog-prod-us1-4 Bot commented Apr 29, 2026

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 87.50%
Overall Coverage: 77.57% (-0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 29cc270 | Docs | Datadog PR Page | Give us feedback!

@BenoitZugmeyer BenoitZugmeyer merged commit 641fffa into v7 Apr 29, 2026
22 checks passed
@BenoitZugmeyer BenoitZugmeyer deleted the benoit/session-renewal-debug-context-flag branch April 29, 2026 10:02
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants