From 7c486eda36cca0166b4800f53be1cced9dba6f3e Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Fri, 21 Jun 2024 11:16:43 +0200 Subject: [PATCH] docs(js): use client from init method in js snippets --- .../automatic-instrumentation-custom-routing/javascript.mdx | 4 +--- .../performance/opentelemetry-setup/javascript.node.mdx | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/platform-includes/performance/automatic-instrumentation-custom-routing/javascript.mdx b/platform-includes/performance/automatic-instrumentation-custom-routing/javascript.mdx index 1fc6b819de1db..f1238fabd3b94 100644 --- a/platform-includes/performance/automatic-instrumentation-custom-routing/javascript.mdx +++ b/platform-includes/performance/automatic-instrumentation-custom-routing/javascript.mdx @@ -5,7 +5,7 @@ By default, the `browserTracingIntegration()` will create a `pageload` span for To make sure that spans are created correctly for a custom routing setup, you'll need to opt out of the default span creation by setting `instrumentNavigation: false` and `instrumentPageLoad: false` in the `browserTracingIntegration()` options. You can then manually create spans like this: ```javascript -Sentry.init({ +const client = Sentry.init({ integrations: [ Sentry.browserTracingIntegration({ // disable automatic span creation @@ -15,8 +15,6 @@ Sentry.init({ ], }); -const client = Sentry.getClient() - // We start the pageload span as early as possible! let pageLoadSpan = Sentry.startBrowserTracingPageLoadSpan(client, { name: window.location.pathname, diff --git a/platform-includes/performance/opentelemetry-setup/javascript.node.mdx b/platform-includes/performance/opentelemetry-setup/javascript.node.mdx index 582e885e7be41..464294a270e47 100644 --- a/platform-includes/performance/opentelemetry-setup/javascript.node.mdx +++ b/platform-includes/performance/opentelemetry-setup/javascript.node.mdx @@ -33,7 +33,7 @@ function setupSentry() { setupGlobalHub(); // Make sure to call `Sentry.init` BEFORE initializing the OpenTelemetry SDK - Sentry.init({ + const client = Sentry.init({ dsn: "___PUBLIC_DSN___", tracesSampleRate: 1.0, // set the instrumenter to use OpenTelemetry instead of Sentry @@ -41,7 +41,6 @@ function setupSentry() { // ... }); - const client = getClient(); setupEventContextTrace(client); // You can wrap whatever local storage context manager you want to use