From bcbdeb7231e2ad208421c8c61085cec881dc0867 Mon Sep 17 00:00:00 2001 From: Rauno Viskus Date: Mon, 11 Apr 2022 10:54:56 +0300 Subject: [PATCH 1/4] fix: remove forcing RUN_MSSQL_TESTS to be true in tests (#965) --- .../node/instrumentation-tedious/test/instrumentation.test.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/node/instrumentation-tedious/test/instrumentation.test.ts b/plugins/node/instrumentation-tedious/test/instrumentation.test.ts index 5c18e8404d..9313281838 100644 --- a/plugins/node/instrumentation-tedious/test/instrumentation.test.ts +++ b/plugins/node/instrumentation-tedious/test/instrumentation.test.ts @@ -33,8 +33,6 @@ import { TediousInstrumentation } from '../src'; import makeApi from './api'; import type { Connection, ConnectionConfig } from 'tedious'; -process.env.RUN_MSSQL_TESTS = 'true'; - const port = Number(process.env.MSSQL_PORT) || 1433; const database = process.env.MSSQL_DATABASE || 'master'; const host = process.env.MSSQL_HOST || '127.0.0.1'; From cfb0b7a4ffe508563e383b7a186d438186b5c518 Mon Sep 17 00:00:00 2001 From: Ran Nozik Date: Mon, 11 Apr 2022 11:11:03 +0300 Subject: [PATCH 2/4] feat: send log level to pino hook (#967) * send log level to pino hook * add comment to hook log, change to semver.satisfies Co-authored-by: Rauno Viskus --- .../README.md | 2 +- .../package.json | 2 +- .../src/instrumentation.ts | 19 ++++++++++++------- .../src/types.ts | 6 +++++- .../test/pino.test.ts | 6 +++++- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-pino/README.md b/plugins/node/opentelemetry-instrumentation-pino/README.md index 7a74c574b0..d15537761c 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/README.md +++ b/plugins/node/opentelemetry-instrumentation-pino/README.md @@ -27,7 +27,7 @@ registerInstrumentations({ instrumentations: [ new PinoInstrumentation({ // Optional hook to insert additional context to log object. - logHook: (span, record) => { + logHook: (span, record, level) => { record['resource.service.name'] = provider.resource.attributes['service.name']; }, }), diff --git a/plugins/node/opentelemetry-instrumentation-pino/package.json b/plugins/node/opentelemetry-instrumentation-pino/package.json index 6234e05d95..9026d8a809 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/package.json +++ b/plugins/node/opentelemetry-instrumentation-pino/package.json @@ -66,7 +66,7 @@ }, "dependencies": { "@opentelemetry/instrumentation": "^0.27.0", - "pino": "7.2.0", + "pino": "7.10.0", "semver": "^7.3.5" } } diff --git a/plugins/node/opentelemetry-instrumentation-pino/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-pino/src/instrumentation.ts index bfca81faab..463d59a0cf 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-pino/src/instrumentation.ts @@ -46,7 +46,9 @@ export class PinoInstrumentation extends InstrumentationBase { const instrumentation = this; const patchedPino = Object.assign((...args: unknown[]) => { if (args.length == 0) { - return pinoModule({ mixin: instrumentation._getMixinFunction() }); + return pinoModule({ + mixin: instrumentation._getMixinFunction(), + }); } if (args.length == 1) { @@ -84,7 +86,7 @@ export class PinoInstrumentation extends InstrumentationBase { this._config = config; } - private _callHook(span: Span, record: Record) { + private _callHook(span: Span, record: Record, level: number) { const hook = this.getConfig().logHook; if (!hook) { @@ -92,7 +94,7 @@ export class PinoInstrumentation extends InstrumentationBase { } safeExecuteInTheMiddle( - () => hook(span, record), + () => hook(span, record, level), err => { if (err) { diag.error('pino instrumentation: error calling logHook', err); @@ -104,7 +106,7 @@ export class PinoInstrumentation extends InstrumentationBase { private _getMixinFunction() { const instrumentation = this; - return function otelMixin() { + return function otelMixin(_context: object, level: number) { if (!instrumentation.isEnabled()) { return {}; } @@ -127,7 +129,7 @@ export class PinoInstrumentation extends InstrumentationBase { trace_flags: `0${spanContext.traceFlags.toString(16)}`, }; - instrumentation._callHook(span, record); + instrumentation._callHook(span, record, level); return record; }; @@ -146,8 +148,11 @@ export class PinoInstrumentation extends InstrumentationBase { const originalMixin = options.mixin; const otelMixin = this._getMixinFunction(); - options.mixin = () => { - return Object.assign(otelMixin(), originalMixin()); + options.mixin = (context: object, level: number) => { + return Object.assign( + otelMixin(context, level), + originalMixin(context, level) + ); }; return options; diff --git a/plugins/node/opentelemetry-instrumentation-pino/src/types.ts b/plugins/node/opentelemetry-instrumentation-pino/src/types.ts index e5e84187d0..7e29d47cc7 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/src/types.ts +++ b/plugins/node/opentelemetry-instrumentation-pino/src/types.ts @@ -19,7 +19,11 @@ import { InstrumentationConfig } from '@opentelemetry/instrumentation'; import type { pino } from 'pino'; // eslint-disable-next-line @typescript-eslint/no-explicit-any -export type LogHookFunction = (span: Span, record: Record) => void; +export type LogHookFunction = ( + span: Span, + record: Record, + level?: number // Available in pino >= 7.9.0 +) => void; export interface PinoInstrumentationConfig extends InstrumentationConfig { logHook?: LogHookFunction; diff --git a/plugins/node/opentelemetry-instrumentation-pino/test/pino.test.ts b/plugins/node/opentelemetry-instrumentation-pino/test/pino.test.ts index 27642dc024..4d2a5c3ff1 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/test/pino.test.ts +++ b/plugins/node/opentelemetry-instrumentation-pino/test/pino.test.ts @@ -24,6 +24,7 @@ import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks'; import { Writable } from 'stream'; import * as assert from 'assert'; import * as sinon from 'sinon'; +import * as semver from 'semver'; import type { pino as Pino } from 'pino'; import { PinoInstrumentation } from '../src'; @@ -112,8 +113,11 @@ describe('PinoInstrumentation', () => { const span = tracer.startSpan('abc'); instrumentation.setConfig({ enabled: true, - logHook: (_span, record) => { + logHook: (_span, record, level) => { record['resource.service.name'] = 'test-service'; + if (semver.satisfies(pino.version, '>= 7.9.0')) { + assert.strictEqual(level, 30); + } }, }); context.with(trace.setSpan(context.active(), span), () => { From 80e855aa39ed10ee42cd3c839dc16a5d0449561a Mon Sep 17 00:00:00 2001 From: Rauno Viskus Date: Mon, 11 Apr 2022 12:36:05 +0300 Subject: [PATCH 3/4] fix: don't try to shut cassandra client down if it wasn't initialized (#966) --- .../test/cassandra-driver.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/node/opentelemetry-instrumentation-cassandra/test/cassandra-driver.test.ts b/plugins/node/opentelemetry-instrumentation-cassandra/test/cassandra-driver.test.ts index da34d02b02..42b8f9082c 100644 --- a/plugins/node/opentelemetry-instrumentation-cassandra/test/cassandra-driver.test.ts +++ b/plugins/node/opentelemetry-instrumentation-cassandra/test/cassandra-driver.test.ts @@ -165,7 +165,7 @@ describe('CassandraDriverInstrumentation', () => { after(async function () { this.timeout(60000); - await client.shutdown(); + await client?.shutdown?.(); if (testCassandraLocally) { testUtils.cleanUpDocker('cassandra'); } From 9a586480ed6a7677fb1283a61d05540345c52617 Mon Sep 17 00:00:00 2001 From: Rauno Viskus Date: Tue, 12 Apr 2022 12:47:12 +0300 Subject: [PATCH 4/4] feat: update webpack outside of examples (#963) * feat: update webpack outside of examples * chore: replace istanbul-instrumenter-loader with @jsdevtools/coverage-istanbul-loader Co-authored-by: Valentin Marchaud --- karma.base.js | 2 +- karma.webpack.js | 4 +-- .../auto-instrumentations-web/karma.conf.js | 21 +++++++++++++- .../auto-instrumentations-web/package.json | 17 ++++++----- .../karma.conf.js | 29 +++++++++++++++---- .../package.json | 14 +++++---- .../karma.conf.js | 19 ++++++++++++ .../package.json | 17 ++++++----- .../karma.conf.js | 21 +++++++++++++- .../package.json | 16 +++++----- .../karma.conf.js | 21 +++++++++++++- .../package.json | 16 +++++----- .../karma.conf.js | 19 ++++++++++++ .../package.json | 16 +++++----- .../karma.conf.js | 21 +++++++++++++- .../package.json | 15 ++++++---- .../karma.conf.js | 29 +++++++++++++++---- .../package.json | 15 ++++++---- 18 files changed, 240 insertions(+), 72 deletions(-) diff --git a/karma.base.js b/karma.base.js index 70435dda11..995bd79659 100644 --- a/karma.base.js +++ b/karma.base.js @@ -18,7 +18,7 @@ module.exports = { listenAddress: 'localhost', hostname: 'localhost', browsers: ['ChromeHeadless'], - frameworks: ['mocha'], + frameworks: ['mocha', 'webpack'], coverageIstanbulReporter: { reports: ['json'], dir: '.nyc_output', diff --git a/karma.webpack.js b/karma.webpack.js index 5863df2f3f..10bf5ad0e9 100644 --- a/karma.webpack.js +++ b/karma.webpack.js @@ -20,7 +20,7 @@ const webpackNodePolyfills = require('./webpack.node-polyfills.js'); module.exports = { mode: 'development', target: 'web', - output: { filename: 'bundle.js' }, + name: 'bundle', resolve: { extensions: ['.ts', '.js', '.tsx'] }, devtool: 'inline-source-map', module: { @@ -31,7 +31,7 @@ module.exports = { exclude: /(node_modules|\.test\.[tj]sx?$)/, test: /\.ts$/, use: { - loader: 'istanbul-instrumenter-loader', + loader: '@jsdevtools/coverage-istanbul-loader', options: { esModules: true } } }, diff --git a/metapackages/auto-instrumentations-web/karma.conf.js b/metapackages/auto-instrumentations-web/karma.conf.js index edcd9f055f..133e22df63 100644 --- a/metapackages/auto-instrumentations-web/karma.conf.js +++ b/metapackages/auto-instrumentations-web/karma.conf.js @@ -1,5 +1,5 @@ /*! - * Copyright 2020, OpenTelemetry Authors + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,29 @@ * limitations under the License. */ +const webpack = require('webpack'); + const karmaWebpackConfig = require('../../karma.webpack'); const karmaBaseConfig = require('../../karma.base'); module.exports = (config) => { + { + const plugins = karmaWebpackConfig.plugins = []; + plugins.push(new webpack.ProvidePlugin({ + process: 'process/browser', + })); + } + + { + const plugins = karmaBaseConfig.plugins = []; + const toAdd = Object.keys(require('./package.json').devDependencies) + .filter((packageName) => packageName.startsWith('karma-')) + .map((packageName) => require(packageName)); + plugins.push( + ...toAdd + ); + } + config.set(Object.assign({}, karmaBaseConfig, { webpack: karmaWebpackConfig })) diff --git a/metapackages/auto-instrumentations-web/package.json b/metapackages/auto-instrumentations-web/package.json index 6906286b00..e105eb2343 100644 --- a/metapackages/auto-instrumentations-web/package.json +++ b/metapackages/auto-instrumentations-web/package.json @@ -31,29 +31,32 @@ }, "devDependencies": { "@babel/core": "7.15.0", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "1.0.2", "@types/mocha": "8.2.3", "@types/node": "16.11.21", "@types/sinon": "10.0.2", "@types/webpack-env": "1.16.2", + "assert": "2.0.0", "babel-loader": "8.2.2", "gts": "3.1.0", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", - "karma-chrome-launcher": "3.1.0", + "karma": "6.3.17", + "karma-chrome-launcher": "3.1.1", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", - "karma-webpack": "4.0.2", + "karma-spec-reporter": "0.0.33", + "karma-webpack": "5.0.0", "mocha": "7.2.0", "nyc": "15.1.0", + "process": "0.11.10", "rimraf": "3.0.2", "sinon": "13.0.1", "ts-loader": "8.3.0", "ts-mocha": "8.0.0", "typescript": "4.3.5", - "webpack": "4.46.0", - "webpack-cli": "4.7.2", + "util": "0.12.4", + "webpack": "5.72.0", + "webpack-cli": "4.9.2", "webpack-merge": "5.8.0" }, "dependencies": { diff --git a/packages/opentelemetry-id-generator-aws-xray/karma.conf.js b/packages/opentelemetry-id-generator-aws-xray/karma.conf.js index f1a1f3a7e8..133e22df63 100644 --- a/packages/opentelemetry-id-generator-aws-xray/karma.conf.js +++ b/packages/opentelemetry-id-generator-aws-xray/karma.conf.js @@ -14,13 +14,30 @@ * limitations under the License. */ +const webpack = require('webpack'); + const karmaWebpackConfig = require('../../karma.webpack'); const karmaBaseConfig = require('../../karma.base'); -module.exports = config => { - config.set( - Object.assign({}, karmaBaseConfig, { - webpack: karmaWebpackConfig, - }) - ); +module.exports = (config) => { + { + const plugins = karmaWebpackConfig.plugins = []; + plugins.push(new webpack.ProvidePlugin({ + process: 'process/browser', + })); + } + + { + const plugins = karmaBaseConfig.plugins = []; + const toAdd = Object.keys(require('./package.json').devDependencies) + .filter((packageName) => packageName.startsWith('karma-')) + .map((packageName) => require(packageName)); + plugins.push( + ...toAdd + ); + } + + config.set(Object.assign({}, karmaBaseConfig, { + webpack: karmaWebpackConfig + })) }; diff --git a/packages/opentelemetry-id-generator-aws-xray/package.json b/packages/opentelemetry-id-generator-aws-xray/package.json index 337ed5bcd2..bdadbc2008 100644 --- a/packages/opentelemetry-id-generator-aws-xray/package.json +++ b/packages/opentelemetry-id-generator-aws-xray/package.json @@ -54,27 +54,29 @@ "@opentelemetry/api": "^1.0.2" }, "devDependencies": { + "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "1.0.2", "@types/mocha": "8.2.3", "@types/node": "16.11.21", "@types/sinon": "10.0.2", "@types/webpack-env": "1.16.2", + "assert": "2.0.0", "gts": "3.1.0", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", - "karma-chrome-launcher": "3.1.0", + "karma": "6.3.17", + "karma-chrome-launcher": "3.1.1", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", - "karma-webpack": "4.0.2", + "karma-spec-reporter": "0.0.33", + "karma-webpack": "5.0.0", "mocha": "7.2.0", "nyc": "15.1.0", + "process": "0.11.10", "rimraf": "3.0.2", "sinon": "13.0.1", "ts-loader": "8.3.0", "ts-mocha": "8.0.0", "typescript": "4.3.5", - "webpack": "4.46.0" + "webpack": "5.72.0" }, "dependencies": { "@opentelemetry/core": "^1.0.0" diff --git a/plugins/web/opentelemetry-instrumentation-document-load/karma.conf.js b/plugins/web/opentelemetry-instrumentation-document-load/karma.conf.js index 6174839d65..35e9ab9375 100644 --- a/plugins/web/opentelemetry-instrumentation-document-load/karma.conf.js +++ b/plugins/web/opentelemetry-instrumentation-document-load/karma.conf.js @@ -14,10 +14,29 @@ * limitations under the License. */ +const webpack = require('webpack'); + const karmaWebpackConfig = require('../../../karma.webpack'); const karmaBaseConfig = require('../../../karma.base'); module.exports = (config) => { + { + const plugins = karmaWebpackConfig.plugins = []; + plugins.push(new webpack.ProvidePlugin({ + process: 'process/browser', + })); + } + + { + const plugins = karmaBaseConfig.plugins = []; + const toAdd = Object.keys(require('./package.json').devDependencies) + .filter((packageName) => packageName.startsWith('karma-')) + .map((packageName) => require(packageName)); + plugins.push( + ...toAdd + ); + } + config.set(Object.assign({}, karmaBaseConfig, { webpack: karmaWebpackConfig })) diff --git a/plugins/web/opentelemetry-instrumentation-document-load/package.json b/plugins/web/opentelemetry-instrumentation-document-load/package.json index fb029b6a34..2f16d246ba 100644 --- a/plugins/web/opentelemetry-instrumentation-document-load/package.json +++ b/plugins/web/opentelemetry-instrumentation-document-load/package.json @@ -51,29 +51,32 @@ }, "devDependencies": { "@babel/core": "7.15.0", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "1.0.2", "@types/mocha": "8.2.3", "@types/node": "16.11.21", "@types/sinon": "10.0.2", "@types/webpack-env": "1.16.2", + "assert": "2.0.0", "babel-loader": "8.2.2", "gts": "3.1.0", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", - "karma-chrome-launcher": "3.1.0", + "karma": "6.3.17", + "karma-chrome-launcher": "3.1.1", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", - "karma-webpack": "4.0.2", + "karma-spec-reporter": "0.0.33", + "karma-webpack": "5.0.0", "mocha": "7.2.0", "nyc": "15.1.0", + "process": "0.11.10", "rimraf": "3.0.2", "sinon": "13.0.1", "ts-loader": "8.3.0", "ts-mocha": "8.0.0", "typescript": "4.3.5", - "webpack": "4.46.0", - "webpack-cli": "4.7.2", + "util": "0.12.4", + "webpack": "5.72.0", + "webpack-cli": "4.9.2", "webpack-merge": "5.8.0" }, "dependencies": { diff --git a/plugins/web/opentelemetry-instrumentation-long-task/karma.conf.js b/plugins/web/opentelemetry-instrumentation-long-task/karma.conf.js index 4a4bd49791..62d6fdcb46 100644 --- a/plugins/web/opentelemetry-instrumentation-long-task/karma.conf.js +++ b/plugins/web/opentelemetry-instrumentation-long-task/karma.conf.js @@ -14,12 +14,31 @@ * limitations under the License. */ +const webpack = require('webpack'); + const karmaWebpackConfig = require('../../../karma.webpack'); const karmaBaseConfig = require('../../../karma.base'); module.exports = (config) => { + { + const plugins = karmaWebpackConfig.plugins = []; + plugins.push(new webpack.ProvidePlugin({ + process: 'process/browser', + })); + } + + { + const plugins = karmaBaseConfig.plugins = []; + const toAdd = Object.keys(require('./package.json').devDependencies) + .filter((packageName) => packageName.startsWith('karma-')) + .map((packageName) => require(packageName)); + plugins.push( + ...toAdd + ); + } + config.set(Object.assign({}, karmaBaseConfig, { frameworks: karmaBaseConfig.frameworks.concat(['jquery-1.8.3']), - webpack: karmaWebpackConfig, + webpack: karmaWebpackConfig })) }; diff --git a/plugins/web/opentelemetry-instrumentation-long-task/package.json b/plugins/web/opentelemetry-instrumentation-long-task/package.json index 1a7ad6c550..a2cb3c202d 100644 --- a/plugins/web/opentelemetry-instrumentation-long-task/package.json +++ b/plugins/web/opentelemetry-instrumentation-long-task/package.json @@ -48,6 +48,7 @@ }, "devDependencies": { "@babel/core": "7.15.0", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "1.0.2", "@opentelemetry/sdk-trace-base": "1.0.1", "@types/jquery": "3.5.6", @@ -55,25 +56,26 @@ "@types/node": "16.11.21", "@types/sinon": "10.0.2", "@types/webpack-env": "1.16.2", + "assert": "2.0.0", "babel-loader": "8.2.2", "gts": "3.1.0", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", - "karma-chrome-launcher": "3.1.0", + "karma": "6.3.17", + "karma-chrome-launcher": "3.1.1", "karma-coverage-istanbul-reporter": "3.0.3", "karma-jquery": "0.2.4", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", - "karma-webpack": "4.0.2", + "karma-spec-reporter": "0.0.33", + "karma-webpack": "5.0.0", "mocha": "7.2.0", "nyc": "15.1.0", + "process": "0.11.10", "rimraf": "3.0.2", "sinon": "13.0.1", "ts-loader": "8.3.0", "ts-mocha": "8.0.0", "typescript": "4.3.5", - "webpack": "4.46.0", - "webpack-cli": "4.7.2", + "webpack": "5.72.0", + "webpack-cli": "4.9.2", "webpack-merge": "5.8.0", "zone.js": "0.11.4" }, diff --git a/plugins/web/opentelemetry-instrumentation-user-interaction/karma.conf.js b/plugins/web/opentelemetry-instrumentation-user-interaction/karma.conf.js index 4a4bd49791..62d6fdcb46 100644 --- a/plugins/web/opentelemetry-instrumentation-user-interaction/karma.conf.js +++ b/plugins/web/opentelemetry-instrumentation-user-interaction/karma.conf.js @@ -14,12 +14,31 @@ * limitations under the License. */ +const webpack = require('webpack'); + const karmaWebpackConfig = require('../../../karma.webpack'); const karmaBaseConfig = require('../../../karma.base'); module.exports = (config) => { + { + const plugins = karmaWebpackConfig.plugins = []; + plugins.push(new webpack.ProvidePlugin({ + process: 'process/browser', + })); + } + + { + const plugins = karmaBaseConfig.plugins = []; + const toAdd = Object.keys(require('./package.json').devDependencies) + .filter((packageName) => packageName.startsWith('karma-')) + .map((packageName) => require(packageName)); + plugins.push( + ...toAdd + ); + } + config.set(Object.assign({}, karmaBaseConfig, { frameworks: karmaBaseConfig.frameworks.concat(['jquery-1.8.3']), - webpack: karmaWebpackConfig, + webpack: karmaWebpackConfig })) }; diff --git a/plugins/web/opentelemetry-instrumentation-user-interaction/package.json b/plugins/web/opentelemetry-instrumentation-user-interaction/package.json index 10ddef4d4b..cc81c413fc 100644 --- a/plugins/web/opentelemetry-instrumentation-user-interaction/package.json +++ b/plugins/web/opentelemetry-instrumentation-user-interaction/package.json @@ -48,6 +48,7 @@ }, "devDependencies": { "@babel/core": "7.15.0", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "1.0.2", "@opentelemetry/context-zone-peer-dep": "1.0.1", "@opentelemetry/instrumentation-xml-http-request": "0.27.0", @@ -57,25 +58,26 @@ "@types/node": "16.11.21", "@types/sinon": "10.0.2", "@types/webpack-env": "1.16.2", + "assert": "2.0.0", "babel-loader": "8.2.2", "gts": "3.1.0", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", - "karma-chrome-launcher": "3.1.0", + "karma": "6.3.17", + "karma-chrome-launcher": "3.1.1", "karma-coverage-istanbul-reporter": "3.0.3", "karma-jquery": "0.2.4", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", - "karma-webpack": "4.0.2", + "karma-spec-reporter": "0.0.33", + "karma-webpack": "5.0.0", "mocha": "7.2.0", "nyc": "15.1.0", + "process": "0.11.10", "rimraf": "3.0.2", "sinon": "13.0.1", "ts-loader": "8.3.0", "ts-mocha": "8.0.0", "typescript": "4.3.5", - "webpack": "4.46.0", - "webpack-cli": "4.7.2", + "webpack": "5.72.0", + "webpack-cli": "4.9.2", "webpack-merge": "5.8.0", "zone.js": "0.11.4" }, diff --git a/plugins/web/opentelemetry-plugin-react-load/karma.conf.js b/plugins/web/opentelemetry-plugin-react-load/karma.conf.js index 6174839d65..35e9ab9375 100644 --- a/plugins/web/opentelemetry-plugin-react-load/karma.conf.js +++ b/plugins/web/opentelemetry-plugin-react-load/karma.conf.js @@ -14,10 +14,29 @@ * limitations under the License. */ +const webpack = require('webpack'); + const karmaWebpackConfig = require('../../../karma.webpack'); const karmaBaseConfig = require('../../../karma.base'); module.exports = (config) => { + { + const plugins = karmaWebpackConfig.plugins = []; + plugins.push(new webpack.ProvidePlugin({ + process: 'process/browser', + })); + } + + { + const plugins = karmaBaseConfig.plugins = []; + const toAdd = Object.keys(require('./package.json').devDependencies) + .filter((packageName) => packageName.startsWith('karma-')) + .map((packageName) => require(packageName)); + plugins.push( + ...toAdd + ); + } + config.set(Object.assign({}, karmaBaseConfig, { webpack: karmaWebpackConfig })) diff --git a/plugins/web/opentelemetry-plugin-react-load/package.json b/plugins/web/opentelemetry-plugin-react-load/package.json index 20f2b91acf..da5270a1c2 100644 --- a/plugins/web/opentelemetry-plugin-react-load/package.json +++ b/plugins/web/opentelemetry-plugin-react-load/package.json @@ -48,6 +48,7 @@ }, "devDependencies": { "@babel/core": "7.15.0", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "1.0.2", "@opentelemetry/propagator-b3": "1.0.1", "@types/mocha": "7.0.2", @@ -58,17 +59,18 @@ "@types/shimmer": "1.0.2", "@types/sinon": "10.0.2", "@types/webpack-env": "1.16.2", + "assert": "2.0.0", "babel-loader": "8.2.2", "gts": "3.1.0", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", - "karma-chrome-launcher": "3.1.0", + "karma": "6.3.17", + "karma-chrome-launcher": "3.1.1", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", - "karma-webpack": "4.0.2", + "karma-spec-reporter": "0.0.33", + "karma-webpack": "5.0.0", "mocha": "7.2.0", "nyc": "15.1.0", + "process": "0.11.10", "react": "17.0.2", "react-dom": "17.0.2", "rimraf": "3.0.2", @@ -76,8 +78,8 @@ "ts-loader": "8.3.0", "ts-mocha": "8.0.0", "typescript": "4.3.5", - "webpack": "4.46.0", - "webpack-cli": "4.7.2", + "webpack": "5.72.0", + "webpack-cli": "4.9.2", "webpack-merge": "5.8.0" }, "peerDependencies": { diff --git a/propagators/opentelemetry-propagator-aws-xray/karma.conf.js b/propagators/opentelemetry-propagator-aws-xray/karma.conf.js index edcd9f055f..133e22df63 100644 --- a/propagators/opentelemetry-propagator-aws-xray/karma.conf.js +++ b/propagators/opentelemetry-propagator-aws-xray/karma.conf.js @@ -1,5 +1,5 @@ /*! - * Copyright 2020, OpenTelemetry Authors + * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,29 @@ * limitations under the License. */ +const webpack = require('webpack'); + const karmaWebpackConfig = require('../../karma.webpack'); const karmaBaseConfig = require('../../karma.base'); module.exports = (config) => { + { + const plugins = karmaWebpackConfig.plugins = []; + plugins.push(new webpack.ProvidePlugin({ + process: 'process/browser', + })); + } + + { + const plugins = karmaBaseConfig.plugins = []; + const toAdd = Object.keys(require('./package.json').devDependencies) + .filter((packageName) => packageName.startsWith('karma-')) + .map((packageName) => require(packageName)); + plugins.push( + ...toAdd + ); + } + config.set(Object.assign({}, karmaBaseConfig, { webpack: karmaWebpackConfig })) diff --git a/propagators/opentelemetry-propagator-aws-xray/package.json b/propagators/opentelemetry-propagator-aws-xray/package.json index 7df61a9a03..06a8e66e62 100644 --- a/propagators/opentelemetry-propagator-aws-xray/package.json +++ b/propagators/opentelemetry-propagator-aws-xray/package.json @@ -48,25 +48,28 @@ "@opentelemetry/api": "^1.0.2" }, "devDependencies": { + "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "1.0.2", "@types/mocha": "8.2.3", "@types/node": "16.11.21", "@types/webpack-env": "1.16.2", + "assert": "2.0.0", "gts": "3.1.0", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", - "karma-chrome-launcher": "3.1.0", + "karma": "6.3.17", + "karma-chrome-launcher": "3.1.1", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", - "karma-webpack": "4.0.2", + "karma-spec-reporter": "0.0.33", + "karma-webpack": "5.0.0", "mocha": "7.2.0", "nyc": "15.1.0", + "process": "0.11.10", "rimraf": "3.0.2", "ts-loader": "8.3.0", "ts-mocha": "8.0.0", "typescript": "4.3.5", - "webpack": "4.46.0" + "webpack": "5.72.0", + "webpack-cli": "4.9.2" }, "dependencies": { "@opentelemetry/core": "^1.0.0" diff --git a/propagators/opentelemetry-propagator-ot-trace/karma.conf.js b/propagators/opentelemetry-propagator-ot-trace/karma.conf.js index f1a1f3a7e8..133e22df63 100644 --- a/propagators/opentelemetry-propagator-ot-trace/karma.conf.js +++ b/propagators/opentelemetry-propagator-ot-trace/karma.conf.js @@ -14,13 +14,30 @@ * limitations under the License. */ +const webpack = require('webpack'); + const karmaWebpackConfig = require('../../karma.webpack'); const karmaBaseConfig = require('../../karma.base'); -module.exports = config => { - config.set( - Object.assign({}, karmaBaseConfig, { - webpack: karmaWebpackConfig, - }) - ); +module.exports = (config) => { + { + const plugins = karmaWebpackConfig.plugins = []; + plugins.push(new webpack.ProvidePlugin({ + process: 'process/browser', + })); + } + + { + const plugins = karmaBaseConfig.plugins = []; + const toAdd = Object.keys(require('./package.json').devDependencies) + .filter((packageName) => packageName.startsWith('karma-')) + .map((packageName) => require(packageName)); + plugins.push( + ...toAdd + ); + } + + config.set(Object.assign({}, karmaBaseConfig, { + webpack: karmaWebpackConfig + })) }; diff --git a/propagators/opentelemetry-propagator-ot-trace/package.json b/propagators/opentelemetry-propagator-ot-trace/package.json index cc696aaac6..c01690e8e6 100644 --- a/propagators/opentelemetry-propagator-ot-trace/package.json +++ b/propagators/opentelemetry-propagator-ot-trace/package.json @@ -49,23 +49,26 @@ "@opentelemetry/api": "^1.0.2" }, "devDependencies": { + "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "1.0.2", "@types/mocha": "8.2.3", "@types/node": "16.11.21", "@types/webpack-env": "1.16.2", + "assert": "2.0.0", "gts": "3.1.0", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", - "karma-chrome-launcher": "3.1.0", + "karma": "6.3.17", + "karma-chrome-launcher": "3.1.1", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", - "karma-webpack": "4.0.2", + "karma-spec-reporter": "0.0.33", + "karma-webpack": "5.0.0", "mocha": "7.2.0", "nyc": "15.1.0", + "process": "0.11.10", "ts-loader": "8.3.0", "ts-mocha": "8.0.0", "typescript": "4.3.5", - "webpack": "4.46.0" + "webpack": "5.72.0", + "webpack-cli": "4.9.2" } }