diff --git a/.github/workflows/close-stale.yml b/.github/workflows/close-stale.yml index 2eb02a4d6f..442db8b66d 100644 --- a/.github/workflows/close-stale.yml +++ b/.github/workflows/close-stale.yml @@ -7,7 +7,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v4 + - uses: actions/stale@v5 with: days-before-stale: 60 days-before-close: 14 diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index fe461b1ec4..6d3aae6883 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -8,7 +8,7 @@ jobs: release-please: runs-on: ubuntu-latest steps: - - uses: google-github-actions/release-please-action@v2 + - uses: google-github-actions/release-please-action@v3 id: release with: command: manifest @@ -23,7 +23,7 @@ jobs: fetch-depth: 0 - name: Setup Node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{ steps.release.outputs.releases_created }} with: node-version: 14 diff --git a/.github/workflows/test-all-versions.yml b/.github/workflows/test-all-versions.yml index 617e2ebc28..e14436c165 100644 --- a/.github/workflows/test-all-versions.yml +++ b/.github/workflows/test-all-versions.yml @@ -119,7 +119,7 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - name: Cache Dependencies diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 7935ff7917..89cc20835e 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -113,7 +113,7 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - name: Cache Dependencies @@ -163,7 +163,7 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - name: Cache Dependencies diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 47b1adabb2..07ac787357 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1 +1 @@ -{"detectors/node/opentelemetry-resource-detector-alibaba-cloud":"0.26.2","detectors/node/opentelemetry-resource-detector-aws":"1.0.3","detectors/node/opentelemetry-resource-detector-gcp":"0.26.2","detectors/node/opentelemetry-resource-detector-github":"0.26.1","metapackages/auto-instrumentations-node":"0.27.3","metapackages/auto-instrumentations-web":"0.27.2","packages/opentelemetry-browser-extension-autoinjection":"0.27.3","packages/opentelemetry-host-metrics":"0.27.1","packages/opentelemetry-id-generator-aws-xray":"1.0.1","packages/opentelemetry-test-utils":"0.29.0","plugins/node/instrumentation-tedious":"0.1.0","plugins/node/opentelemetry-instrumentation-aws-lambda":"0.29.0","plugins/node/opentelemetry-instrumentation-aws-sdk":"0.5.0","plugins/node/opentelemetry-instrumentation-bunyan":"0.27.1","plugins/node/opentelemetry-instrumentation-cassandra":"0.27.1","plugins/node/opentelemetry-instrumentation-connect":"0.27.1","plugins/node/opentelemetry-instrumentation-dns":"0.27.1","plugins/node/opentelemetry-instrumentation-express":"0.28.0","plugins/node/opentelemetry-instrumentation-generic-pool":"0.27.2","plugins/node/opentelemetry-instrumentation-graphql":"0.27.3","plugins/node/opentelemetry-instrumentation-hapi":"0.27.1","plugins/node/opentelemetry-instrumentation-ioredis":"0.27.1","plugins/node/opentelemetry-instrumentation-knex":"0.27.1","plugins/node/opentelemetry-instrumentation-koa":"0.28.1","plugins/node/opentelemetry-instrumentation-memcached":"0.27.1","plugins/node/opentelemetry-instrumentation-mongodb":"0.28.0","plugins/node/opentelemetry-instrumentation-mysql":"0.27.1","plugins/node/opentelemetry-instrumentation-mysql2":"0.28.0","plugins/node/opentelemetry-instrumentation-nestjs-core":"0.28.3","plugins/node/opentelemetry-instrumentation-net":"0.27.1","plugins/node/opentelemetry-instrumentation-pg":"0.28.0","plugins/node/opentelemetry-instrumentation-pino":"0.28.1","plugins/node/opentelemetry-instrumentation-redis":"0.28.0","plugins/node/opentelemetry-instrumentation-restify":"0.27.2","plugins/node/opentelemetry-instrumentation-router":"0.27.1","plugins/node/opentelemetry-instrumentation-winston":"0.27.1","plugins/web/opentelemetry-instrumentation-document-load":"0.27.1","plugins/web/opentelemetry-instrumentation-user-interaction":"0.28.1","plugins/web/opentelemetry-plugin-react-load":"0.26.1","propagators/opentelemetry-propagator-aws-xray":"1.0.1","propagators/opentelemetry-propagator-grpc-census-binary":"0.25.1","propagators/opentelemetry-propagator-ot-trace":"0.25.1","plugins/node/opentelemetry-instrumentation-fastify":"0.25.0"} \ No newline at end of file +{"detectors/node/opentelemetry-resource-detector-alibaba-cloud":"0.26.2","detectors/node/opentelemetry-resource-detector-aws":"1.0.3","detectors/node/opentelemetry-resource-detector-gcp":"0.26.2","detectors/node/opentelemetry-resource-detector-github":"0.26.1","metapackages/auto-instrumentations-node":"0.27.3","metapackages/auto-instrumentations-web":"0.27.2","packages/opentelemetry-browser-extension-autoinjection":"0.27.4","packages/opentelemetry-host-metrics":"0.27.1","packages/opentelemetry-id-generator-aws-xray":"1.0.1","packages/opentelemetry-test-utils":"0.29.0","plugins/node/instrumentation-tedious":"0.1.0","plugins/node/opentelemetry-instrumentation-aws-lambda":"0.29.0","plugins/node/opentelemetry-instrumentation-aws-sdk":"0.5.1","plugins/node/opentelemetry-instrumentation-bunyan":"0.27.1","plugins/node/opentelemetry-instrumentation-cassandra":"0.27.1","plugins/node/opentelemetry-instrumentation-connect":"0.27.1","plugins/node/opentelemetry-instrumentation-dns":"0.27.1","plugins/node/opentelemetry-instrumentation-express":"0.28.0","plugins/node/opentelemetry-instrumentation-generic-pool":"0.27.2","plugins/node/opentelemetry-instrumentation-graphql":"0.27.4","plugins/node/opentelemetry-instrumentation-hapi":"0.27.1","plugins/node/opentelemetry-instrumentation-ioredis":"0.28.0","plugins/node/opentelemetry-instrumentation-knex":"0.27.1","plugins/node/opentelemetry-instrumentation-koa":"0.28.1","plugins/node/opentelemetry-instrumentation-memcached":"0.27.1","plugins/node/opentelemetry-instrumentation-mongodb":"0.29.0","plugins/node/opentelemetry-instrumentation-mysql":"0.28.0","plugins/node/opentelemetry-instrumentation-mysql2":"0.29.0","plugins/node/opentelemetry-instrumentation-nestjs-core":"0.28.3","plugins/node/opentelemetry-instrumentation-net":"0.27.1","plugins/node/opentelemetry-instrumentation-pg":"0.28.0","plugins/node/opentelemetry-instrumentation-pino":"0.28.1","plugins/node/opentelemetry-instrumentation-redis":"0.29.0","plugins/node/opentelemetry-instrumentation-restify":"0.27.2","plugins/node/opentelemetry-instrumentation-router":"0.27.1","plugins/node/opentelemetry-instrumentation-winston":"0.27.2","plugins/web/opentelemetry-instrumentation-document-load":"0.27.1","plugins/web/opentelemetry-instrumentation-user-interaction":"0.28.1","plugins/web/opentelemetry-plugin-react-load":"0.26.1","propagators/opentelemetry-propagator-aws-xray":"1.0.1","propagators/opentelemetry-propagator-grpc-census-binary":"0.25.1","propagators/opentelemetry-propagator-ot-trace":"0.25.1","plugins/node/opentelemetry-instrumentation-fastify":"0.26.0","packages/opentelemetry-propagation-utils":"0.27.0","plugins/web/opentelemetry-instrumentation-long-task":"0.28.0"} \ No newline at end of file diff --git a/detectors/node/opentelemetry-resource-detector-alibaba-cloud/package.json b/detectors/node/opentelemetry-resource-detector-alibaba-cloud/package.json index c0405235d0..6f6f058602 100644 --- a/detectors/node/opentelemetry-resource-detector-alibaba-cloud/package.json +++ b/detectors/node/opentelemetry-resource-detector-alibaba-cloud/package.json @@ -7,15 +7,14 @@ "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "clean": "rimraf build/*", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/resource-detector-alibaba-cloud --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/resource-detector-alibaba-cloud --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "tdd": "npm run test -- --watch-extensions ts --watch", - "version:update": "node ../../../scripts/version-update.js", "watch": "tsc -w" }, "keywords": [ diff --git a/detectors/node/opentelemetry-resource-detector-aws/package.json b/detectors/node/opentelemetry-resource-detector-aws/package.json index ebaca916d1..6e1a2fd6ab 100644 --- a/detectors/node/opentelemetry-resource-detector-aws/package.json +++ b/detectors/node/opentelemetry-resource-detector-aws/package.json @@ -7,15 +7,14 @@ "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "clean": "rimraf build/*", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/resource-detector-aws --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/resource-detector-aws --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "tdd": "npm run test -- --watch-extensions ts --watch", - "version:update": "node ../../../scripts/version-update.js", "watch": "tsc -w" }, "keywords": [ diff --git a/detectors/node/opentelemetry-resource-detector-gcp/package.json b/detectors/node/opentelemetry-resource-detector-gcp/package.json index 50ae8a5304..3ae7fa6318 100644 --- a/detectors/node/opentelemetry-resource-detector-gcp/package.json +++ b/detectors/node/opentelemetry-resource-detector-gcp/package.json @@ -7,15 +7,14 @@ "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "clean": "rimraf build/*", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/resource-detector-gcp --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/resource-detector-gcp --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "tdd": "npm run test -- --watch-extensions ts --watch", - "version:update": "node ../../../scripts/version-update.js", "watch": "tsc -w" }, "keywords": [ @@ -65,4 +64,4 @@ "gcp-metadata": "^4.1.4", "semver": "7.3.5" } -} \ No newline at end of file +} diff --git a/detectors/node/opentelemetry-resource-detector-github/package.json b/detectors/node/opentelemetry-resource-detector-github/package.json index 4fa4623286..e48d30527f 100644 --- a/detectors/node/opentelemetry-resource-detector-github/package.json +++ b/detectors/node/opentelemetry-resource-detector-github/package.json @@ -7,15 +7,14 @@ "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "clean": "rimraf build/*", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/resource-detector-github --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/resource-detector-github --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "tdd": "npm run test -- --watch-extensions ts --watch", - "version:update": "node ../../../scripts/version-update.js", "watch": "tsc -w" }, "keywords": [ diff --git a/metapackages/auto-instrumentations-node/CHANGELOG.md b/metapackages/auto-instrumentations-node/CHANGELOG.md index 528dbdc11e..409c388473 100644 --- a/metapackages/auto-instrumentations-node/CHANGELOG.md +++ b/metapackages/auto-instrumentations-node/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @opentelemetry/instrumentation-aws-sdk bumped from ^0.5.0 to ^0.5.1 + * @opentelemetry/instrumentation-fastify bumped from ^0.25.0 to ^0.26.0 + * @opentelemetry/instrumentation-graphql bumped from ^0.27.3 to ^0.27.4 + * @opentelemetry/instrumentation-ioredis bumped from ^0.27.1 to ^0.28.0 + * @opentelemetry/instrumentation-mongodb bumped from ^0.28.0 to ^0.29.0 + * @opentelemetry/instrumentation-mysql bumped from ^0.27.1 to ^0.28.0 + * @opentelemetry/instrumentation-mysql2 bumped from ^0.28.0 to ^0.29.0 + * @opentelemetry/instrumentation-redis bumped from ^0.28.0 to ^0.29.0 + * @opentelemetry/instrumentation-winston bumped from ^0.27.0 to ^0.27.2 + ### [0.27.3](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/auto-instrumentations-node-v0.27.2...auto-instrumentations-node-v0.27.3) (2022-02-06) @@ -111,4 +125,4 @@ * @opentelemetry/instrumentation-mongodb bumped from ^0.25.0 to ^0.26.0 * @opentelemetry/instrumentation-mysql bumped from ^0.25.0 to ^0.26.0 * @opentelemetry/instrumentation-pg bumped from ^0.25.0 to ^0.26.0 - * @opentelemetry/instrumentation-redis bumped from ^0.25.0 to ^0.26.0 \ No newline at end of file + * @opentelemetry/instrumentation-redis bumped from ^0.25.0 to ^0.26.0 diff --git a/metapackages/auto-instrumentations-node/package.json b/metapackages/auto-instrumentations-node/package.json index 31afa2bad5..387d5922a0 100644 --- a/metapackages/auto-instrumentations-node/package.json +++ b/metapackages/auto-instrumentations-node/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/auto-instrumentations-node", - "version": "0.27.3", + "version": "0.27.4", "description": "Metapackage which bundles opentelemetry node core and contrib instrumentations", "author": "OpenTelemetry Authors", "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib#readme", @@ -16,7 +16,7 @@ "compile": "tsc -p .", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/auto-instrumentations-node --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/auto-instrumentations-node --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "tdd": "yarn test -- --watch-extensions ts --watch", @@ -45,31 +45,31 @@ "dependencies": { "@opentelemetry/instrumentation": "^0.27.0", "@opentelemetry/instrumentation-aws-lambda": "^0.29.0", - "@opentelemetry/instrumentation-aws-sdk": "^0.5.0", + "@opentelemetry/instrumentation-aws-sdk": "^0.5.1", "@opentelemetry/instrumentation-bunyan": "^0.27.0", "@opentelemetry/instrumentation-cassandra-driver": "^0.27.0", "@opentelemetry/instrumentation-connect": "^0.27.0", "@opentelemetry/instrumentation-dns": "^0.27.1", "@opentelemetry/instrumentation-express": "^0.28.0", - "@opentelemetry/instrumentation-fastify": "^0.25.0", + "@opentelemetry/instrumentation-fastify": "^0.26.0", "@opentelemetry/instrumentation-generic-pool": "^0.27.2", - "@opentelemetry/instrumentation-graphql": "^0.27.3", + "@opentelemetry/instrumentation-graphql": "^0.27.4", "@opentelemetry/instrumentation-grpc": "^0.27.0", "@opentelemetry/instrumentation-hapi": "^0.27.0", "@opentelemetry/instrumentation-http": "^0.27.0", - "@opentelemetry/instrumentation-ioredis": "^0.27.1", + "@opentelemetry/instrumentation-ioredis": "^0.28.0", "@opentelemetry/instrumentation-knex": "^0.27.0", "@opentelemetry/instrumentation-koa": "^0.28.1", "@opentelemetry/instrumentation-memcached": "^0.27.0", - "@opentelemetry/instrumentation-mongodb": "^0.28.0", - "@opentelemetry/instrumentation-mysql": "^0.27.1", - "@opentelemetry/instrumentation-mysql2": "^0.28.0", + "@opentelemetry/instrumentation-mongodb": "^0.29.0", + "@opentelemetry/instrumentation-mysql": "^0.28.0", + "@opentelemetry/instrumentation-mysql2": "^0.29.0", "@opentelemetry/instrumentation-nestjs-core": "^0.28.3", "@opentelemetry/instrumentation-net": "^0.27.0", "@opentelemetry/instrumentation-pg": "^0.28.0", "@opentelemetry/instrumentation-pino": "^0.28.0", - "@opentelemetry/instrumentation-redis": "^0.28.0", + "@opentelemetry/instrumentation-redis": "^0.29.0", "@opentelemetry/instrumentation-restify": "^0.27.2", - "@opentelemetry/instrumentation-winston": "^0.27.0" + "@opentelemetry/instrumentation-winston": "^0.27.2" } } diff --git a/metapackages/auto-instrumentations-web/package.json b/metapackages/auto-instrumentations-web/package.json index bd40925618..f9d415dcd1 100644 --- a/metapackages/auto-instrumentations-web/package.json +++ b/metapackages/auto-instrumentations-web/package.json @@ -17,11 +17,10 @@ "compile": "tsc --build tsconfig.json tsconfig.esm.json", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/auto-instrumentations-web --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/auto-instrumentations-web --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "test:browser": "nyc karma start --single-run", - "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json" }, "bugs": { @@ -41,7 +40,7 @@ "colors": "1.4.0", "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.14", + "karma": "6.3.16", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", diff --git a/package.json b/package.json index 96eae24821..87ff1588a1 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "clean": "lerna run clean", "postinstall": "npm run bootstrap", "prepare": "husky install", - "precompile": "tsc --version && lerna run version", + "precompile": "tsc --version && npm run version:update", "version:update": "lerna run version:update", "compile": "lerna run compile", "prewatch": "npm run precompile", diff --git a/packages/opentelemetry-browser-extension-autoinjection/CHANGELOG.md b/packages/opentelemetry-browser-extension-autoinjection/CHANGELOG.md index 145cbc3fe2..efe72cdd19 100644 --- a/packages/opentelemetry-browser-extension-autoinjection/CHANGELOG.md +++ b/packages/opentelemetry-browser-extension-autoinjection/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [0.27.4](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/browser-extension-autoinjection-v0.27.3...browser-extension-autoinjection-v0.27.4) (2022-03-02) + + +### Bug Fixes + +* **browser-extension-autoinjection:** update eslint-plugin-json5 version to 0.1.4 ([#896](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/896)) ([e47fcaa](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/e47fcaa1a04de35b096f373f44abbf87ff4125f2)) + ### [0.27.3](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/browser-extension-autoinjection-v0.27.2...browser-extension-autoinjection-v0.27.3) (2022-02-06) diff --git a/packages/opentelemetry-browser-extension-autoinjection/package.json b/packages/opentelemetry-browser-extension-autoinjection/package.json index 6c184538eb..a8a00deb4b 100644 --- a/packages/opentelemetry-browser-extension-autoinjection/package.json +++ b/packages/opentelemetry-browser-extension-autoinjection/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/browser-extension-autoinjection", - "version": "0.27.3", + "version": "0.27.4", "description": "A browser extension that injects opentelemetry tracers into any website", "scripts": { "clean": "rimraf build/*", @@ -10,7 +10,7 @@ "build:mv3": "npx webpack --mode=production --env MV=3", "lint": "eslint .", "lint:fix": "eslint . --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/browser-extension-autoinjection --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/browser-extension-autoinjection --include-dependencies", "prewatch": "npm run precompile", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "tdd": "npm run test -- --watch-extensions ts --watch", diff --git a/packages/opentelemetry-host-metrics/package.json b/packages/opentelemetry-host-metrics/package.json index 35ec944057..c5cfe2e1c0 100644 --- a/packages/opentelemetry-host-metrics/package.json +++ b/packages/opentelemetry-host-metrics/package.json @@ -7,10 +7,10 @@ "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "clean": "rimraf build/*", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/host-metrics --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/host-metrics --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", diff --git a/packages/opentelemetry-id-generator-aws-xray/package.json b/packages/opentelemetry-id-generator-aws-xray/package.json index 71b7edecbe..cac0cba173 100644 --- a/packages/opentelemetry-id-generator-aws-xray/package.json +++ b/packages/opentelemetry-id-generator-aws-xray/package.json @@ -15,7 +15,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "precompile": "tsc --version && lerna run version --scope @opentelemetry/id-generator-aws-xray --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/id-generator-aws-xray --include-dependencies", "prewatch": "npm run precompile", "compile": "tsc --build tsconfig.json tsconfig.esm.json", "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", @@ -23,7 +23,6 @@ "test:browser": "nyc karma start --single-run", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json", "prepare": "npm run compile" }, @@ -63,7 +62,7 @@ "colors": "1.4.0", "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.14", + "karma": "6.3.16", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", diff --git a/packages/opentelemetry-propagation-utils/CHANGELOG.md b/packages/opentelemetry-propagation-utils/CHANGELOG.md new file mode 100644 index 0000000000..2bc4f80ffe --- /dev/null +++ b/packages/opentelemetry-propagation-utils/CHANGELOG.md @@ -0,0 +1,14 @@ +# Changelog + +## [0.27.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/propagation-utils-v0.26.0...propagation-utils-v0.27.0) (2022-03-02) + + +### Features + +* **instrumentation-aws-sdk:** upstream aws-sdk instrumentation from ext-js ([#678](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/678)) ([f5851e7](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/f5851e72512117dbce571a42930a90c560dbf63d)) +* upstream mocha instrumentation testing plugin from ext-js [#621](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/621) ([#669](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/669)) ([a5170c4](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/a5170c494706a2bec3ba51e59966d0ca8a41d00e)) + + +### Bug Fixes + +* rename lerna's --include-filtered-dependencies option ([#817](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/817)) ([cf268e7](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/cf268e7a92b7800ad6dbec9ca77466f9ee03ee1a)) diff --git a/packages/opentelemetry-propagation-utils/package.json b/packages/opentelemetry-propagation-utils/package.json index fdd54c0943..f4c9a9652a 100644 --- a/packages/opentelemetry-propagation-utils/package.json +++ b/packages/opentelemetry-propagation-utils/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/propagation-utils", - "version": "0.26.0", + "version": "0.27.0", "description": "Propagation utilities for opentelemetry instrumentations", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -12,10 +12,9 @@ "compile": "tsc --build tsconfig.json tsconfig.esm.json", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/propagation-utils --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/propagation-utils --include-dependencies", "prepare": "npm run compile", "prewatch": "npm run precompile", - "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json" }, "repository": "open-telemetry/opentelemetry-js-contrib", @@ -45,4 +44,4 @@ "gts": "3.1.0", "typescript": "4.3.5" } -} \ No newline at end of file +} diff --git a/packages/opentelemetry-test-utils/package.json b/packages/opentelemetry-test-utils/package.json index 91f9635503..12f27a01f9 100644 --- a/packages/opentelemetry-test-utils/package.json +++ b/packages/opentelemetry-test-utils/package.json @@ -11,7 +11,7 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "compile": "tsc -p .", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/contrib-test-utils --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/contrib-test-utils --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "watch": "tsc -w" @@ -52,4 +52,4 @@ "@opentelemetry/sdk-trace-base": "1.0.1", "@opentelemetry/semantic-conventions": "1.0.1" } -} \ No newline at end of file +} diff --git a/plugins/node/instrumentation-tedious/package.json b/plugins/node/instrumentation-tedious/package.json index 5835a82b4d..0c65f1de96 100644 --- a/plugins/node/instrumentation-tedious/package.json +++ b/plugins/node/instrumentation-tedious/package.json @@ -7,10 +7,10 @@ "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "clean": "rimraf build/*", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "lint:fix": "eslint . --ext .ts --fix", "lint": "eslint . --ext .ts", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-tedious --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-tedious --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", diff --git a/plugins/node/instrumentation-tedious/test/instrumentation.test.ts b/plugins/node/instrumentation-tedious/test/instrumentation.test.ts index 0f8f8a74b6..5c18e8404d 100644 --- a/plugins/node/instrumentation-tedious/test/instrumentation.test.ts +++ b/plugins/node/instrumentation-tedious/test/instrumentation.test.ts @@ -16,7 +16,10 @@ import { context, trace, SpanStatusCode, SpanKind } from '@opentelemetry/api'; import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { + DbSystemValues, + SemanticAttributes, +} from '@opentelemetry/semantic-conventions'; import * as util from 'util'; import * as testUtils from '@opentelemetry/contrib-test-utils'; import { @@ -334,7 +337,10 @@ function assertSpan(span: ReadableSpan, expected: any) { assert(span); assert.strictEqual(span.name, expected.name); assert.strictEqual(span.kind, SpanKind.CLIENT); - assert.strictEqual(span.attributes[SemanticAttributes.DB_SYSTEM], 'mssql'); + assert.strictEqual( + span.attributes[SemanticAttributes.DB_SYSTEM], + DbSystemValues.MSSQL + ); assert.strictEqual( span.attributes[SemanticAttributes.DB_NAME], expected.database ?? database diff --git a/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json b/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json index 7126f2d18b..b10b68647f 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json +++ b/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json @@ -11,11 +11,11 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-aws-lambda --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-aws-lambda --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc -p ." + "compile": "tsc -p ." }, "keywords": [ "aws-lambda", diff --git a/plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts index 57ff18be58..f8d0c52289 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts @@ -190,7 +190,7 @@ export class AwsLambdaInstrumentation extends InstrumentationBase { ); } - return otelContext.with(trace.setSpan(otelContext.active(), span), () => { + return otelContext.with(trace.setSpan(parent, span), () => { // Lambda seems to pass a callback even if handler is of Promise form, so we wrap all the time before calling // the handler and see if the result is a Promise or not. In such a case, the callback is usually ignored. If // the handler happened to both call the callback and complete a returned Promise, whichever happens first will diff --git a/plugins/node/opentelemetry-instrumentation-aws-lambda/test/integrations/lambda-handler.test.ts b/plugins/node/opentelemetry-instrumentation-aws-lambda/test/integrations/lambda-handler.test.ts index 68cc1231ea..cabb6d0f37 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-lambda/test/integrations/lambda-handler.test.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-lambda/test/integrations/lambda-handler.test.ts @@ -626,6 +626,37 @@ describe('lambda handler', () => { assert.strictEqual(span.parentSpanId, sampledGenericSpanContext.spanId); }); + it('prefers to extract baggage over sampled lambda context if "eventContextExtractor" is defined', async () => { + process.env[traceContextEnvironmentKey] = sampledAwsHeader; + const customExtractor = (event: any): OtelContext => { + return propagation.extract( + context.active(), + event.customContextCarrier + ); + }; + + initializeHandler('lambda-test/async.handler_return_baggage', { + disableAwsContextPropagation: true, + eventContextExtractor: customExtractor, + }); + + const baggage = 'abcd=1234'; + const customRemoteEvent = { + customContextCarrier: { + traceparent: sampledGenericSpan, + baggage, + }, + }; + + const lambdaTestAsync = lambdaRequire('lambda-test/async'); + const actual = await lambdaTestAsync.handler_return_baggage( + customRemoteEvent, + ctx + ); + + assert.strictEqual(actual, baggage); + }); + it('creates trace from ROOT_CONTEXT when "disableAwsContextPropagation" is true, eventContextExtractor is provided, and no custom context is found', async () => { process.env[traceContextEnvironmentKey] = sampledAwsHeader; const customExtractor = (event: any): OtelContext => { diff --git a/plugins/node/opentelemetry-instrumentation-aws-lambda/test/lambda-test/async.js b/plugins/node/opentelemetry-instrumentation-aws-lambda/test/lambda-test/async.js index fe8bc5f9ff..c6c2e529cf 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-lambda/test/lambda-test/async.js +++ b/plugins/node/opentelemetry-instrumentation-aws-lambda/test/lambda-test/async.js @@ -30,3 +30,8 @@ exports.stringerror = async function (event, context) { exports.context = async function (event, context) { return api.trace.getSpan(api.context.active()).spanContext().traceId; }; + +exports.handler_return_baggage = async function (event, context) { + const [baggageEntryKey, baggageEntryValue] = api.propagation.getBaggage(api.context.active()).getAllEntries()[0]; + return `${baggageEntryKey}=${baggageEntryValue.value}`; +} diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-aws-sdk/CHANGELOG.md index cfe33e092b..a4875af2e1 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +### [0.5.1](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-aws-sdk-v0.5.0...instrumentation-aws-sdk-v0.5.1) (2022-03-02) + + +### Bug Fixes + +* **opentelemetry-instrumentation-aws-sdk:** error when ReturnConsumedCapacity is set to None ([#899](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/899)) ([e7ab4d0](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/e7ab4d056b6663f593b47af7c3e8014a72a963fe)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @opentelemetry/propagation-utils bumped from ^0.26.0 to ^0.27.0 + ## [0.5.0](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-aws-sdk-v0.4.0...instrumentation-aws-sdk-v0.5.0) (2022-01-24) @@ -70,4 +84,4 @@ * The following workspace dependencies were updated * devDependencies - * @opentelemetry/contrib-test-utils bumped from ^0.26.0 to ^0.27.0 \ No newline at end of file + * @opentelemetry/contrib-test-utils bumped from ^0.26.0 to ^0.27.0 diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json b/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json index 597fa31f1c..759b899818 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-aws-sdk", - "version": "0.5.0", + "version": "0.5.1", "description": "OpenTelemetry automatic instrumentation for the `aws-sdk` package", "keywords": [ "aws", @@ -30,10 +30,10 @@ "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "clean": "rimraf build/*", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-aws-sdk --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-aws-sdk --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", @@ -48,8 +48,8 @@ "dependencies": { "@opentelemetry/core": "^1.0.0", "@opentelemetry/instrumentation": "^0.27.0", - "@opentelemetry/propagation-utils": "^0.26.0", - "@opentelemetry/semantic-conventions": "^1.0.0" + "@opentelemetry/semantic-conventions": "^1.0.0", + "@opentelemetry/propagation-utils": "^0.27.0" }, "devDependencies": { "@aws-sdk/client-dynamodb": "3.37.0", diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/dynamodb.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/dynamodb.ts index e6f23bd42a..0cf383f27f 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/dynamodb.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/dynamodb.ts @@ -15,7 +15,10 @@ */ import { Span, SpanKind, Tracer } from '@opentelemetry/api'; import { RequestMetadata, ServiceExtension } from './ServiceExtension'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { + DbSystemValues, + SemanticAttributes, +} from '@opentelemetry/semantic-conventions'; import { AwsSdkInstrumentationConfig, NormalizedRequest, @@ -30,7 +33,7 @@ export class DynamodbServiceExtension implements ServiceExtension { const operation = normalizedRequest.commandName; const spanAttributes = { - [SemanticAttributes.DB_SYSTEM]: 'dynamodb', + [SemanticAttributes.DB_SYSTEM]: DbSystemValues.DYNAMODB, [SemanticAttributes.DB_NAME]: normalizedRequest.commandInput?.TableName, [SemanticAttributes.DB_OPERATION]: operation, [SemanticAttributes.DB_STATEMENT]: JSON.stringify( @@ -61,7 +64,7 @@ export class DynamodbServiceExtension implements ServiceExtension { const operation = response.request.commandName; if (operation === 'BatchGetItem') { - if ('ConsumedCapacity' in response.data) { + if (Array.isArray(response.data?.ConsumedCapacity)) { span.setAttribute( SemanticAttributes.AWS_DYNAMODB_CONSUMED_CAPACITY, response.data.ConsumedCapacity.map( diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/dynamodb.test.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/dynamodb.test.ts index dab0144f4f..41b715770a 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/dynamodb.test.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/dynamodb.test.ts @@ -23,7 +23,10 @@ import * as AWS from 'aws-sdk'; import { AWSError } from 'aws-sdk'; import { mockV2AwsSend } from './testing-utils'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { + DbSystemValues, + SemanticAttributes, +} from '@opentelemetry/semantic-conventions'; import * as expect from 'expect'; import type { ConsumedCapacity as ConsumedCapacityV2 } from 'aws-sdk/clients/dynamodb'; import type { ConsumedCapacity as ConsumedCapacityV3 } from '@aws-sdk/client-dynamodb'; @@ -73,7 +76,9 @@ describe('DynamoDB', () => { const spans = getTestSpans(); expect(spans.length).toStrictEqual(1); const attrs = spans[0].attributes; - expect(attrs[SemanticAttributes.DB_SYSTEM]).toStrictEqual('dynamodb'); + expect(attrs[SemanticAttributes.DB_SYSTEM]).toStrictEqual( + DbSystemValues.DYNAMODB + ); expect(attrs[SemanticAttributes.DB_NAME]).toStrictEqual('test-table'); expect(attrs[SemanticAttributes.DB_OPERATION]).toStrictEqual('Query'); expect( @@ -120,7 +125,9 @@ describe('DynamoDB', () => { const spans = getTestSpans(); expect(spans.length).toStrictEqual(1); const attrs = spans[0].attributes; - expect(attrs[SemanticAttributes.DB_SYSTEM]).toStrictEqual('dynamodb'); + expect(attrs[SemanticAttributes.DB_SYSTEM]).toStrictEqual( + DbSystemValues.DYNAMODB + ); expect(attrs[SemanticAttributes.DB_OPERATION]).toStrictEqual( 'BatchGetItem' ); @@ -165,7 +172,9 @@ describe('DynamoDB', () => { const spans = getTestSpans(); expect(spans.length).toStrictEqual(1); const attrs = spans[0].attributes; - expect(attrs[SemanticAttributes.DB_SYSTEM]).toStrictEqual('dynamodb'); + expect(attrs[SemanticAttributes.DB_SYSTEM]).toStrictEqual( + DbSystemValues.DYNAMODB + ); expect(attrs[SemanticAttributes.DB_OPERATION]).toStrictEqual( 'BatchGetItem' ); @@ -187,5 +196,50 @@ describe('DynamoDB', () => { } ); }); + + it('should populate BatchGetIem when consumedCapacity is undefined', done => { + mockV2AwsSend(responseMockSuccess, { + Responses: { 'test-table': [{ key1: { S: 'val1' } }] }, + UnprocessedKeys: {}, + ConsumedCapacity: undefined, + } as AWS.DynamoDB.Types.BatchGetItemOutput); + + const dynamodb = new AWS.DynamoDB.DocumentClient(); + const dynamodb_params = { + RequestItems: { + 'test-table': { + Keys: [{ key1: { S: 'val1' } }], + ProjectionExpression: 'id', + }, + }, + ReturnConsumedCapacity: 'NONE', + }; + dynamodb.batchGet( + dynamodb_params, + ( + err: AWSError, + data: AWS.DynamoDB.DocumentClient.BatchGetItemOutput + ) => { + const spans = getTestSpans(); + expect(spans.length).toStrictEqual(1); + const attrs = spans[0].attributes; + expect(attrs[SemanticAttributes.DB_SYSTEM]).toStrictEqual('dynamodb'); + expect(attrs[SemanticAttributes.DB_OPERATION]).toStrictEqual( + 'BatchGetItem' + ); + expect( + attrs[SemanticAttributes.AWS_DYNAMODB_TABLE_NAMES] + ).toStrictEqual(['test-table']); + expect( + attrs[SemanticAttributes.AWS_DYNAMODB_CONSUMED_CAPACITY] + ).toBeUndefined(); + expect( + JSON.parse(attrs[SemanticAttributes.DB_STATEMENT] as string) + ).toEqual(dynamodb_params); + expect(err).toBeFalsy(); + done(); + } + ); + }); }); }); diff --git a/plugins/node/opentelemetry-instrumentation-bunyan/package.json b/plugins/node/opentelemetry-instrumentation-bunyan/package.json index bbd8050dee..664fa36639 100644 --- a/plugins/node/opentelemetry-instrumentation-bunyan/package.json +++ b/plugins/node/opentelemetry-instrumentation-bunyan/package.json @@ -7,10 +7,10 @@ "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "clean": "rimraf build/*", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-bunyan --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-bunyan --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", diff --git a/plugins/node/opentelemetry-instrumentation-cassandra/package.json b/plugins/node/opentelemetry-instrumentation-cassandra/package.json index 1c77e63551..4c5783693e 100644 --- a/plugins/node/opentelemetry-instrumentation-cassandra/package.json +++ b/plugins/node/opentelemetry-instrumentation-cassandra/package.json @@ -11,11 +11,11 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-cassandra-driver --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-cassandra-driver --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc -p ." + "compile": "tsc -p ." }, "keywords": [ "cassandra-driver", diff --git a/plugins/node/opentelemetry-instrumentation-connect/package.json b/plugins/node/opentelemetry-instrumentation-connect/package.json index 572ea6ecd7..7484135eba 100644 --- a/plugins/node/opentelemetry-instrumentation-connect/package.json +++ b/plugins/node/opentelemetry-instrumentation-connect/package.json @@ -7,10 +7,10 @@ "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "clean": "rimraf build/*", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-connect --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-connect --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", diff --git a/plugins/node/opentelemetry-instrumentation-dns/package.json b/plugins/node/opentelemetry-instrumentation-dns/package.json index e078bae4e8..17799ac8fe 100644 --- a/plugins/node/opentelemetry-instrumentation-dns/package.json +++ b/plugins/node/opentelemetry-instrumentation-dns/package.json @@ -11,11 +11,11 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-dns --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-dns --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc -p ." + "compile": "tsc -p ." }, "keywords": [ "dns", diff --git a/plugins/node/opentelemetry-instrumentation-express/package.json b/plugins/node/opentelemetry-instrumentation-express/package.json index f8d1851fb4..413f3baf17 100644 --- a/plugins/node/opentelemetry-instrumentation-express/package.json +++ b/plugins/node/opentelemetry-instrumentation-express/package.json @@ -12,10 +12,10 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-express --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-express --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "prepare": "npm run compile", "watch": "tsc -w" }, diff --git a/plugins/node/opentelemetry-instrumentation-fastify/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-fastify/CHANGELOG.md new file mode 100644 index 0000000000..2bad5f0e4f --- /dev/null +++ b/plugins/node/opentelemetry-instrumentation-fastify/CHANGELOG.md @@ -0,0 +1,18 @@ +# Changelog + +## [0.26.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-fastify-v0.25.0...instrumentation-fastify-v0.26.0) (2022-03-02) + + +### Features + +* new fastify instrumentation ([#611](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/611)) ([77c215b](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/77c215bdd7adb76c8934028458a2b7f28e041f37)) +* upstream mocha instrumentation testing plugin from ext-js [#621](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/621) ([#669](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/669)) ([a5170c4](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/a5170c494706a2bec3ba51e59966d0ca8a41d00e)) +* use latest instrumentation base ([#769](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/769)) ([7aff23e](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/7aff23ebebbe209fa3b78c2e7f513c9cd2231be4)) + + +### Bug Fixes + +* fastify and browser autoinjection failed to compile ([#793](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/793)) ([c08efa8](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/c08efa82a38d3d5b4d0c51d712a39052317b9f74)) +* typo in fastify description ([#891](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/891)) ([adbd6dc](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/adbd6dcb0af6540a6d10b7e2ceaaf2c69a3e1146)) +* update some dev-deps in fastify instrumentation ([a20f77b](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/a20f77b539d2a1eecc8a423d3b0381988e4734b8)) +* use localhost for services in CI ([#816](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/816)) ([f497313](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/f4973133e86549bbca301983085cc67788a10acd)) diff --git a/plugins/node/opentelemetry-instrumentation-fastify/package.json b/plugins/node/opentelemetry-instrumentation-fastify/package.json index 94404ca784..84658456de 100644 --- a/plugins/node/opentelemetry-instrumentation-fastify/package.json +++ b/plugins/node/opentelemetry-instrumentation-fastify/package.json @@ -1,19 +1,20 @@ { "name": "@opentelemetry/instrumentation-fastify", - "version": "0.25.0", + "version": "0.26.0", "description": "OpenTelemetry fastify automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "clean": "rimraf build/*", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-fastify --include-dependencies", "prepare": "npm run compile", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "version:update": "node ../../../scripts/version-update.js", + "prewatch": "npm run precompile", "watch": "tsc -w" }, "keywords": [ diff --git a/plugins/node/opentelemetry-instrumentation-generic-pool/package.json b/plugins/node/opentelemetry-instrumentation-generic-pool/package.json index 88f3d3231b..478d886883 100644 --- a/plugins/node/opentelemetry-instrumentation-generic-pool/package.json +++ b/plugins/node/opentelemetry-instrumentation-generic-pool/package.json @@ -11,10 +11,10 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-generic-pool --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-generic-pool --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "prepare": "npm run compile", "watch": "tsc -w" }, diff --git a/plugins/node/opentelemetry-instrumentation-graphql/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-graphql/CHANGELOG.md index de0fd99370..bb0d84e968 100644 --- a/plugins/node/opentelemetry-instrumentation-graphql/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-graphql/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [0.27.4](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-graphql-v0.27.3...instrumentation-graphql-v0.27.4) (2022-03-02) + + +### Bug Fixes + +* **graphql:** fix `graphql.operation.name` field ([#903](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/903)) ([5529261](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/552926146c838efd7e2b778ae6fb815e9e304965)) + ### [0.27.3](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-graphql-v0.27.2...instrumentation-graphql-v0.27.3) (2022-02-06) diff --git a/plugins/node/opentelemetry-instrumentation-graphql/package.json b/plugins/node/opentelemetry-instrumentation-graphql/package.json index a8da7f644a..6b2ba3ba3e 100644 --- a/plugins/node/opentelemetry-instrumentation-graphql/package.json +++ b/plugins/node/opentelemetry-instrumentation-graphql/package.json @@ -1,16 +1,16 @@ { "name": "@opentelemetry/instrumentation-graphql", - "version": "0.27.3", + "version": "0.27.4", "description": "OpenTelemetry @opentelemetry/instrumentation-graphql automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "clean": "rimraf build/*", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-graphql --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-graphql --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", diff --git a/plugins/node/opentelemetry-instrumentation-graphql/src/enums/AttributeNames.ts b/plugins/node/opentelemetry-instrumentation-graphql/src/enums/AttributeNames.ts index b5a1027a41..d264930721 100644 --- a/plugins/node/opentelemetry-instrumentation-graphql/src/enums/AttributeNames.ts +++ b/plugins/node/opentelemetry-instrumentation-graphql/src/enums/AttributeNames.ts @@ -19,7 +19,8 @@ export enum AttributeNames { FIELD_NAME = 'graphql.field.name', FIELD_PATH = 'graphql.field.path', FIELD_TYPE = 'graphql.field.type', - OPERATION = 'graphql.operation.name', + OPERATION_TYPE = 'graphql.operation.type', + OPERATION_NAME = 'graphql.operation.name', VARIABLES = 'graphql.variables.', ERROR_VALIDATION_NAME = 'graphql.validation.error', } diff --git a/plugins/node/opentelemetry-instrumentation-graphql/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-graphql/src/instrumentation.ts index 7e0700f6a6..52c7465a2f 100644 --- a/plugins/node/opentelemetry-instrumentation-graphql/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-graphql/src/instrumentation.ts @@ -401,10 +401,18 @@ export class GraphQLInstrumentation extends InstrumentationBase { const span = this.tracer.startSpan(SpanNames.EXECUTE, {}); if (operation) { - const name = (operation as graphqlTypes.OperationDefinitionNode) - .operation; - if (name) { - span.setAttribute(AttributeNames.OPERATION, name); + const operationDefinition = + operation as graphqlTypes.OperationDefinitionNode; + span.setAttribute( + AttributeNames.OPERATION_TYPE, + operationDefinition.operation + ); + + if (operationDefinition.name) { + span.setAttribute( + AttributeNames.OPERATION_NAME, + operationDefinition.name.value + ); } } else { let operationName = ' '; @@ -415,7 +423,7 @@ export class GraphQLInstrumentation extends InstrumentationBase { '$operationName$', operationName ); - span.setAttribute(AttributeNames.OPERATION, operationName); + span.setAttribute(AttributeNames.OPERATION_NAME, operationName); } if (processedArgs.document?.loc) { diff --git a/plugins/node/opentelemetry-instrumentation-graphql/test/graphql.test.ts b/plugins/node/opentelemetry-instrumentation-graphql/test/graphql.test.ts index fb3c642181..2829792f14 100644 --- a/plugins/node/opentelemetry-instrumentation-graphql/test/graphql.test.ts +++ b/plugins/node/opentelemetry-instrumentation-graphql/test/graphql.test.ts @@ -61,7 +61,7 @@ const sourceBookById = ` `; const sourceAddBook = ` - mutation { + mutation AddBook { addBook( name: "Fifth Book" authorIds: "0,2" @@ -155,9 +155,13 @@ describe('graphql', () => { ' }\n' ); assert.deepStrictEqual( - executeSpan.attributes[AttributeNames.OPERATION], + executeSpan.attributes[AttributeNames.OPERATION_TYPE], 'query' ); + assert.deepStrictEqual( + executeSpan.attributes[AttributeNames.OPERATION_NAME], + undefined + ); assert.deepStrictEqual(executeSpan.name, SpanNames.EXECUTE); assert.deepStrictEqual(executeSpan.parentSpanId, undefined); }); @@ -278,9 +282,13 @@ describe('graphql', () => { ' }\n' ); assert.deepStrictEqual( - executeSpan.attributes[AttributeNames.OPERATION], + executeSpan.attributes[AttributeNames.OPERATION_TYPE], 'query' ); + assert.deepStrictEqual( + executeSpan.attributes[AttributeNames.OPERATION_NAME], + undefined + ); assert.deepStrictEqual(executeSpan.name, SpanNames.EXECUTE); assert.deepStrictEqual(executeSpan.parentSpanId, undefined); }); @@ -364,9 +372,13 @@ describe('graphql', () => { ' }\n' ); assert.deepStrictEqual( - executeSpan.attributes[AttributeNames.OPERATION], + executeSpan.attributes[AttributeNames.OPERATION_TYPE], 'query' ); + assert.deepStrictEqual( + executeSpan.attributes[AttributeNames.OPERATION_NAME], + 'Query1' + ); assert.deepStrictEqual( executeSpan.attributes[`${AttributeNames.VARIABLES}id`], undefined @@ -456,9 +468,13 @@ describe('graphql', () => { ' }\n' ); assert.deepStrictEqual( - executeSpan.attributes[AttributeNames.OPERATION], + executeSpan.attributes[AttributeNames.OPERATION_TYPE], 'query' ); + assert.deepStrictEqual( + executeSpan.attributes[AttributeNames.OPERATION_NAME], + undefined + ); assert.deepStrictEqual(executeSpan.name, SpanNames.EXECUTE); assert.deepStrictEqual(executeSpan.parentSpanId, undefined); }); @@ -520,9 +536,13 @@ describe('graphql', () => { ' }\n' ); assert.deepStrictEqual( - executeSpan.attributes[AttributeNames.OPERATION], + executeSpan.attributes[AttributeNames.OPERATION_TYPE], 'query' ); + assert.deepStrictEqual( + executeSpan.attributes[AttributeNames.OPERATION_NAME], + undefined + ); assert.deepStrictEqual(executeSpan.name, SpanNames.EXECUTE); assert.deepStrictEqual(executeSpan.parentSpanId, undefined); }); @@ -607,9 +627,13 @@ describe('graphql', () => { ' }\n' ); assert.deepStrictEqual( - executeSpan.attributes[AttributeNames.OPERATION], + executeSpan.attributes[AttributeNames.OPERATION_TYPE], 'query' ); + assert.deepStrictEqual( + executeSpan.attributes[AttributeNames.OPERATION_NAME], + undefined + ); assert.deepStrictEqual(executeSpan.name, SpanNames.EXECUTE); assert.deepStrictEqual(executeSpan.parentSpanId, undefined); }); @@ -664,7 +688,7 @@ describe('graphql', () => { assert.deepStrictEqual( parseSpan.attributes[AttributeNames.SOURCE], '\n' + - ' mutation {\n' + + ' mutation AddBook {\n' + ' addBook(\n' + ' name: "Fifth Book"\n' + ' authorIds: "0,2"\n' + @@ -689,7 +713,7 @@ describe('graphql', () => { assert.deepStrictEqual( executeSpan.attributes[AttributeNames.SOURCE], '\n' + - ' mutation {\n' + + ' mutation AddBook {\n' + ' addBook(\n' + ' name: "Fifth Book"\n' + ' authorIds: "0,2"\n' + @@ -699,9 +723,13 @@ describe('graphql', () => { ' }\n' ); assert.deepStrictEqual( - executeSpan.attributes[AttributeNames.OPERATION], + executeSpan.attributes[AttributeNames.OPERATION_TYPE], 'mutation' ); + assert.deepStrictEqual( + executeSpan.attributes[AttributeNames.OPERATION_NAME], + 'AddBook' + ); assert.deepStrictEqual(executeSpan.name, SpanNames.EXECUTE); assert.deepStrictEqual(executeSpan.parentSpanId, undefined); }); @@ -785,9 +813,13 @@ describe('graphql', () => { ' }\n' ); assert.deepStrictEqual( - executeSpan.attributes[AttributeNames.OPERATION], + executeSpan.attributes[AttributeNames.OPERATION_TYPE], 'query' ); + assert.deepStrictEqual( + executeSpan.attributes[AttributeNames.OPERATION_NAME], + 'Query1' + ); assert.deepStrictEqual( executeSpan.attributes[`${AttributeNames.VARIABLES}id`], 2 @@ -848,7 +880,7 @@ describe('graphql', () => { assert.deepStrictEqual( parseSpan.attributes[AttributeNames.SOURCE], '\n' + - ' mutation {\n' + + ' mutation AddBook {\n' + ' addBook(\n' + ' name: "*"\n' + ' authorIds: "*"\n' + @@ -873,7 +905,7 @@ describe('graphql', () => { assert.deepStrictEqual( executeSpan.attributes[AttributeNames.SOURCE], '\n' + - ' mutation {\n' + + ' mutation AddBook {\n' + ' addBook(\n' + ' name: "*"\n' + ' authorIds: "*"\n' + @@ -883,9 +915,13 @@ describe('graphql', () => { ' }\n' ); assert.deepStrictEqual( - executeSpan.attributes[AttributeNames.OPERATION], + executeSpan.attributes[AttributeNames.OPERATION_TYPE], 'mutation' ); + assert.deepStrictEqual( + executeSpan.attributes[AttributeNames.OPERATION_NAME], + 'AddBook' + ); assert.deepStrictEqual(executeSpan.name, SpanNames.EXECUTE); assert.deepStrictEqual(executeSpan.parentSpanId, undefined); }); @@ -1021,7 +1057,7 @@ describe('graphql', () => { it('should attach response hook data to the resulting spans', () => { const querySpan = spans.find( - span => span.attributes['graphql.operation.name'] == 'query' + span => span.attributes[AttributeNames.OPERATION_TYPE] == 'query' ); const instrumentationResult = querySpan?.attributes[dataAttributeName]; assert.deepStrictEqual( @@ -1125,7 +1161,7 @@ describe('graphql', () => { ' }\n' ); assert.deepStrictEqual( - executeSpan.attributes[AttributeNames.OPERATION], + executeSpan.attributes[AttributeNames.OPERATION_NAME], 'Operation "foo" not supported' ); assert.deepStrictEqual(executeSpan.name, SpanNames.EXECUTE); diff --git a/plugins/node/opentelemetry-instrumentation-hapi/package.json b/plugins/node/opentelemetry-instrumentation-hapi/package.json index b1526ad3f3..a016f4ca77 100644 --- a/plugins/node/opentelemetry-instrumentation-hapi/package.json +++ b/plugins/node/opentelemetry-instrumentation-hapi/package.json @@ -11,10 +11,10 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-hapi --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-hapi --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "prepare": "npm run compile" }, "keywords": [ diff --git a/plugins/node/opentelemetry-instrumentation-ioredis/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-ioredis/CHANGELOG.md index aeea81377c..05167ca351 100644 --- a/plugins/node/opentelemetry-instrumentation-ioredis/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-ioredis/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [0.28.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-ioredis-v0.27.1...instrumentation-ioredis-v0.28.0) (2022-03-02) + + +### ⚠ BREAKING CHANGES + +* **ioredis:** net.peer.ip -> db.connection_string + +### Bug Fixes + +* **ioredis:** net.peer.ip -> db.connection_string ([986c349](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/986c3499b324ebdf49aabf35bc3711c91bb91ec8)) + ### [0.27.1](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-ioredis-v0.27.0...instrumentation-ioredis-v0.27.1) (2022-01-24) @@ -47,4 +58,4 @@ * The following workspace dependencies were updated * devDependencies - * @opentelemetry/contrib-test-utils bumped from ^0.25.0 to ^0.27.0 \ No newline at end of file + * @opentelemetry/contrib-test-utils bumped from ^0.25.0 to ^0.27.0 diff --git a/plugins/node/opentelemetry-instrumentation-ioredis/package.json b/plugins/node/opentelemetry-instrumentation-ioredis/package.json index 60fa8959f0..66bb133b02 100644 --- a/plugins/node/opentelemetry-instrumentation-ioredis/package.json +++ b/plugins/node/opentelemetry-instrumentation-ioredis/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-ioredis", - "version": "0.27.1", + "version": "0.28.0", "description": "OpenTelemetry ioredis automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -15,10 +15,10 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-ioredis --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-ioredis --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "prepare": "npm run compile" }, "keywords": [ diff --git a/plugins/node/opentelemetry-instrumentation-ioredis/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-ioredis/src/instrumentation.ts index d3a26a9ec3..dcd067bd85 100644 --- a/plugins/node/opentelemetry-instrumentation-ioredis/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-ioredis/src/instrumentation.ts @@ -22,7 +22,10 @@ import { isWrapped, } from '@opentelemetry/instrumentation'; import { IORedisInstrumentationConfig, IORedisCommand } from './types'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { + DbSystemValues, + SemanticAttributes, +} from '@opentelemetry/semantic-conventions'; import { safeExecuteInTheMiddle } from '@opentelemetry/instrumentation'; import { endSpan, defaultDbStatementSerializer } from './utils'; import { VERSION } from './version'; @@ -34,8 +37,6 @@ const DEFAULT_CONFIG: IORedisInstrumentationConfig = { export class IORedisInstrumentation extends InstrumentationBase< typeof ioredisTypes > { - static readonly DB_SYSTEM = 'redis'; - constructor(_config: IORedisInstrumentationConfig = {}) { super( '@opentelemetry/instrumentation-ioredis', @@ -113,7 +114,7 @@ export class IORedisInstrumentation extends InstrumentationBase< const span = instrumentation.tracer.startSpan(cmd.name, { kind: SpanKind.CLIENT, attributes: { - [SemanticAttributes.DB_SYSTEM]: IORedisInstrumentation.DB_SYSTEM, + [SemanticAttributes.DB_SYSTEM]: DbSystemValues.REDIS, [SemanticAttributes.DB_STATEMENT]: dbStatementSerializer( cmd.name, cmd.args @@ -143,7 +144,7 @@ export class IORedisInstrumentation extends InstrumentationBase< span.setAttributes({ [SemanticAttributes.NET_PEER_NAME]: host, [SemanticAttributes.NET_PEER_PORT]: port, - [SemanticAttributes.NET_PEER_IP]: `redis://${host}:${port}`, + [SemanticAttributes.DB_CONNECTION_STRING]: `redis://${host}:${port}`, }); try { @@ -186,7 +187,7 @@ export class IORedisInstrumentation extends InstrumentationBase< const span = instrumentation.tracer.startSpan('connect', { kind: SpanKind.CLIENT, attributes: { - [SemanticAttributes.DB_SYSTEM]: IORedisInstrumentation.DB_SYSTEM, + [SemanticAttributes.DB_SYSTEM]: DbSystemValues.REDIS, [SemanticAttributes.DB_STATEMENT]: 'connect', }, }); @@ -195,7 +196,7 @@ export class IORedisInstrumentation extends InstrumentationBase< span.setAttributes({ [SemanticAttributes.NET_PEER_NAME]: host, [SemanticAttributes.NET_PEER_PORT]: port, - [SemanticAttributes.NET_PEER_IP]: `redis://${host}:${port}`, + [SemanticAttributes.DB_CONNECTION_STRING]: `redis://${host}:${port}`, }); try { const client = original.apply(this, arguments); diff --git a/plugins/node/opentelemetry-instrumentation-ioredis/test/ioredis.test.ts b/plugins/node/opentelemetry-instrumentation-ioredis/test/ioredis.test.ts index 2a346a81b1..b57adcb76b 100644 --- a/plugins/node/opentelemetry-instrumentation-ioredis/test/ioredis.test.ts +++ b/plugins/node/opentelemetry-instrumentation-ioredis/test/ioredis.test.ts @@ -39,7 +39,10 @@ import { DbStatementSerializer, IORedisRequestHookInformation, } from '../src/types'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { + DbSystemValues, + SemanticAttributes, +} from '@opentelemetry/semantic-conventions'; const memoryExporter = new InMemorySpanExporter(); @@ -51,10 +54,10 @@ const CONFIG = { const URL = `redis://${CONFIG.host}:${CONFIG.port}`; const DEFAULT_ATTRIBUTES = { - [SemanticAttributes.DB_SYSTEM]: IORedisInstrumentation.DB_SYSTEM, + [SemanticAttributes.DB_SYSTEM]: DbSystemValues.REDIS, [SemanticAttributes.NET_PEER_NAME]: CONFIG.host, [SemanticAttributes.NET_PEER_PORT]: CONFIG.port, - [SemanticAttributes.NET_PEER_IP]: URL, + [SemanticAttributes.DB_CONNECTION_STRING]: URL, }; const unsetStatus: SpanStatus = { diff --git a/plugins/node/opentelemetry-instrumentation-knex/package.json b/plugins/node/opentelemetry-instrumentation-knex/package.json index 8d68399d16..3343a20f51 100644 --- a/plugins/node/opentelemetry-instrumentation-knex/package.json +++ b/plugins/node/opentelemetry-instrumentation-knex/package.json @@ -11,10 +11,10 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-knex --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-knex --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "prepare": "npm run compile", "watch": "tsc -w" }, diff --git a/plugins/node/opentelemetry-instrumentation-knex/src/utils.ts b/plugins/node/opentelemetry-instrumentation-knex/src/utils.ts index ec8c9bdb5d..6a54e7c878 100644 --- a/plugins/node/opentelemetry-instrumentation-knex/src/utils.ts +++ b/plugins/node/opentelemetry-instrumentation-knex/src/utils.ts @@ -14,6 +14,8 @@ * limitations under the License. */ +import { DbSystemValues } from '@opentelemetry/semantic-conventions'; + type Exception = { new (message: string): Exception; constructor: Exception; @@ -50,8 +52,8 @@ export const cloneErrorWithNewMessage = (err: Exception, message: string) => { }; const systemMap = new Map([ - ['sqlite3', 'sqlite'], - ['pg', 'postgresql'], + ['sqlite3', DbSystemValues.SQLITE], + ['pg', DbSystemValues.POSTGRESQL], ]); export const mapSystem = (knexSystem: string) => { return systemMap.get(knexSystem) || knexSystem; diff --git a/plugins/node/opentelemetry-instrumentation-koa/package.json b/plugins/node/opentelemetry-instrumentation-koa/package.json index 4a05e501f0..afa172fdf8 100644 --- a/plugins/node/opentelemetry-instrumentation-koa/package.json +++ b/plugins/node/opentelemetry-instrumentation-koa/package.json @@ -12,10 +12,10 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-koa --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-koa --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "prepare": "npm run compile", "watch": "tsc -w" }, diff --git a/plugins/node/opentelemetry-instrumentation-memcached/package.json b/plugins/node/opentelemetry-instrumentation-memcached/package.json index d2dc0bc61a..82187f2d22 100644 --- a/plugins/node/opentelemetry-instrumentation-memcached/package.json +++ b/plugins/node/opentelemetry-instrumentation-memcached/package.json @@ -7,10 +7,10 @@ "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "clean": "rimraf build/*", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-memcached --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-memcached --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", diff --git a/plugins/node/opentelemetry-instrumentation-memcached/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-memcached/src/instrumentation.ts index 7ffca113b9..2c7b22b2ad 100644 --- a/plugins/node/opentelemetry-instrumentation-memcached/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-memcached/src/instrumentation.ts @@ -21,7 +21,10 @@ import { InstrumentationNodeModuleDefinition, } from '@opentelemetry/instrumentation'; import type * as Memcached from 'memcached'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { + DbSystemValues, + SemanticAttributes, +} from '@opentelemetry/semantic-conventions'; import * as utils from './utils'; import { InstrumentationConfig } from './types'; import { VERSION } from './version'; @@ -29,7 +32,7 @@ import { VERSION } from './version'; export class Instrumentation extends InstrumentationBase { static readonly COMPONENT = 'memcached'; static readonly COMMON_ATTRIBUTES = { - [SemanticAttributes.DB_SYSTEM]: Instrumentation.COMPONENT, + [SemanticAttributes.DB_SYSTEM]: DbSystemValues.MEMCACHED, }; static readonly DEFAULT_CONFIG: InstrumentationConfig = { enhancedDatabaseReporting: false, diff --git a/plugins/node/opentelemetry-instrumentation-memcached/test/index.test.ts b/plugins/node/opentelemetry-instrumentation-memcached/test/index.test.ts index 1c86a16d54..34e4ae807f 100644 --- a/plugins/node/opentelemetry-instrumentation-memcached/test/index.test.ts +++ b/plugins/node/opentelemetry-instrumentation-memcached/test/index.test.ts @@ -25,7 +25,10 @@ import { import type * as Memcached from 'memcached'; import * as assert from 'assert'; import Instrumentation from '../src'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { + DbSystemValues, + SemanticAttributes, +} from '@opentelemetry/semantic-conventions'; import * as util from 'util'; const instrumentation = new Instrumentation(); @@ -37,7 +40,7 @@ const CONFIG = { }; const DEFAULT_ATTRIBUTES = { - [SemanticAttributes.DB_SYSTEM]: Instrumentation.COMPONENT, + [SemanticAttributes.DB_SYSTEM]: DbSystemValues.MEMCACHED, [SemanticAttributes.NET_PEER_NAME]: CONFIG.host, [SemanticAttributes.NET_PEER_PORT]: CONFIG.port, }; diff --git a/plugins/node/opentelemetry-instrumentation-mongodb/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-mongodb/CHANGELOG.md index b70129f2df..28a1e64e94 100644 --- a/plugins/node/opentelemetry-instrumentation-mongodb/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-mongodb/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.29.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-mongodb-v0.28.0...instrumentation-mongodb-v0.29.0) (2022-03-02) + + +### Features + +* **mongodb4:** added mongodb4 instrumentation ([#869](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/869)) ([47700e1](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/47700e10dc6e4bd9ba0255cae85dec07ab4dd448)) + ## [0.28.0](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-mongodb-v0.27.0...instrumentation-mongodb-v0.28.0) (2022-01-24) @@ -52,4 +59,4 @@ * The following workspace dependencies were updated * devDependencies - * @opentelemetry/contrib-test-utils bumped from ^0.26.0 to ^0.27.0 \ No newline at end of file + * @opentelemetry/contrib-test-utils bumped from ^0.26.0 to ^0.27.0 diff --git a/plugins/node/opentelemetry-instrumentation-mongodb/package.json b/plugins/node/opentelemetry-instrumentation-mongodb/package.json index fb8b4e6c19..d8b36e2594 100644 --- a/plugins/node/opentelemetry-instrumentation-mongodb/package.json +++ b/plugins/node/opentelemetry-instrumentation-mongodb/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-mongodb", - "version": "0.28.0", + "version": "0.29.0", "description": "OpenTelemetry mongodb automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -14,10 +14,10 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-mongodb --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-mongodb --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "prepare": "npm run compile", "watch": "tsc -w" }, diff --git a/plugins/node/opentelemetry-instrumentation-mongodb/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-mongodb/src/instrumentation.ts index cc539d9406..5e078f9ccd 100644 --- a/plugins/node/opentelemetry-instrumentation-mongodb/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-mongodb/src/instrumentation.ts @@ -29,7 +29,10 @@ import { isWrapped, safeExecuteInTheMiddle, } from '@opentelemetry/instrumentation'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { + DbSystemValues, + SemanticAttributes, +} from '@opentelemetry/semantic-conventions'; import type * as mongodb from 'mongodb'; import { CursorState, @@ -563,7 +566,7 @@ export class MongoDBInstrumentation extends InstrumentationBase< ) { // add database related attributes span.setAttributes({ - [SemanticAttributes.DB_SYSTEM]: 'mongodb', + [SemanticAttributes.DB_SYSTEM]: DbSystemValues.MONGODB, [SemanticAttributes.DB_NAME]: dbName, [SemanticAttributes.DB_MONGODB_COLLECTION]: dbCollection, }); diff --git a/plugins/node/opentelemetry-instrumentation-mysql/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-mysql/CHANGELOG.md index 2f7df975be..564adffa70 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-mysql/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [0.28.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-mysql-v0.27.1...instrumentation-mysql-v0.28.0) (2022-03-02) + + +### ⚠ BREAKING CHANGES + +* **mysql*,redis:** net.peer.ip -> db.connection_string + +### Bug Fixes + +* **mysql*,redis:** net.peer.ip -> db.connection_string ([bf39b90](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/bf39b908fd64cec92c862b2deca5d760ddcf4509)) + ### [0.27.1](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-mysql-v0.27.0...instrumentation-mysql-v0.27.1) (2022-01-24) @@ -43,4 +54,4 @@ * The following workspace dependencies were updated * devDependencies - * @opentelemetry/contrib-test-utils bumped from ^0.25.0 to ^0.27.0 \ No newline at end of file + * @opentelemetry/contrib-test-utils bumped from ^0.25.0 to ^0.27.0 diff --git a/plugins/node/opentelemetry-instrumentation-mysql/package.json b/plugins/node/opentelemetry-instrumentation-mysql/package.json index 7fd2f69bbb..a9f64bbaca 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql/package.json +++ b/plugins/node/opentelemetry-instrumentation-mysql/package.json @@ -1,16 +1,16 @@ { "name": "@opentelemetry/instrumentation-mysql", - "version": "0.27.1", + "version": "0.28.0", "description": "OpenTelemetry mysql automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "clean": "rimraf build/*", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "lint:fix": "eslint . --ext .ts --fix", "lint": "eslint . --ext .ts", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-mysql --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-mysql --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", diff --git a/plugins/node/opentelemetry-instrumentation-mysql/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-mysql/src/instrumentation.ts index 00968d7dce..795e55b9f7 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-mysql/src/instrumentation.ts @@ -26,7 +26,10 @@ import { InstrumentationNodeModuleDefinition, isWrapped, } from '@opentelemetry/instrumentation'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { + DbSystemValues, + SemanticAttributes, +} from '@opentelemetry/semantic-conventions'; import type * as mysqlTypes from 'mysql'; import { MySQLInstrumentationConfig } from './types'; import { getConnectionAttributes, getDbStatement, getSpanName } from './utils'; @@ -42,9 +45,8 @@ type getConnectionCallbackType = ( export class MySQLInstrumentation extends InstrumentationBase< typeof mysqlTypes > { - static readonly COMPONENT = 'mysql'; static readonly COMMON_ATTRIBUTES = { - [SemanticAttributes.DB_SYSTEM]: MySQLInstrumentation.COMPONENT, + [SemanticAttributes.DB_SYSTEM]: DbSystemValues.MYSQL, }; constructor(config?: MySQLInstrumentationConfig) { diff --git a/plugins/node/opentelemetry-instrumentation-mysql/src/utils.ts b/plugins/node/opentelemetry-instrumentation-mysql/src/utils.ts index b89d19e9a6..90b07bea4f 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql/src/utils.ts +++ b/plugins/node/opentelemetry-instrumentation-mysql/src/utils.ts @@ -36,7 +36,11 @@ export function getConnectionAttributes( return { [SemanticAttributes.NET_PEER_NAME]: host, [SemanticAttributes.NET_PEER_PORT]: port, - [SemanticAttributes.NET_PEER_IP]: getJDBCString(host, port, database), + [SemanticAttributes.DB_CONNECTION_STRING]: getJDBCString( + host, + port, + database + ), [SemanticAttributes.DB_NAME]: database, [SemanticAttributes.DB_USER]: user, }; diff --git a/plugins/node/opentelemetry-instrumentation-mysql/test/index.test.ts b/plugins/node/opentelemetry-instrumentation-mysql/test/index.test.ts index 438f875499..3f3c9c808f 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql/test/index.test.ts +++ b/plugins/node/opentelemetry-instrumentation-mysql/test/index.test.ts @@ -16,7 +16,10 @@ import { context, trace, SpanStatusCode } from '@opentelemetry/api'; import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { + DbSystemValues, + SemanticAttributes, +} from '@opentelemetry/semantic-conventions'; import * as testUtils from '@opentelemetry/contrib-test-utils'; import { BasicTracerProvider, @@ -716,7 +719,10 @@ function assertSpan( values?: any, errorMessage?: string ) { - assert.strictEqual(span.attributes[SemanticAttributes.DB_SYSTEM], 'mysql'); + assert.strictEqual( + span.attributes[SemanticAttributes.DB_SYSTEM], + DbSystemValues.MYSQL + ); assert.strictEqual(span.attributes[SemanticAttributes.DB_NAME], database); assert.strictEqual(span.attributes[SemanticAttributes.NET_PEER_PORT], port); assert.strictEqual(span.attributes[SemanticAttributes.NET_PEER_NAME], host); diff --git a/plugins/node/opentelemetry-instrumentation-mysql2/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-mysql2/CHANGELOG.md index a19d7f23a4..bae2d0fe8a 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql2/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-mysql2/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## [0.29.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-mysql2-v0.28.0...instrumentation-mysql2-v0.29.0) (2022-03-02) + + +### ⚠ BREAKING CHANGES + +* **mysql*,redis:** net.peer.ip -> db.connection_string + +### Features + +* add mysql2 responsehook ([#915](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/915)) ([f436601](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/f4366015e2a628efc4cb8a47d508ba5620175f88)) +* support mysql2 v1 ([#908](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/908)) ([d3883d3](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/d3883d38b7cf929404cf4eac9a9a48b7d1f4327f)) + + +### Bug Fixes + +* **mysql*,redis:** net.peer.ip -> db.connection_string ([bf39b90](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/bf39b908fd64cec92c862b2deca5d760ddcf4509)) +* use SQL verb for mysql2 span name when query object is used ([#923](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/923)) ([3d1388b](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/3d1388b0f779417de86b5b9af84d9000c7f67782)) + ## [0.28.0](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-mysql2-v0.27.0...instrumentation-mysql2-v0.28.0) (2022-01-24) @@ -47,4 +65,4 @@ * The following workspace dependencies were updated * devDependencies - * @opentelemetry/contrib-test-utils bumped from ^0.25.0 to ^0.27.0 \ No newline at end of file + * @opentelemetry/contrib-test-utils bumped from ^0.25.0 to ^0.27.0 diff --git a/plugins/node/opentelemetry-instrumentation-mysql2/README.md b/plugins/node/opentelemetry-instrumentation-mysql2/README.md index dc6ce0ae4a..7fd9096ff9 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql2/README.md +++ b/plugins/node/opentelemetry-instrumentation-mysql2/README.md @@ -43,6 +43,14 @@ registerInstrumentations({ }) ``` +### MySQL2 Instrumentation Options + +You can set the following instrumentation options: + +| Options | Type | Description | +| ------- | ---- | ----------- | +| `responseHook` | `MySQL2InstrumentationExecutionResponseHook` (function) | Function for adding custom attributes from db response | + ## Useful links - For more information on OpenTelemetry, visit: diff --git a/plugins/node/opentelemetry-instrumentation-mysql2/package.json b/plugins/node/opentelemetry-instrumentation-mysql2/package.json index 1c97018f1c..db6a337bdf 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql2/package.json +++ b/plugins/node/opentelemetry-instrumentation-mysql2/package.json @@ -1,16 +1,16 @@ { "name": "@opentelemetry/instrumentation-mysql2", - "version": "0.28.0", + "version": "0.29.0", "description": "OpenTelemetry mysql2 automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "clean": "rimraf build/*", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "lint:fix": "eslint . --ext .ts --fix", "lint": "eslint . --ext .ts", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-mysql2 --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-mysql2 --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", diff --git a/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts index 16f194190d..2fd2c15330 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-mysql2/src/instrumentation.ts @@ -19,8 +19,12 @@ import { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped, + safeExecuteInTheMiddle, } from '@opentelemetry/instrumentation'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { + DbSystemValues, + SemanticAttributes, +} from '@opentelemetry/semantic-conventions'; import type * as mysqlTypes from 'mysql2'; import { MySQL2InstrumentationConfig } from './types'; import { @@ -36,9 +40,8 @@ type formatType = typeof mysqlTypes.format; export class MySQL2Instrumentation extends InstrumentationBase< typeof mysqlTypes > { - static readonly COMPONENT = 'mysql'; static readonly COMMON_ATTRIBUTES = { - [SemanticAttributes.DB_SYSTEM]: MySQL2Instrumentation.COMPONENT, + [SemanticAttributes.DB_SYSTEM]: DbSystemValues.MYSQL, }; constructor(config?: MySQL2InstrumentationConfig) { @@ -107,13 +110,29 @@ export class MySQL2Instrumentation extends InstrumentationBase< ), }, }); - const endSpan = once((err?: any) => { + const endSpan = once((err?: any, results?: any) => { if (err) { span.setStatus({ code: api.SpanStatusCode.ERROR, message: err.message, }); + } else { + const config: MySQL2InstrumentationConfig = thisPlugin._config; + if (typeof config.responseHook === 'function') { + safeExecuteInTheMiddle( + () => { + config.responseHook!(span, { queryResults: results }); + }, + err => { + if (err) { + thisPlugin._diag.warn('Failed executing responseHook', err); + } + }, + true + ); + } } + span.end(); }); @@ -136,8 +155,8 @@ export class MySQL2Instrumentation extends InstrumentationBase< .once('error', err => { endSpan(err); }) - .once('result', () => { - endSpan(); + .once('result', results => { + endSpan(undefined, results); }); return streamableQuery; @@ -169,7 +188,7 @@ export class MySQL2Instrumentation extends InstrumentationBase< results?: any, fields?: mysqlTypes.FieldPacket[] ) { - endSpan(err); + endSpan(err, results); return originalCallback(...arguments); }; }; diff --git a/plugins/node/opentelemetry-instrumentation-mysql2/src/types.ts b/plugins/node/opentelemetry-instrumentation-mysql2/src/types.ts index 16df8a745e..c14743495b 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql2/src/types.ts +++ b/plugins/node/opentelemetry-instrumentation-mysql2/src/types.ts @@ -15,5 +15,22 @@ */ import { InstrumentationConfig } from '@opentelemetry/instrumentation'; +import type { Span } from '@opentelemetry/api'; -export type MySQL2InstrumentationConfig = InstrumentationConfig; +export interface MySQL2ResponseHookInformation { + queryResults: any; +} + +export interface MySQL2InstrumentationExecutionResponseHook { + (span: Span, responseHookInfo: MySQL2ResponseHookInformation): void; +} + +export interface MySQL2InstrumentationConfig extends InstrumentationConfig { + /** + * Hook that allows adding custom span attributes based on the data + * returned MySQL2 queries. + * + * @default undefined + */ + responseHook?: MySQL2InstrumentationExecutionResponseHook; +} diff --git a/plugins/node/opentelemetry-instrumentation-mysql2/src/utils.ts b/plugins/node/opentelemetry-instrumentation-mysql2/src/utils.ts index b6ab662be2..66570bb78e 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql2/src/utils.ts +++ b/plugins/node/opentelemetry-instrumentation-mysql2/src/utils.ts @@ -36,7 +36,11 @@ export function getConnectionAttributes(config: Config): SpanAttributes { return { [SemanticAttributes.NET_PEER_NAME]: host, [SemanticAttributes.NET_PEER_PORT]: port, - [SemanticAttributes.NET_PEER_IP]: getJDBCString(host, port, database), + [SemanticAttributes.DB_CONNECTION_STRING]: getJDBCString( + host, + port, + database + ), [SemanticAttributes.DB_NAME]: database, [SemanticAttributes.DB_USER]: user, }; @@ -99,10 +103,9 @@ export function getDbStatement( * @returns SQL statement without variable arguments or SQL verb */ export function getSpanName(query: string | Query | QueryOptions): string { - if (typeof query === 'object') { - return query.sql; - } - return query.split(' ')[0]; + const rawQuery = typeof query === 'object' ? query.sql : query; + // Extract the SQL verb + return rawQuery?.split(' ')?.[0]; } export const once = (fn: Function) => { diff --git a/plugins/node/opentelemetry-instrumentation-mysql2/test/mysql.test.ts b/plugins/node/opentelemetry-instrumentation-mysql2/test/mysql.test.ts index 698d2f14f5..c2664602a9 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql2/test/mysql.test.ts +++ b/plugins/node/opentelemetry-instrumentation-mysql2/test/mysql.test.ts @@ -17,7 +17,10 @@ import * as semver from 'semver'; import { context, trace, SpanStatusCode } from '@opentelemetry/api'; import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { + DbSystemValues, + SemanticAttributes, +} from '@opentelemetry/semantic-conventions'; import * as testUtils from '@opentelemetry/contrib-test-utils'; import { BasicTracerProvider, @@ -26,7 +29,7 @@ import { SimpleSpanProcessor, } from '@opentelemetry/sdk-trace-base'; import * as assert from 'assert'; -import { MySQL2Instrumentation } from '../src'; +import { MySQL2Instrumentation, MySQL2InstrumentationConfig } from '../src'; const LIB_VERSION = testUtils.getPackageVersion('mysql2'); const port = Number(process.env.MYSQL_PORT) || 33306; @@ -143,6 +146,10 @@ describe('mysql@2.x', () => { query.on('end', () => { const spans = memoryExporter.getFinishedSpans(); assert.strictEqual(spans[0].name, 'SELECT'); + assert.strictEqual( + spans[0].attributes[SemanticAttributes.DB_STATEMENT], + sql + ); done(); }); }); @@ -158,7 +165,11 @@ describe('mysql@2.x', () => { query.on('end', () => { const spans = memoryExporter.getFinishedSpans(); - assert.strictEqual(spans[0].name, sql); + assert.strictEqual(spans[0].name, 'SELECT'); + assert.strictEqual( + spans[0].attributes[SemanticAttributes.DB_STATEMENT], + query.sql + ); done(); }); }); @@ -644,6 +655,126 @@ describe('mysql@2.x', () => { ); }); }); + + describe('#responseHook', () => { + const queryResultAttribute = 'query_result'; + + after(() => { + instrumentation.setConfig({}); + }); + + describe('invalid repsonse hook', () => { + before(() => { + instrumentation.disable(); + instrumentation.setTracerProvider(provider); + const config: MySQL2InstrumentationConfig = { + responseHook: (span, responseHookInfo) => { + throw new Error('random failure!'); + }, + }; + instrumentation.setConfig(config); + instrumentation.enable(); + }); + + it('should not affect the behavior of the query', done => { + const span = provider.getTracer('default').startSpan('test span'); + context.with(trace.setSpan(context.active(), span), () => { + const sql = 'SELECT 1+1 as solution'; + connection.query(sql, (err, res: mysqlTypes.RowDataPacket[]) => { + assert.ifError(err); + assert.ok(res); + assert.strictEqual(res[0].solution, 2); + done(); + }); + }); + }); + }); + + describe('valid response hook', () => { + before(() => { + instrumentation.disable(); + instrumentation.setTracerProvider(provider); + const config: MySQL2InstrumentationConfig = { + responseHook: (span, responseHookInfo) => { + span.setAttribute( + queryResultAttribute, + JSON.stringify(responseHookInfo.queryResults) + ); + }, + }; + instrumentation.setConfig(config); + instrumentation.enable(); + }); + + it('should extract data from responseHook - connection', done => { + const span = provider.getTracer('default').startSpan('test span'); + context.with(trace.setSpan(context.active(), span), () => { + const sql = 'SELECT 1+1 as solution'; + connection.query(sql, (err, res: mysqlTypes.RowDataPacket[]) => { + assert.ifError(err); + assert.ok(res); + assert.strictEqual(res[0].solution, 2); + const spans = memoryExporter.getFinishedSpans(); + assert.strictEqual(spans.length, 1); + assertSpan(spans[0], sql); + assert.strictEqual( + spans[0].attributes[queryResultAttribute], + JSON.stringify(res) + ); + done(); + }); + }); + }); + + it('should extract data from responseHook - pool', done => { + const span = provider.getTracer('default').startSpan('test span'); + context.with(trace.setSpan(context.active(), span), () => { + const sql = 'SELECT 1+1 as solution'; + pool.getConnection((err, conn) => { + conn.query(sql, (err, res: mysqlTypes.RowDataPacket[]) => { + assert.ifError(err); + assert.ok(res); + assert.strictEqual(res[0].solution, 2); + const spans = memoryExporter.getFinishedSpans(); + assert.strictEqual(spans.length, 1); + assertSpan(spans[0], sql); + assert.strictEqual( + spans[0].attributes[queryResultAttribute], + JSON.stringify(res) + ); + done(); + }); + }); + }); + }); + + it('should extract data from responseHook - poolCluster', done => { + poolCluster.getConnection((err, poolClusterConnection) => { + assert.ifError(err); + const span = provider.getTracer('default').startSpan('test span'); + context.with(trace.setSpan(context.active(), span), () => { + const sql = 'SELECT 1+1 as solution'; + poolClusterConnection.query( + sql, + (err, res: mysqlTypes.RowDataPacket[]) => { + assert.ifError(err); + assert.ok(res); + assert.strictEqual(res[0].solution, 2); + const spans = memoryExporter.getFinishedSpans(); + assert.strictEqual(spans.length, 1); + assertSpan(spans[0], sql); + assert.strictEqual( + spans[0].attributes[queryResultAttribute], + JSON.stringify(res) + ); + done(); + } + ); + }); + }); + }); + }); + }); }); function assertSpan( @@ -652,7 +783,10 @@ function assertSpan( values?: any, errorMessage?: string ) { - assert.strictEqual(span.attributes[SemanticAttributes.DB_SYSTEM], 'mysql'); + assert.strictEqual( + span.attributes[SemanticAttributes.DB_SYSTEM], + DbSystemValues.MYSQL + ); assert.strictEqual(span.attributes[SemanticAttributes.DB_NAME], database); assert.strictEqual(span.attributes[SemanticAttributes.NET_PEER_PORT], port); assert.strictEqual(span.attributes[SemanticAttributes.NET_PEER_NAME], host); diff --git a/plugins/node/opentelemetry-instrumentation-nestjs-core/package.json b/plugins/node/opentelemetry-instrumentation-nestjs-core/package.json index 43dd517329..eea07261c0 100644 --- a/plugins/node/opentelemetry-instrumentation-nestjs-core/package.json +++ b/plugins/node/opentelemetry-instrumentation-nestjs-core/package.json @@ -7,11 +7,11 @@ "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "clean": "rimraf build/*", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "compile:watch": "tsc -w", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-nestjs-core --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-nestjs-core --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", diff --git a/plugins/node/opentelemetry-instrumentation-net/package.json b/plugins/node/opentelemetry-instrumentation-net/package.json index 9120baf950..be45fc640a 100644 --- a/plugins/node/opentelemetry-instrumentation-net/package.json +++ b/plugins/node/opentelemetry-instrumentation-net/package.json @@ -11,11 +11,11 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-net --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-net --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc -p ." + "compile": "tsc -p ." }, "keywords": [ "connect", diff --git a/plugins/node/opentelemetry-instrumentation-pg/package.json b/plugins/node/opentelemetry-instrumentation-pg/package.json index 94333e09a8..5daa7d09ee 100644 --- a/plugins/node/opentelemetry-instrumentation-pg/package.json +++ b/plugins/node/opentelemetry-instrumentation-pg/package.json @@ -7,10 +7,10 @@ "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "clean": "rimraf build/*", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-pg --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-pg --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "tdd": "npm run test -- --watch-extensions ts --watch", diff --git a/plugins/node/opentelemetry-instrumentation-pino/package.json b/plugins/node/opentelemetry-instrumentation-pino/package.json index 8c823a3f20..6234e05d95 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/package.json +++ b/plugins/node/opentelemetry-instrumentation-pino/package.json @@ -12,11 +12,11 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-pino --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-pino --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc -p ." + "compile": "tsc -p ." }, "keywords": [ "instrumentation", diff --git a/plugins/node/opentelemetry-instrumentation-redis/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-redis/CHANGELOG.md index 377181106a..4e8e9cc526 100644 --- a/plugins/node/opentelemetry-instrumentation-redis/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-redis/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [0.29.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-redis-v0.28.0...instrumentation-redis-v0.29.0) (2022-03-02) + + +### ⚠ BREAKING CHANGES + +* **mysql*,redis:** net.peer.ip -> db.connection_string + +### Bug Fixes + +* **mysql*,redis:** net.peer.ip -> db.connection_string ([bf39b90](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/bf39b908fd64cec92c862b2deca5d760ddcf4509)) +* **opentelemetry-instrumentation-redis:** add condition before error print ([#897](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/897)) ([f1d2fd0](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/f1d2fd084c8e3e494e3606c4eca53158495f43f6)) + ## [0.28.0](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-redis-v0.27.0...instrumentation-redis-v0.28.0) (2022-01-24) @@ -48,4 +60,4 @@ * The following workspace dependencies were updated * devDependencies - * @opentelemetry/contrib-test-utils bumped from ^0.25.0 to ^0.27.0 \ No newline at end of file + * @opentelemetry/contrib-test-utils bumped from ^0.25.0 to ^0.27.0 diff --git a/plugins/node/opentelemetry-instrumentation-redis/README.md b/plugins/node/opentelemetry-instrumentation-redis/README.md index 0c2cf66eca..c3ee1915a6 100644 --- a/plugins/node/opentelemetry-instrumentation-redis/README.md +++ b/plugins/node/opentelemetry-instrumentation-redis/README.md @@ -20,7 +20,7 @@ npm install --save @opentelemetry/instrumentation-redis ### Supported Versions -- `>=2.6.0` +- `^2.6.0 || ^3.0.0` (version `4` is not yet supported) ## Usage diff --git a/plugins/node/opentelemetry-instrumentation-redis/package.json b/plugins/node/opentelemetry-instrumentation-redis/package.json index eae843fed6..4e4f3cd2ae 100644 --- a/plugins/node/opentelemetry-instrumentation-redis/package.json +++ b/plugins/node/opentelemetry-instrumentation-redis/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-redis", - "version": "0.28.0", + "version": "0.29.0", "description": "OpenTelemetry redis automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -15,10 +15,10 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-redis --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-redis --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "prepare": "npm run compile" }, "keywords": [ diff --git a/plugins/node/opentelemetry-instrumentation-redis/src/utils.ts b/plugins/node/opentelemetry-instrumentation-redis/src/utils.ts index 471e288dbc..4f74b17a19 100644 --- a/plugins/node/opentelemetry-instrumentation-redis/src/utils.ts +++ b/plugins/node/opentelemetry-instrumentation-redis/src/utils.ts @@ -32,7 +32,10 @@ import { } from './types'; import { EventEmitter } from 'events'; import { RedisInstrumentation } from './'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { + DbSystemValues, + SemanticAttributes, +} from '@opentelemetry/semantic-conventions'; import { safeExecuteInTheMiddle } from '@opentelemetry/instrumentation'; const endSpan = (span: Span, err?: Error | null) => { @@ -102,7 +105,7 @@ export const getTracedInternalSendCommand = ( { kind: SpanKind.CLIENT, attributes: { - [SemanticAttributes.DB_SYSTEM]: RedisInstrumentation.COMPONENT, + [SemanticAttributes.DB_SYSTEM]: DbSystemValues.REDIS, [SemanticAttributes.DB_STATEMENT]: dbStatementSerializer( cmd.command, cmd.args @@ -120,7 +123,7 @@ export const getTracedInternalSendCommand = ( } if (this.address) { span.setAttribute( - SemanticAttributes.NET_PEER_IP, + SemanticAttributes.DB_CONNECTION_STRING, `redis://${this.address}` ); } diff --git a/plugins/node/opentelemetry-instrumentation-redis/test/redis.test.ts b/plugins/node/opentelemetry-instrumentation-redis/test/redis.test.ts index 9728e05b12..09842809fc 100644 --- a/plugins/node/opentelemetry-instrumentation-redis/test/redis.test.ts +++ b/plugins/node/opentelemetry-instrumentation-redis/test/redis.test.ts @@ -31,7 +31,10 @@ import { } from '@opentelemetry/sdk-trace-base'; import * as assert from 'assert'; import { RedisInstrumentation } from '../src'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { + DbSystemValues, + SemanticAttributes, +} from '@opentelemetry/semantic-conventions'; const instrumentation = new RedisInstrumentation(); instrumentation.enable(); @@ -50,10 +53,10 @@ const CONFIG = { const URL = `redis://${CONFIG.host}:${CONFIG.port}`; const DEFAULT_ATTRIBUTES = { - [SemanticAttributes.DB_SYSTEM]: RedisInstrumentation.COMPONENT, + [SemanticAttributes.DB_SYSTEM]: DbSystemValues.REDIS, [SemanticAttributes.NET_PEER_NAME]: CONFIG.host, [SemanticAttributes.NET_PEER_PORT]: CONFIG.port, - [SemanticAttributes.NET_PEER_IP]: URL, + [SemanticAttributes.DB_CONNECTION_STRING]: URL, }; const unsetStatus: SpanStatus = { diff --git a/plugins/node/opentelemetry-instrumentation-restify/package.json b/plugins/node/opentelemetry-instrumentation-restify/package.json index 277ebee0c5..083f9278f3 100644 --- a/plugins/node/opentelemetry-instrumentation-restify/package.json +++ b/plugins/node/opentelemetry-instrumentation-restify/package.json @@ -11,10 +11,10 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-restify --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-restify --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "prepare": "npm run compile", "watch": "tsc -w" }, diff --git a/plugins/node/opentelemetry-instrumentation-router/package.json b/plugins/node/opentelemetry-instrumentation-router/package.json index 96afaef04a..4272f4e5ae 100644 --- a/plugins/node/opentelemetry-instrumentation-router/package.json +++ b/plugins/node/opentelemetry-instrumentation-router/package.json @@ -11,10 +11,10 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-router --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-router --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "prepare": "npm run compile", "watch": "tsc -w" }, diff --git a/plugins/node/opentelemetry-instrumentation-winston/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-winston/CHANGELOG.md index 0d2ca9c92d..fb742e403c 100644 --- a/plugins/node/opentelemetry-instrumentation-winston/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-winston/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [0.27.2](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-winston-v0.27.1...instrumentation-winston-v0.27.2) (2022-03-02) + + +### Bug Fixes + +* **documentation:** mixed up winston readme for hook ([#910](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/910)) ([0a557e8](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/0a557e86c0d70dc6ab7af9736b1746f89c5fc8bf)) + ### [0.27.1](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-winston-v0.27.0...instrumentation-winston-v0.27.1) (2022-01-24) diff --git a/plugins/node/opentelemetry-instrumentation-winston/package.json b/plugins/node/opentelemetry-instrumentation-winston/package.json index 72bce86e6d..86af3b9319 100644 --- a/plugins/node/opentelemetry-instrumentation-winston/package.json +++ b/plugins/node/opentelemetry-instrumentation-winston/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-winston", - "version": "0.27.1", + "version": "0.27.2", "description": "OpenTelemetry instrumentation for winston", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -12,11 +12,11 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-winston --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-winston --include-dependencies", "prewatch": "npm run precompile", "prepare": "npm run compile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc -p ." + "compile": "tsc -p ." }, "keywords": [ "instrumentation", diff --git a/plugins/node/opentelemetry-instrumentation-winston/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-winston/src/instrumentation.ts index 16ef6b9a48..3db88c7921 100644 --- a/plugins/node/opentelemetry-instrumentation-winston/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-winston/src/instrumentation.ts @@ -29,13 +29,13 @@ import { isWrapped, safeExecuteInTheMiddle, } from '@opentelemetry/instrumentation'; -import { - WinstonInstrumentationConfig, +import type { WinstonInstrumentationConfig } from './types'; +import type { Winston2LogMethod, Winston2LoggerModule, Winston3LogMethod, Winston3Logger, -} from './types'; +} from './internal-types'; import { VERSION } from './version'; const winston3Versions = ['>=3 <4']; diff --git a/plugins/node/opentelemetry-instrumentation-fastify/src/version.ts b/plugins/node/opentelemetry-instrumentation-winston/src/internal-types.ts similarity index 58% rename from plugins/node/opentelemetry-instrumentation-fastify/src/version.ts rename to plugins/node/opentelemetry-instrumentation-winston/src/internal-types.ts index 2c1c3f80c6..0138a85266 100644 --- a/plugins/node/opentelemetry-instrumentation-fastify/src/version.ts +++ b/plugins/node/opentelemetry-instrumentation-winston/src/internal-types.ts @@ -14,5 +14,16 @@ * limitations under the License. */ -// this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.25.0'; +import type { Logger as Winston3Logger } from 'winston'; +import type { + LoggerInstance as Winston2Logger, + LogMethod as Winston2LogMethod, +} from 'winston2'; +export type Winston3LogMethod = Winston3Logger['write']; +export type { Winston3Logger }; + +export type { Winston2LogMethod }; +export type Winston2LoggerModule = { + Logger: Winston2Logger & { prototype: { log: Winston2LogMethod } }; +}; +export type { Winston2Logger }; diff --git a/plugins/node/opentelemetry-instrumentation-winston/src/types.ts b/plugins/node/opentelemetry-instrumentation-winston/src/types.ts index 1901c2e928..d3fa20eb12 100644 --- a/plugins/node/opentelemetry-instrumentation-winston/src/types.ts +++ b/plugins/node/opentelemetry-instrumentation-winston/src/types.ts @@ -16,11 +16,6 @@ import { Span } from '@opentelemetry/api'; import { InstrumentationConfig } from '@opentelemetry/instrumentation'; -import type { Logger as Winston3Logger } from 'winston'; -import type { - LoggerInstance as Winston2Logger, - LogMethod as Winston2LogMethod, -} from 'winston2'; // eslint-disable-next-line @typescript-eslint/no-explicit-any export type LogHookFunction = (span: Span, record: Record) => void; @@ -28,12 +23,3 @@ export type LogHookFunction = (span: Span, record: Record) => void; export interface WinstonInstrumentationConfig extends InstrumentationConfig { logHook?: LogHookFunction; } - -export type Winston3LogMethod = Winston3Logger['write']; -export type { Winston3Logger }; - -export type { Winston2LogMethod }; -export type Winston2LoggerModule = { - Logger: Winston2Logger & { prototype: { log: Winston2LogMethod } }; -}; -export type { Winston2Logger }; diff --git a/plugins/node/opentelemetry-instrumentation-winston/test/winston.test.ts b/plugins/node/opentelemetry-instrumentation-winston/test/winston.test.ts index a38d4d16f1..bdc8ff8d80 100644 --- a/plugins/node/opentelemetry-instrumentation-winston/test/winston.test.ts +++ b/plugins/node/opentelemetry-instrumentation-winston/test/winston.test.ts @@ -25,7 +25,7 @@ import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks'; import * as assert from 'assert'; import * as sinon from 'sinon'; import { Writable } from 'stream'; -import type { Winston2Logger, Winston3Logger } from '../src/types'; +import type { Winston2Logger, Winston3Logger } from '../src/internal-types'; import { WinstonInstrumentation } from '../src'; const memoryExporter = new InMemorySpanExporter(); diff --git a/plugins/web/opentelemetry-instrumentation-document-load/package.json b/plugins/web/opentelemetry-instrumentation-document-load/package.json index 773959daad..ae6c85679f 100644 --- a/plugins/web/opentelemetry-instrumentation-document-load/package.json +++ b/plugins/web/opentelemetry-instrumentation-document-load/package.json @@ -10,7 +10,7 @@ "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-document-load --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-document-load --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", "compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json", @@ -60,7 +60,7 @@ "colors": "1.4.0", "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.14", + "karma": "6.3.16", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", diff --git a/plugins/web/opentelemetry-instrumentation-long-task/CHANGELOG.md b/plugins/web/opentelemetry-instrumentation-long-task/CHANGELOG.md new file mode 100644 index 0000000000..7a64bb0b7d --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-long-task/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog + +## [0.28.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-long-task-v0.27.0...instrumentation-long-task-v0.28.0) (2022-03-02) + + +### Features + +* Long Tasks instrumentation ([#757](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/757)) ([56d332e](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/56d332e58ab2ed35fc11c4b30c8a812dd41670d3)) +* **longtasks:** allow callback to add span attributes on collection ([#863](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/863)) ([1f68004](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/1f68004ef9b25b0d260159f4b1e2f279b1a64649)) +* upstream mocha instrumentation testing plugin from ext-js [#621](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/621) ([#669](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/669)) ([a5170c4](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/a5170c494706a2bec3ba51e59966d0ca8a41d00e)) + + +### Bug Fixes + +* rename lerna's --include-filtered-dependencies option ([#817](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/817)) ([cf268e7](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/cf268e7a92b7800ad6dbec9ca77466f9ee03ee1a)) diff --git a/plugins/web/opentelemetry-instrumentation-long-task/package.json b/plugins/web/opentelemetry-instrumentation-long-task/package.json index dafa0a0093..1008373386 100644 --- a/plugins/web/opentelemetry-instrumentation-long-task/package.json +++ b/plugins/web/opentelemetry-instrumentation-long-task/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-long-task", - "version": "0.27.0", + "version": "0.28.0", "description": "OpenTelemetry long task API automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -10,7 +10,7 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-user-interaction --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-user-interaction --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", "compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json", @@ -59,7 +59,7 @@ "colors": "1.4.0", "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.14", + "karma": "6.3.16", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-jquery": "0.2.4", diff --git a/plugins/web/opentelemetry-instrumentation-user-interaction/package.json b/plugins/web/opentelemetry-instrumentation-user-interaction/package.json index cb764fc1e8..d1db3dbb09 100644 --- a/plugins/web/opentelemetry-instrumentation-user-interaction/package.json +++ b/plugins/web/opentelemetry-instrumentation-user-interaction/package.json @@ -10,7 +10,7 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-user-interaction --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-user-interaction --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", "compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json", @@ -61,7 +61,7 @@ "colors": "1.4.0", "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.14", + "karma": "6.3.16", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-jquery": "0.2.4", diff --git a/plugins/web/opentelemetry-plugin-react-load/package.json b/plugins/web/opentelemetry-plugin-react-load/package.json index ec12c5503a..7495d22afd 100644 --- a/plugins/web/opentelemetry-plugin-react-load/package.json +++ b/plugins/web/opentelemetry-plugin-react-load/package.json @@ -10,7 +10,7 @@ "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/plugin-react-load --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/plugin-react-load --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", "compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json", @@ -62,7 +62,7 @@ "colors": "1.4.0", "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.14", + "karma": "6.3.16", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", diff --git a/propagators/opentelemetry-propagator-aws-xray/package.json b/propagators/opentelemetry-propagator-aws-xray/package.json index 2fddeadb38..5075b1911e 100644 --- a/propagators/opentelemetry-propagator-aws-xray/package.json +++ b/propagators/opentelemetry-propagator-aws-xray/package.json @@ -7,7 +7,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "precompile": "tsc --version && lerna run version --scope @opentelemetry/propagator-aws-xray --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/propagator-aws-xray --include-dependencies", "prewatch": "npm run precompile", "compile": "tsc --build tsconfig.json tsconfig.esm.json", "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", @@ -15,7 +15,6 @@ "test:browser": "nyc karma start --single-run", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json", "prepare": "npm run compile" }, @@ -56,7 +55,7 @@ "colors": "1.4.0", "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.14", + "karma": "6.3.16", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", diff --git a/propagators/opentelemetry-propagator-grpc-census-binary/package.json b/propagators/opentelemetry-propagator-grpc-census-binary/package.json index 5cda1c6ceb..db91952f86 100644 --- a/propagators/opentelemetry-propagator-grpc-census-binary/package.json +++ b/propagators/opentelemetry-propagator-grpc-census-binary/package.json @@ -12,11 +12,10 @@ "clean": "rimraf build/*", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "precompile": "tsc --version && lerna run version --scope @opentelemetry/propagator-grpc-census-binary --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/propagator-grpc-census-binary --include-dependencies", "prewatch": "npm run precompile", - "compile": "npm run version:update && tsc -p .", + "compile": "tsc -p .", "prepare": "npm run compile", - "version:update": "node ../../scripts/version-update.js", "watch": "tsc -w" }, "keywords": [ diff --git a/propagators/opentelemetry-propagator-ot-trace/package.json b/propagators/opentelemetry-propagator-ot-trace/package.json index 1a9302cdb6..bb3c771585 100644 --- a/propagators/opentelemetry-propagator-ot-trace/package.json +++ b/propagators/opentelemetry-propagator-ot-trace/package.json @@ -7,7 +7,7 @@ "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "precompile": "tsc --version && lerna run version --scope @opentelemetry/propagator-ot-trace --include-dependencies", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/propagator-ot-trace --include-dependencies", "prewatch": "npm run precompile", "compile": "tsc --build tsconfig.json tsconfig.esm.json", "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", @@ -15,7 +15,6 @@ "test:browser": "nyc karma start --single-run", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json", "prepare": "npm run compile" }, @@ -57,7 +56,7 @@ "colors": "1.4.0", "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.14", + "karma": "6.3.16", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", diff --git a/renovate.json b/renovate.json index d07e3d25e9..6870e5991b 100644 --- a/renovate.json +++ b/renovate.json @@ -13,10 +13,8 @@ "rangeStrategy": "bump" } ], - "assignees": [ - "@dyladan", - "@mayurkale22" - ], + "ignoreDeps": ["lerna", "lerna-changelog"], + "assignees": ["@blumamir", "@dyladan", "@legendecas", "@Rauno56", "@vmarchaud"], "schedule": [ "before 3am on Friday" ],