From fb0a5484e7d73ff890e9947aa6b8ff4fcad247e7 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Mon, 27 May 2024 17:35:36 +0200 Subject: [PATCH 1/2] feat: Update node getting started pages --- .../javascript/guides/connect/index.mdx | 59 +------------- .../javascript/guides/express/index.mdx | 59 +------------- .../javascript/guides/fastify/index.mdx | 59 +------------- .../javascript/guides/hapi/index.mdx | 61 +------------- .../platforms/javascript/guides/koa/index.mdx | 61 +------------- .../javascript/guides/nestjs/index.mdx | 54 +------------ .../javascript/guides/node/index.mdx | 59 +------------- .../javascript.node.mdx | 20 ++++- .../getting-started-node/javascript.mdx | 80 +++++++++++++++++++ 9 files changed, 105 insertions(+), 407 deletions(-) create mode 100644 platform-includes/getting-started-node/javascript.mdx diff --git a/docs/platforms/javascript/guides/connect/index.mdx b/docs/platforms/javascript/guides/connect/index.mdx index 5143f0a0ae791..f4b54dc85b387 100644 --- a/docs/platforms/javascript/guides/connect/index.mdx +++ b/docs/platforms/javascript/guides/connect/index.mdx @@ -11,61 +11,4 @@ categories: This guide explains how to set up Sentry in your Connect application. -Don't already have an account and Sentry project established? Head over to [sentry.io](https://sentry.io/signup/), then return to this page. - - -This guide is for version 8.0.0 and up of `@sentry/node`. - - -## Install - -Sentry captures data by using an SDK within your application’s runtime. This means that you have to add `@sentry/node` as a runtime dependency to your application: - -```bash {tabTitle:npm} -npm install --save @sentry/node -``` - -```bash {tabTitle:Yarn} -yarn add @sentry/node -``` - -## Configure - -Sentry should be initialized as early in your app as possible. It is essential that you call `Sentry.init` before you require any other modules in your application—otherwise, auto-instrumentation of these modules will _not_ work. - -You need to create a file named `instrument.js` that imports and initializes Sentry: - - - -If you set a `tracesSampleRate`, performance instrumentation will automatically be enabled for you. See Automatic Instrumentation to learn about all the things that the SDK automatically instruments for you. - -You can also manually capture performance data - see Custom Instrumentation for details. - -## Use - -You need to require or import the `instrument.js` file before requiring any other modules in your application. This is necessary to ensure that Sentry can automatically instrument all modules in your application: - - - - - -If you run your application with ESM, you need to import the Sentry Initialization file before importing any other modules. See running Sentry with ESM. -If you are unsure how you are running your application, see Installation Methods for more information. - - - - - -## Verify - -This snippet includes an intentional error, so you can test that everything is working as soon as you set it up. - - - - - -Learn more about manually capturing an error or message in our Usage documentation. - - - -To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. + diff --git a/docs/platforms/javascript/guides/express/index.mdx b/docs/platforms/javascript/guides/express/index.mdx index 4541478ce88f7..583d94c329e14 100644 --- a/docs/platforms/javascript/guides/express/index.mdx +++ b/docs/platforms/javascript/guides/express/index.mdx @@ -11,61 +11,4 @@ categories: This guide explains how to set up Sentry in your Express application. -Don't already have an account and Sentry project established? Head over to [sentry.io](https://sentry.io/signup/), then return to this page. - -This guide is for version 8.0.0 and up of `@sentry/node`. - -## Install - -Sentry captures data by using an SDK within your application’s runtime. This means that you have to add `@sentry/node` as a runtime dependency to your application: - -```bash {tabTitle:npm} -npm install --save @sentry/node -``` - -```bash {tabTitle:Yarn} -yarn add @sentry/node -``` - -## Configure - -Sentry should be initialized as early in your app as possible. It is essential that you call `Sentry.init` before you require any other modules in your application—otherwise, auto-instrumentation of these modules will _not_ work. - -Once this is done, Sentry's Node SDK captures unhandled exceptions as well as tracing data for your application. - -You need to create a file named `instrument.js` that imports and initializes Sentry: - - - -If you set a `tracesSampleRate`, performance instrumentation will automatically be enabled for you. See Automatic Instrumentation to learn about all the things that the SDK automatically instruments for you. - -You can also manually capture performance data - see Custom Instrumentation for details. - -## Use - -You need to require or import the `instrument.js` file before requiring any other modules in your application. This is necessary to ensure that Sentry can automatically instrument all modules in your application: - - - - - -If you run your application with ESM, you need to import the Sentry Initialization file before importing any other modules. See running Sentry with ESM. -If you are unsure how you are running your application, see Installation Methods for more information. - - - - - -## Verify - -This snippet includes an intentional error, so you can test that everything is working as soon as you set it up. - - - - - -Learn more about manually capturing an error or message in our Usage documentation. - - - -To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. + diff --git a/docs/platforms/javascript/guides/fastify/index.mdx b/docs/platforms/javascript/guides/fastify/index.mdx index e8a181a0152b5..b3bc73a2f2f4f 100644 --- a/docs/platforms/javascript/guides/fastify/index.mdx +++ b/docs/platforms/javascript/guides/fastify/index.mdx @@ -11,61 +11,4 @@ categories: This guide explains how to set up Sentry in your Fastify application. -Don't already have an account and Sentry project established? Head over to [sentry.io](https://sentry.io/signup/), then return to this page. - -This guide is for version 8.0.0 and up of `@sentry/node`. - -## Install - -Sentry captures data by using an SDK within your application’s runtime. This means that you have to add `@sentry/node` as a runtime dependency to your application: - -```bash {tabTitle:npm} -npm install --save @sentry/node -``` - -```bash {tabTitle:Yarn} -yarn add @sentry/node -``` - -## Configure - -Sentry should be initialized as early in your app as possible. It is essential that you call `Sentry.init` before you require any other modules in your application—otherwise, auto-instrumentation of these modules will _not_ work. - -Once this is done, Sentry's Node SDK captures unhandled exceptions as well as tracing data for your application. - -You need to create a file named `instrument.js` that imports and initializes Sentry: - - - -If you set a `tracesSampleRate`, performance instrumentation will automatically be enabled for you. See Automatic Instrumentation to learn about all the things that the SDK automatically instruments for you. - -You can also manually capture performance data - see Custom Instrumentation for details. - -## Use - -You need to require or import the `instrument.js` file before requiring any other modules in your application. This is necessary to ensure that Sentry can automatically instrument all modules in your application: - - - - - -If you run your application with ESM, you need to import the Sentry Initialization file before importing any other modules. See running Sentry with ESM. -If you are unsure how you are running your application, see Installation Methods for more information. - - - - - -## Verify - -This snippet includes an intentional error, so you can test that everything is working as soon as you set it up. - - - - - -Learn more about manually capturing an error or message in our Usage documentation. - - - -To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. + diff --git a/docs/platforms/javascript/guides/hapi/index.mdx b/docs/platforms/javascript/guides/hapi/index.mdx index 43adce58bcb81..c473c43093683 100644 --- a/docs/platforms/javascript/guides/hapi/index.mdx +++ b/docs/platforms/javascript/guides/hapi/index.mdx @@ -11,63 +11,4 @@ categories: This guide explains how to set up Sentry in your Hapi application. -Don't already have an account and Sentry project established? Head over to [sentry.io](https://sentry.io/signup/), then return to this page. - - -This guide is for version 8.0.0 and up of `@sentry/node`. - - -## Install - -Sentry captures data by using an SDK within your application’s runtime. This means that you have to add `@sentry/node` as a runtime dependency to your application: - -```bash {tabTitle:npm} -npm install --save @sentry/node -``` - -```bash {tabTitle:Yarn} -yarn add @sentry/node -``` - -## Configure - -Sentry should be initialized as early in your app as possible. It is essential that you call `Sentry.init` before you require any other modules in your application—otherwise, auto-instrumentation of these modules will _not_ work. - -Once this is done, Sentry's Node SDK captures unhandled exceptions as well as tracing data for your application. - -You need to create a file named `instrument.js` that imports and initializes Sentry: - - - -If you set a `tracesSampleRate`, performance instrumentation will automatically be enabled for you. See Automatic Instrumentation to learn about all the things that the SDK automatically instruments for you. - -You can also manually capture performance data - see Custom Instrumentation for details. - -## Use - -You need to require or import the `instrument.js` file before requiring any other modules in your application. This is necessary to ensure that Sentry can automatically instrument all modules in your application: - - - - - -If you run your application with ESM, you need to import the Sentry Initialization file before importing any other modules. See running Sentry with ESM. -If you are unsure how you are running your application, see Installation Methods for more information. - - - - - -## Verify - -This snippet includes an intentional error, so you can test that everything is working as soon as you set it up. - - - - - -Learn more about manually capturing an error or message in our Usage documentation. - - - -To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. + diff --git a/docs/platforms/javascript/guides/koa/index.mdx b/docs/platforms/javascript/guides/koa/index.mdx index d38533895ada9..36aa6d34f8961 100644 --- a/docs/platforms/javascript/guides/koa/index.mdx +++ b/docs/platforms/javascript/guides/koa/index.mdx @@ -11,63 +11,4 @@ categories: This guide explains how to set up Sentry in your Koa application. -Don't already have an account and Sentry project established? Head over to [sentry.io](https://sentry.io/signup/), then return to this page. - - -This guide is for version 8.0.0 and up of `@sentry/node`. - - -## Install - -Sentry captures data by using an SDK within your application’s runtime. This means that you have to add `@sentry/node` as a runtime dependency to your application: - -```bash {tabTitle:npm} -npm install --save @sentry/node -``` - -```bash {tabTitle:Yarn} -yarn add @sentry/node -``` - -## Configure - -Sentry should be initialized as early in your app as possible. It is essential that you call `Sentry.init` before you require any other modules in your application—otherwise, auto-instrumentation of these modules will _not_ work. - -Once this is done, Sentry's Node SDK captures unhandled exceptions as well as tracing data for your application. - -You need to create a file named `instrument.js` that imports and initializes Sentry: - - - -If you set a `tracesSampleRate`, performance instrumentation will automatically be enabled for you. See Automatic Instrumentation to learn about all the things that the SDK automatically instruments for you. - -You can also manually capture performance data - see Custom Instrumentation for details. - -## Use - -You need to require or import the `instrument.js` file before requiring any other modules in your application. This is necessary to ensure that Sentry can automatically instrument all modules in your application: - - - - - -If you run your application with ESM, you need to import the Sentry Initialization file before importing any other modules. See running Sentry with ESM. -If you are unsure how you are running your application, see Installation Methods for more information. - - - - - -## Verify - -This snippet includes an intentional error, so you can test that everything is working as soon as you set it up. - - - - - -Learn more about manually capturing an error or message in our Usage documentation. - - - -To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. + diff --git a/docs/platforms/javascript/guides/nestjs/index.mdx b/docs/platforms/javascript/guides/nestjs/index.mdx index bc3d2f58842f7..7d3a05993a17f 100644 --- a/docs/platforms/javascript/guides/nestjs/index.mdx +++ b/docs/platforms/javascript/guides/nestjs/index.mdx @@ -11,56 +11,4 @@ categories: This guide explains how to set up Sentry in your Nest.js application. -Don't already have an account and Sentry project established? Head over to [sentry.io](https://sentry.io/signup/), then return to this page. - - - This guide is for version 8.0.0 and up of `@sentry/node`. - - -## Install - -Sentry captures data by using an SDK within your application’s runtime. This means that you have to add `@sentry/node` as a runtime dependency to your application: - -```bash {tabTitle:npm} -npm install --save @sentry/node -``` - -```bash {tabTitle:Yarn} -yarn add @sentry/node -``` - -## Configure - -Sentry should be initialized as early in your app as possible. It is essential that you call `Sentry.init` before you require any other modules in your application—otherwise, auto-instrumentation of these modules will _not_ work. - -Once this is done, Sentry's Node SDK captures unhandled exceptions as well as tracing data for your application. - -You need to create a file named `instrument.js` that imports and initializes Sentry: - - - -If you set a `tracesSampleRate`, performance instrumentation will automatically be enabled for you. See Automatic Instrumentation to learn about all the things that the SDK automatically instruments for you. - -You can also manually capture performance data - see Custom Instrumentation for details. - -## Use - -You need to require or import the `instrument.js` file before requiring any other modules in your application. This is necessary to ensure that Sentry can automatically instrument all modules in your application: - - - - - -## Verify - -This snippet includes an intentional error, so you can test that everything is working as soon as you set it up. - - - - - - Learn more about manually capturing an error or message in our Usage documentation. - - - -To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. + diff --git a/docs/platforms/javascript/guides/node/index.mdx b/docs/platforms/javascript/guides/node/index.mdx index 18fc4faea2166..833b961047ea1 100644 --- a/docs/platforms/javascript/guides/node/index.mdx +++ b/docs/platforms/javascript/guides/node/index.mdx @@ -12,61 +12,4 @@ This guide explains how to set up Sentry in your Node.js application. -Don't already have an account and Sentry project established? Head over to [sentry.io](https://sentry.io/signup/), then return to this page. - -This guide is for version 8.0.0 and up of `@sentry/node`. - -## Install - -Sentry captures data by using an SDK within your application’s runtime. This means that you have to add `@sentry/node` as a runtime dependency to your application: - -```bash {tabTitle:npm} -npm install --save @sentry/node -``` - -```bash {tabTitle:Yarn} -yarn add @sentry/node -``` - -## Configure - -Sentry should be initialized as early in your app as possible. It is essential that you call `Sentry.init` before you require any other modules in your application—otherwise, auto-instrumentation of these modules will _not_ work. - -Once this is done, Sentry's Node SDK captures unhandled exceptions as well as tracing data for your application. - -You need to create a file named `instrument.js` that imports and initializes Sentry: - - - -If you set a `tracesSampleRate`, performance instrumentation will automatically be enabled for you. See Automatic Instrumentation to learn about all the things that the SDK automatically instruments for you. - -You can also manually capture performance data - see Custom Instrumentation for details. - -## Use - -You need to require or import the `instrument.js` file before requiring any other modules in your application. This is necessary to ensure that Sentry can automatically instrument all modules in your application: - - - - - -If you run your application with ESM, you need to import the Sentry Initialization file before importing any other modules. See running Sentry with ESM. -If you are unsure how you are running your application, see Installation Methods for more information. - - - - - -## Verify - -This snippet includes an intentional error, so you can test that everything is working as soon as you set it up. - - - - - -Learn more about manually capturing an error or message in our Usage documentation. - - - -To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. + diff --git a/platform-includes/getting-started-config/javascript.node.mdx b/platform-includes/getting-started-config/javascript.node.mdx index 3634bd4c2dc94..0136d14e95f7b 100644 --- a/platform-includes/getting-started-config/javascript.node.mdx +++ b/platform-includes/getting-started-config/javascript.node.mdx @@ -1,27 +1,43 @@ -```javascript {tabTitle:CommonJS} {filename: instrument.js} +```javascript {tabTitle:CommonJS} {filename: instrument.js} {"onboardingOptions": {"performance": "10-13", "profiling": "6-9, 14-17"}} const Sentry = require("@sentry/node"); // Ensure to call this before requiring any other modules! Sentry.init({ dsn: "___PUBLIC_DSN___", + integrations: [ + // Add our Profiling integration + nodeProfilingIntegration(), + ], // Add Performance Monitoring by setting tracesSampleRate // We recommend adjusting this value in production tracesSampleRate: 1.0, + + // Set sampling rate for profiling + // This is relative to tracesSampleRate + profilesSampleRate: 1.0, }); ``` -```javascript {tabTitle:ESM} {filename: instrument.mjs} +```javascript {tabTitle:ESM} {filename: instrument.mjs} {"onboardingOptions": {"performance": "10-13", "profiling": "6-9, 14-17"}} import * as Sentry from "@sentry/node"; // Ensure to call this before importing any other modules! Sentry.init({ dsn: "___PUBLIC_DSN___", + integrations: [ + // Add our Profiling integration + nodeProfilingIntegration(), + ], // Add Performance Monitoring by setting tracesSampleRate // We recommend adjusting this value in production tracesSampleRate: 1.0, + + // Set sampling rate for profiling + // This is relative to tracesSampleRate + profilesSampleRate: 1.0, }); ``` diff --git a/platform-includes/getting-started-node/javascript.mdx b/platform-includes/getting-started-node/javascript.mdx new file mode 100644 index 0000000000000..aae05fa9317ec --- /dev/null +++ b/platform-includes/getting-started-node/javascript.mdx @@ -0,0 +1,80 @@ +Don't already have an account and Sentry project established? Head over to [sentry.io](https://sentry.io/signup/), then return to this page. + +This guide is for version 8.0.0 and up of `@sentry/node`. + +## Install + + + +Sentry captures data by using an SDK within your application’s runtime. This means that you have to add `@sentry/node` as a runtime dependency to your application: + +```bash {tabTitle:npm} +npm install --save @sentry/node +``` + +```bash {tabTitle:Yarn} +yarn add @sentry/node +``` + + + +You also have to install the profiling-node package: + +```bash {tabTitle:npm} +npm install --save @sentry/profiling-node +``` + +```bash {tabTitle:Yarn} +yarn add @sentry/profiling-node +``` + + + +## Configure + +Sentry should be initialized as early in your app as possible. It is essential that you call `Sentry.init` before you require any other modules in your application—otherwise, auto-instrumentation of these modules will _not_ work. + +Once this is done, Sentry's Node SDK captures unhandled exceptions as well as tracing data for your application. + +You need to create a file named `instrument.js` that imports and initializes Sentry: + + + + + +Once you set a `tracesSampleRate`, performance instrumentation is automatically enabled for you. See Automatic Instrumentation to learn about all the things that the SDK automatically instruments for you. + +You can also manually capture performance data - see Custom Instrumentation for details. + + + +## Use + +You need to require or import the `instrument.js` file before requiring any other modules in your application. This is necessary to ensure that Sentry can automatically instrument all modules in your application: + + + + + +If you run your application with ESM, you need to import the Sentry Initialization file before importing any other modules. See running Sentry with ESM. +If you are unsure how you are running your application, see Installation Methods for more information. + + + + + +## Verify + +This snippet includes an intentional error, so you can test that everything is working as soon as you set it up. + + + + + +Learn more about manually capturing an error or message in our Usage documentation. + + + +To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. From 638622fc56087aa86b20e76ed3738de6416d3c34 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Tue, 28 May 2024 09:15:15 +0200 Subject: [PATCH 2/2] only show single code block --- platform-includes/getting-started-node/javascript.mdx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/platform-includes/getting-started-node/javascript.mdx b/platform-includes/getting-started-node/javascript.mdx index aae05fa9317ec..ec4169e294f23 100644 --- a/platform-includes/getting-started-node/javascript.mdx +++ b/platform-includes/getting-started-node/javascript.mdx @@ -10,6 +10,8 @@ Don't already have an account and Sentry project established? Head over to [sent Sentry captures data by using an SDK within your application’s runtime. This means that you have to add `@sentry/node` as a runtime dependency to your application: + + ```bash {tabTitle:npm} npm install --save @sentry/node ``` @@ -18,16 +20,16 @@ npm install --save @sentry/node yarn add @sentry/node ``` - + -You also have to install the profiling-node package: + ```bash {tabTitle:npm} -npm install --save @sentry/profiling-node +npm install --save @sentry/node @sentry/profiling-node ``` ```bash {tabTitle:Yarn} -yarn add @sentry/profiling-node +yarn add @sentry/node @sentry/profiling-node ```