diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 048875a6cf..061a464830 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -15,7 +15,7 @@ jobs: fetch-depth: 0 - name: Setup Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 14 registry-url: 'https://registry.npmjs.org' diff --git a/.github/workflows/test-all-versions.yml b/.github/workflows/test-all-versions.yml index 2b480d8be2..7941917545 100644 --- a/.github/workflows/test-all-versions.yml +++ b/.github/workflows/test-all-versions.yml @@ -110,7 +110,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Set MySQL variables diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index d5bdf612ce..2e82c88a96 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -118,7 +118,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Set MySQL variables @@ -177,7 +177,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Cache Dependencies diff --git a/detectors/node/opentelemetry-resource-detector-gcp/package.json b/detectors/node/opentelemetry-resource-detector-gcp/package.json index e4b529b531..edcc8bdf01 100644 --- a/detectors/node/opentelemetry-resource-detector-gcp/package.json +++ b/detectors/node/opentelemetry-resource-detector-gcp/package.json @@ -60,7 +60,7 @@ "@opentelemetry/core": "^1.0.0", "@opentelemetry/resources": "^1.0.0", "@opentelemetry/semantic-conventions": "^1.0.0", - "gcp-metadata": "^5.0.0" + "gcp-metadata": "^6.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/detectors/node/opentelemetry-resource-detector-gcp#readme" } diff --git a/detectors/node/opentelemetry-resource-detector-instana/package.json b/detectors/node/opentelemetry-resource-detector-instana/package.json index 1e9e571ccc..6ec0c3378d 100644 --- a/detectors/node/opentelemetry-resource-detector-instana/package.json +++ b/detectors/node/opentelemetry-resource-detector-instana/package.json @@ -41,7 +41,7 @@ "devDependencies": { "@opentelemetry/api": "^1.3.0", "@opentelemetry/contrib-test-utils": "^0.34.2", - "@opentelemetry/sdk-node": "^0.44.0", + "@opentelemetry/sdk-node": "^0.45.1", "@types/mocha": "8.2.3", "@types/node": "18.6.5", "@types/semver": "7.5.3", diff --git a/metapackages/auto-instrumentations-node/package.json b/metapackages/auto-instrumentations-node/package.json index 32b28a9efd..58cdba11d6 100644 --- a/metapackages/auto-instrumentations-node/package.json +++ b/metapackages/auto-instrumentations-node/package.json @@ -49,7 +49,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/instrumentation-amqplib": "^0.33.2", "@opentelemetry/instrumentation-aws-lambda": "^0.37.1", "@opentelemetry/instrumentation-aws-sdk": "^0.36.1", @@ -64,9 +64,9 @@ "@opentelemetry/instrumentation-fastify": "^0.32.3", "@opentelemetry/instrumentation-generic-pool": "^0.32.3", "@opentelemetry/instrumentation-graphql": "^0.35.2", - "@opentelemetry/instrumentation-grpc": "^0.44.0", + "@opentelemetry/instrumentation-grpc": "^0.45.1", "@opentelemetry/instrumentation-hapi": "^0.33.1", - "@opentelemetry/instrumentation-http": "^0.44.0", + "@opentelemetry/instrumentation-http": "^0.45.1", "@opentelemetry/instrumentation-ioredis": "^0.35.2", "@opentelemetry/instrumentation-knex": "^0.32.2", "@opentelemetry/instrumentation-koa": "^0.36.1", @@ -92,6 +92,6 @@ "@opentelemetry/resource-detector-container": "^0.3.2", "@opentelemetry/resource-detector-gcp": "^0.29.2", "@opentelemetry/resources": "^1.12.0", - "@opentelemetry/sdk-node": "^0.44.0" + "@opentelemetry/sdk-node": "^0.45.1" } } diff --git a/metapackages/auto-instrumentations-node/src/index.ts b/metapackages/auto-instrumentations-node/src/index.ts index 3c0c688a05..6224f95413 100644 --- a/metapackages/auto-instrumentations-node/src/index.ts +++ b/metapackages/auto-instrumentations-node/src/index.ts @@ -14,4 +14,8 @@ * limitations under the License. */ -export { getNodeAutoInstrumentations, InstrumentationConfigMap } from './utils'; +export { + getNodeAutoInstrumentations, + getResourceDetectorsFromEnv, + InstrumentationConfigMap, +} from './utils'; diff --git a/metapackages/auto-instrumentations-web/package.json b/metapackages/auto-instrumentations-web/package.json index d951c334eb..7c20328752 100644 --- a/metapackages/auto-instrumentations-web/package.json +++ b/metapackages/auto-instrumentations-web/package.json @@ -30,7 +30,8 @@ "url": "https://github.com/open-telemetry/opentelemetry-js-contrib/issues" }, "peerDependencies": { - "@opentelemetry/api": "^1.3.0" + "@opentelemetry/api": "^1.3.0", + "zone.js": "0.11.4" }, "devDependencies": { "@babel/core": "7.22.17", @@ -59,10 +60,10 @@ "webpack-merge": "5.8.0" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/instrumentation-document-load": "^0.33.2", - "@opentelemetry/instrumentation-fetch": "^0.44.0", + "@opentelemetry/instrumentation-fetch": "^0.45.1", "@opentelemetry/instrumentation-user-interaction": "^0.33.2", - "@opentelemetry/instrumentation-xml-http-request": "^0.44.0" + "@opentelemetry/instrumentation-xml-http-request": "^0.45.1" } } diff --git a/packages/opentelemetry-host-metrics/src/enum.ts b/packages/opentelemetry-host-metrics/src/enum.ts index a4ed9a637b..c23bc57587 100644 --- a/packages/opentelemetry-host-metrics/src/enum.ts +++ b/packages/opentelemetry-host-metrics/src/enum.ts @@ -27,6 +27,11 @@ export enum METRIC_NAMES { PROCESS_MEMORY_USAGE = 'process.memory.usage', } +export enum METRIC_ATTRIBUTES { + SYSTEM_CPU_LOGICAL_NUMBER = 'system.cpu.logical_number', + SYSTEM_CPU_STATE = 'system.cpu.state', +} + export enum CPU_LABELS { USER = 'user', SYSTEM = 'system', diff --git a/packages/opentelemetry-host-metrics/src/metric.ts b/packages/opentelemetry-host-metrics/src/metric.ts index e89b69887b..022ba8d051 100644 --- a/packages/opentelemetry-host-metrics/src/metric.ts +++ b/packages/opentelemetry-host-metrics/src/metric.ts @@ -40,48 +40,51 @@ export class HostMetrics extends BaseMetrics { observableResult: api.BatchObservableResult, cpuUsages: CpuUsageData[] ): void { + const stateAttr = enums.METRIC_ATTRIBUTES.SYSTEM_CPU_STATE; + const cpuAttr = enums.METRIC_ATTRIBUTES.SYSTEM_CPU_LOGICAL_NUMBER; + for (let i = 0, j = cpuUsages.length; i < j; i++) { const cpuUsage = cpuUsages[i]; observableResult.observe(this._cpuTime, cpuUsage.user, { - state: enums.CPU_LABELS.USER, - cpu: cpuUsage.cpuNumber, + [stateAttr]: enums.CPU_LABELS.USER, + [cpuAttr]: cpuUsage.cpuNumber, }); observableResult.observe(this._cpuTime, cpuUsage.system, { - state: enums.CPU_LABELS.SYSTEM, - cpu: cpuUsage.cpuNumber, + [stateAttr]: enums.CPU_LABELS.SYSTEM, + [cpuAttr]: cpuUsage.cpuNumber, }); observableResult.observe(this._cpuTime, cpuUsage.idle, { - state: enums.CPU_LABELS.IDLE, - cpu: cpuUsage.cpuNumber, + [stateAttr]: enums.CPU_LABELS.IDLE, + [cpuAttr]: cpuUsage.cpuNumber, }); observableResult.observe(this._cpuTime, cpuUsage.interrupt, { - state: enums.CPU_LABELS.INTERRUPT, - cpu: cpuUsage.cpuNumber, + [stateAttr]: enums.CPU_LABELS.INTERRUPT, + [cpuAttr]: cpuUsage.cpuNumber, }); observableResult.observe(this._cpuTime, cpuUsage.nice, { - state: enums.CPU_LABELS.NICE, - cpu: cpuUsage.cpuNumber, + [stateAttr]: enums.CPU_LABELS.NICE, + [cpuAttr]: cpuUsage.cpuNumber, }); observableResult.observe(this._cpuUtilization, cpuUsage.userP, { - state: enums.CPU_LABELS.USER, - cpu: cpuUsage.cpuNumber, + [stateAttr]: enums.CPU_LABELS.USER, + [cpuAttr]: cpuUsage.cpuNumber, }); observableResult.observe(this._cpuUtilization, cpuUsage.systemP, { - state: enums.CPU_LABELS.SYSTEM, - cpu: cpuUsage.cpuNumber, + [stateAttr]: enums.CPU_LABELS.SYSTEM, + [cpuAttr]: cpuUsage.cpuNumber, }); observableResult.observe(this._cpuUtilization, cpuUsage.idleP, { - state: enums.CPU_LABELS.IDLE, - cpu: cpuUsage.cpuNumber, + [stateAttr]: enums.CPU_LABELS.IDLE, + [cpuAttr]: cpuUsage.cpuNumber, }); observableResult.observe(this._cpuUtilization, cpuUsage.interruptP, { - state: enums.CPU_LABELS.INTERRUPT, - cpu: cpuUsage.cpuNumber, + [stateAttr]: enums.CPU_LABELS.INTERRUPT, + [cpuAttr]: cpuUsage.cpuNumber, }); observableResult.observe(this._cpuUtilization, cpuUsage.niceP, { - state: enums.CPU_LABELS.NICE, - cpu: cpuUsage.cpuNumber, + [stateAttr]: enums.CPU_LABELS.NICE, + [cpuAttr]: cpuUsage.cpuNumber, }); } } diff --git a/packages/opentelemetry-host-metrics/src/stats/common.ts b/packages/opentelemetry-host-metrics/src/stats/common.ts index b74522ae0d..520dc2cd2b 100644 --- a/packages/opentelemetry-host-metrics/src/stats/common.ts +++ b/packages/opentelemetry-host-metrics/src/stats/common.ts @@ -22,28 +22,39 @@ const MILLISECOND = 1 / 1e3; let cpuUsageTime: number | undefined = undefined; /** - * It returns cpu load delta from last time - to be used with SumObservers. - * When called first time it will return 0 and then delta will be calculated + * We get data as soon as we load the module so the 1st collect + * of the metric already has valuable data to be sent. + */ +let prevOsData: { time: number; cpus: os.CpuInfo[] } = { + time: Date.now(), + cpus: os.cpus(), +}; + +/** + * For each CPU returned by `os.cpus()` it returns + * - the CPU times in each state (user, sys, ...) in seconds + * - the % of time the CPU was in each state since last measurement */ export function getCpuUsageData(): CpuUsageData[] { - if (typeof cpuUsageTime !== 'number') { - cpuUsageTime = new Date().getTime() - process.uptime() * 1000; - } + const currentTime = Date.now(); + const timeElapsed = currentTime - prevOsData.time; + const currentOsData = { time: currentTime, cpus: os.cpus() }; - const timeElapsed = (new Date().getTime() - cpuUsageTime) / 1000; + const usageData = currentOsData.cpus.map((cpu, cpuNumber) => { + const prevTimes = prevOsData.cpus[cpuNumber].times; + const currTimes = cpu.times; - return os.cpus().map((cpu, cpuNumber) => { - const idle = cpu.times.idle * MILLISECOND; - const user = cpu.times.user * MILLISECOND; - const system = cpu.times.sys * MILLISECOND; - const interrupt = cpu.times.irq * MILLISECOND; - const nice = cpu.times.nice * MILLISECOND; + const idle = currTimes.idle * MILLISECOND; + const user = currTimes.user * MILLISECOND; + const system = currTimes.sys * MILLISECOND; + const interrupt = currTimes.irq * MILLISECOND; + const nice = currTimes.nice * MILLISECOND; - const idleP = idle / timeElapsed; - const userP = user / timeElapsed; - const systemP = system / timeElapsed; - const interruptP = interrupt / timeElapsed; - const niceP = nice / timeElapsed; + const idleP = (currTimes.idle - prevTimes.idle) / timeElapsed; + const userP = (currTimes.user - prevTimes.user) / timeElapsed; + const systemP = (currTimes.sys - prevTimes.sys) / timeElapsed; + const interruptP = (currTimes.irq - prevTimes.irq) / timeElapsed; + const niceP = (currTimes.nice - prevTimes.nice) / timeElapsed; return { cpuNumber: String(cpuNumber), @@ -59,6 +70,10 @@ export function getCpuUsageData(): CpuUsageData[] { niceP, }; }); + + prevOsData = currentOsData; + + return usageData; } /** diff --git a/packages/opentelemetry-host-metrics/test/metric.test.ts b/packages/opentelemetry-host-metrics/test/metric.test.ts index 39b4fdb8eb..57251aaba2 100644 --- a/packages/opentelemetry-host-metrics/test/metric.test.ts +++ b/packages/opentelemetry-host-metrics/test/metric.test.ts @@ -27,6 +27,7 @@ import { import * as assert from 'assert'; import * as os from 'os'; import * as sinon from 'sinon'; +import { METRIC_ATTRIBUTES } from '../src/enum'; import { HostMetrics } from '../src'; const cpuJson = require('./mocks/cpu.json'); @@ -68,6 +69,10 @@ const mockedOS = { totalmem: function () { return 1024 * 1024; }, + cpusIdx: 0, + cpus: function () { + return cpuJson[this.cpusIdx++ % 2]; + }, }; const INTERVAL = 3000; @@ -112,7 +117,7 @@ describe('Host Metrics', () => { return mockedOS.freemem(); }); sandbox.stub(os, 'totalmem').returns(mockedOS.totalmem()); - sandbox.stub(os, 'cpus').returns(cpuJson); + sandbox.stub(os, 'cpus').callsFake(() => mockedOS.cpus()); sandbox.stub(process, 'uptime').returns(0); sandbox.stub(SI, 'networkStats').callsFake(() => { return mockedSI.networkStats(); @@ -146,6 +151,9 @@ describe('Host Metrics', () => { await reader.collect(); dateStub.returns(process.uptime() * 1000 + INTERVAL); + // advance the clock for the next collection + sandbox.clock.tick(1000); + // invalidates throttles countSI = 0; }); @@ -153,36 +161,119 @@ describe('Host Metrics', () => { sandbox.restore(); }); + const sysCpuStateAttr = METRIC_ATTRIBUTES.SYSTEM_CPU_STATE; + const sysCpuNumAttr = METRIC_ATTRIBUTES.SYSTEM_CPU_LOGICAL_NUMBER; + it('should export CPU time metrics', async () => { const metric = await getRecords(reader, 'system.cpu.time'); - ensureValue(metric, { state: 'user', cpu: '0' }, 90713.56); - ensureValue(metric, { state: 'system', cpu: '0' }, 63192.630000000005); - ensureValue(metric, { state: 'idle', cpu: '0' }, 374870.7); - ensureValue(metric, { state: 'interrupt', cpu: '0' }, 0); - ensureValue(metric, { state: 'nice', cpu: '0' }, 0); - - ensureValue(metric, { state: 'user', cpu: '1' }, 11005.42); - ensureValue(metric, { state: 'system', cpu: '1' }, 7678.12); - ensureValue(metric, { state: 'idle', cpu: '1' }, 510034.8); - ensureValue(metric, { state: 'interrupt', cpu: '1' }, 0); - ensureValue(metric, { state: 'nice', cpu: '1' }, 0); + ensureValue( + metric, + { [sysCpuStateAttr]: 'user', [sysCpuNumAttr]: '0' }, + 90714.26 + ); + ensureValue( + metric, + { [sysCpuStateAttr]: 'system', [sysCpuNumAttr]: '0' }, + 63192.83 + ); + ensureValue( + metric, + { [sysCpuStateAttr]: 'idle', [sysCpuNumAttr]: '0' }, + 374870.8 + ); + ensureValue( + metric, + { [sysCpuStateAttr]: 'interrupt', [sysCpuNumAttr]: '0' }, + 0 + ); + ensureValue( + metric, + { [sysCpuStateAttr]: 'nice', [sysCpuNumAttr]: '0' }, + 0 + ); + + ensureValue( + metric, + { [sysCpuStateAttr]: 'user', [sysCpuNumAttr]: '1' }, + 11005.72 + ); + ensureValue( + metric, + { [sysCpuStateAttr]: 'system', [sysCpuNumAttr]: '1' }, + 7678.62 + ); + ensureValue( + metric, + { [sysCpuStateAttr]: 'idle', [sysCpuNumAttr]: '1' }, + 510035 + ); + ensureValue( + metric, + { [sysCpuStateAttr]: 'interrupt', [sysCpuNumAttr]: '1' }, + 0 + ); + ensureValue( + metric, + { [sysCpuStateAttr]: 'nice', [sysCpuNumAttr]: '1' }, + 0 + ); }); it('should export CPU utilization metrics', async () => { const metric = await getRecords(reader, 'system.cpu.utilization'); - ensureValue(metric, { state: 'user', cpu: '0' }, 30247.935978659552); - ensureValue(metric, { state: 'system', cpu: '0' }, 21071.23374458153); - ensureValue(metric, { state: 'idle', cpu: '0' }, 124998.56618872957); - ensureValue(metric, { state: 'interrupt', cpu: '0' }, 0); - ensureValue(metric, { state: 'nice', cpu: '0' }, 0); - - ensureValue(metric, { state: 'user', cpu: '1' }, 3669.6965655218405); - ensureValue(metric, { state: 'system', cpu: '1' }, 2560.2267422474156); - ensureValue(metric, { state: 'idle', cpu: '1' }, 170068.28942980993); - ensureValue(metric, { state: 'interrupt', cpu: '1' }, 0); - ensureValue(metric, { state: 'nice', cpu: '1' }, 0); + ensureValue( + metric, + { [sysCpuStateAttr]: 'user', [sysCpuNumAttr]: '0' }, + 0.7 + ); + ensureValue( + metric, + { [sysCpuStateAttr]: 'system', [sysCpuNumAttr]: '0' }, + 0.2 + ); + ensureValue( + metric, + { [sysCpuStateAttr]: 'idle', [sysCpuNumAttr]: '0' }, + 0.1 + ); + ensureValue( + metric, + { [sysCpuStateAttr]: 'interrupt', [sysCpuNumAttr]: '0' }, + 0 + ); + ensureValue( + metric, + { [sysCpuStateAttr]: 'nice', [sysCpuNumAttr]: '0' }, + 0 + ); + + ensureValue( + metric, + { [sysCpuStateAttr]: 'user', [sysCpuNumAttr]: '1' }, + 0.3 + ); + ensureValue( + metric, + { [sysCpuStateAttr]: 'system', [sysCpuNumAttr]: '1' }, + 0.5 + ); + ensureValue( + metric, + { [sysCpuStateAttr]: 'idle', [sysCpuNumAttr]: '1' }, + 0.2 + ); + ensureValue( + metric, + { [sysCpuStateAttr]: 'interrupt', [sysCpuNumAttr]: '1' }, + 0 + ); + ensureValue( + metric, + { [sysCpuStateAttr]: 'nice', [sysCpuNumAttr]: '1' }, + 0 + ); }); it('should export Memory usage metrics', async () => { diff --git a/packages/opentelemetry-host-metrics/test/mocks/cpu.json b/packages/opentelemetry-host-metrics/test/mocks/cpu.json index d9831b12a1..bb8beec726 100644 --- a/packages/opentelemetry-host-metrics/test/mocks/cpu.json +++ b/packages/opentelemetry-host-metrics/test/mocks/cpu.json @@ -1,22 +1,54 @@ -[{ - "model": "CPU @ 2.60GHz", - "speed": 2600, - "times": { - "user": 90713560, - "nice": 0, - "sys": 63192630, - "idle": 374870700, - "irq": 0 - } -}, { - "model": "CPU @ 2.60GHz", - "speed": 2600, - "times": { - "user": 11005420, - "nice": 0, - "sys": 7678120, - "idle": 510034800, - "irq": 0 - } -} -] +[ + [ + { + "model": "CPU @ 2.60GHz", + "speed": 2600, + "// times": "this is the 1st collect of CPU data which will be used to calc utilization", + "times": { + "user": 90713560, + "nice": 0, + "sys": 63192630, + "idle": 374870700, + "irq": 0 + } + }, + { + "model": "CPU @ 2.60GHz", + "speed": 2600, + "// times": "this is the 1st collect of CPU data which will be used to calc utilization", + "times": { + "user": 11005420, + "nice": 0, + "sys": 7678120, + "idle": 510034800, + "irq": 0 + } + } + ], + [ + { + "model": "CPU @ 2.60GHz", + "speed": 2600, + "// times": "assuming a time delta of 1000ms we distribute 70% to user, 20% to sys and 10% to idle", + "times": { + "user": 90714260, + "nice": 0, + "sys": 63192830, + "idle": 374870800, + "irq": 0 + } + }, + { + "model": "CPU @ 2.60GHz", + "speed": 2600, + "// times": "assuming a time delta of 1000ms we distribute 30% to user, 50% to sys and 20% to idle", + "times": { + "user": 11005720, + "nice": 0, + "sys": 7678620, + "idle": 510035000, + "irq": 0 + } + } + ] +] \ No newline at end of file diff --git a/packages/opentelemetry-test-utils/package.json b/packages/opentelemetry-test-utils/package.json index 5f90d25167..062b7b9a6e 100644 --- a/packages/opentelemetry-test-utils/package.json +++ b/packages/opentelemetry-test-utils/package.json @@ -48,7 +48,7 @@ "dependencies": { "@opentelemetry/core": "^1.0.0", "@opentelemetry/exporter-jaeger": "^1.3.1", - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/sdk-trace-node": "^1.8.0", "@opentelemetry/resources": "^1.8.0", "@opentelemetry/sdk-trace-base": "^1.8.0", diff --git a/plugins/node/instrumentation-amqplib/package.json b/plugins/node/instrumentation-amqplib/package.json index 5c603dcec5..56a86768e7 100644 --- a/plugins/node/instrumentation-amqplib/package.json +++ b/plugins/node/instrumentation-amqplib/package.json @@ -47,7 +47,7 @@ }, "dependencies": { "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0" }, "devDependencies": { diff --git a/plugins/node/instrumentation-cucumber/package.json b/plugins/node/instrumentation-cucumber/package.json index 75428285f1..c4d29250cf 100644 --- a/plugins/node/instrumentation-cucumber/package.json +++ b/plugins/node/instrumentation-cucumber/package.json @@ -65,7 +65,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-cucumber#readme" diff --git a/plugins/node/instrumentation-dataloader/package.json b/plugins/node/instrumentation-dataloader/package.json index 96e4978993..39ab571d40 100644 --- a/plugins/node/instrumentation-dataloader/package.json +++ b/plugins/node/instrumentation-dataloader/package.json @@ -61,7 +61,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0" + "@opentelemetry/instrumentation": "^0.45.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-dataloader#readme" } diff --git a/plugins/node/instrumentation-fs/package.json b/plugins/node/instrumentation-fs/package.json index 707283d857..592c4ecc26 100644 --- a/plugins/node/instrumentation-fs/package.json +++ b/plugins/node/instrumentation-fs/package.json @@ -59,7 +59,7 @@ }, "dependencies": { "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-fs#readme" diff --git a/plugins/node/instrumentation-lru-memoizer/package.json b/plugins/node/instrumentation-lru-memoizer/package.json index 8a3aca6765..8bd3f66541 100644 --- a/plugins/node/instrumentation-lru-memoizer/package.json +++ b/plugins/node/instrumentation-lru-memoizer/package.json @@ -57,7 +57,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0" + "@opentelemetry/instrumentation": "^0.45.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-lru-memoizer#readme" } diff --git a/plugins/node/instrumentation-mongoose/package.json b/plugins/node/instrumentation-mongoose/package.json index ada722c74e..b37594365f 100644 --- a/plugins/node/instrumentation-mongoose/package.json +++ b/plugins/node/instrumentation-mongoose/package.json @@ -61,7 +61,7 @@ }, "dependencies": { "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-mongoose#readme" diff --git a/plugins/node/instrumentation-socket.io/package.json b/plugins/node/instrumentation-socket.io/package.json index 352fba531b..2f0fec5ace 100644 --- a/plugins/node/instrumentation-socket.io/package.json +++ b/plugins/node/instrumentation-socket.io/package.json @@ -58,7 +58,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-socket.io#readme" diff --git a/plugins/node/instrumentation-tedious/package.json b/plugins/node/instrumentation-tedious/package.json index 06d0ac09bf..530adbd085 100644 --- a/plugins/node/instrumentation-tedious/package.json +++ b/plugins/node/instrumentation-tedious/package.json @@ -62,7 +62,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0", "@types/tedious": "^4.0.10" }, diff --git a/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json b/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json index c30158eb51..95beb657cd 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json +++ b/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json @@ -59,7 +59,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/propagator-aws-xray": "^1.3.1", "@opentelemetry/resources": "^1.8.0", "@opentelemetry/semantic-conventions": "^1.0.0", diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json b/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json index 09d0ee663e..c94e780c99 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json @@ -47,7 +47,7 @@ }, "dependencies": { "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0", "@opentelemetry/propagation-utils": "^0.30.2" }, diff --git a/plugins/node/opentelemetry-instrumentation-bunyan/package.json b/plugins/node/opentelemetry-instrumentation-bunyan/package.json index 5c905a750b..aec0dfe3e2 100644 --- a/plugins/node/opentelemetry-instrumentation-bunyan/package.json +++ b/plugins/node/opentelemetry-instrumentation-bunyan/package.json @@ -64,7 +64,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@types/bunyan": "1.8.9" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-bunyan#readme" diff --git a/plugins/node/opentelemetry-instrumentation-bunyan/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-bunyan/src/instrumentation.ts index a673a364bd..0a3a8102a7 100644 --- a/plugins/node/opentelemetry-instrumentation-bunyan/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-bunyan/src/instrumentation.ts @@ -14,13 +14,7 @@ * limitations under the License. */ -import { - context, - diag, - trace, - isSpanContextValid, - Span, -} from '@opentelemetry/api'; +import { context, trace, isSpanContextValid, Span } from '@opentelemetry/api'; import { InstrumentationBase, InstrumentationNodeModuleDefinition, @@ -43,7 +37,8 @@ export class BunyanInstrumentation extends InstrumentationBase< new InstrumentationNodeModuleDefinition( 'bunyan', ['<2.0'], - logger => { + (logger, moduleVersion) => { + this._diag.debug(`Applying patch for bunyan@${moduleVersion}`); // eslint-disable-next-line @typescript-eslint/no-explicit-any const proto = logger.prototype as any; if (isWrapped(proto['_emit'])) { @@ -58,8 +53,9 @@ export class BunyanInstrumentation extends InstrumentationBase< ); return logger; }, - logger => { + (logger, moduleVersion) => { if (logger === undefined) return; + this._diag.debug(`Removing patch for bunyan@${moduleVersion}`); // eslint-disable-next-line @typescript-eslint/no-explicit-any this._unwrap(logger.prototype as any, '_emit'); } @@ -114,7 +110,7 @@ export class BunyanInstrumentation extends InstrumentationBase< () => hook(span, record), err => { if (err) { - diag.error('bunyan instrumentation: error calling logHook', err); + this._diag.error('error calling logHook', err); } }, true diff --git a/plugins/node/opentelemetry-instrumentation-cassandra/package.json b/plugins/node/opentelemetry-instrumentation-cassandra/package.json index 722a7fa6da..6fdec55c6d 100644 --- a/plugins/node/opentelemetry-instrumentation-cassandra/package.json +++ b/plugins/node/opentelemetry-instrumentation-cassandra/package.json @@ -64,7 +64,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-cassandra#readme" diff --git a/plugins/node/opentelemetry-instrumentation-cassandra/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-cassandra/src/instrumentation.ts index 68f8975ece..fe2f9718e5 100644 --- a/plugins/node/opentelemetry-instrumentation-cassandra/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-cassandra/src/instrumentation.ts @@ -51,7 +51,10 @@ export class CassandraDriverInstrumentation extends InstrumentationBase { return new InstrumentationNodeModuleDefinition( 'cassandra-driver', supportedVersions, - driverModule => { + (driverModule, moduleVersion) => { + this._diag.debug( + `Applying patch for cassandra-driver@${moduleVersion}` + ); // eslint-disable-next-line @typescript-eslint/no-explicit-any const Client = driverModule.Client.prototype as any; @@ -73,7 +76,10 @@ export class CassandraDriverInstrumentation extends InstrumentationBase { return driverModule; }, - driverModule => { + (driverModule, moduleVersion) => { + this._diag.debug( + `Removing patch for cassandra-driver@${moduleVersion}` + ); // eslint-disable-next-line @typescript-eslint/no-explicit-any const Client = driverModule.Client.prototype as any; diff --git a/plugins/node/opentelemetry-instrumentation-connect/package.json b/plugins/node/opentelemetry-instrumentation-connect/package.json index 07b64fbbf5..fe2ca364ac 100644 --- a/plugins/node/opentelemetry-instrumentation-connect/package.json +++ b/plugins/node/opentelemetry-instrumentation-connect/package.json @@ -59,7 +59,7 @@ }, "dependencies": { "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0", "@types/connect": "3.4.36" }, diff --git a/plugins/node/opentelemetry-instrumentation-dns/package.json b/plugins/node/opentelemetry-instrumentation-dns/package.json index 6ba9c4793f..007646e16c 100644 --- a/plugins/node/opentelemetry-instrumentation-dns/package.json +++ b/plugins/node/opentelemetry-instrumentation-dns/package.json @@ -62,7 +62,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0", "semver": "^7.5.4" }, diff --git a/plugins/node/opentelemetry-instrumentation-express/examples/package.json b/plugins/node/opentelemetry-instrumentation-express/examples/package.json index 9452aab585..fa448b0e5b 100644 --- a/plugins/node/opentelemetry-instrumentation-express/examples/package.json +++ b/plugins/node/opentelemetry-instrumentation-express/examples/package.json @@ -32,9 +32,9 @@ "@opentelemetry/api": "^1.0.0", "@opentelemetry/exporter-jaeger": "^1.0.0", "@opentelemetry/exporter-zipkin": "^1.0.0", - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/instrumentation-express": "0.28.0", - "@opentelemetry/instrumentation-http": "^0.44.0", + "@opentelemetry/instrumentation-http": "^0.45.1", "@opentelemetry/resources": "^1.0.0", "@opentelemetry/sdk-trace-base": "^1.0.0", "@opentelemetry/sdk-trace-node": "^1.0.0", diff --git a/plugins/node/opentelemetry-instrumentation-express/package.json b/plugins/node/opentelemetry-instrumentation-express/package.json index a1c45723df..9eb7b8e1bb 100644 --- a/plugins/node/opentelemetry-instrumentation-express/package.json +++ b/plugins/node/opentelemetry-instrumentation-express/package.json @@ -66,7 +66,7 @@ }, "dependencies": { "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0", "@types/express": "4.17.18" }, diff --git a/plugins/node/opentelemetry-instrumentation-fastify/package.json b/plugins/node/opentelemetry-instrumentation-fastify/package.json index 9d110cccc1..cebdf8b8c0 100644 --- a/plugins/node/opentelemetry-instrumentation-fastify/package.json +++ b/plugins/node/opentelemetry-instrumentation-fastify/package.json @@ -49,7 +49,7 @@ "@fastify/express": "^2.0.2", "@opentelemetry/api": "^1.3.0", "@opentelemetry/context-async-hooks": "^1.8.0", - "@opentelemetry/instrumentation-http": "0.44.0", + "@opentelemetry/instrumentation-http": "^0.45.1", "@opentelemetry/sdk-trace-base": "^1.8.0", "@opentelemetry/sdk-trace-node": "^1.8.0", "@types/express": "4.17.18", @@ -65,7 +65,7 @@ }, "dependencies": { "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-fastify#readme" diff --git a/plugins/node/opentelemetry-instrumentation-fastify/src/constants.ts b/plugins/node/opentelemetry-instrumentation-fastify/src/constants.ts index e6e0ebedae..4f2efd02d5 100644 --- a/plugins/node/opentelemetry-instrumentation-fastify/src/constants.ts +++ b/plugins/node/opentelemetry-instrumentation-fastify/src/constants.ts @@ -18,9 +18,18 @@ export const spanRequestSymbol = Symbol( 'opentelemetry.instrumentation.fastify.request_active_span' ); -export const applicationHookNames = [ - 'onRegister', - 'onRoute', - 'onReady', - 'onClose', -]; +// The instrumentation creates a span for invocations of lifecycle hook handlers +// that take `(request, reply, ...[, done])` arguments. Currently this is all +// lifecycle hooks except `onRequestAbort`. +// https://fastify.dev/docs/latest/Reference/Hooks +export const hooksNamesToWrap = new Set([ + 'onTimeout', + 'onRequest', + 'preParsing', + 'preValidation', + 'preSerialization', + 'preHandler', + 'onSend', + 'onResponse', + 'onError', +]); diff --git a/plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts index ba96a020dd..e410b93bad 100644 --- a/plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts @@ -33,7 +33,7 @@ import type { FastifyRequest, FastifyReply, } from 'fastify'; -import { applicationHookNames } from './constants'; +import { hooksNamesToWrap } from './constants'; import { AttributeNames, FastifyNames, @@ -178,8 +178,8 @@ export class FastifyInstrumentation extends InstrumentationBase { const name = args[0] as string; const handler = args[1] as HandlerOriginal; const pluginName = this.pluginName; - if (applicationHookNames.includes(name)) { - return original.apply(this, [name, handler] as never); + if (!hooksNamesToWrap.has(name)) { + return original.apply(this, args); } const syncFunctionWithDone = diff --git a/plugins/node/opentelemetry-instrumentation-fastify/test/instrumentation.test.ts b/plugins/node/opentelemetry-instrumentation-fastify/test/instrumentation.test.ts index 90a881a321..2efccaf724 100644 --- a/plugins/node/opentelemetry-instrumentation-fastify/test/instrumentation.test.ts +++ b/plugins/node/opentelemetry-instrumentation-fastify/test/instrumentation.test.ts @@ -424,6 +424,14 @@ describe('fastify', () => { await startServer(); }); + it('preClose is not instrumented', async () => { + app.addHook('preClose', () => { + assertRootContextActive(); + }); + + await startServer(); + }); + it('onClose is not instrumented', async () => { app.addHook('onClose', () => { assertRootContextActive(); diff --git a/plugins/node/opentelemetry-instrumentation-generic-pool/package.json b/plugins/node/opentelemetry-instrumentation-generic-pool/package.json index 63dc4730f5..7d63ade565 100644 --- a/plugins/node/opentelemetry-instrumentation-generic-pool/package.json +++ b/plugins/node/opentelemetry-instrumentation-generic-pool/package.json @@ -62,7 +62,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-generic-pool#readme" diff --git a/plugins/node/opentelemetry-instrumentation-graphql/package.json b/plugins/node/opentelemetry-instrumentation-graphql/package.json index fd9c769bd6..248007ed45 100644 --- a/plugins/node/opentelemetry-instrumentation-graphql/package.json +++ b/plugins/node/opentelemetry-instrumentation-graphql/package.json @@ -61,7 +61,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0" + "@opentelemetry/instrumentation": "^0.45.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-graphql#readme" } diff --git a/plugins/node/opentelemetry-instrumentation-graphql/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-graphql/src/instrumentation.ts index 5872fb8df6..217744e3da 100644 --- a/plugins/node/opentelemetry-instrumentation-graphql/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-graphql/src/instrumentation.ts @@ -102,7 +102,8 @@ export class GraphQLInstrumentation extends InstrumentationBase { supportedVersions, // cannot make it work with appropriate type as execute function has 2 //types and/cannot import function but only types - (moduleExports: any) => { + (moduleExports: any, moduleVersion) => { + this._diag.debug(`Applying patch for graphql@${moduleVersion} execute`); if (isWrapped(moduleExports.execute)) { this._unwrap(moduleExports, 'execute'); } @@ -113,8 +114,11 @@ export class GraphQLInstrumentation extends InstrumentationBase { ); return moduleExports; }, - moduleExports => { + (moduleExports, moduleVersion) => { if (moduleExports) { + this._diag.debug( + `Removing patch for graphql@${moduleVersion} execute` + ); this._unwrap(moduleExports, 'execute'); } } @@ -127,15 +131,17 @@ export class GraphQLInstrumentation extends InstrumentationBase { return new InstrumentationNodeModuleFile( 'graphql/language/parser.js', supportedVersions, - moduleExports => { - if (isWrapped(moduleExports.execute)) { + (moduleExports, moduleVersion) => { + this._diag.debug(`Applying patch for graphql@${moduleVersion} parse`); + if (isWrapped(moduleExports.parse)) { this._unwrap(moduleExports, 'parse'); } this._wrap(moduleExports, 'parse', this._patchParse()); return moduleExports; }, - moduleExports => { + (moduleExports, moduleVersion) => { if (moduleExports) { + this._diag.debug(`Removing patch for graphql@${moduleVersion} parse`); this._unwrap(moduleExports, 'parse'); } } @@ -148,15 +154,21 @@ export class GraphQLInstrumentation extends InstrumentationBase { return new InstrumentationNodeModuleFile( 'graphql/validation/validate.js', supportedVersions, - moduleExports => { - if (isWrapped(moduleExports.execute)) { + (moduleExports, moduleVersion) => { + this._diag.debug( + `Applying patch for graphql@${moduleVersion} validate` + ); + if (isWrapped(moduleExports.validate)) { this._unwrap(moduleExports, 'validate'); } this._wrap(moduleExports, 'validate', this._patchValidate()); return moduleExports; }, - moduleExports => { + (moduleExports, moduleVersion) => { if (moduleExports) { + this._diag.debug( + `Removing patch for graphql@${moduleVersion} validate` + ); this._unwrap(moduleExports, 'validate'); } } @@ -285,7 +297,7 @@ export class GraphQLInstrumentation extends InstrumentationBase { }, err => { if (err) { - api.diag.error('Error running response hook', err); + this._diag.error('Error running response hook', err); } endSpan(span, undefined); diff --git a/plugins/node/opentelemetry-instrumentation-hapi/package.json b/plugins/node/opentelemetry-instrumentation-hapi/package.json index 6661a1db31..a4d349cb8f 100644 --- a/plugins/node/opentelemetry-instrumentation-hapi/package.json +++ b/plugins/node/opentelemetry-instrumentation-hapi/package.json @@ -60,7 +60,7 @@ }, "dependencies": { "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0", "@types/hapi__hapi": "20.0.13" }, diff --git a/plugins/node/opentelemetry-instrumentation-ioredis/package.json b/plugins/node/opentelemetry-instrumentation-ioredis/package.json index cfbad0dc28..697279252e 100644 --- a/plugins/node/opentelemetry-instrumentation-ioredis/package.json +++ b/plugins/node/opentelemetry-instrumentation-ioredis/package.json @@ -69,7 +69,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/redis-common": "^0.36.1", "@opentelemetry/semantic-conventions": "^1.0.0", "@types/ioredis4": "npm:@types/ioredis@^4.28.10" diff --git a/plugins/node/opentelemetry-instrumentation-knex/package.json b/plugins/node/opentelemetry-instrumentation-knex/package.json index 10b5b8073c..4910b42a99 100644 --- a/plugins/node/opentelemetry-instrumentation-knex/package.json +++ b/plugins/node/opentelemetry-instrumentation-knex/package.json @@ -60,7 +60,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-knex#readme" diff --git a/plugins/node/opentelemetry-instrumentation-koa/examples/package.json b/plugins/node/opentelemetry-instrumentation-koa/examples/package.json index 04b1de66d7..7ad16c520e 100644 --- a/plugins/node/opentelemetry-instrumentation-koa/examples/package.json +++ b/plugins/node/opentelemetry-instrumentation-koa/examples/package.json @@ -34,8 +34,8 @@ "@opentelemetry/api": "^1.0.0", "@opentelemetry/exporter-jaeger": "^1.0.0", "@opentelemetry/exporter-zipkin": "^1.0.0", - "@opentelemetry/instrumentation": "^0.44.0", - "@opentelemetry/instrumentation-http": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", + "@opentelemetry/instrumentation-http": "^0.45.1", "@opentelemetry/instrumentation-koa": "^0.31.0", "@opentelemetry/sdk-trace-node": "^1.0.0", "@opentelemetry/sdk-trace-base": "^1.0.0", diff --git a/plugins/node/opentelemetry-instrumentation-koa/package.json b/plugins/node/opentelemetry-instrumentation-koa/package.json index 2ff2337966..6a1b9653ed 100644 --- a/plugins/node/opentelemetry-instrumentation-koa/package.json +++ b/plugins/node/opentelemetry-instrumentation-koa/package.json @@ -68,7 +68,7 @@ }, "dependencies": { "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0", "@types/koa": "2.13.9", "@types/koa__router": "12.0.1" diff --git a/plugins/node/opentelemetry-instrumentation-memcached/package.json b/plugins/node/opentelemetry-instrumentation-memcached/package.json index d560fb6890..b16fcb0512 100644 --- a/plugins/node/opentelemetry-instrumentation-memcached/package.json +++ b/plugins/node/opentelemetry-instrumentation-memcached/package.json @@ -63,7 +63,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0", "@types/memcached": "^2.2.6" }, diff --git a/plugins/node/opentelemetry-instrumentation-mongodb/examples/package.json b/plugins/node/opentelemetry-instrumentation-mongodb/examples/package.json index 124776ff49..178d68cb5b 100644 --- a/plugins/node/opentelemetry-instrumentation-mongodb/examples/package.json +++ b/plugins/node/opentelemetry-instrumentation-mongodb/examples/package.json @@ -33,8 +33,8 @@ "@opentelemetry/api": "^1.0.0", "@opentelemetry/exporter-jaeger": "^1.0.0", "@opentelemetry/exporter-zipkin": "^1.0.0", - "@opentelemetry/instrumentation": "^0.44.0", - "@opentelemetry/instrumentation-http": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", + "@opentelemetry/instrumentation-http": "^0.45.1", "@opentelemetry/instrumentation-mongodb": "^0.32.0", "@opentelemetry/sdk-trace-node": "^1.0.0", "@opentelemetry/sdk-trace-base": "^1.0.0", diff --git a/plugins/node/opentelemetry-instrumentation-mongodb/package.json b/plugins/node/opentelemetry-instrumentation-mongodb/package.json index 291a3c0d5b..94dcbd2b7e 100644 --- a/plugins/node/opentelemetry-instrumentation-mongodb/package.json +++ b/plugins/node/opentelemetry-instrumentation-mongodb/package.json @@ -70,8 +70,8 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", "@opentelemetry/sdk-metrics": "^1.9.1", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-mongodb#readme" diff --git a/plugins/node/opentelemetry-instrumentation-mongodb/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-mongodb/src/instrumentation.ts index b23af687f3..3be3019848 100644 --- a/plugins/node/opentelemetry-instrumentation-mongodb/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-mongodb/src/instrumentation.ts @@ -13,8 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { AsyncResource } from 'async_hooks'; - import { context, diag, @@ -332,7 +330,7 @@ export class MongoDBInstrumentation extends InstrumentationBase { private _getV4ConnectionPoolCheckOut() { return (original: V4ConnectionPool['checkOut']) => { return function patchedCheckout(this: unknown, callback: any) { - const patchedCallback = AsyncResource.bind(callback); + const patchedCallback = context.bind(context.active(), callback); return original.call(this, patchedCallback); }; }; diff --git a/plugins/node/opentelemetry-instrumentation-mysql/examples/package.json b/plugins/node/opentelemetry-instrumentation-mysql/examples/package.json index b257832c73..fbd603d769 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql/examples/package.json +++ b/plugins/node/opentelemetry-instrumentation-mysql/examples/package.json @@ -34,12 +34,12 @@ "@opentelemetry/api": "^1.0.0", "@opentelemetry/exporter-jaeger": "^1.0.0", "@opentelemetry/exporter-zipkin": "^1.0.0", - "@opentelemetry/instrumentation": "^0.44.0", - "@opentelemetry/instrumentation-http": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", + "@opentelemetry/instrumentation-http": "^0.45.1", "@opentelemetry/instrumentation-mysql": "^0.31.0", "@opentelemetry/sdk-trace-base": "^1.0.0", "@opentelemetry/sdk-trace-node": "^1.0.0", - "@opentelemetry/exporter-metrics-otlp-grpc": "0.44.0", + "@opentelemetry/exporter-metrics-otlp-grpc": "^0.45.1", "mysql": "^2.18.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme", diff --git a/plugins/node/opentelemetry-instrumentation-mysql/package.json b/plugins/node/opentelemetry-instrumentation-mysql/package.json index 18b7b9add3..bb5924986b 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql/package.json +++ b/plugins/node/opentelemetry-instrumentation-mysql/package.json @@ -63,7 +63,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0", "@types/mysql": "2.15.22" }, diff --git a/plugins/node/opentelemetry-instrumentation-mysql2/package.json b/plugins/node/opentelemetry-instrumentation-mysql2/package.json index dec0a017e7..2cfd4888a6 100644 --- a/plugins/node/opentelemetry-instrumentation-mysql2/package.json +++ b/plugins/node/opentelemetry-instrumentation-mysql2/package.json @@ -65,7 +65,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0", "@opentelemetry/sql-common": "^0.40.0" }, diff --git a/plugins/node/opentelemetry-instrumentation-nestjs-core/package.json b/plugins/node/opentelemetry-instrumentation-nestjs-core/package.json index f04ef44559..e371f74f16 100644 --- a/plugins/node/opentelemetry-instrumentation-nestjs-core/package.json +++ b/plugins/node/opentelemetry-instrumentation-nestjs-core/package.json @@ -73,7 +73,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-nestjs-core#readme" diff --git a/plugins/node/opentelemetry-instrumentation-net/package.json b/plugins/node/opentelemetry-instrumentation-net/package.json index 5af5a30bf5..00239bcd1f 100644 --- a/plugins/node/opentelemetry-instrumentation-net/package.json +++ b/plugins/node/opentelemetry-instrumentation-net/package.json @@ -61,7 +61,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-net#readme" diff --git a/plugins/node/opentelemetry-instrumentation-pg/package.json b/plugins/node/opentelemetry-instrumentation-pg/package.json index 28eebe4a23..cbc96490e4 100644 --- a/plugins/node/opentelemetry-instrumentation-pg/package.json +++ b/plugins/node/opentelemetry-instrumentation-pg/package.json @@ -75,7 +75,7 @@ }, "dependencies": { "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0", "@opentelemetry/sql-common": "^0.40.0", "@types/pg": "8.6.1", diff --git a/plugins/node/opentelemetry-instrumentation-pg/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-pg/src/instrumentation.ts index 8d7914c51b..1fa8f58d3d 100644 --- a/plugins/node/opentelemetry-instrumentation-pg/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-pg/src/instrumentation.ts @@ -22,7 +22,6 @@ import { import { context, - diag, trace, Span, SpanStatusCode, @@ -66,7 +65,8 @@ export class PgInstrumentation extends InstrumentationBase { const modulePG = new InstrumentationNodeModuleDefinition( 'pg', ['8.*'], - (module: any) => { + (module: any, moduleVersion) => { + this._diag.debug(`Applying patch for pg@${moduleVersion}`); const moduleExports: typeof pgTypes = module[Symbol.toStringTag] === 'Module' ? module.default // ESM @@ -93,11 +93,12 @@ export class PgInstrumentation extends InstrumentationBase { return module; }, - (module: any) => { + (module: any, moduleVersion) => { const moduleExports: typeof pgTypes = module[Symbol.toStringTag] === 'Module' ? module.default // ESM : module; // CommonJS + this._diag.debug(`Removing patch for pg@${moduleVersion}`); if (isWrapped(moduleExports.Client.prototype.query)) { this._unwrap(moduleExports.Client.prototype, 'query'); } @@ -109,7 +110,8 @@ export class PgInstrumentation extends InstrumentationBase { >( 'pg-pool', ['2.*', '3.*'], - moduleExports => { + (moduleExports, moduleVersion) => { + this._diag.debug(`Applying patch for pg-pool@${moduleVersion}`); if (isWrapped(moduleExports.prototype.connect)) { this._unwrap(moduleExports.prototype, 'connect'); } @@ -120,7 +122,8 @@ export class PgInstrumentation extends InstrumentationBase { ); return moduleExports; }, - moduleExports => { + (moduleExports, moduleVersion) => { + this._diag.debug(`Removing patch for pg-pool@${moduleVersion}`); if (isWrapped(moduleExports.prototype.connect)) { this._unwrap(moduleExports.prototype, 'connect'); } @@ -180,7 +183,7 @@ export class PgInstrumentation extends InstrumentationBase { private _getClientQueryPatch() { const plugin = this; return (original: typeof pgTypes.Client.prototype.query) => { - diag.debug( + this._diag.debug( `Patching ${PgInstrumentation.COMPONENT}.Client.prototype.query` ); return function query(this: PgClientExtended, ...args: unknown[]) { diff --git a/plugins/node/opentelemetry-instrumentation-pino/package.json b/plugins/node/opentelemetry-instrumentation-pino/package.json index f46c9ffa2c..45fc87bfa9 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/package.json +++ b/plugins/node/opentelemetry-instrumentation-pino/package.json @@ -66,7 +66,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0" + "@opentelemetry/instrumentation": "^0.45.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-pino#readme" } diff --git a/plugins/node/opentelemetry-instrumentation-redis-4/package.json b/plugins/node/opentelemetry-instrumentation-redis-4/package.json index cf0e3b89f8..f2630c478b 100644 --- a/plugins/node/opentelemetry-instrumentation-redis-4/package.json +++ b/plugins/node/opentelemetry-instrumentation-redis-4/package.json @@ -69,7 +69,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/redis-common": "^0.36.1", "@opentelemetry/semantic-conventions": "^1.0.0" }, diff --git a/plugins/node/opentelemetry-instrumentation-redis/examples/package.json b/plugins/node/opentelemetry-instrumentation-redis/examples/package.json index c5c228182f..5c2f5342c4 100644 --- a/plugins/node/opentelemetry-instrumentation-redis/examples/package.json +++ b/plugins/node/opentelemetry-instrumentation-redis/examples/package.json @@ -34,8 +34,8 @@ "@opentelemetry/api": "^1.0.0", "@opentelemetry/exporter-jaeger": "^1.0.0", "@opentelemetry/exporter-zipkin": "^1.0.0", - "@opentelemetry/instrumentation": "^0.44.0", - "@opentelemetry/instrumentation-http": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", + "@opentelemetry/instrumentation-http": "^0.45.1", "@opentelemetry/instrumentation-redis": "^0.32.0", "@opentelemetry/sdk-trace-base": "^1.0.0", "@opentelemetry/sdk-trace-node": "^1.0.0", diff --git a/plugins/node/opentelemetry-instrumentation-redis/package.json b/plugins/node/opentelemetry-instrumentation-redis/package.json index e172524f48..c430d8ef7f 100644 --- a/plugins/node/opentelemetry-instrumentation-redis/package.json +++ b/plugins/node/opentelemetry-instrumentation-redis/package.json @@ -70,7 +70,7 @@ "@types/redis": "2.8.32" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/redis-common": "^0.36.1", "@opentelemetry/semantic-conventions": "^1.0.0" }, diff --git a/plugins/node/opentelemetry-instrumentation-restify/package.json b/plugins/node/opentelemetry-instrumentation-restify/package.json index b2f32efaf6..e6f1d83535 100644 --- a/plugins/node/opentelemetry-instrumentation-restify/package.json +++ b/plugins/node/opentelemetry-instrumentation-restify/package.json @@ -65,7 +65,7 @@ }, "dependencies": { "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-restify#readme" diff --git a/plugins/node/opentelemetry-instrumentation-router/package.json b/plugins/node/opentelemetry-instrumentation-router/package.json index fe8f94537c..8b57d6d918 100644 --- a/plugins/node/opentelemetry-instrumentation-router/package.json +++ b/plugins/node/opentelemetry-instrumentation-router/package.json @@ -59,7 +59,7 @@ "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/semantic-conventions": "^1.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-router#readme" diff --git a/plugins/node/opentelemetry-instrumentation-winston/package.json b/plugins/node/opentelemetry-instrumentation-winston/package.json index 1f7c27b7ee..6570a6ef17 100644 --- a/plugins/node/opentelemetry-instrumentation-winston/package.json +++ b/plugins/node/opentelemetry-instrumentation-winston/package.json @@ -66,7 +66,7 @@ "winston2": "npm:winston@2.4.7" }, "dependencies": { - "@opentelemetry/instrumentation": "^0.44.0" + "@opentelemetry/instrumentation": "^0.45.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-winston#readme" } diff --git a/plugins/node/opentelemetry-instrumentation-winston/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-winston/src/instrumentation.ts index 3db88c7921..6b4c8dbaa8 100644 --- a/plugins/node/opentelemetry-instrumentation-winston/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-winston/src/instrumentation.ts @@ -16,7 +16,6 @@ import { context, - diag, trace, isSpanContextValid, Span, @@ -57,7 +56,8 @@ export class WinstonInstrumentation extends InstrumentationBase { new InstrumentationNodeModuleFile( 'winston/lib/winston/logger.js', winston3Versions, - logger => { + (logger, moduleVersion) => { + this._diag.debug(`Applying patch for winston@${moduleVersion}`); if (isWrapped(logger.prototype['write'])) { this._unwrap(logger.prototype, 'write'); } @@ -65,8 +65,9 @@ export class WinstonInstrumentation extends InstrumentationBase { this._wrap(logger.prototype, 'write', this._getPatchedWrite()); return logger; }, - logger => { + (logger, moduleVersion) => { if (logger === undefined) return; + this._diag.debug(`Removing patch for winston@${moduleVersion}`); this._unwrap(logger.prototype, 'write'); } ), @@ -81,7 +82,8 @@ export class WinstonInstrumentation extends InstrumentationBase { new InstrumentationNodeModuleFile( 'winston/lib/winston/logger.js', winstonPre3Versions, - fileExports => { + (fileExports, moduleVersion) => { + this._diag.debug(`Applying patch for winston@${moduleVersion}`); const proto = fileExports.Logger.prototype; if (isWrapped(proto.log)) { @@ -92,8 +94,9 @@ export class WinstonInstrumentation extends InstrumentationBase { return fileExports; }, - fileExports => { + (fileExports, moduleVersion) => { if (fileExports === undefined) return; + this._diag.debug(`Removing patch for winston@${moduleVersion}`); this._unwrap(fileExports.Logger.prototype, 'log'); } ), @@ -121,7 +124,7 @@ export class WinstonInstrumentation extends InstrumentationBase { () => hook(span, record), err => { if (err) { - diag.error('winston instrumentation: error calling logHook', err); + this._diag.error('error calling logHook', err); } }, true diff --git a/plugins/web/opentelemetry-instrumentation-document-load/package.json b/plugins/web/opentelemetry-instrumentation-document-load/package.json index cd2498c386..256bb452d4 100644 --- a/plugins/web/opentelemetry-instrumentation-document-load/package.json +++ b/plugins/web/opentelemetry-instrumentation-document-load/package.json @@ -4,20 +4,21 @@ "description": "OpenTelemetry document-load automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", + "esnext": "build/esnext/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", + "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "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", + "compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "prepare": "npm run compile", "tdd": "karma start", "test:browser": "nyc karma start --single-run", - "watch": "tsc --build -watch tsconfig.json tsconfig.esm.json" + "watch": "tsc --build -watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json" }, "keywords": [ "opentelemetry", @@ -36,6 +37,9 @@ "build/esm/**/*.js", "build/esm/**/*.map", "build/esm/**/*.d.ts", + "build/esnext/**/*.js", + "build/esnext/**/*.map", + "build/esnext/**/*.d.ts", "build/src/**/*.js", "build/src/**/*.map", "build/src/**/*.d.ts", @@ -77,7 +81,7 @@ }, "dependencies": { "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/sdk-trace-base": "^1.0.0", "@opentelemetry/sdk-trace-web": "^1.15.0", "@opentelemetry/semantic-conventions": "^1.0.0" diff --git a/plugins/web/opentelemetry-instrumentation-document-load/tsconfig.esnext.json b/plugins/web/opentelemetry-instrumentation-document-load/tsconfig.esnext.json new file mode 100644 index 0000000000..cb78dd6ff3 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-document-load/tsconfig.esnext.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../tsconfig.base.esnext.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "build/esnext", + "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ] +} diff --git a/plugins/web/opentelemetry-instrumentation-long-task/package.json b/plugins/web/opentelemetry-instrumentation-long-task/package.json index 929f4131e4..9e498a976c 100644 --- a/plugins/web/opentelemetry-instrumentation-long-task/package.json +++ b/plugins/web/opentelemetry-instrumentation-long-task/package.json @@ -4,20 +4,21 @@ "description": "OpenTelemetry long task API automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", + "esnext": "build/esnext/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", + "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "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", + "compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "prepare": "npm run compile", "tdd": "karma start", "test:browser": "nyc karma start --single-run", - "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json" + "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json" }, "keywords": [ "opentelemetry", @@ -36,6 +37,9 @@ "build/esm/**/*.js", "build/esm/**/*.map", "build/esm/**/*.d.ts", + "build/esnext/**/*.js", + "build/esnext/**/*.map", + "build/esnext/**/*.d.ts", "build/src/**/*.js", "build/src/**/*.map", "build/src/**/*.d.ts", @@ -78,7 +82,7 @@ }, "dependencies": { "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/sdk-trace-web": "^1.8.0" }, "peerDependencies": { diff --git a/plugins/web/opentelemetry-instrumentation-long-task/tsconfig.esnext.json b/plugins/web/opentelemetry-instrumentation-long-task/tsconfig.esnext.json new file mode 100644 index 0000000000..b2380afb29 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-long-task/tsconfig.esnext.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../tsconfig.base.esnext.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "build/esnext", + "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo" + }, + "files": [ "node_modules/zone.js/dist/zone.js.d.ts"], + "include": [ + "src/**/*.ts" + ] +} diff --git a/plugins/web/opentelemetry-instrumentation-user-interaction/package.json b/plugins/web/opentelemetry-instrumentation-user-interaction/package.json index bfefa05e9a..a3055a275c 100644 --- a/plugins/web/opentelemetry-instrumentation-user-interaction/package.json +++ b/plugins/web/opentelemetry-instrumentation-user-interaction/package.json @@ -4,20 +4,21 @@ "description": "OpenTelemetry UserInteraction automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", + "esnext": "build/esnext/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", + "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "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", + "compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "prepare": "npm run compile", "tdd": "karma start", "test:browser": "nyc karma start --single-run", - "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json" + "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json" }, "keywords": [ "opentelemetry", @@ -36,6 +37,9 @@ "build/esm/**/*.js", "build/esm/**/*.map", "build/esm/**/*.d.ts", + "build/esnext/**/*.js", + "build/esnext/**/*.map", + "build/esnext/**/*.d.ts", "build/src/**/*.js", "build/src/**/*.map", "build/src/**/*.d.ts", @@ -50,7 +54,7 @@ "@babel/core": "7.22.17", "@opentelemetry/api": "^1.3.0", "@opentelemetry/context-zone-peer-dep": "^1.8.0", - "@opentelemetry/instrumentation-xml-http-request": "^0.44.0", + "@opentelemetry/instrumentation-xml-http-request": "^0.45.1", "@opentelemetry/sdk-trace-base": "^1.8.0", "@types/jquery": "3.5.20", "@types/mocha": "7.0.2", @@ -80,7 +84,7 @@ }, "dependencies": { "@opentelemetry/core": "^1.8.0", - "@opentelemetry/instrumentation": "^0.44.0", + "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/sdk-trace-web": "^1.8.0" }, "peerDependencies": { diff --git a/plugins/web/opentelemetry-instrumentation-user-interaction/tsconfig.esnext.json b/plugins/web/opentelemetry-instrumentation-user-interaction/tsconfig.esnext.json new file mode 100644 index 0000000000..c593d54802 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-user-interaction/tsconfig.esnext.json @@ -0,0 +1,13 @@ +{ + "extends": "../../../tsconfig.base.esnext.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "build/esnext", + "skipLibCheck": true, + "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo" + }, + "files": [ "node_modules/zone.js/dist/zone.js.d.ts"], + "include": [ + "src/**/*.ts" + ] +} diff --git a/plugins/web/opentelemetry-plugin-react-load/package.json b/plugins/web/opentelemetry-plugin-react-load/package.json index 5922c9e6f4..3d87ab766b 100644 --- a/plugins/web/opentelemetry-plugin-react-load/package.json +++ b/plugins/web/opentelemetry-plugin-react-load/package.json @@ -4,20 +4,21 @@ "description": "OpenTelemetry React loading automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", + "esnext": "build/esnext/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", + "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "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", + "compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "prepare": "npm run compile", "tdd": "karma start", "test:browser": "nyc karma start --single-run", - "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json" + "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json" }, "keywords": [ "opentelemetry", @@ -36,6 +37,9 @@ "build/esm/**/*.js", "build/esm/**/*.map", "build/esm/**/*.d.ts", + "build/esnext/**/*.js", + "build/esnext/**/*.map", + "build/esnext/**/*.d.ts", "build/src/**/*.js", "build/src/**/*.map", "build/src/**/*.d.ts", diff --git a/plugins/web/opentelemetry-plugin-react-load/tsconfig.esnext.json b/plugins/web/opentelemetry-plugin-react-load/tsconfig.esnext.json new file mode 100644 index 0000000000..96f396167e --- /dev/null +++ b/plugins/web/opentelemetry-plugin-react-load/tsconfig.esnext.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../tsconfig.base.esnext.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "build/esnext", + "jsx": "react", + "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ] +} diff --git a/tsconfig.base.esnext.json b/tsconfig.base.esnext.json new file mode 100644 index 0000000000..7875da812e --- /dev/null +++ b/tsconfig.base.esnext.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "esnext", + // target should be aligned with tsconfig.base.json + "target": "es2017", + "moduleResolution": "node" + }, +}