From ad21991c0848aafef381c40d2d6ff9812b9c3ed2 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Mon, 6 May 2024 23:01:10 +0300 Subject: [PATCH 01/41] add typeorm instrumentation --- package-lock.json | 1409 +++++++++++++++++ .../instrumentation-typeorm/.eslintignore | 1 + .../node/instrumentation-typeorm/.eslintrc.js | 7 + plugins/node/instrumentation-typeorm/LICENSE | 201 +++ plugins/node/instrumentation-typeorm/NOTICE | 5 + .../node/instrumentation-typeorm/package.json | 63 + .../node/instrumentation-typeorm/src/index.ts | 17 + .../instrumentation-typeorm/src/typeorm.ts | 473 ++++++ .../node/instrumentation-typeorm/src/types.ts | 49 + .../src/utils/get-func-param-names.ts | 24 + .../src/utils/index.ts | 17 + .../src/utils/suppressTracing.ts | 26 + .../test/Connection.test.ts | 66 + .../test/EntityManager.test.ts | 214 +++ .../test/QueryBuilder.test.ts | 87 + .../test/Repository.test.ts | 52 + .../test/config.test.ts | 163 ++ .../instrumentation-typeorm/test/utils.ts | 53 + .../instrumentation-typeorm/tsconfig.json | 13 + 19 files changed, 2940 insertions(+) create mode 100644 plugins/node/instrumentation-typeorm/.eslintignore create mode 100644 plugins/node/instrumentation-typeorm/.eslintrc.js create mode 100644 plugins/node/instrumentation-typeorm/LICENSE create mode 100644 plugins/node/instrumentation-typeorm/NOTICE create mode 100644 plugins/node/instrumentation-typeorm/package.json create mode 100644 plugins/node/instrumentation-typeorm/src/index.ts create mode 100644 plugins/node/instrumentation-typeorm/src/typeorm.ts create mode 100644 plugins/node/instrumentation-typeorm/src/types.ts create mode 100644 plugins/node/instrumentation-typeorm/src/utils/get-func-param-names.ts create mode 100644 plugins/node/instrumentation-typeorm/src/utils/index.ts create mode 100644 plugins/node/instrumentation-typeorm/src/utils/suppressTracing.ts create mode 100644 plugins/node/instrumentation-typeorm/test/Connection.test.ts create mode 100644 plugins/node/instrumentation-typeorm/test/EntityManager.test.ts create mode 100644 plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts create mode 100644 plugins/node/instrumentation-typeorm/test/Repository.test.ts create mode 100644 plugins/node/instrumentation-typeorm/test/config.test.ts create mode 100644 plugins/node/instrumentation-typeorm/test/utils.ts create mode 100644 plugins/node/instrumentation-typeorm/tsconfig.json diff --git a/package-lock.json b/package-lock.json index d11fd45248..074d7c84e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4295,6 +4295,32 @@ "node": ">=0.1.90" } }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@cucumber/ci-environment": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/@cucumber/ci-environment/-/ci-environment-9.2.0.tgz", @@ -8582,6 +8608,10 @@ "resolved": "plugins/node/instrumentation-tedious", "link": true }, + "node_modules/@opentelemetry/instrumentation-typeorm": { + "resolved": "plugins/node/instrumentation-typeorm", + "link": true + }, "node_modules/@opentelemetry/instrumentation-undici": { "resolved": "plugins/node/instrumentation-undici", "link": true @@ -10298,6 +10328,12 @@ "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==", "dev": true }, + "node_modules/@sqltools/formatter": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@sqltools/formatter/-/formatter-1.2.5.tgz", + "integrity": "sha512-Uy0+khmZqUrUGm5dmMqVlnvufZRSK0FbYzVgp0UMstm+F5+W2/jnEEQyc9vo1ZR/E5ZI/B1WjjoTqBqwJL6Krw==", + "dev": true + }, "node_modules/@teppeis/multimaps": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@teppeis/multimaps/-/multimaps-2.0.0.tgz", @@ -10322,6 +10358,38 @@ "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", "dev": true }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/@tufjs/canonical-json": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz", @@ -11934,6 +12002,17 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/acorn-walk": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", + "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", + "dev": true, + "optional": true, + "peer": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/add-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/add-stream/-/add-stream-1.0.0.tgz", @@ -12216,6 +12295,15 @@ "node": ">= 8" } }, + "node_modules/app-root-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-3.1.0.tgz", + "integrity": "sha512-biN3PwB2gUtjaYy/isrU3aNWI5w+fAfvHkSvCKeQGxhmYpwKFUxudR3Yya+KqVRHBmEDYh+/lTozYCFbmzX4nA==", + "dev": true, + "engines": { + "node": ">= 6.0.0" + } + }, "node_modules/append-field": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", @@ -12259,6 +12347,14 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -14985,6 +15081,14 @@ "sha.js": "^2.4.8" } }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/cross-env": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", @@ -15183,6 +15287,12 @@ "node": "*" } }, + "node_modules/dayjs": { + "version": "1.11.11", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.11.tgz", + "integrity": "sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg==", + "dev": true + }, "node_modules/debounce": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", @@ -34731,6 +34841,14 @@ "integrity": "sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==", "dev": true }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/v8-to-istanbul": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", @@ -37386,6 +37504,764 @@ "@opentelemetry/api": "^1.3.0" } }, + "plugins/node/instrumentation-typeorm": { + "version": "0.0.1", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/instrumentation": "^0.51.0", + "@opentelemetry/semantic-conventions": "^1.24.0" + }, + "devDependencies": { + "@opentelemetry/api": "^1.3.0", + "@opentelemetry/contrib-test-utils": "^0.39.0", + "@opentelemetry/sdk-trace-base": "^1.24.0", + "@types/mocha": "7.0.2", + "@types/node": "18.6.5", + "mocha": "7.2.0", + "nyc": "15.1.0", + "rimraf": "5.0.5", + "sqlite3": "^5.0.2", + "ts-mocha": "10.0.0", + "typeorm": "^0.3.17", + "typescript": "4.4.4" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/api-logs": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.51.0.tgz", + "integrity": "sha512-m/jtfBPEIXS1asltl8fPQtO3Sb1qMpuL61unQajUmM8zIxeMF1AlqzWXM3QedcYgTTFiJCew5uJjyhpmqhc0+g==", + "dependencies": { + "@opentelemetry/api": "^1.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/context-async-hooks": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-1.24.0.tgz", + "integrity": "sha512-s7xaQ9ifDpJvwbWRLkZD/J5hY35w+MECm4TQUkg6szRcny9lf6oVhWij4w3JJFQgvHQMXU7oXOpX8Z05HxV/8g==", + "dev": true, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.9.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/contrib-test-utils": { + "version": "0.39.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/contrib-test-utils/-/contrib-test-utils-0.39.0.tgz", + "integrity": "sha512-Ob5eB/8Nayj9DmRnLn0v6y/mws7s/8TXbYyESkcu7lLoHzTvOToqKfjmTbjh/4IRxhtYKTMn894VCoOFCJyWBw==", + "dev": true, + "dependencies": { + "@opentelemetry/core": "^1.0.0", + "@opentelemetry/exporter-jaeger": "^1.3.1", + "@opentelemetry/instrumentation": "^0.51.0", + "@opentelemetry/resources": "^1.8.0", + "@opentelemetry/sdk-node": "^0.51.0", + "@opentelemetry/sdk-trace-base": "^1.8.0", + "@opentelemetry/sdk-trace-node": "^1.8.0", + "@opentelemetry/semantic-conventions": "^1.22.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/core": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.24.0.tgz", + "integrity": "sha512-FP2oN7mVPqcdxJDTTnKExj4mi91EH+DNuArKfHTjPuJWe2K1JfMIVXNfahw1h3onJxQnxS8K0stKkogX05s+Aw==", + "dev": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "1.24.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.9.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-trace-otlp-grpc": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-grpc/-/exporter-trace-otlp-grpc-0.51.0.tgz", + "integrity": "sha512-xQpxKzS8ZnxYCa1v+3EKWhwMrSK3+RezpJ+AEKaP2pf2QbLfHt7kKfSn7niR2u3A1Tbe2aC7Ptt9+MafhThOOQ==", + "dev": true, + "dependencies": { + "@grpc/grpc-js": "^1.7.1", + "@opentelemetry/core": "1.24.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.51.0", + "@opentelemetry/otlp-transformer": "0.51.0", + "@opentelemetry/resources": "1.24.0", + "@opentelemetry/sdk-trace-base": "1.24.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-trace-otlp-http": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-http/-/exporter-trace-otlp-http-0.51.0.tgz", + "integrity": "sha512-zODqnLZmPOxj9CarFv0TrVlx9mgj0TfCMCiUiTdNi9iA2rgdKVo+bjJjpYF6LCTJOQCR5TScAUCKyzwkgDI+iA==", + "dev": true, + "dependencies": { + "@opentelemetry/core": "1.24.0", + "@opentelemetry/otlp-exporter-base": "0.51.0", + "@opentelemetry/otlp-transformer": "0.51.0", + "@opentelemetry/resources": "1.24.0", + "@opentelemetry/sdk-trace-base": "1.24.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-trace-otlp-proto": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-proto/-/exporter-trace-otlp-proto-0.51.0.tgz", + "integrity": "sha512-Fi7r0iMqGoFCQQ+WY0pYOWp395vdinZJIkYKnNbnreHxAN/kVDBl2FxbV3DeOKuRxEY08Gyb9ggPf+Zrqp7l/w==", + "dev": true, + "dependencies": { + "@opentelemetry/core": "1.24.0", + "@opentelemetry/otlp-exporter-base": "0.51.0", + "@opentelemetry/otlp-proto-exporter-base": "0.51.0", + "@opentelemetry/otlp-transformer": "0.51.0", + "@opentelemetry/resources": "1.24.0", + "@opentelemetry/sdk-trace-base": "1.24.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-zipkin": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-zipkin/-/exporter-zipkin-1.24.0.tgz", + "integrity": "sha512-QeGv0PHONswmu567pf9QliJ6s6DgCu5+ziF+soNS1LTcr1VRRVLViYLmGxmzDFUC48sjNTu7sumcKT0nJXsGBw==", + "dev": true, + "dependencies": { + "@opentelemetry/core": "1.24.0", + "@opentelemetry/resources": "1.24.0", + "@opentelemetry/sdk-trace-base": "1.24.0", + "@opentelemetry/semantic-conventions": "1.24.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/instrumentation": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.51.0.tgz", + "integrity": "sha512-Eg/+Od5bEvzpvZQGhvMyKIkrzB9S7jW+6z9LHEI2VXhl/GrqQ3oBqlzJt4tA6pGtxRmqQWKWGM1wAbwDdW/gUA==", + "dependencies": { + "@opentelemetry/api-logs": "0.51.0", + "@types/shimmer": "^1.0.2", + "import-in-the-middle": "1.7.1", + "require-in-the-middle": "^7.1.1", + "semver": "^7.5.2", + "shimmer": "^1.2.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/otlp-exporter-base": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-exporter-base/-/otlp-exporter-base-0.51.0.tgz", + "integrity": "sha512-hR4c9vWVz1QgzCBSyy9zSDkvfTgaK96E6/tfVP6O4dzdZW9HqWimA3lXV/KXadEGqShvM4GToz9EHp2A5RU5bQ==", + "dev": true, + "dependencies": { + "@opentelemetry/core": "1.24.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/otlp-grpc-exporter-base": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-grpc-exporter-base/-/otlp-grpc-exporter-base-0.51.0.tgz", + "integrity": "sha512-oTRtDvvB0bTRTBVrvKA/oM1gIAqQ6DVQS07pvqiL1cZS8wBrGgpw+2iTd0nV661Y/MhDn/kNWp8lRhMEIKN9bw==", + "dev": true, + "dependencies": { + "@grpc/grpc-js": "^1.7.1", + "@opentelemetry/core": "1.24.0", + "@opentelemetry/otlp-exporter-base": "0.51.0", + "protobufjs": "^7.2.3" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/otlp-proto-exporter-base": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-proto-exporter-base/-/otlp-proto-exporter-base-0.51.0.tgz", + "integrity": "sha512-WDANDLSUh11Gu5o6iCzmjZraIv5bK8z1L/t6lxQ2NeEKiKUPo5pVOBBQQC/yAQU2yeqkiO1GRCieH+XahZf60A==", + "dev": true, + "dependencies": { + "@opentelemetry/core": "1.24.0", + "@opentelemetry/otlp-exporter-base": "0.51.0", + "protobufjs": "^7.2.3" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/otlp-transformer": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-transformer/-/otlp-transformer-0.51.0.tgz", + "integrity": "sha512-ylLgx2xumVoSefDHP9GMAU/LG+TU3+8eacVDXV5o1RqWxsdVOaQmCTY0XyDgeRTn6hIOVAq/HHQbRq3iWOrt2A==", + "dev": true, + "dependencies": { + "@opentelemetry/api-logs": "0.51.0", + "@opentelemetry/core": "1.24.0", + "@opentelemetry/resources": "1.24.0", + "@opentelemetry/sdk-logs": "0.51.0", + "@opentelemetry/sdk-metrics": "1.24.0", + "@opentelemetry/sdk-trace-base": "1.24.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.9.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/propagator-b3": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-b3/-/propagator-b3-1.24.0.tgz", + "integrity": "sha512-7TMIDE4+NO5vnkor+zned42wqca+hmhW5gWKhmYjUHC5B5uojo1PvtmBrd7kigFu96XvL4ZUWVzibWRWIQ/++Q==", + "dev": true, + "dependencies": { + "@opentelemetry/core": "1.24.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.9.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/propagator-jaeger": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-jaeger/-/propagator-jaeger-1.24.0.tgz", + "integrity": "sha512-r3MX3AmJiUeiWTXSDOdwBeaO+ahvWcFCpuKxmhhsH8Q8LqDnjhNd3krqBh4Qsq9wa0WhWtiQaDs/NOCWoMOlOw==", + "dev": true, + "dependencies": { + "@opentelemetry/core": "1.24.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.9.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/resources": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.24.0.tgz", + "integrity": "sha512-mxC7E7ocUS1tLzepnA7O9/G8G6ZTdjCH2pXme1DDDuCuk6n2/53GADX+GWBuyX0dfIxeMInIbJAdjlfN9GNr6A==", + "dev": true, + "dependencies": { + "@opentelemetry/core": "1.24.0", + "@opentelemetry/semantic-conventions": "1.24.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.9.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/sdk-logs": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.51.0.tgz", + "integrity": "sha512-K4fMBRFD8hQ6khk0rvYFuo6L9ymeGgByir6BcuFIgQuQ00OhYwBi9AruZz5V733Ejq7P8ObR3YyubkOUIbeVAw==", + "dev": true, + "dependencies": { + "@opentelemetry/core": "1.24.0", + "@opentelemetry/resources": "1.24.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.4.0 <1.9.0", + "@opentelemetry/api-logs": ">=0.39.1" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/sdk-metrics": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.24.0.tgz", + "integrity": "sha512-4tJ+E6N019OZVB/nUW/LoK9xHxfeh88TCoaTqHeLBE9wLYfi6irWW6J9cphMav7J8Qk0D5b7/RM4VEY4dArWOA==", + "dev": true, + "dependencies": { + "@opentelemetry/core": "1.24.0", + "@opentelemetry/resources": "1.24.0", + "lodash.merge": "^4.6.2" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.9.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/sdk-node": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-node/-/sdk-node-0.51.0.tgz", + "integrity": "sha512-MrPXDQsTAj3lcY8YUCjb7dvSXVZ5jG6wmjD2LB68V1rsLBdP8j70jsI9GaKijY7QB6psbLq6apO1vYeim5U7aw==", + "dev": true, + "dependencies": { + "@opentelemetry/api-logs": "0.51.0", + "@opentelemetry/core": "1.24.0", + "@opentelemetry/exporter-trace-otlp-grpc": "0.51.0", + "@opentelemetry/exporter-trace-otlp-http": "0.51.0", + "@opentelemetry/exporter-trace-otlp-proto": "0.51.0", + "@opentelemetry/exporter-zipkin": "1.24.0", + "@opentelemetry/instrumentation": "0.51.0", + "@opentelemetry/resources": "1.24.0", + "@opentelemetry/sdk-logs": "0.51.0", + "@opentelemetry/sdk-metrics": "1.24.0", + "@opentelemetry/sdk-trace-base": "1.24.0", + "@opentelemetry/sdk-trace-node": "1.24.0", + "@opentelemetry/semantic-conventions": "1.24.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.9.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/sdk-trace-base": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.24.0.tgz", + "integrity": "sha512-H9sLETZ4jw9UJ3totV8oM5R0m4CW0ZIOLfp4NV3g0CM8HD5zGZcaW88xqzWDgiYRpctFxd+WmHtGX/Upoa2vRg==", + "dev": true, + "dependencies": { + "@opentelemetry/core": "1.24.0", + "@opentelemetry/resources": "1.24.0", + "@opentelemetry/semantic-conventions": "1.24.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.9.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/sdk-trace-node": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-node/-/sdk-trace-node-1.24.0.tgz", + "integrity": "sha512-QgByHmM9uloTpcYEEyW9YJEIMKHFSIM677RH9pJPWWwtM2NQFbEp/8HIJw80Ymtaz6cAxg1Kay1ByqIVzq3t5g==", + "dev": true, + "dependencies": { + "@opentelemetry/context-async-hooks": "1.24.0", + "@opentelemetry/core": "1.24.0", + "@opentelemetry/propagator-b3": "1.24.0", + "@opentelemetry/propagator-jaeger": "1.24.0", + "@opentelemetry/sdk-trace-base": "1.24.0", + "semver": "^7.5.2" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.9.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/semantic-conventions": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.24.0.tgz", + "integrity": "sha512-yL0jI6Ltuz8R+Opj7jClGrul6pOoYrdfVmzQS4SITXRPH7I5IRZbrwe/6/v8v4WYMa6MYZG480S1+uc/IGfqsA==", + "engines": { + "node": ">=14" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/bson": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/bson/-/bson-5.5.1.tgz", + "integrity": "sha512-ix0EwukN2EpC0SRWIj/7B5+A6uQMQy6KMREI9qQqvgpkV2frH63T0UDVd1SYedL6dNCmDBYB3QtXi4ISk9YT+g==", + "dev": true, + "optional": true, + "peer": true, + "engines": { + "node": ">=14.20.1" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "plugins/node/instrumentation-typeorm/node_modules/dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "plugins/node/instrumentation-typeorm/node_modules/mongodb": { + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.9.2.tgz", + "integrity": "sha512-H60HecKO4Bc+7dhOv4sJlgvenK4fQNqqUIlXxZYQNbfEWSALGAwGoyJd/0Qwk4TttFXUOHJ2ZJQe/52ScaUwtQ==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "bson": "^5.5.0", + "mongodb-connection-string-url": "^2.6.0", + "socks": "^2.7.1" + }, + "engines": { + "node": ">=14.20.1" + }, + "optionalDependencies": { + "@mongodb-js/saslprep": "^1.1.0" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.188.0", + "@mongodb-js/zstd": "^1.0.0", + "kerberos": "^1.0.0 || ^2.0.0", + "mongodb-client-encryption": ">=2.3.0 <3", + "snappy": "^7.2.2" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "@mongodb-js/zstd": { + "optional": true + }, + "kerberos": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + } + } + }, + "plugins/node/instrumentation-typeorm/node_modules/reflect-metadata": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", + "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==", + "dev": true + }, + "plugins/node/instrumentation-typeorm/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "plugins/node/instrumentation-typeorm/node_modules/typeorm": { + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.20.tgz", + "integrity": "sha512-sJ0T08dV5eoZroaq9uPKBoNcGslHBR4E4y+EBHs//SiGbblGe7IeduP/IH4ddCcj0qp3PHwDwGnuvqEAnKlq/Q==", + "dev": true, + "dependencies": { + "@sqltools/formatter": "^1.2.5", + "app-root-path": "^3.1.0", + "buffer": "^6.0.3", + "chalk": "^4.1.2", + "cli-highlight": "^2.1.11", + "dayjs": "^1.11.9", + "debug": "^4.3.4", + "dotenv": "^16.0.3", + "glob": "^10.3.10", + "mkdirp": "^2.1.3", + "reflect-metadata": "^0.2.1", + "sha.js": "^2.4.11", + "tslib": "^2.5.0", + "uuid": "^9.0.0", + "yargs": "^17.6.2" + }, + "bin": { + "typeorm": "cli.js", + "typeorm-ts-node-commonjs": "cli-ts-node-commonjs.js", + "typeorm-ts-node-esm": "cli-ts-node-esm.js" + }, + "engines": { + "node": ">=16.13.0" + }, + "funding": { + "url": "https://opencollective.com/typeorm" + }, + "peerDependencies": { + "@google-cloud/spanner": "^5.18.0", + "@sap/hana-client": "^2.12.25", + "better-sqlite3": "^7.1.2 || ^8.0.0 || ^9.0.0", + "hdb-pool": "^0.1.6", + "ioredis": "^5.0.4", + "mongodb": "^5.8.0", + "mssql": "^9.1.1 || ^10.0.1", + "mysql2": "^2.2.5 || ^3.0.1", + "oracledb": "^6.3.0", + "pg": "^8.5.1", + "pg-native": "^3.0.0", + "pg-query-stream": "^4.0.0", + "redis": "^3.1.1 || ^4.0.0", + "sql.js": "^1.4.0", + "sqlite3": "^5.0.3", + "ts-node": "^10.7.0", + "typeorm-aurora-data-api-driver": "^2.0.0" + }, + "peerDependenciesMeta": { + "@google-cloud/spanner": { + "optional": true + }, + "@sap/hana-client": { + "optional": true + }, + "better-sqlite3": { + "optional": true + }, + "hdb-pool": { + "optional": true + }, + "ioredis": { + "optional": true + }, + "mongodb": { + "optional": true + }, + "mssql": { + "optional": true + }, + "mysql2": { + "optional": true + }, + "oracledb": { + "optional": true + }, + "pg": { + "optional": true + }, + "pg-native": { + "optional": true + }, + "pg-query-stream": { + "optional": true + }, + "redis": { + "optional": true + }, + "sql.js": { + "optional": true + }, + "sqlite3": { + "optional": true + }, + "ts-node": { + "optional": true + }, + "typeorm-aurora-data-api-driver": { + "optional": true + } + } + }, + "plugins/node/instrumentation-typeorm/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "dev": true, + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "optional": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, "plugins/node/instrumentation-undici": { "name": "@opentelemetry/instrumentation-undici", "version": "0.1.0", @@ -42542,6 +43418,31 @@ "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", "dev": true }, + "@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "dependencies": { + "@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + } + } + }, "@cucumber/ci-environment": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/@cucumber/ci-environment/-/ci-environment-9.2.0.tgz", @@ -47193,6 +48094,432 @@ "typescript": "4.4.4" } }, + "@opentelemetry/instrumentation-typeorm": { + "version": "file:plugins/node/instrumentation-typeorm", + "requires": { + "@opentelemetry/api": "^1.3.0", + "@opentelemetry/contrib-test-utils": "^0.39.0", + "@opentelemetry/instrumentation": "^0.51.0", + "@opentelemetry/sdk-trace-base": "^1.24.0", + "@opentelemetry/semantic-conventions": "^1.24.0", + "@types/mocha": "7.0.2", + "@types/node": "18.6.5", + "mocha": "7.2.0", + "nyc": "15.1.0", + "rimraf": "5.0.5", + "sqlite3": "^5.0.2", + "ts-mocha": "10.0.0", + "typeorm": "^0.3.17", + "typescript": "4.4.4" + }, + "dependencies": { + "@opentelemetry/api-logs": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.51.0.tgz", + "integrity": "sha512-m/jtfBPEIXS1asltl8fPQtO3Sb1qMpuL61unQajUmM8zIxeMF1AlqzWXM3QedcYgTTFiJCew5uJjyhpmqhc0+g==", + "requires": { + "@opentelemetry/api": "^1.0.0" + } + }, + "@opentelemetry/context-async-hooks": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-1.24.0.tgz", + "integrity": "sha512-s7xaQ9ifDpJvwbWRLkZD/J5hY35w+MECm4TQUkg6szRcny9lf6oVhWij4w3JJFQgvHQMXU7oXOpX8Z05HxV/8g==", + "dev": true, + "requires": {} + }, + "@opentelemetry/contrib-test-utils": { + "version": "0.39.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/contrib-test-utils/-/contrib-test-utils-0.39.0.tgz", + "integrity": "sha512-Ob5eB/8Nayj9DmRnLn0v6y/mws7s/8TXbYyESkcu7lLoHzTvOToqKfjmTbjh/4IRxhtYKTMn894VCoOFCJyWBw==", + "dev": true, + "requires": { + "@opentelemetry/core": "^1.0.0", + "@opentelemetry/exporter-jaeger": "^1.3.1", + "@opentelemetry/instrumentation": "^0.51.0", + "@opentelemetry/resources": "^1.8.0", + "@opentelemetry/sdk-node": "^0.51.0", + "@opentelemetry/sdk-trace-base": "^1.8.0", + "@opentelemetry/sdk-trace-node": "^1.8.0", + "@opentelemetry/semantic-conventions": "^1.22.0" + } + }, + "@opentelemetry/core": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.24.0.tgz", + "integrity": "sha512-FP2oN7mVPqcdxJDTTnKExj4mi91EH+DNuArKfHTjPuJWe2K1JfMIVXNfahw1h3onJxQnxS8K0stKkogX05s+Aw==", + "dev": true, + "requires": { + "@opentelemetry/semantic-conventions": "1.24.0" + } + }, + "@opentelemetry/exporter-trace-otlp-grpc": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-grpc/-/exporter-trace-otlp-grpc-0.51.0.tgz", + "integrity": "sha512-xQpxKzS8ZnxYCa1v+3EKWhwMrSK3+RezpJ+AEKaP2pf2QbLfHt7kKfSn7niR2u3A1Tbe2aC7Ptt9+MafhThOOQ==", + "dev": true, + "requires": { + "@grpc/grpc-js": "^1.7.1", + "@opentelemetry/core": "1.24.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.51.0", + "@opentelemetry/otlp-transformer": "0.51.0", + "@opentelemetry/resources": "1.24.0", + "@opentelemetry/sdk-trace-base": "1.24.0" + } + }, + "@opentelemetry/exporter-trace-otlp-http": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-http/-/exporter-trace-otlp-http-0.51.0.tgz", + "integrity": "sha512-zODqnLZmPOxj9CarFv0TrVlx9mgj0TfCMCiUiTdNi9iA2rgdKVo+bjJjpYF6LCTJOQCR5TScAUCKyzwkgDI+iA==", + "dev": true, + "requires": { + "@opentelemetry/core": "1.24.0", + "@opentelemetry/otlp-exporter-base": "0.51.0", + "@opentelemetry/otlp-transformer": "0.51.0", + "@opentelemetry/resources": "1.24.0", + "@opentelemetry/sdk-trace-base": "1.24.0" + } + }, + "@opentelemetry/exporter-trace-otlp-proto": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-proto/-/exporter-trace-otlp-proto-0.51.0.tgz", + "integrity": "sha512-Fi7r0iMqGoFCQQ+WY0pYOWp395vdinZJIkYKnNbnreHxAN/kVDBl2FxbV3DeOKuRxEY08Gyb9ggPf+Zrqp7l/w==", + "dev": true, + "requires": { + "@opentelemetry/core": "1.24.0", + "@opentelemetry/otlp-exporter-base": "0.51.0", + "@opentelemetry/otlp-proto-exporter-base": "0.51.0", + "@opentelemetry/otlp-transformer": "0.51.0", + "@opentelemetry/resources": "1.24.0", + "@opentelemetry/sdk-trace-base": "1.24.0" + } + }, + "@opentelemetry/exporter-zipkin": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-zipkin/-/exporter-zipkin-1.24.0.tgz", + "integrity": "sha512-QeGv0PHONswmu567pf9QliJ6s6DgCu5+ziF+soNS1LTcr1VRRVLViYLmGxmzDFUC48sjNTu7sumcKT0nJXsGBw==", + "dev": true, + "requires": { + "@opentelemetry/core": "1.24.0", + "@opentelemetry/resources": "1.24.0", + "@opentelemetry/sdk-trace-base": "1.24.0", + "@opentelemetry/semantic-conventions": "1.24.0" + } + }, + "@opentelemetry/instrumentation": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.51.0.tgz", + "integrity": "sha512-Eg/+Od5bEvzpvZQGhvMyKIkrzB9S7jW+6z9LHEI2VXhl/GrqQ3oBqlzJt4tA6pGtxRmqQWKWGM1wAbwDdW/gUA==", + "requires": { + "@opentelemetry/api-logs": "0.51.0", + "@types/shimmer": "^1.0.2", + "import-in-the-middle": "1.7.1", + "require-in-the-middle": "^7.1.1", + "semver": "^7.5.2", + "shimmer": "^1.2.1" + } + }, + "@opentelemetry/otlp-exporter-base": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-exporter-base/-/otlp-exporter-base-0.51.0.tgz", + "integrity": "sha512-hR4c9vWVz1QgzCBSyy9zSDkvfTgaK96E6/tfVP6O4dzdZW9HqWimA3lXV/KXadEGqShvM4GToz9EHp2A5RU5bQ==", + "dev": true, + "requires": { + "@opentelemetry/core": "1.24.0" + } + }, + "@opentelemetry/otlp-grpc-exporter-base": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-grpc-exporter-base/-/otlp-grpc-exporter-base-0.51.0.tgz", + "integrity": "sha512-oTRtDvvB0bTRTBVrvKA/oM1gIAqQ6DVQS07pvqiL1cZS8wBrGgpw+2iTd0nV661Y/MhDn/kNWp8lRhMEIKN9bw==", + "dev": true, + "requires": { + "@grpc/grpc-js": "^1.7.1", + "@opentelemetry/core": "1.24.0", + "@opentelemetry/otlp-exporter-base": "0.51.0", + "protobufjs": "^7.2.3" + } + }, + "@opentelemetry/otlp-proto-exporter-base": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-proto-exporter-base/-/otlp-proto-exporter-base-0.51.0.tgz", + "integrity": "sha512-WDANDLSUh11Gu5o6iCzmjZraIv5bK8z1L/t6lxQ2NeEKiKUPo5pVOBBQQC/yAQU2yeqkiO1GRCieH+XahZf60A==", + "dev": true, + "requires": { + "@opentelemetry/core": "1.24.0", + "@opentelemetry/otlp-exporter-base": "0.51.0", + "protobufjs": "^7.2.3" + } + }, + "@opentelemetry/otlp-transformer": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-transformer/-/otlp-transformer-0.51.0.tgz", + "integrity": "sha512-ylLgx2xumVoSefDHP9GMAU/LG+TU3+8eacVDXV5o1RqWxsdVOaQmCTY0XyDgeRTn6hIOVAq/HHQbRq3iWOrt2A==", + "dev": true, + "requires": { + "@opentelemetry/api-logs": "0.51.0", + "@opentelemetry/core": "1.24.0", + "@opentelemetry/resources": "1.24.0", + "@opentelemetry/sdk-logs": "0.51.0", + "@opentelemetry/sdk-metrics": "1.24.0", + "@opentelemetry/sdk-trace-base": "1.24.0" + } + }, + "@opentelemetry/propagator-b3": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-b3/-/propagator-b3-1.24.0.tgz", + "integrity": "sha512-7TMIDE4+NO5vnkor+zned42wqca+hmhW5gWKhmYjUHC5B5uojo1PvtmBrd7kigFu96XvL4ZUWVzibWRWIQ/++Q==", + "dev": true, + "requires": { + "@opentelemetry/core": "1.24.0" + } + }, + "@opentelemetry/propagator-jaeger": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-jaeger/-/propagator-jaeger-1.24.0.tgz", + "integrity": "sha512-r3MX3AmJiUeiWTXSDOdwBeaO+ahvWcFCpuKxmhhsH8Q8LqDnjhNd3krqBh4Qsq9wa0WhWtiQaDs/NOCWoMOlOw==", + "dev": true, + "requires": { + "@opentelemetry/core": "1.24.0" + } + }, + "@opentelemetry/resources": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.24.0.tgz", + "integrity": "sha512-mxC7E7ocUS1tLzepnA7O9/G8G6ZTdjCH2pXme1DDDuCuk6n2/53GADX+GWBuyX0dfIxeMInIbJAdjlfN9GNr6A==", + "dev": true, + "requires": { + "@opentelemetry/core": "1.24.0", + "@opentelemetry/semantic-conventions": "1.24.0" + } + }, + "@opentelemetry/sdk-logs": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.51.0.tgz", + "integrity": "sha512-K4fMBRFD8hQ6khk0rvYFuo6L9ymeGgByir6BcuFIgQuQ00OhYwBi9AruZz5V733Ejq7P8ObR3YyubkOUIbeVAw==", + "dev": true, + "requires": { + "@opentelemetry/core": "1.24.0", + "@opentelemetry/resources": "1.24.0" + } + }, + "@opentelemetry/sdk-metrics": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.24.0.tgz", + "integrity": "sha512-4tJ+E6N019OZVB/nUW/LoK9xHxfeh88TCoaTqHeLBE9wLYfi6irWW6J9cphMav7J8Qk0D5b7/RM4VEY4dArWOA==", + "dev": true, + "requires": { + "@opentelemetry/core": "1.24.0", + "@opentelemetry/resources": "1.24.0", + "lodash.merge": "^4.6.2" + } + }, + "@opentelemetry/sdk-node": { + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-node/-/sdk-node-0.51.0.tgz", + "integrity": "sha512-MrPXDQsTAj3lcY8YUCjb7dvSXVZ5jG6wmjD2LB68V1rsLBdP8j70jsI9GaKijY7QB6psbLq6apO1vYeim5U7aw==", + "dev": true, + "requires": { + "@opentelemetry/api-logs": "0.51.0", + "@opentelemetry/core": "1.24.0", + "@opentelemetry/exporter-trace-otlp-grpc": "0.51.0", + "@opentelemetry/exporter-trace-otlp-http": "0.51.0", + "@opentelemetry/exporter-trace-otlp-proto": "0.51.0", + "@opentelemetry/exporter-zipkin": "1.24.0", + "@opentelemetry/instrumentation": "0.51.0", + "@opentelemetry/resources": "1.24.0", + "@opentelemetry/sdk-logs": "0.51.0", + "@opentelemetry/sdk-metrics": "1.24.0", + "@opentelemetry/sdk-trace-base": "1.24.0", + "@opentelemetry/sdk-trace-node": "1.24.0", + "@opentelemetry/semantic-conventions": "1.24.0" + } + }, + "@opentelemetry/sdk-trace-base": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.24.0.tgz", + "integrity": "sha512-H9sLETZ4jw9UJ3totV8oM5R0m4CW0ZIOLfp4NV3g0CM8HD5zGZcaW88xqzWDgiYRpctFxd+WmHtGX/Upoa2vRg==", + "dev": true, + "requires": { + "@opentelemetry/core": "1.24.0", + "@opentelemetry/resources": "1.24.0", + "@opentelemetry/semantic-conventions": "1.24.0" + } + }, + "@opentelemetry/sdk-trace-node": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-node/-/sdk-trace-node-1.24.0.tgz", + "integrity": "sha512-QgByHmM9uloTpcYEEyW9YJEIMKHFSIM677RH9pJPWWwtM2NQFbEp/8HIJw80Ymtaz6cAxg1Kay1ByqIVzq3t5g==", + "dev": true, + "requires": { + "@opentelemetry/context-async-hooks": "1.24.0", + "@opentelemetry/core": "1.24.0", + "@opentelemetry/propagator-b3": "1.24.0", + "@opentelemetry/propagator-jaeger": "1.24.0", + "@opentelemetry/sdk-trace-base": "1.24.0", + "semver": "^7.5.2" + } + }, + "@opentelemetry/semantic-conventions": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.24.0.tgz", + "integrity": "sha512-yL0jI6Ltuz8R+Opj7jClGrul6pOoYrdfVmzQS4SITXRPH7I5IRZbrwe/6/v8v4WYMa6MYZG480S1+uc/IGfqsA==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "bson": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/bson/-/bson-5.5.1.tgz", + "integrity": "sha512-ix0EwukN2EpC0SRWIj/7B5+A6uQMQy6KMREI9qQqvgpkV2frH63T0UDVd1SYedL6dNCmDBYB3QtXi4ISk9YT+g==", + "dev": true, + "optional": true, + "peer": true + }, + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "dev": true + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true + }, + "mongodb": { + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.9.2.tgz", + "integrity": "sha512-H60HecKO4Bc+7dhOv4sJlgvenK4fQNqqUIlXxZYQNbfEWSALGAwGoyJd/0Qwk4TttFXUOHJ2ZJQe/52ScaUwtQ==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "@mongodb-js/saslprep": "^1.1.0", + "bson": "^5.5.0", + "mongodb-connection-string-url": "^2.6.0", + "socks": "^2.7.1" + } + }, + "reflect-metadata": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", + "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + } + }, + "typeorm": { + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.20.tgz", + "integrity": "sha512-sJ0T08dV5eoZroaq9uPKBoNcGslHBR4E4y+EBHs//SiGbblGe7IeduP/IH4ddCcj0qp3PHwDwGnuvqEAnKlq/Q==", + "dev": true, + "requires": { + "@sqltools/formatter": "^1.2.5", + "app-root-path": "^3.1.0", + "buffer": "^6.0.3", + "chalk": "^4.1.2", + "cli-highlight": "^2.1.11", + "dayjs": "^1.11.9", + "debug": "^4.3.4", + "dotenv": "^16.0.3", + "glob": "^10.3.10", + "mkdirp": "^2.1.3", + "reflect-metadata": "^0.2.1", + "sha.js": "^2.4.11", + "tslib": "^2.5.0", + "uuid": "^9.0.0", + "yargs": "^17.6.2" + } + }, + "uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "dev": true + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "optional": true, + "peer": true + } + } + }, "@opentelemetry/instrumentation-undici": { "version": "file:plugins/node/instrumentation-undici", "requires": { @@ -49062,6 +50389,12 @@ "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==", "dev": true }, + "@sqltools/formatter": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@sqltools/formatter/-/formatter-1.2.5.tgz", + "integrity": "sha512-Uy0+khmZqUrUGm5dmMqVlnvufZRSK0FbYzVgp0UMstm+F5+W2/jnEEQyc9vo1ZR/E5ZI/B1WjjoTqBqwJL6Krw==", + "dev": true + }, "@teppeis/multimaps": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@teppeis/multimaps/-/multimaps-2.0.0.tgz", @@ -49080,6 +50413,38 @@ "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", "dev": true }, + "@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "dev": true, + "optional": true, + "peer": true + }, + "@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true, + "optional": true, + "peer": true + }, + "@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true, + "optional": true, + "peer": true + }, + "@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true, + "optional": true, + "peer": true + }, "@tufjs/canonical-json": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz", @@ -50471,6 +51836,14 @@ "dev": true, "requires": {} }, + "acorn-walk": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", + "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", + "dev": true, + "optional": true, + "peer": true + }, "add-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/add-stream/-/add-stream-1.0.0.tgz", @@ -50695,6 +52068,12 @@ "picomatch": "^2.0.4" } }, + "app-root-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-3.1.0.tgz", + "integrity": "sha512-biN3PwB2gUtjaYy/isrU3aNWI5w+fAfvHkSvCKeQGxhmYpwKFUxudR3Yya+KqVRHBmEDYh+/lTozYCFbmzX4nA==", + "dev": true + }, "append-field": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", @@ -50732,6 +52111,14 @@ "readable-stream": "^3.6.0" } }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true, + "optional": true, + "peer": true + }, "argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -52891,6 +54278,14 @@ "sha.js": "^2.4.8" } }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true, + "optional": true, + "peer": true + }, "cross-env": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", @@ -53044,6 +54439,12 @@ "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", "dev": true }, + "dayjs": { + "version": "1.11.11", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.11.tgz", + "integrity": "sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg==", + "dev": true + }, "debounce": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", @@ -68421,6 +69822,14 @@ "integrity": "sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==", "dev": true }, + "v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true, + "optional": true, + "peer": true + }, "v8-to-istanbul": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", diff --git a/plugins/node/instrumentation-typeorm/.eslintignore b/plugins/node/instrumentation-typeorm/.eslintignore new file mode 100644 index 0000000000..378eac25d3 --- /dev/null +++ b/plugins/node/instrumentation-typeorm/.eslintignore @@ -0,0 +1 @@ +build diff --git a/plugins/node/instrumentation-typeorm/.eslintrc.js b/plugins/node/instrumentation-typeorm/.eslintrc.js new file mode 100644 index 0000000000..f756f4488b --- /dev/null +++ b/plugins/node/instrumentation-typeorm/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + "env": { + "mocha": true, + "node": true + }, + ...require('../../../eslint.config.js') +} diff --git a/plugins/node/instrumentation-typeorm/LICENSE b/plugins/node/instrumentation-typeorm/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/plugins/node/instrumentation-typeorm/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/plugins/node/instrumentation-typeorm/NOTICE b/plugins/node/instrumentation-typeorm/NOTICE new file mode 100644 index 0000000000..8765d4a3cd --- /dev/null +++ b/plugins/node/instrumentation-typeorm/NOTICE @@ -0,0 +1,5 @@ +[Based on the instrumentation written by Aspecto](https://github.com/aspecto-io/opentelemetry-ext-js/tree/master/packages/instrumentation-typeorm). + +The library contains the following changes compared to the original: +* Removed `moduleVersionAttributeName` configuration option. +* Changed the function signature of `responseHook`. diff --git a/plugins/node/instrumentation-typeorm/package.json b/plugins/node/instrumentation-typeorm/package.json new file mode 100644 index 0000000000..be43e8f92c --- /dev/null +++ b/plugins/node/instrumentation-typeorm/package.json @@ -0,0 +1,63 @@ +{ + "name": "@opentelemetry/instrumentation-typeorm", + "version": "0.0.1", + "description": "OpenTelemetry automatic instrumentation package for typeorm", + "main": "build/src/index.js", + "types": "build/src/index.d.ts", + "repository": "open-telemetry/opentelemetry-js-contrib", + "scripts": { + "test": "ts-mocha --require @opentelemetry/contrib-test-utils -p tsconfig.json 'test/**/*.test.ts'", + "tdd": "npm run test -- --watch-extensions ts --watch", + "clean": "rimraf build/*", + "lint": "eslint . --ext .ts", + "lint:fix": "eslint . --ext .ts --fix", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-typeorm --include-dependencies", + "prewatch": "npm run precompile", + "prepublishOnly": "npm run compile", + "version:update": "node ../../../scripts/version-update.js", + "compile": "tsc -p ." + }, + "keywords": [ + "typeorm", + "instrumentation", + "nodejs", + "opentelemetry", + "profiling", + "tracing" + ], + "author": "OpenTelemetry Authors", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + }, + "files": [ + "build/src/**/*.js", + "build/src/**/*.js.map", + "build/src/**/*.d.ts" + ], + "publishConfig": { + "access": "public" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + }, + "devDependencies": { + "@opentelemetry/api": "^1.3.0", + "@opentelemetry/contrib-test-utils": "^0.39.0", + "@opentelemetry/sdk-trace-base": "^1.24.0", + "@types/mocha": "7.0.2", + "@types/node": "18.6.5", + "typeorm": "^0.3.17", + "mocha": "7.2.0", + "nyc": "15.1.0", + "rimraf": "5.0.5", + "ts-mocha": "10.0.0", + "sqlite3": "^5.0.2", + "typescript": "4.4.4" + }, + "dependencies": { + "@opentelemetry/instrumentation": "^0.51.0", + "@opentelemetry/semantic-conventions": "^1.24.0" + }, + "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-typeorm#readme" +} diff --git a/plugins/node/instrumentation-typeorm/src/index.ts b/plugins/node/instrumentation-typeorm/src/index.ts new file mode 100644 index 0000000000..853761b84e --- /dev/null +++ b/plugins/node/instrumentation-typeorm/src/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export * from './typeorm'; +export * from './types'; diff --git a/plugins/node/instrumentation-typeorm/src/typeorm.ts b/plugins/node/instrumentation-typeorm/src/typeorm.ts new file mode 100644 index 0000000000..caa79b0ed5 --- /dev/null +++ b/plugins/node/instrumentation-typeorm/src/typeorm.ts @@ -0,0 +1,473 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { + Span, + SpanKind, + SpanStatusCode, + trace, + context, +} from '@opentelemetry/api'; +import { suppressTracing } from '@opentelemetry/core'; +import { + SEMATTRS_DB_NAME, + SEMATTRS_DB_OPERATION, + SEMATTRS_DB_SQL_TABLE, + SEMATTRS_DB_STATEMENT, + SEMATTRS_DB_SYSTEM, + SEMATTRS_DB_USER, + SEMATTRS_NET_PEER_NAME, + SEMATTRS_NET_PEER_PORT, +} from '@opentelemetry/semantic-conventions'; +import { + ExtendedDatabaseAttribute, + TypeormInstrumentationConfig, +} from './types'; +import { + getParamNames, + isTypeormInternalTracingSuppressed, + suppressTypeormInternalTracing, +} from './utils'; +import { VERSION } from './version'; +import type * as typeorm from 'typeorm'; +import { + InstrumentationBase, + InstrumentationNodeModuleDefinition, + InstrumentationNodeModuleFile, + isWrapped, + safeExecuteInTheMiddle, +} from '@opentelemetry/instrumentation'; +import { isPromise } from 'util/types'; + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +type SelectQueryBuilderMethod = keyof typeorm.SelectQueryBuilder; +const selectQueryBuilderExecuteMethods: SelectQueryBuilderMethod[] = [ + 'getRawOne', + 'getCount', + 'getManyAndCount', + 'stream', + 'getMany', + 'getOneOrFail', + 'getOne', + 'getRawAndEntities', + 'getRawMany', +]; +const rawQueryFuncName = 'query'; +type EntityManagerMethods = keyof typeorm.EntityManager; +const functionsUsingEntityPersistExecutor: EntityManagerMethods[] = [ + 'save', + 'remove', + 'softRemove', + 'recover', +]; +const functionsUsingQueryBuilder: EntityManagerMethods[] = [ + 'insert', + 'update', + 'delete', + 'softDelete', + 'restore', + 'count', + 'find', + 'findAndCount', + 'findByIds', + 'findOne', + 'increment', + 'decrement', +]; +const entityManagerMethods: EntityManagerMethods[] = [ + ...functionsUsingEntityPersistExecutor, + ...functionsUsingQueryBuilder, +]; + +export class TypeormInstrumentation extends InstrumentationBase { + protected override _config!: TypeormInstrumentationConfig; + constructor(config: TypeormInstrumentationConfig = {}) { + super('@opentelemetry/instrumentation-typeorm', VERSION, config); + } + + protected init() { + const selectQueryBuilder = new InstrumentationNodeModuleFile( + 'typeorm/query-builder/SelectQueryBuilder.js', + ['>0.2.28'], + moduleExports => { + selectQueryBuilderExecuteMethods.map(method => { + if (isWrapped(moduleExports.SelectQueryBuilder.prototype?.[method])) { + this._unwrap(moduleExports.SelectQueryBuilder.prototype, method); + } + this._wrap( + moduleExports.SelectQueryBuilder.prototype, + method, + this._patchQueryBuilder() + ); + }); + + return moduleExports; + }, + moduleExports => { + selectQueryBuilderExecuteMethods.map(method => { + if (isWrapped(moduleExports.SelectQueryBuilder.prototype?.[method])) { + this._unwrap(moduleExports.SelectQueryBuilder.prototype, method); + } + }); + return moduleExports; + } + ); + + const connection = new InstrumentationNodeModuleFile( + 'typeorm/connection/Connection.js', + ['>0.2.28 <0.3.0'], + moduleExports => { + if (isWrapped(moduleExports.Connection.prototype?.[rawQueryFuncName])) { + this._unwrap(moduleExports.Connection.prototype, rawQueryFuncName); + } + this._wrap( + moduleExports.Connection.prototype, + rawQueryFuncName, + this._patchRawQuery() + ); + + return moduleExports; + }, + moduleExports => { + if (isWrapped(moduleExports.Connection.prototype?.[rawQueryFuncName])) { + this._unwrap(moduleExports.Connection.prototype, rawQueryFuncName); + } + return moduleExports; + } + ); + + const dataSource = new InstrumentationNodeModuleFile( + 'typeorm/data-source/DataSource.js', + ['>=0.3.0'], + moduleExports => { + if (isWrapped(moduleExports.DataSource.prototype?.[rawQueryFuncName])) { + this._unwrap(moduleExports.DataSource.prototype, rawQueryFuncName); + } + this._wrap( + moduleExports.DataSource.prototype, + rawQueryFuncName, + this._patchRawQuery() + ); + + return moduleExports; + }, + moduleExports => { + if (isWrapped(moduleExports.DataSource.prototype?.[rawQueryFuncName])) { + this._unwrap(moduleExports.DataSource.prototype, rawQueryFuncName); + } + return moduleExports; + } + ); + + const entityManager = new InstrumentationNodeModuleFile( + 'typeorm/entity-manager/EntityManager.js', + ['>0.2.28'], + moduleExports => { + entityManagerMethods.map(method => { + if (isWrapped(moduleExports.EntityManager.prototype?.[method])) { + this._unwrap(moduleExports.EntityManager.prototype, method); + } + this._wrap( + moduleExports.EntityManager.prototype, + method, + this._patchEntityManagerFunction(method) + ); + }); + + return moduleExports; + }, + moduleExports => { + entityManagerMethods.map(method => { + if (isWrapped(moduleExports.EntityManager.prototype?.[method])) { + this._unwrap(moduleExports.EntityManager.prototype, method); + } + }); + return moduleExports; + } + ); + + const module = new InstrumentationNodeModuleDefinition( + 'typeorm', + ['>0.2.28'], + undefined, + undefined, + [selectQueryBuilder, entityManager, connection, dataSource] + ); + return module; + } + + private _patchEntityManagerFunction(opName: string) { + const self = this; + return (original: Function) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return function (this: any, ...args: unknown[]) { + if (isTypeormInternalTracingSuppressed(context.active())) { + return original.apply(this, args); + } + const connectionOptions = this?.connection?.options ?? {}; + const attributes: Record = { + [SEMATTRS_DB_SYSTEM]: connectionOptions.type, + [SEMATTRS_DB_USER]: connectionOptions.username, + [SEMATTRS_NET_PEER_NAME]: connectionOptions.host, + [SEMATTRS_NET_PEER_PORT]: connectionOptions.port, + [SEMATTRS_DB_NAME]: connectionOptions.database, + [SEMATTRS_DB_OPERATION]: opName, + [SEMATTRS_DB_STATEMENT]: JSON.stringify( + buildStatement(original, args) + ), + }; + + //ignore EntityMetadataNotFoundError + try { + if (this.metadata) { + attributes[SEMATTRS_DB_SQL_TABLE] = this.metadata.tableName; + } else { + const entity = args[0]; + const name = + typeof entity === 'object' ? entity?.constructor?.name : entity; + const metadata = this.connection.getMetadata(name); + if (metadata?.tableName) { + attributes[SEMATTRS_DB_SQL_TABLE] = metadata.tableName; + } + } + } catch { + /* */ + } + + Object.entries(attributes).forEach(([key, value]) => { + if (value === undefined) delete attributes[key]; + }); + + const span: Span = self.tracer.startSpan(`TypeORM ${opName}`, { + kind: SpanKind.CLIENT, + attributes, + }); + + const contextWithSpan = trace.setSpan(context.active(), span); + + const traceContext = self._config.enableInternalInstrumentation + ? contextWithSpan + : suppressTypeormInternalTracing(contextWithSpan); + + const contextWithSuppressTracing = self._config + .suppressInternalInstrumentation + ? suppressTracing(traceContext) + : traceContext; + + return context.with(contextWithSuppressTracing, () => + self._endSpan(() => original.apply(this, args), span) + ); + }; + }; + } + + private _patchQueryBuilder() { + const self = this; + return (original: Function) => { + return function ( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + this: typeorm.SelectQueryBuilder, + ...args: unknown[] + ) { + if (isTypeormInternalTracingSuppressed(context.active())) { + return original.apply(this, args); + } + const sql = this.getQuery(); + const parameters = this.getParameters(); + const mainTableName = this.getMainTableName(); + const operation = this.expressionMap.queryType; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const connectionOptions: any = this.connection?.options; + const attributes: Record = { + [SEMATTRS_DB_SYSTEM]: connectionOptions.type, + [SEMATTRS_DB_USER]: connectionOptions.username, + [SEMATTRS_NET_PEER_NAME]: connectionOptions.host, + [SEMATTRS_NET_PEER_PORT]: connectionOptions.port, + [SEMATTRS_DB_NAME]: connectionOptions.database, + [SEMATTRS_DB_OPERATION]: operation, + [SEMATTRS_DB_STATEMENT]: sql, + [SEMATTRS_DB_SQL_TABLE]: mainTableName, + }; + if (self._config.collectParameters) { + try { + attributes[ExtendedDatabaseAttribute.DB_STATEMENT_PARAMETERS] = + JSON.stringify(parameters); + } catch (err) { + /* */ + } + } + const span: Span = self.tracer.startSpan( + `TypeORM ${operation} ${mainTableName}`, + { + kind: SpanKind.CLIENT, + attributes, + } + ); + + const contextWithSpan = trace.setSpan(context.active(), span); + + const traceContext = self._config.enableInternalInstrumentation + ? contextWithSpan + : suppressTypeormInternalTracing(contextWithSpan); + + const contextWithSuppressTracing = self._config + ?.suppressInternalInstrumentation + ? suppressTracing(traceContext) + : traceContext; + + return context.with(contextWithSuppressTracing, () => + self._endSpan(() => original.apply(this, args), span) + ); + }; + }; + } + + private getOperationName(statement: string) { + let operation = 'raw query'; + if (typeof statement === 'string') { + statement = statement.trim(); + try { + operation = statement.split(' ')[0].toUpperCase(); + } catch (e) { + /* */ + } + } + + return operation; + } + + private _patchRawQuery() { + const self = this; + return (original: Function) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return function (this: any, ...args: unknown[]) { + if (isTypeormInternalTracingSuppressed(context.active())) { + return original.apply(this, args); + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const sql = args[0] as any; + const operation = self.getOperationName(sql); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const connectionOptions: any = this.options; + const attributes = { + [SEMATTRS_DB_SYSTEM]: connectionOptions.type, + [SEMATTRS_DB_USER]: connectionOptions.username, + [SEMATTRS_NET_PEER_NAME]: connectionOptions.host, + [SEMATTRS_NET_PEER_PORT]: connectionOptions.port, + [SEMATTRS_DB_NAME]: connectionOptions.database, + [SEMATTRS_DB_OPERATION]: operation, + [SEMATTRS_DB_STATEMENT]: sql, + }; + + const span: Span = self.tracer.startSpan(`TypeORM ${operation}`, { + kind: SpanKind.CLIENT, + attributes, + }); + + const contextWithSpan = trace.setSpan(context.active(), span); + + const traceContext = self._config.enableInternalInstrumentation + ? contextWithSpan + : suppressTypeormInternalTracing(contextWithSpan); + + const contextWithSuppressTracing = self._config + ?.suppressInternalInstrumentation + ? suppressTracing(traceContext) + : traceContext; + + return context.with(contextWithSuppressTracing, () => + self._endSpan(() => original.apply(this, args), span) + ); + }; + }; + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + private _endSpan(traced: any, span: Span) { + const executeResponseHook = (response: unknown) => { + const hook = this._config?.responseHook; + if (hook !== undefined) { + safeExecuteInTheMiddle( + () => hook(span, { response }), + e => { + if (e) this._diag.error('responseHook error', e); + }, + true + ); + } + return response; + }; + try { + const response = traced(); + if (isPromise(response)) { + return Promise.resolve(response) + .then(response => executeResponseHook(response)) + .catch(err => { + if (err) { + if (typeof err === 'string') { + span.setStatus({ code: SpanStatusCode.ERROR, message: err }); + } else { + span.recordException(err); + span.setStatus({ + code: SpanStatusCode.ERROR, + message: err?.message, + }); + } + } + throw err; + }) + .finally(() => span.end()); + } else { + span.end(); + return executeResponseHook(response); + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } catch (error: any) { + span.recordException(error); + span.setStatus({ code: SpanStatusCode.ERROR, message: error?.message }); + span.end(); + throw error; + } + } +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const buildStatement = (func: Function, args: any[]) => { + const paramNames = getParamNames(func) || []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const statement = {} as any; + paramNames.forEach((pName, i) => { + const value = args[i]; + if (!value) return; + + try { + const stringified = JSON.stringify(value); + if (stringified) { + statement[pName] = args[i]; + return; + } + } catch (_err) { + /* */ + } + if (value?.name) { + statement[pName] = value.name; + return; + } + if (value?.constructor?.name) { + statement[pName] = value.constructor.name; + } + }); + return statement; +}; diff --git a/plugins/node/instrumentation-typeorm/src/types.ts b/plugins/node/instrumentation-typeorm/src/types.ts new file mode 100644 index 0000000000..cc942a514f --- /dev/null +++ b/plugins/node/instrumentation-typeorm/src/types.ts @@ -0,0 +1,49 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import type { Span } from '@opentelemetry/api'; +import { InstrumentationConfig } from '@opentelemetry/instrumentation'; + +export enum ExtendedDatabaseAttribute { + DB_STATEMENT_PARAMETERS = 'db.statement.parameters', +} + +export interface HookInfo { + response: any; +} + +export type TypeormResponseCustomAttributesFunction = ( + span: Span, + info: HookInfo +) => void; + +export interface TypeormInstrumentationConfig extends InstrumentationConfig { + /** hook for adding custom attributes using the response payload */ + responseHook?: TypeormResponseCustomAttributesFunction; + /** + * Typeorm operation use mongodb/postgres/mysql/mariadb/etc. under the hood. + * If, for example, postgres instrumentation is enabled, a postgres operation will also create + * a postgres span describing the communication. + * Setting the `suppressInternalInstrumentation` config value to `true` will + * cause the instrumentation to suppress instrumentation of underlying operations. + */ + suppressInternalInstrumentation?: boolean; + /** Some methods such as `getManyAndCount` can generate internally multiple spans. + * To instrument those set this to `true` + */ + enableInternalInstrumentation?: boolean; + /** set to `true` if you want to capture the parameter values for parameterized SQL queries (**may leak sensitive information**) */ + collectParameters?: boolean; +} diff --git a/plugins/node/instrumentation-typeorm/src/utils/get-func-param-names.ts b/plugins/node/instrumentation-typeorm/src/utils/get-func-param-names.ts new file mode 100644 index 0000000000..a740444d61 --- /dev/null +++ b/plugins/node/instrumentation-typeorm/src/utils/get-func-param-names.ts @@ -0,0 +1,24 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm; +const ARGUMENT_NAMES = /([^\s,]+)/g; + +export function getParamNames(func: Function) { + const fnStr = func.toString().replace(STRIP_COMMENTS, ''); + return fnStr + .slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')) + .match(ARGUMENT_NAMES); +} diff --git a/plugins/node/instrumentation-typeorm/src/utils/index.ts b/plugins/node/instrumentation-typeorm/src/utils/index.ts new file mode 100644 index 0000000000..5299ff9beb --- /dev/null +++ b/plugins/node/instrumentation-typeorm/src/utils/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export * from './get-func-param-names'; +export * from './suppressTracing'; diff --git a/plugins/node/instrumentation-typeorm/src/utils/suppressTracing.ts b/plugins/node/instrumentation-typeorm/src/utils/suppressTracing.ts new file mode 100644 index 0000000000..588483ee74 --- /dev/null +++ b/plugins/node/instrumentation-typeorm/src/utils/suppressTracing.ts @@ -0,0 +1,26 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { createContextKey, Context } from '@opentelemetry/api'; + +const SUPPRESS_TYPEORM_INTERNAL_TRACING_KEY = createContextKey( + 'instrumentation-typeorm Context Key SUPPRESS_TYPEORM_INTERNAL_TRACING' +); + +export const suppressTypeormInternalTracing = (context: Context) => + context.setValue(SUPPRESS_TYPEORM_INTERNAL_TRACING_KEY, true); + +export const isTypeormInternalTracingSuppressed = (context: Context) => + context.getValue(SUPPRESS_TYPEORM_INTERNAL_TRACING_KEY) === true; diff --git a/plugins/node/instrumentation-typeorm/test/Connection.test.ts b/plugins/node/instrumentation-typeorm/test/Connection.test.ts new file mode 100644 index 0000000000..918e671086 --- /dev/null +++ b/plugins/node/instrumentation-typeorm/test/Connection.test.ts @@ -0,0 +1,66 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import * as assert from 'assert'; +import { SpanStatusCode } from '@opentelemetry/api'; +import { + SEMATTRS_DB_SYSTEM, + SEMATTRS_DB_NAME, + SEMATTRS_DB_OPERATION, + SEMATTRS_DB_STATEMENT, +} from '@opentelemetry/semantic-conventions'; +import { TypeormInstrumentation } from '../src'; +import { + getTestSpans, + registerInstrumentationTesting, +} from '@opentelemetry/contrib-test-utils'; + +const instrumentation = registerInstrumentationTesting( + new TypeormInstrumentation() +); + +import * as typeorm from 'typeorm'; +import { rawQueryOptions } from './utils'; + +describe('Connection', () => { + after(() => { + instrumentation.enable(); + }); + beforeEach(() => { + instrumentation.enable(); + }); + afterEach(() => { + instrumentation.disable(); + }); + + describe('single connection', () => { + it('raw query', async () => { + const options = rawQueryOptions; + const connection = await typeorm.createConnection(rawQueryOptions); + const query = 'select * from user'; + await connection.query(query); + const typeOrmSpans = getTestSpans(); + + assert.strictEqual(typeOrmSpans.length, 1); + assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); + const attributes = typeOrmSpans[0].attributes; + assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], options.type); + assert.strictEqual(attributes[SEMATTRS_DB_NAME], options.database); + assert.strictEqual(attributes[SEMATTRS_DB_OPERATION], 'SELECT'); + assert.strictEqual(attributes[SEMATTRS_DB_STATEMENT], query); + await connection.close(); + }); + }); +}); diff --git a/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts b/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts new file mode 100644 index 0000000000..bcbbae80f5 --- /dev/null +++ b/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts @@ -0,0 +1,214 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import * as assert from 'assert'; +import { SpanStatusCode } from '@opentelemetry/api'; +import { + SEMATTRS_DB_SQL_TABLE, + SEMATTRS_DB_SYSTEM, + SEMATTRS_DB_NAME, + SEMATTRS_DB_OPERATION, + SEMATTRS_DB_STATEMENT, +} from '@opentelemetry/semantic-conventions'; +import { TypeormInstrumentation } from '../src'; +import { + getTestSpans, + registerInstrumentationTesting, +} from '@opentelemetry/contrib-test-utils'; + +const instrumentation = registerInstrumentationTesting( + new TypeormInstrumentation() +); +import * as typeorm from 'typeorm'; +import { defaultOptions, User } from './utils'; + +describe('EntityManager', () => { + after(() => { + instrumentation.enable(); + }); + beforeEach(() => { + instrumentation.enable(); + }); + afterEach(() => { + instrumentation.disable(); + }); + + describe('single connection', () => { + it('save using connection.manager', async () => { + const options = defaultOptions; + const connection = await typeorm.createConnection(defaultOptions); + const user = new User(1, 'aspecto', 'io'); + await connection.manager.save(user); + const typeOrmSpans = getTestSpans(); + + assert.strictEqual(typeOrmSpans.length, 1); + assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); + const attributes = typeOrmSpans[0].attributes; + assert.strictEqual(attributes[SEMATTRS_DB_SQL_TABLE], 'user'); + assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], options.type); + assert.strictEqual(attributes[SEMATTRS_DB_NAME], options.database); + assert.strictEqual(attributes[SEMATTRS_DB_OPERATION], 'save'); + assert.strictEqual( + attributes[SEMATTRS_DB_STATEMENT], + JSON.stringify({ targetOrEntity: user }) + ); + await connection.close(); + }); + + it('save', async () => { + const options = defaultOptions; + const connection = await typeorm.createConnection(defaultOptions); + const manager = connection.createEntityManager(); + const user = new User(1, 'aspecto', 'io'); + await manager.save(user); + const typeOrmSpans = getTestSpans(); + + assert.strictEqual(typeOrmSpans.length, 1); + assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); + const attributes = typeOrmSpans[0].attributes; + assert.strictEqual(attributes[SEMATTRS_DB_SQL_TABLE], 'user'); + assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], options.type); + assert.strictEqual(attributes[SEMATTRS_DB_NAME], options.database); + assert.strictEqual(attributes[SEMATTRS_DB_OPERATION], 'save'); + assert.strictEqual( + attributes[SEMATTRS_DB_STATEMENT], + JSON.stringify({ targetOrEntity: user }) + ); + await connection.close(); + }); + + it('remove', async () => { + const options = defaultOptions; + const connection = await typeorm.createConnection(defaultOptions); + const manager = connection.createEntityManager(); + + const user = new User(56, 'aspecto', 'io'); + await manager.save(user); + await manager.remove(user); + const typeOrmSpans = getTestSpans(); + + assert.strictEqual(typeOrmSpans.length, 2); + assert.strictEqual(typeOrmSpans[1].status.code, SpanStatusCode.UNSET); + const attributes = typeOrmSpans[1].attributes; + assert.strictEqual(attributes[SEMATTRS_DB_SQL_TABLE], 'user'); + assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], options.type); + assert.strictEqual(attributes[SEMATTRS_DB_NAME], options.database); + assert.strictEqual(attributes[SEMATTRS_DB_OPERATION], 'remove'); + assert.strictEqual( + attributes[SEMATTRS_DB_STATEMENT], + JSON.stringify({ + targetOrEntity: { id: 56, firstName: 'aspecto', lastName: 'io' }, + }) + ); + await connection.close(); + }); + + it('update', async () => { + const options = defaultOptions; + const connection = await typeorm.createConnection(defaultOptions); + const manager = connection.createEntityManager(); + const user = new User(56, 'aspecto', 'io'); + await manager.save(user); + const partialEntity = { lastName: '.io' }; + await manager.update(User, 56, partialEntity); + const typeOrmSpans = getTestSpans(); + + assert.strictEqual(typeOrmSpans.length, 2); + assert.strictEqual(typeOrmSpans[1].status.code, SpanStatusCode.UNSET); + const attributes = typeOrmSpans[1].attributes; + assert.strictEqual(attributes[SEMATTRS_DB_SQL_TABLE], 'user'); + assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], options.type); + assert.strictEqual(attributes[SEMATTRS_DB_NAME], options.database); + assert.strictEqual(attributes[SEMATTRS_DB_OPERATION], 'update'); + assert.strictEqual( + attributes[SEMATTRS_DB_STATEMENT], + JSON.stringify({ target: 'User', criteria: 56, partialEntity }) + ); + await connection.close(); + }); + + it('Sets failure status when function throws', async () => { + const connection = await typeorm.createConnection(defaultOptions); + const manager = connection.createEntityManager(); + try { + await manager.find({} as any); + } catch (err) {} + + const typeOrmSpans = getTestSpans(); + assert.strictEqual(typeOrmSpans.length, 1); + assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.ERROR); + assert.strictEqual( + typeOrmSpans[0].status.message, + 'No metadata for "[object Object]" was found.' + ); + await connection.close(); + }); + }); + + describe('multiple connections', () => { + const options2: any = { + name: 'connection2', + type: 'sqlite', + database: 'connection2.db', + entities: [User], + synchronize: true, + }; + + it('appends matching connection details to span', async () => { + const [sqlite1, sqlite2] = await typeorm.createConnections([ + defaultOptions, + options2, + ]); + const manager1 = sqlite1.createEntityManager(); + const manager2 = sqlite2.createEntityManager(); + + const user = new User(1, 'aspecto', 'io'); + await manager1.save(user); + await manager2.remove(user); + + const spans = getTestSpans(); + assert.strictEqual(spans.length, 2); + const sqlite1Span = spans[0]; + const sqlite2Span = spans[1]; + + assert.strictEqual( + sqlite1Span.attributes[SEMATTRS_DB_SYSTEM], + defaultOptions.type + ); + assert.strictEqual( + sqlite1Span.attributes[SEMATTRS_DB_NAME], + defaultOptions.database + ); + assert.strictEqual(sqlite1Span.attributes[SEMATTRS_DB_OPERATION], 'save'); + assert.strictEqual(sqlite1Span.attributes[SEMATTRS_DB_SQL_TABLE], 'user'); + + assert.strictEqual( + sqlite2Span.attributes[SEMATTRS_DB_SYSTEM], + options2.type + ); + assert.strictEqual( + sqlite2Span.attributes[SEMATTRS_DB_NAME], + options2.database + ); + assert.strictEqual( + sqlite2Span.attributes[SEMATTRS_DB_OPERATION], + 'remove' + ); + assert.strictEqual(sqlite2Span.attributes[SEMATTRS_DB_SQL_TABLE], 'user'); + await sqlite1.close(); + await sqlite2.close(); + }); + }); +}); diff --git a/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts b/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts new file mode 100644 index 0000000000..cdea8a3a48 --- /dev/null +++ b/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts @@ -0,0 +1,87 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import * as assert from 'assert'; +import { SpanStatusCode } from '@opentelemetry/api'; +import { + SEMATTRS_DB_NAME, + SEMATTRS_DB_SQL_TABLE, + SEMATTRS_DB_STATEMENT, + SEMATTRS_DB_SYSTEM, + SEMATTRS_DB_USER, + SEMATTRS_NET_PEER_NAME, + SEMATTRS_NET_PEER_PORT, +} from '@opentelemetry/semantic-conventions'; +import { TypeormInstrumentation } from '../src'; +import { + getTestSpans, + registerInstrumentationTesting, +} from '@opentelemetry/contrib-test-utils'; + +const instrumentation = registerInstrumentationTesting( + new TypeormInstrumentation() +); + +import * as typeorm from 'typeorm'; +import { defaultOptions, User } from './utils'; + +describe('QueryBuilder', () => { + beforeEach(() => { + instrumentation.enable(); + }); + + afterEach(() => { + instrumentation.disable(); + }); + + it('getManyAndCount', async () => { + const connectionOptions = defaultOptions as any; + const connection = await typeorm.createConnection(connectionOptions); + const queryBuilder = connection + .getRepository(User) + .createQueryBuilder('user'); + const users = await queryBuilder + .where('user.id = :userId', { userId: '1' }) + .getManyAndCount(); + assert.strictEqual(users.length, 2); + const typeOrmSpans = getTestSpans(); + assert.strictEqual(typeOrmSpans.length, 1); + assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); + const attributes = typeOrmSpans[0].attributes; + assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], connectionOptions.type); + assert.strictEqual( + attributes[SEMATTRS_DB_USER], + connectionOptions.username + ); + assert.strictEqual( + attributes[SEMATTRS_NET_PEER_NAME], + connectionOptions.host + ); + assert.strictEqual( + attributes[SEMATTRS_NET_PEER_PORT], + connectionOptions.port + ); + assert.strictEqual( + attributes[SEMATTRS_DB_NAME], + connectionOptions.database + ); + assert.strictEqual(attributes[SEMATTRS_DB_SQL_TABLE], 'user'); + assert.strictEqual( + attributes[SEMATTRS_DB_STATEMENT], + 'SELECT "user"."id" AS "user_id", "user"."firstName" AS "user_firstName", "user"."lastName" AS "user_lastName" FROM "user" "user" WHERE "user"."id" = :userId' + ); + await connection.close(); + }); +}); diff --git a/plugins/node/instrumentation-typeorm/test/Repository.test.ts b/plugins/node/instrumentation-typeorm/test/Repository.test.ts new file mode 100644 index 0000000000..31bc955146 --- /dev/null +++ b/plugins/node/instrumentation-typeorm/test/Repository.test.ts @@ -0,0 +1,52 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import * as assert from 'assert'; +import { TypeormInstrumentation } from '../src'; +import { + getTestSpans, + registerInstrumentationTesting, +} from '@opentelemetry/contrib-test-utils'; + +const instrumentation = registerInstrumentationTesting( + new TypeormInstrumentation() +); + +import { defaultOptions, User } from './utils'; +import * as typeorm from 'typeorm'; +import { SEMATTRS_DB_SQL_TABLE } from '@opentelemetry/semantic-conventions'; + +describe('Repository', () => { + beforeEach(() => { + instrumentation.enable(); + }); + + afterEach(() => { + instrumentation.disable(); + }); + + it('findAndCount', async () => { + const connection = await typeorm.createConnection(defaultOptions); + const repo = connection.getRepository(User); + const [_users, count] = await repo.findAndCount(); + assert(count === 0); + const spans = getTestSpans(); + assert.strictEqual(spans.length, 1); + const span = spans[0]; + const attributes = span.attributes; + assert.strictEqual(attributes[SEMATTRS_DB_SQL_TABLE], 'user'); + await connection.close(); + }); +}); diff --git a/plugins/node/instrumentation-typeorm/test/config.test.ts b/plugins/node/instrumentation-typeorm/test/config.test.ts new file mode 100644 index 0000000000..944c71a648 --- /dev/null +++ b/plugins/node/instrumentation-typeorm/test/config.test.ts @@ -0,0 +1,163 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import * as assert from 'assert'; +import { + SEMATTRS_NET_PEER_PORT, + SEMATTRS_NET_PEER_NAME, + SEMATTRS_DB_SQL_TABLE, + SEMATTRS_DB_NAME, + SEMATTRS_DB_USER, + SEMATTRS_DB_STATEMENT, + SEMATTRS_DB_SYSTEM, + SEMATTRS_DB_OPERATION, +} from '@opentelemetry/semantic-conventions'; +import { + ExtendedDatabaseAttribute, + TypeormInstrumentation, + TypeormInstrumentationConfig, +} from '../src'; + +import { + getTestSpans, + registerInstrumentationTesting, +} from '@opentelemetry/contrib-test-utils'; + +const instrumentation = registerInstrumentationTesting( + new TypeormInstrumentation() +); + +import * as typeorm from 'typeorm'; +import { defaultOptions, User } from './utils'; +import { SpanStatusCode } from '@opentelemetry/api'; + +describe('TypeormInstrumentationConfig', () => { + it('responseHook', async function () { + this.timeout(3_000); + instrumentation.disable(); + const config: TypeormInstrumentationConfig = { + responseHook: (span, { response }) => { + span.setAttribute('test', JSON.stringify(response)); + }, + }; + instrumentation.setConfig(config); + instrumentation.enable(); + + const connection = await typeorm.createConnection(defaultOptions); + const user = new User(1, 'aspecto', 'io'); + await connection.manager.save(user); + const typeOrmSpans = getTestSpans(); + assert.strictEqual(typeOrmSpans.length, 1); + const attributes = typeOrmSpans[0].attributes; + + assert.strictEqual(attributes['test'], JSON.stringify(user)); + assert.strictEqual(attributes[SEMATTRS_DB_OPERATION], 'save'); + assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], defaultOptions.type); + await connection.close(); + }); + + it('enableInternalInstrumentation:true', async () => { + const config: TypeormInstrumentationConfig = { + enableInternalInstrumentation: true, + }; + instrumentation.setConfig(config); + const connection = await typeorm.createConnection(defaultOptions); + await connection.manager.findAndCount(User); + const spans = getTestSpans(); + assert.strictEqual(spans.length, 2); + + const findAndCountSpan = spans.find( + s => s.name.indexOf('findAndCount') !== -1 + ); + assert.notStrictEqual(findAndCountSpan, undefined); + assert.strictEqual( + findAndCountSpan?.attributes[SEMATTRS_DB_OPERATION], + 'findAndCount' + ); + assert.strictEqual( + findAndCountSpan?.attributes[SEMATTRS_DB_SQL_TABLE], + 'user' + ); + + const selectSpan = spans.find(s => s.name.indexOf('select') !== -1); + assert.notStrictEqual(selectSpan, undefined); + assert.strictEqual(selectSpan?.attributes[SEMATTRS_DB_OPERATION], 'select'); + assert.strictEqual(selectSpan?.attributes[SEMATTRS_DB_SQL_TABLE], 'user'); + await connection.close(); + }); + + it('enableInternalInstrumentation:false', async () => { + const config: TypeormInstrumentationConfig = { + enableInternalInstrumentation: false, + }; + instrumentation.setConfig(config); + const connection = await typeorm.createConnection(defaultOptions); + await connection.manager.findAndCount(User); + const spans = getTestSpans(); + assert.strictEqual(spans.length, 1); + const attributes = spans[0].attributes; + assert.strictEqual(attributes[SEMATTRS_DB_OPERATION], 'findAndCount'); + assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], defaultOptions.type); + assert.strictEqual(attributes[SEMATTRS_DB_SQL_TABLE], 'user'); + await connection.close(); + }); + + it('collectParameters:true', async () => { + const config: TypeormInstrumentationConfig = { + collectParameters: true, + }; + instrumentation.setConfig(config); + const connectionOptions = defaultOptions as any; + const connection = await typeorm.createConnection(connectionOptions); + await connection + .getRepository(User) + .createQueryBuilder('user') + .where('user.id = :userId', { userId: '1' }) + .andWhere('user.firstName = :firstName', { firstName: 'bob' }) + .andWhere('user.lastName = :lastName', { lastName: 'dow' }) + .getMany(); + const typeOrmSpans = getTestSpans(); + assert.strictEqual(typeOrmSpans.length, 1); + assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); + const attributes = typeOrmSpans[0].attributes; + assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], connectionOptions.type); + assert.strictEqual( + attributes[SEMATTRS_DB_USER], + connectionOptions.username + ); + assert.strictEqual( + attributes[SEMATTRS_NET_PEER_NAME], + connectionOptions.host + ); + assert.strictEqual( + attributes[SEMATTRS_NET_PEER_PORT], + connectionOptions.port + ); + assert.strictEqual( + attributes[SEMATTRS_DB_NAME], + connectionOptions.database + ); + assert.strictEqual(attributes[SEMATTRS_DB_SQL_TABLE], 'user'); + assert.strictEqual( + attributes[SEMATTRS_DB_STATEMENT], + 'SELECT "user"."id" AS "user_id", "user"."firstName" AS "user_firstName", "user"."lastName" AS "user_lastName" FROM "user" "user" WHERE "user"."id" = :userId AND "user"."firstName" = :firstName AND "user"."lastName" = :lastName' + ); + assert.strictEqual( + attributes[ExtendedDatabaseAttribute.DB_STATEMENT_PARAMETERS], + JSON.stringify({ userId: '1', firstName: 'bob', lastName: 'dow' }) + ); + await connection.close(); + }); +}); diff --git a/plugins/node/instrumentation-typeorm/test/utils.ts b/plugins/node/instrumentation-typeorm/test/utils.ts new file mode 100644 index 0000000000..6588029162 --- /dev/null +++ b/plugins/node/instrumentation-typeorm/test/utils.ts @@ -0,0 +1,53 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import * as typeorm from 'typeorm'; + +@typeorm.Entity() +export class User { + @typeorm.PrimaryColumn() + id: number; + + @typeorm.Column() + firstName: string; + + @typeorm.Column() + lastName: string; + + constructor(id: number, firstName: string, lastName: string) { + this.id = id; + this.firstName = firstName; + this.lastName = lastName; + } +} + +// type is typeorm.ConnectionOptions for <0.3.0 +// and typeorm.DataSourceOptions for >=0.3.0 +export const defaultOptions: any = { + type: 'sqlite', + database: ':memory:', + dropSchema: true, + synchronize: true, + entities: [User], +}; + +export const rawQueryOptions: any = { + type: 'sqlite', + database: ':memory:', + dropSchema: true, + synchronize: true, + entities: [User], + name: 'rawQuery', +}; diff --git a/plugins/node/instrumentation-typeorm/tsconfig.json b/plugins/node/instrumentation-typeorm/tsconfig.json new file mode 100644 index 0000000000..9078465762 --- /dev/null +++ b/plugins/node/instrumentation-typeorm/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../../tsconfig.base", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "experimentalDecorators": true, + "emitDecoratorMetadata": true + }, + "include": [ + "src/**/*.ts", + "test/**/*.ts" + ] +} From 797bac8d12cb240c2afba9c3fd369a8192d18770 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Wed, 8 May 2024 16:51:30 +0300 Subject: [PATCH 02/41] update copyright notices, add readme --- eslint.config.js | 2 +- plugins/node/instrumentation-typeorm/NOTICE | 2 + .../node/instrumentation-typeorm/README.md | 89 +++++++++++++++++++ .../node/instrumentation-typeorm/src/index.ts | 2 +- .../instrumentation-typeorm/src/typeorm.ts | 6 +- .../node/instrumentation-typeorm/src/types.ts | 2 +- .../src/utils/get-func-param-names.ts | 2 +- .../src/utils/index.ts | 2 +- .../src/utils/suppressTracing.ts | 2 +- .../test/Connection.test.ts | 2 +- .../test/EntityManager.test.ts | 2 +- .../test/QueryBuilder.test.ts | 2 +- .../test/Repository.test.ts | 2 +- .../test/config.test.ts | 2 +- .../instrumentation-typeorm/test/utils.ts | 2 +- 15 files changed, 105 insertions(+), 16 deletions(-) create mode 100644 plugins/node/instrumentation-typeorm/README.md diff --git a/eslint.config.js b/eslint.config.js index e342425670..71488af0c9 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -20,7 +20,7 @@ module.exports = { "no-shadow": "off", "node/no-deprecated-api": ["warn"], "header/header": ["error", "block", [{ - pattern: / \* Copyright The OpenTelemetry Authors[\r\n]+ \*[\r\n]+ \* Licensed under the Apache License, Version 2\.0 \(the \"License\"\);[\r\n]+ \* you may not use this file except in compliance with the License\.[\r\n]+ \* You may obtain a copy of the License at[\r\n]+ \*[\r\n]+ \* https:\/\/www\.apache\.org\/licenses\/LICENSE-2\.0[\r\n]+ \*[\r\n]+ \* Unless required by applicable law or agreed to in writing, software[\r\n]+ \* distributed under the License is distributed on an \"AS IS\" BASIS,[\r\n]+ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.[\r\n]+ \* See the License for the specific language governing permissions and[\r\n]+ \* limitations under the License\./gm, + pattern: / \* Copyright The OpenTelemetry Authors(, .+)*[\r\n]+ \*[\r\n]+ \* Licensed under the Apache License, Version 2\.0 \(the \"License\"\);[\r\n]+ \* you may not use this file except in compliance with the License\.[\r\n]+ \* You may obtain a copy of the License at[\r\n]+ \*[\r\n]+ \* https:\/\/www\.apache\.org\/licenses\/LICENSE-2\.0[\r\n]+ \*[\r\n]+ \* Unless required by applicable law or agreed to in writing, software[\r\n]+ \* distributed under the License is distributed on an \"AS IS\" BASIS,[\r\n]+ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.[\r\n]+ \* See the License for the specific language governing permissions and[\r\n]+ \* limitations under the License\./gm, template: `\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n ` }]] diff --git a/plugins/node/instrumentation-typeorm/NOTICE b/plugins/node/instrumentation-typeorm/NOTICE index 8765d4a3cd..e73a837010 100644 --- a/plugins/node/instrumentation-typeorm/NOTICE +++ b/plugins/node/instrumentation-typeorm/NOTICE @@ -3,3 +3,5 @@ The library contains the following changes compared to the original: * Removed `moduleVersionAttributeName` configuration option. * Changed the function signature of `responseHook`. +* Removed dependency on `is-promise` package. +* Removed usage of SemanticAttributes in favor of explicit values. diff --git a/plugins/node/instrumentation-typeorm/README.md b/plugins/node/instrumentation-typeorm/README.md new file mode 100644 index 0000000000..f4d495567c --- /dev/null +++ b/plugins/node/instrumentation-typeorm/README.md @@ -0,0 +1,89 @@ +# OpenTelemetry `typeorm` Instrumentation for Node.js + +[![NPM Published Version][npm-img]][npm-url] +[![Apache License][license-image]][license-image] + +This module provides automatic instrumentation for the [`typeorm`](https://www.npmjs.com/package/typeorm) package, which may be loaded using the [`@opentelemetry/sdk-trace-node`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package and is included in the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle. + +If total installation size is not constrained, it is recommended to use the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle with [@opentelemetry/sdk-node](`https://www.npmjs.com/package/@opentelemetry/sdk-node`) for the most seamless instrumentation experience. + +Compatible with OpenTelemetry JS API and SDK `1.0+`. + +## Installation + +```bash +npm install --save @opentelemetry/instrumentation-typeorm +``` + +### Supported versions + +- `>0.2.28` + +## Usage + +```js +const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node'); +const { TypeormInstrumentation } = require('@opentelemetry/instrumentation-typeorm'); +const { registerInstrumentations } = require('@opentelemetry/instrumentation'); + +const provider = new NodeTracerProvider(); +provider.register(); + +registerInstrumentations({ + instrumentations: [ + new TypeormInstrumentation({ + // see below for available configuration + }), + ], +}); +``` + +### Instrumentation Options + +You can set the following: + +| Options | Type | Description | +| ---------------------------- | -------------------------------------- | ------------------------------------------------------------------------------| +| `responseHook` | `TypeormResponseCustomAttributesFunction` | Hook called before response is returned, which allows to add custom attributes to span. | +| `suppressInternalInstrumentation` | boolean | Typeorm uses mongodb/postgres/mysql/mariadb/etc. under the hood. If, for example, postgres instrumentation is enabled, a postgres operation will also create a postgres span describing the communication. Setting the `suppressInternalInstrumentation` config value to `true` will cause the instrumentation to suppress instrumentation of underlying operations. | +| `enableInternalInstrumentation` | boolean | Some methods such as `getManyAndCount` can generate internally multiple spans. To instrument those set this to `true` | +| `collectParameters` | boolean | set to `true` if you want to capture the parameter values for parameterized SQL queries (**may leak sensitive information**) + +## Semantic Conventions + +This package uses `@opentelemetry/semantic-conventions` version `1.24+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md) + +Attributes collected: + + SEMATTRS_NET_PEER_NAME, + SEMATTRS_NET_PEER_PORT, + +| Attribute | Short Description | +| ----------------| --------------------------------------------------------------------------- | +| `db.name` | The name of the database being accessed. | +| `db.operation` | The name of the operation being executed (e.g. the SQL keyword). | +| `db.sql.table` | The name of the table being accessed. | +| `db.statement` | The database statement being executed. | +| `db.system` | An identifier for the database management system (DBMS) product being used. | +| `db.user` | Username for accessing the database. | +| `net.peer.name` | Remote address of the database. | +| `net.peer.port` | Peer port number of the network connection. | + + + + +## Useful links + +- For more information on OpenTelemetry, visit: +- For more about OpenTelemetry JavaScript: +- For help or feedback on this project, join us in [GitHub Discussions][discussions-url] + +## License + +Apache 2.0 - See [LICENSE][license-url] for more information. + +[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions +[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE +[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat +[npm-url]: https://www.npmjs.com/package/@opentelemetry/instrumentation-typeorm +[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-typeorm.svg diff --git a/plugins/node/instrumentation-typeorm/src/index.ts b/plugins/node/instrumentation-typeorm/src/index.ts index 853761b84e..a0cf02263c 100644 --- a/plugins/node/instrumentation-typeorm/src/index.ts +++ b/plugins/node/instrumentation-typeorm/src/index.ts @@ -1,5 +1,5 @@ /* - * Copyright The OpenTelemetry Authors + * Copyright The OpenTelemetry Authors, Aspecto * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/node/instrumentation-typeorm/src/typeorm.ts b/plugins/node/instrumentation-typeorm/src/typeorm.ts index caa79b0ed5..b92ba751d7 100644 --- a/plugins/node/instrumentation-typeorm/src/typeorm.ts +++ b/plugins/node/instrumentation-typeorm/src/typeorm.ts @@ -1,5 +1,5 @@ /* - * Copyright The OpenTelemetry Authors + * Copyright The OpenTelemetry Authors, Aspecto * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -443,11 +443,9 @@ export class TypeormInstrumentation extends InstrumentationBase { } } -// eslint-disable-next-line @typescript-eslint/no-explicit-any const buildStatement = (func: Function, args: any[]) => { const paramNames = getParamNames(func) || []; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const statement = {} as any; + const statement: Record = {}; paramNames.forEach((pName, i) => { const value = args[i]; if (!value) return; diff --git a/plugins/node/instrumentation-typeorm/src/types.ts b/plugins/node/instrumentation-typeorm/src/types.ts index cc942a514f..59dd27c578 100644 --- a/plugins/node/instrumentation-typeorm/src/types.ts +++ b/plugins/node/instrumentation-typeorm/src/types.ts @@ -1,5 +1,5 @@ /* - * Copyright The OpenTelemetry Authors + * Copyright The OpenTelemetry Authors, Aspecto * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/node/instrumentation-typeorm/src/utils/get-func-param-names.ts b/plugins/node/instrumentation-typeorm/src/utils/get-func-param-names.ts index a740444d61..61a9cfa33c 100644 --- a/plugins/node/instrumentation-typeorm/src/utils/get-func-param-names.ts +++ b/plugins/node/instrumentation-typeorm/src/utils/get-func-param-names.ts @@ -1,5 +1,5 @@ /* - * Copyright The OpenTelemetry Authors + * Copyright The OpenTelemetry Authors, Aspecto * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/node/instrumentation-typeorm/src/utils/index.ts b/plugins/node/instrumentation-typeorm/src/utils/index.ts index 5299ff9beb..1667497fa2 100644 --- a/plugins/node/instrumentation-typeorm/src/utils/index.ts +++ b/plugins/node/instrumentation-typeorm/src/utils/index.ts @@ -1,5 +1,5 @@ /* - * Copyright The OpenTelemetry Authors + * Copyright The OpenTelemetry Authors, Aspecto * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/node/instrumentation-typeorm/src/utils/suppressTracing.ts b/plugins/node/instrumentation-typeorm/src/utils/suppressTracing.ts index 588483ee74..eb871c1991 100644 --- a/plugins/node/instrumentation-typeorm/src/utils/suppressTracing.ts +++ b/plugins/node/instrumentation-typeorm/src/utils/suppressTracing.ts @@ -1,5 +1,5 @@ /* - * Copyright The OpenTelemetry Authors + * Copyright The OpenTelemetry Authors, Aspecto * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/node/instrumentation-typeorm/test/Connection.test.ts b/plugins/node/instrumentation-typeorm/test/Connection.test.ts index 918e671086..874668b93a 100644 --- a/plugins/node/instrumentation-typeorm/test/Connection.test.ts +++ b/plugins/node/instrumentation-typeorm/test/Connection.test.ts @@ -1,5 +1,5 @@ /* - * Copyright The OpenTelemetry Authors + * Copyright The OpenTelemetry Authors, Aspecto * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts b/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts index bcbbae80f5..b91a56be67 100644 --- a/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts +++ b/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts @@ -1,5 +1,5 @@ /* - * Copyright The OpenTelemetry Authors + * Copyright The OpenTelemetry Authors, Aspecto * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts b/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts index cdea8a3a48..8af093a433 100644 --- a/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts +++ b/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts @@ -1,5 +1,5 @@ /* - * Copyright The OpenTelemetry Authors + * Copyright The OpenTelemetry Authors, Aspecto * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/node/instrumentation-typeorm/test/Repository.test.ts b/plugins/node/instrumentation-typeorm/test/Repository.test.ts index 31bc955146..9c4ba180e1 100644 --- a/plugins/node/instrumentation-typeorm/test/Repository.test.ts +++ b/plugins/node/instrumentation-typeorm/test/Repository.test.ts @@ -1,5 +1,5 @@ /* - * Copyright The OpenTelemetry Authors + * Copyright The OpenTelemetry Authors, Aspecto * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/node/instrumentation-typeorm/test/config.test.ts b/plugins/node/instrumentation-typeorm/test/config.test.ts index 944c71a648..c800b61250 100644 --- a/plugins/node/instrumentation-typeorm/test/config.test.ts +++ b/plugins/node/instrumentation-typeorm/test/config.test.ts @@ -1,5 +1,5 @@ /* - * Copyright The OpenTelemetry Authors + * Copyright The OpenTelemetry Authors, Aspecto * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/node/instrumentation-typeorm/test/utils.ts b/plugins/node/instrumentation-typeorm/test/utils.ts index 6588029162..acc9c3dd82 100644 --- a/plugins/node/instrumentation-typeorm/test/utils.ts +++ b/plugins/node/instrumentation-typeorm/test/utils.ts @@ -1,5 +1,5 @@ /* - * Copyright The OpenTelemetry Authors + * Copyright The OpenTelemetry Authors, Aspecto * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From b8578ddad21753196ea23b3ad1e1ee6bef156870 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Wed, 8 May 2024 16:56:31 +0300 Subject: [PATCH 03/41] update release please manifest and component owners --- .github/component_owners.yml | 2 ++ .release-please-manifest.json | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/component_owners.yml b/.github/component_owners.yml index 210413659d..722635d04b 100644 --- a/.github/component_owners.yml +++ b/.github/component_owners.yml @@ -67,6 +67,8 @@ components: - rauno56 plugins/node/instrumentation-tedious: - rauno56 + plugins/node/instrumentation-typeorm: + - seemk plugins/node/opentelemetry-instrumentation-aws-lambda: - carolabadeer plugins/node/opentelemetry-instrumentation-aws-sdk: diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 43ec74b8a0..9965db2f5c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -25,6 +25,7 @@ "plugins/node/instrumentation-runtime-node": "0.4.0", "plugins/node/instrumentation-socket.io": "0.39.0", "plugins/node/instrumentation-tedious": "0.10.1", + "plugins/node/instrumentation-typeorm": "0.0.1", "plugins/node/instrumentation-undici": "0.2.0", "plugins/node/opentelemetry-instrumentation-aws-lambda": "0.41.0", "plugins/node/opentelemetry-instrumentation-aws-sdk": "0.41.0", From c1f4c0bde3378ef5132306723840ec6cb146f539 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Wed, 8 May 2024 17:08:37 +0300 Subject: [PATCH 04/41] lint --- plugins/node/instrumentation-typeorm/README.md | 3 --- release-please-config.json | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/node/instrumentation-typeorm/README.md b/plugins/node/instrumentation-typeorm/README.md index f4d495567c..6893380fb4 100644 --- a/plugins/node/instrumentation-typeorm/README.md +++ b/plugins/node/instrumentation-typeorm/README.md @@ -69,9 +69,6 @@ Attributes collected: | `net.peer.name` | Remote address of the database. | | `net.peer.port` | Peer port number of the network connection. | - - - ## Useful links - For more information on OpenTelemetry, visit: diff --git a/release-please-config.json b/release-please-config.json index 8142b3b582..ddc27e85f8 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -32,6 +32,7 @@ "plugins/node/instrumentation-runtime-node": {}, "plugins/node/instrumentation-socket.io": {}, "plugins/node/instrumentation-tedious": {}, + "plugins/node/instrumentation-typeorm": {}, "plugins/node/instrumentation-undici": {}, "plugins/node/opentelemetry-instrumentation-aws-lambda": {}, "plugins/node/opentelemetry-instrumentation-aws-sdk": {}, From 9c55fa1b6ca1998d16eab5ffa981f8e25119d4cf Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Wed, 8 May 2024 17:22:07 +0300 Subject: [PATCH 05/41] dont use qualified require --- plugins/node/instrumentation-typeorm/src/typeorm.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/node/instrumentation-typeorm/src/typeorm.ts b/plugins/node/instrumentation-typeorm/src/typeorm.ts index b92ba751d7..91edc2b367 100644 --- a/plugins/node/instrumentation-typeorm/src/typeorm.ts +++ b/plugins/node/instrumentation-typeorm/src/typeorm.ts @@ -49,7 +49,7 @@ import { isWrapped, safeExecuteInTheMiddle, } from '@opentelemetry/instrumentation'; -import { isPromise } from 'util/types'; +import * as util from 'util'; // eslint-disable-next-line @typescript-eslint/no-explicit-any type SelectQueryBuilderMethod = keyof typeorm.SelectQueryBuilder; @@ -411,7 +411,7 @@ export class TypeormInstrumentation extends InstrumentationBase { }; try { const response = traced(); - if (isPromise(response)) { + if (util.types.isPromise(response)) { return Promise.resolve(response) .then(response => executeResponseHook(response)) .catch(err => { From 83dafea3c41d06c72e0eb8b157f5390db74426d4 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Wed, 22 May 2024 11:51:16 +0300 Subject: [PATCH 06/41] rename collectParameters to enhancedDatabaseReporting specify max version support --- package-lock.json | 635 +----------------- .../node/instrumentation-typeorm/README.md | 5 +- .../instrumentation-typeorm/connection2.db | Bin 0 -> 8192 bytes .../node/instrumentation-typeorm/package.json | 4 +- .../instrumentation-typeorm/src/typeorm.ts | 10 +- .../node/instrumentation-typeorm/src/types.ts | 2 +- .../test/config.test.ts | 4 +- 7 files changed, 14 insertions(+), 646 deletions(-) create mode 100644 plugins/node/instrumentation-typeorm/connection2.db diff --git a/package-lock.json b/package-lock.json index 8ded139b67..d5c8776343 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37974,6 +37974,7 @@ } }, "plugins/node/instrumentation-typeorm": { + "name": "@opentelemetry/instrumentation-typeorm", "version": "0.0.1", "license": "Apache-2.0", "dependencies": { @@ -37991,7 +37992,7 @@ "rimraf": "5.0.5", "sqlite3": "^5.0.2", "ts-mocha": "10.0.0", - "typeorm": "^0.3.17", + "typeorm": "^0.3.20", "typescript": "4.4.4" }, "engines": { @@ -38001,384 +38002,6 @@ "@opentelemetry/api": "^1.3.0" } }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/api-logs": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.51.0.tgz", - "integrity": "sha512-m/jtfBPEIXS1asltl8fPQtO3Sb1qMpuL61unQajUmM8zIxeMF1AlqzWXM3QedcYgTTFiJCew5uJjyhpmqhc0+g==", - "dependencies": { - "@opentelemetry/api": "^1.0.0" - }, - "engines": { - "node": ">=14" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/context-async-hooks": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-1.24.0.tgz", - "integrity": "sha512-s7xaQ9ifDpJvwbWRLkZD/J5hY35w+MECm4TQUkg6szRcny9lf6oVhWij4w3JJFQgvHQMXU7oXOpX8Z05HxV/8g==", - "dev": true, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/contrib-test-utils": { - "version": "0.39.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/contrib-test-utils/-/contrib-test-utils-0.39.0.tgz", - "integrity": "sha512-Ob5eB/8Nayj9DmRnLn0v6y/mws7s/8TXbYyESkcu7lLoHzTvOToqKfjmTbjh/4IRxhtYKTMn894VCoOFCJyWBw==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "^1.0.0", - "@opentelemetry/exporter-jaeger": "^1.3.1", - "@opentelemetry/instrumentation": "^0.51.0", - "@opentelemetry/resources": "^1.8.0", - "@opentelemetry/sdk-node": "^0.51.0", - "@opentelemetry/sdk-trace-base": "^1.8.0", - "@opentelemetry/sdk-trace-node": "^1.8.0", - "@opentelemetry/semantic-conventions": "^1.22.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/core": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.24.0.tgz", - "integrity": "sha512-FP2oN7mVPqcdxJDTTnKExj4mi91EH+DNuArKfHTjPuJWe2K1JfMIVXNfahw1h3onJxQnxS8K0stKkogX05s+Aw==", - "dev": true, - "dependencies": { - "@opentelemetry/semantic-conventions": "1.24.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-trace-otlp-grpc": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-grpc/-/exporter-trace-otlp-grpc-0.51.0.tgz", - "integrity": "sha512-xQpxKzS8ZnxYCa1v+3EKWhwMrSK3+RezpJ+AEKaP2pf2QbLfHt7kKfSn7niR2u3A1Tbe2aC7Ptt9+MafhThOOQ==", - "dev": true, - "dependencies": { - "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.24.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.51.0", - "@opentelemetry/otlp-transformer": "0.51.0", - "@opentelemetry/resources": "1.24.0", - "@opentelemetry/sdk-trace-base": "1.24.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-trace-otlp-http": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-http/-/exporter-trace-otlp-http-0.51.0.tgz", - "integrity": "sha512-zODqnLZmPOxj9CarFv0TrVlx9mgj0TfCMCiUiTdNi9iA2rgdKVo+bjJjpYF6LCTJOQCR5TScAUCKyzwkgDI+iA==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.0", - "@opentelemetry/otlp-exporter-base": "0.51.0", - "@opentelemetry/otlp-transformer": "0.51.0", - "@opentelemetry/resources": "1.24.0", - "@opentelemetry/sdk-trace-base": "1.24.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-trace-otlp-proto": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-proto/-/exporter-trace-otlp-proto-0.51.0.tgz", - "integrity": "sha512-Fi7r0iMqGoFCQQ+WY0pYOWp395vdinZJIkYKnNbnreHxAN/kVDBl2FxbV3DeOKuRxEY08Gyb9ggPf+Zrqp7l/w==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.0", - "@opentelemetry/otlp-exporter-base": "0.51.0", - "@opentelemetry/otlp-proto-exporter-base": "0.51.0", - "@opentelemetry/otlp-transformer": "0.51.0", - "@opentelemetry/resources": "1.24.0", - "@opentelemetry/sdk-trace-base": "1.24.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-zipkin": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-zipkin/-/exporter-zipkin-1.24.0.tgz", - "integrity": "sha512-QeGv0PHONswmu567pf9QliJ6s6DgCu5+ziF+soNS1LTcr1VRRVLViYLmGxmzDFUC48sjNTu7sumcKT0nJXsGBw==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.0", - "@opentelemetry/resources": "1.24.0", - "@opentelemetry/sdk-trace-base": "1.24.0", - "@opentelemetry/semantic-conventions": "1.24.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/instrumentation": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.51.0.tgz", - "integrity": "sha512-Eg/+Od5bEvzpvZQGhvMyKIkrzB9S7jW+6z9LHEI2VXhl/GrqQ3oBqlzJt4tA6pGtxRmqQWKWGM1wAbwDdW/gUA==", - "dependencies": { - "@opentelemetry/api-logs": "0.51.0", - "@types/shimmer": "^1.0.2", - "import-in-the-middle": "1.7.1", - "require-in-the-middle": "^7.1.1", - "semver": "^7.5.2", - "shimmer": "^1.2.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/otlp-exporter-base": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-exporter-base/-/otlp-exporter-base-0.51.0.tgz", - "integrity": "sha512-hR4c9vWVz1QgzCBSyy9zSDkvfTgaK96E6/tfVP6O4dzdZW9HqWimA3lXV/KXadEGqShvM4GToz9EHp2A5RU5bQ==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/otlp-grpc-exporter-base": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-grpc-exporter-base/-/otlp-grpc-exporter-base-0.51.0.tgz", - "integrity": "sha512-oTRtDvvB0bTRTBVrvKA/oM1gIAqQ6DVQS07pvqiL1cZS8wBrGgpw+2iTd0nV661Y/MhDn/kNWp8lRhMEIKN9bw==", - "dev": true, - "dependencies": { - "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.24.0", - "@opentelemetry/otlp-exporter-base": "0.51.0", - "protobufjs": "^7.2.3" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/otlp-proto-exporter-base": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-proto-exporter-base/-/otlp-proto-exporter-base-0.51.0.tgz", - "integrity": "sha512-WDANDLSUh11Gu5o6iCzmjZraIv5bK8z1L/t6lxQ2NeEKiKUPo5pVOBBQQC/yAQU2yeqkiO1GRCieH+XahZf60A==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.0", - "@opentelemetry/otlp-exporter-base": "0.51.0", - "protobufjs": "^7.2.3" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/otlp-transformer": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-transformer/-/otlp-transformer-0.51.0.tgz", - "integrity": "sha512-ylLgx2xumVoSefDHP9GMAU/LG+TU3+8eacVDXV5o1RqWxsdVOaQmCTY0XyDgeRTn6hIOVAq/HHQbRq3iWOrt2A==", - "dev": true, - "dependencies": { - "@opentelemetry/api-logs": "0.51.0", - "@opentelemetry/core": "1.24.0", - "@opentelemetry/resources": "1.24.0", - "@opentelemetry/sdk-logs": "0.51.0", - "@opentelemetry/sdk-metrics": "1.24.0", - "@opentelemetry/sdk-trace-base": "1.24.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.3.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/propagator-b3": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-b3/-/propagator-b3-1.24.0.tgz", - "integrity": "sha512-7TMIDE4+NO5vnkor+zned42wqca+hmhW5gWKhmYjUHC5B5uojo1PvtmBrd7kigFu96XvL4ZUWVzibWRWIQ/++Q==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/propagator-jaeger": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-jaeger/-/propagator-jaeger-1.24.0.tgz", - "integrity": "sha512-r3MX3AmJiUeiWTXSDOdwBeaO+ahvWcFCpuKxmhhsH8Q8LqDnjhNd3krqBh4Qsq9wa0WhWtiQaDs/NOCWoMOlOw==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/resources": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.24.0.tgz", - "integrity": "sha512-mxC7E7ocUS1tLzepnA7O9/G8G6ZTdjCH2pXme1DDDuCuk6n2/53GADX+GWBuyX0dfIxeMInIbJAdjlfN9GNr6A==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.0", - "@opentelemetry/semantic-conventions": "1.24.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/sdk-logs": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.51.0.tgz", - "integrity": "sha512-K4fMBRFD8hQ6khk0rvYFuo6L9ymeGgByir6BcuFIgQuQ00OhYwBi9AruZz5V733Ejq7P8ObR3YyubkOUIbeVAw==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.0", - "@opentelemetry/resources": "1.24.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.4.0 <1.9.0", - "@opentelemetry/api-logs": ">=0.39.1" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/sdk-metrics": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.24.0.tgz", - "integrity": "sha512-4tJ+E6N019OZVB/nUW/LoK9xHxfeh88TCoaTqHeLBE9wLYfi6irWW6J9cphMav7J8Qk0D5b7/RM4VEY4dArWOA==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.0", - "@opentelemetry/resources": "1.24.0", - "lodash.merge": "^4.6.2" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.3.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/sdk-node": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-node/-/sdk-node-0.51.0.tgz", - "integrity": "sha512-MrPXDQsTAj3lcY8YUCjb7dvSXVZ5jG6wmjD2LB68V1rsLBdP8j70jsI9GaKijY7QB6psbLq6apO1vYeim5U7aw==", - "dev": true, - "dependencies": { - "@opentelemetry/api-logs": "0.51.0", - "@opentelemetry/core": "1.24.0", - "@opentelemetry/exporter-trace-otlp-grpc": "0.51.0", - "@opentelemetry/exporter-trace-otlp-http": "0.51.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.51.0", - "@opentelemetry/exporter-zipkin": "1.24.0", - "@opentelemetry/instrumentation": "0.51.0", - "@opentelemetry/resources": "1.24.0", - "@opentelemetry/sdk-logs": "0.51.0", - "@opentelemetry/sdk-metrics": "1.24.0", - "@opentelemetry/sdk-trace-base": "1.24.0", - "@opentelemetry/sdk-trace-node": "1.24.0", - "@opentelemetry/semantic-conventions": "1.24.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.3.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/sdk-trace-base": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.24.0.tgz", - "integrity": "sha512-H9sLETZ4jw9UJ3totV8oM5R0m4CW0ZIOLfp4NV3g0CM8HD5zGZcaW88xqzWDgiYRpctFxd+WmHtGX/Upoa2vRg==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.0", - "@opentelemetry/resources": "1.24.0", - "@opentelemetry/semantic-conventions": "1.24.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/sdk-trace-node": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-node/-/sdk-trace-node-1.24.0.tgz", - "integrity": "sha512-QgByHmM9uloTpcYEEyW9YJEIMKHFSIM677RH9pJPWWwtM2NQFbEp/8HIJw80Ymtaz6cAxg1Kay1ByqIVzq3t5g==", - "dev": true, - "dependencies": { - "@opentelemetry/context-async-hooks": "1.24.0", - "@opentelemetry/core": "1.24.0", - "@opentelemetry/propagator-b3": "1.24.0", - "@opentelemetry/propagator-jaeger": "1.24.0", - "@opentelemetry/sdk-trace-base": "1.24.0", - "semver": "^7.5.2" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/semantic-conventions": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.24.0.tgz", - "integrity": "sha512-yL0jI6Ltuz8R+Opj7jClGrul6pOoYrdfVmzQS4SITXRPH7I5IRZbrwe/6/v8v4WYMa6MYZG480S1+uc/IGfqsA==", - "engines": { - "node": ">=14" - } - }, "plugins/node/instrumentation-typeorm/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -49251,262 +48874,10 @@ "rimraf": "5.0.5", "sqlite3": "^5.0.2", "ts-mocha": "10.0.0", - "typeorm": "^0.3.17", + "typeorm": "^0.3.20", "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/api-logs": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.51.0.tgz", - "integrity": "sha512-m/jtfBPEIXS1asltl8fPQtO3Sb1qMpuL61unQajUmM8zIxeMF1AlqzWXM3QedcYgTTFiJCew5uJjyhpmqhc0+g==", - "requires": { - "@opentelemetry/api": "^1.0.0" - } - }, - "@opentelemetry/context-async-hooks": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-1.24.0.tgz", - "integrity": "sha512-s7xaQ9ifDpJvwbWRLkZD/J5hY35w+MECm4TQUkg6szRcny9lf6oVhWij4w3JJFQgvHQMXU7oXOpX8Z05HxV/8g==", - "dev": true, - "requires": {} - }, - "@opentelemetry/contrib-test-utils": { - "version": "0.39.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/contrib-test-utils/-/contrib-test-utils-0.39.0.tgz", - "integrity": "sha512-Ob5eB/8Nayj9DmRnLn0v6y/mws7s/8TXbYyESkcu7lLoHzTvOToqKfjmTbjh/4IRxhtYKTMn894VCoOFCJyWBw==", - "dev": true, - "requires": { - "@opentelemetry/core": "^1.0.0", - "@opentelemetry/exporter-jaeger": "^1.3.1", - "@opentelemetry/instrumentation": "^0.51.0", - "@opentelemetry/resources": "^1.8.0", - "@opentelemetry/sdk-node": "^0.51.0", - "@opentelemetry/sdk-trace-base": "^1.8.0", - "@opentelemetry/sdk-trace-node": "^1.8.0", - "@opentelemetry/semantic-conventions": "^1.22.0" - } - }, - "@opentelemetry/core": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.24.0.tgz", - "integrity": "sha512-FP2oN7mVPqcdxJDTTnKExj4mi91EH+DNuArKfHTjPuJWe2K1JfMIVXNfahw1h3onJxQnxS8K0stKkogX05s+Aw==", - "dev": true, - "requires": { - "@opentelemetry/semantic-conventions": "1.24.0" - } - }, - "@opentelemetry/exporter-trace-otlp-grpc": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-grpc/-/exporter-trace-otlp-grpc-0.51.0.tgz", - "integrity": "sha512-xQpxKzS8ZnxYCa1v+3EKWhwMrSK3+RezpJ+AEKaP2pf2QbLfHt7kKfSn7niR2u3A1Tbe2aC7Ptt9+MafhThOOQ==", - "dev": true, - "requires": { - "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.24.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.51.0", - "@opentelemetry/otlp-transformer": "0.51.0", - "@opentelemetry/resources": "1.24.0", - "@opentelemetry/sdk-trace-base": "1.24.0" - } - }, - "@opentelemetry/exporter-trace-otlp-http": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-http/-/exporter-trace-otlp-http-0.51.0.tgz", - "integrity": "sha512-zODqnLZmPOxj9CarFv0TrVlx9mgj0TfCMCiUiTdNi9iA2rgdKVo+bjJjpYF6LCTJOQCR5TScAUCKyzwkgDI+iA==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.0", - "@opentelemetry/otlp-exporter-base": "0.51.0", - "@opentelemetry/otlp-transformer": "0.51.0", - "@opentelemetry/resources": "1.24.0", - "@opentelemetry/sdk-trace-base": "1.24.0" - } - }, - "@opentelemetry/exporter-trace-otlp-proto": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-proto/-/exporter-trace-otlp-proto-0.51.0.tgz", - "integrity": "sha512-Fi7r0iMqGoFCQQ+WY0pYOWp395vdinZJIkYKnNbnreHxAN/kVDBl2FxbV3DeOKuRxEY08Gyb9ggPf+Zrqp7l/w==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.0", - "@opentelemetry/otlp-exporter-base": "0.51.0", - "@opentelemetry/otlp-proto-exporter-base": "0.51.0", - "@opentelemetry/otlp-transformer": "0.51.0", - "@opentelemetry/resources": "1.24.0", - "@opentelemetry/sdk-trace-base": "1.24.0" - } - }, - "@opentelemetry/exporter-zipkin": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-zipkin/-/exporter-zipkin-1.24.0.tgz", - "integrity": "sha512-QeGv0PHONswmu567pf9QliJ6s6DgCu5+ziF+soNS1LTcr1VRRVLViYLmGxmzDFUC48sjNTu7sumcKT0nJXsGBw==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.0", - "@opentelemetry/resources": "1.24.0", - "@opentelemetry/sdk-trace-base": "1.24.0", - "@opentelemetry/semantic-conventions": "1.24.0" - } - }, - "@opentelemetry/instrumentation": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.51.0.tgz", - "integrity": "sha512-Eg/+Od5bEvzpvZQGhvMyKIkrzB9S7jW+6z9LHEI2VXhl/GrqQ3oBqlzJt4tA6pGtxRmqQWKWGM1wAbwDdW/gUA==", - "requires": { - "@opentelemetry/api-logs": "0.51.0", - "@types/shimmer": "^1.0.2", - "import-in-the-middle": "1.7.1", - "require-in-the-middle": "^7.1.1", - "semver": "^7.5.2", - "shimmer": "^1.2.1" - } - }, - "@opentelemetry/otlp-exporter-base": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-exporter-base/-/otlp-exporter-base-0.51.0.tgz", - "integrity": "sha512-hR4c9vWVz1QgzCBSyy9zSDkvfTgaK96E6/tfVP6O4dzdZW9HqWimA3lXV/KXadEGqShvM4GToz9EHp2A5RU5bQ==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.0" - } - }, - "@opentelemetry/otlp-grpc-exporter-base": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-grpc-exporter-base/-/otlp-grpc-exporter-base-0.51.0.tgz", - "integrity": "sha512-oTRtDvvB0bTRTBVrvKA/oM1gIAqQ6DVQS07pvqiL1cZS8wBrGgpw+2iTd0nV661Y/MhDn/kNWp8lRhMEIKN9bw==", - "dev": true, - "requires": { - "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.24.0", - "@opentelemetry/otlp-exporter-base": "0.51.0", - "protobufjs": "^7.2.3" - } - }, - "@opentelemetry/otlp-proto-exporter-base": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-proto-exporter-base/-/otlp-proto-exporter-base-0.51.0.tgz", - "integrity": "sha512-WDANDLSUh11Gu5o6iCzmjZraIv5bK8z1L/t6lxQ2NeEKiKUPo5pVOBBQQC/yAQU2yeqkiO1GRCieH+XahZf60A==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.0", - "@opentelemetry/otlp-exporter-base": "0.51.0", - "protobufjs": "^7.2.3" - } - }, - "@opentelemetry/otlp-transformer": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-transformer/-/otlp-transformer-0.51.0.tgz", - "integrity": "sha512-ylLgx2xumVoSefDHP9GMAU/LG+TU3+8eacVDXV5o1RqWxsdVOaQmCTY0XyDgeRTn6hIOVAq/HHQbRq3iWOrt2A==", - "dev": true, - "requires": { - "@opentelemetry/api-logs": "0.51.0", - "@opentelemetry/core": "1.24.0", - "@opentelemetry/resources": "1.24.0", - "@opentelemetry/sdk-logs": "0.51.0", - "@opentelemetry/sdk-metrics": "1.24.0", - "@opentelemetry/sdk-trace-base": "1.24.0" - } - }, - "@opentelemetry/propagator-b3": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-b3/-/propagator-b3-1.24.0.tgz", - "integrity": "sha512-7TMIDE4+NO5vnkor+zned42wqca+hmhW5gWKhmYjUHC5B5uojo1PvtmBrd7kigFu96XvL4ZUWVzibWRWIQ/++Q==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.0" - } - }, - "@opentelemetry/propagator-jaeger": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-jaeger/-/propagator-jaeger-1.24.0.tgz", - "integrity": "sha512-r3MX3AmJiUeiWTXSDOdwBeaO+ahvWcFCpuKxmhhsH8Q8LqDnjhNd3krqBh4Qsq9wa0WhWtiQaDs/NOCWoMOlOw==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.0" - } - }, - "@opentelemetry/resources": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.24.0.tgz", - "integrity": "sha512-mxC7E7ocUS1tLzepnA7O9/G8G6ZTdjCH2pXme1DDDuCuk6n2/53GADX+GWBuyX0dfIxeMInIbJAdjlfN9GNr6A==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.0", - "@opentelemetry/semantic-conventions": "1.24.0" - } - }, - "@opentelemetry/sdk-logs": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.51.0.tgz", - "integrity": "sha512-K4fMBRFD8hQ6khk0rvYFuo6L9ymeGgByir6BcuFIgQuQ00OhYwBi9AruZz5V733Ejq7P8ObR3YyubkOUIbeVAw==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.0", - "@opentelemetry/resources": "1.24.0" - } - }, - "@opentelemetry/sdk-metrics": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.24.0.tgz", - "integrity": "sha512-4tJ+E6N019OZVB/nUW/LoK9xHxfeh88TCoaTqHeLBE9wLYfi6irWW6J9cphMav7J8Qk0D5b7/RM4VEY4dArWOA==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.0", - "@opentelemetry/resources": "1.24.0", - "lodash.merge": "^4.6.2" - } - }, - "@opentelemetry/sdk-node": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-node/-/sdk-node-0.51.0.tgz", - "integrity": "sha512-MrPXDQsTAj3lcY8YUCjb7dvSXVZ5jG6wmjD2LB68V1rsLBdP8j70jsI9GaKijY7QB6psbLq6apO1vYeim5U7aw==", - "dev": true, - "requires": { - "@opentelemetry/api-logs": "0.51.0", - "@opentelemetry/core": "1.24.0", - "@opentelemetry/exporter-trace-otlp-grpc": "0.51.0", - "@opentelemetry/exporter-trace-otlp-http": "0.51.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.51.0", - "@opentelemetry/exporter-zipkin": "1.24.0", - "@opentelemetry/instrumentation": "0.51.0", - "@opentelemetry/resources": "1.24.0", - "@opentelemetry/sdk-logs": "0.51.0", - "@opentelemetry/sdk-metrics": "1.24.0", - "@opentelemetry/sdk-trace-base": "1.24.0", - "@opentelemetry/sdk-trace-node": "1.24.0", - "@opentelemetry/semantic-conventions": "1.24.0" - } - }, - "@opentelemetry/sdk-trace-base": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.24.0.tgz", - "integrity": "sha512-H9sLETZ4jw9UJ3totV8oM5R0m4CW0ZIOLfp4NV3g0CM8HD5zGZcaW88xqzWDgiYRpctFxd+WmHtGX/Upoa2vRg==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.0", - "@opentelemetry/resources": "1.24.0", - "@opentelemetry/semantic-conventions": "1.24.0" - } - }, - "@opentelemetry/sdk-trace-node": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-node/-/sdk-trace-node-1.24.0.tgz", - "integrity": "sha512-QgByHmM9uloTpcYEEyW9YJEIMKHFSIM677RH9pJPWWwtM2NQFbEp/8HIJw80Ymtaz6cAxg1Kay1ByqIVzq3t5g==", - "dev": true, - "requires": { - "@opentelemetry/context-async-hooks": "1.24.0", - "@opentelemetry/core": "1.24.0", - "@opentelemetry/propagator-b3": "1.24.0", - "@opentelemetry/propagator-jaeger": "1.24.0", - "@opentelemetry/sdk-trace-base": "1.24.0", - "semver": "^7.5.2" - } - }, - "@opentelemetry/semantic-conventions": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.24.0.tgz", - "integrity": "sha512-yL0jI6Ltuz8R+Opj7jClGrul6pOoYrdfVmzQS4SITXRPH7I5IRZbrwe/6/v8v4WYMa6MYZG480S1+uc/IGfqsA==" - }, "ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", diff --git a/plugins/node/instrumentation-typeorm/README.md b/plugins/node/instrumentation-typeorm/README.md index 6893380fb4..bd03aa499b 100644 --- a/plugins/node/instrumentation-typeorm/README.md +++ b/plugins/node/instrumentation-typeorm/README.md @@ -47,7 +47,7 @@ You can set the following: | `responseHook` | `TypeormResponseCustomAttributesFunction` | Hook called before response is returned, which allows to add custom attributes to span. | | `suppressInternalInstrumentation` | boolean | Typeorm uses mongodb/postgres/mysql/mariadb/etc. under the hood. If, for example, postgres instrumentation is enabled, a postgres operation will also create a postgres span describing the communication. Setting the `suppressInternalInstrumentation` config value to `true` will cause the instrumentation to suppress instrumentation of underlying operations. | | `enableInternalInstrumentation` | boolean | Some methods such as `getManyAndCount` can generate internally multiple spans. To instrument those set this to `true` | -| `collectParameters` | boolean | set to `true` if you want to capture the parameter values for parameterized SQL queries (**may leak sensitive information**) +| `enhancedDatabaseReporting` | boolean | set to `true` if you want to capture the parameter values for parameterized SQL queries (**may leak sensitive information**) ## Semantic Conventions @@ -55,9 +55,6 @@ This package uses `@opentelemetry/semantic-conventions` version `1.24+`, which i Attributes collected: - SEMATTRS_NET_PEER_NAME, - SEMATTRS_NET_PEER_PORT, - | Attribute | Short Description | | ----------------| --------------------------------------------------------------------------- | | `db.name` | The name of the database being accessed. | diff --git a/plugins/node/instrumentation-typeorm/connection2.db b/plugins/node/instrumentation-typeorm/connection2.db new file mode 100644 index 0000000000000000000000000000000000000000..a3206c893fb1633f465560aa14ddec67f5552dae GIT binary patch literal 8192 zcmeI#zY4-I5C-r>1Sio&T#rl&;^GTfrGr?j);e^Inrgv6n8xmXT;IZED7c8bejho) z+4lxZ`XedXT$W_w7+<(VD=yofB*y_ z009U<00Izz00bZafj<%`8@$o&ba;6;a(7mbTxnOeY2ayeL71)ccdv@6)sVH0-0.2.28'], + ['>=0.2.29 <1'], moduleExports => { selectQueryBuilderExecuteMethods.map(method => { if (isWrapped(moduleExports.SelectQueryBuilder.prototype?.[method])) { @@ -150,7 +150,7 @@ export class TypeormInstrumentation extends InstrumentationBase { const dataSource = new InstrumentationNodeModuleFile( 'typeorm/data-source/DataSource.js', - ['>=0.3.0'], + ['>=0.3.0 <1'], moduleExports => { if (isWrapped(moduleExports.DataSource.prototype?.[rawQueryFuncName])) { this._unwrap(moduleExports.DataSource.prototype, rawQueryFuncName); @@ -173,7 +173,7 @@ export class TypeormInstrumentation extends InstrumentationBase { const entityManager = new InstrumentationNodeModuleFile( 'typeorm/entity-manager/EntityManager.js', - ['>0.2.28'], + ['>=0.2.29 <1'], moduleExports => { entityManagerMethods.map(method => { if (isWrapped(moduleExports.EntityManager.prototype?.[method])) { @@ -200,7 +200,7 @@ export class TypeormInstrumentation extends InstrumentationBase { const module = new InstrumentationNodeModuleDefinition( 'typeorm', - ['>0.2.28'], + ['>=0.2.29 <1'], undefined, undefined, [selectQueryBuilder, entityManager, connection, dataSource] @@ -300,7 +300,7 @@ export class TypeormInstrumentation extends InstrumentationBase { [SEMATTRS_DB_STATEMENT]: sql, [SEMATTRS_DB_SQL_TABLE]: mainTableName, }; - if (self._config.collectParameters) { + if (self._config.enhancedDatabaseReporting) { try { attributes[ExtendedDatabaseAttribute.DB_STATEMENT_PARAMETERS] = JSON.stringify(parameters); diff --git a/plugins/node/instrumentation-typeorm/src/types.ts b/plugins/node/instrumentation-typeorm/src/types.ts index 59dd27c578..b4fbdc328e 100644 --- a/plugins/node/instrumentation-typeorm/src/types.ts +++ b/plugins/node/instrumentation-typeorm/src/types.ts @@ -45,5 +45,5 @@ export interface TypeormInstrumentationConfig extends InstrumentationConfig { */ enableInternalInstrumentation?: boolean; /** set to `true` if you want to capture the parameter values for parameterized SQL queries (**may leak sensitive information**) */ - collectParameters?: boolean; + enhancedDatabaseReporting?: boolean; } diff --git a/plugins/node/instrumentation-typeorm/test/config.test.ts b/plugins/node/instrumentation-typeorm/test/config.test.ts index c800b61250..22c13d764a 100644 --- a/plugins/node/instrumentation-typeorm/test/config.test.ts +++ b/plugins/node/instrumentation-typeorm/test/config.test.ts @@ -114,9 +114,9 @@ describe('TypeormInstrumentationConfig', () => { await connection.close(); }); - it('collectParameters:true', async () => { + it('enhancedDatabaseReporting:true', async () => { const config: TypeormInstrumentationConfig = { - collectParameters: true, + enhancedDatabaseReporting: true, }; instrumentation.setConfig(config); const connectionOptions = defaultOptions as any; From 75890b2e16b774b92c9d286aee92aca7b2cbf69f Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 4 Jun 2024 17:52:40 +0300 Subject: [PATCH 07/41] update versions --- plugins/node/instrumentation-typeorm/README.md | 2 +- plugins/node/instrumentation-typeorm/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/node/instrumentation-typeorm/README.md b/plugins/node/instrumentation-typeorm/README.md index bd03aa499b..c55a8f4126 100644 --- a/plugins/node/instrumentation-typeorm/README.md +++ b/plugins/node/instrumentation-typeorm/README.md @@ -17,7 +17,7 @@ npm install --save @opentelemetry/instrumentation-typeorm ### Supported versions -- `>0.2.28` +- `>=0.2.29 <1` ## Usage diff --git a/plugins/node/instrumentation-typeorm/package.json b/plugins/node/instrumentation-typeorm/package.json index 7c438009a2..a1d1db036e 100644 --- a/plugins/node/instrumentation-typeorm/package.json +++ b/plugins/node/instrumentation-typeorm/package.json @@ -1,7 +1,7 @@ { "name": "@opentelemetry/instrumentation-typeorm", "version": "0.0.1", - "description": "OpenTelemetry instrumentation for `typeorm` database data-wrapper ORM", + "description": "OpenTelemetry instrumentation for `typeorm` database data-mapper ORM", "main": "build/src/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", From 235636a405f08d2a1b75d715d23ac93b38857c99 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 4 Jun 2024 18:11:46 +0300 Subject: [PATCH 08/41] rename db.statement.parameters to db.typeorm.parameters --- plugins/node/instrumentation-typeorm/src/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/node/instrumentation-typeorm/src/types.ts b/plugins/node/instrumentation-typeorm/src/types.ts index b4fbdc328e..88eb5e8c3d 100644 --- a/plugins/node/instrumentation-typeorm/src/types.ts +++ b/plugins/node/instrumentation-typeorm/src/types.ts @@ -17,7 +17,7 @@ import type { Span } from '@opentelemetry/api'; import { InstrumentationConfig } from '@opentelemetry/instrumentation'; export enum ExtendedDatabaseAttribute { - DB_STATEMENT_PARAMETERS = 'db.statement.parameters', + DB_STATEMENT_PARAMETERS = 'db.typeorm.parameters', } export interface HookInfo { From ac619c1f3870dff290e13e6dcb27d101ffff57e4 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 4 Jun 2024 19:17:35 +0300 Subject: [PATCH 09/41] fix readme formatting --- plugins/node/instrumentation-typeorm/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/node/instrumentation-typeorm/README.md b/plugins/node/instrumentation-typeorm/README.md index c55a8f4126..dbe6317aa5 100644 --- a/plugins/node/instrumentation-typeorm/README.md +++ b/plugins/node/instrumentation-typeorm/README.md @@ -47,7 +47,7 @@ You can set the following: | `responseHook` | `TypeormResponseCustomAttributesFunction` | Hook called before response is returned, which allows to add custom attributes to span. | | `suppressInternalInstrumentation` | boolean | Typeorm uses mongodb/postgres/mysql/mariadb/etc. under the hood. If, for example, postgres instrumentation is enabled, a postgres operation will also create a postgres span describing the communication. Setting the `suppressInternalInstrumentation` config value to `true` will cause the instrumentation to suppress instrumentation of underlying operations. | | `enableInternalInstrumentation` | boolean | Some methods such as `getManyAndCount` can generate internally multiple spans. To instrument those set this to `true` | -| `enhancedDatabaseReporting` | boolean | set to `true` if you want to capture the parameter values for parameterized SQL queries (**may leak sensitive information**) +| `enhancedDatabaseReporting` | boolean | set to `true` if you want to capture the parameter values for parameterized SQL queries (**may leak sensitive information**) | ## Semantic Conventions From cdaea83479e89a96783db031b95927de33b8158b Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 4 Jun 2024 19:40:08 +0300 Subject: [PATCH 10/41] don't parse operation from raw queries --- .../node/instrumentation-typeorm/src/typeorm.ts | 16 +--------------- .../test/Connection.test.ts | 2 +- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/plugins/node/instrumentation-typeorm/src/typeorm.ts b/plugins/node/instrumentation-typeorm/src/typeorm.ts index 1e20b00d8c..ca35c84533 100644 --- a/plugins/node/instrumentation-typeorm/src/typeorm.ts +++ b/plugins/node/instrumentation-typeorm/src/typeorm.ts @@ -334,20 +334,6 @@ export class TypeormInstrumentation extends InstrumentationBase { }; } - private getOperationName(statement: string) { - let operation = 'raw query'; - if (typeof statement === 'string') { - statement = statement.trim(); - try { - operation = statement.split(' ')[0].toUpperCase(); - } catch (e) { - /* */ - } - } - - return operation; - } - private _patchRawQuery() { const self = this; return (original: Function) => { @@ -358,7 +344,7 @@ export class TypeormInstrumentation extends InstrumentationBase { } // eslint-disable-next-line @typescript-eslint/no-explicit-any const sql = args[0] as any; - const operation = self.getOperationName(sql); + const operation = 'raw query'; // eslint-disable-next-line @typescript-eslint/no-explicit-any const connectionOptions: any = this.options; const attributes = { diff --git a/plugins/node/instrumentation-typeorm/test/Connection.test.ts b/plugins/node/instrumentation-typeorm/test/Connection.test.ts index 874668b93a..8dda4eefca 100644 --- a/plugins/node/instrumentation-typeorm/test/Connection.test.ts +++ b/plugins/node/instrumentation-typeorm/test/Connection.test.ts @@ -58,7 +58,7 @@ describe('Connection', () => { const attributes = typeOrmSpans[0].attributes; assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], options.type); assert.strictEqual(attributes[SEMATTRS_DB_NAME], options.database); - assert.strictEqual(attributes[SEMATTRS_DB_OPERATION], 'SELECT'); + assert.strictEqual(attributes[SEMATTRS_DB_OPERATION], 'raw query'); assert.strictEqual(attributes[SEMATTRS_DB_STATEMENT], query); await connection.close(); }); From b8f5099c9bb95e6462d7120b7f8a37b10a408386 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 4 Jun 2024 19:47:03 +0300 Subject: [PATCH 11/41] update NOTICE --- plugins/node/instrumentation-typeorm/NOTICE | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/node/instrumentation-typeorm/NOTICE b/plugins/node/instrumentation-typeorm/NOTICE index e73a837010..db9123c282 100644 --- a/plugins/node/instrumentation-typeorm/NOTICE +++ b/plugins/node/instrumentation-typeorm/NOTICE @@ -5,3 +5,5 @@ The library contains the following changes compared to the original: * Changed the function signature of `responseHook`. * Removed dependency on `is-promise` package. * Removed usage of SemanticAttributes in favor of explicit values. +* Removed parsing of db operation from raw queries. +* Changed db.database.parameters to db.typeorm.parameters. From ae6622ef8dbd9ed058314c4c3f55a48487c07b2a Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 4 Jun 2024 21:05:05 +0300 Subject: [PATCH 12/41] add tav --- plugins/node/instrumentation-typeorm/.tav.yml | 4 ++++ plugins/node/instrumentation-typeorm/package.json | 1 + 2 files changed, 5 insertions(+) create mode 100644 plugins/node/instrumentation-typeorm/.tav.yml diff --git a/plugins/node/instrumentation-typeorm/.tav.yml b/plugins/node/instrumentation-typeorm/.tav.yml new file mode 100644 index 0000000000..4dbd43c36e --- /dev/null +++ b/plugins/node/instrumentation-typeorm/.tav.yml @@ -0,0 +1,4 @@ +'typeorm': + versions: ">0.2.28" + commands: + - npm run test diff --git a/plugins/node/instrumentation-typeorm/package.json b/plugins/node/instrumentation-typeorm/package.json index a1d1db036e..e18f841f21 100644 --- a/plugins/node/instrumentation-typeorm/package.json +++ b/plugins/node/instrumentation-typeorm/package.json @@ -7,6 +7,7 @@ "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "test": "ts-mocha --require @opentelemetry/contrib-test-utils -p tsconfig.json 'test/**/*.test.ts'", + "test-all-versions": "tav", "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", "lint": "eslint . --ext .ts", From 8c2c6bbe2e7dbccbc06a6054820a3d3300d57258 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Wed, 5 Jun 2024 16:23:05 +0300 Subject: [PATCH 13/41] use PACKAGE_VERSION --- package-lock.json | 1 + plugins/node/instrumentation-typeorm/src/typeorm.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index ada7785f11..e24962ed12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38224,6 +38224,7 @@ } }, "plugins/node/instrumentation-typeorm": { + "name": "@opentelemetry/instrumentation-typeorm", "version": "0.0.1", "license": "Apache-2.0", "dependencies": { diff --git a/plugins/node/instrumentation-typeorm/src/typeorm.ts b/plugins/node/instrumentation-typeorm/src/typeorm.ts index ca35c84533..f98cdcd072 100644 --- a/plugins/node/instrumentation-typeorm/src/typeorm.ts +++ b/plugins/node/instrumentation-typeorm/src/typeorm.ts @@ -40,7 +40,7 @@ import { isTypeormInternalTracingSuppressed, suppressTypeormInternalTracing, } from './utils'; -import { VERSION } from './version'; +import { PACKAGE_NAME, PACKAGE_VERSION } from './version'; import type * as typeorm from 'typeorm'; import { InstrumentationBase, @@ -94,7 +94,7 @@ const entityManagerMethods: EntityManagerMethods[] = [ export class TypeormInstrumentation extends InstrumentationBase { protected override _config!: TypeormInstrumentationConfig; constructor(config: TypeormInstrumentationConfig = {}) { - super('@opentelemetry/instrumentation-typeorm', VERSION, config); + super(PACKAGE_NAME, PACKAGE_VERSION, config); } protected init() { From 6cbc833a07432ea558ed21375b1dc05031fda42c Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Thu, 20 Jun 2024 15:54:37 +0300 Subject: [PATCH 14/41] remove binary file --- .../node/instrumentation-typeorm/connection2.db | Bin 8192 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 plugins/node/instrumentation-typeorm/connection2.db diff --git a/plugins/node/instrumentation-typeorm/connection2.db b/plugins/node/instrumentation-typeorm/connection2.db deleted file mode 100644 index a3206c893fb1633f465560aa14ddec67f5552dae..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8192 zcmeI#zY4-I5C-r>1Sio&T#rl&;^GTfrGr?j);e^Inrgv6n8xmXT;IZED7c8bejho) z+4lxZ`XedXT$W_w7+<(VD=yofB*y_ z009U<00Izz00bZafj<%`8@$o&ba;6;a(7mbTxnOeY2ayeL71)ccdv@6)sVH0- Date: Thu, 22 Aug 2024 11:49:06 +0300 Subject: [PATCH 15/41] update pkg lock --- package-lock.json | 87 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/package-lock.json b/package-lock.json index 8d42491789..8d1d80b6bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38446,7 +38446,62 @@ "node": ">=18" } }, + "plugins/node/instrumentation-tedious/node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "plugins/node/instrumentation-tedious/node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "plugins/node/instrumentation-typeorm": { + "name": "@opentelemetry/instrumentation-typeorm", "version": "0.0.1", "license": "Apache-2.0", "dependencies": { @@ -39058,6 +39113,25 @@ "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==", "dev": true }, + "plugins/node/instrumentation-typeorm/node_modules/rimraf": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.5.tgz", + "integrity": "sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^10.3.7" + }, + "bin": { + "rimraf": "dist/esm/bin.mjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "plugins/node/instrumentation-typeorm/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -39076,6 +39150,8 @@ "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -39239,6 +39315,8 @@ "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=6" } @@ -54188,6 +54266,15 @@ "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==", "dev": true }, + "rimraf": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.5.tgz", + "integrity": "sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==", + "dev": true, + "requires": { + "glob": "^10.3.7" + } + }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", From e8398618b22f9185a2cd0ccf3573bb125ac2f15e Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Sat, 15 Mar 2025 14:35:43 +0200 Subject: [PATCH 16/41] update deps --- package-lock.json | 1152 +++-------------- .../node/instrumentation-typeorm/package.json | 30 +- 2 files changed, 169 insertions(+), 1013 deletions(-) diff --git a/package-lock.json b/package-lock.json index d194181436..a0b6d7d581 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8743,9 +8743,9 @@ } }, "node_modules/@opentelemetry/api": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.8.0.tgz", - "integrity": "sha512-I/s6F7yKUDdtMsoBWXJe8Qz40Tui5vsuKCWJEWVL+5q9sSWRzzx6v2KeNsOBEwd94j0eWkpWCH4yB6rZg9Mf0w==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", + "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==", "engines": { "node": ">=8.0.0" } @@ -11833,7 +11833,8 @@ "version": "1.2.5", "resolved": "https://registry.npmjs.org/@sqltools/formatter/-/formatter-1.2.5.tgz", "integrity": "sha512-Uy0+khmZqUrUGm5dmMqVlnvufZRSK0FbYzVgp0UMstm+F5+W2/jnEEQyc9vo1ZR/E5ZI/B1WjjoTqBqwJL6Krw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@teppeis/multimaps": { "version": "2.0.0", @@ -13585,6 +13586,16 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/ansis": { + "version": "3.17.0", + "resolved": "https://registry.npmjs.org/ansis/-/ansis-3.17.0.tgz", + "integrity": "sha512-0qWUglt9JEqLFr3w1I1pbrChn1grhaiAR2ocX1PP/flRmxgtwTzPFFFnfIlD6aMOLQZgSuCRlidD70lvx8yhzg==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + } + }, "node_modules/any-promise": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", @@ -13604,15 +13615,6 @@ "node": ">= 8" } }, - "node_modules/app-root-path": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-3.1.0.tgz", - "integrity": "sha512-biN3PwB2gUtjaYy/isrU3aNWI5w+fAfvHkSvCKeQGxhmYpwKFUxudR3Yya+KqVRHBmEDYh+/lTozYCFbmzX4nA==", - "dev": true, - "engines": { - "node": ">= 6.0.0" - } - }, "node_modules/anymatch/node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", @@ -13625,6 +13627,16 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/app-root-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-3.1.0.tgz", + "integrity": "sha512-biN3PwB2gUtjaYy/isrU3aNWI5w+fAfvHkSvCKeQGxhmYpwKFUxudR3Yya+KqVRHBmEDYh+/lTozYCFbmzX4nA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6.0.0" + } + }, "node_modules/append-field": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", @@ -16175,10 +16187,11 @@ } }, "node_modules/dayjs": { - "version": "1.11.11", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.11.tgz", - "integrity": "sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg==", - "dev": true + "version": "1.11.13", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", + "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==", + "dev": true, + "license": "MIT" }, "node_modules/debounce": { "version": "1.2.1", @@ -30805,6 +30818,7 @@ "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "dev": true, + "license": "(MIT AND BSD-3-Clause)", "dependencies": { "inherits": "^2.0.1", "safe-buffer": "^5.0.1" @@ -31728,6 +31742,23 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, + "node_modules/sql-highlight": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/sql-highlight/-/sql-highlight-6.0.0.tgz", + "integrity": "sha512-+fLpbAbWkQ+d0JEchJT/NrRRXbYRNbG15gFpANx73EwxQB1PRjj+k/OI0GTU0J63g8ikGkJECQp9z8XEJZvPRw==", + "dev": true, + "funding": [ + "https://github.com/scriptcoded/sql-highlight?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/scriptcoded" + } + ], + "license": "MIT", + "engines": { + "node": ">=14" + } + }, "node_modules/sqlite3": { "version": "5.1.7", "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.1.7.tgz", @@ -36157,21 +36188,19 @@ "version": "0.0.1", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/instrumentation": "^0.51.0", - "@opentelemetry/semantic-conventions": "^1.24.0" + "@opentelemetry/instrumentation": "^0.57.2", + "@opentelemetry/semantic-conventions": "^1.27.0" }, "devDependencies": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/contrib-test-utils": "^0.39.0", - "@opentelemetry/sdk-trace-base": "^1.24.0", - "@types/mocha": "7.0.2", - "@types/node": "18.6.5", - "mocha": "7.2.0", + "@opentelemetry/contrib-test-utils": "^0.45.1", + "@opentelemetry/sdk-trace-base": "^1.8.0", + "@types/mocha": "10.0.10", + "@types/node": "18.18.14", "nyc": "15.1.0", - "rimraf": "5.0.5", + "rimraf": "5.0.10", "sqlite3": "^5.0.2", - "ts-mocha": "10.0.0", - "typeorm": "^0.3.20", + "typeorm": "^0.3.21", "typescript": "4.4.4" }, "engines": { @@ -36181,427 +36210,14 @@ "@opentelemetry/api": "^1.3.0" } }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/api-logs": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.51.1.tgz", - "integrity": "sha512-E3skn949Pk1z2XtXu/lxf6QAZpawuTM/IUEXcAzpiUkTd73Hmvw26FiN3cJuTmkpM5hZzHwkomVdtrh/n/zzwA==", - "dependencies": { - "@opentelemetry/api": "^1.0.0" - }, - "engines": { - "node": ">=14" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/context-async-hooks": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-1.24.1.tgz", - "integrity": "sha512-R5r6DO4kgEOVBxFXhXjwospLQkv+sYxwCfjvoZBe7Zm6KKXAV9kDSJhi/D1BweowdZmO+sdbENLs374gER8hpQ==", - "dev": true, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/contrib-test-utils": { - "version": "0.39.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/contrib-test-utils/-/contrib-test-utils-0.39.0.tgz", - "integrity": "sha512-Ob5eB/8Nayj9DmRnLn0v6y/mws7s/8TXbYyESkcu7lLoHzTvOToqKfjmTbjh/4IRxhtYKTMn894VCoOFCJyWBw==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "^1.0.0", - "@opentelemetry/exporter-jaeger": "^1.3.1", - "@opentelemetry/instrumentation": "^0.51.0", - "@opentelemetry/resources": "^1.8.0", - "@opentelemetry/sdk-node": "^0.51.0", - "@opentelemetry/sdk-trace-base": "^1.8.0", - "@opentelemetry/sdk-trace-node": "^1.8.0", - "@opentelemetry/semantic-conventions": "^1.22.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/core": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.24.1.tgz", - "integrity": "sha512-wMSGfsdmibI88K9wB498zXY04yThPexo8jvwNNlm542HZB7XrrMRBbAyKJqG8qDRJwIBdBrPMi4V9ZPW/sqrcg==", - "dev": true, - "dependencies": { - "@opentelemetry/semantic-conventions": "1.24.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-trace-otlp-grpc": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-grpc/-/exporter-trace-otlp-grpc-0.51.1.tgz", - "integrity": "sha512-P9+Hkszih95ITvldGZ+kXvj9HpD1QfS+PwooyHK72GYA+Bgm+yUSAsDkUkDms8+s9HW6poxURv3LcjaMuBBpVQ==", - "dev": true, - "dependencies": { - "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.24.1", - "@opentelemetry/otlp-grpc-exporter-base": "0.51.1", - "@opentelemetry/otlp-transformer": "0.51.1", - "@opentelemetry/resources": "1.24.1", - "@opentelemetry/sdk-trace-base": "1.24.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-trace-otlp-grpc/node_modules/@opentelemetry/otlp-grpc-exporter-base": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-grpc-exporter-base/-/otlp-grpc-exporter-base-0.51.1.tgz", - "integrity": "sha512-ZAS+4pq8o7dsugGTwV9s6JMKSxi+guIHdn0acOv0bqj26e9pWDFx5Ky+bI0aY46uR9Y0JyXqY+KAEYM/SO3DFA==", - "dev": true, - "dependencies": { - "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.24.1", - "@opentelemetry/otlp-exporter-base": "0.51.1", - "protobufjs": "^7.2.3" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-trace-otlp-grpc/node_modules/@opentelemetry/otlp-grpc-exporter-base/node_modules/@opentelemetry/otlp-exporter-base": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-exporter-base/-/otlp-exporter-base-0.51.1.tgz", - "integrity": "sha512-UYlnOYyDdzo1Gw559EHCzru0RwhvuXCwoH8jGo9J4gO1TE58GjnEmIjomMsKBCym3qWNJfIQXw+9SZCV0DdQNg==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-trace-otlp-http": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-http/-/exporter-trace-otlp-http-0.51.1.tgz", - "integrity": "sha512-n+LhLPsX07URh+HhV2SHVSvz1t4G/l/CE5BjpmhAPqeTceFac1VpyQkavWEJbvnK5bUEXijWt4LxAxFpt2fXyw==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/otlp-exporter-base": "0.51.1", - "@opentelemetry/otlp-transformer": "0.51.1", - "@opentelemetry/resources": "1.24.1", - "@opentelemetry/sdk-trace-base": "1.24.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-trace-otlp-http/node_modules/@opentelemetry/otlp-exporter-base": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-exporter-base/-/otlp-exporter-base-0.51.1.tgz", - "integrity": "sha512-UYlnOYyDdzo1Gw559EHCzru0RwhvuXCwoH8jGo9J4gO1TE58GjnEmIjomMsKBCym3qWNJfIQXw+9SZCV0DdQNg==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-trace-otlp-proto": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-proto/-/exporter-trace-otlp-proto-0.51.1.tgz", - "integrity": "sha512-SE9f0/6V6EeXC9i+WA4WFjS1EYgaBCpAnI5+lxWvZ7iO7EU1IvHvZhP6Kojr0nLldo83gqg6G7OWFqsID3uF+w==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/otlp-exporter-base": "0.51.1", - "@opentelemetry/otlp-proto-exporter-base": "0.51.1", - "@opentelemetry/otlp-transformer": "0.51.1", - "@opentelemetry/resources": "1.24.1", - "@opentelemetry/sdk-trace-base": "1.24.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-trace-otlp-proto/node_modules/@opentelemetry/otlp-exporter-base": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-exporter-base/-/otlp-exporter-base-0.51.1.tgz", - "integrity": "sha512-UYlnOYyDdzo1Gw559EHCzru0RwhvuXCwoH8jGo9J4gO1TE58GjnEmIjomMsKBCym3qWNJfIQXw+9SZCV0DdQNg==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-trace-otlp-proto/node_modules/@opentelemetry/otlp-proto-exporter-base": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-proto-exporter-base/-/otlp-proto-exporter-base-0.51.1.tgz", - "integrity": "sha512-gxxxwfk0inDMb5DLeuxQ3L8TtptxSiTNHE4nnAJH34IQXAVRhXSXW1rK8PmDKDngRPIZ6J7ncUCjjIn8b+AgqQ==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/otlp-exporter-base": "0.51.1", - "protobufjs": "^7.2.3" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/exporter-zipkin": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-zipkin/-/exporter-zipkin-1.24.1.tgz", - "integrity": "sha512-+Rl/VFmu2n6eaRMnVbyfZx1DqR/1KNyWebYuHyQBZaEAVIn/ZLgmofRpXN1X2nhJ4BNaptQUNxAstCYYz6dKoQ==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/resources": "1.24.1", - "@opentelemetry/sdk-trace-base": "1.24.1", - "@opentelemetry/semantic-conventions": "1.24.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/instrumentation": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.51.1.tgz", - "integrity": "sha512-JIrvhpgqY6437QIqToyozrUG1h5UhwHkaGK/WAX+fkrpyPtc+RO5FkRtUd9BH0MibabHHvqsnBGKfKVijbmp8w==", - "dependencies": { - "@opentelemetry/api-logs": "0.51.1", - "@types/shimmer": "^1.0.2", - "import-in-the-middle": "1.7.4", - "require-in-the-middle": "^7.1.1", - "semver": "^7.5.2", - "shimmer": "^1.2.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.3.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/otlp-transformer": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-transformer/-/otlp-transformer-0.51.1.tgz", - "integrity": "sha512-OppYOXwV9LQqqtYUCywqoOqX/JT9LQ5/FMuPZ//eTkvuHdUC4ZMwz2c6uSoT2R90GWvvGnF1iEqTGyTT3xAt2Q==", - "dev": true, - "dependencies": { - "@opentelemetry/api-logs": "0.51.1", - "@opentelemetry/core": "1.24.1", - "@opentelemetry/resources": "1.24.1", - "@opentelemetry/sdk-logs": "0.51.1", - "@opentelemetry/sdk-metrics": "1.24.1", - "@opentelemetry/sdk-trace-base": "1.24.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.3.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/propagator-b3": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-b3/-/propagator-b3-1.24.1.tgz", - "integrity": "sha512-nda97ZwhpZKyUJTXqQuKzNhPMUgMLunbbGWn8kroBwegn+nh6OhtyGkrVQsQLNdVKJl0KeB5z0ZgeWszrYhwFw==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/propagator-jaeger": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-jaeger/-/propagator-jaeger-1.24.1.tgz", - "integrity": "sha512-7bRBJn3FG1l195A1m+xXRHvgzAOBsfmRi9uZ5Da18oTh7BLmNDiA8+kpk51FpTsU1PCikPVpRDNPhKVB6lyzZg==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/resources": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.24.1.tgz", - "integrity": "sha512-cyv0MwAaPF7O86x5hk3NNgenMObeejZFLJJDVuSeSMIsknlsj3oOZzRv3qSzlwYomXsICfBeFFlxwHQte5mGXQ==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/semantic-conventions": "1.24.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/sdk-logs": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.51.1.tgz", - "integrity": "sha512-ULQQtl82b673PpZc5/0EtH4V+BrwVOgKJZEB7tYZnGTG3I98tQVk89S9/JSixomDr++F4ih+LSJTCqIKBz+MQQ==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/resources": "1.24.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.4.0 <1.9.0", - "@opentelemetry/api-logs": ">=0.39.1" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/sdk-metrics": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.24.1.tgz", - "integrity": "sha512-FrAqCbbGao9iKI+Mgh+OsC9+U2YMoXnlDHe06yH7dvavCKzE3S892dGtX54+WhSFVxHR/TMRVJiK/CV93GR0TQ==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/resources": "1.24.1", - "lodash.merge": "^4.6.2" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.3.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/sdk-node": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-node/-/sdk-node-0.51.1.tgz", - "integrity": "sha512-GgmNF9C+6esr8PIJxCqHw84rEOkYm6XdFWZ2+Wyc3qaUt92ACoN7uSw5iKNvaUq62W0xii1wsGxwHzyENtPP8w==", - "dev": true, - "dependencies": { - "@opentelemetry/api-logs": "0.51.1", - "@opentelemetry/core": "1.24.1", - "@opentelemetry/exporter-trace-otlp-grpc": "0.51.1", - "@opentelemetry/exporter-trace-otlp-http": "0.51.1", - "@opentelemetry/exporter-trace-otlp-proto": "0.51.1", - "@opentelemetry/exporter-zipkin": "1.24.1", - "@opentelemetry/instrumentation": "0.51.1", - "@opentelemetry/resources": "1.24.1", - "@opentelemetry/sdk-logs": "0.51.1", - "@opentelemetry/sdk-metrics": "1.24.1", - "@opentelemetry/sdk-trace-base": "1.24.1", - "@opentelemetry/sdk-trace-node": "1.24.1", - "@opentelemetry/semantic-conventions": "1.24.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.3.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/sdk-trace-base": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.24.1.tgz", - "integrity": "sha512-zz+N423IcySgjihl2NfjBf0qw1RWe11XIAWVrTNOSSI6dtSPJiVom2zipFB2AEEtJWpv0Iz6DY6+TjnyTV5pWg==", - "dev": true, - "dependencies": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/resources": "1.24.1", - "@opentelemetry/semantic-conventions": "1.24.1" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/sdk-trace-node": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-node/-/sdk-trace-node-1.24.1.tgz", - "integrity": "sha512-/FZX8uWaGIAwsDhqI8VvQ+qWtfMNlXjaFYGc+vmxgdRFppCSSIRwrPyIhJO1qx61okyYhoyxVEZAfoiNxrfJCg==", - "dev": true, - "dependencies": { - "@opentelemetry/context-async-hooks": "1.24.1", - "@opentelemetry/core": "1.24.1", - "@opentelemetry/propagator-b3": "1.24.1", - "@opentelemetry/propagator-jaeger": "1.24.1", - "@opentelemetry/sdk-trace-base": "1.24.1", - "semver": "^7.5.2" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.9.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/@opentelemetry/semantic-conventions": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.24.1.tgz", - "integrity": "sha512-VkliWlS4/+GHLLW7J/rVBA00uXus1SWvwFvcUDxDwmFxYfg/2VI6ekwdXS28cjI8Qz2ky2BzG8OUHo+WeYIWqw==", - "engines": { - "node": ">=14" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "plugins/node/instrumentation-typeorm/node_modules/@types/node": { + "version": "18.18.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.14.tgz", + "integrity": "sha512-iSOeNeXYNYNLLOMDSVPvIFojclvMZ/HDY2dU17kUlcsOsSQETbWIslJbYLZgA+ox8g2XQwSHKTkght1a5X26lQ==", "dev": true, + "license": "MIT", "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "undici-types": "~5.26.4" } }, "plugins/node/instrumentation-typeorm/node_modules/bson": { @@ -36609,6 +36225,7 @@ "resolved": "https://registry.npmjs.org/bson/-/bson-5.5.1.tgz", "integrity": "sha512-ix0EwukN2EpC0SRWIj/7B5+A6uQMQy6KMREI9qQqvgpkV2frH63T0UDVd1SYedL6dNCmDBYB3QtXi4ISk9YT+g==", "dev": true, + "license": "Apache-2.0", "optional": true, "peer": true, "engines": { @@ -36634,50 +36251,18 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" } }, - "plugins/node/instrumentation-typeorm/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "plugins/node/instrumentation-typeorm/node_modules/dotenv": { - "version": "16.4.5", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", - "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "version": "16.4.7", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", + "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=12" }, @@ -36703,24 +36288,15 @@ "type": "consulting", "url": "https://feross.org/support" } - ] - }, - "plugins/node/instrumentation-typeorm/node_modules/import-in-the-middle": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-1.7.4.tgz", - "integrity": "sha512-Lk+qzWmiQuRPPulGQeK5qq0v32k2bHnWrRPFgqyvhw7Kkov5L6MOLOIU3pcWeujc9W4q54Cp3Q2WV16eQkc7Bg==", - "dependencies": { - "acorn": "^8.8.2", - "acorn-import-attributes": "^1.9.5", - "cjs-module-lexer": "^1.2.2", - "module-details-from-path": "^1.0.3" - } + ], + "license": "BSD-3-Clause" }, "plugins/node/instrumentation-typeorm/node_modules/mongodb": { "version": "5.9.2", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.9.2.tgz", "integrity": "sha512-H60HecKO4Bc+7dhOv4sJlgvenK4fQNqqUIlXxZYQNbfEWSALGAwGoyJd/0Qwk4TttFXUOHJ2ZJQe/52ScaUwtQ==", "dev": true, + "license": "Apache-2.0", "optional": true, "peer": true, "dependencies": { @@ -36763,105 +36339,29 @@ "version": "0.2.2", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==", - "dev": true - }, - "plugins/node/instrumentation-typeorm/node_modules/rimraf": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.5.tgz", - "integrity": "sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^10.3.7" - }, - "bin": { - "rimraf": "dist/esm/bin.mjs" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/ts-node": { - "version": "10.9.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", - "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } + "license": "Apache-2.0", + "peer": true }, "plugins/node/instrumentation-typeorm/node_modules/typeorm": { - "version": "0.3.20", - "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.20.tgz", - "integrity": "sha512-sJ0T08dV5eoZroaq9uPKBoNcGslHBR4E4y+EBHs//SiGbblGe7IeduP/IH4ddCcj0qp3PHwDwGnuvqEAnKlq/Q==", + "version": "0.3.21", + "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.21.tgz", + "integrity": "sha512-lh4rUWl1liZGjyPTWpwcK8RNI5x4ekln+/JJOox1wCd7xbucYDOXWD+1cSzTN3L0wbTGxxOtloM5JlxbOxEufA==", "dev": true, + "license": "MIT", "dependencies": { "@sqltools/formatter": "^1.2.5", + "ansis": "^3.9.0", "app-root-path": "^3.1.0", "buffer": "^6.0.3", - "chalk": "^4.1.2", - "cli-highlight": "^2.1.11", "dayjs": "^1.11.9", "debug": "^4.3.4", "dotenv": "^16.0.3", - "glob": "^10.3.10", - "mkdirp": "^2.1.3", - "reflect-metadata": "^0.2.1", + "glob": "^10.4.5", "sha.js": "^2.4.11", + "sql-highlight": "^6.0.0", "tslib": "^2.5.0", - "uuid": "^9.0.0", + "uuid": "^11.0.5", "yargs": "^17.6.2" }, "bin": { @@ -36878,17 +36378,18 @@ "peerDependencies": { "@google-cloud/spanner": "^5.18.0", "@sap/hana-client": "^2.12.25", - "better-sqlite3": "^7.1.2 || ^8.0.0 || ^9.0.0", + "better-sqlite3": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0", "hdb-pool": "^0.1.6", "ioredis": "^5.0.4", "mongodb": "^5.8.0", - "mssql": "^9.1.1 || ^10.0.1", + "mssql": "^9.1.1 || ^10.0.1 || ^11.0.1", "mysql2": "^2.2.5 || ^3.0.1", "oracledb": "^6.3.0", "pg": "^8.5.1", "pg-native": "^3.0.0", "pg-query-stream": "^4.0.0", "redis": "^3.1.1 || ^4.0.0", + "reflect-metadata": "^0.1.14 || ^0.2.0", "sql.js": "^1.4.0", "sqlite3": "^5.0.3", "ts-node": "^10.7.0", @@ -36948,29 +36449,32 @@ } } }, + "plugins/node/instrumentation-typeorm/node_modules/typescript": { + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "plugins/node/instrumentation-typeorm/node_modules/uuid": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", + "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", "dev": true, "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" ], - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "plugins/node/instrumentation-typeorm/node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, "license": "MIT", - "optional": true, - "peer": true, - "engines": { - "node": ">=6" + "bin": { + "uuid": "dist/esm/bin/uuid" } }, "plugins/node/instrumentation-undici": { @@ -45641,9 +45145,9 @@ } }, "@opentelemetry/api": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.8.0.tgz", - "integrity": "sha512-I/s6F7yKUDdtMsoBWXJe8Qz40Tui5vsuKCWJEWVL+5q9sSWRzzx6v2KeNsOBEwd94j0eWkpWCH4yB6rZg9Mf0w==" + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", + "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==" }, "@opentelemetry/api-logs": { "version": "0.57.2", @@ -48001,306 +47505,26 @@ "version": "file:plugins/node/instrumentation-typeorm", "requires": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/contrib-test-utils": "^0.39.0", - "@opentelemetry/instrumentation": "^0.51.0", - "@opentelemetry/sdk-trace-base": "^1.24.0", - "@opentelemetry/semantic-conventions": "^1.24.0", - "@types/mocha": "7.0.2", - "@types/node": "18.6.5", - "mocha": "7.2.0", + "@opentelemetry/contrib-test-utils": "^0.45.1", + "@opentelemetry/instrumentation": "^0.57.2", + "@opentelemetry/sdk-trace-base": "^1.8.0", + "@opentelemetry/semantic-conventions": "^1.27.0", + "@types/mocha": "10.0.10", + "@types/node": "18.18.14", "nyc": "15.1.0", - "rimraf": "5.0.5", + "rimraf": "5.0.10", "sqlite3": "^5.0.2", - "ts-mocha": "10.0.0", - "typeorm": "^0.3.20", + "typeorm": "^0.3.21", "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/api-logs": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.51.1.tgz", - "integrity": "sha512-E3skn949Pk1z2XtXu/lxf6QAZpawuTM/IUEXcAzpiUkTd73Hmvw26FiN3cJuTmkpM5hZzHwkomVdtrh/n/zzwA==", - "requires": { - "@opentelemetry/api": "^1.0.0" - } - }, - "@opentelemetry/context-async-hooks": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-1.24.1.tgz", - "integrity": "sha512-R5r6DO4kgEOVBxFXhXjwospLQkv+sYxwCfjvoZBe7Zm6KKXAV9kDSJhi/D1BweowdZmO+sdbENLs374gER8hpQ==", - "dev": true, - "requires": {} - }, - "@opentelemetry/contrib-test-utils": { - "version": "0.39.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/contrib-test-utils/-/contrib-test-utils-0.39.0.tgz", - "integrity": "sha512-Ob5eB/8Nayj9DmRnLn0v6y/mws7s/8TXbYyESkcu7lLoHzTvOToqKfjmTbjh/4IRxhtYKTMn894VCoOFCJyWBw==", - "dev": true, - "requires": { - "@opentelemetry/core": "^1.0.0", - "@opentelemetry/exporter-jaeger": "^1.3.1", - "@opentelemetry/instrumentation": "^0.51.0", - "@opentelemetry/resources": "^1.8.0", - "@opentelemetry/sdk-node": "^0.51.0", - "@opentelemetry/sdk-trace-base": "^1.8.0", - "@opentelemetry/sdk-trace-node": "^1.8.0", - "@opentelemetry/semantic-conventions": "^1.22.0" - } - }, - "@opentelemetry/core": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.24.1.tgz", - "integrity": "sha512-wMSGfsdmibI88K9wB498zXY04yThPexo8jvwNNlm542HZB7XrrMRBbAyKJqG8qDRJwIBdBrPMi4V9ZPW/sqrcg==", - "dev": true, - "requires": { - "@opentelemetry/semantic-conventions": "1.24.1" - } - }, - "@opentelemetry/exporter-trace-otlp-grpc": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-grpc/-/exporter-trace-otlp-grpc-0.51.1.tgz", - "integrity": "sha512-P9+Hkszih95ITvldGZ+kXvj9HpD1QfS+PwooyHK72GYA+Bgm+yUSAsDkUkDms8+s9HW6poxURv3LcjaMuBBpVQ==", - "dev": true, - "requires": { - "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.24.1", - "@opentelemetry/otlp-grpc-exporter-base": "0.51.1", - "@opentelemetry/otlp-transformer": "0.51.1", - "@opentelemetry/resources": "1.24.1", - "@opentelemetry/sdk-trace-base": "1.24.1" - }, - "dependencies": { - "@opentelemetry/otlp-grpc-exporter-base": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-grpc-exporter-base/-/otlp-grpc-exporter-base-0.51.1.tgz", - "integrity": "sha512-ZAS+4pq8o7dsugGTwV9s6JMKSxi+guIHdn0acOv0bqj26e9pWDFx5Ky+bI0aY46uR9Y0JyXqY+KAEYM/SO3DFA==", - "dev": true, - "requires": { - "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.24.1", - "@opentelemetry/otlp-exporter-base": "0.51.1", - "protobufjs": "^7.2.3" - }, - "dependencies": { - "@opentelemetry/otlp-exporter-base": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-exporter-base/-/otlp-exporter-base-0.51.1.tgz", - "integrity": "sha512-UYlnOYyDdzo1Gw559EHCzru0RwhvuXCwoH8jGo9J4gO1TE58GjnEmIjomMsKBCym3qWNJfIQXw+9SZCV0DdQNg==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.1" - } - } - } - } - } - }, - "@opentelemetry/exporter-trace-otlp-http": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-http/-/exporter-trace-otlp-http-0.51.1.tgz", - "integrity": "sha512-n+LhLPsX07URh+HhV2SHVSvz1t4G/l/CE5BjpmhAPqeTceFac1VpyQkavWEJbvnK5bUEXijWt4LxAxFpt2fXyw==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/otlp-exporter-base": "0.51.1", - "@opentelemetry/otlp-transformer": "0.51.1", - "@opentelemetry/resources": "1.24.1", - "@opentelemetry/sdk-trace-base": "1.24.1" - }, - "dependencies": { - "@opentelemetry/otlp-exporter-base": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-exporter-base/-/otlp-exporter-base-0.51.1.tgz", - "integrity": "sha512-UYlnOYyDdzo1Gw559EHCzru0RwhvuXCwoH8jGo9J4gO1TE58GjnEmIjomMsKBCym3qWNJfIQXw+9SZCV0DdQNg==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.1" - } - } - } - }, - "@opentelemetry/exporter-trace-otlp-proto": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-proto/-/exporter-trace-otlp-proto-0.51.1.tgz", - "integrity": "sha512-SE9f0/6V6EeXC9i+WA4WFjS1EYgaBCpAnI5+lxWvZ7iO7EU1IvHvZhP6Kojr0nLldo83gqg6G7OWFqsID3uF+w==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/otlp-exporter-base": "0.51.1", - "@opentelemetry/otlp-proto-exporter-base": "0.51.1", - "@opentelemetry/otlp-transformer": "0.51.1", - "@opentelemetry/resources": "1.24.1", - "@opentelemetry/sdk-trace-base": "1.24.1" - }, - "dependencies": { - "@opentelemetry/otlp-exporter-base": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-exporter-base/-/otlp-exporter-base-0.51.1.tgz", - "integrity": "sha512-UYlnOYyDdzo1Gw559EHCzru0RwhvuXCwoH8jGo9J4gO1TE58GjnEmIjomMsKBCym3qWNJfIQXw+9SZCV0DdQNg==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.1" - } - }, - "@opentelemetry/otlp-proto-exporter-base": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-proto-exporter-base/-/otlp-proto-exporter-base-0.51.1.tgz", - "integrity": "sha512-gxxxwfk0inDMb5DLeuxQ3L8TtptxSiTNHE4nnAJH34IQXAVRhXSXW1rK8PmDKDngRPIZ6J7ncUCjjIn8b+AgqQ==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/otlp-exporter-base": "0.51.1", - "protobufjs": "^7.2.3" - } - } - } - }, - "@opentelemetry/exporter-zipkin": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-zipkin/-/exporter-zipkin-1.24.1.tgz", - "integrity": "sha512-+Rl/VFmu2n6eaRMnVbyfZx1DqR/1KNyWebYuHyQBZaEAVIn/ZLgmofRpXN1X2nhJ4BNaptQUNxAstCYYz6dKoQ==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/resources": "1.24.1", - "@opentelemetry/sdk-trace-base": "1.24.1", - "@opentelemetry/semantic-conventions": "1.24.1" - } - }, - "@opentelemetry/instrumentation": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.51.1.tgz", - "integrity": "sha512-JIrvhpgqY6437QIqToyozrUG1h5UhwHkaGK/WAX+fkrpyPtc+RO5FkRtUd9BH0MibabHHvqsnBGKfKVijbmp8w==", - "requires": { - "@opentelemetry/api-logs": "0.51.1", - "@types/shimmer": "^1.0.2", - "import-in-the-middle": "1.7.4", - "require-in-the-middle": "^7.1.1", - "semver": "^7.5.2", - "shimmer": "^1.2.1" - } - }, - "@opentelemetry/otlp-transformer": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-transformer/-/otlp-transformer-0.51.1.tgz", - "integrity": "sha512-OppYOXwV9LQqqtYUCywqoOqX/JT9LQ5/FMuPZ//eTkvuHdUC4ZMwz2c6uSoT2R90GWvvGnF1iEqTGyTT3xAt2Q==", - "dev": true, - "requires": { - "@opentelemetry/api-logs": "0.51.1", - "@opentelemetry/core": "1.24.1", - "@opentelemetry/resources": "1.24.1", - "@opentelemetry/sdk-logs": "0.51.1", - "@opentelemetry/sdk-metrics": "1.24.1", - "@opentelemetry/sdk-trace-base": "1.24.1" - } - }, - "@opentelemetry/propagator-b3": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-b3/-/propagator-b3-1.24.1.tgz", - "integrity": "sha512-nda97ZwhpZKyUJTXqQuKzNhPMUgMLunbbGWn8kroBwegn+nh6OhtyGkrVQsQLNdVKJl0KeB5z0ZgeWszrYhwFw==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.1" - } - }, - "@opentelemetry/propagator-jaeger": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-jaeger/-/propagator-jaeger-1.24.1.tgz", - "integrity": "sha512-7bRBJn3FG1l195A1m+xXRHvgzAOBsfmRi9uZ5Da18oTh7BLmNDiA8+kpk51FpTsU1PCikPVpRDNPhKVB6lyzZg==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.1" - } - }, - "@opentelemetry/resources": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.24.1.tgz", - "integrity": "sha512-cyv0MwAaPF7O86x5hk3NNgenMObeejZFLJJDVuSeSMIsknlsj3oOZzRv3qSzlwYomXsICfBeFFlxwHQte5mGXQ==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/semantic-conventions": "1.24.1" - } - }, - "@opentelemetry/sdk-logs": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.51.1.tgz", - "integrity": "sha512-ULQQtl82b673PpZc5/0EtH4V+BrwVOgKJZEB7tYZnGTG3I98tQVk89S9/JSixomDr++F4ih+LSJTCqIKBz+MQQ==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/resources": "1.24.1" - } - }, - "@opentelemetry/sdk-metrics": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.24.1.tgz", - "integrity": "sha512-FrAqCbbGao9iKI+Mgh+OsC9+U2YMoXnlDHe06yH7dvavCKzE3S892dGtX54+WhSFVxHR/TMRVJiK/CV93GR0TQ==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/resources": "1.24.1", - "lodash.merge": "^4.6.2" - } - }, - "@opentelemetry/sdk-node": { - "version": "0.51.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-node/-/sdk-node-0.51.1.tgz", - "integrity": "sha512-GgmNF9C+6esr8PIJxCqHw84rEOkYm6XdFWZ2+Wyc3qaUt92ACoN7uSw5iKNvaUq62W0xii1wsGxwHzyENtPP8w==", - "dev": true, - "requires": { - "@opentelemetry/api-logs": "0.51.1", - "@opentelemetry/core": "1.24.1", - "@opentelemetry/exporter-trace-otlp-grpc": "0.51.1", - "@opentelemetry/exporter-trace-otlp-http": "0.51.1", - "@opentelemetry/exporter-trace-otlp-proto": "0.51.1", - "@opentelemetry/exporter-zipkin": "1.24.1", - "@opentelemetry/instrumentation": "0.51.1", - "@opentelemetry/resources": "1.24.1", - "@opentelemetry/sdk-logs": "0.51.1", - "@opentelemetry/sdk-metrics": "1.24.1", - "@opentelemetry/sdk-trace-base": "1.24.1", - "@opentelemetry/sdk-trace-node": "1.24.1", - "@opentelemetry/semantic-conventions": "1.24.1" - } - }, - "@opentelemetry/sdk-trace-base": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.24.1.tgz", - "integrity": "sha512-zz+N423IcySgjihl2NfjBf0qw1RWe11XIAWVrTNOSSI6dtSPJiVom2zipFB2AEEtJWpv0Iz6DY6+TjnyTV5pWg==", - "dev": true, - "requires": { - "@opentelemetry/core": "1.24.1", - "@opentelemetry/resources": "1.24.1", - "@opentelemetry/semantic-conventions": "1.24.1" - } - }, - "@opentelemetry/sdk-trace-node": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-node/-/sdk-trace-node-1.24.1.tgz", - "integrity": "sha512-/FZX8uWaGIAwsDhqI8VvQ+qWtfMNlXjaFYGc+vmxgdRFppCSSIRwrPyIhJO1qx61okyYhoyxVEZAfoiNxrfJCg==", - "dev": true, - "requires": { - "@opentelemetry/context-async-hooks": "1.24.1", - "@opentelemetry/core": "1.24.1", - "@opentelemetry/propagator-b3": "1.24.1", - "@opentelemetry/propagator-jaeger": "1.24.1", - "@opentelemetry/sdk-trace-base": "1.24.1", - "semver": "^7.5.2" - } - }, - "@opentelemetry/semantic-conventions": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.24.1.tgz", - "integrity": "sha512-VkliWlS4/+GHLLW7J/rVBA00uXus1SWvwFvcUDxDwmFxYfg/2VI6ekwdXS28cjI8Qz2ky2BzG8OUHo+WeYIWqw==" - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "@types/node": { + "version": "18.18.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.14.tgz", + "integrity": "sha512-iSOeNeXYNYNLLOMDSVPvIFojclvMZ/HDY2dU17kUlcsOsSQETbWIslJbYLZgA+ox8g2XQwSHKTkght1a5X26lQ==", "dev": true, "requires": { - "color-convert": "^2.0.1" + "undici-types": "~5.26.4" } }, "bson": { @@ -48321,35 +47545,10 @@ "ieee754": "^1.2.1" } }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "dotenv": { - "version": "16.4.5", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", - "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "version": "16.4.7", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", + "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", "dev": true }, "ieee754": { @@ -48358,17 +47557,6 @@ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "dev": true }, - "import-in-the-middle": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-1.7.4.tgz", - "integrity": "sha512-Lk+qzWmiQuRPPulGQeK5qq0v32k2bHnWrRPFgqyvhw7Kkov5L6MOLOIU3pcWeujc9W4q54Cp3Q2WV16eQkc7Bg==", - "requires": { - "acorn": "^8.8.2", - "acorn-import-attributes": "^1.9.5", - "cjs-module-lexer": "^1.2.2", - "module-details-from-path": "^1.0.3" - } - }, "mongodb": { "version": "5.9.2", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.9.2.tgz", @@ -48387,85 +47575,41 @@ "version": "0.2.2", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==", - "dev": true - }, - "rimraf": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.5.tgz", - "integrity": "sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==", "dev": true, - "requires": { - "glob": "^10.3.7" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "ts-node": { - "version": "10.9.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", - "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - } + "peer": true }, "typeorm": { - "version": "0.3.20", - "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.20.tgz", - "integrity": "sha512-sJ0T08dV5eoZroaq9uPKBoNcGslHBR4E4y+EBHs//SiGbblGe7IeduP/IH4ddCcj0qp3PHwDwGnuvqEAnKlq/Q==", + "version": "0.3.21", + "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.21.tgz", + "integrity": "sha512-lh4rUWl1liZGjyPTWpwcK8RNI5x4ekln+/JJOox1wCd7xbucYDOXWD+1cSzTN3L0wbTGxxOtloM5JlxbOxEufA==", "dev": true, "requires": { "@sqltools/formatter": "^1.2.5", + "ansis": "^3.9.0", "app-root-path": "^3.1.0", "buffer": "^6.0.3", - "chalk": "^4.1.2", - "cli-highlight": "^2.1.11", "dayjs": "^1.11.9", "debug": "^4.3.4", "dotenv": "^16.0.3", - "glob": "^10.3.10", - "mkdirp": "^2.1.3", - "reflect-metadata": "^0.2.1", + "glob": "^10.4.5", "sha.js": "^2.4.11", + "sql-highlight": "^6.0.0", "tslib": "^2.5.0", - "uuid": "^9.0.0", + "uuid": "^11.0.5", "yargs": "^17.6.2" } }, - "uuid": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "typescript": { + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", "dev": true }, - "yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "optional": true, - "peer": true + "uuid": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", + "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", + "dev": true } } }, @@ -52656,6 +51800,12 @@ "color-convert": "^2.0.1" } }, + "ansis": { + "version": "3.17.0", + "resolved": "https://registry.npmjs.org/ansis/-/ansis-3.17.0.tgz", + "integrity": "sha512-0qWUglt9JEqLFr3w1I1pbrChn1grhaiAR2ocX1PP/flRmxgtwTzPFFFnfIlD6aMOLQZgSuCRlidD70lvx8yhzg==", + "dev": true + }, "any-promise": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", @@ -54675,9 +53825,9 @@ "dev": true }, "dayjs": { - "version": "1.11.11", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.11.tgz", - "integrity": "sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg==", + "version": "1.11.13", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", + "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==", "dev": true }, "debounce": { @@ -66697,6 +65847,12 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, + "sql-highlight": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/sql-highlight/-/sql-highlight-6.0.0.tgz", + "integrity": "sha512-+fLpbAbWkQ+d0JEchJT/NrRRXbYRNbG15gFpANx73EwxQB1PRjj+k/OI0GTU0J63g8ikGkJECQp9z8XEJZvPRw==", + "dev": true + }, "sqlite3": { "version": "5.1.7", "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.1.7.tgz", diff --git a/plugins/node/instrumentation-typeorm/package.json b/plugins/node/instrumentation-typeorm/package.json index e18f841f21..e0e77ae9b5 100644 --- a/plugins/node/instrumentation-typeorm/package.json +++ b/plugins/node/instrumentation-typeorm/package.json @@ -6,17 +6,19 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "test": "ts-mocha --require @opentelemetry/contrib-test-utils -p tsconfig.json 'test/**/*.test.ts'", - "test-all-versions": "tav", - "tdd": "npm run test -- --watch-extensions ts --watch", "clean": "rimraf build/*", + "compile": "tsc -p .", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-typeorm --include-dependencies", + "lint:readme": "node ../../../scripts/lint-readme.js", "prewatch": "npm run precompile", "prepublishOnly": "npm run compile", + "tdd": "npm run test -- --watch-extensions ts --watch", + "test": "nyc mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", + "test-all-versions": "tav", + "test:debug": "mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'", "version:update": "node ../../../scripts/version-update.js", - "compile": "tsc -p ." + "watch": "tsc -w" }, "keywords": [ "typeorm", @@ -44,21 +46,19 @@ }, "devDependencies": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/contrib-test-utils": "^0.39.0", - "@opentelemetry/sdk-trace-base": "^1.24.0", - "@types/mocha": "7.0.2", - "@types/node": "18.6.5", - "typeorm": "^0.3.20", - "mocha": "7.2.0", + "@opentelemetry/contrib-test-utils": "^0.45.1", + "@opentelemetry/sdk-trace-base": "^1.8.0", + "@types/mocha": "10.0.10", + "@types/node": "18.18.14", + "typeorm": "^0.3.21", "nyc": "15.1.0", - "rimraf": "5.0.5", - "ts-mocha": "10.0.0", + "rimraf": "5.0.10", "sqlite3": "^5.0.2", "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.51.0", - "@opentelemetry/semantic-conventions": "^1.24.0" + "@opentelemetry/instrumentation": "^0.57.2", + "@opentelemetry/semantic-conventions": "^1.27.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-typeorm#readme" } From 7a10d66a2be8da51bf2e6b7b24de4bd3777eac17 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Sat, 15 Mar 2025 14:47:55 +0200 Subject: [PATCH 17/41] add missing dep --- package-lock.json | 2 ++ plugins/node/instrumentation-typeorm/package.json | 1 + 2 files changed, 3 insertions(+) diff --git a/package-lock.json b/package-lock.json index a0b6d7d581..4e6a3b3815 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36188,6 +36188,7 @@ "version": "0.0.1", "license": "Apache-2.0", "dependencies": { + "@opentelemetry/core": "^1.8.0", "@opentelemetry/instrumentation": "^0.57.2", "@opentelemetry/semantic-conventions": "^1.27.0" }, @@ -47506,6 +47507,7 @@ "requires": { "@opentelemetry/api": "^1.3.0", "@opentelemetry/contrib-test-utils": "^0.45.1", + "@opentelemetry/core": "^1.8.0", "@opentelemetry/instrumentation": "^0.57.2", "@opentelemetry/sdk-trace-base": "^1.8.0", "@opentelemetry/semantic-conventions": "^1.27.0", diff --git a/plugins/node/instrumentation-typeorm/package.json b/plugins/node/instrumentation-typeorm/package.json index e0e77ae9b5..114b179ac9 100644 --- a/plugins/node/instrumentation-typeorm/package.json +++ b/plugins/node/instrumentation-typeorm/package.json @@ -58,6 +58,7 @@ }, "dependencies": { "@opentelemetry/instrumentation": "^0.57.2", + "@opentelemetry/core": "^1.8.0", "@opentelemetry/semantic-conventions": "^1.27.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-typeorm#readme" From b781c447f688ad6736bf253baf4ed07601d8263d Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Sat, 15 Mar 2025 14:58:10 +0200 Subject: [PATCH 18/41] add knipignore --- plugins/node/instrumentation-typeorm/src/typeorm.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/node/instrumentation-typeorm/src/typeorm.ts b/plugins/node/instrumentation-typeorm/src/typeorm.ts index f98cdcd072..8b0bccd27e 100644 --- a/plugins/node/instrumentation-typeorm/src/typeorm.ts +++ b/plugins/node/instrumentation-typeorm/src/typeorm.ts @@ -40,6 +40,7 @@ import { isTypeormInternalTracingSuppressed, suppressTypeormInternalTracing, } from './utils'; +/** @knipignore */ import { PACKAGE_NAME, PACKAGE_VERSION } from './version'; import type * as typeorm from 'typeorm'; import { From c8417f23d09e7adab621b57f8a7aac17376a11ae Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Sat, 15 Mar 2025 15:18:27 +0200 Subject: [PATCH 19/41] add min version --- plugins/node/instrumentation-typeorm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/node/instrumentation-typeorm/package.json b/plugins/node/instrumentation-typeorm/package.json index 114b179ac9..942e428d45 100644 --- a/plugins/node/instrumentation-typeorm/package.json +++ b/plugins/node/instrumentation-typeorm/package.json @@ -31,7 +31,7 @@ "author": "OpenTelemetry Authors", "license": "Apache-2.0", "engines": { - "node": ">=14" + "node": ">=16.13.0" }, "files": [ "build/src/**/*.js", From 7415ca5e7762a596e941eb0cb96098e34ee510ef Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Sat, 15 Mar 2025 15:51:52 +0200 Subject: [PATCH 20/41] skip tests on node 14 --- plugins/node/instrumentation-typeorm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/node/instrumentation-typeorm/package.json b/plugins/node/instrumentation-typeorm/package.json index 942e428d45..7a62fbf0c9 100644 --- a/plugins/node/instrumentation-typeorm/package.json +++ b/plugins/node/instrumentation-typeorm/package.json @@ -14,7 +14,7 @@ "prewatch": "npm run precompile", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "nyc mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", + "test": "SKIP_TEST_IF_NODE_OLDER_THAN=16 nyc mocha --require '../../../scripts/skip-test-if.js' --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", "test-all-versions": "tav", "test:debug": "mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'", "version:update": "node ../../../scripts/version-update.js", From bf8692e1b2fb03cc2ab3db7abb94f704bf388ade Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 18 Mar 2025 14:55:49 +0200 Subject: [PATCH 21/41] update pkg lock --- package-lock.json | 295 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 285 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index ce14312e35..d35170f6fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35726,6 +35726,287 @@ "undici-types": "~5.26.4" } }, + "plugins/node/instrumentation-typeorm": { + "name": "@opentelemetry/instrumentation-typeorm", + "version": "0.0.1", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "^2.0.0", + "@opentelemetry/instrumentation": "^0.200.0", + "@opentelemetry/semantic-conventions": "^1.27.0" + }, + "devDependencies": { + "@opentelemetry/api": "^1.3.0", + "@opentelemetry/contrib-test-utils": "^0.45.1", + "@opentelemetry/sdk-trace-base": "^2.0.0", + "@types/mocha": "10.0.10", + "@types/node": "18.18.14", + "nyc": "15.1.0", + "rimraf": "5.0.10", + "sqlite3": "^5.0.2", + "typeorm": "^0.3.21", + "typescript": "5.0.4" + }, + "engines": { + "node": ">=16.13.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/@types/node": { + "version": "18.18.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.14.tgz", + "integrity": "sha512-iSOeNeXYNYNLLOMDSVPvIFojclvMZ/HDY2dU17kUlcsOsSQETbWIslJbYLZgA+ox8g2XQwSHKTkght1a5X26lQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/bson": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/bson/-/bson-5.5.1.tgz", + "integrity": "sha512-ix0EwukN2EpC0SRWIj/7B5+A6uQMQy6KMREI9qQqvgpkV2frH63T0UDVd1SYedL6dNCmDBYB3QtXi4ISk9YT+g==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "peer": true, + "engines": { + "node": ">=14.20.1" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/dotenv": { + "version": "16.4.7", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", + "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "plugins/node/instrumentation-typeorm/node_modules/mongodb": { + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.9.2.tgz", + "integrity": "sha512-H60HecKO4Bc+7dhOv4sJlgvenK4fQNqqUIlXxZYQNbfEWSALGAwGoyJd/0Qwk4TttFXUOHJ2ZJQe/52ScaUwtQ==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "peer": true, + "dependencies": { + "bson": "^5.5.0", + "mongodb-connection-string-url": "^2.6.0", + "socks": "^2.7.1" + }, + "engines": { + "node": ">=14.20.1" + }, + "optionalDependencies": { + "@mongodb-js/saslprep": "^1.1.0" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.188.0", + "@mongodb-js/zstd": "^1.0.0", + "kerberos": "^1.0.0 || ^2.0.0", + "mongodb-client-encryption": ">=2.3.0 <3", + "snappy": "^7.2.2" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "@mongodb-js/zstd": { + "optional": true + }, + "kerberos": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + } + } + }, + "plugins/node/instrumentation-typeorm/node_modules/reflect-metadata": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", + "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==", + "dev": true, + "license": "Apache-2.0", + "peer": true + }, + "plugins/node/instrumentation-typeorm/node_modules/typeorm": { + "version": "0.3.21", + "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.21.tgz", + "integrity": "sha512-lh4rUWl1liZGjyPTWpwcK8RNI5x4ekln+/JJOox1wCd7xbucYDOXWD+1cSzTN3L0wbTGxxOtloM5JlxbOxEufA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sqltools/formatter": "^1.2.5", + "ansis": "^3.9.0", + "app-root-path": "^3.1.0", + "buffer": "^6.0.3", + "dayjs": "^1.11.9", + "debug": "^4.3.4", + "dotenv": "^16.0.3", + "glob": "^10.4.5", + "sha.js": "^2.4.11", + "sql-highlight": "^6.0.0", + "tslib": "^2.5.0", + "uuid": "^11.0.5", + "yargs": "^17.6.2" + }, + "bin": { + "typeorm": "cli.js", + "typeorm-ts-node-commonjs": "cli-ts-node-commonjs.js", + "typeorm-ts-node-esm": "cli-ts-node-esm.js" + }, + "engines": { + "node": ">=16.13.0" + }, + "funding": { + "url": "https://opencollective.com/typeorm" + }, + "peerDependencies": { + "@google-cloud/spanner": "^5.18.0", + "@sap/hana-client": "^2.12.25", + "better-sqlite3": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0", + "hdb-pool": "^0.1.6", + "ioredis": "^5.0.4", + "mongodb": "^5.8.0", + "mssql": "^9.1.1 || ^10.0.1 || ^11.0.1", + "mysql2": "^2.2.5 || ^3.0.1", + "oracledb": "^6.3.0", + "pg": "^8.5.1", + "pg-native": "^3.0.0", + "pg-query-stream": "^4.0.0", + "redis": "^3.1.1 || ^4.0.0", + "reflect-metadata": "^0.1.14 || ^0.2.0", + "sql.js": "^1.4.0", + "sqlite3": "^5.0.3", + "ts-node": "^10.7.0", + "typeorm-aurora-data-api-driver": "^2.0.0" + }, + "peerDependenciesMeta": { + "@google-cloud/spanner": { + "optional": true + }, + "@sap/hana-client": { + "optional": true + }, + "better-sqlite3": { + "optional": true + }, + "hdb-pool": { + "optional": true + }, + "ioredis": { + "optional": true + }, + "mongodb": { + "optional": true + }, + "mssql": { + "optional": true + }, + "mysql2": { + "optional": true + }, + "oracledb": { + "optional": true + }, + "pg": { + "optional": true + }, + "pg-native": { + "optional": true + }, + "pg-query-stream": { + "optional": true + }, + "redis": { + "optional": true + }, + "sql.js": { + "optional": true + }, + "sqlite3": { + "optional": true + }, + "ts-node": { + "optional": true + }, + "typeorm-aurora-data-api-driver": { + "optional": true + } + } + }, + "plugins/node/instrumentation-typeorm/node_modules/uuid": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", + "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", + "dev": true, + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/esm/bin/uuid" + } + }, "plugins/node/instrumentation-undici": { "name": "@opentelemetry/instrumentation-undici", "version": "0.10.1", @@ -45991,9 +46272,9 @@ "requires": { "@opentelemetry/api": "^1.3.0", "@opentelemetry/contrib-test-utils": "^0.45.1", - "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.57.2", - "@opentelemetry/sdk-trace-base": "^1.8.0", + "@opentelemetry/core": "^2.0.0", + "@opentelemetry/instrumentation": "^0.200.0", + "@opentelemetry/sdk-trace-base": "^2.0.0", "@opentelemetry/semantic-conventions": "^1.27.0", "@types/mocha": "10.0.10", "@types/node": "18.18.14", @@ -46001,7 +46282,7 @@ "rimraf": "5.0.10", "sqlite3": "^5.0.2", "typeorm": "^0.3.21", - "typescript": "4.4.4" + "typescript": "5.0.4" }, "dependencies": { "@types/node": { @@ -46085,12 +46366,6 @@ "yargs": "^17.6.2" } }, - "typescript": { - "version": "4.4.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", - "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", - "dev": true - }, "uuid": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", From b5a21973056940b09de317b336f3641aafac0986 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 18 Mar 2025 15:08:37 +0200 Subject: [PATCH 22/41] use getConfig --- .../instrumentation-typeorm/src/typeorm.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/plugins/node/instrumentation-typeorm/src/typeorm.ts b/plugins/node/instrumentation-typeorm/src/typeorm.ts index 8b0bccd27e..4c34caf880 100644 --- a/plugins/node/instrumentation-typeorm/src/typeorm.ts +++ b/plugins/node/instrumentation-typeorm/src/typeorm.ts @@ -92,8 +92,7 @@ const entityManagerMethods: EntityManagerMethods[] = [ ...functionsUsingQueryBuilder, ]; -export class TypeormInstrumentation extends InstrumentationBase { - protected override _config!: TypeormInstrumentationConfig; +export class TypeormInstrumentation extends InstrumentationBase { constructor(config: TypeormInstrumentationConfig = {}) { super(PACKAGE_NAME, PACKAGE_VERSION, config); } @@ -258,11 +257,11 @@ export class TypeormInstrumentation extends InstrumentationBase { const contextWithSpan = trace.setSpan(context.active(), span); - const traceContext = self._config.enableInternalInstrumentation + const traceContext = self.getConfig().enableInternalInstrumentation ? contextWithSpan : suppressTypeormInternalTracing(contextWithSpan); - const contextWithSuppressTracing = self._config + const contextWithSuppressTracing = self.getConfig() .suppressInternalInstrumentation ? suppressTracing(traceContext) : traceContext; @@ -301,7 +300,7 @@ export class TypeormInstrumentation extends InstrumentationBase { [SEMATTRS_DB_STATEMENT]: sql, [SEMATTRS_DB_SQL_TABLE]: mainTableName, }; - if (self._config.enhancedDatabaseReporting) { + if (self.getConfig().enhancedDatabaseReporting) { try { attributes[ExtendedDatabaseAttribute.DB_STATEMENT_PARAMETERS] = JSON.stringify(parameters); @@ -319,11 +318,11 @@ export class TypeormInstrumentation extends InstrumentationBase { const contextWithSpan = trace.setSpan(context.active(), span); - const traceContext = self._config.enableInternalInstrumentation + const traceContext = self.getConfig().enableInternalInstrumentation ? contextWithSpan : suppressTypeormInternalTracing(contextWithSpan); - const contextWithSuppressTracing = self._config + const contextWithSuppressTracing = self.getConfig() ?.suppressInternalInstrumentation ? suppressTracing(traceContext) : traceContext; @@ -365,11 +364,11 @@ export class TypeormInstrumentation extends InstrumentationBase { const contextWithSpan = trace.setSpan(context.active(), span); - const traceContext = self._config.enableInternalInstrumentation + const traceContext = self.getConfig().enableInternalInstrumentation ? contextWithSpan : suppressTypeormInternalTracing(contextWithSpan); - const contextWithSuppressTracing = self._config + const contextWithSuppressTracing = self.getConfig() ?.suppressInternalInstrumentation ? suppressTracing(traceContext) : traceContext; @@ -384,7 +383,7 @@ export class TypeormInstrumentation extends InstrumentationBase { // eslint-disable-next-line @typescript-eslint/no-explicit-any private _endSpan(traced: any, span: Span) { const executeResponseHook = (response: unknown) => { - const hook = this._config?.responseHook; + const hook = this.getConfig().responseHook; if (hook !== undefined) { safeExecuteInTheMiddle( () => hook(span, { response }), From 3f44ecb23392d6c9159364c3c6e7d310bdc94abc Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Wed, 26 Mar 2025 19:09:20 +0200 Subject: [PATCH 23/41] updage package lock --- package-lock.json | 4 ++-- plugins/node/instrumentation-typeorm/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 134086311b..d4bb593958 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35752,7 +35752,7 @@ }, "devDependencies": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/contrib-test-utils": "^0.45.1", + "@opentelemetry/contrib-test-utils": "^0.46.0", "@opentelemetry/sdk-trace-base": "^2.0.0", "@types/mocha": "10.0.10", "@types/node": "18.18.14", @@ -47460,7 +47460,7 @@ "version": "file:plugins/node/instrumentation-typeorm", "requires": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/contrib-test-utils": "^0.45.1", + "@opentelemetry/contrib-test-utils": "^0.46.0", "@opentelemetry/core": "^2.0.0", "@opentelemetry/instrumentation": "^0.200.0", "@opentelemetry/sdk-trace-base": "^2.0.0", diff --git a/plugins/node/instrumentation-typeorm/package.json b/plugins/node/instrumentation-typeorm/package.json index d81b7f748c..7600ae02a6 100644 --- a/plugins/node/instrumentation-typeorm/package.json +++ b/plugins/node/instrumentation-typeorm/package.json @@ -46,7 +46,7 @@ }, "devDependencies": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/contrib-test-utils": "^0.45.1", + "@opentelemetry/contrib-test-utils": "^0.46.0", "@opentelemetry/sdk-trace-base": "^2.0.0", "@types/mocha": "10.0.10", "@types/node": "18.18.14", From d570ab2f9cb9f29fe6349d9391fa497fbe53a5f2 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Wed, 26 Mar 2025 19:45:06 +0200 Subject: [PATCH 24/41] update semattrs --- .../node/instrumentation-typeorm/README.md | 2 - .../instrumentation-typeorm/src/semconv.ts | 24 ++++++ .../instrumentation-typeorm/src/typeorm.ts | 68 +++++++++-------- .../test/Connection.test.ts | 18 ++--- .../test/EntityManager.test.ts | 74 +++++++++---------- .../test/QueryBuilder.test.ts | 42 ++++------- .../test/Repository.test.ts | 6 +- .../test/config.test.ts | 65 +++++++--------- 8 files changed, 143 insertions(+), 156 deletions(-) create mode 100644 plugins/node/instrumentation-typeorm/src/semconv.ts diff --git a/plugins/node/instrumentation-typeorm/README.md b/plugins/node/instrumentation-typeorm/README.md index dbe6317aa5..c803a940ba 100644 --- a/plugins/node/instrumentation-typeorm/README.md +++ b/plugins/node/instrumentation-typeorm/README.md @@ -51,8 +51,6 @@ You can set the following: ## Semantic Conventions -This package uses `@opentelemetry/semantic-conventions` version `1.24+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md) - Attributes collected: | Attribute | Short Description | diff --git a/plugins/node/instrumentation-typeorm/src/semconv.ts b/plugins/node/instrumentation-typeorm/src/semconv.ts new file mode 100644 index 0000000000..a733776042 --- /dev/null +++ b/plugins/node/instrumentation-typeorm/src/semconv.ts @@ -0,0 +1,24 @@ +/* + * Copyright The OpenTelemetry Authors, Aspecto + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export const ATTR_DB_NAME = 'db.name' as const; +export const ATTR_DB_OPERATION = 'db.operation' as const; +export const ATTR_DB_SQL_TABLE = 'db.sql.table' as const; +export const ATTR_DB_STATEMENT = 'db.statement' as const; +export const ATTR_DB_SYSTEM = 'db.system' as const; +export const ATTR_DB_USER = 'db.user' as const; +export const ATTR_NET_PEER_NAME = 'net.peer.name' as const; +export const ATTR_NET_PEER_PORT = 'net.peer.port' as const; diff --git a/plugins/node/instrumentation-typeorm/src/typeorm.ts b/plugins/node/instrumentation-typeorm/src/typeorm.ts index 4c34caf880..27a3e48807 100644 --- a/plugins/node/instrumentation-typeorm/src/typeorm.ts +++ b/plugins/node/instrumentation-typeorm/src/typeorm.ts @@ -22,15 +22,15 @@ import { } from '@opentelemetry/api'; import { suppressTracing } from '@opentelemetry/core'; import { - SEMATTRS_DB_NAME, - SEMATTRS_DB_OPERATION, - SEMATTRS_DB_SQL_TABLE, - SEMATTRS_DB_STATEMENT, - SEMATTRS_DB_SYSTEM, - SEMATTRS_DB_USER, - SEMATTRS_NET_PEER_NAME, - SEMATTRS_NET_PEER_PORT, -} from '@opentelemetry/semantic-conventions'; + ATTR_DB_NAME, + ATTR_DB_OPERATION, + ATTR_DB_SQL_TABLE, + ATTR_DB_STATEMENT, + ATTR_DB_SYSTEM, + ATTR_DB_USER, + ATTR_NET_PEER_NAME, + ATTR_NET_PEER_PORT, +} from './semconv'; import { ExtendedDatabaseAttribute, TypeormInstrumentationConfig, @@ -218,28 +218,26 @@ export class TypeormInstrumentation extends InstrumentationBase = { - [SEMATTRS_DB_SYSTEM]: connectionOptions.type, - [SEMATTRS_DB_USER]: connectionOptions.username, - [SEMATTRS_NET_PEER_NAME]: connectionOptions.host, - [SEMATTRS_NET_PEER_PORT]: connectionOptions.port, - [SEMATTRS_DB_NAME]: connectionOptions.database, - [SEMATTRS_DB_OPERATION]: opName, - [SEMATTRS_DB_STATEMENT]: JSON.stringify( - buildStatement(original, args) - ), + [ATTR_DB_SYSTEM]: connectionOptions.type, + [ATTR_DB_USER]: connectionOptions.username, + [ATTR_NET_PEER_NAME]: connectionOptions.host, + [ATTR_NET_PEER_PORT]: connectionOptions.port, + [ATTR_DB_NAME]: connectionOptions.database, + [ATTR_DB_OPERATION]: opName, + [ATTR_DB_STATEMENT]: JSON.stringify(buildStatement(original, args)), }; //ignore EntityMetadataNotFoundError try { if (this.metadata) { - attributes[SEMATTRS_DB_SQL_TABLE] = this.metadata.tableName; + attributes[ATTR_DB_SQL_TABLE] = this.metadata.tableName; } else { const entity = args[0]; const name = typeof entity === 'object' ? entity?.constructor?.name : entity; const metadata = this.connection.getMetadata(name); if (metadata?.tableName) { - attributes[SEMATTRS_DB_SQL_TABLE] = metadata.tableName; + attributes[ATTR_DB_SQL_TABLE] = metadata.tableName; } } } catch { @@ -291,14 +289,14 @@ export class TypeormInstrumentation extends InstrumentationBase = { - [SEMATTRS_DB_SYSTEM]: connectionOptions.type, - [SEMATTRS_DB_USER]: connectionOptions.username, - [SEMATTRS_NET_PEER_NAME]: connectionOptions.host, - [SEMATTRS_NET_PEER_PORT]: connectionOptions.port, - [SEMATTRS_DB_NAME]: connectionOptions.database, - [SEMATTRS_DB_OPERATION]: operation, - [SEMATTRS_DB_STATEMENT]: sql, - [SEMATTRS_DB_SQL_TABLE]: mainTableName, + [ATTR_DB_SYSTEM]: connectionOptions.type, + [ATTR_DB_USER]: connectionOptions.username, + [ATTR_NET_PEER_NAME]: connectionOptions.host, + [ATTR_NET_PEER_PORT]: connectionOptions.port, + [ATTR_DB_NAME]: connectionOptions.database, + [ATTR_DB_OPERATION]: operation, + [ATTR_DB_STATEMENT]: sql, + [ATTR_DB_SQL_TABLE]: mainTableName, }; if (self.getConfig().enhancedDatabaseReporting) { try { @@ -348,13 +346,13 @@ export class TypeormInstrumentation extends InstrumentationBase { assert.strictEqual(typeOrmSpans.length, 1); assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[0].attributes; - assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], options.type); - assert.strictEqual(attributes[SEMATTRS_DB_NAME], options.database); - assert.strictEqual(attributes[SEMATTRS_DB_OPERATION], 'raw query'); - assert.strictEqual(attributes[SEMATTRS_DB_STATEMENT], query); + assert.strictEqual(attributes[ATTR_DB_SYSTEM], options.type); + assert.strictEqual(attributes[ATTR_DB_NAME], options.database); + assert.strictEqual(attributes[ATTR_DB_OPERATION], 'raw query'); + assert.strictEqual(attributes[ATTR_DB_STATEMENT], query); await connection.close(); }); }); diff --git a/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts b/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts index b91a56be67..f40f0edd76 100644 --- a/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts +++ b/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts @@ -16,12 +16,12 @@ import * as assert from 'assert'; import { SpanStatusCode } from '@opentelemetry/api'; import { - SEMATTRS_DB_SQL_TABLE, - SEMATTRS_DB_SYSTEM, - SEMATTRS_DB_NAME, - SEMATTRS_DB_OPERATION, - SEMATTRS_DB_STATEMENT, -} from '@opentelemetry/semantic-conventions'; + ATTR_DB_SQL_TABLE, + ATTR_DB_SYSTEM, + ATTR_DB_NAME, + ATTR_DB_OPERATION, + ATTR_DB_STATEMENT, +} from '../src/semconv'; import { TypeormInstrumentation } from '../src'; import { getTestSpans, @@ -56,12 +56,12 @@ describe('EntityManager', () => { assert.strictEqual(typeOrmSpans.length, 1); assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[0].attributes; - assert.strictEqual(attributes[SEMATTRS_DB_SQL_TABLE], 'user'); - assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], options.type); - assert.strictEqual(attributes[SEMATTRS_DB_NAME], options.database); - assert.strictEqual(attributes[SEMATTRS_DB_OPERATION], 'save'); + assert.strictEqual(attributes[ATTR_DB_SQL_TABLE], 'user'); + assert.strictEqual(attributes[ATTR_DB_SYSTEM], options.type); + assert.strictEqual(attributes[ATTR_DB_NAME], options.database); + assert.strictEqual(attributes[ATTR_DB_OPERATION], 'save'); assert.strictEqual( - attributes[SEMATTRS_DB_STATEMENT], + attributes[ATTR_DB_STATEMENT], JSON.stringify({ targetOrEntity: user }) ); await connection.close(); @@ -78,12 +78,12 @@ describe('EntityManager', () => { assert.strictEqual(typeOrmSpans.length, 1); assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[0].attributes; - assert.strictEqual(attributes[SEMATTRS_DB_SQL_TABLE], 'user'); - assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], options.type); - assert.strictEqual(attributes[SEMATTRS_DB_NAME], options.database); - assert.strictEqual(attributes[SEMATTRS_DB_OPERATION], 'save'); + assert.strictEqual(attributes[ATTR_DB_SQL_TABLE], 'user'); + assert.strictEqual(attributes[ATTR_DB_SYSTEM], options.type); + assert.strictEqual(attributes[ATTR_DB_NAME], options.database); + assert.strictEqual(attributes[ATTR_DB_OPERATION], 'save'); assert.strictEqual( - attributes[SEMATTRS_DB_STATEMENT], + attributes[ATTR_DB_STATEMENT], JSON.stringify({ targetOrEntity: user }) ); await connection.close(); @@ -102,12 +102,12 @@ describe('EntityManager', () => { assert.strictEqual(typeOrmSpans.length, 2); assert.strictEqual(typeOrmSpans[1].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[1].attributes; - assert.strictEqual(attributes[SEMATTRS_DB_SQL_TABLE], 'user'); - assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], options.type); - assert.strictEqual(attributes[SEMATTRS_DB_NAME], options.database); - assert.strictEqual(attributes[SEMATTRS_DB_OPERATION], 'remove'); + assert.strictEqual(attributes[ATTR_DB_SQL_TABLE], 'user'); + assert.strictEqual(attributes[ATTR_DB_SYSTEM], options.type); + assert.strictEqual(attributes[ATTR_DB_NAME], options.database); + assert.strictEqual(attributes[ATTR_DB_OPERATION], 'remove'); assert.strictEqual( - attributes[SEMATTRS_DB_STATEMENT], + attributes[ATTR_DB_STATEMENT], JSON.stringify({ targetOrEntity: { id: 56, firstName: 'aspecto', lastName: 'io' }, }) @@ -128,12 +128,12 @@ describe('EntityManager', () => { assert.strictEqual(typeOrmSpans.length, 2); assert.strictEqual(typeOrmSpans[1].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[1].attributes; - assert.strictEqual(attributes[SEMATTRS_DB_SQL_TABLE], 'user'); - assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], options.type); - assert.strictEqual(attributes[SEMATTRS_DB_NAME], options.database); - assert.strictEqual(attributes[SEMATTRS_DB_OPERATION], 'update'); + assert.strictEqual(attributes[ATTR_DB_SQL_TABLE], 'user'); + assert.strictEqual(attributes[ATTR_DB_SYSTEM], options.type); + assert.strictEqual(attributes[ATTR_DB_NAME], options.database); + assert.strictEqual(attributes[ATTR_DB_OPERATION], 'update'); assert.strictEqual( - attributes[SEMATTRS_DB_STATEMENT], + attributes[ATTR_DB_STATEMENT], JSON.stringify({ target: 'User', criteria: 56, partialEntity }) ); await connection.close(); @@ -184,29 +184,23 @@ describe('EntityManager', () => { const sqlite2Span = spans[1]; assert.strictEqual( - sqlite1Span.attributes[SEMATTRS_DB_SYSTEM], + sqlite1Span.attributes[ATTR_DB_SYSTEM], defaultOptions.type ); assert.strictEqual( - sqlite1Span.attributes[SEMATTRS_DB_NAME], + sqlite1Span.attributes[ATTR_DB_NAME], defaultOptions.database ); - assert.strictEqual(sqlite1Span.attributes[SEMATTRS_DB_OPERATION], 'save'); - assert.strictEqual(sqlite1Span.attributes[SEMATTRS_DB_SQL_TABLE], 'user'); + assert.strictEqual(sqlite1Span.attributes[ATTR_DB_OPERATION], 'save'); + assert.strictEqual(sqlite1Span.attributes[ATTR_DB_SQL_TABLE], 'user'); + assert.strictEqual(sqlite2Span.attributes[ATTR_DB_SYSTEM], options2.type); assert.strictEqual( - sqlite2Span.attributes[SEMATTRS_DB_SYSTEM], - options2.type - ); - assert.strictEqual( - sqlite2Span.attributes[SEMATTRS_DB_NAME], + sqlite2Span.attributes[ATTR_DB_NAME], options2.database ); - assert.strictEqual( - sqlite2Span.attributes[SEMATTRS_DB_OPERATION], - 'remove' - ); - assert.strictEqual(sqlite2Span.attributes[SEMATTRS_DB_SQL_TABLE], 'user'); + assert.strictEqual(sqlite2Span.attributes[ATTR_DB_OPERATION], 'remove'); + assert.strictEqual(sqlite2Span.attributes[ATTR_DB_SQL_TABLE], 'user'); await sqlite1.close(); await sqlite2.close(); }); diff --git a/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts b/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts index 8af093a433..31228df3ac 100644 --- a/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts +++ b/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts @@ -16,14 +16,14 @@ import * as assert from 'assert'; import { SpanStatusCode } from '@opentelemetry/api'; import { - SEMATTRS_DB_NAME, - SEMATTRS_DB_SQL_TABLE, - SEMATTRS_DB_STATEMENT, - SEMATTRS_DB_SYSTEM, - SEMATTRS_DB_USER, - SEMATTRS_NET_PEER_NAME, - SEMATTRS_NET_PEER_PORT, -} from '@opentelemetry/semantic-conventions'; + ATTR_DB_NAME, + ATTR_DB_SQL_TABLE, + ATTR_DB_STATEMENT, + ATTR_DB_SYSTEM, + ATTR_DB_USER, + ATTR_NET_PEER_NAME, + ATTR_NET_PEER_PORT, +} from '../src/semconv'; import { TypeormInstrumentation } from '../src'; import { getTestSpans, @@ -60,26 +60,14 @@ describe('QueryBuilder', () => { assert.strictEqual(typeOrmSpans.length, 1); assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[0].attributes; - assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], connectionOptions.type); + assert.strictEqual(attributes[ATTR_DB_SYSTEM], connectionOptions.type); + assert.strictEqual(attributes[ATTR_DB_USER], connectionOptions.username); + assert.strictEqual(attributes[ATTR_NET_PEER_NAME], connectionOptions.host); + assert.strictEqual(attributes[ATTR_NET_PEER_PORT], connectionOptions.port); + assert.strictEqual(attributes[ATTR_DB_NAME], connectionOptions.database); + assert.strictEqual(attributes[ATTR_DB_SQL_TABLE], 'user'); assert.strictEqual( - attributes[SEMATTRS_DB_USER], - connectionOptions.username - ); - assert.strictEqual( - attributes[SEMATTRS_NET_PEER_NAME], - connectionOptions.host - ); - assert.strictEqual( - attributes[SEMATTRS_NET_PEER_PORT], - connectionOptions.port - ); - assert.strictEqual( - attributes[SEMATTRS_DB_NAME], - connectionOptions.database - ); - assert.strictEqual(attributes[SEMATTRS_DB_SQL_TABLE], 'user'); - assert.strictEqual( - attributes[SEMATTRS_DB_STATEMENT], + attributes[ATTR_DB_STATEMENT], 'SELECT "user"."id" AS "user_id", "user"."firstName" AS "user_firstName", "user"."lastName" AS "user_lastName" FROM "user" "user" WHERE "user"."id" = :userId' ); await connection.close(); diff --git a/plugins/node/instrumentation-typeorm/test/Repository.test.ts b/plugins/node/instrumentation-typeorm/test/Repository.test.ts index 9c4ba180e1..596849b13a 100644 --- a/plugins/node/instrumentation-typeorm/test/Repository.test.ts +++ b/plugins/node/instrumentation-typeorm/test/Repository.test.ts @@ -26,7 +26,7 @@ const instrumentation = registerInstrumentationTesting( import { defaultOptions, User } from './utils'; import * as typeorm from 'typeorm'; -import { SEMATTRS_DB_SQL_TABLE } from '@opentelemetry/semantic-conventions'; +import { ATTR_DB_SQL_TABLE } from '../src/semconv'; describe('Repository', () => { beforeEach(() => { @@ -46,7 +46,7 @@ describe('Repository', () => { assert.strictEqual(spans.length, 1); const span = spans[0]; const attributes = span.attributes; - assert.strictEqual(attributes[SEMATTRS_DB_SQL_TABLE], 'user'); - await connection.close(); + assert.strictEqual(attributes[ATTR_DB_SQL_TABLE], 'user'); + await connection.destroy(); }); }); diff --git a/plugins/node/instrumentation-typeorm/test/config.test.ts b/plugins/node/instrumentation-typeorm/test/config.test.ts index 22c13d764a..e801cddf1a 100644 --- a/plugins/node/instrumentation-typeorm/test/config.test.ts +++ b/plugins/node/instrumentation-typeorm/test/config.test.ts @@ -15,15 +15,15 @@ */ import * as assert from 'assert'; import { - SEMATTRS_NET_PEER_PORT, - SEMATTRS_NET_PEER_NAME, - SEMATTRS_DB_SQL_TABLE, - SEMATTRS_DB_NAME, - SEMATTRS_DB_USER, - SEMATTRS_DB_STATEMENT, - SEMATTRS_DB_SYSTEM, - SEMATTRS_DB_OPERATION, -} from '@opentelemetry/semantic-conventions'; + ATTR_NET_PEER_PORT, + ATTR_NET_PEER_NAME, + ATTR_DB_SQL_TABLE, + ATTR_DB_NAME, + ATTR_DB_USER, + ATTR_DB_STATEMENT, + ATTR_DB_SYSTEM, + ATTR_DB_OPERATION, +} from '../src/semconv'; import { ExtendedDatabaseAttribute, TypeormInstrumentation, @@ -63,8 +63,8 @@ describe('TypeormInstrumentationConfig', () => { const attributes = typeOrmSpans[0].attributes; assert.strictEqual(attributes['test'], JSON.stringify(user)); - assert.strictEqual(attributes[SEMATTRS_DB_OPERATION], 'save'); - assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], defaultOptions.type); + assert.strictEqual(attributes[ATTR_DB_OPERATION], 'save'); + assert.strictEqual(attributes[ATTR_DB_SYSTEM], defaultOptions.type); await connection.close(); }); @@ -83,18 +83,15 @@ describe('TypeormInstrumentationConfig', () => { ); assert.notStrictEqual(findAndCountSpan, undefined); assert.strictEqual( - findAndCountSpan?.attributes[SEMATTRS_DB_OPERATION], + findAndCountSpan?.attributes[ATTR_DB_OPERATION], 'findAndCount' ); - assert.strictEqual( - findAndCountSpan?.attributes[SEMATTRS_DB_SQL_TABLE], - 'user' - ); + assert.strictEqual(findAndCountSpan?.attributes[ATTR_DB_SQL_TABLE], 'user'); const selectSpan = spans.find(s => s.name.indexOf('select') !== -1); assert.notStrictEqual(selectSpan, undefined); - assert.strictEqual(selectSpan?.attributes[SEMATTRS_DB_OPERATION], 'select'); - assert.strictEqual(selectSpan?.attributes[SEMATTRS_DB_SQL_TABLE], 'user'); + assert.strictEqual(selectSpan?.attributes[ATTR_DB_OPERATION], 'select'); + assert.strictEqual(selectSpan?.attributes[ATTR_DB_SQL_TABLE], 'user'); await connection.close(); }); @@ -108,9 +105,9 @@ describe('TypeormInstrumentationConfig', () => { const spans = getTestSpans(); assert.strictEqual(spans.length, 1); const attributes = spans[0].attributes; - assert.strictEqual(attributes[SEMATTRS_DB_OPERATION], 'findAndCount'); - assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], defaultOptions.type); - assert.strictEqual(attributes[SEMATTRS_DB_SQL_TABLE], 'user'); + assert.strictEqual(attributes[ATTR_DB_OPERATION], 'findAndCount'); + assert.strictEqual(attributes[ATTR_DB_SYSTEM], defaultOptions.type); + assert.strictEqual(attributes[ATTR_DB_SQL_TABLE], 'user'); await connection.close(); }); @@ -132,26 +129,14 @@ describe('TypeormInstrumentationConfig', () => { assert.strictEqual(typeOrmSpans.length, 1); assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[0].attributes; - assert.strictEqual(attributes[SEMATTRS_DB_SYSTEM], connectionOptions.type); - assert.strictEqual( - attributes[SEMATTRS_DB_USER], - connectionOptions.username - ); - assert.strictEqual( - attributes[SEMATTRS_NET_PEER_NAME], - connectionOptions.host - ); - assert.strictEqual( - attributes[SEMATTRS_NET_PEER_PORT], - connectionOptions.port - ); - assert.strictEqual( - attributes[SEMATTRS_DB_NAME], - connectionOptions.database - ); - assert.strictEqual(attributes[SEMATTRS_DB_SQL_TABLE], 'user'); + assert.strictEqual(attributes[ATTR_DB_SYSTEM], connectionOptions.type); + assert.strictEqual(attributes[ATTR_DB_USER], connectionOptions.username); + assert.strictEqual(attributes[ATTR_NET_PEER_NAME], connectionOptions.host); + assert.strictEqual(attributes[ATTR_NET_PEER_PORT], connectionOptions.port); + assert.strictEqual(attributes[ATTR_DB_NAME], connectionOptions.database); + assert.strictEqual(attributes[ATTR_DB_SQL_TABLE], 'user'); assert.strictEqual( - attributes[SEMATTRS_DB_STATEMENT], + attributes[ATTR_DB_STATEMENT], 'SELECT "user"."id" AS "user_id", "user"."firstName" AS "user_firstName", "user"."lastName" AS "user_lastName" FROM "user" "user" WHERE "user"."id" = :userId AND "user"."firstName" = :firstName AND "user"."lastName" = :lastName' ); assert.strictEqual( From 0d1eb7c57f6412613942ec2a546a3044a2603078 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Wed, 26 Mar 2025 19:53:02 +0200 Subject: [PATCH 25/41] remove unused dep --- package-lock.json | 4 +--- plugins/node/instrumentation-typeorm/package.json | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index d4bb593958..75794c0f91 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35747,8 +35747,7 @@ "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^2.0.0", - "@opentelemetry/instrumentation": "^0.200.0", - "@opentelemetry/semantic-conventions": "^1.27.0" + "@opentelemetry/instrumentation": "^0.200.0" }, "devDependencies": { "@opentelemetry/api": "^1.3.0", @@ -47464,7 +47463,6 @@ "@opentelemetry/core": "^2.0.0", "@opentelemetry/instrumentation": "^0.200.0", "@opentelemetry/sdk-trace-base": "^2.0.0", - "@opentelemetry/semantic-conventions": "^1.27.0", "@types/mocha": "10.0.10", "@types/node": "18.18.14", "nyc": "15.1.0", diff --git a/plugins/node/instrumentation-typeorm/package.json b/plugins/node/instrumentation-typeorm/package.json index 7600ae02a6..fc5bd4882b 100644 --- a/plugins/node/instrumentation-typeorm/package.json +++ b/plugins/node/instrumentation-typeorm/package.json @@ -58,8 +58,7 @@ }, "dependencies": { "@opentelemetry/instrumentation": "^0.200.0", - "@opentelemetry/core": "^2.0.0", - "@opentelemetry/semantic-conventions": "^1.27.0" + "@opentelemetry/core": "^2.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-typeorm#readme" } From 39ca9e9051ea2ce89afa30341ecab63ce72cf24d Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Thu, 27 Mar 2025 21:54:09 +0200 Subject: [PATCH 26/41] add weyert as component owner --- .github/component_owners.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/component_owners.yml b/.github/component_owners.yml index 44fac5e915..fb6730d8cd 100644 --- a/.github/component_owners.yml +++ b/.github/component_owners.yml @@ -71,6 +71,7 @@ components: # Unmaintained plugins/node/instrumentation-typeorm: - seemk + - weyert plugins/node/opentelemetry-instrumentation-aws-lambda: - jj22ee plugins/node/opentelemetry-instrumentation-aws-sdk: From 8db383794945726ff932a3b0b14bd2cc01e9622a Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Thu, 27 Mar 2025 22:47:25 +0200 Subject: [PATCH 27/41] support typeorm >=0.3.0 <1 --- package-lock.json | 2 +- plugins/node/instrumentation-typeorm/.tav.yml | 2 +- .../node/instrumentation-typeorm/README.md | 2 +- .../node/instrumentation-typeorm/package.json | 2 +- .../instrumentation-typeorm/src/typeorm.ts | 31 +++---------------- 5 files changed, 8 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index 75794c0f91..4263fe611b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35762,7 +35762,7 @@ "typescript": "5.0.4" }, "engines": { - "node": ">=16.13.0" + "node": "^18.19.0 || >=20.6.0" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" diff --git a/plugins/node/instrumentation-typeorm/.tav.yml b/plugins/node/instrumentation-typeorm/.tav.yml index 4dbd43c36e..1df7d3bd2f 100644 --- a/plugins/node/instrumentation-typeorm/.tav.yml +++ b/plugins/node/instrumentation-typeorm/.tav.yml @@ -1,4 +1,4 @@ 'typeorm': - versions: ">0.2.28" + versions: ">=0.3.0" commands: - npm run test diff --git a/plugins/node/instrumentation-typeorm/README.md b/plugins/node/instrumentation-typeorm/README.md index c803a940ba..a5143b4a93 100644 --- a/plugins/node/instrumentation-typeorm/README.md +++ b/plugins/node/instrumentation-typeorm/README.md @@ -17,7 +17,7 @@ npm install --save @opentelemetry/instrumentation-typeorm ### Supported versions -- `>=0.2.29 <1` +- `>=0.3.0 <1` ## Usage diff --git a/plugins/node/instrumentation-typeorm/package.json b/plugins/node/instrumentation-typeorm/package.json index fc5bd4882b..a051b666a8 100644 --- a/plugins/node/instrumentation-typeorm/package.json +++ b/plugins/node/instrumentation-typeorm/package.json @@ -31,7 +31,7 @@ "author": "OpenTelemetry Authors", "license": "Apache-2.0", "engines": { - "node": ">=16.13.0" + "node": "^18.19.0 || >=20.6.0" }, "files": [ "build/src/**/*.js", diff --git a/plugins/node/instrumentation-typeorm/src/typeorm.ts b/plugins/node/instrumentation-typeorm/src/typeorm.ts index 27a3e48807..4160dbda4e 100644 --- a/plugins/node/instrumentation-typeorm/src/typeorm.ts +++ b/plugins/node/instrumentation-typeorm/src/typeorm.ts @@ -100,7 +100,7 @@ export class TypeormInstrumentation extends InstrumentationBase=0.2.29 <1'], + ['>=0.3.0 <1'], moduleExports => { selectQueryBuilderExecuteMethods.map(method => { if (isWrapped(moduleExports.SelectQueryBuilder.prototype?.[method])) { @@ -125,29 +125,6 @@ export class TypeormInstrumentation extends InstrumentationBase0.2.28 <0.3.0'], - moduleExports => { - if (isWrapped(moduleExports.Connection.prototype?.[rawQueryFuncName])) { - this._unwrap(moduleExports.Connection.prototype, rawQueryFuncName); - } - this._wrap( - moduleExports.Connection.prototype, - rawQueryFuncName, - this._patchRawQuery() - ); - - return moduleExports; - }, - moduleExports => { - if (isWrapped(moduleExports.Connection.prototype?.[rawQueryFuncName])) { - this._unwrap(moduleExports.Connection.prototype, rawQueryFuncName); - } - return moduleExports; - } - ); - const dataSource = new InstrumentationNodeModuleFile( 'typeorm/data-source/DataSource.js', ['>=0.3.0 <1'], @@ -173,7 +150,7 @@ export class TypeormInstrumentation extends InstrumentationBase=0.2.29 <1'], + ['>=0.3.0 <1'], moduleExports => { entityManagerMethods.map(method => { if (isWrapped(moduleExports.EntityManager.prototype?.[method])) { @@ -200,10 +177,10 @@ export class TypeormInstrumentation extends InstrumentationBase=0.2.29 <1'], + ['>=0.3.0 <1'], undefined, undefined, - [selectQueryBuilder, entityManager, connection, dataSource] + [selectQueryBuilder, entityManager, dataSource] ); return module; } From 4df601a47fd0c63f0c3f18c99f89cc0d5d21c4cf Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Thu, 27 Mar 2025 23:25:14 +0200 Subject: [PATCH 28/41] no need for explicit nodejs 16 skip any longer --- plugins/node/instrumentation-typeorm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/node/instrumentation-typeorm/package.json b/plugins/node/instrumentation-typeorm/package.json index a051b666a8..96e7af0501 100644 --- a/plugins/node/instrumentation-typeorm/package.json +++ b/plugins/node/instrumentation-typeorm/package.json @@ -14,7 +14,7 @@ "prewatch": "npm run precompile", "prepublishOnly": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "SKIP_TEST_IF_NODE_OLDER_THAN=16 nyc mocha --require '../../../scripts/skip-test-if.js' --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", + "test": "nyc mocha --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'", "test-all-versions": "tav", "test:debug": "mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'", "version:update": "node ../../../scripts/version-update.js", From 693972f3251e0121ef6eedce6c56fad2465d4f1b Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 8 Apr 2025 20:59:22 +0300 Subject: [PATCH 29/41] Update plugins/node/instrumentation-typeorm/README.md Co-authored-by: Marc Pichler --- plugins/node/instrumentation-typeorm/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/node/instrumentation-typeorm/README.md b/plugins/node/instrumentation-typeorm/README.md index a5143b4a93..77b70d8500 100644 --- a/plugins/node/instrumentation-typeorm/README.md +++ b/plugins/node/instrumentation-typeorm/README.md @@ -5,7 +5,7 @@ This module provides automatic instrumentation for the [`typeorm`](https://www.npmjs.com/package/typeorm) package, which may be loaded using the [`@opentelemetry/sdk-trace-node`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package and is included in the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle. -If total installation size is not constrained, it is recommended to use the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle with [@opentelemetry/sdk-node](`https://www.npmjs.com/package/@opentelemetry/sdk-node`) for the most seamless instrumentation experience. +If total installation size is not constrained, it is recommended to use [@opentelemetry/sdk-node](`https://www.npmjs.com/package/@opentelemetry/sdk-node`) for the most seamless instrumentation experience. Compatible with OpenTelemetry JS API and SDK `1.0+`. From 117ccdfc3fccf506e6cad8fa168ed0d55c97bf2e Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 8 Apr 2025 20:59:48 +0300 Subject: [PATCH 30/41] Update plugins/node/instrumentation-typeorm/package.json Co-authored-by: Marc Pichler --- plugins/node/instrumentation-typeorm/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/node/instrumentation-typeorm/package.json b/plugins/node/instrumentation-typeorm/package.json index 96e7af0501..393ea7b784 100644 --- a/plugins/node/instrumentation-typeorm/package.json +++ b/plugins/node/instrumentation-typeorm/package.json @@ -25,7 +25,6 @@ "instrumentation", "nodejs", "opentelemetry", - "profiling", "tracing" ], "author": "OpenTelemetry Authors", From 409e011936157a833237ba773159cae48d8e4225 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 8 Apr 2025 21:00:01 +0300 Subject: [PATCH 31/41] Update plugins/node/instrumentation-typeorm/README.md Co-authored-by: Marc Pichler --- plugins/node/instrumentation-typeorm/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/node/instrumentation-typeorm/README.md b/plugins/node/instrumentation-typeorm/README.md index 77b70d8500..3d26f3d09f 100644 --- a/plugins/node/instrumentation-typeorm/README.md +++ b/plugins/node/instrumentation-typeorm/README.md @@ -3,7 +3,7 @@ [![NPM Published Version][npm-img]][npm-url] [![Apache License][license-image]][license-image] -This module provides automatic instrumentation for the [`typeorm`](https://www.npmjs.com/package/typeorm) package, which may be loaded using the [`@opentelemetry/sdk-trace-node`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package and is included in the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle. +This module provides automatic instrumentation for the [`typeorm`](https://www.npmjs.com/package/typeorm) package, which may be loaded using the [`@opentelemetry/instrumentation`](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation) package. If total installation size is not constrained, it is recommended to use [@opentelemetry/sdk-node](`https://www.npmjs.com/package/@opentelemetry/sdk-node`) for the most seamless instrumentation experience. From bfe00e2e9eea04f093889c49ebcfe33fe348733a Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 8 Apr 2025 21:00:18 +0300 Subject: [PATCH 32/41] Update plugins/node/instrumentation-typeorm/README.md Co-authored-by: Marc Pichler --- plugins/node/instrumentation-typeorm/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/node/instrumentation-typeorm/README.md b/plugins/node/instrumentation-typeorm/README.md index 3d26f3d09f..a6ac0db014 100644 --- a/plugins/node/instrumentation-typeorm/README.md +++ b/plugins/node/instrumentation-typeorm/README.md @@ -7,7 +7,7 @@ This module provides automatic instrumentation for the [`typeorm`](https://www.n If total installation size is not constrained, it is recommended to use [@opentelemetry/sdk-node](`https://www.npmjs.com/package/@opentelemetry/sdk-node`) for the most seamless instrumentation experience. -Compatible with OpenTelemetry JS API and SDK `1.0+`. +Compatible with OpenTelemetry JS API `^1.3.0` and SDK `2.0+`. ## Installation From 29fb28649dc7837bb150cdef937a387ad8d3fe8a Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 8 Apr 2025 22:26:53 +0300 Subject: [PATCH 33/41] update to latest db semconv --- plugins/node/instrumentation-typeorm/NOTICE | 1 + .../node/instrumentation-typeorm/README.md | 19 +++-- .../node/instrumentation-typeorm/package.json | 3 +- .../instrumentation-typeorm/src/semconv.ts | 15 ++-- .../instrumentation-typeorm/src/typeorm.ts | 60 +++++++------- .../test/Connection.test.ts | 16 ++-- .../test/EntityManager.test.ts | 81 +++++++++++-------- .../test/QueryBuilder.test.ts | 29 +++---- .../test/Repository.test.ts | 4 +- .../test/config.test.ts | 55 +++++++------ 10 files changed, 151 insertions(+), 132 deletions(-) diff --git a/plugins/node/instrumentation-typeorm/NOTICE b/plugins/node/instrumentation-typeorm/NOTICE index db9123c282..442cb321bc 100644 --- a/plugins/node/instrumentation-typeorm/NOTICE +++ b/plugins/node/instrumentation-typeorm/NOTICE @@ -7,3 +7,4 @@ The library contains the following changes compared to the original: * Removed usage of SemanticAttributes in favor of explicit values. * Removed parsing of db operation from raw queries. * Changed db.database.parameters to db.typeorm.parameters. +* Updated to OpenTelemetry semantic conventions 1.32.0. diff --git a/plugins/node/instrumentation-typeorm/README.md b/plugins/node/instrumentation-typeorm/README.md index a6ac0db014..5746935151 100644 --- a/plugins/node/instrumentation-typeorm/README.md +++ b/plugins/node/instrumentation-typeorm/README.md @@ -53,16 +53,15 @@ You can set the following: Attributes collected: -| Attribute | Short Description | -| ----------------| --------------------------------------------------------------------------- | -| `db.name` | The name of the database being accessed. | -| `db.operation` | The name of the operation being executed (e.g. the SQL keyword). | -| `db.sql.table` | The name of the table being accessed. | -| `db.statement` | The database statement being executed. | -| `db.system` | An identifier for the database management system (DBMS) product being used. | -| `db.user` | Username for accessing the database. | -| `net.peer.name` | Remote address of the database. | -| `net.peer.port` | Peer port number of the network connection. | +| Attribute | Short Description | +| ---------------------| --------------------------------------------------------------------------- | +| `db.namespace` | The name of the database being accessed. | +| `db.operation.name` | The name of the operation being executed (e.g. the SQL keyword). | +| `db.collection.name` | The name of the table being accessed. | +| `db.query.text` | The database statement being executed. | +| `db.system.name` | An identifier for the database management system (DBMS) product being used. | +| `server.address` | Remote address of the database. | +| `server.port` | Peer port number of the network connection. | ## Useful links diff --git a/plugins/node/instrumentation-typeorm/package.json b/plugins/node/instrumentation-typeorm/package.json index 393ea7b784..2849aba49a 100644 --- a/plugins/node/instrumentation-typeorm/package.json +++ b/plugins/node/instrumentation-typeorm/package.json @@ -57,7 +57,8 @@ }, "dependencies": { "@opentelemetry/instrumentation": "^0.200.0", - "@opentelemetry/core": "^2.0.0" + "@opentelemetry/core": "^2.0.0", + "@opentelemetry/semantic-conventions": "^1.30.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-typeorm#readme" } diff --git a/plugins/node/instrumentation-typeorm/src/semconv.ts b/plugins/node/instrumentation-typeorm/src/semconv.ts index a733776042..df934ac462 100644 --- a/plugins/node/instrumentation-typeorm/src/semconv.ts +++ b/plugins/node/instrumentation-typeorm/src/semconv.ts @@ -14,11 +14,10 @@ * limitations under the License. */ -export const ATTR_DB_NAME = 'db.name' as const; -export const ATTR_DB_OPERATION = 'db.operation' as const; -export const ATTR_DB_SQL_TABLE = 'db.sql.table' as const; -export const ATTR_DB_STATEMENT = 'db.statement' as const; -export const ATTR_DB_SYSTEM = 'db.system' as const; -export const ATTR_DB_USER = 'db.user' as const; -export const ATTR_NET_PEER_NAME = 'net.peer.name' as const; -export const ATTR_NET_PEER_PORT = 'net.peer.port' as const; +export const ATTR_DB_NAMESPACE = 'db.namespace' as const; +export const ATTR_DB_COLLECTION_NAME = 'db.collection.name' as const; +export const ATTR_DB_OPERATION_NAME = 'db.operation.name' as const; +export const ATTR_DB_QUERY_TEXT = 'db.query.text' as const; +export const ATTR_DB_SYSTEM_NAME = 'db.system.name' as const; +export const ATTR_SERVER_ADDRESS = 'server.address' as const; +export const ATTR_SERVER_PORT = 'server.port' as const; diff --git a/plugins/node/instrumentation-typeorm/src/typeorm.ts b/plugins/node/instrumentation-typeorm/src/typeorm.ts index 4160dbda4e..2f0db1700f 100644 --- a/plugins/node/instrumentation-typeorm/src/typeorm.ts +++ b/plugins/node/instrumentation-typeorm/src/typeorm.ts @@ -22,14 +22,13 @@ import { } from '@opentelemetry/api'; import { suppressTracing } from '@opentelemetry/core'; import { - ATTR_DB_NAME, - ATTR_DB_OPERATION, - ATTR_DB_SQL_TABLE, - ATTR_DB_STATEMENT, - ATTR_DB_SYSTEM, - ATTR_DB_USER, - ATTR_NET_PEER_NAME, - ATTR_NET_PEER_PORT, + ATTR_DB_COLLECTION_NAME, + ATTR_DB_NAMESPACE, + ATTR_DB_OPERATION_NAME, + ATTR_DB_QUERY_TEXT, + ATTR_DB_SYSTEM_NAME, + ATTR_SERVER_ADDRESS, + ATTR_SERVER_PORT, } from './semconv'; import { ExtendedDatabaseAttribute, @@ -195,26 +194,25 @@ export class TypeormInstrumentation extends InstrumentationBase = { - [ATTR_DB_SYSTEM]: connectionOptions.type, - [ATTR_DB_USER]: connectionOptions.username, - [ATTR_NET_PEER_NAME]: connectionOptions.host, - [ATTR_NET_PEER_PORT]: connectionOptions.port, - [ATTR_DB_NAME]: connectionOptions.database, - [ATTR_DB_OPERATION]: opName, - [ATTR_DB_STATEMENT]: JSON.stringify(buildStatement(original, args)), + [ATTR_DB_SYSTEM_NAME]: connectionOptions.type, + [ATTR_SERVER_ADDRESS]: connectionOptions.host, + [ATTR_SERVER_PORT]: connectionOptions.port, + [ATTR_DB_NAMESPACE]: connectionOptions.database, + [ATTR_DB_OPERATION_NAME]: opName, + [ATTR_DB_QUERY_TEXT]: JSON.stringify(buildStatement(original, args)), }; //ignore EntityMetadataNotFoundError try { if (this.metadata) { - attributes[ATTR_DB_SQL_TABLE] = this.metadata.tableName; + attributes[ATTR_DB_COLLECTION_NAME] = this.metadata.tableName; } else { const entity = args[0]; const name = typeof entity === 'object' ? entity?.constructor?.name : entity; const metadata = this.connection.getMetadata(name); if (metadata?.tableName) { - attributes[ATTR_DB_SQL_TABLE] = metadata.tableName; + attributes[ATTR_DB_COLLECTION_NAME] = metadata.tableName; } } } catch { @@ -266,14 +264,13 @@ export class TypeormInstrumentation extends InstrumentationBase = { - [ATTR_DB_SYSTEM]: connectionOptions.type, - [ATTR_DB_USER]: connectionOptions.username, - [ATTR_NET_PEER_NAME]: connectionOptions.host, - [ATTR_NET_PEER_PORT]: connectionOptions.port, - [ATTR_DB_NAME]: connectionOptions.database, - [ATTR_DB_OPERATION]: operation, - [ATTR_DB_STATEMENT]: sql, - [ATTR_DB_SQL_TABLE]: mainTableName, + [ATTR_DB_SYSTEM_NAME]: connectionOptions.type, + [ATTR_SERVER_ADDRESS]: connectionOptions.host, + [ATTR_SERVER_PORT]: connectionOptions.port, + [ATTR_DB_NAMESPACE]: connectionOptions.database, + [ATTR_DB_OPERATION_NAME]: operation, + [ATTR_DB_QUERY_TEXT]: sql, + [ATTR_DB_COLLECTION_NAME]: mainTableName, }; if (self.getConfig().enhancedDatabaseReporting) { try { @@ -323,13 +320,12 @@ export class TypeormInstrumentation extends InstrumentationBase { assert.strictEqual(typeOrmSpans.length, 1); assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[0].attributes; - assert.strictEqual(attributes[ATTR_DB_SYSTEM], options.type); - assert.strictEqual(attributes[ATTR_DB_NAME], options.database); - assert.strictEqual(attributes[ATTR_DB_OPERATION], 'raw query'); - assert.strictEqual(attributes[ATTR_DB_STATEMENT], query); + assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], options.type); + assert.strictEqual(attributes[ATTR_DB_NAMESPACE], options.database); + assert.strictEqual(attributes[ATTR_DB_OPERATION_NAME], 'raw query'); + assert.strictEqual(attributes[ATTR_DB_QUERY_TEXT], query); await connection.close(); }); }); diff --git a/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts b/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts index f40f0edd76..1d10674bd8 100644 --- a/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts +++ b/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts @@ -16,11 +16,11 @@ import * as assert from 'assert'; import { SpanStatusCode } from '@opentelemetry/api'; import { - ATTR_DB_SQL_TABLE, - ATTR_DB_SYSTEM, - ATTR_DB_NAME, - ATTR_DB_OPERATION, - ATTR_DB_STATEMENT, + ATTR_DB_COLLECTION_NAME, + ATTR_DB_SYSTEM_NAME, + ATTR_DB_NAMESPACE, + ATTR_DB_OPERATION_NAME, + ATTR_DB_QUERY_TEXT, } from '../src/semconv'; import { TypeormInstrumentation } from '../src'; import { @@ -56,12 +56,12 @@ describe('EntityManager', () => { assert.strictEqual(typeOrmSpans.length, 1); assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[0].attributes; - assert.strictEqual(attributes[ATTR_DB_SQL_TABLE], 'user'); - assert.strictEqual(attributes[ATTR_DB_SYSTEM], options.type); - assert.strictEqual(attributes[ATTR_DB_NAME], options.database); - assert.strictEqual(attributes[ATTR_DB_OPERATION], 'save'); + assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); + assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], options.type); + assert.strictEqual(attributes[ATTR_DB_NAMESPACE], options.database); + assert.strictEqual(attributes[ATTR_DB_OPERATION_NAME], 'save'); assert.strictEqual( - attributes[ATTR_DB_STATEMENT], + attributes[ATTR_DB_QUERY_TEXT], JSON.stringify({ targetOrEntity: user }) ); await connection.close(); @@ -78,12 +78,12 @@ describe('EntityManager', () => { assert.strictEqual(typeOrmSpans.length, 1); assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[0].attributes; - assert.strictEqual(attributes[ATTR_DB_SQL_TABLE], 'user'); - assert.strictEqual(attributes[ATTR_DB_SYSTEM], options.type); - assert.strictEqual(attributes[ATTR_DB_NAME], options.database); - assert.strictEqual(attributes[ATTR_DB_OPERATION], 'save'); + assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); + assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], options.type); + assert.strictEqual(attributes[ATTR_DB_NAMESPACE], options.database); + assert.strictEqual(attributes[ATTR_DB_OPERATION_NAME], 'save'); assert.strictEqual( - attributes[ATTR_DB_STATEMENT], + attributes[ATTR_DB_QUERY_TEXT], JSON.stringify({ targetOrEntity: user }) ); await connection.close(); @@ -102,12 +102,12 @@ describe('EntityManager', () => { assert.strictEqual(typeOrmSpans.length, 2); assert.strictEqual(typeOrmSpans[1].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[1].attributes; - assert.strictEqual(attributes[ATTR_DB_SQL_TABLE], 'user'); - assert.strictEqual(attributes[ATTR_DB_SYSTEM], options.type); - assert.strictEqual(attributes[ATTR_DB_NAME], options.database); - assert.strictEqual(attributes[ATTR_DB_OPERATION], 'remove'); + assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); + assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], options.type); + assert.strictEqual(attributes[ATTR_DB_NAMESPACE], options.database); + assert.strictEqual(attributes[ATTR_DB_OPERATION_NAME], 'remove'); assert.strictEqual( - attributes[ATTR_DB_STATEMENT], + attributes[ATTR_DB_QUERY_TEXT], JSON.stringify({ targetOrEntity: { id: 56, firstName: 'aspecto', lastName: 'io' }, }) @@ -128,12 +128,12 @@ describe('EntityManager', () => { assert.strictEqual(typeOrmSpans.length, 2); assert.strictEqual(typeOrmSpans[1].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[1].attributes; - assert.strictEqual(attributes[ATTR_DB_SQL_TABLE], 'user'); - assert.strictEqual(attributes[ATTR_DB_SYSTEM], options.type); - assert.strictEqual(attributes[ATTR_DB_NAME], options.database); - assert.strictEqual(attributes[ATTR_DB_OPERATION], 'update'); + assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); + assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], options.type); + assert.strictEqual(attributes[ATTR_DB_NAMESPACE], options.database); + assert.strictEqual(attributes[ATTR_DB_OPERATION_NAME], 'update'); assert.strictEqual( - attributes[ATTR_DB_STATEMENT], + attributes[ATTR_DB_QUERY_TEXT], JSON.stringify({ target: 'User', criteria: 56, partialEntity }) ); await connection.close(); @@ -184,23 +184,38 @@ describe('EntityManager', () => { const sqlite2Span = spans[1]; assert.strictEqual( - sqlite1Span.attributes[ATTR_DB_SYSTEM], + sqlite1Span.attributes[ATTR_DB_SYSTEM_NAME], defaultOptions.type ); assert.strictEqual( - sqlite1Span.attributes[ATTR_DB_NAME], + sqlite1Span.attributes[ATTR_DB_NAMESPACE], defaultOptions.database ); - assert.strictEqual(sqlite1Span.attributes[ATTR_DB_OPERATION], 'save'); - assert.strictEqual(sqlite1Span.attributes[ATTR_DB_SQL_TABLE], 'user'); + assert.strictEqual( + sqlite1Span.attributes[ATTR_DB_OPERATION_NAME], + 'save' + ); + assert.strictEqual( + sqlite1Span.attributes[ATTR_DB_COLLECTION_NAME], + 'user' + ); - assert.strictEqual(sqlite2Span.attributes[ATTR_DB_SYSTEM], options2.type); assert.strictEqual( - sqlite2Span.attributes[ATTR_DB_NAME], + sqlite2Span.attributes[ATTR_DB_SYSTEM_NAME], + options2.type + ); + assert.strictEqual( + sqlite2Span.attributes[ATTR_DB_NAMESPACE], options2.database ); - assert.strictEqual(sqlite2Span.attributes[ATTR_DB_OPERATION], 'remove'); - assert.strictEqual(sqlite2Span.attributes[ATTR_DB_SQL_TABLE], 'user'); + assert.strictEqual( + sqlite2Span.attributes[ATTR_DB_OPERATION_NAME], + 'remove' + ); + assert.strictEqual( + sqlite2Span.attributes[ATTR_DB_COLLECTION_NAME], + 'user' + ); await sqlite1.close(); await sqlite2.close(); }); diff --git a/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts b/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts index 31228df3ac..bee373358e 100644 --- a/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts +++ b/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts @@ -16,13 +16,12 @@ import * as assert from 'assert'; import { SpanStatusCode } from '@opentelemetry/api'; import { - ATTR_DB_NAME, - ATTR_DB_SQL_TABLE, - ATTR_DB_STATEMENT, - ATTR_DB_SYSTEM, - ATTR_DB_USER, - ATTR_NET_PEER_NAME, - ATTR_NET_PEER_PORT, + ATTR_DB_NAMESPACE, + ATTR_DB_COLLECTION_NAME, + ATTR_DB_QUERY_TEXT, + ATTR_DB_SYSTEM_NAME, + ATTR_SERVER_ADDRESS, + ATTR_SERVER_PORT, } from '../src/semconv'; import { TypeormInstrumentation } from '../src'; import { @@ -60,14 +59,16 @@ describe('QueryBuilder', () => { assert.strictEqual(typeOrmSpans.length, 1); assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[0].attributes; - assert.strictEqual(attributes[ATTR_DB_SYSTEM], connectionOptions.type); - assert.strictEqual(attributes[ATTR_DB_USER], connectionOptions.username); - assert.strictEqual(attributes[ATTR_NET_PEER_NAME], connectionOptions.host); - assert.strictEqual(attributes[ATTR_NET_PEER_PORT], connectionOptions.port); - assert.strictEqual(attributes[ATTR_DB_NAME], connectionOptions.database); - assert.strictEqual(attributes[ATTR_DB_SQL_TABLE], 'user'); + assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], connectionOptions.type); + assert.strictEqual(attributes[ATTR_SERVER_ADDRESS], connectionOptions.host); + assert.strictEqual(attributes[ATTR_SERVER_PORT], connectionOptions.port); assert.strictEqual( - attributes[ATTR_DB_STATEMENT], + attributes[ATTR_DB_NAMESPACE], + connectionOptions.database + ); + assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); + assert.strictEqual( + attributes[ATTR_DB_QUERY_TEXT], 'SELECT "user"."id" AS "user_id", "user"."firstName" AS "user_firstName", "user"."lastName" AS "user_lastName" FROM "user" "user" WHERE "user"."id" = :userId' ); await connection.close(); diff --git a/plugins/node/instrumentation-typeorm/test/Repository.test.ts b/plugins/node/instrumentation-typeorm/test/Repository.test.ts index 596849b13a..9315eba937 100644 --- a/plugins/node/instrumentation-typeorm/test/Repository.test.ts +++ b/plugins/node/instrumentation-typeorm/test/Repository.test.ts @@ -26,7 +26,7 @@ const instrumentation = registerInstrumentationTesting( import { defaultOptions, User } from './utils'; import * as typeorm from 'typeorm'; -import { ATTR_DB_SQL_TABLE } from '../src/semconv'; +import { ATTR_DB_COLLECTION_NAME } from '../src/semconv'; describe('Repository', () => { beforeEach(() => { @@ -46,7 +46,7 @@ describe('Repository', () => { assert.strictEqual(spans.length, 1); const span = spans[0]; const attributes = span.attributes; - assert.strictEqual(attributes[ATTR_DB_SQL_TABLE], 'user'); + assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); await connection.destroy(); }); }); diff --git a/plugins/node/instrumentation-typeorm/test/config.test.ts b/plugins/node/instrumentation-typeorm/test/config.test.ts index e801cddf1a..c8c5e7bcc6 100644 --- a/plugins/node/instrumentation-typeorm/test/config.test.ts +++ b/plugins/node/instrumentation-typeorm/test/config.test.ts @@ -15,14 +15,13 @@ */ import * as assert from 'assert'; import { - ATTR_NET_PEER_PORT, - ATTR_NET_PEER_NAME, - ATTR_DB_SQL_TABLE, - ATTR_DB_NAME, - ATTR_DB_USER, - ATTR_DB_STATEMENT, - ATTR_DB_SYSTEM, - ATTR_DB_OPERATION, + ATTR_SERVER_PORT, + ATTR_SERVER_ADDRESS, + ATTR_DB_COLLECTION_NAME, + ATTR_DB_NAMESPACE, + ATTR_DB_QUERY_TEXT, + ATTR_DB_SYSTEM_NAME, + ATTR_DB_OPERATION_NAME, } from '../src/semconv'; import { ExtendedDatabaseAttribute, @@ -63,8 +62,8 @@ describe('TypeormInstrumentationConfig', () => { const attributes = typeOrmSpans[0].attributes; assert.strictEqual(attributes['test'], JSON.stringify(user)); - assert.strictEqual(attributes[ATTR_DB_OPERATION], 'save'); - assert.strictEqual(attributes[ATTR_DB_SYSTEM], defaultOptions.type); + assert.strictEqual(attributes[ATTR_DB_OPERATION_NAME], 'save'); + assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], defaultOptions.type); await connection.close(); }); @@ -83,15 +82,21 @@ describe('TypeormInstrumentationConfig', () => { ); assert.notStrictEqual(findAndCountSpan, undefined); assert.strictEqual( - findAndCountSpan?.attributes[ATTR_DB_OPERATION], + findAndCountSpan?.attributes[ATTR_DB_OPERATION_NAME], 'findAndCount' ); - assert.strictEqual(findAndCountSpan?.attributes[ATTR_DB_SQL_TABLE], 'user'); + assert.strictEqual( + findAndCountSpan?.attributes[ATTR_DB_COLLECTION_NAME], + 'user' + ); const selectSpan = spans.find(s => s.name.indexOf('select') !== -1); assert.notStrictEqual(selectSpan, undefined); - assert.strictEqual(selectSpan?.attributes[ATTR_DB_OPERATION], 'select'); - assert.strictEqual(selectSpan?.attributes[ATTR_DB_SQL_TABLE], 'user'); + assert.strictEqual( + selectSpan?.attributes[ATTR_DB_OPERATION_NAME], + 'select' + ); + assert.strictEqual(selectSpan?.attributes[ATTR_DB_COLLECTION_NAME], 'user'); await connection.close(); }); @@ -105,9 +110,9 @@ describe('TypeormInstrumentationConfig', () => { const spans = getTestSpans(); assert.strictEqual(spans.length, 1); const attributes = spans[0].attributes; - assert.strictEqual(attributes[ATTR_DB_OPERATION], 'findAndCount'); - assert.strictEqual(attributes[ATTR_DB_SYSTEM], defaultOptions.type); - assert.strictEqual(attributes[ATTR_DB_SQL_TABLE], 'user'); + assert.strictEqual(attributes[ATTR_DB_OPERATION_NAME], 'findAndCount'); + assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], defaultOptions.type); + assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); await connection.close(); }); @@ -129,14 +134,16 @@ describe('TypeormInstrumentationConfig', () => { assert.strictEqual(typeOrmSpans.length, 1); assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[0].attributes; - assert.strictEqual(attributes[ATTR_DB_SYSTEM], connectionOptions.type); - assert.strictEqual(attributes[ATTR_DB_USER], connectionOptions.username); - assert.strictEqual(attributes[ATTR_NET_PEER_NAME], connectionOptions.host); - assert.strictEqual(attributes[ATTR_NET_PEER_PORT], connectionOptions.port); - assert.strictEqual(attributes[ATTR_DB_NAME], connectionOptions.database); - assert.strictEqual(attributes[ATTR_DB_SQL_TABLE], 'user'); + assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], connectionOptions.type); + assert.strictEqual(attributes[ATTR_SERVER_ADDRESS], connectionOptions.host); + assert.strictEqual(attributes[ATTR_SERVER_PORT], connectionOptions.port); + assert.strictEqual( + attributes[ATTR_DB_NAMESPACE], + connectionOptions.database + ); + assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); assert.strictEqual( - attributes[ATTR_DB_STATEMENT], + attributes[ATTR_DB_QUERY_TEXT], 'SELECT "user"."id" AS "user_id", "user"."firstName" AS "user_firstName", "user"."lastName" AS "user_lastName" FROM "user" "user" WHERE "user"."id" = :userId AND "user"."firstName" = :firstName AND "user"."lastName" = :lastName' ); assert.strictEqual( From a1feddffe940ab82732e94e3606134fb0111bc48 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 8 Apr 2025 22:29:43 +0300 Subject: [PATCH 34/41] remove use of deprecated close in tests --- .../test/Connection.test.ts | 2 +- .../test/EntityManager.test.ts | 30 +++++++++++-------- .../test/QueryBuilder.test.ts | 2 +- .../test/config.test.ts | 10 +++---- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/plugins/node/instrumentation-typeorm/test/Connection.test.ts b/plugins/node/instrumentation-typeorm/test/Connection.test.ts index 8d64a77466..7c01019cd7 100644 --- a/plugins/node/instrumentation-typeorm/test/Connection.test.ts +++ b/plugins/node/instrumentation-typeorm/test/Connection.test.ts @@ -60,7 +60,7 @@ describe('Connection', () => { assert.strictEqual(attributes[ATTR_DB_NAMESPACE], options.database); assert.strictEqual(attributes[ATTR_DB_OPERATION_NAME], 'raw query'); assert.strictEqual(attributes[ATTR_DB_QUERY_TEXT], query); - await connection.close(); + await connection.destroy(); }); }); }); diff --git a/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts b/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts index 1d10674bd8..9b13a3e5b6 100644 --- a/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts +++ b/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts @@ -49,7 +49,7 @@ describe('EntityManager', () => { it('save using connection.manager', async () => { const options = defaultOptions; const connection = await typeorm.createConnection(defaultOptions); - const user = new User(1, 'aspecto', 'io'); + const user = new User(1, 'opentelemetry', 'io'); await connection.manager.save(user); const typeOrmSpans = getTestSpans(); @@ -64,14 +64,14 @@ describe('EntityManager', () => { attributes[ATTR_DB_QUERY_TEXT], JSON.stringify({ targetOrEntity: user }) ); - await connection.close(); + await connection.destroy(); }); it('save', async () => { const options = defaultOptions; const connection = await typeorm.createConnection(defaultOptions); const manager = connection.createEntityManager(); - const user = new User(1, 'aspecto', 'io'); + const user = new User(1, 'opentelemetry', 'io'); await manager.save(user); const typeOrmSpans = getTestSpans(); @@ -86,7 +86,7 @@ describe('EntityManager', () => { attributes[ATTR_DB_QUERY_TEXT], JSON.stringify({ targetOrEntity: user }) ); - await connection.close(); + await connection.destroy(); }); it('remove', async () => { @@ -94,7 +94,7 @@ describe('EntityManager', () => { const connection = await typeorm.createConnection(defaultOptions); const manager = connection.createEntityManager(); - const user = new User(56, 'aspecto', 'io'); + const user = new User(56, 'opentelemetry', 'io'); await manager.save(user); await manager.remove(user); const typeOrmSpans = getTestSpans(); @@ -109,17 +109,21 @@ describe('EntityManager', () => { assert.strictEqual( attributes[ATTR_DB_QUERY_TEXT], JSON.stringify({ - targetOrEntity: { id: 56, firstName: 'aspecto', lastName: 'io' }, + targetOrEntity: { + id: 56, + firstName: 'opentelemetry', + lastName: 'io', + }, }) ); - await connection.close(); + await connection.destroy(); }); it('update', async () => { const options = defaultOptions; const connection = await typeorm.createConnection(defaultOptions); const manager = connection.createEntityManager(); - const user = new User(56, 'aspecto', 'io'); + const user = new User(56, 'opentelemetry', 'io'); await manager.save(user); const partialEntity = { lastName: '.io' }; await manager.update(User, 56, partialEntity); @@ -136,7 +140,7 @@ describe('EntityManager', () => { attributes[ATTR_DB_QUERY_TEXT], JSON.stringify({ target: 'User', criteria: 56, partialEntity }) ); - await connection.close(); + await connection.destroy(); }); it('Sets failure status when function throws', async () => { @@ -153,7 +157,7 @@ describe('EntityManager', () => { typeOrmSpans[0].status.message, 'No metadata for "[object Object]" was found.' ); - await connection.close(); + await connection.destroy(); }); }); @@ -174,7 +178,7 @@ describe('EntityManager', () => { const manager1 = sqlite1.createEntityManager(); const manager2 = sqlite2.createEntityManager(); - const user = new User(1, 'aspecto', 'io'); + const user = new User(1, 'opentelemetry', 'io'); await manager1.save(user); await manager2.remove(user); @@ -216,8 +220,8 @@ describe('EntityManager', () => { sqlite2Span.attributes[ATTR_DB_COLLECTION_NAME], 'user' ); - await sqlite1.close(); - await sqlite2.close(); + await sqlite1.destroy(); + await sqlite2.destroy(); }); }); }); diff --git a/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts b/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts index bee373358e..ee6541e2d1 100644 --- a/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts +++ b/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts @@ -71,6 +71,6 @@ describe('QueryBuilder', () => { attributes[ATTR_DB_QUERY_TEXT], 'SELECT "user"."id" AS "user_id", "user"."firstName" AS "user_firstName", "user"."lastName" AS "user_lastName" FROM "user" "user" WHERE "user"."id" = :userId' ); - await connection.close(); + await connection.destroy(); }); }); diff --git a/plugins/node/instrumentation-typeorm/test/config.test.ts b/plugins/node/instrumentation-typeorm/test/config.test.ts index c8c5e7bcc6..e94f7de799 100644 --- a/plugins/node/instrumentation-typeorm/test/config.test.ts +++ b/plugins/node/instrumentation-typeorm/test/config.test.ts @@ -55,7 +55,7 @@ describe('TypeormInstrumentationConfig', () => { instrumentation.enable(); const connection = await typeorm.createConnection(defaultOptions); - const user = new User(1, 'aspecto', 'io'); + const user = new User(1, 'opentelemetry', 'io'); await connection.manager.save(user); const typeOrmSpans = getTestSpans(); assert.strictEqual(typeOrmSpans.length, 1); @@ -64,7 +64,7 @@ describe('TypeormInstrumentationConfig', () => { assert.strictEqual(attributes['test'], JSON.stringify(user)); assert.strictEqual(attributes[ATTR_DB_OPERATION_NAME], 'save'); assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], defaultOptions.type); - await connection.close(); + await connection.destroy(); }); it('enableInternalInstrumentation:true', async () => { @@ -97,7 +97,7 @@ describe('TypeormInstrumentationConfig', () => { 'select' ); assert.strictEqual(selectSpan?.attributes[ATTR_DB_COLLECTION_NAME], 'user'); - await connection.close(); + await connection.destroy(); }); it('enableInternalInstrumentation:false', async () => { @@ -113,7 +113,7 @@ describe('TypeormInstrumentationConfig', () => { assert.strictEqual(attributes[ATTR_DB_OPERATION_NAME], 'findAndCount'); assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], defaultOptions.type); assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); - await connection.close(); + await connection.destroy(); }); it('enhancedDatabaseReporting:true', async () => { @@ -150,6 +150,6 @@ describe('TypeormInstrumentationConfig', () => { attributes[ExtendedDatabaseAttribute.DB_STATEMENT_PARAMETERS], JSON.stringify({ userId: '1', firstName: 'bob', lastName: 'dow' }) ); - await connection.close(); + await connection.destroy(); }); }); From 6420025c0d6bd86476598c9ce13d5eec8ed068bd Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 8 Apr 2025 22:34:40 +0300 Subject: [PATCH 35/41] remove unused dep, add comment regarding future changes to NOTICE --- plugins/node/instrumentation-typeorm/NOTICE | 2 ++ plugins/node/instrumentation-typeorm/package.json | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/node/instrumentation-typeorm/NOTICE b/plugins/node/instrumentation-typeorm/NOTICE index 442cb321bc..61844b567e 100644 --- a/plugins/node/instrumentation-typeorm/NOTICE +++ b/plugins/node/instrumentation-typeorm/NOTICE @@ -8,3 +8,5 @@ The library contains the following changes compared to the original: * Removed parsing of db operation from raw queries. * Changed db.database.parameters to db.typeorm.parameters. * Updated to OpenTelemetry semantic conventions 1.32.0. + +Refer to the changelog for any future changes. diff --git a/plugins/node/instrumentation-typeorm/package.json b/plugins/node/instrumentation-typeorm/package.json index 2849aba49a..393ea7b784 100644 --- a/plugins/node/instrumentation-typeorm/package.json +++ b/plugins/node/instrumentation-typeorm/package.json @@ -57,8 +57,7 @@ }, "dependencies": { "@opentelemetry/instrumentation": "^0.200.0", - "@opentelemetry/core": "^2.0.0", - "@opentelemetry/semantic-conventions": "^1.30.0" + "@opentelemetry/core": "^2.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-typeorm#readme" } From 645dde258d364a841a8aef4fe4d74b964cb9c057 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 15 Apr 2025 15:59:10 +0300 Subject: [PATCH 36/41] get rid of deprecated createConnection --- .../test/Connection.test.ts | 7 +-- .../test/EntityManager.test.ts | 53 +++++++++++-------- .../test/QueryBuilder.test.ts | 21 +++----- .../test/Repository.test.ts | 7 +-- .../test/config.test.ts | 30 ++++++----- .../instrumentation-typeorm/test/utils.ts | 2 - 6 files changed, 63 insertions(+), 57 deletions(-) diff --git a/plugins/node/instrumentation-typeorm/test/Connection.test.ts b/plugins/node/instrumentation-typeorm/test/Connection.test.ts index 7c01019cd7..d3a730b0ad 100644 --- a/plugins/node/instrumentation-typeorm/test/Connection.test.ts +++ b/plugins/node/instrumentation-typeorm/test/Connection.test.ts @@ -48,9 +48,10 @@ describe('Connection', () => { describe('single connection', () => { it('raw query', async () => { const options = rawQueryOptions; - const connection = await typeorm.createConnection(rawQueryOptions); + const ds = new typeorm.DataSource(options); + await ds.initialize(); const query = 'select * from user'; - await connection.query(query); + await ds.query(query); const typeOrmSpans = getTestSpans(); assert.strictEqual(typeOrmSpans.length, 1); @@ -60,7 +61,7 @@ describe('Connection', () => { assert.strictEqual(attributes[ATTR_DB_NAMESPACE], options.database); assert.strictEqual(attributes[ATTR_DB_OPERATION_NAME], 'raw query'); assert.strictEqual(attributes[ATTR_DB_QUERY_TEXT], query); - await connection.destroy(); + await ds.destroy(); }); }); }); diff --git a/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts b/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts index 9b13a3e5b6..b476ff8b4a 100644 --- a/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts +++ b/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts @@ -48,9 +48,11 @@ describe('EntityManager', () => { describe('single connection', () => { it('save using connection.manager', async () => { const options = defaultOptions; - const connection = await typeorm.createConnection(defaultOptions); + const ds = new typeorm.DataSource(options); + await ds.initialize(); + const user = new User(1, 'opentelemetry', 'io'); - await connection.manager.save(user); + await ds.manager.save(user); const typeOrmSpans = getTestSpans(); assert.strictEqual(typeOrmSpans.length, 1); @@ -64,13 +66,14 @@ describe('EntityManager', () => { attributes[ATTR_DB_QUERY_TEXT], JSON.stringify({ targetOrEntity: user }) ); - await connection.destroy(); + await ds.destroy(); }); it('save', async () => { const options = defaultOptions; - const connection = await typeorm.createConnection(defaultOptions); - const manager = connection.createEntityManager(); + const ds = new typeorm.DataSource(options); + await ds.initialize(); + const manager = ds.manager; const user = new User(1, 'opentelemetry', 'io'); await manager.save(user); const typeOrmSpans = getTestSpans(); @@ -86,13 +89,14 @@ describe('EntityManager', () => { attributes[ATTR_DB_QUERY_TEXT], JSON.stringify({ targetOrEntity: user }) ); - await connection.destroy(); + await ds.destroy(); }); it('remove', async () => { const options = defaultOptions; - const connection = await typeorm.createConnection(defaultOptions); - const manager = connection.createEntityManager(); + const ds = new typeorm.DataSource(options); + await ds.initialize(); + const manager = ds.manager; const user = new User(56, 'opentelemetry', 'io'); await manager.save(user); @@ -116,13 +120,14 @@ describe('EntityManager', () => { }, }) ); - await connection.destroy(); + await ds.destroy(); }); it('update', async () => { const options = defaultOptions; - const connection = await typeorm.createConnection(defaultOptions); - const manager = connection.createEntityManager(); + const ds = new typeorm.DataSource(options); + await ds.initialize(); + const manager = ds.manager; const user = new User(56, 'opentelemetry', 'io'); await manager.save(user); const partialEntity = { lastName: '.io' }; @@ -140,12 +145,13 @@ describe('EntityManager', () => { attributes[ATTR_DB_QUERY_TEXT], JSON.stringify({ target: 'User', criteria: 56, partialEntity }) ); - await connection.destroy(); + await ds.destroy(); }); it('Sets failure status when function throws', async () => { - const connection = await typeorm.createConnection(defaultOptions); - const manager = connection.createEntityManager(); + const ds = new typeorm.DataSource(defaultOptions); + await ds.initialize(); + const manager = ds.manager; try { await manager.find({} as any); } catch (err) {} @@ -157,7 +163,7 @@ describe('EntityManager', () => { typeOrmSpans[0].status.message, 'No metadata for "[object Object]" was found.' ); - await connection.destroy(); + await ds.destroy(); }); }); @@ -171,12 +177,13 @@ describe('EntityManager', () => { }; it('appends matching connection details to span', async () => { - const [sqlite1, sqlite2] = await typeorm.createConnections([ - defaultOptions, - options2, - ]); - const manager1 = sqlite1.createEntityManager(); - const manager2 = sqlite2.createEntityManager(); + const ds1 = new typeorm.DataSource(defaultOptions); + await ds1.initialize(); + const ds2 = new typeorm.DataSource(options2); + await ds2.initialize(); + + const manager1 = ds1.manager; + const manager2 = ds2.manager; const user = new User(1, 'opentelemetry', 'io'); await manager1.save(user); @@ -220,8 +227,8 @@ describe('EntityManager', () => { sqlite2Span.attributes[ATTR_DB_COLLECTION_NAME], 'user' ); - await sqlite1.destroy(); - await sqlite2.destroy(); + await ds1.destroy(); + await ds2.destroy(); }); }); }); diff --git a/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts b/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts index ee6541e2d1..1afe942930 100644 --- a/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts +++ b/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts @@ -46,11 +46,9 @@ describe('QueryBuilder', () => { }); it('getManyAndCount', async () => { - const connectionOptions = defaultOptions as any; - const connection = await typeorm.createConnection(connectionOptions); - const queryBuilder = connection - .getRepository(User) - .createQueryBuilder('user'); + const ds = new typeorm.DataSource(defaultOptions); + await ds.initialize(); + const queryBuilder = ds.getRepository(User).createQueryBuilder('user'); const users = await queryBuilder .where('user.id = :userId', { userId: '1' }) .getManyAndCount(); @@ -59,18 +57,15 @@ describe('QueryBuilder', () => { assert.strictEqual(typeOrmSpans.length, 1); assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[0].attributes; - assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], connectionOptions.type); - assert.strictEqual(attributes[ATTR_SERVER_ADDRESS], connectionOptions.host); - assert.strictEqual(attributes[ATTR_SERVER_PORT], connectionOptions.port); - assert.strictEqual( - attributes[ATTR_DB_NAMESPACE], - connectionOptions.database - ); + assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], defaultOptions.type); + assert.strictEqual(attributes[ATTR_SERVER_ADDRESS], defaultOptions.host); + assert.strictEqual(attributes[ATTR_SERVER_PORT], defaultOptions.port); + assert.strictEqual(attributes[ATTR_DB_NAMESPACE], defaultOptions.database); assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); assert.strictEqual( attributes[ATTR_DB_QUERY_TEXT], 'SELECT "user"."id" AS "user_id", "user"."firstName" AS "user_firstName", "user"."lastName" AS "user_lastName" FROM "user" "user" WHERE "user"."id" = :userId' ); - await connection.destroy(); + await ds.destroy(); }); }); diff --git a/plugins/node/instrumentation-typeorm/test/Repository.test.ts b/plugins/node/instrumentation-typeorm/test/Repository.test.ts index 9315eba937..27a5b620f9 100644 --- a/plugins/node/instrumentation-typeorm/test/Repository.test.ts +++ b/plugins/node/instrumentation-typeorm/test/Repository.test.ts @@ -38,8 +38,9 @@ describe('Repository', () => { }); it('findAndCount', async () => { - const connection = await typeorm.createConnection(defaultOptions); - const repo = connection.getRepository(User); + const ds = new typeorm.DataSource(defaultOptions); + await ds.initialize(); + const repo = ds.getRepository(User); const [_users, count] = await repo.findAndCount(); assert(count === 0); const spans = getTestSpans(); @@ -47,6 +48,6 @@ describe('Repository', () => { const span = spans[0]; const attributes = span.attributes; assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); - await connection.destroy(); + await ds.destroy(); }); }); diff --git a/plugins/node/instrumentation-typeorm/test/config.test.ts b/plugins/node/instrumentation-typeorm/test/config.test.ts index e94f7de799..f1854002b8 100644 --- a/plugins/node/instrumentation-typeorm/test/config.test.ts +++ b/plugins/node/instrumentation-typeorm/test/config.test.ts @@ -54,9 +54,10 @@ describe('TypeormInstrumentationConfig', () => { instrumentation.setConfig(config); instrumentation.enable(); - const connection = await typeorm.createConnection(defaultOptions); + const ds = new typeorm.DataSource(defaultOptions); + await ds.initialize(); const user = new User(1, 'opentelemetry', 'io'); - await connection.manager.save(user); + await ds.manager.save(user); const typeOrmSpans = getTestSpans(); assert.strictEqual(typeOrmSpans.length, 1); const attributes = typeOrmSpans[0].attributes; @@ -64,7 +65,7 @@ describe('TypeormInstrumentationConfig', () => { assert.strictEqual(attributes['test'], JSON.stringify(user)); assert.strictEqual(attributes[ATTR_DB_OPERATION_NAME], 'save'); assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], defaultOptions.type); - await connection.destroy(); + await ds.destroy(); }); it('enableInternalInstrumentation:true', async () => { @@ -72,8 +73,9 @@ describe('TypeormInstrumentationConfig', () => { enableInternalInstrumentation: true, }; instrumentation.setConfig(config); - const connection = await typeorm.createConnection(defaultOptions); - await connection.manager.findAndCount(User); + const ds = new typeorm.DataSource(defaultOptions); + await ds.initialize(); + await ds.manager.findAndCount(User); const spans = getTestSpans(); assert.strictEqual(spans.length, 2); @@ -97,7 +99,7 @@ describe('TypeormInstrumentationConfig', () => { 'select' ); assert.strictEqual(selectSpan?.attributes[ATTR_DB_COLLECTION_NAME], 'user'); - await connection.destroy(); + await ds.destroy(); }); it('enableInternalInstrumentation:false', async () => { @@ -105,15 +107,16 @@ describe('TypeormInstrumentationConfig', () => { enableInternalInstrumentation: false, }; instrumentation.setConfig(config); - const connection = await typeorm.createConnection(defaultOptions); - await connection.manager.findAndCount(User); + const ds = new typeorm.DataSource(defaultOptions); + await ds.initialize(); + await ds.manager.findAndCount(User); const spans = getTestSpans(); assert.strictEqual(spans.length, 1); const attributes = spans[0].attributes; assert.strictEqual(attributes[ATTR_DB_OPERATION_NAME], 'findAndCount'); assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], defaultOptions.type); assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); - await connection.destroy(); + await ds.destroy(); }); it('enhancedDatabaseReporting:true', async () => { @@ -121,9 +124,10 @@ describe('TypeormInstrumentationConfig', () => { enhancedDatabaseReporting: true, }; instrumentation.setConfig(config); - const connectionOptions = defaultOptions as any; - const connection = await typeorm.createConnection(connectionOptions); - await connection + const connectionOptions = defaultOptions; + const ds = new typeorm.DataSource(connectionOptions); + await ds.initialize(); + await ds .getRepository(User) .createQueryBuilder('user') .where('user.id = :userId', { userId: '1' }) @@ -150,6 +154,6 @@ describe('TypeormInstrumentationConfig', () => { attributes[ExtendedDatabaseAttribute.DB_STATEMENT_PARAMETERS], JSON.stringify({ userId: '1', firstName: 'bob', lastName: 'dow' }) ); - await connection.destroy(); + await ds.destroy(); }); }); diff --git a/plugins/node/instrumentation-typeorm/test/utils.ts b/plugins/node/instrumentation-typeorm/test/utils.ts index acc9c3dd82..9cd897098b 100644 --- a/plugins/node/instrumentation-typeorm/test/utils.ts +++ b/plugins/node/instrumentation-typeorm/test/utils.ts @@ -33,8 +33,6 @@ export class User { } } -// type is typeorm.ConnectionOptions for <0.3.0 -// and typeorm.DataSourceOptions for >=0.3.0 export const defaultOptions: any = { type: 'sqlite', database: ':memory:', From 0d88138d436071e8e9005ed97984f65ecccd0108 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 15 Apr 2025 16:01:05 +0300 Subject: [PATCH 37/41] get rid of rawQueryOptions --- .../node/instrumentation-typeorm/test/Connection.test.ts | 4 ++-- plugins/node/instrumentation-typeorm/test/utils.ts | 9 --------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/plugins/node/instrumentation-typeorm/test/Connection.test.ts b/plugins/node/instrumentation-typeorm/test/Connection.test.ts index d3a730b0ad..0b31d198f4 100644 --- a/plugins/node/instrumentation-typeorm/test/Connection.test.ts +++ b/plugins/node/instrumentation-typeorm/test/Connection.test.ts @@ -32,7 +32,7 @@ const instrumentation = registerInstrumentationTesting( ); import * as typeorm from 'typeorm'; -import { rawQueryOptions } from './utils'; +import { defaultOptions } from './utils'; describe('Connection', () => { after(() => { @@ -47,7 +47,7 @@ describe('Connection', () => { describe('single connection', () => { it('raw query', async () => { - const options = rawQueryOptions; + const options = { ...defaultOptions, name: 'rawQuery' }; const ds = new typeorm.DataSource(options); await ds.initialize(); const query = 'select * from user'; diff --git a/plugins/node/instrumentation-typeorm/test/utils.ts b/plugins/node/instrumentation-typeorm/test/utils.ts index 9cd897098b..9c039e4685 100644 --- a/plugins/node/instrumentation-typeorm/test/utils.ts +++ b/plugins/node/instrumentation-typeorm/test/utils.ts @@ -40,12 +40,3 @@ export const defaultOptions: any = { synchronize: true, entities: [User], }; - -export const rawQueryOptions: any = { - type: 'sqlite', - database: ':memory:', - dropSchema: true, - synchronize: true, - entities: [User], - name: 'rawQuery', -}; From c3739b0c2a41f0655990e8bc11cc5e89ee9a29ad Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 15 Apr 2025 16:38:40 +0300 Subject: [PATCH 38/41] update span names to latest semconv --- .../instrumentation-typeorm/src/typeorm.ts | 23 ++++++++++++++----- .../test/Connection.test.ts | 1 + .../test/EntityManager.test.ts | 7 ++++++ .../test/QueryBuilder.test.ts | 1 + .../test/Repository.test.ts | 1 + 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/plugins/node/instrumentation-typeorm/src/typeorm.ts b/plugins/node/instrumentation-typeorm/src/typeorm.ts index 2f0db1700f..b655551eac 100644 --- a/plugins/node/instrumentation-typeorm/src/typeorm.ts +++ b/plugins/node/instrumentation-typeorm/src/typeorm.ts @@ -223,10 +223,13 @@ export class TypeormInstrumentation extends InstrumentationBase { }); return statement; }; + +function buildSpanName(operation: string, target: string | undefined): string { + if (target !== undefined) { + return `${operation} ${target}`; + } + + return operation; +} diff --git a/plugins/node/instrumentation-typeorm/test/Connection.test.ts b/plugins/node/instrumentation-typeorm/test/Connection.test.ts index 0b31d198f4..8999c67576 100644 --- a/plugins/node/instrumentation-typeorm/test/Connection.test.ts +++ b/plugins/node/instrumentation-typeorm/test/Connection.test.ts @@ -55,6 +55,7 @@ describe('Connection', () => { const typeOrmSpans = getTestSpans(); assert.strictEqual(typeOrmSpans.length, 1); + assert.strictEqual(typeOrmSpans[0].name, 'raw query'); assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[0].attributes; assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], options.type); diff --git a/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts b/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts index b476ff8b4a..605ce93594 100644 --- a/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts +++ b/plugins/node/instrumentation-typeorm/test/EntityManager.test.ts @@ -56,6 +56,7 @@ describe('EntityManager', () => { const typeOrmSpans = getTestSpans(); assert.strictEqual(typeOrmSpans.length, 1); + assert.strictEqual(typeOrmSpans[0].name, 'save user'); assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[0].attributes; assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); @@ -79,6 +80,7 @@ describe('EntityManager', () => { const typeOrmSpans = getTestSpans(); assert.strictEqual(typeOrmSpans.length, 1); + assert.strictEqual(typeOrmSpans[0].name, 'save user'); assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[0].attributes; assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); @@ -104,6 +106,7 @@ describe('EntityManager', () => { const typeOrmSpans = getTestSpans(); assert.strictEqual(typeOrmSpans.length, 2); + assert.strictEqual(typeOrmSpans[1].name, 'remove user'); assert.strictEqual(typeOrmSpans[1].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[1].attributes; assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); @@ -135,6 +138,7 @@ describe('EntityManager', () => { const typeOrmSpans = getTestSpans(); assert.strictEqual(typeOrmSpans.length, 2); + assert.strictEqual(typeOrmSpans[1].name, 'update user'); assert.strictEqual(typeOrmSpans[1].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[1].attributes; assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); @@ -158,6 +162,7 @@ describe('EntityManager', () => { const typeOrmSpans = getTestSpans(); assert.strictEqual(typeOrmSpans.length, 1); + assert.strictEqual(typeOrmSpans[0].name, 'find'); assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.ERROR); assert.strictEqual( typeOrmSpans[0].status.message, @@ -194,6 +199,7 @@ describe('EntityManager', () => { const sqlite1Span = spans[0]; const sqlite2Span = spans[1]; + assert.strictEqual(sqlite1Span.name, 'save user'); assert.strictEqual( sqlite1Span.attributes[ATTR_DB_SYSTEM_NAME], defaultOptions.type @@ -211,6 +217,7 @@ describe('EntityManager', () => { 'user' ); + assert.strictEqual(sqlite2Span.name, 'remove user'); assert.strictEqual( sqlite2Span.attributes[ATTR_DB_SYSTEM_NAME], options2.type diff --git a/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts b/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts index 1afe942930..710155d7cf 100644 --- a/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts +++ b/plugins/node/instrumentation-typeorm/test/QueryBuilder.test.ts @@ -55,6 +55,7 @@ describe('QueryBuilder', () => { assert.strictEqual(users.length, 2); const typeOrmSpans = getTestSpans(); assert.strictEqual(typeOrmSpans.length, 1); + assert.strictEqual(typeOrmSpans[0].name, 'select user'); assert.strictEqual(typeOrmSpans[0].status.code, SpanStatusCode.UNSET); const attributes = typeOrmSpans[0].attributes; assert.strictEqual(attributes[ATTR_DB_SYSTEM_NAME], defaultOptions.type); diff --git a/plugins/node/instrumentation-typeorm/test/Repository.test.ts b/plugins/node/instrumentation-typeorm/test/Repository.test.ts index 27a5b620f9..8dec19a1f1 100644 --- a/plugins/node/instrumentation-typeorm/test/Repository.test.ts +++ b/plugins/node/instrumentation-typeorm/test/Repository.test.ts @@ -47,6 +47,7 @@ describe('Repository', () => { assert.strictEqual(spans.length, 1); const span = spans[0]; const attributes = span.attributes; + assert.strictEqual(span.name, 'findAndCount user'); assert.strictEqual(attributes[ATTR_DB_COLLECTION_NAME], 'user'); await ds.destroy(); }); From 0ea6adea2e6517b1d7d4cf675ac893aca64e3d3f Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Fri, 25 Apr 2025 11:05:09 +0300 Subject: [PATCH 39/41] add additional component owners --- .github/component_owners.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/component_owners.yml b/.github/component_owners.yml index aad862c656..53ad4775c1 100644 --- a/.github/component_owners.yml +++ b/.github/component_owners.yml @@ -75,6 +75,8 @@ components: plugins/node/instrumentation-typeorm: - seemk - weyert + - t2t2 + - mhennoch plugins/node/opentelemetry-instrumentation-aws-lambda: - jj22ee plugins/node/opentelemetry-instrumentation-aws-sdk: From c0fe8e6ecf0f5ba27649ffb1197916e1e59d6e0f Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 29 Apr 2025 11:12:34 +0300 Subject: [PATCH 40/41] update package-lock --- package-lock.json | 420 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 420 insertions(+) diff --git a/package-lock.json b/package-lock.json index c80cf23680..ffd91915b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34629,6 +34629,17 @@ "undici-types": "~5.26.4" } }, + "plugins/node/instrumentation-typeorm/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "plugins/node/instrumentation-typeorm/node_modules/bson": { "version": "5.5.1", "resolved": "https://registry.npmjs.org/bson/-/bson-5.5.1.tgz", @@ -34666,6 +34677,35 @@ "ieee754": "^1.2.1" } }, + "plugins/node/instrumentation-typeorm/node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true, + "license": "MIT" + }, "plugins/node/instrumentation-typeorm/node_modules/dotenv": { "version": "16.4.7", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", @@ -34679,6 +34719,20 @@ "url": "https://dotenvx.com" } }, + "plugins/node/instrumentation-typeorm/node_modules/foreground-child": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8.0.0" + } + }, "plugins/node/instrumentation-typeorm/node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -34700,6 +34754,19 @@ ], "license": "BSD-3-Clause" }, + "plugins/node/instrumentation-typeorm/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "plugins/node/instrumentation-typeorm/node_modules/mongodb": { "version": "5.9.2", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.9.2.tgz", @@ -34744,6 +34811,123 @@ } } }, + "plugins/node/instrumentation-typeorm/node_modules/nyc": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-15.1.0.tgz", + "integrity": "sha512-jMW04n9SxKdKi1ZMGhvUTHBN0EICCRkHemEoE5jm6mTYcqcdas0ATzgUgejlQUHMvpnOZqGB5Xxsv9KxJW1j8A==", + "dev": true, + "license": "ISC", + "dependencies": { + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "caching-transform": "^4.0.0", + "convert-source-map": "^1.7.0", + "decamelize": "^1.2.0", + "find-cache-dir": "^3.2.0", + "find-up": "^4.1.0", + "foreground-child": "^2.0.0", + "get-package-type": "^0.1.0", + "glob": "^7.1.6", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-hook": "^3.0.0", + "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-processinfo": "^2.0.2", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.2", + "make-dir": "^3.0.0", + "node-preload": "^0.2.1", + "p-map": "^3.0.0", + "process-on-spawn": "^1.0.0", + "resolve-from": "^5.0.0", + "rimraf": "^3.0.0", + "signal-exit": "^3.0.2", + "spawn-wrap": "^2.0.0", + "test-exclude": "^6.0.0", + "yargs": "^15.0.2" + }, + "bin": { + "nyc": "bin/nyc.js" + }, + "engines": { + "node": ">=8.9" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/nyc/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/nyc/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/nyc/node_modules/yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "plugins/node/instrumentation-typeorm/node_modules/reflect-metadata": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", @@ -34752,6 +34936,13 @@ "license": "Apache-2.0", "peer": true }, + "plugins/node/instrumentation-typeorm/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, "plugins/node/instrumentation-typeorm/node_modules/typeorm": { "version": "0.3.21", "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.21.tgz", @@ -34858,6 +35049,20 @@ } } }, + "plugins/node/instrumentation-typeorm/node_modules/typescript": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=12.20" + } + }, "plugins/node/instrumentation-typeorm/node_modules/uuid": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", @@ -34872,6 +35077,42 @@ "uuid": "dist/esm/bin/uuid" } }, + "plugins/node/instrumentation-typeorm/node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "plugins/node/instrumentation-typeorm/node_modules/y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "dev": true, + "license": "ISC" + }, + "plugins/node/instrumentation-typeorm/node_modules/yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, "plugins/node/instrumentation-undici": { "name": "@opentelemetry/instrumentation-undici", "version": "0.11.0", @@ -45191,6 +45432,16 @@ "undici-types": "~5.26.4" } }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "bson": { "version": "5.5.1", "resolved": "https://registry.npmjs.org/bson/-/bson-5.5.1.tgz", @@ -45209,18 +45460,60 @@ "ieee754": "^1.2.1" } }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true + }, "dotenv": { "version": "16.4.7", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", "dev": true }, + "foreground-child": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" + } + }, "ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "dev": true }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, "mongodb": { "version": "5.9.2", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.9.2.tgz", @@ -45235,6 +45528,94 @@ "socks": "^2.7.1" } }, + "nyc": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-15.1.0.tgz", + "integrity": "sha512-jMW04n9SxKdKi1ZMGhvUTHBN0EICCRkHemEoE5jm6mTYcqcdas0ATzgUgejlQUHMvpnOZqGB5Xxsv9KxJW1j8A==", + "dev": true, + "requires": { + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "caching-transform": "^4.0.0", + "convert-source-map": "^1.7.0", + "decamelize": "^1.2.0", + "find-cache-dir": "^3.2.0", + "find-up": "^4.1.0", + "foreground-child": "^2.0.0", + "get-package-type": "^0.1.0", + "glob": "^7.1.6", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-hook": "^3.0.0", + "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-processinfo": "^2.0.2", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.2", + "make-dir": "^3.0.0", + "node-preload": "^0.2.1", + "p-map": "^3.0.0", + "process-on-spawn": "^1.0.0", + "resolve-from": "^5.0.0", + "rimraf": "^3.0.0", + "signal-exit": "^3.0.2", + "spawn-wrap": "^2.0.0", + "test-exclude": "^6.0.0", + "yargs": "^15.0.2" + }, + "dependencies": { + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + } + } + } + }, + "p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, "reflect-metadata": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", @@ -45242,6 +45623,12 @@ "dev": true, "peer": true }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, "typeorm": { "version": "0.3.21", "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.21.tgz", @@ -45263,11 +45650,44 @@ "yargs": "^17.6.2" } }, + "typescript": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "dev": true + }, "uuid": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", "dev": true + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "dev": true + }, + "yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } } } }, From 71a25ab03773e332e915781585d400995e429f7d Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 29 Apr 2025 11:51:37 +0300 Subject: [PATCH 41/41] ci