From 82a1dc1da1ae3042c034ce95386675d93c1fdbd5 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Wed, 12 Jul 2023 13:50:31 -0400 Subject: [PATCH 1/4] feat(js): Add js tracing without performance docs --- .../how-to-use/javascript.mdx | 14 ++++++++++++ .../how-to-use/javascript.nextjs.mdx | 17 ++++++++++++++ .../how-to-use/javascript.remix.mdx | 17 ++++++++++++++ .../how-to-use/javascript.sveltekit.mdx | 17 ++++++++++++++ .../distributed-tracing/how-to-use/node.mdx | 22 +++++++++++++++++++ .../limiting-traces/javascript.mdx | 10 +++++++++ .../limiting-traces/node.mdx | 9 ++++++++ 7 files changed, 106 insertions(+) create mode 100644 src/platform-includes/distributed-tracing/how-to-use/javascript.mdx create mode 100644 src/platform-includes/distributed-tracing/how-to-use/javascript.nextjs.mdx create mode 100644 src/platform-includes/distributed-tracing/how-to-use/javascript.remix.mdx create mode 100644 src/platform-includes/distributed-tracing/how-to-use/javascript.sveltekit.mdx create mode 100644 src/platform-includes/distributed-tracing/how-to-use/node.mdx create mode 100644 src/platform-includes/distributed-tracing/limiting-traces/javascript.mdx create mode 100644 src/platform-includes/distributed-tracing/limiting-traces/node.mdx diff --git a/src/platform-includes/distributed-tracing/how-to-use/javascript.mdx b/src/platform-includes/distributed-tracing/how-to-use/javascript.mdx new file mode 100644 index 0000000000000..22ddfe5df1d50 --- /dev/null +++ b/src/platform-includes/distributed-tracing/how-to-use/javascript.mdx @@ -0,0 +1,14 @@ +If you use the current version of our JavaScript SDK, distributed tracing just works out of the box if you've enabled the `BrowserTracing` integration. You also should define `tracePropagationTargets` to get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues. + +```js +Sentry.init({ + dsn: "__DSN__", + integrations: [new BrowserTracing()], + tracePropagationTargets: [ + "https://myproject.org", + "https://.*.otherservice.org/.*", + ], +}); +``` + +If you however use version `7.57.x` or below, you need to have our performance monitoring feature enabled for distributed tracing to work. diff --git a/src/platform-includes/distributed-tracing/how-to-use/javascript.nextjs.mdx b/src/platform-includes/distributed-tracing/how-to-use/javascript.nextjs.mdx new file mode 100644 index 0000000000000..c8128a48a0989 --- /dev/null +++ b/src/platform-includes/distributed-tracing/how-to-use/javascript.nextjs.mdx @@ -0,0 +1,17 @@ +If you use the current version of our Next.js SDK, distributed tracing just works out of the box for the client, server and edge runtimes. + +For client-side you might have to define `tracePropagationTargets` to get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues. + +```js +// sentry.client.config.js +Sentry.init({ + dsn: "__DSN__", + integrations: [new BrowserTracing()], + tracePropagationTargets: [ + "https://myproject.org", + "https://.*.otherservice.org/.*", + ], +}); +``` + +If you however use version `7.57.x` or below, you need to have our performance monitoring feature enabled for distributed tracing to work. diff --git a/src/platform-includes/distributed-tracing/how-to-use/javascript.remix.mdx b/src/platform-includes/distributed-tracing/how-to-use/javascript.remix.mdx new file mode 100644 index 0000000000000..16c4af2c7ddb3 --- /dev/null +++ b/src/platform-includes/distributed-tracing/how-to-use/javascript.remix.mdx @@ -0,0 +1,17 @@ +If you use the current version of our Remix SDK, distributed tracing just works out of the box for the client and server + +For client-side you might have to define `tracePropagationTargets` to get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues. + +```tsx +// entry.client.tsx +Sentry.init({ + dsn: "__DSN__", + integrations: [new BrowserTracing()], + tracePropagationTargets: [ + "https://myproject.org", + "https://.*.otherservice.org/.*", + ], +}); +``` + +If you however use version `7.57.x` or below, you need to have our performance monitoring feature enabled for distributed tracing to work. diff --git a/src/platform-includes/distributed-tracing/how-to-use/javascript.sveltekit.mdx b/src/platform-includes/distributed-tracing/how-to-use/javascript.sveltekit.mdx new file mode 100644 index 0000000000000..d3756ff9ba01c --- /dev/null +++ b/src/platform-includes/distributed-tracing/how-to-use/javascript.sveltekit.mdx @@ -0,0 +1,17 @@ +If you use the current version of our SvelteKit SDK, distributed tracing just works out of the box for the client and server runtimes. + +For client-side you might have to define `tracePropagationTargets` to get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues. + +```js +// hooks.client.js +Sentry.init({ + dsn: "__DSN__", + integrations: [new BrowserTracing()], + tracePropagationTargets: [ + "https://myproject.org", + "https://.*.otherservice.org/.*", + ], +}); +``` + +If you however use version `7.57.x` or below, you need to have our performance monitoring feature enabled for distributed tracing to work. diff --git a/src/platform-includes/distributed-tracing/how-to-use/node.mdx b/src/platform-includes/distributed-tracing/how-to-use/node.mdx new file mode 100644 index 0000000000000..21da2854c6afe --- /dev/null +++ b/src/platform-includes/distributed-tracing/how-to-use/node.mdx @@ -0,0 +1,22 @@ +If you use the version `7.58.0` or above of our Node SDK, distributed tracing just works out of the box if you've set up the HTTP integration. + +```js +Sentry.init({ + dsn: "___PUBLIC_DSN___", + integrations: [new Sentry.Integrations.Http({ tracing: true })], +}); +``` + +If you're using express or an express-compatible framework, you also need to use the Sentry middleware: + +```js +const app = express(); + +// RequestHandler creates a separate execution context, so that all +// transactions/spans/breadcrumbs/tags are isolated across requests +app.use(Sentry.Handlers.requestHandler()); +// TracingHandler creates a trace for every incoming request +app.use(Sentry.Handlers.tracingHandler()); +``` + +If you however use version `7.57.x` or below, you need to have our performance monitoring feature enabled for distributed tracing to work. diff --git a/src/platform-includes/distributed-tracing/limiting-traces/javascript.mdx b/src/platform-includes/distributed-tracing/limiting-traces/javascript.mdx new file mode 100644 index 0000000000000..85bf45fb9cedc --- /dev/null +++ b/src/platform-includes/distributed-tracing/limiting-traces/javascript.mdx @@ -0,0 +1,10 @@ +```javascript +Sentry.init({ + dsn: "___PUBLIC_DSN___", + integrations: [new BrowserTracing()], + tracePropagationTargets: [ + "https://myproject.org", + "https://.*.otherservice.org/.*", + ], +}); +``` diff --git a/src/platform-includes/distributed-tracing/limiting-traces/node.mdx b/src/platform-includes/distributed-tracing/limiting-traces/node.mdx new file mode 100644 index 0000000000000..8098abfc10ccf --- /dev/null +++ b/src/platform-includes/distributed-tracing/limiting-traces/node.mdx @@ -0,0 +1,9 @@ +```javascript +Sentry.init({ + dsn: "___PUBLIC_DSN___", + tracePropagationTargets: [ + "https://myproject.org", + "https://.*.otherservice.org/.*", + ], +}); +``` From f93c727c17d27d17f57d8d11122a4c9379710f5f Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Mon, 17 Jul 2023 09:15:14 -0400 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: Liza Mock --- .../distributed-tracing/how-to-use/javascript.mdx | 4 ++-- .../distributed-tracing/how-to-use/javascript.nextjs.mdx | 4 ++-- .../distributed-tracing/how-to-use/javascript.remix.mdx | 6 ++---- .../distributed-tracing/how-to-use/javascript.sveltekit.mdx | 6 +++--- .../distributed-tracing/how-to-use/node.mdx | 6 +++--- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/platform-includes/distributed-tracing/how-to-use/javascript.mdx b/src/platform-includes/distributed-tracing/how-to-use/javascript.mdx index 22ddfe5df1d50..2d4e9bf472a9d 100644 --- a/src/platform-includes/distributed-tracing/how-to-use/javascript.mdx +++ b/src/platform-includes/distributed-tracing/how-to-use/javascript.mdx @@ -1,4 +1,4 @@ -If you use the current version of our JavaScript SDK, distributed tracing just works out of the box if you've enabled the `BrowserTracing` integration. You also should define `tracePropagationTargets` to get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues. +If you're using the current version of our JavaScript SDK and have enabled the `BrowserTracing` integration, distributed tracing will work out of the box. To get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues, define your `tracePropagationTargets`. ```js Sentry.init({ @@ -11,4 +11,4 @@ Sentry.init({ }); ``` -If you however use version `7.57.x` or below, you need to have our performance monitoring feature enabled for distributed tracing to work. +If you're using version `7.57.x` or below, you'll need to have our performance monitoring feature enabled in order for distributed tracing to work. diff --git a/src/platform-includes/distributed-tracing/how-to-use/javascript.nextjs.mdx b/src/platform-includes/distributed-tracing/how-to-use/javascript.nextjs.mdx index c8128a48a0989..c15815a53bdd3 100644 --- a/src/platform-includes/distributed-tracing/how-to-use/javascript.nextjs.mdx +++ b/src/platform-includes/distributed-tracing/how-to-use/javascript.nextjs.mdx @@ -1,4 +1,4 @@ -If you use the current version of our Next.js SDK, distributed tracing just works out of the box for the client, server and edge runtimes. +If you're using the current version of our Next.js SDK, distributed tracing will work out of the box for the client, server, and edge runtimes. For client-side you might have to define `tracePropagationTargets` to get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues. @@ -14,4 +14,4 @@ Sentry.init({ }); ``` -If you however use version `7.57.x` or below, you need to have our performance monitoring feature enabled for distributed tracing to work. +If you're using version `7.57.x` or below, you'll need to have our performance monitoring feature enabled in order for distributed tracing to work. diff --git a/src/platform-includes/distributed-tracing/how-to-use/javascript.remix.mdx b/src/platform-includes/distributed-tracing/how-to-use/javascript.remix.mdx index 16c4af2c7ddb3..568ae7845e38d 100644 --- a/src/platform-includes/distributed-tracing/how-to-use/javascript.remix.mdx +++ b/src/platform-includes/distributed-tracing/how-to-use/javascript.remix.mdx @@ -1,6 +1,4 @@ -If you use the current version of our Remix SDK, distributed tracing just works out of the box for the client and server - -For client-side you might have to define `tracePropagationTargets` to get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues. +If you're using the current version of our Remix SDK, distributed tracing will work out of the box for the client and server. To get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues, you should define `tracePropagationTargets` for client-side. ```tsx // entry.client.tsx @@ -14,4 +12,4 @@ Sentry.init({ }); ``` -If you however use version `7.57.x` or below, you need to have our performance monitoring feature enabled for distributed tracing to work. +If you're using version `7.57.x` or below, you'll need to have our performance monitoring feature enabled in order for distributed tracing to work. diff --git a/src/platform-includes/distributed-tracing/how-to-use/javascript.sveltekit.mdx b/src/platform-includes/distributed-tracing/how-to-use/javascript.sveltekit.mdx index d3756ff9ba01c..4ae106025753b 100644 --- a/src/platform-includes/distributed-tracing/how-to-use/javascript.sveltekit.mdx +++ b/src/platform-includes/distributed-tracing/how-to-use/javascript.sveltekit.mdx @@ -1,6 +1,6 @@ -If you use the current version of our SvelteKit SDK, distributed tracing just works out of the box for the client and server runtimes. +If you're using the current version of our SvelteKit SDK, distributed tracing will work out of the box for the client and server runtimes. To get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues, you should define `tracePropagationTargets` for client-side. + -For client-side you might have to define `tracePropagationTargets` to get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues. ```js // hooks.client.js @@ -14,4 +14,4 @@ Sentry.init({ }); ``` -If you however use version `7.57.x` or below, you need to have our performance monitoring feature enabled for distributed tracing to work. +If you're using version `7.57.x` or below, you'll need to have our performance monitoring feature enabled for distributed tracing to work. diff --git a/src/platform-includes/distributed-tracing/how-to-use/node.mdx b/src/platform-includes/distributed-tracing/how-to-use/node.mdx index 21da2854c6afe..26d1e1979caf0 100644 --- a/src/platform-includes/distributed-tracing/how-to-use/node.mdx +++ b/src/platform-includes/distributed-tracing/how-to-use/node.mdx @@ -1,4 +1,4 @@ -If you use the version `7.58.0` or above of our Node SDK, distributed tracing just works out of the box if you've set up the HTTP integration. +If you're using version `7.58.0` or above of our Node SDK and have the HTTP integration set up, distributed tracing will work out of the box. ```js Sentry.init({ @@ -7,7 +7,7 @@ Sentry.init({ }); ``` -If you're using express or an express-compatible framework, you also need to use the Sentry middleware: +If you're using express or an express-compatible framework, you'll also need to use Sentry middleware: ```js const app = express(); @@ -19,4 +19,4 @@ app.use(Sentry.Handlers.requestHandler()); app.use(Sentry.Handlers.tracingHandler()); ``` -If you however use version `7.57.x` or below, you need to have our performance monitoring feature enabled for distributed tracing to work. +If you're using version `7.57.x` or below, you'll need to have our performance monitoring feature enabled in order for distributed tracing to work. From 25e03ec0c0143e87b9924b110790014f784b19b0 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Mon, 17 Jul 2023 09:16:15 -0400 Subject: [PATCH 3/4] use correct BrowserTracing import --- .../distributed-tracing/how-to-use/javascript.mdx | 2 +- .../distributed-tracing/how-to-use/javascript.nextjs.mdx | 2 +- .../distributed-tracing/how-to-use/javascript.remix.mdx | 2 +- .../distributed-tracing/how-to-use/javascript.sveltekit.mdx | 4 +--- .../distributed-tracing/limiting-traces/javascript.mdx | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/platform-includes/distributed-tracing/how-to-use/javascript.mdx b/src/platform-includes/distributed-tracing/how-to-use/javascript.mdx index 2d4e9bf472a9d..aa40f12669b1e 100644 --- a/src/platform-includes/distributed-tracing/how-to-use/javascript.mdx +++ b/src/platform-includes/distributed-tracing/how-to-use/javascript.mdx @@ -3,7 +3,7 @@ If you're using the current version of our JavaScript SDK and have enabled the ` ```js Sentry.init({ dsn: "__DSN__", - integrations: [new BrowserTracing()], + integrations: [new Sentry.BrowserTracing()], tracePropagationTargets: [ "https://myproject.org", "https://.*.otherservice.org/.*", diff --git a/src/platform-includes/distributed-tracing/how-to-use/javascript.nextjs.mdx b/src/platform-includes/distributed-tracing/how-to-use/javascript.nextjs.mdx index c15815a53bdd3..36d4aa3467b15 100644 --- a/src/platform-includes/distributed-tracing/how-to-use/javascript.nextjs.mdx +++ b/src/platform-includes/distributed-tracing/how-to-use/javascript.nextjs.mdx @@ -6,7 +6,7 @@ For client-side you might have to define `tracePropagationTargets` to get around // sentry.client.config.js Sentry.init({ dsn: "__DSN__", - integrations: [new BrowserTracing()], + integrations: [new Sentry.BrowserTracing()], tracePropagationTargets: [ "https://myproject.org", "https://.*.otherservice.org/.*", diff --git a/src/platform-includes/distributed-tracing/how-to-use/javascript.remix.mdx b/src/platform-includes/distributed-tracing/how-to-use/javascript.remix.mdx index 568ae7845e38d..787c7a83b9da8 100644 --- a/src/platform-includes/distributed-tracing/how-to-use/javascript.remix.mdx +++ b/src/platform-includes/distributed-tracing/how-to-use/javascript.remix.mdx @@ -4,7 +4,7 @@ If you're using the current version of our Remix SDK, distributed tracing will w // entry.client.tsx Sentry.init({ dsn: "__DSN__", - integrations: [new BrowserTracing()], + integrations: [new Sentry.BrowserTracing()], tracePropagationTargets: [ "https://myproject.org", "https://.*.otherservice.org/.*", diff --git a/src/platform-includes/distributed-tracing/how-to-use/javascript.sveltekit.mdx b/src/platform-includes/distributed-tracing/how-to-use/javascript.sveltekit.mdx index 4ae106025753b..d5c27279bfbc0 100644 --- a/src/platform-includes/distributed-tracing/how-to-use/javascript.sveltekit.mdx +++ b/src/platform-includes/distributed-tracing/how-to-use/javascript.sveltekit.mdx @@ -1,12 +1,10 @@ If you're using the current version of our SvelteKit SDK, distributed tracing will work out of the box for the client and server runtimes. To get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues, you should define `tracePropagationTargets` for client-side. - - ```js // hooks.client.js Sentry.init({ dsn: "__DSN__", - integrations: [new BrowserTracing()], + integrations: [new Sentry.BrowserTracing()], tracePropagationTargets: [ "https://myproject.org", "https://.*.otherservice.org/.*", diff --git a/src/platform-includes/distributed-tracing/limiting-traces/javascript.mdx b/src/platform-includes/distributed-tracing/limiting-traces/javascript.mdx index 85bf45fb9cedc..200567823746b 100644 --- a/src/platform-includes/distributed-tracing/limiting-traces/javascript.mdx +++ b/src/platform-includes/distributed-tracing/limiting-traces/javascript.mdx @@ -1,7 +1,7 @@ ```javascript Sentry.init({ dsn: "___PUBLIC_DSN___", - integrations: [new BrowserTracing()], + integrations: [new Sentry.BrowserTracing()], tracePropagationTargets: [ "https://myproject.org", "https://.*.otherservice.org/.*", From f70fc965574ff3b87325fc68b90e02360b459e3e Mon Sep 17 00:00:00 2001 From: "getsantry[bot]" <66042841+getsantry[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 13:16:52 +0000 Subject: [PATCH 4/4] style(lint): Auto commit lint changes --- .../distributed-tracing/how-to-use/javascript.sveltekit.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform-includes/distributed-tracing/how-to-use/javascript.sveltekit.mdx b/src/platform-includes/distributed-tracing/how-to-use/javascript.sveltekit.mdx index d5c27279bfbc0..8ebc6c0449430 100644 --- a/src/platform-includes/distributed-tracing/how-to-use/javascript.sveltekit.mdx +++ b/src/platform-includes/distributed-tracing/how-to-use/javascript.sveltekit.mdx @@ -4,7 +4,7 @@ If you're using the current version of our SvelteKit SDK, distributed tracing wi // hooks.client.js Sentry.init({ dsn: "__DSN__", - integrations: [new Sentry.BrowserTracing()], + integrations: [new BrowserTracing()], tracePropagationTargets: [ "https://myproject.org", "https://.*.otherservice.org/.*",