@sentry/node 8.0.0-alpha.1 → 8.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -93
- package/cjs/index.js +3665 -77
- package/cjs/index.js.map +1 -1
- package/esm/index.js +3614 -31
- package/esm/index.js.map +1 -1
- package/esm/integrations/anr/worker-script.js +2 -2
- package/esm/package.json +1 -0
- package/package.json +21 -6
- package/types/index.d.ts +6 -5
- package/types/index.d.ts.map +1 -1
- package/types/integrations/anr/index.d.ts.map +1 -1
- package/types/integrations/anr/worker-script.d.ts +1 -1
- package/types/integrations/anr/worker-script.d.ts.map +1 -1
- package/types/integrations/http.d.ts +4 -0
- package/types/integrations/http.d.ts.map +1 -1
- package/types/integrations/local-variables/common.d.ts +1 -0
- package/types/integrations/local-variables/common.d.ts.map +1 -1
- package/types/integrations/local-variables/local-variables-sync.d.ts +1 -0
- package/types/integrations/local-variables/local-variables-sync.d.ts.map +1 -1
- package/types/integrations/tracing/fastify.d.ts +9 -0
- package/types/integrations/tracing/fastify.d.ts.map +1 -1
- package/types/integrations/tracing/hapi/index.d.ts.map +1 -1
- package/types/integrations/tracing/prisma.d.ts.map +1 -1
- package/types/proxy/helpers.d.ts +2 -2
- package/types/proxy/helpers.d.ts.map +1 -1
- package/types/proxy/index.d.ts.map +1 -1
- package/types/sdk/hub.d.ts.map +1 -1
- package/types/sdk/init.d.ts.map +1 -1
- package/types/transports/http-module.d.ts +2 -2
- package/types/transports/http-module.d.ts.map +1 -1
- package/types/types.d.ts +12 -4
- package/types/types.d.ts.map +1 -1
- package/types-ts3.8/index.d.ts +6 -5
- package/types-ts3.8/integrations/anr/worker-script.d.ts +1 -1
- package/types-ts3.8/integrations/http.d.ts +4 -0
- package/types-ts3.8/integrations/local-variables/common.d.ts +1 -0
- package/types-ts3.8/integrations/local-variables/local-variables-sync.d.ts +1 -0
- package/types-ts3.8/integrations/tracing/fastify.d.ts +9 -0
- package/types-ts3.8/proxy/helpers.d.ts +2 -2
- package/types-ts3.8/transports/http-module.d.ts +2 -2
- package/types-ts3.8/types.d.ts +12 -4
- package/cjs/cron/common.js +0 -56
- package/cjs/cron/common.js.map +0 -1
- package/cjs/cron/cron.js +0 -102
- package/cjs/cron/cron.js.map +0 -1
- package/cjs/cron/index.js +0 -15
- package/cjs/cron/index.js.map +0 -1
- package/cjs/cron/node-cron.js +0 -61
- package/cjs/cron/node-cron.js.map +0 -1
- package/cjs/cron/node-schedule.js +0 -57
- package/cjs/cron/node-schedule.js.map +0 -1
- package/cjs/debug-build.js +0 -11
- package/cjs/debug-build.js.map +0 -1
- package/cjs/integrations/anr/index.js +0 -145
- package/cjs/integrations/anr/index.js.map +0 -1
- package/cjs/integrations/anr/worker-script.js +0 -2
- package/cjs/integrations/anr/worker-script.js.map +0 -1
- package/cjs/integrations/console.js +0 -40
- package/cjs/integrations/console.js.map +0 -1
- package/cjs/integrations/context.js +0 -435
- package/cjs/integrations/context.js.map +0 -1
- package/cjs/integrations/contextlines.js +0 -137
- package/cjs/integrations/contextlines.js.map +0 -1
- package/cjs/integrations/http.js +0 -137
- package/cjs/integrations/http.js.map +0 -1
- package/cjs/integrations/local-variables/common.js +0 -87
- package/cjs/integrations/local-variables/common.js.map +0 -1
- package/cjs/integrations/local-variables/index.js +0 -8
- package/cjs/integrations/local-variables/index.js.map +0 -1
- package/cjs/integrations/local-variables/local-variables-sync.js +0 -400
- package/cjs/integrations/local-variables/local-variables-sync.js.map +0 -1
- package/cjs/integrations/modules.js +0 -99
- package/cjs/integrations/modules.js.map +0 -1
- package/cjs/integrations/node-fetch.js +0 -82
- package/cjs/integrations/node-fetch.js.map +0 -1
- package/cjs/integrations/onuncaughtexception.js +0 -137
- package/cjs/integrations/onuncaughtexception.js.map +0 -1
- package/cjs/integrations/onunhandledrejection.js +0 -90
- package/cjs/integrations/onunhandledrejection.js.map +0 -1
- package/cjs/integrations/spotlight.js +0 -109
- package/cjs/integrations/spotlight.js.map +0 -1
- package/cjs/integrations/tracing/express.js +0 -103
- package/cjs/integrations/tracing/express.js.map +0 -1
- package/cjs/integrations/tracing/fastify.js +0 -33
- package/cjs/integrations/tracing/fastify.js.map +0 -1
- package/cjs/integrations/tracing/graphql.js +0 -34
- package/cjs/integrations/tracing/graphql.js.map +0 -1
- package/cjs/integrations/tracing/hapi/index.js +0 -81
- package/cjs/integrations/tracing/hapi/index.js.map +0 -1
- package/cjs/integrations/tracing/index.js +0 -37
- package/cjs/integrations/tracing/index.js.map +0 -1
- package/cjs/integrations/tracing/koa.js +0 -21
- package/cjs/integrations/tracing/koa.js.map +0 -1
- package/cjs/integrations/tracing/mongo.js +0 -33
- package/cjs/integrations/tracing/mongo.js.map +0 -1
- package/cjs/integrations/tracing/mongoose.js +0 -33
- package/cjs/integrations/tracing/mongoose.js.map +0 -1
- package/cjs/integrations/tracing/mysql.js +0 -26
- package/cjs/integrations/tracing/mysql.js.map +0 -1
- package/cjs/integrations/tracing/mysql2.js +0 -33
- package/cjs/integrations/tracing/mysql2.js.map +0 -1
- package/cjs/integrations/tracing/nest.js +0 -26
- package/cjs/integrations/tracing/nest.js.map +0 -1
- package/cjs/integrations/tracing/postgres.js +0 -34
- package/cjs/integrations/tracing/postgres.js.map +0 -1
- package/cjs/integrations/tracing/prisma.js +0 -33
- package/cjs/integrations/tracing/prisma.js.map +0 -1
- package/cjs/nodeVersion.js +0 -12
- package/cjs/nodeVersion.js.map +0 -1
- package/cjs/otel/contextManager.js +0 -16
- package/cjs/otel/contextManager.js.map +0 -1
- package/cjs/proxy/base.js +0 -126
- package/cjs/proxy/base.js.map +0 -1
- package/cjs/proxy/index.js +0 -209
- package/cjs/proxy/index.js.map +0 -1
- package/cjs/proxy/parse-proxy-response.js +0 -104
- package/cjs/proxy/parse-proxy-response.js.map +0 -1
- package/cjs/sdk/api.js +0 -74
- package/cjs/sdk/api.js.map +0 -1
- package/cjs/sdk/client.js +0 -57
- package/cjs/sdk/client.js.map +0 -1
- package/cjs/sdk/hub.js +0 -104
- package/cjs/sdk/hub.js.map +0 -1
- package/cjs/sdk/init.js +0 -224
- package/cjs/sdk/init.js.map +0 -1
- package/cjs/sdk/initOtel.js +0 -70
- package/cjs/sdk/initOtel.js.map +0 -1
- package/cjs/sdk/scope.js +0 -18
- package/cjs/sdk/scope.js.map +0 -1
- package/cjs/transports/http.js +0 -160
- package/cjs/transports/http.js.map +0 -1
- package/cjs/utils/addOriginToSpan.js +0 -11
- package/cjs/utils/addOriginToSpan.js.map +0 -1
- package/cjs/utils/errorhandling.js +0 -44
- package/cjs/utils/errorhandling.js.map +0 -1
- package/cjs/utils/getRequestUrl.js +0 -18
- package/cjs/utils/getRequestUrl.js.map +0 -1
- package/cjs/utils/module.js +0 -62
- package/cjs/utils/module.js.map +0 -1
- package/esm/cron/common.js +0 -54
- package/esm/cron/common.js.map +0 -1
- package/esm/cron/cron.js +0 -100
- package/esm/cron/cron.js.map +0 -1
- package/esm/cron/index.js +0 -13
- package/esm/cron/index.js.map +0 -1
- package/esm/cron/node-cron.js +0 -56
- package/esm/cron/node-cron.js.map +0 -1
- package/esm/cron/node-schedule.js +0 -55
- package/esm/cron/node-schedule.js.map +0 -1
- package/esm/debug-build.js +0 -9
- package/esm/debug-build.js.map +0 -1
- package/esm/integrations/anr/index.js +0 -139
- package/esm/integrations/anr/index.js.map +0 -1
- package/esm/integrations/anr/worker-script.js.map +0 -1
- package/esm/integrations/console.js +0 -38
- package/esm/integrations/console.js.map +0 -1
- package/esm/integrations/context.js +0 -427
- package/esm/integrations/context.js.map +0 -1
- package/esm/integrations/contextlines.js +0 -131
- package/esm/integrations/contextlines.js.map +0 -1
- package/esm/integrations/http.js +0 -132
- package/esm/integrations/http.js.map +0 -1
- package/esm/integrations/local-variables/common.js +0 -81
- package/esm/integrations/local-variables/common.js.map +0 -1
- package/esm/integrations/local-variables/index.js +0 -6
- package/esm/integrations/local-variables/index.js.map +0 -1
- package/esm/integrations/local-variables/local-variables-sync.js +0 -394
- package/esm/integrations/local-variables/local-variables-sync.js.map +0 -1
- package/esm/integrations/modules.js +0 -97
- package/esm/integrations/modules.js.map +0 -1
- package/esm/integrations/node-fetch.js +0 -80
- package/esm/integrations/node-fetch.js.map +0 -1
- package/esm/integrations/onuncaughtexception.js +0 -134
- package/esm/integrations/onuncaughtexception.js.map +0 -1
- package/esm/integrations/onunhandledrejection.js +0 -87
- package/esm/integrations/onunhandledrejection.js.map +0 -1
- package/esm/integrations/spotlight.js +0 -106
- package/esm/integrations/spotlight.js.map +0 -1
- package/esm/integrations/tracing/express.js +0 -96
- package/esm/integrations/tracing/express.js.map +0 -1
- package/esm/integrations/tracing/fastify.js +0 -31
- package/esm/integrations/tracing/fastify.js.map +0 -1
- package/esm/integrations/tracing/graphql.js +0 -32
- package/esm/integrations/tracing/graphql.js.map +0 -1
- package/esm/integrations/tracing/hapi/index.js +0 -77
- package/esm/integrations/tracing/hapi/index.js.map +0 -1
- package/esm/integrations/tracing/index.js +0 -35
- package/esm/integrations/tracing/index.js.map +0 -1
- package/esm/integrations/tracing/koa.js +0 -19
- package/esm/integrations/tracing/koa.js.map +0 -1
- package/esm/integrations/tracing/mongo.js +0 -31
- package/esm/integrations/tracing/mongo.js.map +0 -1
- package/esm/integrations/tracing/mongoose.js +0 -31
- package/esm/integrations/tracing/mongoose.js.map +0 -1
- package/esm/integrations/tracing/mysql.js +0 -24
- package/esm/integrations/tracing/mysql.js.map +0 -1
- package/esm/integrations/tracing/mysql2.js +0 -31
- package/esm/integrations/tracing/mysql2.js.map +0 -1
- package/esm/integrations/tracing/nest.js +0 -24
- package/esm/integrations/tracing/nest.js.map +0 -1
- package/esm/integrations/tracing/postgres.js +0 -32
- package/esm/integrations/tracing/postgres.js.map +0 -1
- package/esm/integrations/tracing/prisma.js +0 -31
- package/esm/integrations/tracing/prisma.js.map +0 -1
- package/esm/nodeVersion.js +0 -9
- package/esm/nodeVersion.js.map +0 -1
- package/esm/otel/contextManager.js +0 -14
- package/esm/otel/contextManager.js.map +0 -1
- package/esm/proxy/base.js +0 -121
- package/esm/proxy/base.js.map +0 -1
- package/esm/proxy/index.js +0 -203
- package/esm/proxy/index.js.map +0 -1
- package/esm/proxy/parse-proxy-response.js +0 -102
- package/esm/proxy/parse-proxy-response.js.map +0 -1
- package/esm/sdk/api.js +0 -69
- package/esm/sdk/api.js.map +0 -1
- package/esm/sdk/client.js +0 -52
- package/esm/sdk/client.js.map +0 -1
- package/esm/sdk/hub.js +0 -102
- package/esm/sdk/hub.js.map +0 -1
- package/esm/sdk/init.js +0 -221
- package/esm/sdk/init.js.map +0 -1
- package/esm/sdk/initOtel.js +0 -67
- package/esm/sdk/initOtel.js.map +0 -1
- package/esm/sdk/scope.js +0 -16
- package/esm/sdk/scope.js.map +0 -1
- package/esm/transports/http.js +0 -155
- package/esm/transports/http.js.map +0 -1
- package/esm/utils/addOriginToSpan.js +0 -9
- package/esm/utils/addOriginToSpan.js.map +0 -1
- package/esm/utils/errorhandling.js +0 -42
- package/esm/utils/errorhandling.js.map +0 -1
- package/esm/utils/getRequestUrl.js +0 -16
- package/esm/utils/getRequestUrl.js.map +0 -1
- package/esm/utils/module.js +0 -60
- package/esm/utils/module.js.map +0 -1
- package/types/integrations/local-variables/local-variables-async.d.ts +0 -14
- package/types/integrations/local-variables/local-variables-async.d.ts.map +0 -1
- package/types-ts3.8/integrations/local-variables/local-variables-async.d.ts +0 -14
package/README.md
CHANGED
|
@@ -4,36 +4,28 @@
|
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
# Official Sentry SDK for Node
|
|
7
|
+
# Official Sentry SDK for Node
|
|
8
8
|
|
|
9
|
-
[ if you have any feedback/concerns.
|
|
9
|
+
[](https://www.npmjs.com/package/@sentry/node)
|
|
10
|
+
[](https://www.npmjs.com/package/@sentry/node)
|
|
11
|
+
[](https://www.npmjs.com/package/@sentry/node)
|
|
20
12
|
|
|
21
13
|
## Installation
|
|
22
14
|
|
|
23
15
|
```bash
|
|
24
|
-
npm install @sentry/node
|
|
16
|
+
npm install @sentry/node
|
|
25
17
|
|
|
26
18
|
# Or yarn
|
|
27
|
-
yarn add @sentry/node
|
|
19
|
+
yarn add @sentry/node
|
|
28
20
|
```
|
|
29
21
|
|
|
30
22
|
## Usage
|
|
31
23
|
|
|
32
24
|
```js
|
|
33
25
|
// CJS Syntax
|
|
34
|
-
const Sentry = require('@sentry/node
|
|
26
|
+
const Sentry = require('@sentry/node');
|
|
35
27
|
// ESM Syntax
|
|
36
|
-
import * as Sentry from '@sentry/node
|
|
28
|
+
import * as Sentry from '@sentry/node';
|
|
37
29
|
|
|
38
30
|
Sentry.init({
|
|
39
31
|
dsn: '__DSN__',
|
|
@@ -43,65 +35,12 @@ Sentry.init({
|
|
|
43
35
|
|
|
44
36
|
Note that it is necessary to initialize Sentry **before you import any package that may be instrumented by us**.
|
|
45
37
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
Currently, this SDK:
|
|
49
|
-
|
|
50
|
-
* Will capture errors (same as @sentry/node)
|
|
51
|
-
* Auto-instrument for performance - see below for which performance integrations are available.
|
|
52
|
-
* Provide _some_ manual instrumentation APIs
|
|
53
|
-
* Sync OpenTelemetry Context with our Sentry Hub/Scope
|
|
54
|
-
|
|
55
|
-
### Manual Instrumentation
|
|
56
|
-
|
|
57
|
-
You can manual instrument using the following APIs:
|
|
58
|
-
|
|
59
|
-
```js
|
|
60
|
-
const Sentry = require('@sentry/node-experimental');
|
|
61
|
-
|
|
62
|
-
Sentry.startSpan({ description: 'outer' }, function (span) {
|
|
63
|
-
span.setData(customData);
|
|
64
|
-
doSomethingSlow();
|
|
65
|
-
Sentry.startSpan({ description: 'inner' }, function() {
|
|
66
|
-
// inner span is a child of outer span
|
|
67
|
-
doSomethingVerySlow();
|
|
68
|
-
// inner span is auto-ended when this callback ends
|
|
69
|
-
});
|
|
70
|
-
// outer span is auto-ended when this callback ends
|
|
71
|
-
});
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
You can also create spans without marking them as the active span.
|
|
75
|
-
Note that for most scenarios, we recommend the `startSpan` syntax.
|
|
76
|
-
|
|
77
|
-
```js
|
|
78
|
-
const Sentry = require('@sentry/node-experimental');
|
|
79
|
-
|
|
80
|
-
// This will _not_ be put on the scope/set as active, so no other spans will be attached to it
|
|
81
|
-
const span = Sentry.startInactiveSpan({ description: 'non-active span' });
|
|
82
|
-
|
|
83
|
-
doSomethingSlow();
|
|
84
|
-
|
|
85
|
-
span.end();
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Finally you can also get the currently active span, if you need to do more with it:
|
|
89
|
-
|
|
90
|
-
```js
|
|
91
|
-
const Sentry = require('@sentry/node-experimental');
|
|
92
|
-
const span = Sentry.getActiveSpan();
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### Async Context
|
|
96
|
-
|
|
97
|
-
We leverage the OpenTelemetry context forking in order to ensure isolation of parallel requests.
|
|
98
|
-
This means that as long as you are using an OpenTelemetry instrumentation for your framework of choice
|
|
99
|
-
(currently: Express or Fastify), you do not need to setup any `requestHandler` or similar.
|
|
38
|
+
[More information on how to set up Sentry for Node in v8.](./../../docs/v8-node.md)
|
|
100
39
|
|
|
101
40
|
### ESM Support
|
|
102
41
|
|
|
103
|
-
Due to the way OpenTelemetry handles instrumentation, this only works out of the box for CommonJS (`require`)
|
|
104
|
-
|
|
42
|
+
Due to the way OpenTelemetry handles instrumentation, this only works out of the box for CommonJS (`require`)
|
|
43
|
+
applications.
|
|
105
44
|
|
|
106
45
|
There is experimental support for running OpenTelemetry with ESM (`"type": "module"`):
|
|
107
46
|
|
|
@@ -111,27 +50,9 @@ node --experimental-loader=@opentelemetry/instrumentation/hook.mjs ./app.js
|
|
|
111
50
|
|
|
112
51
|
You'll need to install `@opentelemetry/instrumentation` in your app to ensure this works.
|
|
113
52
|
|
|
114
|
-
See
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
## Available (Performance) Integrations
|
|
119
|
-
|
|
120
|
-
* Http
|
|
121
|
-
* Express
|
|
122
|
-
* Fastify
|
|
123
|
-
* Nest
|
|
124
|
-
* Mysql
|
|
125
|
-
* Mysql2
|
|
126
|
-
* GraphQL
|
|
127
|
-
* Mongo
|
|
128
|
-
* Mongoose
|
|
129
|
-
* Postgres
|
|
130
|
-
* Prisma
|
|
131
|
-
|
|
132
|
-
All of these are auto-discovered, you don't need to configure anything for performance.
|
|
133
|
-
You still need to register middlewares etc. for error capturing.
|
|
134
|
-
Other, non-performance integrations from `@sentry/node` are also available (except for Undici).
|
|
53
|
+
See
|
|
54
|
+
[OpenTelemetry Instrumentation Docs](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation#instrumentation-for-es-modules-in-nodejs-experimental)
|
|
55
|
+
for details on this - but note that this is a) experimental, and b) does not work with all integrations.
|
|
135
56
|
|
|
136
57
|
## Links
|
|
137
58
|
|