From 37cc42eaba012367562bc7b86a50196cb6e14ff2 Mon Sep 17 00:00:00 2001 From: Kaung Zin Hein Date: Mon, 26 Aug 2024 13:29:12 -0400 Subject: [PATCH] test(node): Add tests for genericPoolIntegration Signed-off-by: Kaung Zin Hein --- .../.yalc/@sentry/core/LICENSE | 21 --- .../.yalc/@sentry/core/README.md | 23 ---- .../.yalc/@sentry/core/package.json | 70 ---------- .../.yalc/@sentry/core/yalc.sig | 1 - .../.yalc/@sentry/node/LICENSE | 21 --- .../.yalc/@sentry/node/README.md | 77 ----------- .../.yalc/@sentry/node/package.json | 128 ------------------ .../.yalc/@sentry/node/yalc.sig | 1 - .../.yalc/@sentry/types/LICENSE | 21 --- .../.yalc/@sentry/types/README.md | 20 --- .../.yalc/@sentry/types/package.json | 63 --------- .../.yalc/@sentry/types/yalc.sig | 1 - .../.yalc/@sentry/utils/LICENSE | 21 --- .../.yalc/@sentry/utils/README.md | 23 ---- .../.yalc/@sentry/utils/package.json | 70 ---------- .../.yalc/@sentry/utils/yalc.sig | 1 - .../suites/tracing/genericPool/scenario.js | 89 ++++-------- .../suites/tracing/genericPool/test.ts | 24 +++- dev-packages/node-integration-tests/yalc.lock | 24 ---- packages/node/src/index.ts | 1 + .../src/integrations/tracing/genericPool.ts | 2 +- 21 files changed, 49 insertions(+), 653 deletions(-) delete mode 100644 dev-packages/node-integration-tests/.yalc/@sentry/core/LICENSE delete mode 100644 dev-packages/node-integration-tests/.yalc/@sentry/core/README.md delete mode 100644 dev-packages/node-integration-tests/.yalc/@sentry/core/package.json delete mode 100644 dev-packages/node-integration-tests/.yalc/@sentry/core/yalc.sig delete mode 100644 dev-packages/node-integration-tests/.yalc/@sentry/node/LICENSE delete mode 100644 dev-packages/node-integration-tests/.yalc/@sentry/node/README.md delete mode 100644 dev-packages/node-integration-tests/.yalc/@sentry/node/package.json delete mode 100644 dev-packages/node-integration-tests/.yalc/@sentry/node/yalc.sig delete mode 100644 dev-packages/node-integration-tests/.yalc/@sentry/types/LICENSE delete mode 100644 dev-packages/node-integration-tests/.yalc/@sentry/types/README.md delete mode 100644 dev-packages/node-integration-tests/.yalc/@sentry/types/package.json delete mode 100644 dev-packages/node-integration-tests/.yalc/@sentry/types/yalc.sig delete mode 100644 dev-packages/node-integration-tests/.yalc/@sentry/utils/LICENSE delete mode 100644 dev-packages/node-integration-tests/.yalc/@sentry/utils/README.md delete mode 100644 dev-packages/node-integration-tests/.yalc/@sentry/utils/package.json delete mode 100644 dev-packages/node-integration-tests/.yalc/@sentry/utils/yalc.sig delete mode 100644 dev-packages/node-integration-tests/yalc.lock diff --git a/dev-packages/node-integration-tests/.yalc/@sentry/core/LICENSE b/dev-packages/node-integration-tests/.yalc/@sentry/core/LICENSE deleted file mode 100644 index d5b40b7c4219..000000000000 --- a/dev-packages/node-integration-tests/.yalc/@sentry/core/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019-2024 Functional Software, Inc. dba Sentry - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/dev-packages/node-integration-tests/.yalc/@sentry/core/README.md b/dev-packages/node-integration-tests/.yalc/@sentry/core/README.md deleted file mode 100644 index 3e44a1dfc7fa..000000000000 --- a/dev-packages/node-integration-tests/.yalc/@sentry/core/README.md +++ /dev/null @@ -1,23 +0,0 @@ -

- - Sentry - -

- -# Sentry JavaScript SDK Core - -[![npm version](https://img.shields.io/npm/v/@sentry/core.svg)](https://www.npmjs.com/package/@sentry/core) -[![npm dm](https://img.shields.io/npm/dm/@sentry/core.svg)](https://www.npmjs.com/package/@sentry/core) -[![npm dt](https://img.shields.io/npm/dt/@sentry/core.svg)](https://www.npmjs.com/package/@sentry/core) - -## Links - -- [Official SDK Docs](https://docs.sentry.io/quickstart/) -- [TypeDoc](http://getsentry.github.io/sentry-javascript/) - -## General - -This package contains interface definitions, base classes and utilities for building Sentry JavaScript SDKs, like -`@sentry/node` or `@sentry/browser`. - -Please consider all classes and exported functions and interfaces `internal`. diff --git a/dev-packages/node-integration-tests/.yalc/@sentry/core/package.json b/dev-packages/node-integration-tests/.yalc/@sentry/core/package.json deleted file mode 100644 index 431de389caf0..000000000000 --- a/dev-packages/node-integration-tests/.yalc/@sentry/core/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@sentry/core", - "version": "8.25.0+b6304601", - "description": "Base implementation for all Sentry JavaScript SDKs", - "repository": "git://github.com/getsentry/sentry-javascript.git", - "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/core", - "author": "Sentry", - "license": "MIT", - "engines": { - "node": ">=14.18" - }, - "files": [ - "/build" - ], - "main": "build/cjs/index.js", - "module": "build/esm/index.js", - "types": "build/types/index.d.ts", - "exports": { - "./package.json": "./package.json", - ".": { - "import": { - "types": "./build/types/index.d.ts", - "default": "./build/esm/index.js" - }, - "require": { - "types": "./build/types/index.d.ts", - "default": "./build/cjs/index.js" - } - } - }, - "typesVersions": { - "<4.9": { - "build/types/index.d.ts": [ - "build/types-ts3.8/index.d.ts" - ] - } - }, - "publishConfig": { - "access": "public" - }, - "dependencies": { - "@sentry/types": "8.25.0", - "@sentry/utils": "8.25.0" - }, - "scripts": { - "build": "run-p build:transpile build:types", - "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", - "build:types": "run-s build:types:core build:types:downlevel", - "build:types:core": "tsc -p tsconfig.types.json", - "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", - "build:watch": "run-p build:transpile:watch build:types:watch", - "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", - "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:tarball": "npm pack", - "circularDepCheck": "madge --circular src/index.ts", - "clean": "rimraf build coverage sentry-core-*.tgz", - "fix": "eslint . --format stylish --fix", - "lint": "eslint . --format stylish", - "test": "jest", - "test:watch": "jest --watch", - "yalc:publish": "yalc publish --push --sig" - }, - "volta": { - "extends": "../../package.json" - }, - "sideEffects": false, - "yalcSig": "b63046016939e0e6e9861c3fe8b39843" -} diff --git a/dev-packages/node-integration-tests/.yalc/@sentry/core/yalc.sig b/dev-packages/node-integration-tests/.yalc/@sentry/core/yalc.sig deleted file mode 100644 index 6d0256ed73bf..000000000000 --- a/dev-packages/node-integration-tests/.yalc/@sentry/core/yalc.sig +++ /dev/null @@ -1 +0,0 @@ -b63046016939e0e6e9861c3fe8b39843 \ No newline at end of file diff --git a/dev-packages/node-integration-tests/.yalc/@sentry/node/LICENSE b/dev-packages/node-integration-tests/.yalc/@sentry/node/LICENSE deleted file mode 100644 index 6bfafc44539c..000000000000 --- a/dev-packages/node-integration-tests/.yalc/@sentry/node/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023-2024 Functional Software, Inc. dba Sentry - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/dev-packages/node-integration-tests/.yalc/@sentry/node/README.md b/dev-packages/node-integration-tests/.yalc/@sentry/node/README.md deleted file mode 100644 index 6471538fb4f0..000000000000 --- a/dev-packages/node-integration-tests/.yalc/@sentry/node/README.md +++ /dev/null @@ -1,77 +0,0 @@ -

- - Sentry - -

- -# Official Sentry SDK for Node - -[![npm version](https://img.shields.io/npm/v/@sentry/node.svg)](https://www.npmjs.com/package/@sentry/node) -[![npm dm](https://img.shields.io/npm/dm/@sentry/node.svg)](https://www.npmjs.com/package/@sentry/node) -[![npm dt](https://img.shields.io/npm/dt/@sentry/node.svg)](https://www.npmjs.com/package/@sentry/node) - -## Installation - -```bash -npm install @sentry/node - -# Or yarn -yarn add @sentry/node -``` - -## Usage - -Sentry should be initialized as early in your app as possible. It is essential that you call `Sentry.init` before you -require any other modules in your application, otherwise auto-instrumentation of these modules will **not** work. - -You need to create a file named `instrument.js` that imports and initializes Sentry: - -```js -// CJS Syntax -const Sentry = require('@sentry/node'); -// ESM Syntax -import * as Sentry from '@sentry/node'; - -Sentry.init({ - dsn: '__DSN__', - // ... -}); -``` - -You need to require or import the `instrument.js` file before importing any other modules in your application. This is -necessary to ensure that Sentry can automatically instrument all modules in your application: - -```js -// Import this first! -import './instrument'; - -// Now import other modules -import http from 'http'; - -// Your application code goes here -``` - -### ESM Support - -When running your application in ESM mode, you should use the Node.js -[`--import`](https://nodejs.org/api/cli.html#--importmodule) command line option to ensure that Sentry is loaded before -the application code is evaluated. - -Adjust the Node.js call for your application to use the `--import` parameter and point it at `instrument.js`, which -contains your `Sentry.init`() code: - -```bash -# Note: This is only available for Node v18.19.0 onwards. -node --import ./instrument.mjs app.mjs -``` - -If it is not possible for you to pass the `--import` flag to the Node.js binary, you can alternatively use the -`NODE_OPTIONS` environment variable as follows: - -```bash -NODE_OPTIONS="--import ./instrument.mjs" npm run start -``` - -## Links - -- [Official SDK Docs](https://docs.sentry.io/quickstart/) diff --git a/dev-packages/node-integration-tests/.yalc/@sentry/node/package.json b/dev-packages/node-integration-tests/.yalc/@sentry/node/package.json deleted file mode 100644 index 43473a72ed2d..000000000000 --- a/dev-packages/node-integration-tests/.yalc/@sentry/node/package.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "name": "@sentry/node", - "version": "8.25.0+fdee85f9", - "description": "Sentry Node SDK using OpenTelemetry for performance instrumentation", - "repository": "git://github.com/getsentry/sentry-javascript.git", - "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/node", - "author": "Sentry", - "license": "MIT", - "engines": { - "node": ">=14.18" - }, - "files": [ - "/build" - ], - "main": "build/cjs/index.js", - "module": "build/esm/index.js", - "types": "build/types/index.d.ts", - "exports": { - "./package.json": "./package.json", - ".": { - "import": { - "types": "./build/types/index.d.ts", - "default": "./build/esm/index.js" - }, - "require": { - "types": "./build/types/index.d.ts", - "default": "./build/cjs/index.js" - } - }, - "./import": { - "import": { - "default": "./build/import-hook.mjs" - } - }, - "./loader": { - "import": { - "default": "./build/loader-hook.mjs" - } - }, - "./init": { - "import": { - "default": "./build/esm/init.js" - }, - "require": { - "default": "./build/cjs/init.js" - } - }, - "./preload": { - "import": { - "default": "./build/esm/preload.js" - }, - "require": { - "default": "./build/cjs/preload.js" - } - } - }, - "typesVersions": { - "<4.9": { - "build/types/index.d.ts": [ - "build/types-ts3.8/index.d.ts" - ] - } - }, - "publishConfig": { - "access": "public" - }, - "dependencies": { - "@opentelemetry/api": "^1.9.0", - "@opentelemetry/context-async-hooks": "^1.25.1", - "@opentelemetry/core": "^1.25.1", - "@opentelemetry/instrumentation": "^0.52.1", - "@opentelemetry/instrumentation-connect": "0.38.0", - "@opentelemetry/instrumentation-express": "0.41.1", - "@opentelemetry/instrumentation-fastify": "0.38.0", - "@opentelemetry/instrumentation-fs": "0.14.0", - "@opentelemetry/instrumentation-generic-pool": "^0.38.0", - "@opentelemetry/instrumentation-graphql": "0.42.0", - "@opentelemetry/instrumentation-hapi": "0.40.0", - "@opentelemetry/instrumentation-http": "0.52.1", - "@opentelemetry/instrumentation-ioredis": "0.42.0", - "@opentelemetry/instrumentation-koa": "0.42.0", - "@opentelemetry/instrumentation-mongodb": "0.46.0", - "@opentelemetry/instrumentation-mongoose": "0.40.0", - "@opentelemetry/instrumentation-mysql": "0.40.0", - "@opentelemetry/instrumentation-mysql2": "0.40.0", - "@opentelemetry/instrumentation-nestjs-core": "0.39.0", - "@opentelemetry/instrumentation-pg": "0.43.0", - "@opentelemetry/instrumentation-redis-4": "0.41.0", - "@opentelemetry/resources": "^1.25.1", - "@opentelemetry/sdk-trace-base": "^1.25.1", - "@opentelemetry/semantic-conventions": "^1.25.1", - "@prisma/instrumentation": "5.17.0", - "@sentry/core": "8.25.0", - "@sentry/opentelemetry": "8.25.0", - "@sentry/types": "8.25.0", - "@sentry/utils": "8.25.0", - "import-in-the-middle": "^1.11.0" - }, - "optionalDependencies": { - "opentelemetry-instrumentation-fetch-node": "1.2.3" - }, - "scripts": { - "build": "run-p build:transpile build:types", - "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", - "build:types": "run-s build:types:core build:types:downlevel", - "build:types:core": "tsc -p tsconfig.types.json", - "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", - "build:watch": "run-p build:transpile:watch build:types:watch", - "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", - "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:tarball": "npm pack", - "circularDepCheck": "madge --circular src/index.ts", - "clean": "rimraf build coverage sentry-node-*.tgz", - "fix": "eslint . --format stylish --fix", - "lint": "eslint . --format stylish", - "test": "yarn test:jest", - "test:jest": "jest", - "test:watch": "jest --watch", - "yalc:publish": "yalc publish --push --sig" - }, - "volta": { - "extends": "../../package.json" - }, - "sideEffects": false, - "yalcSig": "fdee85f9c066418865de6221a8dc7314" -} diff --git a/dev-packages/node-integration-tests/.yalc/@sentry/node/yalc.sig b/dev-packages/node-integration-tests/.yalc/@sentry/node/yalc.sig deleted file mode 100644 index f4e4ec128ba9..000000000000 --- a/dev-packages/node-integration-tests/.yalc/@sentry/node/yalc.sig +++ /dev/null @@ -1 +0,0 @@ -fdee85f9c066418865de6221a8dc7314 \ No newline at end of file diff --git a/dev-packages/node-integration-tests/.yalc/@sentry/types/LICENSE b/dev-packages/node-integration-tests/.yalc/@sentry/types/LICENSE deleted file mode 100644 index d5b40b7c4219..000000000000 --- a/dev-packages/node-integration-tests/.yalc/@sentry/types/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019-2024 Functional Software, Inc. dba Sentry - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/dev-packages/node-integration-tests/.yalc/@sentry/types/README.md b/dev-packages/node-integration-tests/.yalc/@sentry/types/README.md deleted file mode 100644 index 4c0e2d9cbc34..000000000000 --- a/dev-packages/node-integration-tests/.yalc/@sentry/types/README.md +++ /dev/null @@ -1,20 +0,0 @@ -

- - Sentry - -

- -# Sentry JavaScript SDK Types - -[![npm version](https://img.shields.io/npm/v/@sentry/types.svg)](https://www.npmjs.com/package/@sentry/types) -[![npm dm](https://img.shields.io/npm/dm/@sentry/types.svg)](https://www.npmjs.com/package/@sentry/types) -[![npm dt](https://img.shields.io/npm/dt/@sentry/types.svg)](https://www.npmjs.com/package/@sentry/types) - -## Links - -- [Official SDK Docs](https://docs.sentry.io/quickstart/) -- [TypeDoc](http://getsentry.github.io/sentry-javascript/) - -## General - -Common types used by the Sentry JavaScript SDKs. diff --git a/dev-packages/node-integration-tests/.yalc/@sentry/types/package.json b/dev-packages/node-integration-tests/.yalc/@sentry/types/package.json deleted file mode 100644 index b97ec606c395..000000000000 --- a/dev-packages/node-integration-tests/.yalc/@sentry/types/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@sentry/types", - "version": "8.25.0+09174750", - "description": "Types for all Sentry JavaScript SDKs", - "repository": "git://github.com/getsentry/sentry-javascript.git", - "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/types", - "author": "Sentry", - "license": "MIT", - "engines": { - "node": ">=14.18" - }, - "files": [ - "/build" - ], - "main": "build/cjs/index.js", - "module": "build/esm/index.js", - "types": "build/types/index.d.ts", - "exports": { - "./package.json": "./package.json", - ".": { - "import": { - "types": "./build/types/index.d.ts", - "default": "./build/esm/index.js" - }, - "require": { - "types": "./build/types/index.d.ts", - "default": "./build/cjs/index.js" - } - } - }, - "typesVersions": { - "<4.9": { - "build/types/index.d.ts": [ - "build/types-ts3.8/index.d.ts" - ] - } - }, - "publishConfig": { - "access": "public" - }, - "scripts": { - "build": "run-p build:transpile build:types", - "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", - "build:types": "run-s build:types:core build:types:downlevel", - "build:types:core": "tsc -p tsconfig.types.json", - "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", - "build:watch": "run-p build:transpile:watch build:types:watch", - "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", - "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:tarball": "npm pack", - "clean": "rimraf build sentry-types-*.tgz", - "lint": "eslint . --format stylish", - "fix": "eslint . --format stylish --fix", - "yalc:publish": "yalc publish --push --sig" - }, - "volta": { - "extends": "../../package.json" - }, - "sideEffects": false, - "yalcSig": "091747500ba09e4fef7b4e461001fdbf" -} diff --git a/dev-packages/node-integration-tests/.yalc/@sentry/types/yalc.sig b/dev-packages/node-integration-tests/.yalc/@sentry/types/yalc.sig deleted file mode 100644 index 46fbf9051f5c..000000000000 --- a/dev-packages/node-integration-tests/.yalc/@sentry/types/yalc.sig +++ /dev/null @@ -1 +0,0 @@ -091747500ba09e4fef7b4e461001fdbf \ No newline at end of file diff --git a/dev-packages/node-integration-tests/.yalc/@sentry/utils/LICENSE b/dev-packages/node-integration-tests/.yalc/@sentry/utils/LICENSE deleted file mode 100644 index d5b40b7c4219..000000000000 --- a/dev-packages/node-integration-tests/.yalc/@sentry/utils/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019-2024 Functional Software, Inc. dba Sentry - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/dev-packages/node-integration-tests/.yalc/@sentry/utils/README.md b/dev-packages/node-integration-tests/.yalc/@sentry/utils/README.md deleted file mode 100644 index 812bb86a3525..000000000000 --- a/dev-packages/node-integration-tests/.yalc/@sentry/utils/README.md +++ /dev/null @@ -1,23 +0,0 @@ -

- - Sentry - -

- -# Sentry JavaScript SDK Utilities - -[![npm version](https://img.shields.io/npm/v/@sentry/utils.svg)](https://www.npmjs.com/package/@sentry/utils) -[![npm dm](https://img.shields.io/npm/dm/@sentry/utils.svg)](https://www.npmjs.com/package/@sentry/utils) -[![npm dt](https://img.shields.io/npm/dt/@sentry/utils.svg)](https://www.npmjs.com/package/@sentry/utils) - -## Links - -- [Official SDK Docs](https://docs.sentry.io/quickstart/) -- [TypeDoc](http://getsentry.github.io/sentry-javascript/) - -## General - -Common utilities used by the Sentry JavaScript SDKs. - -Note: This package is only meant to be used internally, and as such is not part of our public API contract and does not -follow semver. diff --git a/dev-packages/node-integration-tests/.yalc/@sentry/utils/package.json b/dev-packages/node-integration-tests/.yalc/@sentry/utils/package.json deleted file mode 100644 index ec5720de4c0c..000000000000 --- a/dev-packages/node-integration-tests/.yalc/@sentry/utils/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@sentry/utils", - "version": "8.25.0+eb0f5131", - "description": "Utilities for all Sentry JavaScript SDKs", - "repository": "git://github.com/getsentry/sentry-javascript.git", - "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/utils", - "author": "Sentry", - "license": "MIT", - "engines": { - "node": ">=14.18" - }, - "files": [ - "/build" - ], - "main": "build/cjs/index.js", - "module": "build/esm/index.js", - "types": "build/types/index.d.ts", - "exports": { - "./package.json": "./package.json", - ".": { - "import": { - "types": "./build/types/index.d.ts", - "default": "./build/esm/index.js" - }, - "require": { - "types": "./build/types/index.d.ts", - "default": "./build/cjs/index.js" - } - } - }, - "typesVersions": { - "<4.9": { - "build/types/index.d.ts": [ - "build/types-ts3.8/index.d.ts" - ] - } - }, - "publishConfig": { - "access": "public" - }, - "dependencies": { - "@sentry/types": "8.25.0" - }, - "scripts": { - "build": "run-p build:transpile build:types", - "build:dev": "yarn build", - "build:transpile": "yarn ts-node scripts/buildRollup.ts", - "build:types": "run-s build:types:core build:types:downlevel", - "build:types:core": "tsc -p tsconfig.types.json", - "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", - "build:watch": "run-p build:transpile:watch build:types:watch", - "build:dev:watch": "yarn build:watch", - "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", - "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:tarball": "npm pack", - "circularDepCheck": "madge --circular src/index.ts", - "clean": "rimraf build coverage cjs esm sentry-utils-*.tgz", - "fix": "eslint . --format stylish --fix", - "lint": "eslint . --format stylish", - "test": "jest", - "test:watch": "jest --watch", - "version": "node ../../scripts/versionbump.js src/version.ts", - "yalc:publish": "yalc publish --push --sig" - }, - "volta": { - "extends": "../../package.json" - }, - "sideEffects": false, - "yalcSig": "eb0f51315465ec6df6c436ceddac5cbd" -} diff --git a/dev-packages/node-integration-tests/.yalc/@sentry/utils/yalc.sig b/dev-packages/node-integration-tests/.yalc/@sentry/utils/yalc.sig deleted file mode 100644 index 0bfb8a6900e4..000000000000 --- a/dev-packages/node-integration-tests/.yalc/@sentry/utils/yalc.sig +++ /dev/null @@ -1 +0,0 @@ -eb0f51315465ec6df6c436ceddac5cbd \ No newline at end of file diff --git a/dev-packages/node-integration-tests/suites/tracing/genericPool/scenario.js b/dev-packages/node-integration-tests/suites/tracing/genericPool/scenario.js index 5de286fcefb0..74d5f73693f5 100644 --- a/dev-packages/node-integration-tests/suites/tracing/genericPool/scenario.js +++ b/dev-packages/node-integration-tests/suites/tracing/genericPool/scenario.js @@ -24,6 +24,7 @@ const factory = { destroy: function (client) { client.end(err => { if (err) { + // eslint-disable-next-line no-console console.error('Error while disconnecting MySQL:', err); } }); @@ -31,70 +32,40 @@ const factory = { }; const opts = { - max: 10, // maximum size of the pool - min: 2, // minimum size of the pool + max: 10, + min: 2, }; const myPool = genericPool.createPool(factory, opts); -// const connection = mysql.createConnection({ -// user: 'root', -// password: 'docker', -// }); +async function run() { + await Sentry.startSpan( + { + op: 'transaction', + name: 'Test Transaction', + }, + async () => { + try { + const client1 = await myPool.acquire(); + const client2 = await myPool.acquire(); -// connection.connect(function (err) { -// if (err) { -// return; -// } -// }); - -// mysql 2 -// mysql -// .createConnection({ -// user: 'root', -// password: 'password', -// host: 'localhost', -// port: 3306, -// }) -// .then(connection => { -// return Sentry.startSpan( -// { -// op: 'transaction', -// name: 'Test Transaction', -// }, -// async _ => { -// await connection.query('SELECT 1 + 1 AS solution'); -// await connection.query('SELECT NOW()', ['1', '2']); -// }, -// ); -// }); - -Sentry.startSpan( - { - op: 'transaction', - name: 'Test Transaction', - }, - span => { - // connection.query('SELECT 1 + 1 AS solution', function () { - // connection.query('SELECT NOW()', ['1', '2'], () => { - // span.end(); - // connection.end(); - // }); - // }); - const resourcePromise = myPool.acquire(); - // span.end(); - - resourcePromise - .then(function (client) { - client.query('SELECT NOW()', function () { - span.end(); - // client.query('SELECT 1 + 1 AS solution'); + client1.query('SELECT NOW()', function () { + myPool.release(client1); + }); - myPool.release(client); + client2.query('SELECT 1 + 1 AS solution', function () { + myPool.release(client2); }); - }) - .catch(function (err) { + } catch (err) { + // eslint-disable-next-line no-console console.error('Error while pooling MySQL:', err); - }); - }, -); + } finally { + await myPool.drain(); + await myPool.clear(); + } + }, + ); +} + +// eslint-disable-next-line @typescript-eslint/no-floating-promises +run(); diff --git a/dev-packages/node-integration-tests/suites/tracing/genericPool/test.ts b/dev-packages/node-integration-tests/suites/tracing/genericPool/test.ts index 026a36c6b8b1..129e142f2808 100644 --- a/dev-packages/node-integration-tests/suites/tracing/genericPool/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/genericPool/test.ts @@ -1,20 +1,30 @@ import { cleanupChildProcesses, createRunner } from '../../../utils/runner'; -describe('mysql auto instrumentation', () => { +describe('genericPool auto instrumentation', () => { afterAll(() => { cleanupChildProcesses(); }); - test('should auto-instrument `genericPool` package when using pool.require()', done => { + test('should auto-instrument `genericPool` package when calling pool.require()', done => { const EXPECTED_TRANSACTION = { transaction: 'Test Transaction', spans: expect.arrayContaining([ expect.objectContaining({ - // op: 'transaction', - data: expect.objectContaining({ - description: 'generic-pool.aquire', - origin: 'manual', - }), + description: 'generic-pool.aquire', + origin: 'auto.db.otel.generic-pool', + data: { + 'sentry.origin': 'auto.db.otel.generic-pool', + }, + status: 'ok', + }), + + expect.objectContaining({ + description: 'generic-pool.aquire', + origin: 'auto.db.otel.generic-pool', + data: { + 'sentry.origin': 'auto.db.otel.generic-pool', + }, + status: 'ok', }), ]), }; diff --git a/dev-packages/node-integration-tests/yalc.lock b/dev-packages/node-integration-tests/yalc.lock deleted file mode 100644 index 49a940cbf30a..000000000000 --- a/dev-packages/node-integration-tests/yalc.lock +++ /dev/null @@ -1,24 +0,0 @@ -{ - "version": "v1", - "packages": { - "@sentry/node": { - "signature": "fdee85f9c066418865de6221a8dc7314", - "file": true, - "replaced": "8.25.0" - }, - "@sentry/core": { - "signature": "b63046016939e0e6e9861c3fe8b39843", - "file": true - }, - "@sentry/types": { - "signature": "091747500ba09e4fef7b4e461001fdbf", - "file": true, - "replaced": "8.25.0" - }, - "@sentry/utils": { - "signature": "eb0f51315465ec6df6c436ceddac5cbd", - "file": true, - "replaced": "8.25.0" - } - } -} \ No newline at end of file diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index 9ef89ab42fb7..c079a9535342 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -26,6 +26,7 @@ export { hapiIntegration, setupHapiErrorHandler } from './integrations/tracing/h export { koaIntegration, setupKoaErrorHandler } from './integrations/tracing/koa'; export { connectIntegration, setupConnectErrorHandler } from './integrations/tracing/connect'; export { spotlightIntegration } from './integrations/spotlight'; +export { genericPoolIntegration } from './integrations/tracing/genericPool'; export { SentryContextManager } from './otel/contextManager'; export { generateInstrumentOnce } from './otel/instrument'; diff --git a/packages/node/src/integrations/tracing/genericPool.ts b/packages/node/src/integrations/tracing/genericPool.ts index 1c7725f95e45..4cda8bd9479d 100644 --- a/packages/node/src/integrations/tracing/genericPool.ts +++ b/packages/node/src/integrations/tracing/genericPool.ts @@ -17,7 +17,7 @@ const _genericPoolIntegration = (() => { setup(client) { client.on('spanStart', span => { const spanJSON = spanToJSON(span); - if (spanJSON.description === 'generic-pool.acquire') { + if (spanJSON.description === 'generic-pool.aquire') { span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.db.otel.generic-pool'); } });