Skip to content

Commit 16769da

Browse files
committed
v8: serverless profiling and performance
1 parent d353e5d commit 16769da

File tree

5 files changed

+45
-102
lines changed

5 files changed

+45
-102
lines changed

docs/platforms/javascript/guides/aws-lambda/performance/instrumentation/automatic-instrumentation.mdx

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,28 @@ description: "Learn what transactions are captured after tracing is enabled."
44
sidebar_order: 10
55
---
66

7-
By default, Sentry's Node.js SDK can automatically instrument HTTP calls.
8-
In order for this to work, you have to create transactions which the HTTP calls will be added to as spans.
9-
10-
Read more about [Custom Instrumentation](./../custom-instrumentation/) to learn how to create transactions and add your own spans.
11-
12-
<Note>
13-
14-
If you're adopting Performance in a high-throughput environment, we recommend testing prior to deployment to ensure that your service's performance characteristics maintain expectations.
15-
16-
Note, that calling `Sentry.autoDiscoverNodePerformanceMonitoringIntegrations` will degrade startup performance of your app due to file I/O operations.
17-
This is especially a concern in Serverless functions.
18-
We recommend manually adding <PlatformLink to="/performance/database" >database integrations</PlatformLink> of your choice manually (see example below).
19-
20-
</Note>
21-
22-
<SignInNote />
7+
When performance is enabled through `tracesSampleRate`, `enableTracing` or a `tracesSampler` function, the Sentry SDK will automatically capture spans for the following:
8+
9+
- Fastify routes & middlewares
10+
- HTTP requests made with `http`, `https` and `fetch`
11+
- DB queries made with:
12+
- `mysql`
13+
- `mysql2`
14+
- `pg`
15+
- `graphql` (including Apollo Server)
16+
- `mongo`
17+
- `mongoose`
18+
- `prisma`
19+
- `ioredis`
20+
21+
All of these are automatically set up for you without any further configuration. The only exception is Prisma, which you have to opt-in for:
2322

2423
```javascript
25-
const Sentry = require("@sentry/node");
24+
const Sentry = require("@sentry/aws-serverless");
2625

2726
Sentry.init({
2827
dsn: "___PUBLIC_DSN___",
29-
integrations: [
30-
// Automatically instrument Node.js libraries and frameworks
31-
// (This function is slow because of file I/O, consider manually adding additional integrations instead)
32-
...Sentry.autoDiscoverNodePerformanceMonitoringIntegrations(),
33-
// Or manually add integrations of your choice. For example:
34-
new Sentry.Integrations.Apollo(),
35-
new Sentry.Integrations.Postgres(),
36-
],
37-
38-
// We recommend adjusting this value in production, or using tracesSampler
39-
// for finer control
4028
tracesSampleRate: 1.0,
29+
integrations: [Sentry.prismaIntegration()],
4130
});
4231
```

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@ If you're adopting Profiling in a high-throughput environment, we recommend test
1616
<Note>
1717

1818
Node profiling is available starting in `@sentry/profiling-node` version `0.3.0`.
19-
You have to have the `@sentry/node` (minimum version `7.44.1`) package installed.
19+
You have to have the `@sentry/aws-serverless` (minimum version `8.0.0`) package installed.
2020

2121
</Note>
2222

2323
```bash {tabTitle:npm}
24-
npm install --save @sentry/node @sentry/profiling-node
24+
npm install --save @sentry/aws-serverless @sentry/profiling-node
2525
```
2626

2727
```bash {tabTitle:Yarn}
28-
yarn add @sentry/node @sentry/profiling-node
28+
yarn add @sentry/aws-serverless @sentry/profiling-node
2929
```
3030

3131
## Enabling Profiling
3232

33-
To enable profiling, import @sentry/profiling-node, add ProfilingIntegration to your integrations, and set the profilesSampleRate.
33+
To enable profiling, import `@sentry/profiling-node`, add the `nodeProfilingIntegration` to your integrations, and set the `profilesSampleRate`.
3434

3535
<SignInNote />
3636

3737
```javascript
38-
const Sentry = require("@sentry/node");
38+
const Sentry = require("@sentry/aws-serverless");
3939
const { nodeProfilingIntegration } = require("@sentry/profiling-node");
4040

4141
Sentry.init({

docs/platforms/javascript/guides/azure-functions/performance/instrumentation/automatic-instrumentation.mdx

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,4 @@ description: "Learn what transactions are captured after tracing is enabled."
44
sidebar_order: 10
55
---
66

7-
By default, Sentry's Node.js SDK can automatically instrument HTTP calls.
8-
In order for this to work, you have to create transactions which the HTTP calls will be added to as spans.
9-
10-
Read more about [Custom Instrumentation](./../custom-instrumentation/) to learn how to create transactions and add your own spans.
11-
12-
<Note>
13-
14-
If you're adopting Performance in a high-throughput environment, we recommend testing prior to deployment to ensure that your service's performance characteristics maintain expectations.
15-
16-
Note, that calling `Sentry.autoDiscoverNodePerformanceMonitoringIntegrations` will degrade startup performance of your app due to file I/O operations.
17-
This is especially a concern in Serverless functions.
18-
We recommend manually adding <PlatformLink to="/performance/database" >database integrations</PlatformLink> of your choice manually (see example below).
19-
20-
</Note>
21-
22-
<SignInNote />
23-
24-
```javascript
25-
const Sentry = require("@sentry/node");
26-
27-
Sentry.init({
28-
dsn: "___PUBLIC_DSN___",
29-
integrations: [
30-
// Automatically instrument Node.js libraries and frameworks
31-
// (This function is slow because of file I/O, consider manually adding additional integrations instead)
32-
...Sentry.autoDiscoverNodePerformanceMonitoringIntegrations(),
33-
// Or manually add integrations of your choice. For example:
34-
new Sentry.Integrations.Apollo(),
35-
new Sentry.Integrations.Postgres(),
36-
],
37-
38-
// We recommend adjusting this value in production, or using tracesSampler
39-
// for finer control
40-
tracesSampleRate: 1.0,
41-
});
42-
```
7+
<Include name="node-automatic-instrumentation" />

docs/platforms/javascript/guides/gcp-functions/performance/instrumentation/automatic-instrumentation.mdx

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,28 @@ description: "Learn what transactions are captured after tracing is enabled."
44
sidebar_order: 10
55
---
66

7-
By default, Sentry's Node.js SDK can automatically instrument HTTP calls.
8-
In order for this to work, you have to create transactions which the HTTP calls will be added to as spans.
9-
10-
Read more about [Custom Instrumentation](./../custom-instrumentation/) to learn how to create transactions and add your own spans.
11-
12-
<Note>
13-
14-
If you're adopting Performance in a high-throughput environment, we recommend testing prior to deployment to ensure that your service's performance characteristics maintain expectations.
15-
16-
Note, that calling `Sentry.autoDiscoverNodePerformanceMonitoringIntegrations` will degrade startup performance of your app due to file I/O operations.
17-
This is especially a concern in Serverless functions.
18-
We recommend manually adding <PlatformLink to="/performance/database" >database integrations</PlatformLink> of your choice manually (see example below).
19-
20-
</Note>
21-
22-
<SignInNote />
7+
When performance is enabled through `tracesSampleRate`, `enableTracing` or a `tracesSampler` function, the Sentry SDK will automatically capture spans for the following:
8+
9+
- Fastify routes & middlewares
10+
- HTTP requests made with `http`, `https` and `fetch`
11+
- DB queries made with:
12+
- `mysql`
13+
- `mysql2`
14+
- `pg`
15+
- `graphql` (including Apollo Server)
16+
- `mongo`
17+
- `mongoose`
18+
- `prisma`
19+
- `ioredis`
20+
21+
All of these are automatically set up for you without any further configuration. The only exception is Prisma, which you have to opt-in for:
2322

2423
```javascript
25-
const Sentry = require("@sentry/node");
24+
const Sentry = require("@sentry/google-cloud-serverless");
2625

2726
Sentry.init({
2827
dsn: "___PUBLIC_DSN___",
29-
integrations: [
30-
// Automatically instrument Node.js libraries and frameworks
31-
// (This function is slow because of file I/O, consider manually adding additional integrations instead)
32-
...Sentry.autoDiscoverNodePerformanceMonitoringIntegrations(),
33-
// Or manually add integrations of your choice. For example:
34-
new Sentry.Integrations.Apollo(),
35-
new Sentry.Integrations.Postgres(),
36-
],
37-
38-
// We recommend adjusting this value in production, or using tracesSampler
39-
// for finer control
4028
tracesSampleRate: 1.0,
29+
integrations: [Sentry.prismaIntegration()],
4130
});
4231
```

docs/platforms/javascript/guides/gcp-functions/profiling/index.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@ If you're adopting Profiling in a high-throughput environment, we recommend test
1616
<Note>
1717

1818
Node profiling is available starting in `@sentry/profiling-node` version `0.3.0`.
19-
You have to have the `@sentry/node` (minimum version `7.44.1`) package installed.
19+
You have to have the `@sentry/google-cloud-serverless` (minimum version `8.0.0`) package installed.
2020

2121
</Note>
2222

2323
```bash {tabTitle:npm}
24-
npm install --save @sentry/node @sentry/profiling-node
24+
npm install --save @sentry/google-cloud-serverless @sentry/profiling-node
2525
```
2626

2727
```bash {tabTitle:Yarn}
28-
yarn add @sentry/node @sentry/profiling-node
28+
yarn add @sentry/google-cloud-serverless @sentry/profiling-node
2929
```
3030

3131
## Enabling Profiling
3232

33-
To enable profiling, import @sentry/profiling-node, add ProfilingIntegration to your integrations, and set the profilesSampleRate.
33+
To enable profiling, import `@sentry/profiling-node`, add the `nodeProfilingIntegration` to your integrations, and set the `profilesSampleRate`.
3434

3535
<SignInNote />
3636

3737
```javascript
38-
const Sentry = require("@sentry/node");
38+
const Sentry = require("@sentry/google-cloud-serverless");
3939
const { nodeProfilingIntegration } = require("@sentry/profiling-node");
4040

4141
Sentry.init({

0 commit comments

Comments
 (0)