From adcc82d93c4ff75d5843014fa60afcc5f5b3a5e2 Mon Sep 17 00:00:00 2001 From: romanG <158156364+RomanGaignault@users.noreply.github.com> Date: Fri, 3 Jan 2025 16:22:48 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20[RUM-5001]=20Enforce=20localStorage?= =?UTF-8?q?=20usage=20telemetry=20(#238)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add new property for session storage fallback selection * sample update * update array to string enum * remove 'cookie-fallback-to-local-storage' for now * restore allow_fallback_to_local_storage * rename sessionStorage to sessionPersistence sessionStorage is already a DOM/JS concept, so let's use something else --------- Co-authored-by: BenoƮt Zugmeyer --- lib/cjs/generated/telemetry.d.ts | 6 +++++- lib/esm/generated/telemetry.d.ts | 6 +++++- samples/telemetry-events/configuration.json | 2 +- schemas/telemetry/configuration-schema.json | 7 ++++++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/cjs/generated/telemetry.d.ts b/lib/cjs/generated/telemetry.d.ts index 4281227..2ca39ad 100644 --- a/lib/cjs/generated/telemetry.d.ts +++ b/lib/cjs/generated/telemetry.d.ts @@ -168,9 +168,13 @@ export declare type TelemetryConfigurationEvent = CommonTelemetryProperties & { */ use_secure_session_cookie?: boolean; /** - * Whether it is allowed to use LocalStorage when cookies are not available + * Whether it is allowed to use LocalStorage when cookies are not available (deprecated in favor of session_persistence) */ allow_fallback_to_local_storage?: boolean; + /** + * Configure the storage strategy for persisting sessions + */ + session_persistence?: 'local-storage' | 'cookie'; /** * Whether contexts are stored in local storage */ diff --git a/lib/esm/generated/telemetry.d.ts b/lib/esm/generated/telemetry.d.ts index 4281227..2ca39ad 100644 --- a/lib/esm/generated/telemetry.d.ts +++ b/lib/esm/generated/telemetry.d.ts @@ -168,9 +168,13 @@ export declare type TelemetryConfigurationEvent = CommonTelemetryProperties & { */ use_secure_session_cookie?: boolean; /** - * Whether it is allowed to use LocalStorage when cookies are not available + * Whether it is allowed to use LocalStorage when cookies are not available (deprecated in favor of session_persistence) */ allow_fallback_to_local_storage?: boolean; + /** + * Configure the storage strategy for persisting sessions + */ + session_persistence?: 'local-storage' | 'cookie'; /** * Whether contexts are stored in local storage */ diff --git a/samples/telemetry-events/configuration.json b/samples/telemetry-events/configuration.json index 2929e16..895ef09 100644 --- a/samples/telemetry-events/configuration.json +++ b/samples/telemetry-events/configuration.json @@ -41,7 +41,7 @@ "track_long_task": true, "use_cross_site_session_cookie": false, "use_secure_session_cookie": true, - "allow_fallback_to_local_storage": true, + "session_persistence": "cookie", "action_name_attribute": "foo", "use_allowed_tracing_origins": false, "default_privacy_level": "mask", diff --git a/schemas/telemetry/configuration-schema.json b/schemas/telemetry/configuration-schema.json index 22933fb..7e203ef 100644 --- a/schemas/telemetry/configuration-schema.json +++ b/schemas/telemetry/configuration-schema.json @@ -136,7 +136,12 @@ }, "allow_fallback_to_local_storage": { "type": "boolean", - "description": "Whether it is allowed to use LocalStorage when cookies are not available" + "description": "Whether it is allowed to use LocalStorage when cookies are not available (deprecated in favor of session_persistence)" + }, + "session_persistence": { + "type": "string", + "enum": ["local-storage", "cookie"], + "description": "Configure the storage strategy for persisting sessions" }, "store_contexts_across_pages": { "type": "boolean",