feat: Add in-memory session persistence option#4124
Conversation
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
Hi @andrewatwood, thanks for your contribution! Having in-memory session storage would be a great addition, two concerns though: 1. Fallback strategy: From my understanding of your issue, you'd want to track users that have both cookies and local storage disabled and you'd want to use in memory session in that case. 2. Session sharing between rum and logs: To correlate RUM and Logs data, the two SDKs share the same storage entry and we want to have the same behavior with session in memory. We don't anticipate the changes needed to address those concerns to be too tricky, so if you want to have a go at it, we could provide additional support. |
|
Thanks for taking a look!
I'll take a timeboxed go at these changes just to see if it can get to resolution a little quicker. But it's really keeping the patch updated between major versions that may have changes that's the biggest effort for us. So, if those changes (including a new in-memory option 🤞) end up being rolled into changes for the next major version anyway, it's still solved on effectively the same timeline from our perspective. Appreciate your time, thanks again @bcaudan! |
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
|
Updated! Left the persistence array as optional to keep the change non-breaking. @bcaudan let me know if this is what you had in mind when you get some time, thanks! |
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
Signed-off-by: Bastien Caudan <bastien.caudan@datadoghq.com>
|
@bcaudan thanks for getting this to the finish line! I'm now seeing the requirement for signed commits blocking merge lol. I'll let you rebase and sign if need be? I didn't have signing set up on this account on my work machine, and I don't have vigilant mode enabled so I think it should be fine for you to replay my commits and sign them all as co-author yeah? Appreciate the quick turnaround on this! |
thomas-lebeau
left a comment
There was a problem hiding this comment.
💯 Thanks a ton for your contribution @andrewatwood !
45d6f5e to
aa8e3e6
Compare
|
@andrewatwood it is available with v6.27.0! |
Motivation
A not-insignificant cohort (>5%) of users for the application I work on have their cookies and local storage disabled. Their sessions are short (~15s happy path) and self-contained, and the relevant context for any given session is nearly entirely limited to that individual single-page session, so long term persistence or multi-tab/window support is wholly unnecessary. However, tracking these sessions and any issues that my arise is still a requirement.
In-memory session storage for the RUM SDK allows us to bypass the requirement for enabled cookies or local storage, and have full access to the sessions originating from these users.
This has been tested extensively, and deployed successfully in production, with over 4M sessions using this persistence strategy in the last two weeks alone.
Changes
SessionPersistence.IN_MEMORY) that stores session data in memoryallowFallbackToLocalStorageflag for clarityTest instructions
On-device site datain Chrome)sessionPersistence: 'in-memory'I do likely need some help fleshing out any further e2e test coverage deemed necessary, as some of the test scripts seem to require more setup information than I am privy to.
Checklist