From 8f2a195d405c173ed7b817db63a1735af424a3e8 Mon Sep 17 00:00:00 2001 From: Jackson Weber <47067795+JacksonWeber@users.noreply.github.com> Date: Wed, 6 Dec 2023 10:11:07 -0800 Subject: [PATCH 1/9] fix(resource-detector-azure): only detect Azure Functions when FUNCTIONS_EXTENSION_VERSION is defined (#1846) --- .../src/detectors/AzureFunctionsDetector.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/detectors/node/opentelemetry-resource-detector-azure/src/detectors/AzureFunctionsDetector.ts b/detectors/node/opentelemetry-resource-detector-azure/src/detectors/AzureFunctionsDetector.ts index 8cd601edb3..2a695fd2d6 100644 --- a/detectors/node/opentelemetry-resource-detector-azure/src/detectors/AzureFunctionsDetector.ts +++ b/detectors/node/opentelemetry-resource-detector-azure/src/detectors/AzureFunctionsDetector.ts @@ -44,8 +44,8 @@ class AzureFunctionsDetector implements DetectorSync { detect(): IResource { let attributes = {}; const functionName = process.env[WEBSITE_SITE_NAME]; - if (functionName) { - const functionVersion = process.env[FUNCTIONS_VERSION]; + const functionVersion = process.env[FUNCTIONS_VERSION]; + if (functionName && functionVersion) { const functionInstance = process.env[WEBSITE_INSTANCE_ID]; const functionMemLimit = process.env[FUNCTIONS_MEM_LIMIT]; From b61f9129f620c4535d3782a985546c2986a46ca0 Mon Sep 17 00:00:00 2001 From: "C. T. Lin" Date: Thu, 7 Dec 2023 08:09:15 +0800 Subject: [PATCH 2/9] fix(koa): fix instrumentation of ESM-imported koa (#1736) Co-authored-by: Trent Mick --- package-lock.json | 5 ++ .../package.json | 2 + .../src/instrumentation.ts | 14 +++- .../test/fixtures/use-koa.mjs | 71 +++++++++++++++++++ .../test/koa.test.ts | 35 ++++++++- 5 files changed, 123 insertions(+), 4 deletions(-) create mode 100644 plugins/node/opentelemetry-instrumentation-koa/test/fixtures/use-koa.mjs diff --git a/package-lock.json b/package-lock.json index 9e8125ce7a..d444c7c8fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34492,6 +34492,7 @@ } }, "plugins/node/opentelemetry-instrumentation-bunyan/examples": { + "name": "bunyan-example", "version": "0.45.1", "license": "Apache-2.0", "dependencies": { @@ -35215,6 +35216,8 @@ "@koa/router": "12.0.0", "@opentelemetry/api": "^1.3.0", "@opentelemetry/context-async-hooks": "^1.8.0", + "@opentelemetry/contrib-test-utils": "^0.35.0", + "@opentelemetry/instrumentation-http": "^0.45.1", "@opentelemetry/sdk-trace-base": "^1.8.0", "@opentelemetry/sdk-trace-node": "^1.8.0", "@types/mocha": "7.0.2", @@ -43708,8 +43711,10 @@ "@koa/router": "12.0.0", "@opentelemetry/api": "^1.3.0", "@opentelemetry/context-async-hooks": "^1.8.0", + "@opentelemetry/contrib-test-utils": "^0.35.0", "@opentelemetry/core": "^1.8.0", "@opentelemetry/instrumentation": "^0.45.1", + "@opentelemetry/instrumentation-http": "^0.45.1", "@opentelemetry/sdk-trace-base": "^1.8.0", "@opentelemetry/sdk-trace-node": "^1.8.0", "@opentelemetry/semantic-conventions": "^1.0.0", diff --git a/plugins/node/opentelemetry-instrumentation-koa/package.json b/plugins/node/opentelemetry-instrumentation-koa/package.json index 17f6ddd991..ae327ebb13 100644 --- a/plugins/node/opentelemetry-instrumentation-koa/package.json +++ b/plugins/node/opentelemetry-instrumentation-koa/package.json @@ -49,6 +49,8 @@ "@koa/router": "12.0.0", "@opentelemetry/api": "^1.3.0", "@opentelemetry/context-async-hooks": "^1.8.0", + "@opentelemetry/contrib-test-utils": "^0.35.0", + "@opentelemetry/instrumentation-http": "^0.45.1", "@opentelemetry/sdk-trace-base": "^1.8.0", "@opentelemetry/sdk-trace-node": "^1.8.0", "@types/mocha": "7.0.2", diff --git a/plugins/node/opentelemetry-instrumentation-koa/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-koa/src/instrumentation.ts index 843639241e..69a14157cc 100644 --- a/plugins/node/opentelemetry-instrumentation-koa/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-koa/src/instrumentation.ts @@ -55,7 +55,11 @@ export class KoaInstrumentation extends InstrumentationBase { return new InstrumentationNodeModuleDefinition( 'koa', ['^2.0.0'], - moduleExports => { + (module: any) => { + const moduleExports: typeof koa = + module[Symbol.toStringTag] === 'Module' + ? module.default // ESM + : module; // CommonJS if (moduleExports == null) { return moduleExports; } @@ -68,9 +72,13 @@ export class KoaInstrumentation extends InstrumentationBase { 'use', this._getKoaUsePatch.bind(this) ); - return moduleExports; + return module; }, - moduleExports => { + (module: any) => { + const moduleExports: typeof koa = + module[Symbol.toStringTag] === 'Module' + ? module.default // ESM + : module; // CommonJS api.diag.debug('Unpatching Koa'); if (isWrapped(moduleExports.prototype.use)) { this._unwrap(moduleExports.prototype, 'use'); diff --git a/plugins/node/opentelemetry-instrumentation-koa/test/fixtures/use-koa.mjs b/plugins/node/opentelemetry-instrumentation-koa/test/fixtures/use-koa.mjs new file mode 100644 index 0000000000..967e76375b --- /dev/null +++ b/plugins/node/opentelemetry-instrumentation-koa/test/fixtures/use-koa.mjs @@ -0,0 +1,71 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Use koa from an ES module: +// node --experimental-loader=@opentelemetry/instrumentation/hook.mjs use-koa.mjs + +import { promisify } from 'util'; +import { createTestNodeSdk } from '@opentelemetry/contrib-test-utils'; + +import { HttpInstrumentation } from '@opentelemetry/instrumentation-http'; +import { KoaInstrumentation } from '../../build/src/index.js'; + +const sdk = createTestNodeSdk({ + serviceName: 'use-koa', + instrumentations: [ + new KoaInstrumentation(), + new HttpInstrumentation() + ] +}) +sdk.start(); + +import Koa from 'koa'; +import KoaRouter from '@koa/router'; +import * as http from 'http'; + +const app = new Koa(); + +app.use(async function simpleMiddleware(ctx, next) { + // Wait a short delay to ensure this "middleware - ..." span clearly starts + // before the "router - ..." span. The test rely on a start-time-based sort + // of the produced spans. If they start in the same millisecond, then tests + // can be flaky. + await promisify(setTimeout)(10); + await next(); +}); + +const router = new KoaRouter(); +router.get('/post/:id', ctx => { + ctx.body = `Post id: ${ctx.params.id}`; +}); + +app.use(router.routes()); + +const server = http.createServer(app.callback()); +await new Promise(resolve => server.listen(0, resolve)); +const port = server.address().port; + +await new Promise(resolve => { + http.get(`http://localhost:${port}/post/0`, (res) => { + res.resume(); + res.on('end', () => { + resolve(); + }); + }) +}); + +await new Promise(resolve => server.close(resolve)); +await sdk.shutdown(); diff --git a/plugins/node/opentelemetry-instrumentation-koa/test/koa.test.ts b/plugins/node/opentelemetry-instrumentation-koa/test/koa.test.ts index eed6667372..8b38513a70 100644 --- a/plugins/node/opentelemetry-instrumentation-koa/test/koa.test.ts +++ b/plugins/node/opentelemetry-instrumentation-koa/test/koa.test.ts @@ -15,9 +15,10 @@ */ import * as KoaRouter from '@koa/router'; -import { context, trace, Span } from '@opentelemetry/api'; +import { context, trace, Span, SpanKind } from '@opentelemetry/api'; import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node'; import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks'; +import * as testUtils from '@opentelemetry/contrib-test-utils'; import { InMemorySpanExporter, SimpleSpanProcessor, @@ -709,4 +710,36 @@ describe('Koa Instrumentation', () => { ); }); }); + + it('should work with ESM usage', async () => { + await testUtils.runTestFixture({ + cwd: __dirname, + argv: ['fixtures/use-koa.mjs'], + env: { + NODE_OPTIONS: + '--experimental-loader=@opentelemetry/instrumentation/hook.mjs', + NODE_NO_WARNINGS: '1', + }, + checkResult: (err, stdout, stderr) => { + assert.ifError(err); + }, + checkCollector: (collector: testUtils.TestCollector) => { + // use-koa.mjs creates a Koa app with a 'GET /post/:id' endpoint and + // a `simpleMiddleware`, then makes a single 'GET /post/0' request. We + // expect to see spans like this: + // span 'GET /post/:id' + // `- span 'middleware - simpleMiddleware' + // `- span 'router - /post/:id' + const spans = collector.sortedSpans; + assert.strictEqual(spans[0].name, 'GET /post/:id'); + assert.strictEqual(spans[0].kind, SpanKind.CLIENT); + assert.strictEqual(spans[1].name, 'middleware - simpleMiddleware'); + assert.strictEqual(spans[1].kind, SpanKind.SERVER); + assert.strictEqual(spans[1].parentSpanId, spans[0].spanId); + assert.strictEqual(spans[2].name, 'router - /post/:id'); + assert.strictEqual(spans[2].kind, SpanKind.SERVER); + assert.strictEqual(spans[2].parentSpanId, spans[1].spanId); + }, + }); + }); }); From 4782f5b7aee3b8816444eee202fe04cd8871ba66 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Wed, 6 Dec 2023 16:10:36 -0800 Subject: [PATCH 3/9] fix(instrumentation-pino): instrument pino used in ESM (#1831) This also reduces the number of pino versions tested with test-all-versions test (from 42 to 13, currently). --- package-lock.json | 2 + .../.tav.yml | 2 +- .../package.json | 1 + .../src/instrumentation.ts | 19 +++-- .../test/fixtures/use-pino-default-import.mjs | 42 +++++++++++ .../test/fixtures/use-pino-named-import.mjs | 42 +++++++++++ .../test/pino.test.ts | 69 +++++++++++++++++++ 7 files changed, 171 insertions(+), 6 deletions(-) create mode 100644 plugins/node/opentelemetry-instrumentation-pino/test/fixtures/use-pino-default-import.mjs create mode 100644 plugins/node/opentelemetry-instrumentation-pino/test/fixtures/use-pino-named-import.mjs diff --git a/package-lock.json b/package-lock.json index d444c7c8fe..393b5258c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35859,6 +35859,7 @@ "devDependencies": { "@opentelemetry/api": "^1.3.0", "@opentelemetry/context-async-hooks": "^1.8.0", + "@opentelemetry/contrib-test-utils": "^0.35.0", "@opentelemetry/sdk-trace-base": "^1.8.0", "@opentelemetry/sdk-trace-node": "^1.8.0", "@types/mocha": "7.0.2", @@ -44213,6 +44214,7 @@ "requires": { "@opentelemetry/api": "^1.3.0", "@opentelemetry/context-async-hooks": "^1.8.0", + "@opentelemetry/contrib-test-utils": "^0.35.0", "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/sdk-trace-base": "^1.8.0", "@opentelemetry/sdk-trace-node": "^1.8.0", diff --git a/plugins/node/opentelemetry-instrumentation-pino/.tav.yml b/plugins/node/opentelemetry-instrumentation-pino/.tav.yml index fc480dd33e..ca1f8bbabc 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/.tav.yml +++ b/plugins/node/opentelemetry-instrumentation-pino/.tav.yml @@ -1,5 +1,5 @@ pino: - - versions: "^8.0.0 || ^7.11.0 || 7.8.0 || 7.2.0 || ^6.13.1 || 5.17.0 || 5.14.0" + - versions: "^8.16.2 || 8.12.1 || 8.8.0 || 8.4.0 || 8.0.0 || ^7.11.0 || 7.8.0 || 7.2.0 || ^6.13.3 || 5.17.0 || 5.14.0" node: ">=14" commands: npm run test - versions: "^7.11.0 || 7.8.0 || 7.2.0 || ^6.13.1 || 5.17.0 || 5.14.0" diff --git a/plugins/node/opentelemetry-instrumentation-pino/package.json b/plugins/node/opentelemetry-instrumentation-pino/package.json index ff285d67f0..1073640da1 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/package.json +++ b/plugins/node/opentelemetry-instrumentation-pino/package.json @@ -46,6 +46,7 @@ "devDependencies": { "@opentelemetry/api": "^1.3.0", "@opentelemetry/context-async-hooks": "^1.8.0", + "@opentelemetry/contrib-test-utils": "^0.35.0", "@opentelemetry/sdk-trace-base": "^1.8.0", "@opentelemetry/sdk-trace-node": "^1.8.0", "@types/mocha": "7.0.2", diff --git a/plugins/node/opentelemetry-instrumentation-pino/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-pino/src/instrumentation.ts index c930c2fa99..5cd5003039 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-pino/src/instrumentation.ts @@ -41,12 +41,14 @@ export class PinoInstrumentation extends InstrumentationBase { new InstrumentationNodeModuleDefinition( 'pino', pinoVersions, - (pinoModule, moduleVersion) => { + (module, moduleVersion?: string) => { diag.debug(`Applying patch for pino@${moduleVersion}`); + const isESM = module[Symbol.toStringTag] === 'Module'; + const moduleExports = isESM ? module.default : module; const instrumentation = this; const patchedPino = Object.assign((...args: unknown[]) => { if (args.length === 0) { - return pinoModule({ + return moduleExports({ mixin: instrumentation._getMixinFunction(), }); } @@ -61,14 +63,14 @@ export class PinoInstrumentation extends InstrumentationBase { args.splice(0, 0, { mixin: instrumentation._getMixinFunction(), }); - return pinoModule(...args); + return moduleExports(...args); } } args[0] = instrumentation._combineOptions(args[0]); - return pinoModule(...args); - }, pinoModule); + return moduleExports(...args); + }, moduleExports); if (typeof patchedPino.pino === 'function') { patchedPino.pino = patchedPino; @@ -76,6 +78,13 @@ export class PinoInstrumentation extends InstrumentationBase { if (typeof patchedPino.default === 'function') { patchedPino.default = patchedPino; } + if (isESM) { + if (module.pino) { + // This was added in pino@6.8.0 (https://github.com/pinojs/pino/pull/936). + module.pino = patchedPino; + } + module.default = patchedPino; + } return patchedPino; } diff --git a/plugins/node/opentelemetry-instrumentation-pino/test/fixtures/use-pino-default-import.mjs b/plugins/node/opentelemetry-instrumentation-pino/test/fixtures/use-pino-default-import.mjs new file mode 100644 index 0000000000..2bde519df7 --- /dev/null +++ b/plugins/node/opentelemetry-instrumentation-pino/test/fixtures/use-pino-default-import.mjs @@ -0,0 +1,42 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Use pino from an ES module: +// node --experimental-loader=@opentelemetry/instrumentation/hook.mjs use-pino-default-import.mjs + +import { trace } from '@opentelemetry/api'; +import { createTestNodeSdk } from '@opentelemetry/contrib-test-utils'; + +import { PinoInstrumentation } from '../../build/src/index.js'; + +const sdk = createTestNodeSdk({ + serviceName: 'use-pino', + instrumentations: [ + new PinoInstrumentation() + ] +}) +sdk.start(); + +import pino from 'pino'; +const logger = pino(); + +const tracer = trace.getTracer(); +await tracer.startActiveSpan('manual', async (span) => { + logger.info('hi from logger') + span.end(); +}); + +await sdk.shutdown(); diff --git a/plugins/node/opentelemetry-instrumentation-pino/test/fixtures/use-pino-named-import.mjs b/plugins/node/opentelemetry-instrumentation-pino/test/fixtures/use-pino-named-import.mjs new file mode 100644 index 0000000000..543cf84826 --- /dev/null +++ b/plugins/node/opentelemetry-instrumentation-pino/test/fixtures/use-pino-named-import.mjs @@ -0,0 +1,42 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Use pino from an ES module: +// node --experimental-loader=@opentelemetry/instrumentation/hook.mjs use-pino-named-import.mjs + +import { trace } from '@opentelemetry/api'; +import { createTestNodeSdk } from '@opentelemetry/contrib-test-utils'; + +import { PinoInstrumentation } from '../../build/src/index.js'; + +const sdk = createTestNodeSdk({ + serviceName: 'use-pino', + instrumentations: [ + new PinoInstrumentation() + ] +}) +sdk.start(); + +import { pino } from 'pino'; // named import, supported with pino >=6.8.0 +const logger = pino(); + +const tracer = trace.getTracer(); +await tracer.startActiveSpan('manual', async (span) => { + logger.info('hi from logger') + span.end(); +}); + +await sdk.shutdown(); diff --git a/plugins/node/opentelemetry-instrumentation-pino/test/pino.test.ts b/plugins/node/opentelemetry-instrumentation-pino/test/pino.test.ts index 3f175bc90a..36c2ac01c2 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/test/pino.test.ts +++ b/plugins/node/opentelemetry-instrumentation-pino/test/pino.test.ts @@ -21,6 +21,10 @@ import { import { context, trace, Span, INVALID_SPAN_CONTEXT } from '@opentelemetry/api'; import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node'; import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks'; +import { + runTestFixture, + TestCollector, +} from '@opentelemetry/contrib-test-utils'; import { Writable } from 'stream'; import * as assert from 'assert'; import * as sinon from 'sinon'; @@ -303,4 +307,69 @@ describe('PinoInstrumentation', () => { }); }); }); + + it('should work with ESM default import', async function () { + let logRecords: any[]; + await runTestFixture({ + cwd: __dirname, + argv: ['fixtures/use-pino-default-import.mjs'], + env: { + NODE_OPTIONS: + '--experimental-loader=@opentelemetry/instrumentation/hook.mjs', + NODE_NO_WARNINGS: '1', + }, + checkResult: (err, stdout, _stderr) => { + assert.ifError(err); + logRecords = stdout + .trim() + .split('\n') + .map(ln => JSON.parse(ln)); + assert.strictEqual(logRecords.length, 1); + }, + checkCollector: (collector: TestCollector) => { + // Check that both log records had the trace-context of the span injected. + const spans = collector.sortedSpans; + assert.strictEqual(spans.length, 1); + logRecords.forEach(rec => { + assert.strictEqual(rec.trace_id, spans[0].traceId); + assert.strictEqual(rec.span_id, spans[0].spanId); + }); + }, + }); + }); + + it('should work with ESM named import', async function () { + if (semver.lt(pino.version, '6.8.0')) { + // Pino 6.8.0 added named ESM exports (https://github.com/pinojs/pino/pull/936). + this.skip(); + } else { + let logRecords: any[]; + await runTestFixture({ + cwd: __dirname, + argv: ['fixtures/use-pino-named-import.mjs'], + env: { + NODE_OPTIONS: + '--experimental-loader=@opentelemetry/instrumentation/hook.mjs', + NODE_NO_WARNINGS: '1', + }, + checkResult: (err, stdout, _stderr) => { + assert.ifError(err); + logRecords = stdout + .trim() + .split('\n') + .map(ln => JSON.parse(ln)); + assert.strictEqual(logRecords.length, 1); + }, + checkCollector: (collector: TestCollector) => { + // Check that both log records had the trace-context of the span injected. + const spans = collector.sortedSpans; + assert.strictEqual(spans.length, 1); + logRecords.forEach(rec => { + assert.strictEqual(rec.trace_id, spans[0].traceId); + assert.strictEqual(rec.span_id, spans[0].spanId); + }); + }, + }); + } + }); }); From bcf3501e623d0fa6af87eeeef0f1cdd2ef755857 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Wed, 6 Dec 2023 16:12:02 -0800 Subject: [PATCH 4/9] feat(host-metrics)!: use the package name as the default instrumentation scope name, to align with instrumentations (#1822) Closes: #1782 --- packages/opentelemetry-host-metrics/src/BaseMetrics.ts | 2 +- packages/opentelemetry-host-metrics/test/metric.test.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/opentelemetry-host-metrics/src/BaseMetrics.ts b/packages/opentelemetry-host-metrics/src/BaseMetrics.ts index 7066ed65d8..6d36f169d4 100644 --- a/packages/opentelemetry-host-metrics/src/BaseMetrics.ts +++ b/packages/opentelemetry-host-metrics/src/BaseMetrics.ts @@ -33,7 +33,7 @@ export interface MetricsCollectorConfig { url?: string; } -const DEFAULT_NAME = 'opentelemetry-host-metrics'; +const DEFAULT_NAME = '@opentelemetry/host-metrics'; /** * Base Class for metrics diff --git a/packages/opentelemetry-host-metrics/test/metric.test.ts b/packages/opentelemetry-host-metrics/test/metric.test.ts index 57251aaba2..64e5cf3d90 100644 --- a/packages/opentelemetry-host-metrics/test/metric.test.ts +++ b/packages/opentelemetry-host-metrics/test/metric.test.ts @@ -139,8 +139,9 @@ describe('Host Metrics', () => { hostMetrics = new HostMetrics({ meterProvider, - name: 'opentelemetry-host-metrics', + name: '', // to get default instrumentation scope name }); + await hostMetrics.start(); const dateStub = sandbox @@ -341,6 +342,11 @@ async function getRecords( assert(collectionResult != null); assert.strictEqual(collectionResult.resourceMetrics.scopeMetrics.length, 1); const scopeMetrics = collectionResult.resourceMetrics.scopeMetrics[0]; + assert.strictEqual( + scopeMetrics.scope.name, + '@opentelemetry/host-metrics', + 'default instrumentation scope name is the package name' + ); const metricDataList = scopeMetrics.metrics.filter( metric => metric.descriptor.name === name ); From 86a21d7b4ce289dc986925ad73ffd6f0618bb5c7 Mon Sep 17 00:00:00 2001 From: David Luna Date: Thu, 7 Dec 2023 01:19:41 +0100 Subject: [PATCH 5/9] fix(instrumentation-express)!: remove `@types/express` from dependencies (#1804) Closes: #1787 --- package-lock.json | 4 ++-- .../node/opentelemetry-instrumentation-express/README.md | 7 +++++++ .../opentelemetry-instrumentation-express/package.json | 4 ++-- .../src/instrumentation.ts | 4 ++-- .../src/internal-types.ts | 4 ++-- .../opentelemetry-instrumentation-express/src/types.ts | 8 ++++---- .../opentelemetry-instrumentation-express/src/utils.ts | 4 ++-- 7 files changed, 21 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 393b5258c4..1d850d42a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34634,14 +34634,14 @@ "dependencies": { "@opentelemetry/core": "^1.8.0", "@opentelemetry/instrumentation": "^0.45.1", - "@opentelemetry/semantic-conventions": "^1.0.0", - "@types/express": "4.17.18" + "@opentelemetry/semantic-conventions": "^1.0.0" }, "devDependencies": { "@opentelemetry/api": "^1.3.0", "@opentelemetry/context-async-hooks": "^1.8.0", "@opentelemetry/sdk-trace-base": "^1.8.0", "@opentelemetry/sdk-trace-node": "^1.8.0", + "@types/express": "4.17.18", "@types/mocha": "7.0.2", "@types/node": "18.6.5", "@types/sinon": "10.0.18", diff --git a/plugins/node/opentelemetry-instrumentation-express/README.md b/plugins/node/opentelemetry-instrumentation-express/README.md index 6eba2b6c67..3bcb67989b 100644 --- a/plugins/node/opentelemetry-instrumentation-express/README.md +++ b/plugins/node/opentelemetry-instrumentation-express/README.md @@ -79,6 +79,13 @@ Express instrumentation has few options available to choose from. You can set th - `info: ExpressRequestInfo` containing the incoming Express.js request, the current route handler creating a span and `ExpressLayerType` - the type of the handling layer. - `defaultName: string` - original name proposed by the instrumentation. +`requestHook` is invoked with 2 arguments: + +- `span: Span` - the span associated with the express request. +- `info: ExpressRequestInfo` containing the incoming Express.js request, the current route handler creating a span and `ExpressLayerType` - the type of the handling layer. + +NOTE: `ExpressRequestInfo.request` is typed as `any`. If you want type support make sure you have `@types/express` installed then you can use `ExpressRequestInfo` + #### Ignore a whole Express route In order to ignore whole traces that represent a given Express route, use diff --git a/plugins/node/opentelemetry-instrumentation-express/package.json b/plugins/node/opentelemetry-instrumentation-express/package.json index 9106594094..fd1d0163c4 100644 --- a/plugins/node/opentelemetry-instrumentation-express/package.json +++ b/plugins/node/opentelemetry-instrumentation-express/package.json @@ -49,6 +49,7 @@ "@opentelemetry/context-async-hooks": "^1.8.0", "@opentelemetry/sdk-trace-base": "^1.8.0", "@opentelemetry/sdk-trace-node": "^1.8.0", + "@types/express": "4.17.18", "@types/mocha": "7.0.2", "@types/node": "18.6.5", "@types/sinon": "10.0.18", @@ -64,8 +65,7 @@ "dependencies": { "@opentelemetry/core": "^1.8.0", "@opentelemetry/instrumentation": "^0.45.1", - "@opentelemetry/semantic-conventions": "^1.0.0", - "@types/express": "4.17.18" + "@opentelemetry/semantic-conventions": "^1.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-express#readme" } diff --git a/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts index 61d91b55e6..46fd4cc0ff 100644 --- a/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts @@ -19,7 +19,7 @@ import { trace, context, diag, - SpanAttributes, + Attributes, SpanStatusCode, } from '@opentelemetry/api'; import type * as express from 'express'; @@ -199,7 +199,7 @@ export class ExpressInstrumentation extends InstrumentationBase< .filter(path => path !== '/' && path !== '/*') .join(''); - const attributes: SpanAttributes = { + const attributes: Attributes = { [SemanticAttributes.HTTP_ROUTE]: route.length > 0 ? route : '/', }; const metadata = getLayerMetadata(layer, layerPath); diff --git a/plugins/node/opentelemetry-instrumentation-express/src/internal-types.ts b/plugins/node/opentelemetry-instrumentation-express/src/internal-types.ts index ab53fc37e7..bae07da361 100644 --- a/plugins/node/opentelemetry-instrumentation-express/src/internal-types.ts +++ b/plugins/node/opentelemetry-instrumentation-express/src/internal-types.ts @@ -15,7 +15,7 @@ */ import type { Request } from 'express'; -import { SpanAttributes } from '@opentelemetry/api'; +import { Attributes } from '@opentelemetry/api'; /** * This symbol is used to mark express layer as being already instrumented @@ -67,6 +67,6 @@ export type ExpressLayer = { }; export type LayerMetadata = { - attributes: SpanAttributes; + attributes: Attributes; name: string; }; diff --git a/plugins/node/opentelemetry-instrumentation-express/src/types.ts b/plugins/node/opentelemetry-instrumentation-express/src/types.ts index a6d376face..50d76df514 100644 --- a/plugins/node/opentelemetry-instrumentation-express/src/types.ts +++ b/plugins/node/opentelemetry-instrumentation-express/src/types.ts @@ -14,15 +14,15 @@ * limitations under the License. */ -import type { Request } from 'express'; import { Span } from '@opentelemetry/api'; import { InstrumentationConfig } from '@opentelemetry/instrumentation'; import { ExpressLayerType } from './enums/ExpressLayerType'; export type IgnoreMatcher = string | RegExp | ((name: string) => boolean); -export type ExpressRequestInfo = { - request: Request; +export type ExpressRequestInfo = { + /** An express request object */ + request: T; route: string; layerType: ExpressLayerType; }; @@ -47,7 +47,7 @@ export interface ExpressRequestCustomAttributeFunction { } /** - * Options available for the Express Instrumentation (see [documentation](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-Instrumentation-express#express-Instrumentation-options)) + * Options available for the Express Instrumentation (see [documentation](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-express#express-instrumentation-options)) */ export interface ExpressInstrumentationConfig extends InstrumentationConfig { /** Ignore specific based on their name */ diff --git a/plugins/node/opentelemetry-instrumentation-express/src/utils.ts b/plugins/node/opentelemetry-instrumentation-express/src/utils.ts index f543104e49..7e51b84124 100644 --- a/plugins/node/opentelemetry-instrumentation-express/src/utils.ts +++ b/plugins/node/opentelemetry-instrumentation-express/src/utils.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { SpanAttributes } from '@opentelemetry/api'; +import { Attributes } from '@opentelemetry/api'; import { IgnoreMatcher, ExpressInstrumentationConfig } from './types'; import { ExpressLayerType } from './enums/ExpressLayerType'; import { AttributeNames } from './enums/AttributeNames'; @@ -49,7 +49,7 @@ export const getLayerMetadata = ( layer: ExpressLayer, layerPath?: string ): { - attributes: SpanAttributes; + attributes: Attributes; name: string; } => { if (layer.name === 'router') { From cdbb29f034218ca14d45d60ab77f33546a37dbaa Mon Sep 17 00:00:00 2001 From: Matthew Turner Date: Thu, 7 Dec 2023 19:12:47 +1100 Subject: [PATCH 6/9] fix(instrumentation-aws-sdk): remove un-sanitised db.statement span attribute from DynamoDB spans (#1748) * feat: add configuration to customise dynamodb statement serialization * fix: format readme * chore: pass DiagLogger to DynamoDB instrumentation * chore: omit db statement when serializer is not configured or when it returned undefined Allow for passing operation to serializer * chore: run lint:fix --------- Co-authored-by: Amir Blum --- .../README.md | 25 +- .../src/aws-sdk.ts | 21 +- .../src/services/ServiceExtension.ts | 14 +- .../src/services/ServicesExtensions.ts | 10 +- .../src/services/dynamodb.ts | 26 +- .../src/services/lambda.ts | 5 +- .../src/services/sns.ts | 5 +- .../src/services/sqs.ts | 5 +- .../src/types.ts | 12 +- .../test/dynamodb.test.ts | 496 +++++++++++++++++- 10 files changed, 558 insertions(+), 61 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/README.md b/plugins/node/opentelemetry-instrumentation-aws-sdk/README.md index a49b72860a..1a24f908bd 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/README.md +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/README.md @@ -20,11 +20,11 @@ npm install --save @opentelemetry/instrumentation-aws-sdk For further automatic instrumentation instruction see the [@opentelemetry/instrumentation](https://www.npmjs.com/package/@opentelemetry/instrumentation) package. ```js -const { NodeTracerProvider } = require("@opentelemetry/sdk-trace-node"); -const { registerInstrumentations } = require("@opentelemetry/instrumentation"); +const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node'); +const { registerInstrumentations } = require('@opentelemetry/instrumentation'); const { AwsInstrumentation, -} = require("@opentelemetry/instrumentation-aws-sdk"); +} = require('@opentelemetry/instrumentation-aws-sdk'); const provider = new NodeTracerProvider(); provider.register(); @@ -42,13 +42,14 @@ registerInstrumentations({ aws-sdk instrumentation has few options available to choose from. You can set the following: -| Options | Type | Description | -| --------------------------------- | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -| `preRequestHook` | `AwsSdkRequestCustomAttributeFunction` | Hook called before request send, which allow to add custom attributes to span. | -| `responseHook` | `AwsSdkResponseCustomAttributeFunction` | Hook for adding custom attributes when response is received from aws. | -| `sqsProcessHook` | `AwsSdkSqsProcessCustomAttributeFunction` | Hook called after starting sqs `process` span (for each sqs received message), which allow to add custom attributes to it. | -| `suppressInternalInstrumentation` | `boolean` | Most aws operation use http requests under the hood. Set this to `true` to hide all underlying http spans. | -| `sqsExtractContextPropagationFromPayload` | `boolean` | Will parse and extract context propagation headers from SQS Payload, false by default. [When should it be used?](./doc/sns.md#integration-with-sqs)| +| Options | Type | Description | +| ----------------------------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `preRequestHook` | `AwsSdkRequestCustomAttributeFunction` | Hook called before request send, which allow to add custom attributes to span. | +| `responseHook` | `AwsSdkResponseCustomAttributeFunction` | Hook for adding custom attributes when response is received from aws. | +| `sqsProcessHook` | `AwsSdkSqsProcessCustomAttributeFunction` | Hook called after starting sqs `process` span (for each sqs received message), which allow to add custom attributes to it. | +| `suppressInternalInstrumentation` | `boolean` | Most aws operation use http requests under the hood. Set this to `true` to hide all underlying http spans. | +| `sqsExtractContextPropagationFromPayload` | `boolean` | Will parse and extract context propagation headers from SQS Payload, false by default. [When should it be used?](./doc/sns.md#integration-with-sqs) | +| `dynamoDBStatementSerializer` | `AwsSdkDynamoDBStatementSerializer` | AWS SDK instrumentation will serialize DynamoDB commands to the `db.statement` attribute using the specified function. Defaults to using a serializer that returns `undefined`. | ## Span Attributes @@ -82,8 +83,8 @@ Usage example: ```js awsInstrumentationConfig = { preRequestHook: (span, request) => { - if (span.serviceName === "s3") { - span.setAttribute("s3.bucket.name", request.commandInput["Bucket"]); + if (span.serviceName === 's3') { + span.setAttribute('s3.bucket.name', request.commandInput['Bucket']); } }, }; diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/aws-sdk.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/aws-sdk.ts index b82192ce82..f07a0795ac 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/aws-sdk.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/aws-sdk.ts @@ -475,8 +475,11 @@ export class AwsInstrumentation extends InstrumentationBase { command.input, undefined ); - const requestMetadata = - self.servicesExtensions.requestPreSpanHook(normalizedRequest); + const requestMetadata = self.servicesExtensions.requestPreSpanHook( + normalizedRequest, + self._config, + self._diag + ); const span = self._startAwsV3Span(normalizedRequest, requestMetadata); const activeContextWithSpan = trace.setSpan(context.active(), span); @@ -602,8 +605,11 @@ export class AwsInstrumentation extends InstrumentationBase { } const normalizedRequest = normalizeV2Request(this); - const requestMetadata = - self.servicesExtensions.requestPreSpanHook(normalizedRequest); + const requestMetadata = self.servicesExtensions.requestPreSpanHook( + normalizedRequest, + self._config, + self._diag + ); const span = self._startAwsV2Span( this, requestMetadata, @@ -642,8 +648,11 @@ export class AwsInstrumentation extends InstrumentationBase { } const normalizedRequest = normalizeV2Request(this); - const requestMetadata = - self.servicesExtensions.requestPreSpanHook(normalizedRequest); + const requestMetadata = self.servicesExtensions.requestPreSpanHook( + normalizedRequest, + self._config, + self._diag + ); const span = self._startAwsV2Span( this, requestMetadata, diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/ServiceExtension.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/ServiceExtension.ts index 5a08fecf69..95f89bdac5 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/ServiceExtension.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/ServiceExtension.ts @@ -13,7 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Span, SpanAttributes, SpanKind, Tracer } from '@opentelemetry/api'; +import { + DiagLogger, + Span, + SpanAttributes, + SpanKind, + Tracer, +} from '@opentelemetry/api'; import { AwsSdkInstrumentationConfig, NormalizedRequest, @@ -30,7 +36,11 @@ export interface RequestMetadata { export interface ServiceExtension { // called before request is sent, and before span is started - requestPreSpanHook: (request: NormalizedRequest) => RequestMetadata; + requestPreSpanHook: ( + request: NormalizedRequest, + config: AwsSdkInstrumentationConfig, + diag: DiagLogger + ) => RequestMetadata; // called before request is sent, and after span is started requestPostSpanHook?: (request: NormalizedRequest) => void; diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/ServicesExtensions.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/ServicesExtensions.ts index 52ab59d886..cb739a2011 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/ServicesExtensions.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/ServicesExtensions.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Tracer, Span } from '@opentelemetry/api'; +import { Tracer, Span, DiagLogger } from '@opentelemetry/api'; import { ServiceExtension, RequestMetadata } from './ServiceExtension'; import { SqsServiceExtension } from './sqs'; import { @@ -35,13 +35,17 @@ export class ServicesExtensions implements ServiceExtension { this.services.set('Lambda', new LambdaServiceExtension()); } - requestPreSpanHook(request: NormalizedRequest): RequestMetadata { + requestPreSpanHook( + request: NormalizedRequest, + config: AwsSdkInstrumentationConfig, + diag: DiagLogger + ): RequestMetadata { const serviceExtension = this.services.get(request.serviceName); if (!serviceExtension) return { isIncoming: false, }; - return serviceExtension.requestPreSpanHook(request); + return serviceExtension.requestPreSpanHook(request, config, diag); } requestPostSpanHook(request: NormalizedRequest) { diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/dynamodb.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/dynamodb.ts index 657d71e407..871d985118 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/dynamodb.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/dynamodb.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Span, SpanKind, Tracer } from '@opentelemetry/api'; +import { DiagLogger, Span, SpanKind, Tracer } from '@opentelemetry/api'; import { RequestMetadata, ServiceExtension } from './ServiceExtension'; import { DbSystemValues, @@ -30,7 +30,11 @@ export class DynamodbServiceExtension implements ServiceExtension { return Array.isArray(values) ? values : [values]; } - requestPreSpanHook(normalizedRequest: NormalizedRequest): RequestMetadata { + requestPreSpanHook( + normalizedRequest: NormalizedRequest, + config: AwsSdkInstrumentationConfig, + diag: DiagLogger + ): RequestMetadata { const spanKind: SpanKind = SpanKind.CLIENT; let spanName: string | undefined; const isIncoming = false; @@ -40,11 +44,23 @@ export class DynamodbServiceExtension implements ServiceExtension { [SemanticAttributes.DB_SYSTEM]: DbSystemValues.DYNAMODB, [SemanticAttributes.DB_NAME]: normalizedRequest.commandInput?.TableName, [SemanticAttributes.DB_OPERATION]: operation, - [SemanticAttributes.DB_STATEMENT]: JSON.stringify( - normalizedRequest.commandInput - ), }; + if (config.dynamoDBStatementSerializer) { + try { + const sanitizedStatement = config.dynamoDBStatementSerializer( + operation, + normalizedRequest.commandInput + ); + + if (typeof sanitizedStatement === 'string') { + spanAttributes[SemanticAttributes.DB_STATEMENT] = sanitizedStatement; + } + } catch (err) { + diag.error('failed to sanitize DynamoDB statement', err); + } + } + // normalizedRequest.commandInput.RequestItems) is undefined when no table names are returned // keys in this object are the table names if (normalizedRequest.commandInput?.TableName) { diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/lambda.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/lambda.ts index 35a9d4a8c5..3254374966 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/lambda.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/lambda.ts @@ -34,7 +34,10 @@ class LambdaCommands { } export class LambdaServiceExtension implements ServiceExtension { - requestPreSpanHook(request: NormalizedRequest): RequestMetadata { + requestPreSpanHook( + request: NormalizedRequest, + _config: AwsSdkInstrumentationConfig + ): RequestMetadata { const functionName = this.extractFunctionName(request.commandInput); let spanAttributes: SpanAttributes = {}; diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sns.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sns.ts index 0ff16558f0..07a016ea8a 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sns.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sns.ts @@ -27,7 +27,10 @@ import { injectPropagationContext } from './MessageAttributes'; import { RequestMetadata, ServiceExtension } from './ServiceExtension'; export class SnsServiceExtension implements ServiceExtension { - requestPreSpanHook(request: NormalizedRequest): RequestMetadata { + requestPreSpanHook( + request: NormalizedRequest, + _config: AwsSdkInstrumentationConfig + ): RequestMetadata { let spanKind: SpanKind = SpanKind.CLIENT; let spanName = `SNS ${request.commandName}`; const spanAttributes = { diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts index f428d68cd3..40fee45cd9 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts @@ -43,7 +43,10 @@ import { } from './MessageAttributes'; export class SqsServiceExtension implements ServiceExtension { - requestPreSpanHook(request: NormalizedRequest): RequestMetadata { + requestPreSpanHook( + request: NormalizedRequest, + _config: AwsSdkInstrumentationConfig + ): RequestMetadata { const queueUrl = this.extractQueueUrl(request.commandInput); const queueName = this.extractQueueNameFromUrl(queueUrl); let spanKind: SpanKind = SpanKind.CLIENT; diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/types.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/types.ts index e23033c9f5..ce99e8c441 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/types.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/types.ts @@ -17,6 +17,8 @@ import { Span } from '@opentelemetry/api'; import { InstrumentationConfig } from '@opentelemetry/instrumentation'; import { SQS } from './aws-sdk.types'; +export type CommandInput = Record; + /** * These are normalized request and response, which are used by both sdk v2 and v3. * They organize the relevant data in one interface which can be processed in a @@ -25,7 +27,7 @@ import { SQS } from './aws-sdk.types'; export interface NormalizedRequest { serviceName: string; commandName: string; - commandInput: Record; + commandInput: CommandInput; region?: string; } export interface NormalizedResponse { @@ -62,6 +64,11 @@ export interface AwsSdkSqsProcessCustomAttributeFunction { (span: Span, sqsProcessInfo: AwsSdkSqsProcessHookInformation): void; } +export type AwsSdkDynamoDBStatementSerializer = ( + operation: string, + commandInput: CommandInput +) => string | undefined; + export interface AwsSdkInstrumentationConfig extends InstrumentationConfig { /** hook for adding custom attributes before request is sent to aws */ preRequestHook?: AwsSdkRequestCustomAttributeFunction; @@ -72,6 +79,9 @@ export interface AwsSdkInstrumentationConfig extends InstrumentationConfig { /** hook for adding custom attribute when an sqs process span is started */ sqsProcessHook?: AwsSdkSqsProcessCustomAttributeFunction; + /** custom serializer function for the db.statement attribute in DynamoDB spans */ + dynamoDBStatementSerializer?: AwsSdkDynamoDBStatementSerializer; + /** * Most aws operation use http request under the hood. * if http instrumentation is enabled, each aws operation will also create diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/dynamodb.test.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/dynamodb.test.ts index ab5f6b1db5..ea4317c63d 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/dynamodb.test.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/dynamodb.test.ts @@ -13,12 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { AwsInstrumentation } from '../src'; +import { + AwsInstrumentation, + CommandInput, + AwsSdkDynamoDBStatementSerializer, +} from '../src'; import { getTestSpans, registerInstrumentationTesting, } from '@opentelemetry/contrib-test-utils'; -registerInstrumentationTesting(new AwsInstrumentation()); +const instrumentation = registerInstrumentationTesting( + new AwsInstrumentation() +); import * as AWS from 'aws-sdk'; import { AWSError } from 'aws-sdk'; @@ -30,6 +36,7 @@ import { import { expect } from 'expect'; import type { ConsumedCapacity as ConsumedCapacityV2 } from 'aws-sdk/clients/dynamodb'; import type { ConsumedCapacity as ConsumedCapacityV3 } from '@aws-sdk/client-dynamodb'; +import * as sinon from 'sinon'; type ConsumedCapacity = ConsumedCapacityV2 | ConsumedCapacityV3; @@ -109,9 +116,7 @@ describe('DynamoDB', () => { expect( attrs[SemanticAttributes.AWS_DYNAMODB_PROJECTION] ).toStrictEqual('id'); - expect( - JSON.parse(attrs[SemanticAttributes.DB_STATEMENT] as string) - ).toEqual(params); + expect(attrs).not.toHaveProperty(SemanticAttributes.DB_STATEMENT); expect(err).toBeFalsy(); done(); } @@ -184,9 +189,7 @@ describe('DynamoDB', () => { expect( attrs[SemanticAttributes.AWS_DYNAMODB_PROJECTION] ).toStrictEqual('id'); - expect( - JSON.parse(attrs[SemanticAttributes.DB_STATEMENT] as string) - ).toEqual(params); + expect(attrs).not.toHaveProperty(SemanticAttributes.DB_STATEMENT); expect(err).toBeFalsy(); done(); } @@ -232,9 +235,7 @@ describe('DynamoDB', () => { JSON.stringify({ ItemCollectionKey: [], SizeEstimateRangeGB: [0] }), ]); - expect( - JSON.parse(attrs[SemanticAttributes.DB_STATEMENT] as string) - ).toEqual(params); + expect(attrs).not.toHaveProperty(SemanticAttributes.DB_STATEMENT); expect(err).toBeFalsy(); done(); } @@ -342,9 +343,7 @@ describe('DynamoDB', () => { expect( attrs[SemanticAttributes.AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY] ).toStrictEqual(30); - expect( - JSON.parse(attrs[SemanticAttributes.DB_STATEMENT] as string) - ).toEqual(params); + expect(attrs).not.toHaveProperty(SemanticAttributes.DB_STATEMENT); expect(err).toBeFalsy(); done(); } @@ -428,9 +427,7 @@ describe('DynamoDB', () => { expect( attrs[SemanticAttributes.AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY] ).toStrictEqual(15); - expect( - JSON.parse(attrs[SemanticAttributes.DB_STATEMENT] as string) - ).toEqual(params); + expect(attrs).not.toHaveProperty(SemanticAttributes.DB_STATEMENT); expect(err).toBeFalsy(); done(); } @@ -472,9 +469,7 @@ describe('DynamoDB', () => { attrs[SemanticAttributes.AWS_DYNAMODB_TABLE_COUNT] ).toStrictEqual(3); - expect( - JSON.parse(attrs[SemanticAttributes.DB_STATEMENT] as string) - ).toEqual(params); + expect(attrs).not.toHaveProperty(SemanticAttributes.DB_STATEMENT); expect(err).toBeFalsy(); done(); } @@ -528,9 +523,7 @@ describe('DynamoDB', () => { expect( attrs[SemanticAttributes.AWS_DYNAMODB_CONSUMED_CAPACITY] ).toBeUndefined(); - expect( - JSON.parse(attrs[SemanticAttributes.DB_STATEMENT] as string) - ).toEqual(dynamodb_params); + expect(attrs).not.toHaveProperty(SemanticAttributes.DB_STATEMENT); expect(err).toBeFalsy(); done(); } @@ -579,9 +572,7 @@ describe('DynamoDB', () => { JSON.stringify(x) ) ); - expect( - JSON.parse(attrs[SemanticAttributes.DB_STATEMENT] as string) - ).toEqual(dynamodb_params); + expect(attrs).not.toHaveProperty(SemanticAttributes.DB_STATEMENT); expect(err).toBeFalsy(); done(); } @@ -624,9 +615,7 @@ describe('DynamoDB', () => { expect( attrs[SemanticAttributes.AWS_DYNAMODB_CONSUMED_CAPACITY] ).toBeUndefined(); - expect( - JSON.parse(attrs[SemanticAttributes.DB_STATEMENT] as string) - ).toEqual(dynamodb_params); + expect(attrs).not.toHaveProperty(SemanticAttributes.DB_STATEMENT); expect(err).toBeFalsy(); done(); } @@ -707,4 +696,453 @@ describe('DynamoDB', () => { ); }); }); + + describe('dbStatementSerializer config', () => { + const SERIALIZED_DB_STATEMENT = 'serialized statement'; + + const dynamoDBStatementSerializer: AwsSdkDynamoDBStatementSerializer = ( + _operation: string, + _command: CommandInput + ): string => { + return SERIALIZED_DB_STATEMENT; + }; + + beforeEach(() => { + instrumentation.disable(); + instrumentation.setConfig({ + dynamoDBStatementSerializer, + }); + instrumentation.enable(); + }); + + it('should not fail if serializer throws', done => { + instrumentation.disable(); + instrumentation.setConfig({ + dynamoDBStatementSerializer: () => { + throw new Error('Serializer failure'); + }, + }); + instrumentation.enable(); + mockV2AwsSend(responseMockSuccess, { + Items: [{ key1: 'val1' }, { key2: 'val2' }], + Count: 2, + ScannedCount: 5, + } as AWS.DynamoDB.Types.QueryOutput); + const dynamodb = new AWS.DynamoDB.DocumentClient(); + const params = { + TableName: 'test-table', + KeyConditionExpression: '#k = :v', + ExpressionAttributeNames: { + '#k': 'key1', + }, + ExpressionAttributeValues: { + ':v': 'val1', + }, + ProjectionExpression: 'id', + ScanIndexForward: true, + ConsistentRead: true, + IndexName: 'name_to_group', + Limit: 10, + Select: 'ALL_ATTRIBUTES', + }; + + dynamodb.query( + params, + (err: AWSError, _data: AWS.DynamoDB.DocumentClient.QueryOutput) => { + const spans = getTestSpans(); + expect(spans.length).toStrictEqual(1); + const attrs = spans[0].attributes; + + expect(attrs).not.toHaveProperty(SemanticAttributes.DB_STATEMENT); + expect(err).toBeFalsy(); + done(); + } + ); + }); + + it('should omit DB statement if serializer is not configured', done => { + instrumentation.disable(); + instrumentation.setConfig({ + dynamoDBStatementSerializer: undefined, + }); + instrumentation.enable(); + mockV2AwsSend(responseMockSuccess, { + Items: [{ key1: 'val1' }, { key2: 'val2' }], + Count: 2, + ScannedCount: 5, + } as AWS.DynamoDB.Types.QueryOutput); + const dynamodb = new AWS.DynamoDB.DocumentClient(); + const params = { + TableName: 'test-table', + KeyConditionExpression: '#k = :v', + ExpressionAttributeNames: { + '#k': 'key1', + }, + ExpressionAttributeValues: { + ':v': 'val1', + }, + ProjectionExpression: 'id', + ScanIndexForward: true, + ConsistentRead: true, + IndexName: 'name_to_group', + Limit: 10, + Select: 'ALL_ATTRIBUTES', + }; + + dynamodb.query( + params, + (err: AWSError, _data: AWS.DynamoDB.DocumentClient.QueryOutput) => { + const spans = getTestSpans(); + expect(spans.length).toStrictEqual(1); + const attrs = spans[0].attributes; + + expect(attrs).not.toHaveProperty(SemanticAttributes.DB_STATEMENT); + expect(err).toBeFalsy(); + done(); + } + ); + }); + + it('should omit DB statement if serializer returns undefined', done => { + instrumentation.disable(); + instrumentation.setConfig({ + dynamoDBStatementSerializer: () => undefined, + }); + instrumentation.enable(); + mockV2AwsSend(responseMockSuccess, { + Items: [{ key1: 'val1' }, { key2: 'val2' }], + Count: 2, + ScannedCount: 5, + } as AWS.DynamoDB.Types.QueryOutput); + const dynamodb = new AWS.DynamoDB.DocumentClient(); + const params = { + TableName: 'test-table', + KeyConditionExpression: '#k = :v', + ExpressionAttributeNames: { + '#k': 'key1', + }, + ExpressionAttributeValues: { + ':v': 'val1', + }, + ProjectionExpression: 'id', + ScanIndexForward: true, + ConsistentRead: true, + IndexName: 'name_to_group', + Limit: 10, + Select: 'ALL_ATTRIBUTES', + }; + + dynamodb.query( + params, + (err: AWSError, _data: AWS.DynamoDB.DocumentClient.QueryOutput) => { + const spans = getTestSpans(); + expect(spans.length).toStrictEqual(1); + const attrs = spans[0].attributes; + + expect(attrs).not.toHaveProperty(SemanticAttributes.DB_STATEMENT); + expect(err).toBeFalsy(); + done(); + } + ); + }); + + it('should provide operation and command input to serializer', done => { + const dynamoDBStatementSerializerSpy = sinon.spy(); + instrumentation.disable(); + instrumentation.setConfig({ + dynamoDBStatementSerializer: dynamoDBStatementSerializerSpy, + }); + instrumentation.enable(); + mockV2AwsSend(responseMockSuccess, { + Items: [{ key1: 'val1' }, { key2: 'val2' }], + Count: 2, + ScannedCount: 5, + } as AWS.DynamoDB.Types.QueryOutput); + const dynamodb = new AWS.DynamoDB.DocumentClient(); + const params = { + TableName: 'test-table', + KeyConditionExpression: '#k = :v', + ExpressionAttributeNames: { + '#k': 'key1', + }, + ExpressionAttributeValues: { + ':v': 'val1', + }, + ProjectionExpression: 'id', + ScanIndexForward: true, + ConsistentRead: true, + IndexName: 'name_to_group', + Limit: 10, + Select: 'ALL_ATTRIBUTES', + }; + + dynamodb.query( + params, + (err: AWSError, _data: AWS.DynamoDB.DocumentClient.QueryOutput) => { + const spans = getTestSpans(); + expect(spans.length).toStrictEqual(1); + + expect(dynamoDBStatementSerializerSpy.callCount).toBe(1); + expect(dynamoDBStatementSerializerSpy.args[0][0]).toStrictEqual( + 'Query' + ); + expect(dynamoDBStatementSerializerSpy.args[0][1]).toStrictEqual({ + ConsistentRead: true, + ExpressionAttributeNames: { + '#k': 'key1', + }, + ExpressionAttributeValues: { + ':v': 'val1', + }, + IndexName: 'name_to_group', + KeyConditionExpression: '#k = :v', + Limit: 10, + ProjectionExpression: 'id', + ScanIndexForward: true, + Select: 'ALL_ATTRIBUTES', + TableName: 'test-table', + }); + + done(); + } + ); + }); + + it('should properly execute the db statement serializer for Query operation', done => { + mockV2AwsSend(responseMockSuccess, { + Items: [{ key1: 'val1' }, { key2: 'val2' }], + Count: 2, + ScannedCount: 5, + } as AWS.DynamoDB.Types.QueryOutput); + const dynamodb = new AWS.DynamoDB.DocumentClient(); + const params = { + TableName: 'test-table', + KeyConditionExpression: '#k = :v', + ExpressionAttributeNames: { + '#k': 'key1', + }, + ExpressionAttributeValues: { + ':v': 'val1', + }, + ProjectionExpression: 'id', + ScanIndexForward: true, + ConsistentRead: true, + IndexName: 'name_to_group', + Limit: 10, + Select: 'ALL_ATTRIBUTES', + }; + + dynamodb.query( + params, + (err: AWSError, _data: AWS.DynamoDB.DocumentClient.QueryOutput) => { + const spans = getTestSpans(); + expect(spans.length).toStrictEqual(1); + const attrs = spans[0].attributes; + + expect(attrs[SemanticAttributes.DB_STATEMENT]).toStrictEqual( + SERIALIZED_DB_STATEMENT + ); + expect(err).toBeFalsy(); + done(); + } + ); + }); + + it('should properly execute the db statement serializer for CreateTable operation', done => { + mockV2AwsSend(responseMockSuccess, { + TableName: 'test_table', + ItemCollectionMetrics: { + ItemCollectionKey: [], + SizeEstimateRangeGB: [0], + }, + ConsumedCapacity: undefined, + } as AWS.DynamoDB.Types.CreateTableOutput); + const globalSecondaryIndexMockData = { + IndexName: 'test_index', + KeySchema: [ + { + AttributeName: 'attribute1', + KeyType: 'HASH', + }, + ], + Projection: { + ProjectionType: 'ALL', + NonKeyAttributes: ['non_key_attr'], + }, + ProvisionedThroughput: { + ReadCapacityUnits: 5, + WriteCapacityUnits: 10, + }, + }; + + const localSecondaryIndexMockData = { + IndexName: 'test_index', + KeySchema: [ + { + AttributeName: 'test_attribute', + KeyType: 'HASH', + }, + ], + Projection: { + ProjectionType: 'ALL', + NonKeyAttributes: ['STRING_VALUE'], + }, + }; + + const dynamodb = new AWS.DynamoDB(); + const params = { + AttributeDefinitions: [ + { + AttributeName: 'test_attribute', + AttributeType: 'S', + }, + ], + TableName: 'test_table', + KeySchema: [ + { + AttributeName: 'test_attribute', + KeyType: 'HASH', + }, + ], + LocalSecondaryIndexes: [localSecondaryIndexMockData], + GlobalSecondaryIndexes: [globalSecondaryIndexMockData], + BillingMode: 'PROVISIONED', + ProvisionedThroughput: { + ReadCapacityUnits: 20, + WriteCapacityUnits: 30, + }, + }; + + dynamodb.createTable( + params, + ( + err: AWSError, + _data: AWS.DynamoDB.DocumentClient.CreateTableOutput + ) => { + const spans = getTestSpans(); + expect(spans.length).toStrictEqual(1); + const attrs = spans[0].attributes; + + expect(attrs[SemanticAttributes.DB_STATEMENT]).toStrictEqual( + SERIALIZED_DB_STATEMENT + ); + expect(err).toBeFalsy(); + done(); + } + ); + }); + + it('should properly execute the db statement serializer for UpdateTable operation', done => { + mockV2AwsSend(responseMockSuccess, { + TableName: 'test_table', + } as AWS.DynamoDB.Types.UpdateTableOutput); + const dynamodb = new AWS.DynamoDB(); + const params = { + AttributeDefinitions: [ + { + AttributeName: 'test_attr', + AttributeType: 'S', + }, + ], + TableName: 'test_table', + ProvisionedThroughput: { + ReadCapacityUnits: 10, + WriteCapacityUnits: 15, + }, + GlobalSecondaryIndexUpdates: [ + { + Update: { + IndexName: 'test_index', + ProvisionedThroughput: { + ReadCapacityUnits: 1, + WriteCapacityUnits: 5, + }, + }, + }, + ], + }; + + dynamodb.updateTable( + params, + ( + err: AWSError, + _data: AWS.DynamoDB.DocumentClient.UpdateTableOutput + ) => { + const spans = getTestSpans(); + expect(spans.length).toStrictEqual(1); + const attrs = spans[0].attributes; + + expect(attrs[SemanticAttributes.DB_STATEMENT]).toStrictEqual( + SERIALIZED_DB_STATEMENT + ); + expect(err).toBeFalsy(); + done(); + } + ); + }); + + it('should properly execute the db statement serializer for ListTables operation', done => { + mockV2AwsSend(responseMockSuccess, { + TableNames: ['test_table', 'test_table_2', 'start_table'], + } as AWS.DynamoDB.Types.ListTablesOutput); + const dynamodb = new AWS.DynamoDB(); + const params = { + ExclusiveStartTableName: 'start_table', + Limit: 10, + }; + + dynamodb.listTables( + params, + ( + err: AWSError, + _data: AWS.DynamoDB.DocumentClient.ListTablesOutput + ) => { + const spans = getTestSpans(); + expect(spans.length).toStrictEqual(1); + const attrs = spans[0].attributes; + + expect(attrs[SemanticAttributes.DB_STATEMENT]).toStrictEqual( + SERIALIZED_DB_STATEMENT + ); + expect(err).toBeFalsy(); + done(); + } + ); + }); + + it('should properly execute the db statement serializer for BatchWriteItem operation', done => { + mockV2AwsSend(responseMockSuccess, { + UnprocessedItems: {}, + ItemCollectionMetrics: { + ItemCollectionKey: [], + SizeEstimateRangeGB: [0], + }, + ConsumedCapacity: undefined, + } as AWS.DynamoDB.Types.BatchWriteItemOutput); + const dynamodb = new AWS.DynamoDB.DocumentClient(); + const params = { + RequestItems: {}, + ReturnConsumedCapacity: 'INDEXES', + ReturnItemCollectionMetrics: 'SIZE', + }; + + dynamodb.batchWrite( + params, + ( + err: AWSError, + _data: AWS.DynamoDB.DocumentClient.BatchWriteItemOutput + ) => { + const spans = getTestSpans(); + expect(spans.length).toStrictEqual(1); + const attrs = spans[0].attributes; + + expect(attrs[SemanticAttributes.DB_STATEMENT]).toStrictEqual( + SERIALIZED_DB_STATEMENT + ); + expect(err).toBeFalsy(); + done(); + } + ); + }); + }); }); From c7e7000b7bf79b0b107c448b403c2613a9b9e2c1 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Thu, 7 Dec 2023 11:53:25 -0500 Subject: [PATCH 7/9] chore: release main (#1829) * chore: release main * chore: sync package-lock.json --------- Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com> --- .release-please-manifest.json | 2 +- .../CHANGELOG.md | 7 ++ .../package.json | 2 +- .../auto-instrumentations-node/CHANGELOG.md | 15 +++++ .../auto-instrumentations-node/package.json | 22 +++---- package-lock.json | 66 +++++++++---------- .../opentelemetry-host-metrics/CHANGELOG.md | 11 ++++ .../opentelemetry-host-metrics/package.json | 2 +- .../instrumentation-cucumber/CHANGELOG.md | 7 ++ .../instrumentation-cucumber/package.json | 2 +- .../CHANGELOG.md | 7 ++ .../package.json | 2 +- .../CHANGELOG.md | 7 ++ .../package.json | 2 +- .../CHANGELOG.md | 7 ++ .../package.json | 2 +- .../CHANGELOG.md | 16 +++++ .../package.json | 2 +- .../CHANGELOG.md | 7 ++ .../package.json | 2 +- .../CHANGELOG.md | 7 ++ .../package.json | 2 +- .../CHANGELOG.md | 7 ++ .../package.json | 2 +- .../CHANGELOG.md | 7 ++ .../package.json | 2 +- .../CHANGELOG.md | 7 ++ .../package.json | 2 +- 28 files changed, 169 insertions(+), 57 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b252fa5d26..f01d025ee8 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1 +1 @@ -{"detectors/node/opentelemetry-resource-detector-alibaba-cloud":"0.28.4","detectors/node/opentelemetry-resource-detector-aws":"1.3.4","detectors/node/opentelemetry-resource-detector-azure":"0.2.1","detectors/node/opentelemetry-resource-detector-container":"0.3.4","detectors/node/opentelemetry-resource-detector-gcp":"0.29.4","detectors/node/opentelemetry-resource-detector-github":"0.28.1","detectors/node/opentelemetry-resource-detector-instana":"0.5.4","metapackages/auto-instrumentations-node":"0.40.1","metapackages/auto-instrumentations-web":"0.34.0","packages/opentelemetry-host-metrics":"0.33.2","packages/opentelemetry-id-generator-aws-xray":"1.2.1","packages/opentelemetry-propagation-utils":"0.30.4","packages/opentelemetry-redis-common":"0.36.1","packages/opentelemetry-sql-common":"0.40.0","packages/opentelemetry-test-utils":"0.35.0","plugins/node/instrumentation-amqplib":"0.33.4","plugins/node/instrumentation-cucumber":"0.1.2","plugins/node/instrumentation-dataloader":"0.5.3","plugins/node/instrumentation-fs":"0.8.3","plugins/node/instrumentation-lru-memoizer":"0.33.4","plugins/node/instrumentation-mongoose":"0.33.4","plugins/node/instrumentation-socket.io":"0.34.4","plugins/node/instrumentation-tedious":"0.6.4","plugins/node/opentelemetry-instrumentation-aws-lambda":"0.37.2","plugins/node/opentelemetry-instrumentation-aws-sdk":"0.37.0","plugins/node/opentelemetry-instrumentation-bunyan":"0.33.0","plugins/node/opentelemetry-instrumentation-cassandra":"0.34.1","plugins/node/opentelemetry-instrumentation-connect":"0.32.3","plugins/node/opentelemetry-instrumentation-dns":"0.32.4","plugins/node/opentelemetry-instrumentation-express":"0.33.3","plugins/node/opentelemetry-instrumentation-fastify":"0.32.4","plugins/node/opentelemetry-instrumentation-generic-pool":"0.32.4","plugins/node/opentelemetry-instrumentation-graphql":"0.36.0","plugins/node/opentelemetry-instrumentation-hapi":"0.33.2","plugins/node/opentelemetry-instrumentation-ioredis":"0.36.0","plugins/node/opentelemetry-instrumentation-knex":"0.32.3","plugins/node/opentelemetry-instrumentation-koa":"0.36.2","plugins/node/opentelemetry-instrumentation-memcached":"0.32.4","plugins/node/opentelemetry-instrumentation-mongodb":"0.37.3","plugins/node/opentelemetry-instrumentation-mysql":"0.34.4","plugins/node/opentelemetry-instrumentation-mysql2":"0.34.4","plugins/node/opentelemetry-instrumentation-nestjs-core":"0.33.3","plugins/node/opentelemetry-instrumentation-net":"0.32.3","plugins/node/opentelemetry-instrumentation-pg":"0.37.1","plugins/node/opentelemetry-instrumentation-pino":"0.34.3","plugins/node/opentelemetry-instrumentation-redis":"0.35.4","plugins/node/opentelemetry-instrumentation-redis-4":"0.35.5","plugins/node/opentelemetry-instrumentation-restify":"0.34.2","plugins/node/opentelemetry-instrumentation-router":"0.33.3","plugins/node/opentelemetry-instrumentation-winston":"0.33.0","plugins/web/opentelemetry-instrumentation-document-load":"0.34.0","plugins/web/opentelemetry-instrumentation-long-task":"0.34.0","plugins/web/opentelemetry-instrumentation-user-interaction":"0.34.0","plugins/web/opentelemetry-plugin-react-load":"0.30.0","propagators/opentelemetry-propagator-aws-xray":"1.3.1","propagators/opentelemetry-propagator-grpc-census-binary":"0.27.1","propagators/opentelemetry-propagator-instana":"0.3.1","propagators/opentelemetry-propagator-ot-trace":"0.27.1"} +{"detectors/node/opentelemetry-resource-detector-alibaba-cloud":"0.28.4","detectors/node/opentelemetry-resource-detector-aws":"1.3.4","detectors/node/opentelemetry-resource-detector-azure":"0.2.2","detectors/node/opentelemetry-resource-detector-container":"0.3.4","detectors/node/opentelemetry-resource-detector-gcp":"0.29.4","detectors/node/opentelemetry-resource-detector-github":"0.28.1","detectors/node/opentelemetry-resource-detector-instana":"0.5.4","metapackages/auto-instrumentations-node":"0.40.2","metapackages/auto-instrumentations-web":"0.34.0","packages/opentelemetry-host-metrics":"0.34.0","packages/opentelemetry-id-generator-aws-xray":"1.2.1","packages/opentelemetry-propagation-utils":"0.30.4","packages/opentelemetry-redis-common":"0.36.1","packages/opentelemetry-sql-common":"0.40.0","packages/opentelemetry-test-utils":"0.35.0","plugins/node/instrumentation-amqplib":"0.33.4","plugins/node/instrumentation-cucumber":"0.2.0","plugins/node/instrumentation-dataloader":"0.5.3","plugins/node/instrumentation-fs":"0.8.3","plugins/node/instrumentation-lru-memoizer":"0.33.4","plugins/node/instrumentation-mongoose":"0.33.4","plugins/node/instrumentation-socket.io":"0.34.4","plugins/node/instrumentation-tedious":"0.6.4","plugins/node/opentelemetry-instrumentation-aws-lambda":"0.37.3","plugins/node/opentelemetry-instrumentation-aws-sdk":"0.37.1","plugins/node/opentelemetry-instrumentation-bunyan":"0.34.0","plugins/node/opentelemetry-instrumentation-cassandra":"0.34.1","plugins/node/opentelemetry-instrumentation-connect":"0.32.3","plugins/node/opentelemetry-instrumentation-dns":"0.32.4","plugins/node/opentelemetry-instrumentation-express":"0.34.0","plugins/node/opentelemetry-instrumentation-fastify":"0.32.5","plugins/node/opentelemetry-instrumentation-generic-pool":"0.32.4","plugins/node/opentelemetry-instrumentation-graphql":"0.36.0","plugins/node/opentelemetry-instrumentation-hapi":"0.33.2","plugins/node/opentelemetry-instrumentation-ioredis":"0.36.0","plugins/node/opentelemetry-instrumentation-knex":"0.32.3","plugins/node/opentelemetry-instrumentation-koa":"0.36.3","plugins/node/opentelemetry-instrumentation-memcached":"0.32.4","plugins/node/opentelemetry-instrumentation-mongodb":"0.38.0","plugins/node/opentelemetry-instrumentation-mysql":"0.34.4","plugins/node/opentelemetry-instrumentation-mysql2":"0.34.4","plugins/node/opentelemetry-instrumentation-nestjs-core":"0.33.3","plugins/node/opentelemetry-instrumentation-net":"0.32.4","plugins/node/opentelemetry-instrumentation-pg":"0.37.1","plugins/node/opentelemetry-instrumentation-pino":"0.34.4","plugins/node/opentelemetry-instrumentation-redis":"0.35.4","plugins/node/opentelemetry-instrumentation-redis-4":"0.35.5","plugins/node/opentelemetry-instrumentation-restify":"0.34.2","plugins/node/opentelemetry-instrumentation-router":"0.33.3","plugins/node/opentelemetry-instrumentation-winston":"0.33.0","plugins/web/opentelemetry-instrumentation-document-load":"0.34.0","plugins/web/opentelemetry-instrumentation-long-task":"0.34.0","plugins/web/opentelemetry-instrumentation-user-interaction":"0.34.0","plugins/web/opentelemetry-plugin-react-load":"0.30.0","propagators/opentelemetry-propagator-aws-xray":"1.3.1","propagators/opentelemetry-propagator-grpc-census-binary":"0.27.1","propagators/opentelemetry-propagator-instana":"0.3.1","propagators/opentelemetry-propagator-ot-trace":"0.27.1"} diff --git a/detectors/node/opentelemetry-resource-detector-azure/CHANGELOG.md b/detectors/node/opentelemetry-resource-detector-azure/CHANGELOG.md index c9f15e4fb1..d69d9fb745 100644 --- a/detectors/node/opentelemetry-resource-detector-azure/CHANGELOG.md +++ b/detectors/node/opentelemetry-resource-detector-azure/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.2.2](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/resource-detector-azure-v0.2.1...resource-detector-azure-v0.2.2) (2023-12-07) + + +### Bug Fixes + +* **resource-detector-azure:** only detect Azure Functions when FUNCTIONS_EXTENSION_VERSION is defined ([#1846](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1846)) ([8f2a195](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/8f2a195d405c173ed7b817db63a1735af424a3e8)) + ## [0.2.1](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/resource-detector-azure-v0.2.0...resource-detector-azure-v0.2.1) (2023-11-22) diff --git a/detectors/node/opentelemetry-resource-detector-azure/package.json b/detectors/node/opentelemetry-resource-detector-azure/package.json index 8afe0bada4..e9f6fd34a6 100644 --- a/detectors/node/opentelemetry-resource-detector-azure/package.json +++ b/detectors/node/opentelemetry-resource-detector-azure/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resource-detector-azure", - "version": "0.2.1", + "version": "0.2.2", "description": "OpenTelemetry SDK resource detector for Azure", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/metapackages/auto-instrumentations-node/CHANGELOG.md b/metapackages/auto-instrumentations-node/CHANGELOG.md index 31a6eae18e..760e808d18 100644 --- a/metapackages/auto-instrumentations-node/CHANGELOG.md +++ b/metapackages/auto-instrumentations-node/CHANGELOG.md @@ -131,6 +131,21 @@ * @opentelemetry/resource-detector-container bumped from ^0.3.3 to ^0.3.4 * @opentelemetry/resource-detector-gcp bumped from ^0.29.3 to ^0.29.4 +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @opentelemetry/instrumentation-aws-lambda bumped from ^0.37.2 to ^0.37.3 + * @opentelemetry/instrumentation-aws-sdk bumped from ^0.37.0 to ^0.37.1 + * @opentelemetry/instrumentation-bunyan bumped from ^0.33.0 to ^0.34.0 + * @opentelemetry/instrumentation-cucumber bumped from ^0.1.2 to ^0.2.0 + * @opentelemetry/instrumentation-express bumped from ^0.33.3 to ^0.34.0 + * @opentelemetry/instrumentation-fastify bumped from ^0.32.4 to ^0.32.5 + * @opentelemetry/instrumentation-koa bumped from ^0.36.2 to ^0.36.3 + * @opentelemetry/instrumentation-mongodb bumped from ^0.37.3 to ^0.38.0 + * @opentelemetry/instrumentation-net bumped from ^0.32.3 to ^0.32.4 + * @opentelemetry/instrumentation-pino bumped from ^0.34.3 to ^0.34.4 + ## [0.40.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/auto-instrumentations-node-v0.39.4...auto-instrumentations-node-v0.40.0) (2023-11-13) diff --git a/metapackages/auto-instrumentations-node/package.json b/metapackages/auto-instrumentations-node/package.json index 85f18cc5f0..dcb822b32a 100644 --- a/metapackages/auto-instrumentations-node/package.json +++ b/metapackages/auto-instrumentations-node/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/auto-instrumentations-node", - "version": "0.40.1", + "version": "0.40.2", "description": "Metapackage which bundles opentelemetry node core and contrib instrumentations", "author": "OpenTelemetry Authors", "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/metapackages/auto-instrumentations-node#readme", @@ -51,17 +51,17 @@ "dependencies": { "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/instrumentation-amqplib": "^0.33.4", - "@opentelemetry/instrumentation-aws-lambda": "^0.37.2", - "@opentelemetry/instrumentation-aws-sdk": "^0.37.0", - "@opentelemetry/instrumentation-bunyan": "^0.33.0", + "@opentelemetry/instrumentation-aws-lambda": "^0.37.3", + "@opentelemetry/instrumentation-aws-sdk": "^0.37.1", + "@opentelemetry/instrumentation-bunyan": "^0.34.0", "@opentelemetry/instrumentation-cassandra-driver": "^0.34.1", "@opentelemetry/instrumentation-connect": "^0.32.3", - "@opentelemetry/instrumentation-cucumber": "^0.1.2", + "@opentelemetry/instrumentation-cucumber": "^0.2.0", "@opentelemetry/instrumentation-dataloader": "^0.5.3", "@opentelemetry/instrumentation-dns": "^0.32.4", - "@opentelemetry/instrumentation-express": "^0.33.3", + "@opentelemetry/instrumentation-express": "^0.34.0", "@opentelemetry/instrumentation-fs": "^0.8.3", - "@opentelemetry/instrumentation-fastify": "^0.32.4", + "@opentelemetry/instrumentation-fastify": "^0.32.5", "@opentelemetry/instrumentation-generic-pool": "^0.32.4", "@opentelemetry/instrumentation-graphql": "^0.36.0", "@opentelemetry/instrumentation-grpc": "^0.45.1", @@ -69,17 +69,17 @@ "@opentelemetry/instrumentation-http": "^0.45.1", "@opentelemetry/instrumentation-ioredis": "^0.36.0", "@opentelemetry/instrumentation-knex": "^0.32.3", - "@opentelemetry/instrumentation-koa": "^0.36.2", + "@opentelemetry/instrumentation-koa": "^0.36.3", "@opentelemetry/instrumentation-lru-memoizer": "^0.33.4", "@opentelemetry/instrumentation-memcached": "^0.32.4", - "@opentelemetry/instrumentation-mongodb": "^0.37.3", + "@opentelemetry/instrumentation-mongodb": "^0.38.0", "@opentelemetry/instrumentation-mongoose": "^0.33.4", "@opentelemetry/instrumentation-mysql": "^0.34.4", "@opentelemetry/instrumentation-mysql2": "^0.34.4", "@opentelemetry/instrumentation-nestjs-core": "^0.33.3", - "@opentelemetry/instrumentation-net": "^0.32.3", + "@opentelemetry/instrumentation-net": "^0.32.4", "@opentelemetry/instrumentation-pg": "^0.37.1", - "@opentelemetry/instrumentation-pino": "^0.34.3", + "@opentelemetry/instrumentation-pino": "^0.34.4", "@opentelemetry/instrumentation-redis": "^0.35.4", "@opentelemetry/instrumentation-redis-4": "^0.35.5", "@opentelemetry/instrumentation-restify": "^0.34.2", diff --git a/package-lock.json b/package-lock.json index 1d850d42a2..02b616dba0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -95,7 +95,7 @@ }, "detectors/node/opentelemetry-resource-detector-azure": { "name": "@opentelemetry/resource-detector-azure", - "version": "0.2.1", + "version": "0.2.2", "license": "Apache-2.0", "dependencies": { "@opentelemetry/resources": "^1.10.1", @@ -235,21 +235,21 @@ }, "metapackages/auto-instrumentations-node": { "name": "@opentelemetry/auto-instrumentations-node", - "version": "0.40.1", + "version": "0.40.2", "license": "Apache-2.0", "dependencies": { "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/instrumentation-amqplib": "^0.33.4", - "@opentelemetry/instrumentation-aws-lambda": "^0.37.2", - "@opentelemetry/instrumentation-aws-sdk": "^0.37.0", - "@opentelemetry/instrumentation-bunyan": "^0.33.0", + "@opentelemetry/instrumentation-aws-lambda": "^0.37.3", + "@opentelemetry/instrumentation-aws-sdk": "^0.37.1", + "@opentelemetry/instrumentation-bunyan": "^0.34.0", "@opentelemetry/instrumentation-cassandra-driver": "^0.34.1", "@opentelemetry/instrumentation-connect": "^0.32.3", - "@opentelemetry/instrumentation-cucumber": "^0.1.2", + "@opentelemetry/instrumentation-cucumber": "^0.2.0", "@opentelemetry/instrumentation-dataloader": "^0.5.3", "@opentelemetry/instrumentation-dns": "^0.32.4", - "@opentelemetry/instrumentation-express": "^0.33.3", - "@opentelemetry/instrumentation-fastify": "^0.32.4", + "@opentelemetry/instrumentation-express": "^0.34.0", + "@opentelemetry/instrumentation-fastify": "^0.32.5", "@opentelemetry/instrumentation-fs": "^0.8.3", "@opentelemetry/instrumentation-generic-pool": "^0.32.4", "@opentelemetry/instrumentation-graphql": "^0.36.0", @@ -258,17 +258,17 @@ "@opentelemetry/instrumentation-http": "^0.45.1", "@opentelemetry/instrumentation-ioredis": "^0.36.0", "@opentelemetry/instrumentation-knex": "^0.32.3", - "@opentelemetry/instrumentation-koa": "^0.36.2", + "@opentelemetry/instrumentation-koa": "^0.36.3", "@opentelemetry/instrumentation-lru-memoizer": "^0.33.4", "@opentelemetry/instrumentation-memcached": "^0.32.4", - "@opentelemetry/instrumentation-mongodb": "^0.37.3", + "@opentelemetry/instrumentation-mongodb": "^0.38.0", "@opentelemetry/instrumentation-mongoose": "^0.33.4", "@opentelemetry/instrumentation-mysql": "^0.34.4", "@opentelemetry/instrumentation-mysql2": "^0.34.4", "@opentelemetry/instrumentation-nestjs-core": "^0.33.3", - "@opentelemetry/instrumentation-net": "^0.32.3", + "@opentelemetry/instrumentation-net": "^0.32.4", "@opentelemetry/instrumentation-pg": "^0.37.1", - "@opentelemetry/instrumentation-pino": "^0.34.3", + "@opentelemetry/instrumentation-pino": "^0.34.4", "@opentelemetry/instrumentation-redis": "^0.35.4", "@opentelemetry/instrumentation-redis-4": "^0.35.5", "@opentelemetry/instrumentation-restify": "^0.34.2", @@ -33638,7 +33638,7 @@ }, "packages/opentelemetry-host-metrics": { "name": "@opentelemetry/host-metrics", - "version": "0.33.2", + "version": "0.34.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/sdk-metrics": "^1.8.0", @@ -33916,7 +33916,7 @@ }, "plugins/node/instrumentation-cucumber": { "name": "@opentelemetry/instrumentation-cucumber", - "version": "0.1.2", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/instrumentation": "^0.45.1", @@ -34378,7 +34378,7 @@ }, "plugins/node/opentelemetry-instrumentation-aws-lambda": { "name": "@opentelemetry/instrumentation-aws-lambda", - "version": "0.37.2", + "version": "0.37.3", "license": "Apache-2.0", "dependencies": { "@opentelemetry/instrumentation": "^0.45.1", @@ -34416,7 +34416,7 @@ }, "plugins/node/opentelemetry-instrumentation-aws-sdk": { "name": "@opentelemetry/instrumentation-aws-sdk", - "version": "0.37.0", + "version": "0.37.1", "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^1.8.0", @@ -34458,7 +34458,7 @@ }, "plugins/node/opentelemetry-instrumentation-bunyan": { "name": "@opentelemetry/instrumentation-bunyan", - "version": "0.33.0", + "version": "0.34.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/api-logs": "^0.45.1", @@ -34629,7 +34629,7 @@ }, "plugins/node/opentelemetry-instrumentation-express": { "name": "@opentelemetry/instrumentation-express", - "version": "0.33.3", + "version": "0.34.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^1.8.0", @@ -34967,7 +34967,7 @@ }, "plugins/node/opentelemetry-instrumentation-fastify": { "name": "@opentelemetry/instrumentation-fastify", - "version": "0.32.4", + "version": "0.32.5", "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^1.8.0", @@ -35203,7 +35203,7 @@ }, "plugins/node/opentelemetry-instrumentation-koa": { "name": "@opentelemetry/instrumentation-koa", - "version": "0.36.2", + "version": "0.36.3", "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^1.8.0", @@ -35423,7 +35423,7 @@ }, "plugins/node/opentelemetry-instrumentation-mongodb": { "name": "@opentelemetry/instrumentation-mongodb", - "version": "0.37.3", + "version": "0.38.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/instrumentation": "^0.45.1", @@ -35769,7 +35769,7 @@ }, "plugins/node/opentelemetry-instrumentation-net": { "name": "@opentelemetry/instrumentation-net", - "version": "0.32.3", + "version": "0.32.4", "license": "Apache-2.0", "dependencies": { "@opentelemetry/instrumentation": "^0.45.1", @@ -35851,7 +35851,7 @@ }, "plugins/node/opentelemetry-instrumentation-pino": { "name": "@opentelemetry/instrumentation-pino", - "version": "0.34.3", + "version": "0.34.4", "license": "Apache-2.0", "dependencies": { "@opentelemetry/instrumentation": "^0.45.1" @@ -42659,16 +42659,16 @@ "@opentelemetry/api": "^1.4.1", "@opentelemetry/instrumentation": "^0.45.1", "@opentelemetry/instrumentation-amqplib": "^0.33.4", - "@opentelemetry/instrumentation-aws-lambda": "^0.37.2", - "@opentelemetry/instrumentation-aws-sdk": "^0.37.0", - "@opentelemetry/instrumentation-bunyan": "^0.33.0", + "@opentelemetry/instrumentation-aws-lambda": "^0.37.3", + "@opentelemetry/instrumentation-aws-sdk": "^0.37.1", + "@opentelemetry/instrumentation-bunyan": "^0.34.0", "@opentelemetry/instrumentation-cassandra-driver": "^0.34.1", "@opentelemetry/instrumentation-connect": "^0.32.3", - "@opentelemetry/instrumentation-cucumber": "^0.1.2", + "@opentelemetry/instrumentation-cucumber": "^0.2.0", "@opentelemetry/instrumentation-dataloader": "^0.5.3", "@opentelemetry/instrumentation-dns": "^0.32.4", - "@opentelemetry/instrumentation-express": "^0.33.3", - "@opentelemetry/instrumentation-fastify": "^0.32.4", + "@opentelemetry/instrumentation-express": "^0.34.0", + "@opentelemetry/instrumentation-fastify": "^0.32.5", "@opentelemetry/instrumentation-fs": "^0.8.3", "@opentelemetry/instrumentation-generic-pool": "^0.32.4", "@opentelemetry/instrumentation-graphql": "^0.36.0", @@ -42677,17 +42677,17 @@ "@opentelemetry/instrumentation-http": "^0.45.1", "@opentelemetry/instrumentation-ioredis": "^0.36.0", "@opentelemetry/instrumentation-knex": "^0.32.3", - "@opentelemetry/instrumentation-koa": "^0.36.2", + "@opentelemetry/instrumentation-koa": "^0.36.3", "@opentelemetry/instrumentation-lru-memoizer": "^0.33.4", "@opentelemetry/instrumentation-memcached": "^0.32.4", - "@opentelemetry/instrumentation-mongodb": "^0.37.3", + "@opentelemetry/instrumentation-mongodb": "^0.38.0", "@opentelemetry/instrumentation-mongoose": "^0.33.4", "@opentelemetry/instrumentation-mysql": "^0.34.4", "@opentelemetry/instrumentation-mysql2": "^0.34.4", "@opentelemetry/instrumentation-nestjs-core": "^0.33.3", - "@opentelemetry/instrumentation-net": "^0.32.3", + "@opentelemetry/instrumentation-net": "^0.32.4", "@opentelemetry/instrumentation-pg": "^0.37.1", - "@opentelemetry/instrumentation-pino": "^0.34.3", + "@opentelemetry/instrumentation-pino": "^0.34.4", "@opentelemetry/instrumentation-redis": "^0.35.4", "@opentelemetry/instrumentation-redis-4": "^0.35.5", "@opentelemetry/instrumentation-restify": "^0.34.2", diff --git a/packages/opentelemetry-host-metrics/CHANGELOG.md b/packages/opentelemetry-host-metrics/CHANGELOG.md index 3d7b1891d8..36b0a6520a 100644 --- a/packages/opentelemetry-host-metrics/CHANGELOG.md +++ b/packages/opentelemetry-host-metrics/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [0.34.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/host-metrics-v0.33.2...host-metrics-v0.34.0) (2023-12-07) + + +### ⚠ BREAKING CHANGES + +* **host-metrics:** use the package name as the default instrumentation scope name, to align with instrumentations ([#1822](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1822)) + +### Features + +* **host-metrics:** use the package name as the default instrumentation scope name, to align with instrumentations ([#1822](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1822)) ([bcf3501](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/bcf3501e623d0fa6af87eeeef0f1cdd2ef755857)), closes [#1782](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1782) + ## [0.33.2](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/host-metrics-v0.33.1...host-metrics-v0.33.2) (2023-11-13) diff --git a/packages/opentelemetry-host-metrics/package.json b/packages/opentelemetry-host-metrics/package.json index b23e0b5002..d58d1b5539 100644 --- a/packages/opentelemetry-host-metrics/package.json +++ b/packages/opentelemetry-host-metrics/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/host-metrics", - "version": "0.33.2", + "version": "0.34.0", "description": "OpenTelemetry Host Metrics for Node.js", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/plugins/node/instrumentation-cucumber/CHANGELOG.md b/plugins/node/instrumentation-cucumber/CHANGELOG.md index 926a6487f3..ebaec5f6a7 100644 --- a/plugins/node/instrumentation-cucumber/CHANGELOG.md +++ b/plugins/node/instrumentation-cucumber/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.2.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-cucumber-v0.1.2...instrumentation-cucumber-v0.2.0) (2023-12-07) + + +### Features + +* **cucumber:** support @cucumber/cucumber@10 ([#1830](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1830)) ([1c2e8b2](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/1c2e8b20ff981873838c1543324e700e2e466dba)) + ## [0.1.2](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-cucumber-v0.1.1...instrumentation-cucumber-v0.1.2) (2023-11-13) diff --git a/plugins/node/instrumentation-cucumber/package.json b/plugins/node/instrumentation-cucumber/package.json index c44c00f932..71d8704eaf 100644 --- a/plugins/node/instrumentation-cucumber/package.json +++ b/plugins/node/instrumentation-cucumber/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-cucumber", - "version": "0.1.2", + "version": "0.2.0", "description": "OpenTelemetry cucumber automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/plugins/node/opentelemetry-instrumentation-aws-lambda/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-aws-lambda/CHANGELOG.md index f6b9350ad5..857fb65976 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-lambda/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-aws-lambda/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.37.3](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-aws-lambda-v0.37.2...instrumentation-aws-lambda-v0.37.3) (2023-12-07) + + +### Bug Fixes + +* **instrumentation-lambda:** soften "unable to init" message and demote to diag.debug ([#1836](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1836)) ([fb80783](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/fb807835e9317891e6f18715e708e9993b8797d8)) + ## [0.37.2](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-aws-lambda-v0.37.1...instrumentation-aws-lambda-v0.37.2) (2023-11-13) diff --git a/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json b/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json index 96ffa6e538..fa71f2c15e 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json +++ b/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-aws-lambda", - "version": "0.37.2", + "version": "0.37.3", "description": "OpenTelemetry AWS Lambda automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-aws-sdk/CHANGELOG.md index ccd96086c1..c2a8e0688e 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.37.1](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-aws-sdk-v0.37.0...instrumentation-aws-sdk-v0.37.1) (2023-12-07) + + +### Bug Fixes + +* **instrumentation-aws-sdk:** remove un-sanitised db.statement span attribute from DynamoDB spans ([#1748](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1748)) ([cdbb29f](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/cdbb29f034218ca14d45d60ab77f33546a37dbaa)) + ## [0.37.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-aws-sdk-v0.36.2...instrumentation-aws-sdk-v0.37.0) (2023-11-22) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json b/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json index c16091147b..8182d8be8a 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-aws-sdk", - "version": "0.37.0", + "version": "0.37.1", "description": "OpenTelemetry automatic instrumentation for the `aws-sdk` package", "keywords": [ "aws", diff --git a/plugins/node/opentelemetry-instrumentation-bunyan/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-bunyan/CHANGELOG.md index 4f181344c5..e2410e3871 100644 --- a/plugins/node/opentelemetry-instrumentation-bunyan/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-bunyan/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.34.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-bunyan-v0.33.0...instrumentation-bunyan-v0.34.0) (2023-12-07) + + +### Features + +* **instrumentation-bunyan:** add log sending to Logs Bridge API ([#1713](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1713)) ([4a1d83c](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/4a1d83ccaa73fa0f11af1d775de4e89ceed75f4d)) + ## [0.33.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-bunyan-v0.32.2...instrumentation-bunyan-v0.33.0) (2023-11-13) diff --git a/plugins/node/opentelemetry-instrumentation-bunyan/package.json b/plugins/node/opentelemetry-instrumentation-bunyan/package.json index 52a2ed161a..60bee3cf61 100644 --- a/plugins/node/opentelemetry-instrumentation-bunyan/package.json +++ b/plugins/node/opentelemetry-instrumentation-bunyan/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-bunyan", - "version": "0.33.0", + "version": "0.34.0", "description": "OpenTelemetry instrumentation for bunyan", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/plugins/node/opentelemetry-instrumentation-express/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-express/CHANGELOG.md index 09389885d2..4607562b72 100644 --- a/plugins/node/opentelemetry-instrumentation-express/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-express/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## [0.34.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-express-v0.33.3...instrumentation-express-v0.34.0) (2023-12-07) + + +### ⚠ BREAKING CHANGES + +* **instrumentation-express:** remove `@types/express` from dependencies ([#1804](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1804)) + +### Features + +* **express:** record exceptions ([#1657](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1657)) ([4ca1862](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/4ca18626610c0ee3da38807da82c753b8763af95)) + + +### Bug Fixes + +* **instrumentation-express:** remove `@types/express` from dependencies ([#1804](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1804)) ([86a21d7](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/86a21d7b4ce289dc986925ad73ffd6f0618bb5c7)), closes [#1787](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1787) + ## [0.33.3](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-express-v0.33.2...instrumentation-express-v0.33.3) (2023-11-13) diff --git a/plugins/node/opentelemetry-instrumentation-express/package.json b/plugins/node/opentelemetry-instrumentation-express/package.json index fd1d0163c4..f3e13e9baa 100644 --- a/plugins/node/opentelemetry-instrumentation-express/package.json +++ b/plugins/node/opentelemetry-instrumentation-express/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-express", - "version": "0.33.3", + "version": "0.34.0", "description": "OpenTelemetry express automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/plugins/node/opentelemetry-instrumentation-fastify/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-fastify/CHANGELOG.md index 9f3aa41fe6..7cbcdedf1b 100644 --- a/plugins/node/opentelemetry-instrumentation-fastify/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-fastify/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.32.5](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-fastify-v0.32.4...instrumentation-fastify-v0.32.5) (2023-12-07) + + +### Bug Fixes + +* **instrumentation-fastify:** fix span attributes and avoid FSTDEP017 FastifyDeprecation warning for 404 request ([#1763](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1763)) ([18ae75c](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/18ae75c6004d66744ee99be68469843372c19d1e)) + ## [0.32.4](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-fastify-v0.32.3...instrumentation-fastify-v0.32.4) (2023-11-13) diff --git a/plugins/node/opentelemetry-instrumentation-fastify/package.json b/plugins/node/opentelemetry-instrumentation-fastify/package.json index a0c12a1418..52712799b3 100644 --- a/plugins/node/opentelemetry-instrumentation-fastify/package.json +++ b/plugins/node/opentelemetry-instrumentation-fastify/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-fastify", - "version": "0.32.4", + "version": "0.32.5", "description": "OpenTelemetry fastify automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/plugins/node/opentelemetry-instrumentation-koa/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-koa/CHANGELOG.md index a1a5601db2..32167ec991 100644 --- a/plugins/node/opentelemetry-instrumentation-koa/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-koa/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.36.3](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-koa-v0.36.2...instrumentation-koa-v0.36.3) (2023-12-07) + + +### Bug Fixes + +* **koa:** fix instrumentation of ESM-imported koa ([#1736](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1736)) ([b61f912](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/b61f9129f620c4535d3782a985546c2986a46ca0)) + ## [0.36.2](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-koa-v0.36.1...instrumentation-koa-v0.36.2) (2023-11-13) diff --git a/plugins/node/opentelemetry-instrumentation-koa/package.json b/plugins/node/opentelemetry-instrumentation-koa/package.json index ae327ebb13..ebdb28b81d 100644 --- a/plugins/node/opentelemetry-instrumentation-koa/package.json +++ b/plugins/node/opentelemetry-instrumentation-koa/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-koa", - "version": "0.36.2", + "version": "0.36.3", "description": "OpenTelemetry Koa automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/plugins/node/opentelemetry-instrumentation-mongodb/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-mongodb/CHANGELOG.md index dee187473c..53ffb674ec 100644 --- a/plugins/node/opentelemetry-instrumentation-mongodb/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-mongodb/CHANGELOG.md @@ -6,6 +6,13 @@ * devDependencies * @opentelemetry/contrib-test-utils bumped from ^0.34.3 to ^0.35.0 +## [0.38.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-mongodb-v0.37.3...instrumentation-mongodb-v0.38.0) (2023-12-07) + + +### Features + +* **instrumentation-mongodb:** add support for mongodb v6 ([#1760](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1760)) ([660e37b](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/660e37bb67509b2fdd5cdd814dad2e60aa0ab40b)) + ## [0.37.2](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-mongodb-v0.37.1...instrumentation-mongodb-v0.37.2) (2023-11-13) diff --git a/plugins/node/opentelemetry-instrumentation-mongodb/package.json b/plugins/node/opentelemetry-instrumentation-mongodb/package.json index 64a3d848d4..a01d2651f5 100644 --- a/plugins/node/opentelemetry-instrumentation-mongodb/package.json +++ b/plugins/node/opentelemetry-instrumentation-mongodb/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-mongodb", - "version": "0.37.3", + "version": "0.38.0", "description": "OpenTelemetry mongodb automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/plugins/node/opentelemetry-instrumentation-net/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-net/CHANGELOG.md index 334ef17a26..3d88a1088f 100644 --- a/plugins/node/opentelemetry-instrumentation-net/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-net/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.32.4](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-net-v0.32.3...instrumentation-net-v0.32.4) (2023-12-07) + + +### Bug Fixes + +* **instrumentation-net:** Don't operate on closed span ([#1819](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1819)) ([60d60d0](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/60d60d0be27f625819d9c4138488fb4d4c0a6b45)) + ## [0.32.3](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-net-v0.32.2...instrumentation-net-v0.32.3) (2023-11-13) diff --git a/plugins/node/opentelemetry-instrumentation-net/package.json b/plugins/node/opentelemetry-instrumentation-net/package.json index fd774aeb69..6b456c3d4f 100644 --- a/plugins/node/opentelemetry-instrumentation-net/package.json +++ b/plugins/node/opentelemetry-instrumentation-net/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-net", - "version": "0.32.3", + "version": "0.32.4", "description": "OpenTelemetry net module automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/plugins/node/opentelemetry-instrumentation-pino/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-pino/CHANGELOG.md index aad79f8f15..28a29653f1 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-pino/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.34.4](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-pino-v0.34.3...instrumentation-pino-v0.34.4) (2023-12-07) + + +### Bug Fixes + +* **instrumentation-pino:** instrument pino used in ESM ([#1831](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1831)) ([4782f5b](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/4782f5b7aee3b8816444eee202fe04cd8871ba66)) + ## [0.34.3](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-pino-v0.34.2...instrumentation-pino-v0.34.3) (2023-11-13) diff --git a/plugins/node/opentelemetry-instrumentation-pino/package.json b/plugins/node/opentelemetry-instrumentation-pino/package.json index 1073640da1..f0f2e21fb5 100644 --- a/plugins/node/opentelemetry-instrumentation-pino/package.json +++ b/plugins/node/opentelemetry-instrumentation-pino/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-pino", - "version": "0.34.3", + "version": "0.34.4", "description": "OpenTelemetry instrumentation for pino", "main": "build/src/index.js", "types": "build/src/index.d.ts", From 67bb0cadb078ba3b8d4679b65f06ae68c4550598 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Fri, 8 Dec 2023 10:35:16 -0800 Subject: [PATCH 8/9] chore(instrumentation-mongoose, instrumentation-socket.io)!: bump engines from >=14.0 to >=14 (#1843) This bump means that the minimum supported Node.js version is vague about the minor. '>=14' is used in all other instrumentations. CI only tests with the current latest Node.js v14.x. --- plugins/node/instrumentation-mongoose/package.json | 2 +- plugins/node/instrumentation-socket.io/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/node/instrumentation-mongoose/package.json b/plugins/node/instrumentation-mongoose/package.json index 0cc75fdcd3..dfd8350c9a 100644 --- a/plugins/node/instrumentation-mongoose/package.json +++ b/plugins/node/instrumentation-mongoose/package.json @@ -31,7 +31,7 @@ "author": "OpenTelemetry Authors", "license": "Apache-2.0", "engines": { - "node": ">=14.0" + "node": ">=14" }, "files": [ "build/src/**/*.js", diff --git a/plugins/node/instrumentation-socket.io/package.json b/plugins/node/instrumentation-socket.io/package.json index 5e22a36b63..2c9ba92d66 100644 --- a/plugins/node/instrumentation-socket.io/package.json +++ b/plugins/node/instrumentation-socket.io/package.json @@ -28,7 +28,7 @@ "author": "OpenTelemetry Authors", "license": "Apache-2.0", "engines": { - "node": ">=14.0" + "node": ">=14" }, "files": [ "build/src/**/*.js", From 3cb2802770eb5b42774e4f7c6fcc7d126a2b31dc Mon Sep 17 00:00:00 2001 From: Jamie Danielson Date: Fri, 8 Dec 2023 16:45:06 -0500 Subject: [PATCH 9/9] feat: add esnext target for auto-instr-web package (#1848) * feat: add esnext target for auto-instr-web package * remove unnecessary jsx line from tsconfig * add skipLibCheck to match tsconfig.esm --- .../auto-instrumentations-web/package.json | 17 ++++++++++++----- .../tsconfig.esnext.json | 10 ++++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 metapackages/auto-instrumentations-web/tsconfig.esnext.json diff --git a/metapackages/auto-instrumentations-web/package.json b/metapackages/auto-instrumentations-web/package.json index c89423df1e..3bcb9dd9c2 100644 --- a/metapackages/auto-instrumentations-web/package.json +++ b/metapackages/auto-instrumentations-web/package.json @@ -13,18 +13,19 @@ }, "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", - "compile": "tsc --build tsconfig.json tsconfig.esm.json", + "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", + "compile": "tsc --build 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/auto-instrumentations-web --include-dependencies", "prewatch": "npm run precompile", "prepublishOnly": "npm run compile", "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" }, "bugs": { "url": "https://github.com/open-telemetry/opentelemetry-js-contrib/issues" @@ -69,6 +70,12 @@ "files": [ "build/src/**/*.js", "build/src/**/*.js.map", - "build/src/**/*.d.ts" + "build/src/**/*.d.ts", + "build/esm/**/*.js", + "build/esm/**/*.js.map", + "build/esm/**/*.d.ts", + "build/esnext/**/*.js", + "build/esnext/**/*.js.map", + "build/esnext/**/*.d.ts" ] -} +} \ No newline at end of file diff --git a/metapackages/auto-instrumentations-web/tsconfig.esnext.json b/metapackages/auto-instrumentations-web/tsconfig.esnext.json new file mode 100644 index 0000000000..d6054d1fb0 --- /dev/null +++ b/metapackages/auto-instrumentations-web/tsconfig.esnext.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base.esnext.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "build/esnext", + "skipLibCheck": true, + "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo" + }, + "include": ["src/**/*.ts"] +}