Skip to content

Commit ab1b6cf

Browse files
authored
docs(js): Update profiling docs (#12161)
1 parent 2b22a2e commit ab1b6cf

File tree

24 files changed

+154
-922
lines changed

24 files changed

+154
-922
lines changed

docs/platforms/javascript/common/configuration/integrations/browserprofiling.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: BrowserProfiling
33
description: "Capture profiling data for the Browser."
44
notSupported:
55
- javascript.cordova
6+
- javascript.capacitor
67
- javascript.node
78
- javascript.aws-lambda
89
- javascript.azure-functions
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: Browser Profiling
3+
sidebar_order: 5000
4+
supported:
5+
- javascript
6+
notSupported:
7+
- javascript.bun
8+
- javascript.cordova
9+
- javascript.capacitor
10+
- javascript.deno
11+
- javascript.cloudflare
12+
- javascript.node
13+
- javascript.aws-lambda
14+
- javascript.azure-functions
15+
- javascript.connect
16+
- javascript.express
17+
- javascript.fastify
18+
- javascript.gcp-functions
19+
- javascript.hapi
20+
- javascript.koa
21+
- javascript.nestjs
22+
description: "Collect & view performance insights for JavaScript programs with Sentry's JavaScript Profiling integration."
23+
---
24+
25+
<Note>
26+
27+
Browser Profiling is currently in beta. Beta features are still in progress and may have bugs. We recognize the irony.
28+
29+
</Note>
30+
31+
The browser profiling integration is built using the [JS Self-Profiling API](https://wicg.github.io/js-self-profiling/) and will likely only move out of beta once the specification progresses and gains adoption. See [platform status](https://chromestatus.com/feature/5170190448852992).
32+
33+
Note that since the profiling API is currently only exposed in Chromium, profiles collected only include that demographic. We hope that as the API gains adoption, other browsers will implement it as well.
34+
35+
<PlatformContent includePath="profiling/index/why-profiling" />
36+
37+
## Prerequisites
38+
39+
To get started with JavaScript browser profiling, you'll need to:
40+
41+
- Install the <PlatformSdkPackageName fallback="@sentry/browser"/> SDK, minimum version 7.60.0
42+
- Configure the document response header to include `Document-Policy: js-profiling`
43+
- Configure the SDK to use the `BrowserProfilingIntegration` and set `profilesSampleRate`
44+
45+
## Step 1: Install the <PlatformOrGuideName/> SDK
46+
47+
<PlatformSection notSupported={["javascript.electron"]}>
48+
49+
Install our <PlatformOrGuideName/> SDK using either `yarn` or `npm`, the minimum version that supports profiling is **7.60.0**.
50+
51+
</PlatformSection>
52+
53+
<PlatformSection supported={["javascript.electron"]}>
54+
55+
Install our Electron SDK using either `yarn` or `npm`, the minimum version that supports profiling is **4.16.0**.
56+
57+
</PlatformSection>
58+
59+
<PlatformContent includePath="profiling/automatic-instrumentation-intro" />
60+
61+
## Step 2: Add Document-Policy: js-profiling header
62+
63+
For the JavaScript browser profiler to start, the document response header needs to include a `Document-Policy` header key with the `js-profiling` value.
64+
65+
<PlatformContent includePath="profiling/automatic-instrumentation-headers" />
66+
67+
## Step 3: Configure the <PlatformOrGuideName/> SDK
68+
69+
Configuration should happen as early as possible in your application's lifecycle. Once this is done, Sentry's JavaScript SDK will capture all unhandled exceptions and transactions.
70+
71+
<PlatformContent includePath="profiling/automatic-instrumentation-setup" />
72+
73+
## The Difference Between DevTools & Sentry's JavaScript Browser Profiler
74+
75+
What does Sentry's JavaScript browser profile offer that Chrome DevTools does not?
76+
77+
- Sentry's JavaScript profiler runs in production and captures real user data, showing real-world performance. DevTools runs locally and only shows profiles of what's running on your machine.
78+
- Sentry runs at a lower sampling rate of 100Hz with a 10ms sample period versus a sampling rate of 1000Hz and a 1ms sample period for DevTools.
79+
- Sentry supports deobfuscation, making it so that all the function names in your code are correct. Typically, when you run JavaScript code, it's minified, meaning that all the function names are replaced with machine-generated abbreviations.
80+
81+
Please note, that since the browser profiling API is currently only implemented in Chromium-based browsers, the profiles collected with Sentry's JavaScript browser profiling will inherently be biased toward that demographic. This is something that you'll need to consider if you're basing your decisions on the data collected.
82+
83+
We hope that as the Javascript browser profiling API gains adoption, other browsers will implement it as well. If you find the browser profiling feature helpful and would like to see it gain further adoption, please consider supporting the spec at the official WICG repository.
Lines changed: 3 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,13 @@
11
---
22
title: Set Up Profiling
33
sidebar_order: 5000
4-
supported:
5-
- javascript
4+
description: "Collect & view performance insights for JavaScript programs with Sentry's Profiling integrations. Get started with browser and Node.js profiling to understand your application's performance."
65
notSupported:
76
- javascript.bun
87
- javascript.cordova
8+
- javascript.capacitor
99
- javascript.deno
1010
- javascript.cloudflare
11-
description: "Collect & view performance insights for JavaScript programs with Sentry’s JavaScript Profiling integration. Get started with browser profiling here."
1211
---
1312

14-
<Note>
15-
16-
Browser Profiling is currently in beta. Beta features are still in progress and may have bugs. We recognize the irony.
17-
18-
</Note>
19-
20-
The browser profiling integration is built using [JS Self-Profiling API](https://wicg.github.io/js-self-profiling/) and will likely only move out of beta once the specification progresses and gains adoption. See platform [status](https://chromestatus.com/feature/5170190448852992).
21-
22-
Note that since the profiling API is currently only exposed in Chromium, profiles collected only include that demographic. This is obvious, but should not be forgotten when analyzing the data collected. We hope that as the API gains adoption, other browsers will implement it as well.
23-
24-
<PlatformContent includePath="profiling/index/why-profiling" />
25-
26-
## Prerequisites
27-
28-
To get started with JavaScript browser profiling, you'll need to:
29-
30-
- Install the <PlatformSdkPackageName fallback="@sentry/browser"/> SDK, minimum version 7.60.0
31-
- Configure the document response header to include `Document-Policy: js-profiling`
32-
- Configure the SDK to use the `BrowserProfilingIntegration` and set `profilesSampleRate`
33-
34-
## Step 1: Install the <PlatformOrGuideName/> SDK
35-
36-
<PlatformSection notSupported={["javascript.electron"]}>
37-
38-
Install our <PlatformOrGuideName/> SDK using either `yarn` or `npm`, the minimum version that supports profiling is **7.60.0**.
39-
40-
</PlatformSection>
41-
42-
<PlatformSection supported={["javascript.electron"]}>
43-
44-
Install our Electron SDK using either `yarn` or `npm`, the minimum version that supports profiling is **4.16.0**.
45-
46-
</PlatformSection>
47-
48-
<PlatformContent includePath="profiling/automatic-instrumentation-intro" />
49-
50-
## Step 2: Add Document-Policy: js-profiling header
51-
52-
For the JavaScript browser profiler to start, the document response header needs to include a `Document-Policy` header key with the `js-profiling` value.
53-
54-
<PlatformContent includePath="profiling/automatic-instrumentation-headers" />
55-
56-
## Step 3: Configure the JavaScript SDK
57-
58-
Configuration should happen as early as possible in your application's lifecycle. Once this is done, Sentry's JavaScript SDK will capture all unhandled exceptions and transactions.
59-
60-
<PlatformContent includePath="profiling/automatic-instrumentation-setup" />
61-
62-
## The Difference Between DevTools & Sentry's JavaScript Browser Profiler
63-
64-
What does Sentry's JavaScript browser profile offer that Chrome DevTools does not?
65-
66-
- Sentry JavaScript profiler runs in production and captures real user data, showing real-world performance. DevTools runs locally on your machine and only shows profiles of what's running on your machine.
67-
- Sentry runs at a lower sampling rate of 100Hz with a 10ms sample period versus a sampling rate of 1000Hz and a 1ms sample period for DevTools.
68-
- Sentry supports deobfuscation, making it so that all the function names in your code are correct. Typically, when you run JavaScript code, it's minified, meaning that all the function names are replaced with machine-generated abbreviations.
69-
70-
Please note, that since the browser profiling API is currently only implemented in Chromium-based browsers, the profiles collected with Sentry's JavaScript browser profiling will inherently be biased toward that demographic. This is something that you'll need to consider if you're basing your decisions on the data collected.
71-
72-
We hope that as the Javascript browser profiling API gains adoption, other browsers will implement it as well. If you find the browser profiling feature helpful and would like to see it gain further adoption, please consider supporting the spec at the official WICG repository.
13+
<PageGrid />

docs/platforms/javascript/guides/nestjs/profiling/index.mdx renamed to docs/platforms/javascript/common/profiling/node-profiling.mdx

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
---
2-
title: Set Up Profiling
2+
title: Node Profiling
33
sidebar_order: 5000
44
description: "Learn more about how to configure our Profiling integration and start profiling your code."
5+
supported:
6+
- javascript.nextjs
7+
- javascript.sveltekit
8+
- javascript.remix
9+
- javascript.astro
10+
- javascript.node
11+
- javascript.aws-lambda
12+
- javascript.azure-functions
13+
- javascript.connect
14+
- javascript.express
15+
- javascript.fastify
16+
- javascript.gcp-functions
17+
- javascript.hapi
18+
- javascript.koa
19+
- javascript.nestjs
520
---
621

722
By default, Sentry error events will not get trace context unless you configure the scope with the transaction, as illustrated in the example below.
@@ -14,43 +29,25 @@ If you're adopting Profiling in a high-throughput environment, we recommend test
1429

1530
## Installation
1631

17-
<Note>
18-
1932
Node profiling is available starting in `@sentry/profiling-node` version `0.3.0`.
20-
You have to have the `@sentry/nestjs` package installed.
21-
22-
</Note>
23-
24-
```bash {tabTitle:npm}
25-
npm install @sentry/nestjs @sentry/profiling-node --save
26-
```
27-
28-
```bash {tabTitle:yarn}
29-
yarn add @sentry/nestjs @sentry/profiling-node
30-
```
31-
32-
```bash {tabTitle:pnpm}
33-
pnpm add @sentry/nestjs @sentry/profiling-node
34-
```
33+
You have to have the <PlatformSdkPackageName fallback="@sentry/node"/> (minimum version `7.44.1`) package installed.
3534

3635
## Enabling Profiling
3736

38-
To enable profiling, import `@sentry/profiling-node`, add `ProfilingIntegration` to your `integrations`, and set the `profilesSampleRate`.
39-
37+
To enable profiling, add `@sentry/profiling-node` to your imports and set up `nodeProfilingIntegration` in your Sentry config.
4038

41-
```javascript
42-
const Sentry = require("@sentry/nestjs");
39+
```javascript {diff}
4340
const { nodeProfilingIntegration } = require("@sentry/profiling-node");
4441

4542
Sentry.init({
4643
dsn: "___PUBLIC_DSN___",
4744
integrations: [
4845
// Add our Profiling integration
49-
nodeProfilingIntegration(),
46+
+ nodeProfilingIntegration(),
5047
],
5148
tracesSampleRate: 1.0,
52-
// Set sampling rate for profiling - this is relative to tracesSampleRate
53-
profilesSampleRate: 1.0,
49+
+ // Set sampling rate for profiling - this is relative to tracesSampleRate
50+
+ profilesSampleRate: 1.0,
5451
});
5552

5653
// Profiling happens automatically after setting it up with `Sentry.init()`.

docs/platforms/javascript/guides/aws-lambda/profiling/index.mdx

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)