Skip to content

Commit f1182d3

Browse files
committed
feat(node): add genericPool integration using opentelemetry instrumentation
Signed-off-by: Kaung Zin Hein <[email protected]>
1 parent fba8cc7 commit f1182d3

File tree

19 files changed

+710
-0
lines changed

19 files changed

+710
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019-2024 Functional Software, Inc. dba Sentry
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9+
of the Software, and to permit persons to whom the Software is furnished to do
10+
so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<p align="center">
2+
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
3+
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
4+
</a>
5+
</p>
6+
7+
# Sentry JavaScript SDK Core
8+
9+
[![npm version](https://img.shields.io/npm/v/@sentry/core.svg)](https://www.npmjs.com/package/@sentry/core)
10+
[![npm dm](https://img.shields.io/npm/dm/@sentry/core.svg)](https://www.npmjs.com/package/@sentry/core)
11+
[![npm dt](https://img.shields.io/npm/dt/@sentry/core.svg)](https://www.npmjs.com/package/@sentry/core)
12+
13+
## Links
14+
15+
- [Official SDK Docs](https://docs.sentry.io/quickstart/)
16+
- [TypeDoc](http://getsentry.github.io/sentry-javascript/)
17+
18+
## General
19+
20+
This package contains interface definitions, base classes and utilities for building Sentry JavaScript SDKs, like
21+
`@sentry/node` or `@sentry/browser`.
22+
23+
Please consider all classes and exported functions and interfaces `internal`.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"name": "@sentry/core",
3+
"version": "8.25.0+b6304601",
4+
"description": "Base implementation for all Sentry JavaScript SDKs",
5+
"repository": "git://github.com/getsentry/sentry-javascript.git",
6+
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/core",
7+
"author": "Sentry",
8+
"license": "MIT",
9+
"engines": {
10+
"node": ">=14.18"
11+
},
12+
"files": [
13+
"/build"
14+
],
15+
"main": "build/cjs/index.js",
16+
"module": "build/esm/index.js",
17+
"types": "build/types/index.d.ts",
18+
"exports": {
19+
"./package.json": "./package.json",
20+
".": {
21+
"import": {
22+
"types": "./build/types/index.d.ts",
23+
"default": "./build/esm/index.js"
24+
},
25+
"require": {
26+
"types": "./build/types/index.d.ts",
27+
"default": "./build/cjs/index.js"
28+
}
29+
}
30+
},
31+
"typesVersions": {
32+
"<4.9": {
33+
"build/types/index.d.ts": [
34+
"build/types-ts3.8/index.d.ts"
35+
]
36+
}
37+
},
38+
"publishConfig": {
39+
"access": "public"
40+
},
41+
"dependencies": {
42+
"@sentry/types": "8.25.0",
43+
"@sentry/utils": "8.25.0"
44+
},
45+
"scripts": {
46+
"build": "run-p build:transpile build:types",
47+
"build:dev": "yarn build",
48+
"build:transpile": "rollup -c rollup.npm.config.mjs",
49+
"build:types": "run-s build:types:core build:types:downlevel",
50+
"build:types:core": "tsc -p tsconfig.types.json",
51+
"build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8",
52+
"build:watch": "run-p build:transpile:watch build:types:watch",
53+
"build:dev:watch": "yarn build:watch",
54+
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",
55+
"build:types:watch": "tsc -p tsconfig.types.json --watch",
56+
"build:tarball": "npm pack",
57+
"circularDepCheck": "madge --circular src/index.ts",
58+
"clean": "rimraf build coverage sentry-core-*.tgz",
59+
"fix": "eslint . --format stylish --fix",
60+
"lint": "eslint . --format stylish",
61+
"test": "jest",
62+
"test:watch": "jest --watch",
63+
"yalc:publish": "yalc publish --push --sig"
64+
},
65+
"volta": {
66+
"extends": "../../package.json"
67+
},
68+
"sideEffects": false,
69+
"yalcSig": "b63046016939e0e6e9861c3fe8b39843"
70+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
b63046016939e0e6e9861c3fe8b39843
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023-2024 Functional Software, Inc. dba Sentry
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9+
of the Software, and to permit persons to whom the Software is furnished to do
10+
so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<p align="center">
2+
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
3+
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
4+
</a>
5+
</p>
6+
7+
# Official Sentry SDK for Node
8+
9+
[![npm version](https://img.shields.io/npm/v/@sentry/node.svg)](https://www.npmjs.com/package/@sentry/node)
10+
[![npm dm](https://img.shields.io/npm/dm/@sentry/node.svg)](https://www.npmjs.com/package/@sentry/node)
11+
[![npm dt](https://img.shields.io/npm/dt/@sentry/node.svg)](https://www.npmjs.com/package/@sentry/node)
12+
13+
## Installation
14+
15+
```bash
16+
npm install @sentry/node
17+
18+
# Or yarn
19+
yarn add @sentry/node
20+
```
21+
22+
## Usage
23+
24+
Sentry should be initialized as early in your app as possible. It is essential that you call `Sentry.init` before you
25+
require any other modules in your application, otherwise auto-instrumentation of these modules will **not** work.
26+
27+
You need to create a file named `instrument.js` that imports and initializes Sentry:
28+
29+
```js
30+
// CJS Syntax
31+
const Sentry = require('@sentry/node');
32+
// ESM Syntax
33+
import * as Sentry from '@sentry/node';
34+
35+
Sentry.init({
36+
dsn: '__DSN__',
37+
// ...
38+
});
39+
```
40+
41+
You need to require or import the `instrument.js` file before importing any other modules in your application. This is
42+
necessary to ensure that Sentry can automatically instrument all modules in your application:
43+
44+
```js
45+
// Import this first!
46+
import './instrument';
47+
48+
// Now import other modules
49+
import http from 'http';
50+
51+
// Your application code goes here
52+
```
53+
54+
### ESM Support
55+
56+
When running your application in ESM mode, you should use the Node.js
57+
[`--import`](https://nodejs.org/api/cli.html#--importmodule) command line option to ensure that Sentry is loaded before
58+
the application code is evaluated.
59+
60+
Adjust the Node.js call for your application to use the `--import` parameter and point it at `instrument.js`, which
61+
contains your `Sentry.init`() code:
62+
63+
```bash
64+
# Note: This is only available for Node v18.19.0 onwards.
65+
node --import ./instrument.mjs app.mjs
66+
```
67+
68+
If it is not possible for you to pass the `--import` flag to the Node.js binary, you can alternatively use the
69+
`NODE_OPTIONS` environment variable as follows:
70+
71+
```bash
72+
NODE_OPTIONS="--import ./instrument.mjs" npm run start
73+
```
74+
75+
## Links
76+
77+
- [Official SDK Docs](https://docs.sentry.io/quickstart/)
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"name": "@sentry/node",
3+
"version": "8.25.0+fdee85f9",
4+
"description": "Sentry Node SDK using OpenTelemetry for performance instrumentation",
5+
"repository": "git://github.com/getsentry/sentry-javascript.git",
6+
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/node",
7+
"author": "Sentry",
8+
"license": "MIT",
9+
"engines": {
10+
"node": ">=14.18"
11+
},
12+
"files": [
13+
"/build"
14+
],
15+
"main": "build/cjs/index.js",
16+
"module": "build/esm/index.js",
17+
"types": "build/types/index.d.ts",
18+
"exports": {
19+
"./package.json": "./package.json",
20+
".": {
21+
"import": {
22+
"types": "./build/types/index.d.ts",
23+
"default": "./build/esm/index.js"
24+
},
25+
"require": {
26+
"types": "./build/types/index.d.ts",
27+
"default": "./build/cjs/index.js"
28+
}
29+
},
30+
"./import": {
31+
"import": {
32+
"default": "./build/import-hook.mjs"
33+
}
34+
},
35+
"./loader": {
36+
"import": {
37+
"default": "./build/loader-hook.mjs"
38+
}
39+
},
40+
"./init": {
41+
"import": {
42+
"default": "./build/esm/init.js"
43+
},
44+
"require": {
45+
"default": "./build/cjs/init.js"
46+
}
47+
},
48+
"./preload": {
49+
"import": {
50+
"default": "./build/esm/preload.js"
51+
},
52+
"require": {
53+
"default": "./build/cjs/preload.js"
54+
}
55+
}
56+
},
57+
"typesVersions": {
58+
"<4.9": {
59+
"build/types/index.d.ts": [
60+
"build/types-ts3.8/index.d.ts"
61+
]
62+
}
63+
},
64+
"publishConfig": {
65+
"access": "public"
66+
},
67+
"dependencies": {
68+
"@opentelemetry/api": "^1.9.0",
69+
"@opentelemetry/context-async-hooks": "^1.25.1",
70+
"@opentelemetry/core": "^1.25.1",
71+
"@opentelemetry/instrumentation": "^0.52.1",
72+
"@opentelemetry/instrumentation-connect": "0.38.0",
73+
"@opentelemetry/instrumentation-express": "0.41.1",
74+
"@opentelemetry/instrumentation-fastify": "0.38.0",
75+
"@opentelemetry/instrumentation-fs": "0.14.0",
76+
"@opentelemetry/instrumentation-generic-pool": "^0.38.0",
77+
"@opentelemetry/instrumentation-graphql": "0.42.0",
78+
"@opentelemetry/instrumentation-hapi": "0.40.0",
79+
"@opentelemetry/instrumentation-http": "0.52.1",
80+
"@opentelemetry/instrumentation-ioredis": "0.42.0",
81+
"@opentelemetry/instrumentation-koa": "0.42.0",
82+
"@opentelemetry/instrumentation-mongodb": "0.46.0",
83+
"@opentelemetry/instrumentation-mongoose": "0.40.0",
84+
"@opentelemetry/instrumentation-mysql": "0.40.0",
85+
"@opentelemetry/instrumentation-mysql2": "0.40.0",
86+
"@opentelemetry/instrumentation-nestjs-core": "0.39.0",
87+
"@opentelemetry/instrumentation-pg": "0.43.0",
88+
"@opentelemetry/instrumentation-redis-4": "0.41.0",
89+
"@opentelemetry/resources": "^1.25.1",
90+
"@opentelemetry/sdk-trace-base": "^1.25.1",
91+
"@opentelemetry/semantic-conventions": "^1.25.1",
92+
"@prisma/instrumentation": "5.17.0",
93+
"@sentry/core": "8.25.0",
94+
"@sentry/opentelemetry": "8.25.0",
95+
"@sentry/types": "8.25.0",
96+
"@sentry/utils": "8.25.0",
97+
"import-in-the-middle": "^1.11.0"
98+
},
99+
"optionalDependencies": {
100+
"opentelemetry-instrumentation-fetch-node": "1.2.3"
101+
},
102+
"scripts": {
103+
"build": "run-p build:transpile build:types",
104+
"build:dev": "yarn build",
105+
"build:transpile": "rollup -c rollup.npm.config.mjs",
106+
"build:types": "run-s build:types:core build:types:downlevel",
107+
"build:types:core": "tsc -p tsconfig.types.json",
108+
"build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8",
109+
"build:watch": "run-p build:transpile:watch build:types:watch",
110+
"build:dev:watch": "yarn build:watch",
111+
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",
112+
"build:types:watch": "tsc -p tsconfig.types.json --watch",
113+
"build:tarball": "npm pack",
114+
"circularDepCheck": "madge --circular src/index.ts",
115+
"clean": "rimraf build coverage sentry-node-*.tgz",
116+
"fix": "eslint . --format stylish --fix",
117+
"lint": "eslint . --format stylish",
118+
"test": "yarn test:jest",
119+
"test:jest": "jest",
120+
"test:watch": "jest --watch",
121+
"yalc:publish": "yalc publish --push --sig"
122+
},
123+
"volta": {
124+
"extends": "../../package.json"
125+
},
126+
"sideEffects": false,
127+
"yalcSig": "fdee85f9c066418865de6221a8dc7314"
128+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fdee85f9c066418865de6221a8dc7314
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019-2024 Functional Software, Inc. dba Sentry
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9+
of the Software, and to permit persons to whom the Software is furnished to do
10+
so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<p align="center">
2+
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
3+
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
4+
</a>
5+
</p>
6+
7+
# Sentry JavaScript SDK Types
8+
9+
[![npm version](https://img.shields.io/npm/v/@sentry/types.svg)](https://www.npmjs.com/package/@sentry/types)
10+
[![npm dm](https://img.shields.io/npm/dm/@sentry/types.svg)](https://www.npmjs.com/package/@sentry/types)
11+
[![npm dt](https://img.shields.io/npm/dt/@sentry/types.svg)](https://www.npmjs.com/package/@sentry/types)
12+
13+
## Links
14+
15+
- [Official SDK Docs](https://docs.sentry.io/quickstart/)
16+
- [TypeDoc](http://getsentry.github.io/sentry-javascript/)
17+
18+
## General
19+
20+
Common types used by the Sentry JavaScript SDKs.

0 commit comments

Comments
 (0)