Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions docs/platforms/javascript/guides/astro/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default defineConfig({

### Client-Side Setup

```javascript {filename:sentry.client.config.js} {"onboardingOptions": {"performance": "11,14-17", "session-replay": "12,18-25"}}
```javascript {filename:sentry.client.config.js}
import * as Sentry from "@sentry/astro";

Sentry.init({
Expand All @@ -105,13 +105,20 @@ Sentry.init({
sendDefaultPii: true,

integrations: [
// ___PRODUCT_OPTION_START___ performance
Sentry.browserTracingIntegration(),
// ___PRODUCT_OPTION_END___ performance
// ___PRODUCT_OPTION_START___ session-replay
Sentry.replayIntegration(),
// ___PRODUCT_OPTION_END___ session-replay
],
// ___PRODUCT_OPTION_START___ performance

// Define how likely traces are sampled. Adjust this value in production,
// or use tracesSampler for greater control.
tracesSampleRate: 1.0,
// ___PRODUCT_OPTION_END___ performance
// ___PRODUCT_OPTION_START___ session-replay

// 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
Expand All @@ -120,34 +127,43 @@ Sentry.init({
// If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs.
replaysOnErrorSampleRate: 1.0,
// ___PRODUCT_OPTION_END___ session-replay
});
```

### Server-Side Setup

```javascript {filename:sentry.server.config.js} {"onboardingOptions": {"performance": "15-18", "profiling": "2,10-14,19-22"}}
```javascript {filename:sentry.server.config.js}
import * as Sentry from "@sentry/astro";
// ___PRODUCT_OPTION_START___ profiling
import { nodeProfilingIntegration } from '@sentry/profiling-node';
// ___PRODUCT_OPTION_END___ profiling

Sentry.init({
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit: for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/astro/configuration/options/#sendDefaultPii
sendDefaultPii: true,
// ___PRODUCT_OPTION_START___ profiling

integrations: [
// Add our Profiling integration
nodeProfilingIntegration(),
],
// ___PRODUCT_OPTION_END___ profiling
// ___PRODUCT_OPTION_START___ performance

// Define how likely traces are sampled. Adjust this value in production,
// or use tracesSampler for greater control.
tracesSampleRate: 1.0,
// ___PRODUCT_OPTION_END___ performance
// ___PRODUCT_OPTION_START___ profiling

// Set sampling rate for profiling
// This is relative to tracesSampleRate
profilesSampleRate: 1.0
// ___PRODUCT_OPTION_END___ profiling
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ Select which Sentry features you'd like to install in addition to Error Monitori

Set the following environment variables in your Lambda function configuration:

```bash {"onboardingOptions": {"performance": "3"}}
```bash
NODE_OPTIONS="-r @sentry/aws-serverless/awslambda-auto"
SENTRY_DSN="___PUBLIC_DSN___"
# ___PRODUCT_OPTION_START___ performance
SENTRY_TRACES_SAMPLE_RATE="1.0"
# ___PRODUCT_OPTION_END___ performance
```

To set environment variables, navigate to your Lambda function, select **Configuration**, then **Environment variables**:
Expand All @@ -67,7 +69,7 @@ Note that you don't have to actually install an NPM package for this to work, as

Make sure you completed [step 1](#1-prerequisites) and [step 2](#2-add-the-sentry-lambda-layer) before proceeding.

```javascript {filename:index.js} {"onboardingOptions": {"performance": "9-15"}}
```javascript {filename:index.js}
const Sentry = require("@sentry/aws-serverless");

Sentry.init({
Expand All @@ -76,13 +78,15 @@ Sentry.init({
// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/options/#sendDefaultPii
sendDefaultPii: true,
// ___PRODUCT_OPTION_START___ performance

// Add Tracing by setting tracesSampleRate and adding integration
// Set tracesSampleRate to 1.0 to capture 100% of transactions
// We recommend adjusting this value in production
// Learn more at
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
tracesSampleRate: 1.0,
// ___PRODUCT_OPTION_END___ performance
});

exports.handler = Sentry.wrapHandler(async (event, context) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ Select which Sentry features you'd like to install in addition to Error Monitori

Set the following environment variables in your Lambda function configuration:

```bash {"onboardingOptions": {"performance": "3"}}
```bash
NODE_OPTIONS="-r @sentry/serverless/dist/awslambda-auto"
SENTRY_DSN="___PUBLIC_DSN___"
# ___PRODUCT_OPTION_START___ performance
SENTRY_TRACES_SAMPLE_RATE="1.0"
# ___PRODUCT_OPTION_END___ performance
```

To set environment variables, navigate to your Lambda function, select **Configuration**, then **Environment variables**.
Expand All @@ -68,17 +70,19 @@ Note that you don't have to actually install an NPM package for this to work, as

Make sure you completed [step 1](#1-prerequisites) and [step 2](#2-add-the-sentry-lambda-layer) before proceeding.

```javascript {filename:index.js} {"onboardingOptions": {"performance": "5-8"}}
```javascript {filename:index.js}
const Sentry = require("@sentry/serverless");

Sentry.init({
dsn: "___PUBLIC_DSN___",
// ___PRODUCT_OPTION_START___ performance
// Add Tracing by setting tracesSampleRate and adding integration
// Set tracesSampleRate to 1.0 to capture 100% of transactions
// We recommend adjusting this value in production
// Learn more at
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
tracesSampleRate: 1.0,
// ___PRODUCT_OPTION_END___ performance
});

exports.handler = Sentry.wrapHandler(async (event, context) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ Select which Sentry features you'd like to install in addition to Error Monitori

Set the following environment variables in your Lambda function configuration:

```bash {"onboardingOptions": {"performance": "3"}}
```bash
NODE_OPTIONS="-r @sentry/aws-serverless/awslambda-auto"
SENTRY_DSN="___PUBLIC_DSN___"
# ___PRODUCT_OPTION_START___ performance
SENTRY_TRACES_SAMPLE_RATE="1.0"
# ___PRODUCT_OPTION_END___ performance
```

To set environment variables, navigate to your Lambda function, select **Configuration**, then **Environment variables**:
Expand All @@ -79,17 +81,19 @@ Note that you don't have to actually install an NPM package for this to work, as

Make sure you completed [step 1](#1-prerequisites) and [step 2](#2-add-the-sentry-lambda-layer) before proceeding.

```javascript {filename:index.js} {"onboardingOptions": {"performance": "5-8"}}
```javascript {filename:index.js}
const Sentry = require("@sentry/aws-serverless");

Sentry.init({
dsn: "___PUBLIC_DSN___",
// ___PRODUCT_OPTION_START___ performance
// Add Tracing by setting tracesSampleRate and adding integration
// Set tracesSampleRate to 1.0 to capture 100% of transactions
// We recommend adjusting this value in production
// Learn more at
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
tracesSampleRate: 1.0,
// ___PRODUCT_OPTION_END___ performance
});

exports.handler = Sentry.wrapHandler(async (event, context) => {
Expand Down
10 changes: 9 additions & 1 deletion docs/platforms/javascript/guides/aws-lambda/install/cjs-npm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,36 @@ pnpm add @sentry/aws-serverless @sentry/profiling-node

Initialize and configure the SDK in your Lambda function Code. Call `Sentry.init` _outside_ of the handler function to avoid re-initializing the SDK on every invocation. Also, add the `Sentry.wrapHandler` wrapper around your function to automatically catch errors and performance data:

```javascript {filename:index.js} {"onboardingOptions": {"performance": "12-18", "profiling": "2,10-11,17-21"}}
```javascript {filename:index.js}
const Sentry = require("@sentry/aws-serverless");
// ___PRODUCT_OPTION_START___ profiling
const { nodeProfilingIntegration } = require("@sentry/profiling-node");

// ___PRODUCT_OPTION_END___ profiling
Sentry.init({
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/options/#sendDefaultPii
sendDefaultPii: true,

// ___PRODUCT_OPTION_START___ profiling
integrations: [nodeProfilingIntegration()],
// ___PRODUCT_OPTION_END___ profiling

// ___PRODUCT_OPTION_START___ performance
// Add Tracing by setting tracesSampleRate and adding integration
// Set tracesSampleRate to 1.0 to capture 100% of transactions
// We recommend adjusting this value in production
// Learn more at
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
tracesSampleRate: 1.0,
// ___PRODUCT_OPTION_END___ performance
// ___PRODUCT_OPTION_START___ profiling

// Set sampling rate for profiling - this is relative to tracesSampleRate
profilesSampleRate: 1.0,
// ___PRODUCT_OPTION_END___ profiling
});

exports.handler = Sentry.wrapHandler(async (event, context) => {
Expand Down
14 changes: 12 additions & 2 deletions docs/platforms/javascript/guides/aws-lambda/install/esm-npm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,12 @@ export const handler = Sentry.wrapHandler(async (event, context) => {

To initialize and configure the SDK, you need to set the following environment variables in your AWS Lambda function configuration:

```bash {"onboardingOptions": {"performance": "3"}}
```bash
NODE_OPTIONS="--import @sentry/aws-serverless/awslambda-auto"
SENTRY_DSN="___PUBLIC_DSN___"
# ___PRODUCT_OPTION_START___ performance
SENTRY_TRACES_SAMPLE_RATE="1.0"
# ___PRODUCT_OPTION_END___ performance
```

To set environment variables, navigate to your Lambda function, select **Configuration**, then **Environment variables**:
Expand All @@ -107,28 +109,36 @@ Follow steps 1 and 2 above to [install the SDK NPM package](#2-install) in your

Create a new file, for example `instrument.mjs` to initialize the SDK:

```javascript {filename:instrument.mjs} {"onboardingOptions": {"performance": "12-18", "profiling": "2,10-11,17-21"}}
```javascript {filename:instrument.mjs}
import * as Sentry from "@sentry/aws-serverless";
// ___PRODUCT_OPTION_START___ profiling
import { nodeProfilingIntegration } from "@sentry/profiling-node";

// ___PRODUCT_OPTION_END___ profiling
Sentry.init({
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/options/#sendDefaultPii
sendDefaultPii: true,
// ___PRODUCT_OPTION_START___ profiling

integrations: [nodeProfilingIntegration()],
// ___PRODUCT_OPTION_END___ profiling
// ___PRODUCT_OPTION_START___ performance

// Add Tracing by setting tracesSampleRate and adding integration
// Set tracesSampleRate to 1.0 to capture 100% of transactions
// We recommend adjusting this value in production
// Learn more at
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
tracesSampleRate: 1.0,
// ___PRODUCT_OPTION_END___ performance

// ___PRODUCT_OPTION_START___ profiling
// Set sampling rate for profiling - this is relative to tracesSampleRate
profilesSampleRate: 1.0,
// ___PRODUCT_OPTION_END___ profiling
});
```

Expand Down
10 changes: 9 additions & 1 deletion docs/platforms/javascript/guides/azure-functions/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,38 @@ Sentry captures data by using an SDK within your application’s runtime. This m

To set up Sentry error logging for an Azure Function:

```javascript {tabTitle:async} {"onboardingOptions": {"performance": "14-20", "profiling": "2, 10-13, 21-23"}}
```javascript {tabTitle:async}
const Sentry = require("@sentry/node");
// ___PRODUCT_OPTION_START___ profiling
const { nodeProfilingIntegration } = require("@sentry/profiling-node");

// ___PRODUCT_OPTION_END___ profiling
Sentry.init({
dsn: "___PUBLIC_DSN___",

// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/azure-functions/configuration/options/#sendDefaultPii
sendDefaultPii: true,
// ___PRODUCT_OPTION_START___ profiling

integrations: [
nodeProfilingIntegration(),
],
// ___PRODUCT_OPTION_END___ profiling

// ___PRODUCT_OPTION_START___ performance
// Add Performance Monitoring by setting tracesSampleRate
// Set tracesSampleRate to 1.0 to capture 100% of transactions
// We recommend adjusting this value in production
// Learn more at
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
tracesSampleRate: 1.0,
// ___PRODUCT_OPTION_END___ performance

// ___PRODUCT_OPTION_START___ profiling
// Set sampling rate for profiling - this is relative to tracesSampleRate
profilesSampleRate: 1.0,
// ___PRODUCT_OPTION_END___ profiling
});

module.exports = async function (context, req) {
Expand Down
10 changes: 8 additions & 2 deletions docs/platforms/javascript/guides/bun/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Once this is done, Sentry's Bun SDK captures unhandled exceptions as well as tra

You need to create a file named `instrument.js` that imports and initializes Sentry:

```javascript {filename: instrument.js} {"onboardingOptions": {"performance": "10-16"}}
```javascript {filename: instrument.js}
import * as Sentry from "@sentry/bun";

// Ensure to call this before importing any other modules!
Expand All @@ -44,13 +44,15 @@ Sentry.init({
// Adds request headers and IP for users, for more info visit:
// https://docs.sentry.io/platforms/javascript/guides/bun/configuration/options/#sendDefaultPii
sendDefaultPii: true,
// ___PRODUCT_OPTION_START___ performance

// Add Performance Monitoring by setting tracesSampleRate
// Set tracesSampleRate to 1.0 to capture 100% of transactions
// We recommend adjusting this value in production
// Learn more at
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
tracesSampleRate: 1.0,
// ___PRODUCT_OPTION_END___ performance
});
```

Expand Down Expand Up @@ -78,10 +80,12 @@ import http from "http";

This snippet includes an intentional error, so you can test that everything is working as soon as you set it up.

```javascript {"onboardingOptions": {"performance": "1-4, 12"}}
```javascript
// ___PRODUCT_OPTION_START___ performance
Sentry.startSpan({
op: "test",
name: "My First Test Transaction",
// ___PRODUCT_OPTION_END___ performance
}, () => {
setTimeout(() => {
try {
Expand All @@ -90,7 +94,9 @@ Sentry.startSpan({
Sentry.captureException(e);
}
}, 99);
// ___PRODUCT_OPTION_START___ performance
});
// ___PRODUCT_OPTION_END___ performance
```

<Alert>
Expand Down
Loading