From d495b0d6c1289936c247fcfc584d8507cbe1db64 Mon Sep 17 00:00:00 2001 From: Bruno Garcia Date: Wed, 7 Dec 2022 19:37:55 -0500 Subject: [PATCH 1/4] replay: ref onboarding snippet --- .../install-session-replay/javascript.mdx | 2 +- .../setup-session-replay/javascript.mdx | 37 ++++--------------- .../common/session-replay/index.mdx | 4 +- 3 files changed, 10 insertions(+), 33 deletions(-) diff --git a/src/platform-includes/session-replay/install-session-replay/javascript.mdx b/src/platform-includes/session-replay/install-session-replay/javascript.mdx index 115fd6e81601c..da8bce6efb287 100644 --- a/src/platform-includes/session-replay/install-session-replay/javascript.mdx +++ b/src/platform-includes/session-replay/install-session-replay/javascript.mdx @@ -1,4 +1,4 @@ -Install the Replay package with NPM or your favourite package manager. Alternatively, you can load the Replay integration via a CDN bundle. +Install the Replay package with NPM or your favorite package manager. Alternatively, you can load the Replay integration via a CDN bundle. ```bash {tabTitle: ESM} # Make sure to have @sentry/browser or a Framework SDK (e.g. @sentry/react) installed diff --git a/src/platform-includes/session-replay/setup-session-replay/javascript.mdx b/src/platform-includes/session-replay/setup-session-replay/javascript.mdx index 001ed7246df84..f9887299fcc1a 100644 --- a/src/platform-includes/session-replay/setup-session-replay/javascript.mdx +++ b/src/platform-includes/session-replay/setup-session-replay/javascript.mdx @@ -1,6 +1,6 @@ To set up the integration, add the following to your Sentry initialization. Several options are supported and passable via the integration constructor. See the [configuration sections](/platforms/javascript/session-replay/custom-instrumentation/) for more details. -```javascript {tabTitle: ESM} +```javascript // import Sentry from your framework SDK (e.g. @sentry/react) instead of @sentry/browser import * as Sentry from "@sentry/browser"; @@ -9,12 +9,13 @@ import { Replay } from "@sentry/replay"; Sentry.init({ dsn: "___PUBLIC_DSN___", - // This sets the sample rate to be 10%. You may want this to be 100% while - // in development and sample at a lower rate in production - replaysSessionSampleRate: 0.1, + // This sets the sample rate to be 100% which helps verifying your set up + // but you'll likely want to lower this in production. + // For example, for 25% sampling, use 0.25 + replaysSessionSampleRate: 1.0, - // If the entire session is not sampled, use the below sample rate to sample - // sessions when an error occurs. + // You can separately control the sample rate for sessions that experienced errors. + // For example keeping it 100%, even in production replaysOnErrorSampleRate: 1.0, integrations: [ @@ -28,27 +29,3 @@ Sentry.init({ // ... }); ``` - -```javascript {tabTitle: CDN} -Sentry.init({ - dsn: "___PUBLIC_DSN___", - - // This sets the sample rate to be 10%. You may want this to be 100% while - // in development and sample at a lower rate in production - replaysSessionSampleRate: 0.1, - - // If the entire session is not sampled, use the below sample rate to sample - // sessions when an error occurs. - replaysOnErrorSampleRate: 1.0, - - integrations: [ - new Sentry.Integrations.Replay({ - // Additional SDK configuration goes in here, for example: - maskAllText: true, - blockAllMedia: true - // See below for all available options - }) - ], - // ... -}); -``` diff --git a/src/platforms/javascript/common/session-replay/index.mdx b/src/platforms/javascript/common/session-replay/index.mdx index 8a25d5fe46ee1..b67273fad619c 100644 --- a/src/platforms/javascript/common/session-replay/index.mdx +++ b/src/platforms/javascript/common/session-replay/index.mdx @@ -39,9 +39,9 @@ Make sure to use the exact same version of `@sentry/replay` as your other Sentry -## Sessions +## Replay Session -A session starts when the Session Replay SDK is first loaded and initialized. The session will continue until 5 minutes passes without any user interactions with the application __OR__ until a maximum of 30 minutes have elapsed. Closing the browser tab will end the session immediately according to the rules for [SessionStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage). +A replay session starts when the Session Replay SDK is first loaded and initialized. The session will continue until 5 minutes passes without any user interactions with the application __OR__ until a maximum of 30 minutes have elapsed. Closing the browser tab will end the session immediately according to the rules for [SessionStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage). From 733aa99b296c1f800cf6c15e7d03992d79cf49d3 Mon Sep 17 00:00:00 2001 From: Bruno Garcia Date: Thu, 8 Dec 2022 11:03:00 -0500 Subject: [PATCH 2/4] Update src/platform-includes/session-replay/install-session-replay/javascript.mdx --- .../session-replay/install-session-replay/javascript.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform-includes/session-replay/install-session-replay/javascript.mdx b/src/platform-includes/session-replay/install-session-replay/javascript.mdx index da8bce6efb287..1c19806e8ce15 100644 --- a/src/platform-includes/session-replay/install-session-replay/javascript.mdx +++ b/src/platform-includes/session-replay/install-session-replay/javascript.mdx @@ -1,4 +1,4 @@ -Install the Replay package with NPM or your favorite package manager. Alternatively, you can load the Replay integration via a CDN bundle. +Install the Replay package with the package manager of your choice. Alternatively, you can load the Replay integration via a CDN bundle. ```bash {tabTitle: ESM} # Make sure to have @sentry/browser or a Framework SDK (e.g. @sentry/react) installed From f9c96bc3ee41b7a225f074dc56733570fbf26556 Mon Sep 17 00:00:00 2001 From: Bruno Garcia Date: Thu, 8 Dec 2022 13:09:29 -0500 Subject: [PATCH 3/4] from review --- .../setup-session-replay/javascript.mdx | 44 +++++++++++++++---- .../common/session-replay/index.mdx | 4 +- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src/platform-includes/session-replay/setup-session-replay/javascript.mdx b/src/platform-includes/session-replay/setup-session-replay/javascript.mdx index f9887299fcc1a..2419623acac72 100644 --- a/src/platform-includes/session-replay/setup-session-replay/javascript.mdx +++ b/src/platform-includes/session-replay/setup-session-replay/javascript.mdx @@ -1,6 +1,6 @@ To set up the integration, add the following to your Sentry initialization. Several options are supported and passable via the integration constructor. See the [configuration sections](/platforms/javascript/session-replay/custom-instrumentation/) for more details. -```javascript +```javascript {tabTitle: ESM} // import Sentry from your framework SDK (e.g. @sentry/react) instead of @sentry/browser import * as Sentry from "@sentry/browser"; @@ -9,13 +9,12 @@ import { Replay } from "@sentry/replay"; Sentry.init({ dsn: "___PUBLIC_DSN___", - // This sets the sample rate to be 100% which helps verifying your set up - // but you'll likely want to lower this in production. - // For example, for 25% sampling, use 0.25 - replaysSessionSampleRate: 1.0, + // This sets the sample rate to be 10%. You may want this to be 100% while + // in development and sample at a lower rate in production + replaysSessionSampleRate: 0.1, - // You can separately control the sample rate for sessions that experienced errors. - // For example keeping it 100%, even in production + // If the entire session is not sampled, use the below sample rate to sample + // sessions when an error occurs. replaysOnErrorSampleRate: 1.0, integrations: [ @@ -26,6 +25,35 @@ Sentry.init({ // See below for all available options }) ], - // ... }); ``` + +```javascript {tabTitle: CDN} +Sentry.init({ + dsn: "___PUBLIC_DSN___", + + // This sets the sample rate to be 10%. You may want this to be 100% while + // in development and sample at a lower rate in production + replaysSessionSampleRate: 0.1, + + // If the entire session is not sampled, use the below sample rate to sample + // sessions when an error occurs. + replaysOnErrorSampleRate: 1.0, + + integrations: [ + new Sentry.Integrations.Replay({ + // Additional SDK configuration goes in here, for example: + maskAllText: true, + blockAllMedia: true + // See below for all available options + }) + ], +}); +``` + +With the settings above, Session Replays with errors are always captured, +you can verify that with: + +```javascript +myUndefinedFunction(); +``` \ No newline at end of file diff --git a/src/platforms/javascript/common/session-replay/index.mdx b/src/platforms/javascript/common/session-replay/index.mdx index b67273fad619c..47e96c8fbb7b2 100644 --- a/src/platforms/javascript/common/session-replay/index.mdx +++ b/src/platforms/javascript/common/session-replay/index.mdx @@ -39,9 +39,9 @@ Make sure to use the exact same version of `@sentry/replay` as your other Sentry -## Replay Session +## User Session -A replay session starts when the Session Replay SDK is first loaded and initialized. The session will continue until 5 minutes passes without any user interactions with the application __OR__ until a maximum of 30 minutes have elapsed. Closing the browser tab will end the session immediately according to the rules for [SessionStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage). +A user session starts when the Session Replay SDK is first loaded and initialized. The session will continue until 5 minutes passes without any user interactions with the application __OR__ until a maximum of 30 minutes have elapsed. Closing the browser tab will end the session immediately according to the rules for [SessionStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage). From 464a65963b998521eb1639a9480619a09324c094 Mon Sep 17 00:00:00 2001 From: Bruno Garcia Date: Thu, 8 Dec 2022 14:25:05 -0500 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> --- .../session-replay/install-session-replay/javascript.mdx | 2 +- .../session-replay/setup-session-replay/javascript.mdx | 4 ++-- src/platforms/javascript/common/session-replay/index.mdx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/platform-includes/session-replay/install-session-replay/javascript.mdx b/src/platform-includes/session-replay/install-session-replay/javascript.mdx index 1c19806e8ce15..7555519790be1 100644 --- a/src/platform-includes/session-replay/install-session-replay/javascript.mdx +++ b/src/platform-includes/session-replay/install-session-replay/javascript.mdx @@ -1,4 +1,4 @@ -Install the Replay package with the package manager of your choice. Alternatively, you can load the Replay integration via a CDN bundle. +Install the Replay package with the package manager of your choice. Alternatively, you can load the Replay integration using a CDN bundle: ```bash {tabTitle: ESM} # Make sure to have @sentry/browser or a Framework SDK (e.g. @sentry/react) installed diff --git a/src/platform-includes/session-replay/setup-session-replay/javascript.mdx b/src/platform-includes/session-replay/setup-session-replay/javascript.mdx index 2419623acac72..ac2189cbe05be 100644 --- a/src/platform-includes/session-replay/setup-session-replay/javascript.mdx +++ b/src/platform-includes/session-replay/setup-session-replay/javascript.mdx @@ -51,8 +51,8 @@ Sentry.init({ }); ``` -With the settings above, Session Replays with errors are always captured, -you can verify that with: +With the settings above, session replays with errors are always captured. +You can verify that with the following: ```javascript myUndefinedFunction(); diff --git a/src/platforms/javascript/common/session-replay/index.mdx b/src/platforms/javascript/common/session-replay/index.mdx index 47e96c8fbb7b2..1ecdd2f29d145 100644 --- a/src/platforms/javascript/common/session-replay/index.mdx +++ b/src/platforms/javascript/common/session-replay/index.mdx @@ -41,7 +41,7 @@ Make sure to use the exact same version of `@sentry/replay` as your other Sentry ## User Session -A user session starts when the Session Replay SDK is first loaded and initialized. The session will continue until 5 minutes passes without any user interactions with the application __OR__ until a maximum of 30 minutes have elapsed. Closing the browser tab will end the session immediately according to the rules for [SessionStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage). +A user session starts when the Session Replay SDK is first loaded and initialized. The session will continue until five minutes passes without any user interactions with the application **or** until a maximum of 30 minutes have elapsed. Closing the browser tab will end the session immediately according to the rules for [SessionStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage).