diff --git a/CHANGELOG.md b/CHANGELOG.md index e49f315e0e4..39b73002433 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,12 +15,28 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/ ### :bug: (Bug Fix) -* fix(sdk-trace-base): ensure attribute value length limit is enforced on span creation [#4417](/~https://github.com/open-telemetry/opentelemetry-js/pull/4417) @pichlermarc - ### :books: (Refine Doc) ### :house: (Internal) +## 1.21.0 + +### :rocket: (Enhancement) + +* feat(sdk-metrics): add constructor option to add metric readers [#4427](/~https://github.com/open-telemetry/opentelemetry-js/pull/4427) @pichlermarc + * deprecates `MeterProvider.addMetricReader()` please use the constructor option `readers` instead. + +### :bug: (Bug Fix) + +* fix(sdk-trace-base): ensure attribute value length limit is enforced on span creation [#4417](/~https://github.com/open-telemetry/opentelemetry-js/pull/4417) @pichlermarc +* fix(sdk-trace-base): Export processed spans while exporter failed [#4287](/~https://github.com/open-telemetry/opentelemetry-js/pull/4287) @Zirak + +### :house: (Internal) + +* chore(opentelemetry-context-zone-peer-dep): support zone.js ^v0.13.0 [#4320](/~https://github.com/open-telemetry/opentelemetry-js/pull/4320) +* refactor(core): drop unnecessary assignment of HOSTNAME [#4421](/~https://github.com/open-telemetry/opentelemetry-js/pull/4421) @pichlermarc +* test(opentelemetry-context-zone-peer-dep): transpile zone.js in tests [#4423](/~https://github.com/open-telemetry/opentelemetry-js/pull/4423) @legendecas + ## 1.20.0 ### :rocket: (Enhancement) diff --git a/README.md b/README.md index eb5236eccde..7339a1e7e97 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,7 @@ The below table describes which versions of each set of packages are expected to | Stable Packages | Experimental Packages | |-----------------------------------------------------------------|-----------------------| +| 1.21.x | 0.48.x | | 1.20.x | 0.47.x | | 1.19.x | 0.46.x | | 1.18.x | 0.45.x | diff --git a/api/CHANGELOG.md b/api/CHANGELOG.md index c46749c01e5..542d9daa38c 100644 --- a/api/CHANGELOG.md +++ b/api/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. ## Unreleased +* feat(api): add SugaredTracer for functions not defined in the spec +* fix(api): fix unreachable @opentelemetry/api/experimental entry [#4446](/~https://github.com/open-telemetry/opentelemetry-js/pull/4446) @legendecas + ## 1.7.0 ### :rocket: (Enhancement) diff --git a/api/package.json b/api/package.json index 4673acbf9ec..140365100f4 100644 --- a/api/package.json +++ b/api/package.json @@ -12,6 +12,20 @@ "./build/esnext/platform/index.js": "./build/esnext/platform/browser/index.js", "./build/src/platform/index.js": "./build/src/platform/browser/index.js" }, + "exports": { + ".": { + "module": "./build/esm/index.js", + "esnext": "./build/esnext/index.js", + "types": "./build/src/index.d.ts", + "default": "./build/src/index.js" + }, + "./experimental": { + "module": "./build/esm/experimental/index.js", + "esnext": "./build/esnext/experimental/index.js", + "types": "./build/src/experimental/index.d.ts", + "default": "./build/src/experimental/index.js" + } + }, "repository": "open-telemetry/opentelemetry-js", "scripts": { "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", diff --git a/packages/opentelemetry-propagator-jaeger/src/version.js b/api/src/experimental/index.ts similarity index 75% rename from packages/opentelemetry-propagator-jaeger/src/version.js rename to api/src/experimental/index.ts index 2090d63abf3..a05c7ba21bd 100644 --- a/packages/opentelemetry-propagator-jaeger/src/version.js +++ b/api/src/experimental/index.ts @@ -1,4 +1,3 @@ -"use strict"; /* * Copyright The OpenTelemetry Authors * @@ -14,7 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.VERSION = void 0; -// this is autogenerated file, see scripts/version-update.js -exports.VERSION = '1.16.0'; +export { wrapTracer, SugaredTracer } from './trace/SugaredTracer'; +export { SugaredSpanOptions } from './trace/SugaredOptions'; diff --git a/packages/opentelemetry-exporter-jaeger/src/version.js b/api/src/experimental/trace/SugaredOptions.ts similarity index 58% rename from packages/opentelemetry-exporter-jaeger/src/version.js rename to api/src/experimental/trace/SugaredOptions.ts index 2090d63abf3..3dba14650e7 100644 --- a/packages/opentelemetry-exporter-jaeger/src/version.js +++ b/api/src/experimental/trace/SugaredOptions.ts @@ -1,4 +1,3 @@ -"use strict"; /* * Copyright The OpenTelemetry Authors * @@ -14,7 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.VERSION = void 0; -// this is autogenerated file, see scripts/version-update.js -exports.VERSION = '1.16.0'; + +import { Span, SpanOptions } from '../../'; + +/** + * Options needed for span creation + */ +export interface SugaredSpanOptions extends SpanOptions { + /** + * function to overwrite default exception behavior to record the exception. No exceptions should be thrown in the function. + * @param e Error which triggered this exception + * @param span current span from context + */ + onException?: (e: Error, span: Span) => void; +} diff --git a/api/src/experimental/trace/SugaredTracer.ts b/api/src/experimental/trace/SugaredTracer.ts new file mode 100644 index 00000000000..c4f5cdc6427 --- /dev/null +++ b/api/src/experimental/trace/SugaredTracer.ts @@ -0,0 +1,215 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { SugaredSpanOptions } from './SugaredOptions'; +import { context, Context, Span, SpanStatusCode, Tracer } from '../../'; + +const defaultOnException = (e: Error, span: Span) => { + span.recordException(e); + span.setStatus({ + code: SpanStatusCode.ERROR, + }); +}; + +/** + * return a new SugaredTracer created from the supplied one + * @param tracer + */ +export function wrapTracer(tracer: Tracer): SugaredTracer { + return new SugaredTracer(tracer); +} + +export class SugaredTracer implements Tracer { + private readonly _tracer: Tracer; + + constructor(tracer: Tracer) { + this._tracer = tracer; + this.startSpan = tracer.startSpan.bind(this._tracer); + this.startActiveSpan = tracer.startActiveSpan.bind(this._tracer); + } + + startActiveSpan: Tracer['startActiveSpan']; + startSpan: Tracer['startSpan']; + + /** + * Starts a new {@link Span} and calls the given function passing it the + * created span as first argument. + * Additionally, the new span gets set in context and this context is activated + * for the duration of the function call. + * The span will be closed after the function has executed. + * If an exception occurs, it is recorded, the status is set to ERROR and the exception is rethrown. + * + * @param name The name of the span + * @param [options] SugaredSpanOptions used for span creation + * @param [context] Context to use to extract parent + * @param fn function called in the context of the span and receives the newly created span as an argument + * @returns return value of fn + * @example + * const something = tracer.withActiveSpan('op', span => { + * // do some work + * }); + * @example + * const something = await tracer.withActiveSpan('op', span => { + * // do some async work + * }); + */ + withActiveSpan ReturnType>( + name: string, + fn: F + ): ReturnType; + withActiveSpan ReturnType>( + name: string, + options: SugaredSpanOptions, + fn: F + ): ReturnType; + withActiveSpan ReturnType>( + name: string, + options: SugaredSpanOptions, + context: Context, + fn: F + ): ReturnType; + withActiveSpan ReturnType>( + name: string, + arg2: F | SugaredSpanOptions, + arg3?: F | Context, + arg4?: F + ): ReturnType { + const { opts, ctx, fn } = massageParams(arg2, arg3, arg4); + + return this._tracer.startActiveSpan(name, opts, ctx, (span: Span) => + handleFn(span, opts, fn) + ) as ReturnType; + } + + /** + * Starts a new {@link Span} and ends it after execution of fn without setting it on context. + * The span will be closed after the function has executed. + * If an exception occurs, it is recorded, the status is et to ERROR and rethrown. + * + * This method does NOT modify the current Context. + * + * @param name The name of the span + * @param [options] SugaredSpanOptions used for span creation + * @param [context] Context to use to extract parent + * @param fn function called in the context of the span and receives the newly created span as an argument + * @returns Span The newly created span + * @example + * const something = tracer.withSpan('op', span => { + * // do some work + * }); + * @example + * const something = await tracer.withSpan('op', span => { + * // do some async work + * }); + */ + withSpan ReturnType>( + name: string, + fn: F + ): ReturnType; + withSpan ReturnType>( + name: string, + options: SugaredSpanOptions, + fn: F + ): ReturnType; + withSpan ReturnType>( + name: string, + options: SugaredSpanOptions, + context: Context, + fn: F + ): ReturnType; + withSpan ReturnType>( + name: string, + options: SugaredSpanOptions, + context: Context, + fn: F + ): ReturnType; + withSpan ReturnType>( + name: string, + arg2: SugaredSpanOptions | F, + arg3?: Context | F, + arg4?: F + ): ReturnType { + const { opts, ctx, fn } = massageParams(arg2, arg3, arg4); + + const span = this._tracer.startSpan(name, opts, ctx); + return handleFn(span, opts, fn) as ReturnType; + } +} + +/** + * Massages parameters of withSpan and withActiveSpan to allow signature overwrites + * @param arg + * @param arg2 + * @param arg3 + */ +function massageParams ReturnType>( + arg: F | SugaredSpanOptions, + arg2?: F | Context, + arg3?: F +) { + let opts: SugaredSpanOptions | undefined; + let ctx: Context | undefined; + let fn: F; + + if (!arg2 && !arg3) { + fn = arg as F; + } else if (!arg3) { + opts = arg as SugaredSpanOptions; + fn = arg2 as F; + } else { + opts = arg as SugaredSpanOptions; + ctx = arg2 as Context; + fn = arg3 as F; + } + opts = opts ?? {}; + ctx = ctx ?? context.active(); + + return { opts, ctx, fn }; +} + +/** + * Executes fn, returns results and runs onException in the case of exception to allow overwriting of error handling + * @param span + * @param opts + * @param fn + */ +function handleFn ReturnType>( + span: Span, + opts: SugaredSpanOptions, + fn: F +): ReturnType { + const onException = opts.onException ?? defaultOnException; + const errorHandler = (e: Error) => { + onException(e, span); + span.end(); + throw e; + }; + + try { + const ret = fn(span) as Promise>; + // if fn is an async function, attach a recordException and spanEnd callback to the promise + if (typeof ret?.then === 'function') { + return ret.then(val => { + span.end(); + return val; + }, errorHandler) as ReturnType; + } + span.end(); + return ret as ReturnType; + } catch (e) { + // add throw to signal the compiler that this will throw in the inner scope + throw errorHandler(e); + } +} diff --git a/api/test/common/experimental/trace/SugaredTracer.test.ts b/api/test/common/experimental/trace/SugaredTracer.test.ts new file mode 100644 index 00000000000..aa0d01f3d89 --- /dev/null +++ b/api/test/common/experimental/trace/SugaredTracer.test.ts @@ -0,0 +1,157 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { wrapTracer } from '../../../../src/experimental'; +import * as assert from 'assert'; +import { NoopTracerProvider } from '../../../../src/trace/NoopTracerProvider'; +import { NoopTracer } from '../../../../src/trace/NoopTracer'; +import { Span } from '../../../../src'; +import { Context, context, SpanOptions } from '../../../../src'; + +describe('SugaredTracer', () => { + class TestTracer extends NoopTracer { + public calls: IArguments[] = []; + + override startActiveSpan ReturnType>( + name: string, + arg2?: SpanOptions, + arg3?: Context, + arg4?: F + ): ReturnType | undefined { + this.calls.push(arguments); + return super.startActiveSpan(name, arg2, arg3, arg4 as F); + } + + override startSpan( + name: string, + options?: SpanOptions, + _context: Context = context.active() + ): Span { + this.calls.push(arguments); + return super.startSpan(name, options, _context); + } + } + + class TestTracerProvider extends NoopTracerProvider { + override getTracer() { + return new TestTracer(); + } + } + + const tracer = new TestTracerProvider().getTracer(); + const sugaredTracer = wrapTracer(tracer); + + afterEach(() => { + tracer.calls = []; + }); + + describe('wrapTracer()', () => { + it('still provides standard tracer functions', () => { + assert.ok( + typeof sugaredTracer.startSpan === 'function', + 'startSpan is missing' + ); + assert.ok( + typeof sugaredTracer.startActiveSpan === 'function', + 'startActiveSpan is missing' + ); + }); + }); + + describe('withActiveSpan()', () => { + it('proxies value with minimal args', () => { + const result = sugaredTracer.withActiveSpan('test', span => { + return 'result'; + }); + + assert.strictEqual(result, 'result', 'Unexpected result'); + + assert.strictEqual(tracer.calls.length, 2); // ensure that startActiveSpan and startSpan is called + }); + + it('proxies value with context', () => { + const result = sugaredTracer.withActiveSpan( + 'test', + { onException: e => e }, + span => { + return 'result'; + } + ); + + assert.strictEqual(result, 'result', 'Unexpected result'); + + assert.strictEqual(tracer.calls.length, 2); // ensure that startActiveSpan and startSpan is called + }); + + it('proxies value with context', () => { + const result = sugaredTracer.withActiveSpan( + 'test', + { onException: e => e }, + context.active(), + span => { + return 'result'; + } + ); + + assert.strictEqual(result, 'result', 'Unexpected result'); + + assert.strictEqual(tracer.calls.length, 2); // ensure that startActiveSpan and startSpan is called + }); + + it('returns promise if wrapped function returns promise', async () => { + const result = sugaredTracer.withActiveSpan('test', span => { + return Promise.resolve('result'); + }); + + assert.ok(typeof result.then == 'function'); + assert.strictEqual(await result, 'result', 'Unexpected result'); + }); + + it('returns void', () => { + const result = sugaredTracer.withActiveSpan('test', (span: Span) => { + return; + }); + + assert.strictEqual(result, undefined); + }); + }); + + describe('withSpan()', () => { + it('proxies value', () => { + const result = sugaredTracer.withSpan('test', span => { + return 'result'; + }); + + assert.strictEqual(result, 'result', 'Unexpected result'); + }); + + it('returns promise if wrapped function returns promise', async () => { + const result = sugaredTracer.withSpan('test', span => { + return Promise.resolve('result'); + }); + + assert.ok(typeof result.then == 'function'); + assert.strictEqual(await result, 'result', 'Unexpected result'); + }); + + it('returns void', () => { + const result = sugaredTracer.withSpan('test', (span: Span) => { + return; + }); + + assert.strictEqual(result, undefined); + }); + }); +}); diff --git a/doc/metrics.md b/doc/metrics.md index 3f48775e49f..1eb873a11d6 100644 --- a/doc/metrics.md +++ b/doc/metrics.md @@ -59,7 +59,7 @@ const { getNodeAutoInstrumentations, } = require("@opentelemetry/auto-instrumentations-node"); -const prometheusExporter = new PrometheusExporter({ startServer: true }); +const prometheusExporter = new PrometheusExporter(); const sdk = new opentelemetry.NodeSDK({ // Optional - If omitted, the metrics SDK will not be initialized @@ -147,7 +147,7 @@ const { getNodeAutoInstrumentations, } = require("@opentelemetry/auto-instrumentations-node"); -const prometheusExporter = new PrometheusExporter({ startServer: true }); +const prometheusExporter = new PrometheusExporter(); const sdk = new opentelemetry.NodeSDK({ // Optional - If omitted, the metrics SDK will not be initialized @@ -499,8 +499,8 @@ to use the Prometheus exporter `PrometheusExporter` which is included in the const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus'); const { MeterProvider } = require('@opentelemetry/sdk-metrics'); -// Add your port and startServer to the Prometheus options -const options = { port: 9464, startServer: true }; +// Add your port to the Prometheus options +const options = { port: 9464 }; const exporter = new PrometheusExporter(options); // Creates MeterProvider and installs the exporter as a MetricReader diff --git a/eslint.base.js b/eslint.base.js index 2ec8974641e..b17bebcd310 100644 --- a/eslint.base.js +++ b/eslint.base.js @@ -5,10 +5,10 @@ module.exports = { "node", "prettier" ], - extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"], + extends: ["eslint:recommended", "plugin:prettier/recommended"], parser: "@typescript-eslint/parser", parserOptions: { - "project": "./tsconfig.json" + "project": null, }, rules: { "quotes": ["error", "single", { "avoidEscape": true }], @@ -29,6 +29,11 @@ module.exports = { overrides: [ { files: ['*.ts'], + // Enable typescript-eslint for ts files. + extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"], + parserOptions: { + "project": "./tsconfig.json" + }, rules: { "@typescript-eslint/no-floating-promises": "error", "@typescript-eslint/no-this-alias": "off", @@ -50,13 +55,24 @@ module.exports = { } }], "@typescript-eslint/no-shadow": ["warn"], + "prefer-rest-params": "off", } }, { files: ["test/**/*.ts"], + // Enable typescript-eslint for ts files. + extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"], + parserOptions: { + "project": "./tsconfig.json" + }, rules: { "no-empty": "off", "@typescript-eslint/ban-ts-ignore": "off", + "@typescript-eslint/ban-types": ["warn", { + "types": { + "Function": null, + } + }], "@typescript-eslint/no-empty-function": "off", "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-unused-vars": "off", @@ -64,7 +80,8 @@ module.exports = { "@typescript-eslint/no-shadow": ["off"], "@typescript-eslint/no-floating-promises": ["off"], "@typescript-eslint/no-non-null-assertion": ["off"], - "@typescript-eslint/explicit-module-boundary-types": ["off"] + "@typescript-eslint/explicit-module-boundary-types": ["off"], + "prefer-rest-params": "off", } } ] diff --git a/examples/esm-http-ts/package.json b/examples/esm-http-ts/package.json index 89e57f12441..5200e5207b4 100644 --- a/examples/esm-http-ts/package.json +++ b/examples/esm-http-ts/package.json @@ -1,7 +1,7 @@ { "name": "esm-http-ts", "private": true, - "version": "0.47.0", + "version": "0.48.0", "description": "Example of HTTP integration with OpenTelemetry using ESM and TypeScript", "main": "build/index.js", "type": "module", @@ -31,12 +31,12 @@ "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/", "dependencies": { "@opentelemetry/api": "1.7.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.47.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/instrumentation-http": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/exporter-trace-otlp-proto": "0.48.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/instrumentation-http": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" } } diff --git a/examples/http/package.json b/examples/http/package.json index c5aae495566..8e269ba879c 100644 --- a/examples/http/package.json +++ b/examples/http/package.json @@ -1,7 +1,7 @@ { "name": "http-example", "private": true, - "version": "0.47.0", + "version": "0.48.0", "description": "Example of HTTP integration with OpenTelemetry", "main": "index.js", "scripts": { @@ -29,14 +29,14 @@ }, "dependencies": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/exporter-jaeger": "1.20.0", - "@opentelemetry/exporter-zipkin": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/instrumentation-http": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/exporter-jaeger": "1.21.0", + "@opentelemetry/exporter-zipkin": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/instrumentation-http": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/http", "devDependencies": { diff --git a/examples/https/package.json b/examples/https/package.json index 21f88d9e771..e47b2159c9b 100644 --- a/examples/https/package.json +++ b/examples/https/package.json @@ -1,7 +1,7 @@ { "name": "https-example", "private": true, - "version": "0.47.0", + "version": "0.48.0", "description": "Example of HTTPs integration with OpenTelemetry", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -33,14 +33,14 @@ }, "dependencies": { "@opentelemetry/api": "^1.0.0", - "@opentelemetry/exporter-jaeger": "1.20.0", - "@opentelemetry/exporter-zipkin": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/instrumentation-http": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/exporter-jaeger": "1.21.0", + "@opentelemetry/exporter-zipkin": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/instrumentation-http": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/https", "devDependencies": { diff --git a/examples/opentelemetry-web/package.json b/examples/opentelemetry-web/package.json index 78c1298f0e1..395c68e1e3e 100644 --- a/examples/opentelemetry-web/package.json +++ b/examples/opentelemetry-web/package.json @@ -1,7 +1,7 @@ { "name": "web-opentelemetry-example", "private": true, - "version": "0.47.0", + "version": "0.48.0", "description": "Example of using @opentelemetry/sdk-trace-web and @opentelemetry/sdk-metrics in browser", "main": "index.js", "scripts": { @@ -32,7 +32,8 @@ "url": "/~https://github.com/open-telemetry/opentelemetry-js/issues" }, "devDependencies": { - "@babel/core": "^7.6.0", + "@babel/core": "^7.23.6", + "@babel/preset-env": "^7.22.20", "babel-loader": "^8.0.6", "ts-loader": "^9.2.6", "typescript": "^4.5.2", @@ -43,20 +44,20 @@ }, "dependencies": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/context-zone": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.47.0", - "@opentelemetry/exporter-trace-otlp-http": "0.47.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.47.0", - "@opentelemetry/exporter-zipkin": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/instrumentation-fetch": "0.47.0", - "@opentelemetry/instrumentation-xml-http-request": "0.47.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-web": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/context-zone": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.48.0", + "@opentelemetry/exporter-trace-otlp-http": "0.48.0", + "@opentelemetry/exporter-trace-otlp-proto": "0.48.0", + "@opentelemetry/exporter-zipkin": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/instrumentation-fetch": "0.48.0", + "@opentelemetry/instrumentation-xml-http-request": "0.48.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-web": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/tracer-web" } diff --git a/examples/otlp-exporter-node/package.json b/examples/otlp-exporter-node/package.json index 1c54a7ee556..6b2580abed5 100644 --- a/examples/otlp-exporter-node/package.json +++ b/examples/otlp-exporter-node/package.json @@ -1,7 +1,7 @@ { "name": "example-otlp-exporter-node", "private": true, - "version": "0.47.0", + "version": "0.48.0", "description": "Example of using @opentelemetry/collector-exporter in Node.js", "main": "index.js", "scripts": { @@ -29,17 +29,17 @@ }, "dependencies": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-metrics-otlp-grpc": "0.47.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.47.0", - "@opentelemetry/exporter-metrics-otlp-proto": "0.47.0", - "@opentelemetry/exporter-trace-otlp-grpc": "0.47.0", - "@opentelemetry/exporter-trace-otlp-http": "0.47.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-metrics-otlp-grpc": "0.48.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.48.0", + "@opentelemetry/exporter-metrics-otlp-proto": "0.48.0", + "@opentelemetry/exporter-trace-otlp-grpc": "0.48.0", + "@opentelemetry/exporter-trace-otlp-http": "0.48.0", + "@opentelemetry/exporter-trace-otlp-proto": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/otlp-exporter-node" } diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 66d0c293328..fb790db505d 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -9,13 +9,40 @@ All notable changes to experimental packages in this project will be documented ### :rocket: (Enhancement) * feat(instrumentation): Make `init()` method public [#4418](/~https://github.com/open-telemetry/opentelemetry-js/pull/4418) +* feat(exporter-metrics-otlp-http): add option to set the exporter aggregation preference [#4409](/~https://github.com/open-telemetry/opentelemetry-js/pull/4409) @AkselAllas ### :bug: (Bug Fix) +* fix(sdk-node): allow using samplers when the exporter is defined in the environment [#4394](/~https://github.com/open-telemetry/opentelemetry-js/pull/4394) @JacksonWeber + ### :books: (Refine Doc) ### :house: (Internal) +* refactor(instrumentation-grpc): clean up remnants of 'grpc' package instrumentation [#4420](/~https://github.com/open-telemetry/opentelemetry-js/pull/4420) @pichlermarc + +## 0.48.0 + +### :boom: Breaking Change + +* fix(instrumentation)!: pin import-in-the-middle@1.7.1 [#4441](/~https://github.com/open-telemetry/opentelemetry-js/pull/4441) + * Fixes a bug where, in some circumstances, ESM instrumentation packages would try to instrument CJS exports on ESM, causing the end-user application to crash. + * This breaking change only affects users that are using the *experimental* `@opentelemetry/instrumentation/hook.mjs` loader hook AND Node.js 18.19 or later: + * This reverts back to an older version of `import-in-the-middle` due to + * This version does not support Node.js 18.19 or later + +### :bug: (Bug Fix) + +* fix(exporter-prometheus): avoid invoking callback synchronously [#4431](/~https://github.com/open-telemetry/opentelemetry-js/pull/4431) @legendecas +* fix(exporter-logs-otlp-grpc): set User-Agent header [#4398](/~https://github.com/open-telemetry/opentelemetry-js/pull/4398) @Vunovati +* fix(exporter-logs-otlp-http): set User-Agent header [#4398](/~https://github.com/open-telemetry/opentelemetry-js/pull/4398) @Vunovati +* fix(exporter-logs-otlp-proto): set User-Agent header [#4398](/~https://github.com/open-telemetry/opentelemetry-js/pull/4398) @Vunovati +* fix(instrumentation-fetch): compatibility with Map types for fetch headers + +### :house: (Internal) + +* refactor(exporter-prometheus): promisify prometheus tests [#4431](/~https://github.com/open-telemetry/opentelemetry-js/pull/4431) @legendecas + ## 0.47.0 ### :boom: Breaking Change diff --git a/experimental/backwards-compatibility/node14/package.json b/experimental/backwards-compatibility/node14/package.json index 8031e5ff53d..a9c5aeda53f 100644 --- a/experimental/backwards-compatibility/node14/package.json +++ b/experimental/backwards-compatibility/node14/package.json @@ -1,6 +1,6 @@ { "name": "backcompat-node14", - "version": "0.47.0", + "version": "0.48.0", "private": true, "description": "Backwards compatibility app for node 14 types and the OpenTelemetry Node.js SDK", "main": "index.js", @@ -9,8 +9,8 @@ "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "dependencies": { - "@opentelemetry/sdk-node": "0.47.0", - "@opentelemetry/sdk-trace-base": "1.20.0" + "@opentelemetry/sdk-node": "0.48.0", + "@opentelemetry/sdk-trace-base": "1.21.0" }, "devDependencies": { "@types/node": "14.18.25", diff --git a/experimental/backwards-compatibility/node16/package.json b/experimental/backwards-compatibility/node16/package.json index 2376e617e70..af35af7d6fe 100644 --- a/experimental/backwards-compatibility/node16/package.json +++ b/experimental/backwards-compatibility/node16/package.json @@ -1,6 +1,6 @@ { "name": "backcompat-node16", - "version": "0.47.0", + "version": "0.48.0", "private": true, "description": "Backwards compatibility app for node 16 types and the OpenTelemetry Node.js SDK", "main": "index.js", @@ -9,8 +9,8 @@ "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "dependencies": { - "@opentelemetry/sdk-node": "0.47.0", - "@opentelemetry/sdk-trace-base": "1.20.0" + "@opentelemetry/sdk-node": "0.48.0", + "@opentelemetry/sdk-trace-base": "1.21.0" }, "devDependencies": { "@types/node": "16.11.52", diff --git a/experimental/examples/logs/package.json b/experimental/examples/logs/package.json index d055611c95b..7fbb42d173b 100644 --- a/experimental/examples/logs/package.json +++ b/experimental/examples/logs/package.json @@ -1,14 +1,14 @@ { "name": "logs-example", - "version": "0.47.0", + "version": "0.48.0", "private": true, "scripts": { "start": "ts-node index.ts" }, "dependencies": { "@opentelemetry/api": "^1.7.0", - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/sdk-logs": "0.47.0" + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/sdk-logs": "0.48.0" }, "devDependencies": { "@types/node": "18.6.5", diff --git a/experimental/examples/opencensus-shim/package.json b/experimental/examples/opencensus-shim/package.json index db72e78c8b0..92990a8ce76 100644 --- a/experimental/examples/opencensus-shim/package.json +++ b/experimental/examples/opencensus-shim/package.json @@ -1,7 +1,7 @@ { "name": "opencensus-shim", "private": true, - "version": "0.47.0", + "version": "0.48.0", "description": "Example of using @opentelemetry/shim-opencensus in Node.js", "main": "index.js", "scripts": { @@ -31,13 +31,13 @@ "@opencensus/instrumentation-http": "0.1.0", "@opencensus/nodejs-base": "0.1.0", "@opentelemetry/api": "1.7.0", - "@opentelemetry/exporter-prometheus": "0.47.0", - "@opentelemetry/exporter-trace-otlp-grpc": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", - "@opentelemetry/shim-opencensus": "0.47.0" + "@opentelemetry/exporter-prometheus": "0.48.0", + "@opentelemetry/exporter-trace-otlp-grpc": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", + "@opentelemetry/shim-opencensus": "0.48.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/examples/opencensus-shim" } diff --git a/experimental/examples/prometheus/README.md b/experimental/examples/prometheus/README.md index 398427baecd..f82f2fc4843 100644 --- a/experimental/examples/prometheus/README.md +++ b/experimental/examples/prometheus/README.md @@ -60,6 +60,7 @@ If you are using the default configurations, the prometheus client will be avail

+

## Useful links diff --git a/experimental/examples/prometheus/images/prom-gauge.png b/experimental/examples/prometheus/images/prom-gauge.png new file mode 100644 index 00000000000..1f530a1c194 Binary files /dev/null and b/experimental/examples/prometheus/images/prom-gauge.png differ diff --git a/experimental/examples/prometheus/index.js b/experimental/examples/prometheus/index.js index cd267db0198..8f8dd96836d 100644 --- a/experimental/examples/prometheus/index.js +++ b/experimental/examples/prometheus/index.js @@ -39,6 +39,23 @@ observableCounter.addCallback(observableResult => { observableResult.observe(counter, attributes); }); +const randomMetricPromise = async () => + new Promise(resolve => + setTimeout(resolve(Math.floor(Math.random() * 100)), 50) + ); + +const observableGauge = meter.createObservableGauge( + 'observable_gauge_requests', + { + description: 'Example of an ObservableGauge', + } +); +// Callbacks are run when metrics are scraped +observableGauge.addCallback(async observableResult => { + const value = await randomMetricPromise(); + observableResult.observe(value, attributes); +}); + // Record metrics setInterval(() => { counter++; diff --git a/experimental/examples/prometheus/package.json b/experimental/examples/prometheus/package.json index a5272f684cf..c6f5c171ed9 100644 --- a/experimental/examples/prometheus/package.json +++ b/experimental/examples/prometheus/package.json @@ -1,6 +1,6 @@ { "name": "prometheus-example", - "version": "0.47.0", + "version": "0.48.0", "private": true, "description": "Example of using @opentelemetry/sdk-metrics and @opentelemetry/exporter-prometheus", "main": "index.js", @@ -11,7 +11,7 @@ "license": "Apache-2.0", "dependencies": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/exporter-prometheus": "0.47.0", - "@opentelemetry/sdk-metrics": "1.20.0" + "@opentelemetry/exporter-prometheus": "0.48.0", + "@opentelemetry/sdk-metrics": "1.21.0" } } diff --git a/experimental/packages/api-events/package.json b/experimental/packages/api-events/package.json index c819fd0a687..764ee61d57a 100644 --- a/experimental/packages/api-events/package.json +++ b/experimental/packages/api-events/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/api-events", - "version": "0.47.0", + "version": "0.48.0", "description": "Public events API for OpenTelemetry", "main": "build/src/index.js", "module": "build/esm/index.js", diff --git a/experimental/packages/api-logs/package.json b/experimental/packages/api-logs/package.json index fe07b755472..617d6774c83 100644 --- a/experimental/packages/api-logs/package.json +++ b/experimental/packages/api-logs/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/api-logs", - "version": "0.47.0", + "version": "0.48.0", "description": "Public logs API for OpenTelemetry", "main": "build/src/index.js", "module": "build/esm/index.js", diff --git a/experimental/packages/exporter-logs-otlp-grpc/package.json b/experimental/packages/exporter-logs-otlp-grpc/package.json index 1a08243ee18..aa548298f9e 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/package.json +++ b/experimental/packages/exporter-logs-otlp-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-logs-otlp-grpc", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry Collector Exporter allows user to send collected log records to the OpenTelemetry Collector", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -48,12 +48,11 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.23.6", "@grpc/proto-loader": "^0.7.10", "@opentelemetry/api": "1.7.0", - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/resources": "1.20.0", + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/resources": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -73,10 +72,10 @@ }, "dependencies": { "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/sdk-logs": "0.47.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/sdk-logs": "0.48.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-logs-otlp-grpc", "sideEffects": false diff --git a/experimental/packages/exporter-logs-otlp-grpc/src/OTLPLogExporter.ts b/experimental/packages/exporter-logs-otlp-grpc/src/OTLPLogExporter.ts index 675ce83db0a..19b747fca72 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/src/OTLPLogExporter.ts +++ b/experimental/packages/exporter-logs-otlp-grpc/src/OTLPLogExporter.ts @@ -28,6 +28,11 @@ import { createExportLogsServiceRequest, IExportLogsServiceRequest, } from '@opentelemetry/otlp-transformer'; +import { VERSION } from './version'; + +const USER_AGENT = { + 'User-Agent': `OTel-OTLP-Exporter-JavaScript/${VERSION}`, +}; /** * OTLP Logs Exporter for Node @@ -38,9 +43,12 @@ export class OTLPLogExporter { constructor(config: OTLPGRPCExporterConfigNode = {}) { super(config); - const headers = baggageUtils.parseKeyPairsIntoRecord( - getEnv().OTEL_EXPORTER_OTLP_LOGS_HEADERS - ); + const headers = { + ...USER_AGENT, + ...baggageUtils.parseKeyPairsIntoRecord( + getEnv().OTEL_EXPORTER_OTLP_LOGS_HEADERS + ), + }; this.metadata ||= new Metadata(); for (const [k, v] of Object.entries(headers)) { this.metadata.set(k, v); diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts b/experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts index 9bda910924c..bb57df4a4ea 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts +++ b/experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts @@ -37,6 +37,7 @@ import { IExportLogsServiceRequest, IResourceLogs, } from '@opentelemetry/otlp-transformer'; +import { VERSION } from '../src/version'; const logsServiceProtoPath = 'opentelemetry/proto/collector/logs/v1/logs_service.proto'; @@ -333,6 +334,12 @@ describe('when configuring via environment', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = ''; envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = ''; }); + it('should include user-agent header by default', () => { + const collectorExporter = new OTLPLogExporter(); + assert.deepStrictEqual(collectorExporter.metadata?.get('User-Agent'), [ + `OTel-OTLP-Exporter-JavaScript/${VERSION}`, + ]); + }); it('should use headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar'; const collectorExporter = new OTLPLogExporter(); diff --git a/experimental/packages/exporter-logs-otlp-http/package.json b/experimental/packages/exporter-logs-otlp-http/package.json index 508834942c0..a268a0f161d 100644 --- a/experimental/packages/exporter-logs-otlp-http/package.json +++ b/experimental/packages/exporter-logs-otlp-http/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-logs-otlp-http", - "version": "0.47.0", + "version": "0.48.0", "publishConfig": { "access": "public" }, @@ -72,8 +72,9 @@ "sideEffects": false, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/resources": "1.20.0", + "@opentelemetry/resources": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -104,10 +105,10 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/sdk-logs": "0.47.0" + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/sdk-logs": "0.48.0" } } diff --git a/experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts b/experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts index 56e4bad3d69..9181b082cf9 100644 --- a/experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts +++ b/experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts @@ -25,6 +25,11 @@ import { OTLPExporterNodeBase } from '@opentelemetry/otlp-exporter-base'; import { createExportLogsServiceRequest } from '@opentelemetry/otlp-transformer'; import { getDefaultUrl } from '../config'; +import { VERSION } from '../../version'; + +const USER_AGENT = { + 'User-Agent': `OTel-OTLP-Exporter-JavaScript/${VERSION}`, +}; /** * Collector Logs Exporter for Node @@ -39,13 +44,14 @@ export class OTLPLogExporter timeoutMillis: getEnv().OTEL_EXPORTER_OTLP_LOGS_TIMEOUT, ...config, }); - this.headers = Object.assign( - this.headers, - baggageUtils.parseKeyPairsIntoRecord( + this.headers = { + ...this.headers, + ...USER_AGENT, + ...baggageUtils.parseKeyPairsIntoRecord( getEnv().OTEL_EXPORTER_OTLP_LOGS_HEADERS ), - config.headers - ); + ...config.headers, + }; } convert(logRecords: ReadableLogRecord[]): IExportLogsServiceRequest { diff --git a/experimental/packages/exporter-logs-otlp-http/test/node/OTLPLogExporter.test.ts b/experimental/packages/exporter-logs-otlp-http/test/node/OTLPLogExporter.test.ts index 83b389628a4..5920657b5b6 100644 --- a/experimental/packages/exporter-logs-otlp-http/test/node/OTLPLogExporter.test.ts +++ b/experimental/packages/exporter-logs-otlp-http/test/node/OTLPLogExporter.test.ts @@ -31,6 +31,7 @@ import { import { PassThrough, Stream } from 'stream'; import { IExportLogsServiceRequest } from '@opentelemetry/otlp-transformer'; import { ExportResultCode } from '@opentelemetry/core'; +import { VERSION } from '../../src/version'; let fakeRequest: PassThrough; @@ -79,6 +80,14 @@ describe('OTLPLogExporter', () => { assert.ok(exporter instanceof OTLPLogExporter); }); + it('should include user-agent header by default', () => { + const exporter = new OTLPLogExporter(); + assert.strictEqual( + exporter.headers['User-Agent'], + `OTel-OTLP-Exporter-JavaScript/${VERSION}` + ); + }); + it('should use headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_LOGS_HEADERS = 'foo=bar'; const exporter = new OTLPLogExporter(); diff --git a/experimental/packages/exporter-logs-otlp-proto/package.json b/experimental/packages/exporter-logs-otlp-proto/package.json index b054acc8125..361a6ac3fc5 100644 --- a/experimental/packages/exporter-logs-otlp-proto/package.json +++ b/experimental/packages/exporter-logs-otlp-proto/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-logs-otlp-proto", - "version": "0.47.0", + "version": "0.48.0", "description": "An OTLP exporter to send logs using protobuf over HTTP", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -64,6 +64,7 @@ }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -93,14 +94,14 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-proto-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-logs": "0.47.0", - "@opentelemetry/sdk-trace-base": "1.20.0" + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-proto-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-logs": "0.48.0", + "@opentelemetry/sdk-trace-base": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-logs-otlp-proto", "sideEffects": false diff --git a/experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts b/experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts index a8cdfc4c969..caec7352fff 100644 --- a/experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts +++ b/experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts @@ -30,6 +30,11 @@ import { } from '@opentelemetry/otlp-transformer'; import { ReadableLogRecord, LogRecordExporter } from '@opentelemetry/sdk-logs'; +import { VERSION } from '../../version'; + +const USER_AGENT = { + 'User-Agent': `OTel-OTLP-Exporter-JavaScript/${VERSION}`, +}; const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/logs'; const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`; @@ -46,13 +51,14 @@ export class OTLPLogExporter { constructor(config: OTLPExporterConfigBase = {}) { super(config); - this.headers = Object.assign( - this.headers, - baggageUtils.parseKeyPairsIntoRecord( + this.headers = { + ...this.headers, + ...USER_AGENT, + ...baggageUtils.parseKeyPairsIntoRecord( getEnv().OTEL_EXPORTER_OTLP_LOGS_HEADERS ), - config.headers - ); + ...config.headers, + }; } convert(logs: ReadableLogRecord[]): IExportLogsServiceRequest { return createExportLogsServiceRequest(logs); diff --git a/experimental/packages/exporter-logs-otlp-proto/test/node/OTLPLogExporter.test.ts b/experimental/packages/exporter-logs-otlp-proto/test/node/OTLPLogExporter.test.ts index ab918c992b6..9778c950464 100644 --- a/experimental/packages/exporter-logs-otlp-proto/test/node/OTLPLogExporter.test.ts +++ b/experimental/packages/exporter-logs-otlp-proto/test/node/OTLPLogExporter.test.ts @@ -39,6 +39,7 @@ import { } from '@opentelemetry/otlp-proto-exporter-base'; import { IExportLogsServiceRequest } from '@opentelemetry/otlp-transformer'; import { ReadableLogRecord } from '@opentelemetry/sdk-logs'; +import { VERSION } from '../../src/version'; let fakeRequest: PassThrough; @@ -137,6 +138,13 @@ describe('OTLPLogExporter - node with proto over http', () => { ); envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = ''; }); + it('should include user-agent header by default', () => { + const exporter = new OTLPLogExporter(); + assert.strictEqual( + exporter.headers['User-Agent'], + `OTel-OTLP-Exporter-JavaScript/${VERSION}` + ); + }); it('should use headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_LOGS_HEADERS = 'foo=bar'; const collectorExporter = new OTLPLogExporter(); diff --git a/experimental/packages/exporter-trace-otlp-grpc/package.json b/experimental/packages/exporter-trace-otlp-grpc/package.json index c64bc5f2044..1f6deb40815 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/package.json +++ b/experimental/packages/exporter-trace-otlp-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-trace-otlp-grpc", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -47,10 +47,9 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.23.6", "@grpc/proto-loader": "^0.7.10", "@opentelemetry/api": "1.7.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -70,11 +69,11 @@ }, "dependencies": { "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-trace-otlp-grpc", "sideEffects": false diff --git a/experimental/packages/exporter-trace-otlp-http/package.json b/experimental/packages/exporter-trace-otlp-http/package.json index 92037029cd2..a06869791a8 100644 --- a/experimental/packages/exporter-trace-otlp-http/package.json +++ b/experimental/packages/exporter-trace-otlp-http/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-trace-otlp-http", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry Collector Trace Exporter allows user to send collected traces to the OpenTelemetry Collector", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -64,6 +64,7 @@ }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -95,11 +96,11 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-trace-otlp-http", "sideEffects": false diff --git a/experimental/packages/exporter-trace-otlp-proto/package.json b/experimental/packages/exporter-trace-otlp-proto/package.json index edc20e95afa..dff818873e3 100644 --- a/experimental/packages/exporter-trace-otlp-proto/package.json +++ b/experimental/packages/exporter-trace-otlp-proto/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-trace-otlp-proto", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector using protobuf over HTTP", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -63,6 +63,7 @@ }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -92,12 +93,12 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-proto-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-proto-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-trace-otlp-proto", "sideEffects": false diff --git a/experimental/packages/opentelemetry-browser-detector/package.json b/experimental/packages/opentelemetry-browser-detector/package.json index 7a49fb111c8..993653992ca 100644 --- a/experimental/packages/opentelemetry-browser-detector/package.json +++ b/experimental/packages/opentelemetry-browser-detector/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/opentelemetry-browser-detector", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry Resource Detector for Browser", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -54,6 +54,7 @@ }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -82,8 +83,8 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/browser-detector" } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json index 0f2b35612b2..0536164f731 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-metrics-otlp-grpc", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -47,7 +47,6 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.23.6", "@grpc/proto-loader": "^0.7.10", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", @@ -69,12 +68,12 @@ }, "dependencies": { "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.47.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.48.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc", "sideEffects": false diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/metricsHelper.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/metricsHelper.ts index 14c8f3a3df5..7c9fbfd99c0 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/metricsHelper.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/metricsHelper.ts @@ -55,10 +55,11 @@ const testResource = new Resource({ cost: 112.12, }); -let meterProvider = new MeterProvider({ resource: testResource }); - let reader = new TestMetricReader(); -meterProvider.addMetricReader(reader); +let meterProvider = new MeterProvider({ + resource: testResource, + readers: [reader], +}); let meter = meterProvider.getMeter('default', '0.0.1'); @@ -67,6 +68,7 @@ export async function collect() { } export function setUp() { + reader = new TestMetricReader(); meterProvider = new MeterProvider({ resource: testResource, views: [ @@ -75,9 +77,8 @@ export function setUp() { instrumentName: 'int-histogram', }), ], + readers: [reader], }); - reader = new TestMetricReader(); - meterProvider.addMetricReader(reader); meter = meterProvider.getMeter('default', '0.0.1'); } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json index 0713b2094eb..f984373a276 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-metrics-otlp-http", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -64,6 +64,7 @@ }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -95,11 +96,11 @@ "@opentelemetry/api": "^1.3.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-http", "sideEffects": false diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts index db8a4a32ed1..66a5bfb5963 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts @@ -21,6 +21,8 @@ import { InstrumentType, PushMetricExporter, ResourceMetrics, + Aggregation, + AggregationSelector, } from '@opentelemetry/sdk-metrics'; import { AggregationTemporalityPreference, @@ -104,6 +106,16 @@ function chooseTemporalitySelector( return chooseTemporalitySelectorFromEnvironment(); } +function chooseAggregationSelector( + config: OTLPMetricExporterOptions | undefined +) { + if (config?.aggregationPreference) { + return config.aggregationPreference; + } else { + return (_instrumentType: any) => Aggregation.Default(); + } +} + export class OTLPMetricExporterBase< T extends OTLPExporterBase< OTLPMetricExporterOptions, @@ -114,9 +126,11 @@ export class OTLPMetricExporterBase< { public _otlpExporter: T; private _aggregationTemporalitySelector: AggregationTemporalitySelector; + private _aggregationSelector: AggregationSelector; constructor(exporter: T, config?: OTLPMetricExporterOptions) { this._otlpExporter = exporter; + this._aggregationSelector = chooseAggregationSelector(config); this._aggregationTemporalitySelector = chooseTemporalitySelector( config?.temporalityPreference ); @@ -137,6 +151,10 @@ export class OTLPMetricExporterBase< return Promise.resolve(); } + selectAggregation(instrumentType: InstrumentType): Aggregation { + return this._aggregationSelector(instrumentType); + } + selectAggregationTemporality( instrumentType: InstrumentType ): AggregationTemporality { diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterOptions.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterOptions.ts index e03bde4e75e..ff805e3b179 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterOptions.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterOptions.ts @@ -15,12 +15,16 @@ */ import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; -import { AggregationTemporality } from '@opentelemetry/sdk-metrics'; +import { + AggregationTemporality, + AggregationSelector, +} from '@opentelemetry/sdk-metrics'; export interface OTLPMetricExporterOptions extends OTLPExporterConfigBase { temporalityPreference?: | AggregationTemporalityPreference | AggregationTemporality; + aggregationPreference?: AggregationSelector; } export enum AggregationTemporalityPreference { diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/metricsHelper.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/metricsHelper.ts index 5605a69b280..850cdae4d0f 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/metricsHelper.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/metricsHelper.ts @@ -72,9 +72,11 @@ const defaultResource = Resource.default().merge( }) ); -let meterProvider = new MeterProvider({ resource: defaultResource }); let reader = new TestMetricReader(); -meterProvider.addMetricReader(reader); +let meterProvider = new MeterProvider({ + resource: defaultResource, + readers: [reader], +}); let meter = meterProvider.getMeter('default', '0.0.1'); export async function collect() { @@ -82,9 +84,12 @@ export async function collect() { } export function setUp(views?: View[]) { - meterProvider = new MeterProvider({ resource: defaultResource, views }); reader = new TestMetricReader(); - meterProvider.addMetricReader(reader); + meterProvider = new MeterProvider({ + resource: defaultResource, + views, + readers: [reader], + }); meter = meterProvider.getMeter('default', '0.0.1'); } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts index 66f6af3006e..b72ed5f8cb8 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts @@ -43,7 +43,9 @@ import { } from '../metricsHelper'; import { MockedResponse } from './nodeHelpers'; import { + Aggregation, AggregationTemporality, + ExplicitBucketHistogramAggregation, InstrumentType, ResourceMetrics, } from '@opentelemetry/sdk-metrics'; @@ -218,6 +220,31 @@ describe('OTLPMetricExporter - node with json over http', () => { }); }); + describe('aggregation', () => { + it('aggregationSelector calls the selector supplied to the constructor', () => { + const aggregation = new ExplicitBucketHistogramAggregation([ + 0, 100, 100000, + ]); + const exporter = new OTLPMetricExporter({ + aggregationPreference: _instrumentType => aggregation, + }); + assert.equal( + exporter.selectAggregation(InstrumentType.COUNTER), + aggregation + ); + }); + + it('aggregationSelector returns the default aggregation preference when nothing is supplied', () => { + const exporter = new OTLPMetricExporter({ + aggregationPreference: _instrumentType => Aggregation.Default(), + }); + assert.equal( + exporter.selectAggregation(InstrumentType.COUNTER), + Aggregation.Default() + ); + }); + }); + describe('when configuring via environment', () => { const envSource = process.env; it('should use url defined in env that ends with root path and append version and signal path', () => { diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json index 7d406b4c44f..c28adedf61e 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-metrics-otlp-proto", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector using protobuf over HTTP", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -55,7 +55,6 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.23.6", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -75,13 +74,13 @@ "@opentelemetry/api": "^1.3.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.47.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-proto-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.48.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-proto-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-proto", "sideEffects": false diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/metricsHelper.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/metricsHelper.ts index 5c9c29abeee..ef70a75c054 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/metricsHelper.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/metricsHelper.ts @@ -54,10 +54,11 @@ const testResource = new Resource({ cost: 112.12, }); -let meterProvider = new MeterProvider({ resource: testResource }); - let reader = new TestMetricReader(); -meterProvider.addMetricReader(reader); +let meterProvider = new MeterProvider({ + resource: testResource, + readers: [reader], +}); let meter = meterProvider.getMeter('default', '0.0.1'); @@ -66,6 +67,7 @@ export async function collect() { } export function setUp() { + reader = new TestMetricReader(); meterProvider = new MeterProvider({ resource: testResource, views: [ @@ -74,9 +76,8 @@ export function setUp() { instrumentName: 'int-histogram', }), ], + readers: [reader], }); - reader = new TestMetricReader(); - meterProvider.addMetricReader(reader); meter = meterProvider.getMeter('default', '0.0.1'); } diff --git a/experimental/packages/opentelemetry-exporter-prometheus/package.json b/experimental/packages/opentelemetry-exporter-prometheus/package.json index f4477c826c3..be424e06d6f 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/package.json +++ b/experimental/packages/opentelemetry-exporter-prometheus/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-prometheus", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry Exporter Prometheus provides a metrics endpoint for Prometheus", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -44,7 +44,7 @@ }, "devDependencies": { "@opentelemetry/api": "1.7.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -61,9 +61,9 @@ "@opentelemetry/api": "^1.3.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-prometheus", "sideEffects": false diff --git a/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusExporter.ts b/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusExporter.ts index 42e4fc41e88..bd763de3f0c 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusExporter.ts +++ b/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusExporter.ts @@ -44,6 +44,7 @@ export class PrometheusExporter extends MetricReader { private readonly _prefix?: string; private readonly _appendTimestamp: boolean; private _serializer: PrometheusSerializer; + private _startServerPromise: Promise | undefined; // This will be required when histogram is implemented. Leaving here so it is not forgotten // Histogram cannot have a attribute named 'le' @@ -95,7 +96,8 @@ export class PrometheusExporter extends MetricReader { callback(err); }); } else if (callback) { - callback(); + // Do not invoke callback immediately to avoid zalgo problem. + queueMicrotask(callback); } } @@ -142,7 +144,7 @@ export class PrometheusExporter extends MetricReader { * Starts the Prometheus export server */ startServer(): Promise { - return new Promise((resolve, reject) => { + this._startServerPromise ??= new Promise((resolve, reject) => { this._server.once('error', reject); this._server.listen( { @@ -157,6 +159,8 @@ export class PrometheusExporter extends MetricReader { } ); }); + + return this._startServerPromise; } /** diff --git a/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusExporter.test.ts b/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusExporter.test.ts index 1030203a2ce..66bab19ef8f 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusExporter.test.ts @@ -53,46 +53,37 @@ describe('PrometheusExporter', () => { }); describe('constructor', () => { - it('should construct an exporter', done => { + it('should construct an exporter', async () => { const exporter = new PrometheusExporter(); assert.ok(typeof exporter.startServer === 'function'); assert.ok(typeof exporter.shutdown === 'function'); - exporter.shutdown().then(done); + await exporter.shutdown(); }); - it('should start the server by default and call the callback', done => { + it('should start the server by default and call the callback', async () => { const port = PrometheusExporter.DEFAULT_OPTIONS.port; const endpoint = PrometheusExporter.DEFAULT_OPTIONS.endpoint; - const exporter = new PrometheusExporter({}, () => { - const url = `http://localhost:${port}${endpoint}`; - http.get(url, (res: any) => { - assert.strictEqual(res.statusCode, 200); - exporter.shutdown().then(() => { - return done(); - }); - }); - }); + const exporter = new PrometheusExporter(); + await exporter.startServer(); + const url = `http://localhost:${port}${endpoint}`; + await request(url); + await exporter.shutdown(); }); - it('should pass server error to callback when port is already in use', done => { - const firstExporter = new PrometheusExporter({}, error => { - if (error) { - // This should not happen as the port should not be already in use when the test starts. - done(error); - } - }); - const secondExporter = new PrometheusExporter({}, error => { - firstExporter - .shutdown() - .then(() => secondExporter.shutdown()) - .then(() => - done( - error - ? undefined - : 'Second exporter should respond with EADDRINUSE but did not pass it to callback' - ) - ); - }); + it('should pass server error to callback when port is already in use', async () => { + const firstExporter = new PrometheusExporter(); + await firstExporter.startServer(); + + const secondExporter = new PrometheusExporter(); + await assert.rejects( + secondExporter.startServer(), + { code: 'EADDRINUSE' }, + 'Second exporter should respond with EADDRINUSE but did not pass it to callback' + ); + + await Promise.all( + [firstExporter, secondExporter].map(it => it.shutdown()) + ); }); it('should not start the server if preventServerStart is passed as an option', () => { @@ -102,51 +93,35 @@ describe('PrometheusExporter', () => { }); describe('server', () => { - it('should start on startServer() and call the callback', done => { + it('should start on startServer() and call the callback', async () => { const exporter = new PrometheusExporter({ port: 9722, preventServerStart: true, }); - exporter.startServer().then(() => { - exporter.shutdown().then(() => { - return done(); - }); - }); + await exporter.startServer(); + await exporter.shutdown(); }); - it('should listen on the default port and default endpoint', done => { + it('should listen on the default port and default endpoint', async () => { const port = PrometheusExporter.DEFAULT_OPTIONS.port; const endpoint = PrometheusExporter.DEFAULT_OPTIONS.endpoint; - const exporter = new PrometheusExporter({}, () => { - const url = `http://localhost:${port}${endpoint}`; - http.get(url, (res: any) => { - assert.strictEqual(res.statusCode, 200); - exporter.shutdown().then(() => { - return done(); - }); - }); - }); + const exporter = new PrometheusExporter(); + const url = `http://localhost:${port}${endpoint}`; + await request(url); + await exporter.shutdown(); }); - it('should listen on a custom port and endpoint if provided', done => { + it('should listen on a custom port and endpoint if provided', async () => { const port = 9991; const endpoint = '/metric'; - const exporter = new PrometheusExporter( - { - port, - endpoint, - }, - () => { - const url = `http://localhost:${port}${endpoint}`; - http.get(url, (res: any) => { - assert.strictEqual(res.statusCode, 200); - exporter.shutdown().then(() => { - return done(); - }); - }); - } - ); + const exporter = new PrometheusExporter({ + port, + endpoint, + }); + const url = `http://localhost:${port}${endpoint}`; + await request(url); + await exporter.shutdown(); }); it('should unref the server to allow graceful termination', () => { @@ -169,67 +144,36 @@ describe('PrometheusExporter', () => { assert.strictEqual(exporter['_port'], 1234); }); - it('should not require endpoints to start with a slash', done => { + it('should not require endpoints to start with a slash', async () => { const port = 9991; const endpoint = 'metric'; + const url = `http://localhost:${port}/metric`; - const exporter = new PrometheusExporter( - { - port, - endpoint, - }, - () => { - const url = `http://localhost:${port}/metric`; - http.get(url, (res: any) => { - assert.strictEqual(res.statusCode, 200); - exporter.shutdown().then(() => { - const exporter2 = new PrometheusExporter( - { - port, - endpoint: `/${endpoint}`, - }, - () => { - const url = `http://localhost:${port}/metric`; - http.get(url, (res: any) => { - assert.strictEqual(res.statusCode, 200); - exporter2.stopServer().then(() => { - return done(); - }); - }); - } - ); - }); - }); - } - ); + const exporter = new PrometheusExporter({ + port, + endpoint, + }); + await exporter.startServer(); + await request(url); + await exporter.stopServer(); }); - it('should return a HTTP status 404 if the endpoint does not match', done => { + it('should return a HTTP status 404 if the endpoint does not match', async () => { const port = 9912; const endpoint = '/metrics'; - const exporter = new PrometheusExporter( - { - port, - endpoint, - }, - () => { - const url = `http://localhost:${port}/invalid`; - - http.get(url, (res: any) => { - assert.strictEqual(res.statusCode, 404); - exporter.shutdown().then(() => { - return done(); - }); - }); - } - ); + const exporter = new PrometheusExporter({ + port, + endpoint, + }); + const url = `http://localhost:${port}/invalid`; + + await assert.rejects(request(url), { statusCode: 404 }); + await exporter.shutdown(); }); - it('should call a provided callback on shutdown regardless of if the server is running', done => { + it('should call a provided callback on shutdown regardless of if the server is running', async () => { const exporter = new PrometheusExporter({ preventServerStart: true }); - exporter.shutdown().then(() => { - return done(); - }); + await exporter.shutdown(); }); it('should able to call getMetricsRequestHandler function to generate response with metrics', async () => { @@ -259,17 +203,17 @@ describe('PrometheusExporter', () => { let meterProvider: MeterProvider; let meter: Meter; - beforeEach(done => { - exporter = new PrometheusExporter({}, () => { - meterProvider = new MeterProvider(); - meterProvider.addMetricReader(exporter); - meter = meterProvider.getMeter('test-prometheus', '1'); - done(); + beforeEach(async () => { + exporter = new PrometheusExporter(); + meterProvider = new MeterProvider({ + readers: [exporter], }); + meter = meterProvider.getMeter('test-prometheus', '1'); + await exporter.startServer(); }); - afterEach(done => { - exporter.shutdown().then(done); + afterEach(async () => { + await exporter.shutdown(); }); it('should export a count aggregation', async () => { @@ -346,7 +290,7 @@ describe('PrometheusExporter', () => { ]); }); - it('should export multiple attributes on manual shutdown', done => { + it('should export multiple attributes on manual shutdown', async () => { const counter = meter.createCounter('counter_total', { description: 'a test description', }); @@ -354,16 +298,10 @@ describe('PrometheusExporter', () => { counter.add(10, { counterKey1: 'attributeValue1' }); counter.add(20, { counterKey1: 'attributeValue2' }); counter.add(30, { counterKey1: 'attributeValue3' }); - meterProvider.shutdown().then(() => { - // exporter has been shut down along with meter provider. - http - .get('http://localhost:9464/metrics', res => { - errorHandler(done)(new Error('unreachable')); - }) - .on('error', (err: any) => { - assert.equal(err.code, 'ECONNREFUSED'); - done(); - }); + await meterProvider.shutdown(); + // exporter has been shut down along with meter provider. + await assert.rejects(request('http://localhost:9464/metrics'), { + code: 'ECONNREFUSED', }); }); @@ -533,8 +471,9 @@ describe('PrometheusExporter', () => { let exporter: PrometheusExporter; function setup(reader: PrometheusExporter) { - meterProvider = new MeterProvider(); - meterProvider.addMetricReader(reader); + meterProvider = new MeterProvider({ + readers: [exporter], + }); meter = meterProvider.getMeter('test-prometheus'); counter = meter.createCounter('counter'); @@ -545,124 +484,84 @@ describe('PrometheusExporter', () => { await exporter.shutdown(); }); - it('should use a configured name prefix', done => { - exporter = new PrometheusExporter( - { - prefix: 'test_prefix', - }, - async () => { - setup(exporter); - http - .get('http://localhost:9464/metrics', res => { - res.on('data', chunk => { - const body = chunk.toString(); - const lines = body.split('\n'); - - assert.deepStrictEqual(lines, [ - ...serializedDefaultResourceLines, - '# HELP test_prefix_counter_total description missing', - '# TYPE test_prefix_counter_total counter', - 'test_prefix_counter_total{key1="attributeValue1"} 10', - '', - ]); - - done(); - }); - }) - .on('error', errorHandler(done)); - } - ); + it('should use a configured name prefix', async () => { + exporter = new PrometheusExporter({ + prefix: 'test_prefix', + }); + setup(exporter); + const body = await request('http://localhost:9464/metrics'); + const lines = body.split('\n'); + + assert.deepStrictEqual(lines, [ + ...serializedDefaultResourceLines, + '# HELP test_prefix_counter_total description missing', + '# TYPE test_prefix_counter_total counter', + 'test_prefix_counter_total{key1="attributeValue1"} 10', + '', + ]); }); - it('should use a configured port', done => { - exporter = new PrometheusExporter( - { - port: 8080, - }, - async () => { - setup(exporter); - http - .get('http://localhost:8080/metrics', res => { - res.on('data', chunk => { - const body = chunk.toString(); - const lines = body.split('\n'); - - assert.deepStrictEqual(lines, [ - ...serializedDefaultResourceLines, - '# HELP counter_total description missing', - '# TYPE counter_total counter', - 'counter_total{key1="attributeValue1"} 10', - '', - ]); - - done(); - }); - }) - .on('error', errorHandler(done)); - } - ); + it('should use a configured port', async () => { + exporter = new PrometheusExporter({ + port: 8080, + }); + + setup(exporter); + const body = await request('http://localhost:8080/metrics'); + const lines = body.split('\n'); + + assert.deepStrictEqual(lines, [ + ...serializedDefaultResourceLines, + '# HELP counter_total description missing', + '# TYPE counter_total counter', + 'counter_total{key1="attributeValue1"} 10', + '', + ]); }); - it('should use a configured endpoint', done => { - exporter = new PrometheusExporter( - { - endpoint: '/test', - }, - async () => { - setup(exporter); - http - .get('http://localhost:9464/test', res => { - res.on('data', chunk => { - const body = chunk.toString(); - const lines = body.split('\n'); - - assert.deepStrictEqual(lines, [ - ...serializedDefaultResourceLines, - '# HELP counter_total description missing', - '# TYPE counter_total counter', - 'counter_total{key1="attributeValue1"} 10', - '', - ]); - - done(); - }); - }) - .on('error', errorHandler(done)); - } - ); + it('should use a configured endpoint', async () => { + exporter = new PrometheusExporter({ + endpoint: '/test', + }); + + setup(exporter); + const body = await request('http://localhost:9464/test'); + const lines = body.split('\n'); + + assert.deepStrictEqual(lines, [ + ...serializedDefaultResourceLines, + '# HELP counter_total description missing', + '# TYPE counter_total counter', + 'counter_total{key1="attributeValue1"} 10', + '', + ]); }); - it('should export a metric with timestamp', done => { - exporter = new PrometheusExporter( - { - appendTimestamp: true, - }, - async () => { - setup(exporter); - http - .get('http://localhost:9464/metrics', res => { - res.on('data', chunk => { - const body = chunk.toString(); - const lines = body.split('\n'); - - assert.deepStrictEqual(lines, [ - ...serializedDefaultResourceLines, - '# HELP counter_total description missing', - '# TYPE counter_total counter', - `counter_total{key1="attributeValue1"} 10 ${mockedHrTimeMs}`, - '', - ]); - - done(); - }); - }) - .on('error', errorHandler(done)); - } - ); + it('should export a metric with timestamp', async () => { + exporter = new PrometheusExporter({ + appendTimestamp: true, + }); + setup(exporter); + const body = await request('http://localhost:9464/metrics'); + const lines = body.split('\n'); + + assert.deepStrictEqual(lines, [ + ...serializedDefaultResourceLines, + '# HELP counter_total description missing', + '# TYPE counter_total counter', + `counter_total{key1="attributeValue1"} 10 ${mockedHrTimeMs}`, + '', + ]); }); }); }); +class RequestStatusError extends Error { + constructor(public statusCode: number | undefined) { + super('request failed with non-200 code'); + } +} + function request(url: string): Promise { return new Promise((resolve, reject) => { http @@ -675,7 +574,7 @@ function request(url: string): Promise { }); res.on('end', () => { if (res.statusCode !== 200) { - reject(new Error('request failed with non-200 code')); + reject(new RequestStatusError(res.statusCode)); return; } resolve(result); @@ -684,7 +583,3 @@ function request(url: string): Promise { .on('error', reject); }); } - -function errorHandler(done: Mocha.Done): (err: Error) => void { - return err => done(err); -} diff --git a/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts b/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts index 1a39aae0039..b2d9e36f8f9 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts +++ b/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts @@ -91,8 +91,8 @@ describe('PrometheusSerializer', () => { instrumentName: '*', }), ], + readers: [reader], }); - meterProvider.addMetricReader(reader); const meter = meterProvider.getMeter('test'); const counter = meter.createCounter('test_total'); @@ -141,8 +141,8 @@ describe('PrometheusSerializer', () => { instrumentName: '*', }), ], + readers: [reader], }); - meterProvider.addMetricReader(reader); const meter = meterProvider.getMeter('test'); const histogram = meter.createHistogram('test'); @@ -206,8 +206,8 @@ describe('PrometheusSerializer', () => { instrumentName: '*', }), ], + readers: [reader], }); - meterProvider.addMetricReader(reader); const meter = meterProvider.getMeter('test'); const counter = meter.createCounter('test_total', { @@ -261,8 +261,8 @@ describe('PrometheusSerializer', () => { instrumentName: '*', }), ], + readers: [reader], }); - meterProvider.addMetricReader(reader); const meter = meterProvider.getMeter('test'); const counter = meter.createUpDownCounter('test_total', { @@ -315,8 +315,8 @@ describe('PrometheusSerializer', () => { instrumentName: '*', }), ], + readers: [reader], }); - meterProvider.addMetricReader(reader); const meter = meterProvider.getMeter('test'); const counter = meter.createUpDownCounter('test_total', { @@ -369,8 +369,8 @@ describe('PrometheusSerializer', () => { instrumentName: '*', }), ], + readers: [reader], }); - meterProvider.addMetricReader(reader); const meter = meterProvider.getMeter('test'); const histogram = meter.createHistogram('test', { @@ -424,8 +424,8 @@ describe('PrometheusSerializer', () => { instrumentName: '*', }), ], + readers: [reader], }); - meterProvider.addMetricReader(reader); const meter = meterProvider.getMeter('test'); const upDownCounter = meter.createUpDownCounter('test', { @@ -474,8 +474,8 @@ describe('PrometheusSerializer', () => { views: [ new View({ aggregation: new SumAggregation(), instrumentName: '*' }), ], + readers: [reader], }); - meterProvider.addMetricReader(reader); const meter = meterProvider.getMeter('test'); const { unit, exportAll = false } = options; @@ -563,8 +563,8 @@ describe('PrometheusSerializer', () => { views: [ new View({ aggregation: new SumAggregation(), instrumentName: '*' }), ], + readers: [reader], }); - meterProvider.addMetricReader(reader); const meter = meterProvider.getMeter('test'); const counter = meter.createUpDownCounter(name); diff --git a/experimental/packages/opentelemetry-instrumentation-fetch/package.json b/experimental/packages/opentelemetry-instrumentation-fetch/package.json index 4c5a2f2820a..f3fb9b1bb1f 100644 --- a/experimental/packages/opentelemetry-instrumentation-fetch/package.json +++ b/experimental/packages/opentelemetry-instrumentation-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-fetch", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry fetch automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -55,10 +55,11 @@ }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-zone": "1.20.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/context-zone": "1.21.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -88,10 +89,10 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/sdk-trace-web": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/sdk-trace-web": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-fetch", "sideEffects": false diff --git a/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts b/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts index 90213a8c691..7960b38535c 100644 --- a/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts +++ b/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts @@ -168,6 +168,10 @@ export class FetchInstrumentation extends InstrumentationBase< api.propagation.inject(api.context.active(), options.headers, { set: (h, k, v) => h.set(k, typeof v === 'string' ? v : String(v)), }); + } else if (options.headers instanceof Map) { + api.propagation.inject(api.context.active(), options.headers, { + set: (h, k, v) => h.set(k, typeof v === 'string' ? v : String(v)), + }); } else { const headers: Partial> = {}; api.propagation.inject(api.context.active(), headers); diff --git a/experimental/packages/opentelemetry-instrumentation-fetch/test/fetch.test.ts b/experimental/packages/opentelemetry-instrumentation-fetch/test/fetch.test.ts index 14dcec9978f..832b2d89990 100644 --- a/experimental/packages/opentelemetry-instrumentation-fetch/test/fetch.test.ts +++ b/experimental/packages/opentelemetry-instrumentation-fetch/test/fetch.test.ts @@ -503,7 +503,7 @@ describe('fetch', () => { assert.ok(r.headers.get('foo') === 'bar'); }); - it('should keep custom headers with url, untyped request object and typed headers object', () => { + it('should keep custom headers with url, untyped request object and typed (Headers) headers object', () => { const url = 'url'; const init = { headers: new Headers({ foo: 'bar' }), @@ -521,6 +521,17 @@ describe('fetch', () => { assert.ok(init.headers['foo'] === 'bar'); }); + it('should keep custom headers with url, untyped request object and typed (Map) headers object', () => { + const url = 'url'; + const init = { + headers: new Map().set('foo', 'bar'), + }; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore variable init not of RequestInit type + window.fetch(url, init).catch(() => {}); + assert.ok(init.headers.get('foo') === 'bar'); + }); + it('should pass request object as first parameter to the original function (#2411)', () => { const r = new Request(url); return window.fetch(r).then( diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/package.json b/experimental/packages/opentelemetry-instrumentation-grpc/package.json index e8b589b2dd6..c1389db8dc6 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/package.json +++ b/experimental/packages/opentelemetry-instrumentation-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-grpc", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry grpc automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -50,10 +50,10 @@ "@grpc/grpc-js": "^1.7.1", "@grpc/proto-loader": "^0.7.10", "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", "@protobuf-ts/grpc-transport": "2.9.3", "@protobuf-ts/runtime": "2.9.3", "@protobuf-ts/runtime-rpc": "2.9.3", @@ -75,8 +75,8 @@ "@opentelemetry/api": "^1.3.0" }, "dependencies": { - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-grpc", "sideEffects": false diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/clientUtils.ts similarity index 95% rename from experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts rename to experimental/packages/opentelemetry-instrumentation-grpc/src/clientUtils.ts index 9e26062d1c8..f4c5470d16c 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/clientUtils.ts @@ -18,19 +18,22 @@ import type { EventEmitter } from 'events'; import type { Span, SpanStatus } from '@opentelemetry/api'; import type { Client, Metadata, ServiceError } from '@grpc/grpc-js'; import type * as grpcJs from '@grpc/grpc-js'; -import type { GrpcJsInstrumentation } from './'; -import type { GrpcClientFunc, SendUnaryDataCallback } from './types'; -import type { metadataCaptureType } from '../internal-types'; +import type { GrpcInstrumentation } from './'; +import type { + GrpcClientFunc, + SendUnaryDataCallback, + metadataCaptureType, +} from './internal-types'; import { propagation, context } from '@opentelemetry/api'; import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; -import { AttributeNames } from '../enums/AttributeNames'; -import { GRPC_STATUS_CODE_OK } from '../status-code'; +import { AttributeNames } from './enums/AttributeNames'; +import { GRPC_STATUS_CODE_OK } from './status-code'; import { _grpcStatusCodeToSpanStatus, _grpcStatusCodeToOpenTelemetryStatusCode, _methodIsIgnored, -} from '../utils'; +} from './utils'; import { errorMonitor } from 'events'; /** @@ -38,7 +41,7 @@ import { errorMonitor } from 'events'; * with both possible casings e.g. "TestMethod" & "testMethod" */ export function getMethodsToWrap( - this: GrpcJsInstrumentation, + this: GrpcInstrumentation, client: typeof Client, methods: { [key: string]: { originalName?: string } } ): string[] { diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts deleted file mode 100644 index 36be79fd074..00000000000 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts +++ /dev/null @@ -1,591 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type { EventEmitter } from 'events'; - -import type { - Server, - serialize as Serialize, - deserialize as Deserialize, - Metadata, - Client, - ServiceDefinition, - loadPackageDefinition, - GrpcObject, -} from '@grpc/grpc-js'; - -import type * as grpcJs from '@grpc/grpc-js'; - -import type { - ServerCallWithMeta, - SendUnaryDataCallback, - ServerRegisterFunction, - HandleCall, - MakeClientConstructorFunction, - PackageDefinition, - GrpcClientFunc, - ClientRequestFunction, -} from './types'; -import type { GrpcInstrumentationConfig } from '../types'; -import type { metadataCaptureType } from '../internal-types'; - -import { - context, - propagation, - ROOT_CONTEXT, - SpanOptions, - SpanKind, - trace, - Span, -} from '@opentelemetry/api'; -import { - InstrumentationNodeModuleDefinition, - isWrapped, - InstrumentationBase, -} from '@opentelemetry/instrumentation'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; - -import { - shouldNotTraceServerCall, - handleServerFunction, - handleUntracedServerFunction, -} from './serverUtils'; -import { - getMethodsToWrap, - makeGrpcClientRemoteCall, - extractMetadataOrSpliceDefault, - setSpanContext, - patchedCallback, - patchResponseStreamEvents, - patchResponseMetadataEvent, - extractMetadataOrSplice, -} from './clientUtils'; -import { - _extractMethodAndService, - metadataCapture, - URI_REGEX, - _methodIsIgnored, -} from '../utils'; -import { AttributeValues } from '../enums/AttributeValues'; - -export class GrpcJsInstrumentation extends InstrumentationBase { - private _metadataCapture: metadataCaptureType; - - constructor( - name: string, - version: string, - config?: GrpcInstrumentationConfig - ) { - super(name, version, config); - this._metadataCapture = this._createMetadataCapture(); - } - - init() { - return [ - new InstrumentationNodeModuleDefinition( - '@grpc/grpc-js', - ['1.*'], - (moduleExports, version) => { - this._diag.debug(`Applying patch for @grpc/grpc-js@${version}`); - if (isWrapped(moduleExports.Server.prototype.register)) { - this._unwrap(moduleExports.Server.prototype, 'register'); - } - // Patch Server methods - this._wrap( - moduleExports.Server.prototype, - 'register', - this._patchServer() - ); - // Patch Client methods - if (isWrapped(moduleExports.makeGenericClientConstructor)) { - this._unwrap(moduleExports, 'makeGenericClientConstructor'); - } - this._wrap( - moduleExports, - 'makeGenericClientConstructor', - this._patchClient(moduleExports) - ); - if (isWrapped(moduleExports.makeClientConstructor)) { - this._unwrap(moduleExports, 'makeClientConstructor'); - } - this._wrap( - moduleExports, - 'makeClientConstructor', - this._patchClient(moduleExports) - ); - if (isWrapped(moduleExports.loadPackageDefinition)) { - this._unwrap(moduleExports, 'loadPackageDefinition'); - } - this._wrap( - moduleExports, - 'loadPackageDefinition', - this._patchLoadPackageDefinition(moduleExports) - ); - if (isWrapped(moduleExports.Client.prototype)) { - this._unwrap(moduleExports.Client.prototype, 'makeUnaryRequest'); - this._unwrap( - moduleExports.Client.prototype, - 'makeClientStreamRequest' - ); - this._unwrap( - moduleExports.Client.prototype, - 'makeServerStreamRequest' - ); - this._unwrap( - moduleExports.Client.prototype, - 'makeBidiStreamRequest' - ); - } - this._wrap( - moduleExports.Client.prototype, - 'makeUnaryRequest', - this._patchClientRequestMethod(moduleExports, false) as any - ); - this._wrap( - moduleExports.Client.prototype, - 'makeClientStreamRequest', - this._patchClientRequestMethod(moduleExports, false) as any - ); - this._wrap( - moduleExports.Client.prototype, - 'makeServerStreamRequest', - this._patchClientRequestMethod(moduleExports, true) as any - ); - this._wrap( - moduleExports.Client.prototype, - 'makeBidiStreamRequest', - this._patchClientRequestMethod(moduleExports, true) as any - ); - return moduleExports; - }, - (moduleExports, version) => { - if (moduleExports === undefined) return; - this._diag.debug(`Removing patch for @grpc/grpc-js@${version}`); - - this._unwrap(moduleExports.Server.prototype, 'register'); - this._unwrap(moduleExports, 'makeClientConstructor'); - this._unwrap(moduleExports, 'makeGenericClientConstructor'); - this._unwrap(moduleExports, 'loadPackageDefinition'); - this._unwrap(moduleExports.Client.prototype, 'makeUnaryRequest'); - this._unwrap( - moduleExports.Client.prototype, - 'makeClientStreamRequest' - ); - this._unwrap( - moduleExports.Client.prototype, - 'makeServerStreamRequest' - ); - this._unwrap(moduleExports.Client.prototype, 'makeBidiStreamRequest'); - } - ), - ]; - } - - override getConfig(): GrpcInstrumentationConfig { - return super.getConfig(); - } - - override setConfig(config?: GrpcInstrumentationConfig): void { - super.setConfig(config); - this._metadataCapture = this._createMetadataCapture(); - } - - /** - * Patch for grpc.Server.prototype.register(...) function. Provides auto-instrumentation for - * client_stream, server_stream, bidi, unary server handler calls. - */ - private _patchServer(): ( - originalRegister: ServerRegisterFunction - ) => ServerRegisterFunction { - const instrumentation = this; - return (originalRegister: ServerRegisterFunction) => { - const config = this.getConfig(); - instrumentation._diag.debug('patched gRPC server'); - return function register( - this: Server, - name: string, - handler: HandleCall, - serialize: Serialize, - deserialize: Deserialize, - type: string - ): boolean { - const originalRegisterResult = originalRegister.call( - this, - name, - handler, - serialize, - deserialize, - type - ); - const handlerSet = this['handlers'].get(name); - - instrumentation._wrap( - handlerSet, - 'func', - (originalFunc: HandleCall) => { - return function func( - this: typeof handlerSet, - call: ServerCallWithMeta, - callback: SendUnaryDataCallback - ) { - const self = this; - - if (shouldNotTraceServerCall(name, config.ignoreGrpcMethods)) { - return handleUntracedServerFunction( - type, - originalFunc, - call, - callback - ); - } - - const spanName = `grpc.${name.replace('/', '')}`; - const spanOptions: SpanOptions = { - kind: SpanKind.SERVER, - }; - - instrumentation._diag.debug( - `patch func: ${JSON.stringify(spanOptions)}` - ); - - context.with( - propagation.extract(ROOT_CONTEXT, call.metadata, { - get: (carrier, key) => carrier.get(key).map(String), - keys: carrier => Object.keys(carrier.getMap()), - }), - () => { - const { service, method } = _extractMethodAndService(name); - - const span = instrumentation.tracer - .startSpan(spanName, spanOptions) - .setAttributes({ - [SemanticAttributes.RPC_SYSTEM]: - AttributeValues.RPC_SYSTEM, - [SemanticAttributes.RPC_METHOD]: method, - [SemanticAttributes.RPC_SERVICE]: service, - }); - - instrumentation._metadataCapture.server.captureRequestMetadata( - span, - call.metadata - ); - - instrumentation._wrap( - call, - 'sendMetadata', - originalSendMetadata => (responseMetadata: Metadata) => { - instrumentation._metadataCapture.server.captureResponseMetadata( - span, - responseMetadata - ); - originalSendMetadata.call(call, responseMetadata); - } - ); - - context.with(trace.setSpan(context.active(), span), () => { - handleServerFunction.call( - self, - span, - type, - originalFunc, - call, - callback - ); - }); - } - ); - }; - } - ); - return originalRegisterResult; - } as typeof Server.prototype.register; - }; - } - - /** - * Patch for grpc.Client.make*Request(...) functions. - * Provides auto-instrumentation for client requests when using a Client without - * makeGenericClientConstructor/makeClientConstructor - */ - private _patchClientRequestMethod( - grpcLib: typeof grpcJs, - hasResponseStream: boolean - ): ( - original: ClientRequestFunction - ) => ClientRequestFunction { - const instrumentation = this; - return (original: ClientRequestFunction) => { - instrumentation._diag.debug( - 'patched makeClientStreamRequest on grpc client' - ); - - return function makeClientStreamRequest(this: grpcJs.Client) { - // method must always be at first position - const method = arguments[0]; - const { name, service, methodAttributeValue } = - instrumentation._splitMethodString(method); - - // Do not attempt to trace/inject context if method is ignored - if ( - method != null && - _methodIsIgnored( - methodAttributeValue, - instrumentation.getConfig().ignoreGrpcMethods - ) - ) { - return original.apply(this, [...arguments]); - } - - const modifiedArgs = [...arguments]; - const metadata = extractMetadataOrSplice(grpcLib, modifiedArgs, 4); - - const span = instrumentation.createClientSpan( - name, - methodAttributeValue, - service, - metadata - ); - instrumentation.extractNetMetadata(this, span); - - // Callback is only present when there is no responseStream - if (!hasResponseStream) { - // Replace the callback with the patched one if it is there. - // If the callback arg is not a function on the last position then the client will throw - // and never call the callback -> so there's nothing to patch - const lastArgIndex = modifiedArgs.length - 1; - const callback = modifiedArgs[lastArgIndex]; - if (typeof callback === 'function') { - modifiedArgs[lastArgIndex] = patchedCallback(span, callback); - } - } - - return context.with(trace.setSpan(context.active(), span), () => { - setSpanContext(metadata); - - const call = original.apply(this, [...modifiedArgs]); - patchResponseMetadataEvent( - span, - call, - instrumentation._metadataCapture - ); - - // Subscribe to response stream events when there's a response stream. - if (hasResponseStream) { - patchResponseStreamEvents(span, call); - } - - return call; - }); - }; - }; - } - - /** - * Entry point for applying client patches to `grpc.makeClientConstructor(...)` equivalents - * @param this GrpcJsPlugin - */ - private _patchClient( - grpcClient: typeof grpcJs - ): ( - original: MakeClientConstructorFunction - ) => MakeClientConstructorFunction { - const instrumentation = this; - return (original: MakeClientConstructorFunction) => { - instrumentation._diag.debug('patching client'); - return function makeClientConstructor( - this: typeof Client, - methods: ServiceDefinition, - serviceName: string, - options?: object - ) { - const client = original.call(this, methods, serviceName, options); - instrumentation._massWrap( - client.prototype, - getMethodsToWrap.call(instrumentation, client, methods), - instrumentation._getPatchedClientMethods(grpcClient) - ); - return client; - }; - }; - } - - /** - * Entry point for client patching for grpc.loadPackageDefinition(...) - * @param this - GrpcJsPlugin - */ - private _patchLoadPackageDefinition(grpcClient: typeof grpcJs) { - const instrumentation = this; - instrumentation._diag.debug('patching loadPackageDefinition'); - return (original: typeof loadPackageDefinition) => { - return function patchedLoadPackageDefinition( - this: null, - packageDef: PackageDefinition - ) { - const result: GrpcObject = original.call( - this, - packageDef - ) as GrpcObject; - instrumentation._patchLoadedPackage(grpcClient, result); - return result; - } as typeof loadPackageDefinition; - }; - } - - /** - * Parse initial client call properties and start a span to trace its execution - */ - private _getPatchedClientMethods( - grpcClient: typeof grpcJs - ): (original: GrpcClientFunc) => () => EventEmitter { - const instrumentation = this; - return (original: GrpcClientFunc) => { - instrumentation._diag.debug('patch all client methods'); - function clientMethodTrace(this: Client) { - const name = `grpc.${original.path.replace('/', '')}`; - const args = [...arguments]; - const metadata = extractMetadataOrSpliceDefault.call( - instrumentation, - grpcClient, - original, - args - ); - const { service, method } = _extractMethodAndService(original.path); - - const span = instrumentation.tracer - .startSpan(name, { kind: SpanKind.CLIENT }) - .setAttributes({ - [SemanticAttributes.RPC_SYSTEM]: 'grpc', - [SemanticAttributes.RPC_METHOD]: method, - [SemanticAttributes.RPC_SERVICE]: service, - }); - instrumentation.extractNetMetadata(this, span); - - instrumentation._metadataCapture.client.captureRequestMetadata( - span, - metadata - ); - - return context.with(trace.setSpan(context.active(), span), () => - makeGrpcClientRemoteCall( - instrumentation._metadataCapture, - original, - args, - metadata, - this - )(span) - ); - } - Object.assign(clientMethodTrace, original); - return clientMethodTrace; - }; - } - - private _splitMethodString(method: string) { - if (method == null) { - return { name: '', service: '', methodAttributeValue: '' }; - } - const name = `grpc.${method.replace('/', '')}`; - const { service, method: methodAttributeValue } = - _extractMethodAndService(method); - return { name, service, methodAttributeValue }; - } - - private createClientSpan( - name: string, - methodAttributeValue: string, - service: string, - metadata?: grpcJs.Metadata - ) { - const span = this.tracer - .startSpan(name, { kind: SpanKind.CLIENT }) - .setAttributes({ - [SemanticAttributes.RPC_SYSTEM]: 'grpc', - [SemanticAttributes.RPC_METHOD]: methodAttributeValue, - [SemanticAttributes.RPC_SERVICE]: service, - }); - - if (metadata != null) { - this._metadataCapture.client.captureRequestMetadata(span, metadata); - } - return span; - } - - private extractNetMetadata(client: grpcJs.Client, span: Span) { - // set net.peer.* from target (e.g., "dns:otel-productcatalogservice:8080") as a hint to APMs - const parsedUri = URI_REGEX.exec(client.getChannel().getTarget()); - if (parsedUri != null && parsedUri.groups != null) { - span.setAttribute( - SemanticAttributes.NET_PEER_NAME, - parsedUri.groups['name'] - ); - span.setAttribute( - SemanticAttributes.NET_PEER_PORT, - parseInt(parsedUri.groups['port']) - ); - } - } - - /** - * Utility function to patch *all* functions loaded through a proto file. - * Recursively searches for Client classes and patches all methods, reversing the - * parsing done by grpc.loadPackageDefinition - * /~https://github.com/grpc/grpc-node/blob/1d14203c382509c3f36132bd0244c99792cb6601/packages/grpc-js/src/make-client.ts#L200-L217 - */ - private _patchLoadedPackage( - grpcClient: typeof grpcJs, - result: GrpcObject - ): void { - Object.values(result).forEach(service => { - if (typeof service === 'function') { - this._massWrap( - service.prototype, - getMethodsToWrap.call(this, service, service.service), - this._getPatchedClientMethods.call(this, grpcClient) - ); - } else if (typeof service.format !== 'string') { - // GrpcObject - this._patchLoadedPackage.call(this, grpcClient, service as GrpcObject); - } - }); - } - - private _createMetadataCapture(): metadataCaptureType { - const config = this.getConfig(); - - return { - client: { - captureRequestMetadata: metadataCapture( - 'request', - config.metadataToSpanAttributes?.client?.requestMetadata ?? [] - ), - captureResponseMetadata: metadataCapture( - 'response', - config.metadataToSpanAttributes?.client?.responseMetadata ?? [] - ), - }, - server: { - captureRequestMetadata: metadataCapture( - 'request', - config.metadataToSpanAttributes?.server?.requestMetadata ?? [] - ), - captureResponseMetadata: metadataCapture( - 'response', - config.metadataToSpanAttributes?.server?.responseMetadata ?? [] - ), - }, - }; - } -} diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/types.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/types.ts deleted file mode 100644 index 06ca7c0b61c..00000000000 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/types.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type { EventEmitter } from 'events'; -import type { CALL_SPAN_ENDED } from './serverUtils'; -import type { - requestCallback, - ServerUnaryCall, - ServerReadableStream, - ServerWritableStream, - ServerDuplexStream, - Metadata, - Server, - makeGenericClientConstructor, -} from '@grpc/grpc-js'; - -/** - * Server Unary callback type - */ -export type SendUnaryDataCallback = requestCallback; - -/** - * Intersection type of all grpc server call types - */ -export type ServerCall = - | ServerUnaryCall - | ServerReadableStream - | ServerWritableStream - | ServerDuplexStream; - -/** - * {@link ServerCall} ServerCall extended with misc. missing utility types - */ -export type ServerCallWithMeta = ServerCall & { - metadata: Metadata; -}; - -/** - * EventEmitter with span ended symbol indicator - */ -export type GrpcEmitter = EventEmitter & { [CALL_SPAN_ENDED]?: boolean }; - -/** - * Grpc client callback function extended with missing utility types - */ -export type GrpcClientFunc = ((...args: unknown[]) => GrpcEmitter) & { - path: string; - requestStream: boolean; - responseStream: boolean; -}; - -export type ServerRegisterFunction = typeof Server.prototype.register; - -export type ClientRequestFunction = ( - ...args: unknown[] -) => ReturnType; - -export type MakeClientConstructorFunction = typeof makeGenericClientConstructor; - -export type { HandleCall } from '@grpc/grpc-js/build/src/server-call'; -export type { PackageDefinition } from '@grpc/grpc-js/build/src/make-client'; diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/index.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/index.ts index 5e1bb947d1d..3e02b5fc9c4 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/index.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/index.ts @@ -14,5 +14,5 @@ * limitations under the License. */ -export * from './instrumentation'; +export { GrpcInstrumentation } from './instrumentation'; export type { GrpcInstrumentationConfig } from './types'; diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/instrumentation.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/instrumentation.ts index bb6e095cf7e..3a04c24e1fd 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/instrumentation.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/instrumentation.ts @@ -14,32 +14,181 @@ * limitations under the License. */ -import type { GrpcInstrumentationConfig } from './types'; -import type { MeterProvider, TracerProvider } from '@opentelemetry/api'; +import type { EventEmitter } from 'events'; -import { VERSION } from './version'; -import { GrpcJsInstrumentation } from './grpc-js'; +import type { + Server, + serialize as Serialize, + deserialize as Deserialize, + Metadata, + Client, + ServiceDefinition, + loadPackageDefinition, + GrpcObject, +} from '@grpc/grpc-js'; -/** The metadata key under which span context is stored as a binary value. */ -export const GRPC_TRACE_KEY = 'grpc-trace-bin'; +import type * as grpcJs from '@grpc/grpc-js'; -export class GrpcInstrumentation { - private _grpcJsInstrumentation: GrpcJsInstrumentation; +import type { + ServerCallWithMeta, + SendUnaryDataCallback, + ServerRegisterFunction, + HandleCall, + MakeClientConstructorFunction, + PackageDefinition, + GrpcClientFunc, + ClientRequestFunction, + metadataCaptureType, +} from './internal-types'; +import type { GrpcInstrumentationConfig } from './types'; - public readonly instrumentationName: string = - '@opentelemetry/instrumentation-grpc'; - public readonly instrumentationVersion: string = VERSION; +import { + context, + propagation, + ROOT_CONTEXT, + SpanOptions, + SpanKind, + trace, + Span, +} from '@opentelemetry/api'; +import { + InstrumentationNodeModuleDefinition, + isWrapped, + InstrumentationBase, +} from '@opentelemetry/instrumentation'; +import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; + +import { + shouldNotTraceServerCall, + handleServerFunction, + handleUntracedServerFunction, +} from './serverUtils'; +import { + getMethodsToWrap, + makeGrpcClientRemoteCall, + extractMetadataOrSpliceDefault, + setSpanContext, + patchedCallback, + patchResponseStreamEvents, + patchResponseMetadataEvent, + extractMetadataOrSplice, +} from './clientUtils'; +import { + _extractMethodAndService, + metadataCapture, + URI_REGEX, + _methodIsIgnored, +} from './utils'; +import { AttributeValues } from './enums/AttributeValues'; +import { VERSION } from './version'; + +export class GrpcInstrumentation extends InstrumentationBase { + private _metadataCapture: metadataCaptureType; constructor(config?: GrpcInstrumentationConfig) { - this._grpcJsInstrumentation = new GrpcJsInstrumentation( - this.instrumentationName, - this.instrumentationVersion, - config - ); + super('@opentelemetry/instrumentation-grpc', VERSION, config); + this._metadataCapture = this._createMetadataCapture(); } - public setConfig(config?: GrpcInstrumentationConfig) { - this._grpcJsInstrumentation.setConfig(config); + init() { + return [ + new InstrumentationNodeModuleDefinition( + '@grpc/grpc-js', + ['1.*'], + (moduleExports, version) => { + this._diag.debug(`Applying patch for @grpc/grpc-js@${version}`); + if (isWrapped(moduleExports.Server.prototype.register)) { + this._unwrap(moduleExports.Server.prototype, 'register'); + } + // Patch Server methods + this._wrap( + moduleExports.Server.prototype, + 'register', + this._patchServer() + ); + // Patch Client methods + if (isWrapped(moduleExports.makeGenericClientConstructor)) { + this._unwrap(moduleExports, 'makeGenericClientConstructor'); + } + this._wrap( + moduleExports, + 'makeGenericClientConstructor', + this._patchClient(moduleExports) + ); + if (isWrapped(moduleExports.makeClientConstructor)) { + this._unwrap(moduleExports, 'makeClientConstructor'); + } + this._wrap( + moduleExports, + 'makeClientConstructor', + this._patchClient(moduleExports) + ); + if (isWrapped(moduleExports.loadPackageDefinition)) { + this._unwrap(moduleExports, 'loadPackageDefinition'); + } + this._wrap( + moduleExports, + 'loadPackageDefinition', + this._patchLoadPackageDefinition(moduleExports) + ); + if (isWrapped(moduleExports.Client.prototype)) { + this._unwrap(moduleExports.Client.prototype, 'makeUnaryRequest'); + this._unwrap( + moduleExports.Client.prototype, + 'makeClientStreamRequest' + ); + this._unwrap( + moduleExports.Client.prototype, + 'makeServerStreamRequest' + ); + this._unwrap( + moduleExports.Client.prototype, + 'makeBidiStreamRequest' + ); + } + this._wrap( + moduleExports.Client.prototype, + 'makeUnaryRequest', + this._patchClientRequestMethod(moduleExports, false) as any + ); + this._wrap( + moduleExports.Client.prototype, + 'makeClientStreamRequest', + this._patchClientRequestMethod(moduleExports, false) as any + ); + this._wrap( + moduleExports.Client.prototype, + 'makeServerStreamRequest', + this._patchClientRequestMethod(moduleExports, true) as any + ); + this._wrap( + moduleExports.Client.prototype, + 'makeBidiStreamRequest', + this._patchClientRequestMethod(moduleExports, true) as any + ); + return moduleExports; + }, + (moduleExports, version) => { + if (moduleExports === undefined) return; + this._diag.debug(`Removing patch for @grpc/grpc-js@${version}`); + + this._unwrap(moduleExports.Server.prototype, 'register'); + this._unwrap(moduleExports, 'makeClientConstructor'); + this._unwrap(moduleExports, 'makeGenericClientConstructor'); + this._unwrap(moduleExports, 'loadPackageDefinition'); + this._unwrap(moduleExports.Client.prototype, 'makeUnaryRequest'); + this._unwrap( + moduleExports.Client.prototype, + 'makeClientStreamRequest' + ); + this._unwrap( + moduleExports.Client.prototype, + 'makeServerStreamRequest' + ); + this._unwrap(moduleExports.Client.prototype, 'makeBidiStreamRequest'); + } + ), + ]; } /** @@ -47,37 +196,398 @@ export class GrpcInstrumentation { * Public reference to the protected BaseInstrumentation `_config` instance to be used by this * plugin's external helper functions */ - public getConfig(): GrpcInstrumentationConfig { - // grpcNative and grpcJs have their own config copy which should be identical so just pick one - return this._grpcJsInstrumentation.getConfig(); + override getConfig(): GrpcInstrumentationConfig { + return super.getConfig(); } - init() { - // sub instrumentations will already be init when constructing them - return; + override setConfig(config?: GrpcInstrumentationConfig): void { + super.setConfig(config); + this._metadataCapture = this._createMetadataCapture(); + } + + /** + * Patch for grpc.Server.prototype.register(...) function. Provides auto-instrumentation for + * client_stream, server_stream, bidi, unary server handler calls. + */ + private _patchServer(): ( + originalRegister: ServerRegisterFunction + ) => ServerRegisterFunction { + const instrumentation = this; + return (originalRegister: ServerRegisterFunction) => { + const config = this.getConfig(); + instrumentation._diag.debug('patched gRPC server'); + return function register( + this: Server, + name: string, + handler: HandleCall, + serialize: Serialize, + deserialize: Deserialize, + type: string + ): boolean { + const originalRegisterResult = originalRegister.call( + this, + name, + handler, + serialize, + deserialize, + type + ); + const handlerSet = this['handlers'].get(name); + + instrumentation._wrap( + handlerSet, + 'func', + (originalFunc: HandleCall) => { + return function func( + this: typeof handlerSet, + call: ServerCallWithMeta, + callback: SendUnaryDataCallback + ) { + const self = this; + + if (shouldNotTraceServerCall(name, config.ignoreGrpcMethods)) { + return handleUntracedServerFunction( + type, + originalFunc, + call, + callback + ); + } + + const spanName = `grpc.${name.replace('/', '')}`; + const spanOptions: SpanOptions = { + kind: SpanKind.SERVER, + }; + + instrumentation._diag.debug( + `patch func: ${JSON.stringify(spanOptions)}` + ); + + context.with( + propagation.extract(ROOT_CONTEXT, call.metadata, { + get: (carrier, key) => carrier.get(key).map(String), + keys: carrier => Object.keys(carrier.getMap()), + }), + () => { + const { service, method } = _extractMethodAndService(name); + + const span = instrumentation.tracer + .startSpan(spanName, spanOptions) + .setAttributes({ + [SemanticAttributes.RPC_SYSTEM]: + AttributeValues.RPC_SYSTEM, + [SemanticAttributes.RPC_METHOD]: method, + [SemanticAttributes.RPC_SERVICE]: service, + }); + + instrumentation._metadataCapture.server.captureRequestMetadata( + span, + call.metadata + ); + + instrumentation._wrap( + call, + 'sendMetadata', + originalSendMetadata => (responseMetadata: Metadata) => { + instrumentation._metadataCapture.server.captureResponseMetadata( + span, + responseMetadata + ); + originalSendMetadata.call(call, responseMetadata); + } + ); + + context.with(trace.setSpan(context.active(), span), () => { + handleServerFunction.call( + self, + span, + type, + originalFunc, + call, + callback + ); + }); + } + ); + }; + } + ); + return originalRegisterResult; + } as typeof Server.prototype.register; + }; + } + + /** + * Patch for grpc.Client.make*Request(...) functions. + * Provides auto-instrumentation for client requests when using a Client without + * makeGenericClientConstructor/makeClientConstructor + */ + private _patchClientRequestMethod( + grpcLib: typeof grpcJs, + hasResponseStream: boolean + ): ( + original: ClientRequestFunction + ) => ClientRequestFunction { + const instrumentation = this; + return (original: ClientRequestFunction) => { + instrumentation._diag.debug( + 'patched makeClientStreamRequest on grpc client' + ); + + return function makeClientStreamRequest(this: grpcJs.Client) { + // method must always be at first position + const method = arguments[0]; + const { name, service, methodAttributeValue } = + instrumentation._splitMethodString(method); + + // Do not attempt to trace/inject context if method is ignored + if ( + method != null && + _methodIsIgnored( + methodAttributeValue, + instrumentation.getConfig().ignoreGrpcMethods + ) + ) { + return original.apply(this, [...arguments]); + } + + const modifiedArgs = [...arguments]; + const metadata = extractMetadataOrSplice(grpcLib, modifiedArgs, 4); + + const span = instrumentation.createClientSpan( + name, + methodAttributeValue, + service, + metadata + ); + instrumentation.extractNetMetadata(this, span); + + // Callback is only present when there is no responseStream + if (!hasResponseStream) { + // Replace the callback with the patched one if it is there. + // If the callback arg is not a function on the last position then the client will throw + // and never call the callback -> so there's nothing to patch + const lastArgIndex = modifiedArgs.length - 1; + const callback = modifiedArgs[lastArgIndex]; + if (typeof callback === 'function') { + modifiedArgs[lastArgIndex] = patchedCallback(span, callback); + } + } + + return context.with(trace.setSpan(context.active(), span), () => { + setSpanContext(metadata); + + const call = original.apply(this, [...modifiedArgs]); + patchResponseMetadataEvent( + span, + call, + instrumentation._metadataCapture + ); + + // Subscribe to response stream events when there's a response stream. + if (hasResponseStream) { + patchResponseStreamEvents(span, call); + } + + return call; + }); + }; + }; } - enable() { - this._grpcJsInstrumentation.enable(); + /** + * Entry point for applying client patches to `grpc.makeClientConstructor(...)` equivalents + * @param this GrpcJsPlugin + */ + private _patchClient( + grpcClient: typeof grpcJs + ): ( + original: MakeClientConstructorFunction + ) => MakeClientConstructorFunction { + const instrumentation = this; + return (original: MakeClientConstructorFunction) => { + instrumentation._diag.debug('patching client'); + return function makeClientConstructor( + this: typeof Client, + methods: ServiceDefinition, + serviceName: string, + options?: object + ) { + const client = original.call(this, methods, serviceName, options); + instrumentation._massWrap( + client.prototype, + getMethodsToWrap.call(instrumentation, client, methods), + instrumentation._getPatchedClientMethods(grpcClient) + ); + return client; + }; + }; } - disable() { - this._grpcJsInstrumentation.disable(); + /** + * Entry point for client patching for grpc.loadPackageDefinition(...) + * @param this - GrpcJsPlugin + */ + private _patchLoadPackageDefinition(grpcClient: typeof grpcJs) { + const instrumentation = this; + instrumentation._diag.debug('patching loadPackageDefinition'); + return (original: typeof loadPackageDefinition) => { + return function patchedLoadPackageDefinition( + this: null, + packageDef: PackageDefinition + ) { + const result: GrpcObject = original.call( + this, + packageDef + ) as GrpcObject; + instrumentation._patchLoadedPackage(grpcClient, result); + return result; + } as typeof loadPackageDefinition; + }; } /** - * Sets MeterProvider to this plugin - * @param meterProvider + * Parse initial client call properties and start a span to trace its execution */ - public setMeterProvider(meterProvider: MeterProvider) { - this._grpcJsInstrumentation.setMeterProvider(meterProvider); + private _getPatchedClientMethods( + grpcClient: typeof grpcJs + ): (original: GrpcClientFunc) => () => EventEmitter { + const instrumentation = this; + return (original: GrpcClientFunc) => { + instrumentation._diag.debug('patch all client methods'); + function clientMethodTrace(this: Client) { + const name = `grpc.${original.path.replace('/', '')}`; + const args = [...arguments]; + const metadata = extractMetadataOrSpliceDefault.call( + instrumentation, + grpcClient, + original, + args + ); + const { service, method } = _extractMethodAndService(original.path); + + const span = instrumentation.tracer + .startSpan(name, { kind: SpanKind.CLIENT }) + .setAttributes({ + [SemanticAttributes.RPC_SYSTEM]: 'grpc', + [SemanticAttributes.RPC_METHOD]: method, + [SemanticAttributes.RPC_SERVICE]: service, + }); + instrumentation.extractNetMetadata(this, span); + + instrumentation._metadataCapture.client.captureRequestMetadata( + span, + metadata + ); + + return context.with(trace.setSpan(context.active(), span), () => + makeGrpcClientRemoteCall( + instrumentation._metadataCapture, + original, + args, + metadata, + this + )(span) + ); + } + Object.assign(clientMethodTrace, original); + return clientMethodTrace; + }; + } + + private _splitMethodString(method: string) { + if (method == null) { + return { name: '', service: '', methodAttributeValue: '' }; + } + const name = `grpc.${method.replace('/', '')}`; + const { service, method: methodAttributeValue } = + _extractMethodAndService(method); + return { name, service, methodAttributeValue }; + } + + private createClientSpan( + name: string, + methodAttributeValue: string, + service: string, + metadata?: grpcJs.Metadata + ) { + const span = this.tracer + .startSpan(name, { kind: SpanKind.CLIENT }) + .setAttributes({ + [SemanticAttributes.RPC_SYSTEM]: 'grpc', + [SemanticAttributes.RPC_METHOD]: methodAttributeValue, + [SemanticAttributes.RPC_SERVICE]: service, + }); + + if (metadata != null) { + this._metadataCapture.client.captureRequestMetadata(span, metadata); + } + return span; + } + + private extractNetMetadata(client: grpcJs.Client, span: Span) { + // set net.peer.* from target (e.g., "dns:otel-productcatalogservice:8080") as a hint to APMs + const parsedUri = URI_REGEX.exec(client.getChannel().getTarget()); + if (parsedUri != null && parsedUri.groups != null) { + span.setAttribute( + SemanticAttributes.NET_PEER_NAME, + parsedUri.groups['name'] + ); + span.setAttribute( + SemanticAttributes.NET_PEER_PORT, + parseInt(parsedUri.groups['port']) + ); + } } /** - * Sets TraceProvider to this plugin - * @param tracerProvider + * Utility function to patch *all* functions loaded through a proto file. + * Recursively searches for Client classes and patches all methods, reversing the + * parsing done by grpc.loadPackageDefinition + * /~https://github.com/grpc/grpc-node/blob/1d14203c382509c3f36132bd0244c99792cb6601/packages/grpc-js/src/make-client.ts#L200-L217 */ - public setTracerProvider(tracerProvider: TracerProvider) { - this._grpcJsInstrumentation.setTracerProvider(tracerProvider); + private _patchLoadedPackage( + grpcClient: typeof grpcJs, + result: GrpcObject + ): void { + Object.values(result).forEach(service => { + if (typeof service === 'function') { + this._massWrap( + service.prototype, + getMethodsToWrap.call(this, service, service.service), + this._getPatchedClientMethods.call(this, grpcClient) + ); + } else if (typeof service.format !== 'string') { + // GrpcObject + this._patchLoadedPackage.call(this, grpcClient, service as GrpcObject); + } + }); + } + + private _createMetadataCapture(): metadataCaptureType { + const config = this.getConfig(); + + return { + client: { + captureRequestMetadata: metadataCapture( + 'request', + config.metadataToSpanAttributes?.client?.requestMetadata ?? [] + ), + captureResponseMetadata: metadataCapture( + 'response', + config.metadataToSpanAttributes?.client?.responseMetadata ?? [] + ), + }, + server: { + captureRequestMetadata: metadataCapture( + 'request', + config.metadataToSpanAttributes?.server?.requestMetadata ?? [] + ), + captureResponseMetadata: metadataCapture( + 'response', + config.metadataToSpanAttributes?.server?.responseMetadata ?? [] + ), + }, + }; } } diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/internal-types.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/internal-types.ts index 50d337b6365..9e87e57a7cf 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/internal-types.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/internal-types.ts @@ -15,7 +15,18 @@ */ import type { Span } from '@opentelemetry/api'; -import type { Metadata } from '@grpc/grpc-js'; +import type { EventEmitter } from 'events'; +import type { CALL_SPAN_ENDED } from './serverUtils'; +import type { + requestCallback, + ServerUnaryCall, + ServerReadableStream, + ServerWritableStream, + ServerDuplexStream, + Server, + Metadata, + makeGenericClientConstructor, +} from '@grpc/grpc-js'; export type metadataCaptureType = { client: { @@ -27,3 +38,49 @@ export type metadataCaptureType = { captureResponseMetadata: (span: Span, metadata: Metadata) => void; }; }; + +/** + * Server Unary callback type + */ +export type SendUnaryDataCallback = requestCallback; + +/** + * Intersection type of all grpc server call types + */ +export type ServerCall = + | ServerUnaryCall + | ServerReadableStream + | ServerWritableStream + | ServerDuplexStream; + +/** + * {@link ServerCall} ServerCall extended with misc. missing utility types + */ +export type ServerCallWithMeta = ServerCall & { + metadata: Metadata; +}; + +/** + * EventEmitter with span ended symbol indicator + */ +export type GrpcEmitter = EventEmitter & { [CALL_SPAN_ENDED]?: boolean }; + +/** + * Grpc client callback function extended with missing utility types + */ +export type GrpcClientFunc = ((...args: unknown[]) => GrpcEmitter) & { + path: string; + requestStream: boolean; + responseStream: boolean; +}; + +export type ServerRegisterFunction = typeof Server.prototype.register; + +export type ClientRequestFunction = ( + ...args: unknown[] +) => ReturnType; + +export type MakeClientConstructorFunction = typeof makeGenericClientConstructor; + +export type { HandleCall } from '@grpc/grpc-js/build/src/server-call'; +export type { PackageDefinition } from '@grpc/grpc-js/build/src/make-client'; diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/serverUtils.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/serverUtils.ts similarity index 96% rename from experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/serverUtils.ts rename to experimental/packages/opentelemetry-instrumentation-grpc/src/serverUtils.ts index ad07828e689..142c65f3ce9 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/serverUtils.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/serverUtils.ts @@ -34,8 +34,8 @@ import type { SendUnaryDataCallback, GrpcEmitter, HandleCall, -} from './types'; -import type { IgnoreMatcher } from '../types'; +} from './internal-types'; +import type { IgnoreMatcher } from './types'; import { context, SpanStatusCode } from '@opentelemetry/api'; import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; @@ -43,9 +43,9 @@ import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; import { _grpcStatusCodeToOpenTelemetryStatusCode, _methodIsIgnored, -} from '../utils'; -import { AttributeNames } from '../enums/AttributeNames'; -import { GRPC_STATUS_CODE_OK } from '../status-code'; +} from './utils'; +import { AttributeNames } from './enums/AttributeNames'; +import { GRPC_STATUS_CODE_OK } from './status-code'; export const CALL_SPAN_ENDED = Symbol('opentelemetry call span ended'); diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/test/grpc-js.test.ts b/experimental/packages/opentelemetry-instrumentation-grpc/test/grpc-js.test.ts index b7e22102983..dc2918d8749 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/test/grpc-js.test.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/test/grpc-js.test.ts @@ -15,7 +15,7 @@ */ import { runTests } from './helper'; -import { GrpcInstrumentation } from '../src/instrumentation'; +import { GrpcInstrumentation } from '../src'; const instrumentation = new GrpcInstrumentation(); instrumentation.enable(); diff --git a/experimental/packages/opentelemetry-instrumentation-http/package.json b/experimental/packages/opentelemetry-instrumentation-http/package.json index 740a8db35c2..453402848c4 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/package.json +++ b/experimental/packages/opentelemetry-instrumentation-http/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-http", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry http/https automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -46,10 +46,10 @@ }, "devDependencies": { "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/request-promise-native": "1.0.21", @@ -74,9 +74,9 @@ "@opentelemetry/api": "^1.3.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/semantic-conventions": "1.21.0", "semver": "^7.5.2" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-http", diff --git a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-metrics.test.ts b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-metrics.test.ts index d7f55ed8463..0f484f08bf8 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-metrics.test.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-metrics.test.ts @@ -38,13 +38,12 @@ const protocol = 'http'; const hostname = 'localhost'; const pathname = '/test'; const tracerProvider = new NodeTracerProvider(); -const meterProvider = new MeterProvider(); const metricsMemoryExporter = new InMemoryMetricExporter( AggregationTemporality.DELTA ); const metricReader = new TestMetricReader(metricsMemoryExporter); +const meterProvider = new MeterProvider({ readers: [metricReader] }); -meterProvider.addMetricReader(metricReader); instrumentation.setTracerProvider(tracerProvider); instrumentation.setMeterProvider(meterProvider); diff --git a/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json b/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json index 564d68fcdf4..8cf9c767fa9 100644 --- a/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json +++ b/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-xml-http-request", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry XMLHttpRequest automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -55,10 +55,11 @@ }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-zone": "1.20.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/context-zone": "1.21.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -88,10 +89,10 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/sdk-trace-web": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/sdk-trace-web": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-xml-http-request", "sideEffects": false diff --git a/experimental/packages/opentelemetry-instrumentation/package.json b/experimental/packages/opentelemetry-instrumentation/package.json index c8ed2ad0708..daf45f823cf 100644 --- a/experimental/packages/opentelemetry-instrumentation/package.json +++ b/experimental/packages/opentelemetry-instrumentation/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation", - "version": "0.47.0", + "version": "0.48.0", "description": "Base class for node which OpenTelemetry instrumentation modules extend", "author": "OpenTelemetry Authors", "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation", @@ -72,7 +72,7 @@ }, "dependencies": { "@types/shimmer": "^1.0.2", - "import-in-the-middle": "^1.7.2", + "import-in-the-middle": "1.7.1", "require-in-the-middle": "^7.1.1", "semver": "^7.5.2", "shimmer": "^1.2.1" @@ -82,8 +82,9 @@ }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/sdk-metrics": "1.20.0", + "@opentelemetry/sdk-metrics": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/semver": "7.5.6", diff --git a/experimental/packages/opentelemetry-sdk-node/README.md b/experimental/packages/opentelemetry-sdk-node/README.md index a7da74decee..ac828b371cd 100644 --- a/experimental/packages/opentelemetry-sdk-node/README.md +++ b/experimental/packages/opentelemetry-sdk-node/README.md @@ -47,7 +47,7 @@ const { } = require("@opentelemetry/auto-instrumentations-node"); const jaegerExporter = new JaegerExporter(); -const prometheusExporter = new PrometheusExporter({ startServer: true }); +const prometheusExporter = new PrometheusExporter(); const sdk = new opentelemetry.NodeSDK({ // Optional - if omitted, the tracing SDK will be initialized from environment variables diff --git a/experimental/packages/opentelemetry-sdk-node/package.json b/experimental/packages/opentelemetry-sdk-node/package.json index dca0c5cb1cc..b43ed80856e 100644 --- a/experimental/packages/opentelemetry-sdk-node/package.json +++ b/experimental/packages/opentelemetry-sdk-node/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-node", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry SDK for Node.js", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -44,27 +44,27 @@ "access": "public" }, "dependencies": { - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-trace-otlp-grpc": "0.47.0", - "@opentelemetry/exporter-trace-otlp-http": "0.47.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.47.0", - "@opentelemetry/exporter-zipkin": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-logs": "0.47.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-trace-otlp-grpc": "0.48.0", + "@opentelemetry/exporter-trace-otlp-http": "0.48.0", + "@opentelemetry/exporter-trace-otlp-proto": "0.48.0", + "@opentelemetry/exporter-zipkin": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-logs": "0.48.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.3.0 <1.8.0" }, "devDependencies": { "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/exporter-jaeger": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/exporter-jaeger": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/semver": "7.5.6", diff --git a/experimental/packages/opentelemetry-sdk-node/src/sdk.ts b/experimental/packages/opentelemetry-sdk-node/src/sdk.ts index 30a1bea7901..39aca6f58a3 100644 --- a/experimental/packages/opentelemetry-sdk-node/src/sdk.ts +++ b/experimental/packages/opentelemetry-sdk-node/src/sdk.ts @@ -92,6 +92,7 @@ export class NodeSDK { private _loggerProvider?: LoggerProvider; private _meterProvider?: MeterProvider; private _serviceName?: string; + private _configuration?: Partial; private _disabled?: boolean; @@ -116,6 +117,8 @@ export class NodeSDK { }); } + this._configuration = configuration; + this._resource = configuration.resource ?? new Resource({}); this._resourceDetectors = configuration.resourceDetectors ?? [ envDetector, @@ -126,7 +129,8 @@ export class NodeSDK { this._autoDetectResources = configuration.autoDetectResources ?? true; - if (configuration.spanProcessor || configuration.traceExporter) { + // If a tracer provider can be created from manual configuration, create it + if (configuration.traceExporter || configuration.spanProcessor) { const tracerProviderConfig: NodeTracerConfig = {}; if (configuration.sampler) { @@ -316,12 +320,14 @@ export class NodeSDK { }) ); + // if there is a tracerProviderConfig (traceExporter/spanProcessor was set manually) or the traceExporter is set manually, use NodeTracerProvider const Provider = this._tracerProviderConfig ? NodeTracerProvider : TracerProviderWithEnvExporters; + // If the Provider is configured with Env Exporters, we need to check if the SDK had any manual configurations and set them here const tracerProvider = new Provider({ - ...this._tracerProviderConfig?.tracerConfig, + ...this._configuration, resource: this._resource, }); @@ -350,15 +356,16 @@ export class NodeSDK { } if (this._meterProviderConfig) { + const readers: MetricReader[] = []; + if (this._meterProviderConfig.reader) { + readers.push(this._meterProviderConfig.reader); + } const meterProvider = new MeterProvider({ resource: this._resource, views: this._meterProviderConfig?.views ?? [], + readers: readers, }); - if (this._meterProviderConfig.reader) { - meterProvider.addMetricReader(this._meterProviderConfig.reader); - } - this._meterProvider = meterProvider; metrics.setGlobalMeterProvider(meterProvider); diff --git a/experimental/packages/opentelemetry-sdk-node/test/sdk.test.ts b/experimental/packages/opentelemetry-sdk-node/test/sdk.test.ts index 6fb76f3dadb..d6a93c8a607 100644 --- a/experimental/packages/opentelemetry-sdk-node/test/sdk.test.ts +++ b/experimental/packages/opentelemetry-sdk-node/test/sdk.test.ts @@ -46,6 +46,7 @@ import { BatchSpanProcessor, NoopSpanProcessor, IdGenerator, + AlwaysOffSampler, } from '@opentelemetry/sdk-trace-base'; import * as assert from 'assert'; import * as semver from 'semver'; @@ -176,6 +177,29 @@ describe('Node SDK', () => { assert.ok(apiTracerProvider.getDelegate() instanceof NodeTracerProvider); }); + it('should register a tracer provider if an exporter is provided via env', async () => { + env.OTEL_TRACES_EXPORTER = 'console'; + const sdk = new NodeSDK({ + autoDetectResources: false, + }); + + sdk.start(); + + assert.ok(!(metrics.getMeterProvider() instanceof MeterProvider)); + + assert.ok( + context['_getContextManager']().constructor.name === + DefaultContextManager.name + ); + assert.ok( + propagation['_getGlobalPropagator']() instanceof CompositePropagator + ); + const apiTracerProvider = + trace.getTracerProvider() as ProxyTracerProvider; + assert.ok(apiTracerProvider.getDelegate() instanceof NodeTracerProvider); + delete env.OTEL_TRACES_EXPORTER; + }); + it('should register a tracer provider if a span processor is provided', async () => { const exporter = new ConsoleSpanExporter(); const spanProcessor = new SimpleSpanProcessor(exporter); @@ -873,6 +897,21 @@ describe('setup exporter from env', () => { assert(listOfProcessors[0] instanceof BatchSpanProcessor); delete env.OTEL_TRACES_EXPORTER; }); + it('should only create one span processor when configured using env vars and config', async () => { + env.OTEL_TRACES_EXPORTER = 'console'; + const sdk = new NodeSDK({ + sampler: new AlwaysOffSampler(), + }); + sdk.start(); + const listOfProcessors = + sdk['_tracerProvider']!['_registeredSpanProcessors']!; + assert.ok(sdk['_tracerProvider'] instanceof TracerProviderWithEnvExporters); + assert.ok( + sdk['_tracerProvider']!['_config']?.sampler instanceof AlwaysOffSampler + ); + assert.strictEqual(listOfProcessors.length, 1); + delete env.OTEL_TRACES_EXPORTER; + }); it('use otlp exporter and defined exporter protocol env value', async () => { env.OTEL_TRACES_EXPORTER = 'otlp'; env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL = 'grpc'; diff --git a/experimental/packages/otlp-exporter-base/package.json b/experimental/packages/otlp-exporter-base/package.json index 11b93d2f6d4..ce41ac2f0fc 100644 --- a/experimental/packages/otlp-exporter-base/package.json +++ b/experimental/packages/otlp-exporter-base/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/otlp-exporter-base", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry OTLP Exporter base (for internal use only)", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -61,10 +61,11 @@ "access": "public" }, "dependencies": { - "@opentelemetry/core": "1.20.0" + "@opentelemetry/core": "1.21.0" }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", diff --git a/experimental/packages/otlp-grpc-exporter-base/package.json b/experimental/packages/otlp-grpc-exporter-base/package.json index 55f11193a7f..fa6817be259 100644 --- a/experimental/packages/otlp-grpc-exporter-base/package.json +++ b/experimental/packages/otlp-grpc-exporter-base/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/otlp-grpc-exporter-base", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry OTLP-gRPC Exporter base (for internal use only)", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -48,11 +48,10 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.23.6", "@opentelemetry/api": "1.7.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -73,8 +72,8 @@ }, "dependencies": { "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", "protobufjs": "^7.2.3" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/otlp-grpc-exporter-base", diff --git a/experimental/packages/otlp-proto-exporter-base/package.json b/experimental/packages/otlp-proto-exporter-base/package.json index 3af11a6fe9f..e62916bdef8 100644 --- a/experimental/packages/otlp-proto-exporter-base/package.json +++ b/experimental/packages/otlp-proto-exporter-base/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/otlp-proto-exporter-base", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenTelemetry OTLP-HTTP-protobuf Exporter base (for internal use only)", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -60,6 +60,7 @@ }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -79,8 +80,8 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", "protobufjs": "^7.2.3" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/otlp-proto-exporter-base", diff --git a/experimental/packages/otlp-transformer/package.json b/experimental/packages/otlp-transformer/package.json index 25c2963db78..a6bed9f5dc0 100644 --- a/experimental/packages/otlp-transformer/package.json +++ b/experimental/packages/otlp-transformer/package.json @@ -4,7 +4,7 @@ "publishConfig": { "access": "public" }, - "version": "0.47.0", + "version": "0.48.0", "description": "Transform OpenTelemetry SDK data into OTLP", "module": "build/esm/index.js", "esnext": "build/esnext/index.js", @@ -79,12 +79,12 @@ "webpack": "5.89.0" }, "dependencies": { - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-logs": "0.47.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0" + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-logs": "0.48.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/otlp-transformer", "sideEffects": false diff --git a/experimental/packages/sdk-logs/package.json b/experimental/packages/sdk-logs/package.json index acbc3f7493c..84afa8b5297 100644 --- a/experimental/packages/sdk-logs/package.json +++ b/experimental/packages/sdk-logs/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-logs", - "version": "0.47.0", + "version": "0.48.0", "publishConfig": { "access": "public" }, @@ -73,8 +73,9 @@ }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": ">=1.4.0 <1.8.0", - "@opentelemetry/api-logs": "0.47.0", + "@opentelemetry/api-logs": "0.48.0", "@opentelemetry/resources_1.9.0": "npm:@opentelemetry/resources@1.9.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -100,7 +101,7 @@ "webpack-merge": "5.10.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0" } } diff --git a/experimental/packages/shim-opencensus/package.json b/experimental/packages/shim-opencensus/package.json index 317f8fa10c4..cebefa1b544 100644 --- a/experimental/packages/shim-opencensus/package.json +++ b/experimental/packages/shim-opencensus/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/shim-opencensus", - "version": "0.47.0", + "version": "0.48.0", "description": "OpenCensus to OpenTelemetry shim", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -50,8 +50,8 @@ "devDependencies": { "@opencensus/core": "0.1.0", "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -69,9 +69,9 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", "require-in-the-middle": "^7.1.1", "semver": "^7.5.2" }, diff --git a/packages/opentelemetry-propagator-b3/src/version.js b/integration-tests/api/.eslintrc.js similarity index 75% rename from packages/opentelemetry-propagator-b3/src/version.js rename to integration-tests/api/.eslintrc.js index 2090d63abf3..6966956e67f 100644 --- a/packages/opentelemetry-propagator-b3/src/version.js +++ b/integration-tests/api/.eslintrc.js @@ -1,4 +1,3 @@ -"use strict"; /* * Copyright The OpenTelemetry Authors * @@ -14,7 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.VERSION = void 0; -// this is autogenerated file, see scripts/version-update.js -exports.VERSION = '1.16.0'; +module.exports = { + env: { + mocha: true, + commonjs: true, + node: true, + browser: true, + }, + ...require('../../eslint.base.js'), +}; diff --git a/integration-tests/api/README.md b/integration-tests/api/README.md new file mode 100644 index 00000000000..1ad5f339d5e --- /dev/null +++ b/integration-tests/api/README.md @@ -0,0 +1,10 @@ +# `opentelemetry/integration-tests-api` + +This is an integration test suite for `@opentelemetry/api` that verifies the +api package works as expected when being imported. + +## Test + +```sh +npm run test +``` diff --git a/integration-tests/api/package.json b/integration-tests/api/package.json new file mode 100644 index 00000000000..5a0b745d7b8 --- /dev/null +++ b/integration-tests/api/package.json @@ -0,0 +1,40 @@ +{ + "name": "@opentelemetry/integration-tests-api", + "version": "1.21.0", + "private": true, + "publishConfig": { + "access": "restricted" + }, + "description": "Verifies @opentelemetry/api in integration tests", + "author": "OpenTelemetry Authors", + "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/integration-tests/api", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+/~https://github.com/open-telemetry/opentelemetry-js.git" + }, + "bugs": { + "url": "/~https://github.com/open-telemetry/opentelemetry-js/issues" + }, + "engines": { + "node": ">=14" + }, + "scripts": { + "compile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", + "pretest": "npm run compile", + "test": "nyc mocha test/**/*.test.js", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", + "lint": "eslint . --ext .js", + "lint:fix": "eslint . --ext .js --fix" + }, + "devDependencies": { + "@opentelemetry/api": "^1.0.0", + "@types/mocha": "9.1.1", + "@types/node": "18.6.5", + "codecov": "3.8.3", + "cross-var": "1.1.0", + "lerna": "6.6.2", + "mocha": "10.0.0", + "nyc": "15.1.0" + } +} diff --git a/integration-tests/api/test/api-entries.test.js b/integration-tests/api/test/api-entries.test.js new file mode 100644 index 00000000000..7f7635a0863 --- /dev/null +++ b/integration-tests/api/test/api-entries.test.js @@ -0,0 +1,48 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const assert = require('assert'); + +// TypeScript v4.4.4 doesn't support `node16` or `nodenext` in +// [Module Resolution](https://www.typescriptlang.org/tsconfig#moduleResolution) +// which is required for typescript to resolve the `package.json#exports` +// entries. +// Additionally, using `node16` or `nodenext` in `tsconfig.json#moduleResolution` +// requires the TypeScript to generate ESModule outputs. This is a breaking +// change for CJS users. +// So we have to use plain JavaScript to verity the `package.json#exports` here. + +describe('@opentelemetry/api entries', () => { + it('should import root entry', async () => { + const mod = await import('@opentelemetry/api'); + assert.ok(mod.trace != null); + }); + + it('should require root entry', () => { + const mod = require('@opentelemetry/api'); + assert.ok(mod.trace != null); + }); + + it('should import experimental entry', async () => { + const mod = await import('@opentelemetry/api/experimental'); + assert.ok(mod.wrapTracer != null); + }); + + it('should require experimental entry', () => { + const mod = require('@opentelemetry/api/experimental'); + assert.ok(mod.wrapTracer != null); + }); +}); diff --git a/integration-tests/propagation-validation-server/package.json b/integration-tests/propagation-validation-server/package.json index 4cdace02ddf..954a00eb7bb 100644 --- a/integration-tests/propagation-validation-server/package.json +++ b/integration-tests/propagation-validation-server/package.json @@ -1,6 +1,6 @@ { "name": "propagation-validation-server", - "version": "1.21.0", + "version": "1.22.0", "description": "server for w3c tests", "main": "validation_server.js", "private": true, @@ -12,9 +12,9 @@ }, "dependencies": { "@opentelemetry/api": "^1.0.0", - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "axios": "1.5.1", "body-parser": "1.19.0", "express": "4.17.3" diff --git a/karma.webpack.js b/karma.webpack.js index b7fa7acb978..d15c15384aa 100644 --- a/karma.webpack.js +++ b/karma.webpack.js @@ -26,6 +26,22 @@ module.exports = { module: { rules: [ { test: /\.ts$/, use: 'ts-loader' }, + { + test: /\.js$/, + exclude: { + and: [/node_modules/], // Exclude libraries in node_modules ... + not: [ + // Except for a few of them that needs to be transpiled because they use modern syntax + /zone.js/, + ], + }, + use: { + loader: 'babel-loader', + options: { + presets: ['@babel/preset-env'], + } + }, + }, { enforce: 'post', exclude: /(node_modules|\.test\.[tj]sx?$)/, diff --git a/package-lock.json b/package-lock.json index 3d300e82755..302a49e6105 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "hasInstallScript": true, "license": "Apache-2.0", "workspaces": [ + "api", "packages/*", "experimental/packages/*", "experimental/examples/*", @@ -194,17 +195,17 @@ } }, "examples/esm-http-ts": { - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/api": "1.7.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.47.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/instrumentation-http": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/exporter-trace-otlp-proto": "0.48.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/instrumentation-http": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "engines": { "node": ">=14" @@ -212,18 +213,18 @@ }, "examples/http": { "name": "http-example", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/exporter-jaeger": "1.20.0", - "@opentelemetry/exporter-zipkin": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/instrumentation-http": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/exporter-jaeger": "1.21.0", + "@opentelemetry/exporter-zipkin": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/instrumentation-http": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "devDependencies": { "cross-env": "^6.0.0" @@ -234,18 +235,18 @@ }, "examples/https": { "name": "https-example", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/api": "^1.0.0", - "@opentelemetry/exporter-jaeger": "1.20.0", - "@opentelemetry/exporter-zipkin": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/instrumentation-http": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/exporter-jaeger": "1.21.0", + "@opentelemetry/exporter-zipkin": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/instrumentation-http": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "devDependencies": { "cross-env": "^6.0.0" @@ -256,27 +257,28 @@ }, "examples/opentelemetry-web": { "name": "web-opentelemetry-example", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/context-zone": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.47.0", - "@opentelemetry/exporter-trace-otlp-http": "0.47.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.47.0", - "@opentelemetry/exporter-zipkin": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/instrumentation-fetch": "0.47.0", - "@opentelemetry/instrumentation-xml-http-request": "0.47.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-web": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/context-zone": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.48.0", + "@opentelemetry/exporter-trace-otlp-http": "0.48.0", + "@opentelemetry/exporter-trace-otlp-proto": "0.48.0", + "@opentelemetry/exporter-zipkin": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/instrumentation-fetch": "0.48.0", + "@opentelemetry/instrumentation-xml-http-request": "0.48.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-web": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "devDependencies": { - "@babel/core": "^7.6.0", + "@babel/core": "^7.23.6", + "@babel/preset-env": "^7.22.20", "babel-loader": "^8.0.6", "ts-loader": "^9.2.6", "typescript": "^4.5.2", @@ -607,21 +609,21 @@ }, "examples/otlp-exporter-node": { "name": "example-otlp-exporter-node", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-metrics-otlp-grpc": "0.47.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.47.0", - "@opentelemetry/exporter-metrics-otlp-proto": "0.47.0", - "@opentelemetry/exporter-trace-otlp-grpc": "0.47.0", - "@opentelemetry/exporter-trace-otlp-http": "0.47.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-metrics-otlp-grpc": "0.48.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.48.0", + "@opentelemetry/exporter-metrics-otlp-proto": "0.48.0", + "@opentelemetry/exporter-trace-otlp-grpc": "0.48.0", + "@opentelemetry/exporter-trace-otlp-http": "0.48.0", + "@opentelemetry/exporter-trace-otlp-proto": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "engines": { "node": ">=14" @@ -629,11 +631,11 @@ }, "experimental/backwards-compatibility/node14": { "name": "backcompat-node14", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/sdk-node": "0.47.0", - "@opentelemetry/sdk-trace-base": "1.20.0" + "@opentelemetry/sdk-node": "0.48.0", + "@opentelemetry/sdk-trace-base": "1.21.0" }, "devDependencies": { "@types/node": "14.18.25", @@ -650,11 +652,11 @@ }, "experimental/backwards-compatibility/node16": { "name": "backcompat-node16", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/sdk-node": "0.47.0", - "@opentelemetry/sdk-trace-base": "1.20.0" + "@opentelemetry/sdk-node": "0.48.0", + "@opentelemetry/sdk-trace-base": "1.21.0" }, "devDependencies": { "@types/node": "16.11.52", @@ -671,11 +673,11 @@ }, "experimental/examples/logs": { "name": "logs-example", - "version": "0.47.0", + "version": "0.48.0", "dependencies": { "@opentelemetry/api": "^1.7.0", - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/sdk-logs": "0.47.0" + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/sdk-logs": "0.48.0" }, "devDependencies": { "@types/node": "18.6.5", @@ -741,20 +743,20 @@ } }, "experimental/examples/opencensus-shim": { - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { "@opencensus/core": "0.1.0", "@opencensus/instrumentation-http": "0.1.0", "@opencensus/nodejs-base": "0.1.0", "@opentelemetry/api": "1.7.0", - "@opentelemetry/exporter-prometheus": "0.47.0", - "@opentelemetry/exporter-trace-otlp-grpc": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", - "@opentelemetry/shim-opencensus": "0.47.0" + "@opentelemetry/exporter-prometheus": "0.48.0", + "@opentelemetry/exporter-trace-otlp-grpc": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", + "@opentelemetry/shim-opencensus": "0.48.0" }, "engines": { "node": ">=14" @@ -762,17 +764,17 @@ }, "experimental/examples/prometheus": { "name": "prometheus-example", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/exporter-prometheus": "0.47.0", - "@opentelemetry/sdk-metrics": "1.20.0" + "@opentelemetry/exporter-prometheus": "0.48.0", + "@opentelemetry/sdk-metrics": "1.21.0" } }, "experimental/packages/api-events": { "name": "@opentelemetry/api-events", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/api": "^1.0.0" @@ -911,7 +913,7 @@ }, "experimental/packages/api-logs": { "name": "@opentelemetry/api-logs", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/api": "^1.0.0" @@ -1050,22 +1052,21 @@ }, "experimental/packages/exporter-logs-otlp-grpc": { "name": "@opentelemetry/exporter-logs-otlp-grpc", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/sdk-logs": "0.47.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/sdk-logs": "0.48.0" }, "devDependencies": { - "@babel/core": "7.23.6", "@grpc/proto-loader": "^0.7.10", "@opentelemetry/api": "1.7.0", - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/resources": "1.20.0", + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/resources": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -1089,19 +1090,20 @@ }, "experimental/packages/exporter-logs-otlp-http": { "name": "@opentelemetry/exporter-logs-otlp-http", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/sdk-logs": "0.47.0" + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/sdk-logs": "0.48.0" }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/resources": "1.20.0", + "@opentelemetry/resources": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -1402,20 +1404,21 @@ }, "experimental/packages/exporter-logs-otlp-proto": { "name": "@opentelemetry/exporter-logs-otlp-proto", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-proto-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-logs": "0.47.0", - "@opentelemetry/sdk-trace-base": "1.20.0" + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-proto-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-logs": "0.48.0", + "@opentelemetry/sdk-trace-base": "1.21.0" }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -1715,21 +1718,20 @@ }, "experimental/packages/exporter-trace-otlp-grpc": { "name": "@opentelemetry/exporter-trace-otlp-grpc", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0" }, "devDependencies": { - "@babel/core": "7.23.6", "@grpc/proto-loader": "^0.7.10", "@opentelemetry/api": "1.7.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -1753,17 +1755,18 @@ }, "experimental/packages/exporter-trace-otlp-http": { "name": "@opentelemetry/exporter-trace-otlp-http", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0" }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -2065,18 +2068,19 @@ }, "experimental/packages/exporter-trace-otlp-proto": { "name": "@opentelemetry/exporter-trace-otlp-proto", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-proto-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-proto-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0" }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -2376,14 +2380,15 @@ }, "experimental/packages/opentelemetry-browser-detector": { "name": "@opentelemetry/opentelemetry-browser-detector", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -2682,19 +2687,18 @@ }, "experimental/packages/opentelemetry-exporter-metrics-otlp-grpc": { "name": "@opentelemetry/exporter-metrics-otlp-grpc", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.47.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.48.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0" }, "devDependencies": { - "@babel/core": "7.23.6", "@grpc/proto-loader": "^0.7.10", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", @@ -2720,17 +2724,18 @@ }, "experimental/packages/opentelemetry-exporter-metrics-otlp-http": { "name": "@opentelemetry/exporter-metrics-otlp-http", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0" }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -3032,19 +3037,18 @@ }, "experimental/packages/opentelemetry-exporter-metrics-otlp-proto": { "name": "@opentelemetry/exporter-metrics-otlp-proto", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.47.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-proto-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.48.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-proto-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0" }, "devDependencies": { - "@babel/core": "7.23.6", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -3069,16 +3073,16 @@ }, "experimental/packages/opentelemetry-exporter-prometheus": { "name": "@opentelemetry/exporter-prometheus", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0" }, "devDependencies": { "@opentelemetry/api": "1.7.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -3100,19 +3104,20 @@ }, "experimental/packages/opentelemetry-instrumentation": { "name": "@opentelemetry/instrumentation", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { "@types/shimmer": "^1.0.2", - "import-in-the-middle": "^1.7.2", + "import-in-the-middle": "1.7.1", "require-in-the-middle": "^7.1.1", "semver": "^7.5.2", "shimmer": "^1.2.1" }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/sdk-metrics": "1.20.0", + "@opentelemetry/sdk-metrics": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/semver": "7.5.6", @@ -3149,20 +3154,21 @@ }, "experimental/packages/opentelemetry-instrumentation-fetch": { "name": "@opentelemetry/instrumentation-fetch", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/sdk-trace-web": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/sdk-trace-web": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-zone": "1.20.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/context-zone": "1.21.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -3462,21 +3468,21 @@ }, "experimental/packages/opentelemetry-instrumentation-grpc": { "name": "@opentelemetry/instrumentation-grpc", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "devDependencies": { "@bufbuild/buf": "1.21.0-1", "@grpc/grpc-js": "^1.7.1", "@grpc/proto-loader": "^0.7.10", "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", "@protobuf-ts/grpc-transport": "2.9.3", "@protobuf-ts/runtime": "2.9.3", "@protobuf-ts/runtime-rpc": "2.9.3", @@ -3503,20 +3509,20 @@ }, "experimental/packages/opentelemetry-instrumentation-http": { "name": "@opentelemetry/instrumentation-http", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/semantic-conventions": "1.21.0", "semver": "^7.5.2" }, "devDependencies": { "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/request-promise-native": "1.0.21", @@ -3556,20 +3562,21 @@ }, "experimental/packages/opentelemetry-instrumentation-xml-http-request": { "name": "@opentelemetry/instrumentation-xml-http-request", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/sdk-trace-web": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/sdk-trace-web": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-zone": "1.20.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/context-zone": "1.21.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -3941,6 +3948,17 @@ "node": ">=10.13.0" } }, + "experimental/packages/opentelemetry-instrumentation/node_modules/import-in-the-middle": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-1.7.1.tgz", + "integrity": "sha512-1LrZPDtW+atAxH42S6288qyDFNQ2YCty+2mxEPRtfazH6Z5QwkaBSTS2ods7hnVJioF6rkRfNoA6A/MstpFXLg==", + "dependencies": { + "acorn": "^8.8.2", + "acorn-import-assertions": "^1.9.0", + "cjs-module-lexer": "^1.2.2", + "module-details-from-path": "^1.0.3" + } + }, "experimental/packages/opentelemetry-instrumentation/node_modules/interpret": { "version": "3.1.1", "dev": true, @@ -4134,27 +4152,27 @@ }, "experimental/packages/opentelemetry-sdk-node": { "name": "@opentelemetry/sdk-node", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-trace-otlp-grpc": "0.47.0", - "@opentelemetry/exporter-trace-otlp-http": "0.47.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.47.0", - "@opentelemetry/exporter-zipkin": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-logs": "0.47.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-trace-otlp-grpc": "0.48.0", + "@opentelemetry/exporter-trace-otlp-http": "0.48.0", + "@opentelemetry/exporter-trace-otlp-proto": "0.48.0", + "@opentelemetry/exporter-zipkin": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-logs": "0.48.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "devDependencies": { "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/exporter-jaeger": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/exporter-jaeger": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/semver": "7.5.6", @@ -4179,13 +4197,14 @@ }, "experimental/packages/otlp-exporter-base": { "name": "@opentelemetry/otlp-exporter-base", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0" + "@opentelemetry/core": "1.21.0" }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -4484,20 +4503,19 @@ }, "experimental/packages/otlp-grpc-exporter-base": { "name": "@opentelemetry/otlp-grpc-exporter-base", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", "protobufjs": "^7.2.3" }, "devDependencies": { - "@babel/core": "7.23.6", "@opentelemetry/api": "1.7.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -4522,15 +4540,16 @@ }, "experimental/packages/otlp-proto-exporter-base": { "name": "@opentelemetry/otlp-proto-exporter-base", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", "protobufjs": "^7.2.3" }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -4555,15 +4574,15 @@ }, "experimental/packages/otlp-transformer": { "name": "@opentelemetry/otlp-transformer", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-logs": "0.47.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0" + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-logs": "0.48.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0" }, "devDependencies": { "@opentelemetry/api": "1.7.0", @@ -4702,16 +4721,17 @@ }, "experimental/packages/sdk-logs": { "name": "@opentelemetry/sdk-logs", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0" }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": ">=1.4.0 <1.8.0", - "@opentelemetry/api-logs": "0.47.0", + "@opentelemetry/api-logs": "0.48.0", "@opentelemetry/resources_1.9.0": "npm:@opentelemetry/resources@1.9.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -5061,20 +5081,20 @@ }, "experimental/packages/shim-opencensus": { "name": "@opentelemetry/shim-opencensus", - "version": "0.47.0", + "version": "0.48.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", "require-in-the-middle": "^7.1.1", "semver": "^7.5.2" }, "devDependencies": { "@opencensus/core": "0.1.0", "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -5095,14 +5115,342 @@ "@opentelemetry/api": "^1.0.0" } }, - "integration-tests/propagation-validation-server": { + "integration-tests/api": { + "name": "@opentelemetry/integration-tests-api", "version": "1.21.0", "license": "Apache-2.0", + "devDependencies": { + "@opentelemetry/api": "^1.0.0", + "@types/mocha": "9.1.1", + "@types/node": "18.6.5", + "codecov": "3.8.3", + "cross-var": "1.1.0", + "lerna": "6.6.2", + "mocha": "10.0.0", + "nyc": "15.1.0" + }, + "engines": { + "node": ">=14" + } + }, + "integration-tests/api/node_modules/@types/mocha": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz", + "integrity": "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==", + "dev": true + }, + "integration-tests/api/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "integration-tests/api/node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "integration-tests/api/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "integration-tests/api/node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "integration-tests/api/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "/~https://github.com/sponsors/sindresorhus" + } + }, + "integration-tests/api/node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "integration-tests/api/node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "/~https://github.com/sponsors/isaacs" + } + }, + "integration-tests/api/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "integration-tests/api/node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "integration-tests/api/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "integration-tests/api/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "/~https://github.com/sponsors/sindresorhus" + } + }, + "integration-tests/api/node_modules/mocha": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.0.0.tgz", + "integrity": "sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA==", + "dev": true, + "dependencies": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.3", + "debug": "4.3.4", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.2.0", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "5.0.1", + "ms": "2.1.3", + "nanoid": "3.3.3", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "workerpool": "6.2.1", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha.js" + }, + "engines": { + "node": ">= 14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mochajs" + } + }, + "integration-tests/api/node_modules/mocha/node_modules/minimatch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "integration-tests/api/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "integration-tests/api/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "/~https://github.com/sponsors/sindresorhus" + } + }, + "integration-tests/api/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "/~https://github.com/sponsors/sindresorhus" + } + }, + "integration-tests/api/node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "integration-tests/api/node_modules/serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "integration-tests/api/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "/~https://github.com/chalk/supports-color?sponsor=1" + } + }, + "integration-tests/api/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "integration-tests/api/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "integration-tests/propagation-validation-server": { + "version": "1.22.0", + "license": "Apache-2.0", "dependencies": { "@opentelemetry/api": "^1.0.0", - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "axios": "1.5.1", "body-parser": "1.19.0", "express": "4.17.3" @@ -9656,6 +10004,10 @@ "resolved": "experimental/packages/opentelemetry-instrumentation-xml-http-request", "link": true }, + "node_modules/@opentelemetry/integration-tests-api": { + "resolved": "integration-tests/api", + "link": true + }, "node_modules/@opentelemetry/opentelemetry-browser-detector": { "resolved": "experimental/packages/opentelemetry-browser-detector", "link": true @@ -19477,17 +19829,6 @@ "node": ">=4" } }, - "node_modules/import-in-the-middle": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-1.7.2.tgz", - "integrity": "sha512-coz7AjRnPyKW36J6JX5Bjz1mcX7MX1H2XsEGseVcnXMdzsAbbAu0HBZhiAem+3SAmuZdi+p8OwoB2qUpTRgjOQ==", - "dependencies": { - "acorn": "^8.8.2", - "acorn-import-assertions": "^1.9.0", - "cjs-module-lexer": "^1.2.2", - "module-details-from-path": "^1.0.3" - } - }, "node_modules/import-local": { "version": "3.1.0", "dev": true, @@ -32940,7 +33281,7 @@ }, "packages/opentelemetry-context-async-hooks": { "name": "@opentelemetry/context-async-hooks", - "version": "1.20.0", + "version": "1.21.0", "license": "Apache-2.0", "devDependencies": { "@opentelemetry/api": ">=1.0.0 <1.8.0", @@ -32963,36 +33304,16 @@ }, "packages/opentelemetry-context-zone": { "name": "@opentelemetry/context-zone", - "version": "1.20.0", + "version": "1.21.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/context-zone-peer-dep": "1.20.0", + "@opentelemetry/context-zone-peer-dep": "1.21.0", "zone.js": "^0.11.0" }, "devDependencies": { - "@babel/core": "7.23.6", - "@types/mocha": "10.0.6", - "@types/node": "18.6.5", - "@types/sinon": "10.0.20", - "@types/webpack-env": "1.16.3", - "babel-loader": "8.3.0", - "codecov": "3.8.3", "cross-var": "1.1.0", - "karma": "6.4.2", - "karma-chrome-launcher": "3.1.0", - "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.36", - "karma-webpack": "4.0.2", "lerna": "6.6.2", - "mocha": "10.2.0", - "nyc": "15.1.0", - "sinon": "15.1.2", - "ts-loader": "8.4.0", - "ts-mocha": "10.0.0", - "typescript": "4.4.4", - "webpack": "5.89.0", - "webpack-cli": "5.1.4", - "webpack-merge": "5.10.0" + "typescript": "4.4.4" }, "engines": { "node": ">=14" @@ -33000,10 +33321,11 @@ }, "packages/opentelemetry-context-zone-peer-dep": { "name": "@opentelemetry/context-zone-peer-dep", - "version": "1.20.0", + "version": "1.21.0", "license": "Apache-2.0", "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": ">=1.0.0 <1.8.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -33029,14 +33351,14 @@ "typescript": "4.4.4", "webpack": "5.89.0", "webpack-cli": "5.1.4", - "zone.js": "0.11.4" + "zone.js": "0.13.3" }, "engines": { "node": ">=14" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.8.0", - "zone.js": "^0.10.2 || ^0.11.0" + "zone.js": "^0.10.2 || ^0.11.0 || ^0.13.0" } }, "packages/opentelemetry-context-zone-peer-dep/node_modules/@webpack-cli/configtest": { @@ -33305,284 +33627,20 @@ } }, "packages/opentelemetry-context-zone-peer-dep/node_modules/zone.js": { - "version": "0.11.4", - "dev": true, - "license": "MIT", - "dependencies": { - "tslib": "^2.0.0" - } - }, - "packages/opentelemetry-context-zone/node_modules/@webpack-cli/configtest": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.15.0" - }, - "peerDependencies": { - "webpack": "5.x.x", - "webpack-cli": "5.x.x" - } - }, - "packages/opentelemetry-context-zone/node_modules/@webpack-cli/info": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.15.0" - }, - "peerDependencies": { - "webpack": "5.x.x", - "webpack-cli": "5.x.x" - } - }, - "packages/opentelemetry-context-zone/node_modules/@webpack-cli/serve": { - "version": "2.0.5", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.15.0" - }, - "peerDependencies": { - "webpack": "5.x.x", - "webpack-cli": "5.x.x" - }, - "peerDependenciesMeta": { - "webpack-dev-server": { - "optional": true - } - } - }, - "packages/opentelemetry-context-zone/node_modules/commander": { - "version": "10.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14" - } - }, - "packages/opentelemetry-context-zone/node_modules/cross-spawn": { - "version": "7.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "packages/opentelemetry-context-zone/node_modules/enhanced-resolve": { - "version": "5.15.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.4", - "tapable": "^2.2.0" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "packages/opentelemetry-context-zone/node_modules/interpret": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10.13.0" - } - }, - "packages/opentelemetry-context-zone/node_modules/rechoir": { - "version": "0.8.0", - "dev": true, - "license": "MIT", - "dependencies": { - "resolve": "^1.20.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "packages/opentelemetry-context-zone/node_modules/shebang-command": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "packages/opentelemetry-context-zone/node_modules/shebang-regex": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "packages/opentelemetry-context-zone/node_modules/tapable": { - "version": "2.2.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "packages/opentelemetry-context-zone/node_modules/terser-webpack-plugin": { - "version": "5.3.9", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.17", - "jest-worker": "^27.4.5", - "schema-utils": "^3.1.1", - "serialize-javascript": "^6.0.1", - "terser": "^5.16.8" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^5.1.0" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "esbuild": { - "optional": true - }, - "uglify-js": { - "optional": true - } - } - }, - "packages/opentelemetry-context-zone/node_modules/webpack": { - "version": "5.89.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/eslint-scope": "^3.7.3", - "@types/estree": "^1.0.0", - "@webassemblyjs/ast": "^1.11.5", - "@webassemblyjs/wasm-edit": "^1.11.5", - "@webassemblyjs/wasm-parser": "^1.11.5", - "acorn": "^8.7.1", - "acorn-import-assertions": "^1.9.0", - "browserslist": "^4.14.5", - "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.15.0", - "es-module-lexer": "^1.2.1", - "eslint-scope": "5.1.1", - "events": "^3.2.0", - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.2.9", - "json-parse-even-better-errors": "^2.3.1", - "loader-runner": "^4.2.0", - "mime-types": "^2.1.27", - "neo-async": "^2.6.2", - "schema-utils": "^3.2.0", - "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.7", - "watchpack": "^2.4.0", - "webpack-sources": "^3.2.3" - }, - "bin": { - "webpack": "bin/webpack.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependenciesMeta": { - "webpack-cli": { - "optional": true - } - } - }, - "packages/opentelemetry-context-zone/node_modules/webpack-cli": { - "version": "5.1.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^2.1.1", - "@webpack-cli/info": "^2.0.2", - "@webpack-cli/serve": "^2.0.5", - "colorette": "^2.0.14", - "commander": "^10.0.1", - "cross-spawn": "^7.0.3", - "envinfo": "^7.7.3", - "fastest-levenshtein": "^1.0.12", - "import-local": "^3.0.2", - "interpret": "^3.1.1", - "rechoir": "^0.8.0", - "webpack-merge": "^5.7.3" - }, - "bin": { - "webpack-cli": "bin/cli.js" - }, - "engines": { - "node": ">=14.15.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "5.x.x" - }, - "peerDependenciesMeta": { - "@webpack-cli/generators": { - "optional": true - }, - "webpack-bundle-analyzer": { - "optional": true - }, - "webpack-dev-server": { - "optional": true - } - } - }, - "packages/opentelemetry-context-zone/node_modules/webpack-sources": { - "version": "3.2.3", + "version": "0.13.3", + "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.13.3.tgz", + "integrity": "sha512-MKPbmZie6fASC/ps4dkmIhaT5eonHkEt6eAy80K42tAm0G2W+AahLJjbfi6X9NPdciOE9GRFTTM8u2IiF6O3ww==", "dev": true, - "license": "MIT", - "engines": { - "node": ">=10.13.0" - } - }, - "packages/opentelemetry-context-zone/node_modules/which": { - "version": "2.0.2", - "dev": true, - "license": "ISC", "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" + "tslib": "^2.3.0" } }, "packages/opentelemetry-core": { "name": "@opentelemetry/core", - "version": "1.20.0", + "version": "1.21.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/semantic-conventions": "1.21.0" }, "devDependencies": { "@opentelemetry/api": ">=1.0.0 <1.8.0", @@ -33724,17 +33782,17 @@ }, "packages/opentelemetry-exporter-jaeger": { "name": "@opentelemetry/exporter-jaeger", - "version": "1.20.0", + "version": "1.21.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "jaeger-client": "^3.15.0" }, "devDependencies": { "@opentelemetry/api": "^1.0.0", - "@opentelemetry/resources": "1.20.0", + "@opentelemetry/resources": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -33757,16 +33815,17 @@ }, "packages/opentelemetry-exporter-zipkin": { "name": "@opentelemetry/exporter-zipkin", - "version": "1.20.0", + "version": "1.21.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "^1.0.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -34068,10 +34127,10 @@ }, "packages/opentelemetry-propagator-b3": { "name": "@opentelemetry/propagator-b3", - "version": "1.20.0", + "version": "1.21.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0" + "@opentelemetry/core": "1.21.0" }, "devDependencies": { "@opentelemetry/api": ">=1.0.0 <1.8.0", @@ -34095,10 +34154,10 @@ }, "packages/opentelemetry-propagator-jaeger": { "name": "@opentelemetry/propagator-jaeger", - "version": "1.20.0", + "version": "1.21.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0" + "@opentelemetry/core": "1.21.0" }, "devDependencies": { "@opentelemetry/api": ">=1.0.0 <1.8.0", @@ -34240,11 +34299,11 @@ }, "packages/opentelemetry-resources": { "name": "@opentelemetry/resources", - "version": "1.20.0", + "version": "1.21.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "devDependencies": { "@opentelemetry/api": ">=1.0.0 <1.8.0", @@ -34585,12 +34644,12 @@ }, "packages/opentelemetry-sdk-trace-base": { "name": "@opentelemetry/sdk-trace-base", - "version": "1.20.0", + "version": "1.21.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "devDependencies": { "@opentelemetry/api": ">=1.0.0 <1.8.0", @@ -34733,20 +34792,20 @@ }, "packages/opentelemetry-sdk-trace-node": { "name": "@opentelemetry/sdk-trace-node", - "version": "1.20.0", + "version": "1.21.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/propagator-jaeger": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/propagator-jaeger": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "semver": "^7.5.2" }, "devDependencies": { "@opentelemetry/api": ">=1.0.0 <1.8.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/semver": "7.5.6", @@ -34769,19 +34828,20 @@ }, "packages/opentelemetry-sdk-trace-web": { "name": "@opentelemetry/sdk-trace-web", - "version": "1.20.0", + "version": "1.21.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": ">=1.0.0 <1.8.0", - "@opentelemetry/context-zone": "1.20.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/resources": "1.20.0", + "@opentelemetry/context-zone": "1.21.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/resources": "1.21.0", "@types/jquery": "3.5.29", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -35084,7 +35144,7 @@ }, "packages/opentelemetry-semantic-conventions": { "name": "@opentelemetry/semantic-conventions", - "version": "1.20.0", + "version": "1.21.0", "license": "Apache-2.0", "devDependencies": { "@types/mocha": "10.0.6", @@ -35106,18 +35166,18 @@ }, "packages/opentelemetry-shim-opentracing": { "name": "@opentelemetry/shim-opentracing", - "version": "1.20.0", + "version": "1.21.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "opentracing": "^0.14.4" }, "devDependencies": { "@opentelemetry/api": ">=1.0.0 <1.8.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/propagator-jaeger": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/propagator-jaeger": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "codecov": "3.8.3", @@ -35137,15 +35197,16 @@ }, "packages/sdk-metrics": { "name": "@opentelemetry/sdk-metrics", - "version": "1.20.0", + "version": "1.21.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", "lodash.merge": "^4.6.2" }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": ">=1.3.0 <1.8.0", "@types/lodash.merge": "4.6.9", "@types/mocha": "10.0.6", @@ -35445,7 +35506,7 @@ }, "packages/template": { "name": "@opentelemetry/template", - "version": "1.20.0", + "version": "1.21.0", "license": "Apache-2.0", "devDependencies": { "@types/node": "18.6.5", @@ -35459,19 +35520,19 @@ }, "selenium-tests": { "name": "@opentelemetry/selenium-tests", - "version": "1.21.0", + "version": "1.22.0", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/context-zone-peer-dep": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-trace-otlp-http": "0.47.0", - "@opentelemetry/exporter-zipkin": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/instrumentation-fetch": "0.47.0", - "@opentelemetry/instrumentation-xml-http-request": "0.47.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-web": "1.20.0", + "@opentelemetry/context-zone-peer-dep": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-trace-otlp-http": "0.48.0", + "@opentelemetry/exporter-zipkin": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/instrumentation-fetch": "0.48.0", + "@opentelemetry/instrumentation-xml-http-request": "0.48.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-web": "1.21.0", "zone.js": "0.11.4" }, "devDependencies": { @@ -39122,190 +39183,36 @@ } } }, - "@opentelemetry/context-async-hooks": { - "version": "file:packages/opentelemetry-context-async-hooks", - "requires": { - "@opentelemetry/api": ">=1.0.0 <1.8.0", - "@types/mocha": "10.0.6", - "@types/node": "18.6.5", - "codecov": "3.8.3", - "cross-var": "1.1.0", - "lerna": "6.6.2", - "mocha": "10.2.0", - "nyc": "15.1.0", - "ts-mocha": "10.0.0", - "typescript": "4.4.4" - } - }, - "@opentelemetry/context-zone": { - "version": "file:packages/opentelemetry-context-zone", - "requires": { - "@babel/core": "7.23.6", - "@opentelemetry/context-zone-peer-dep": "1.20.0", - "@types/mocha": "10.0.6", - "@types/node": "18.6.5", - "@types/sinon": "10.0.20", - "@types/webpack-env": "1.16.3", - "babel-loader": "8.3.0", - "codecov": "3.8.3", - "cross-var": "1.1.0", - "karma": "6.4.2", - "karma-chrome-launcher": "3.1.0", - "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.36", - "karma-webpack": "4.0.2", - "lerna": "6.6.2", - "mocha": "10.2.0", - "nyc": "15.1.0", - "sinon": "15.1.2", - "ts-loader": "8.4.0", - "ts-mocha": "10.0.0", - "typescript": "4.4.4", - "webpack": "5.89.0", - "webpack-cli": "5.1.4", - "webpack-merge": "5.10.0", - "zone.js": "^0.11.0" - }, - "dependencies": { - "@webpack-cli/configtest": { - "version": "2.1.1", - "dev": true, - "requires": {} - }, - "@webpack-cli/info": { - "version": "2.0.2", - "dev": true, - "requires": {} - }, - "@webpack-cli/serve": { - "version": "2.0.5", - "dev": true, - "requires": {} - }, - "commander": { - "version": "10.0.1", - "dev": true - }, - "cross-spawn": { - "version": "7.0.3", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "enhanced-resolve": { - "version": "5.15.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.4", - "tapable": "^2.2.0" - } - }, - "interpret": { - "version": "3.1.1", - "dev": true - }, - "rechoir": { - "version": "0.8.0", - "dev": true, - "requires": { - "resolve": "^1.20.0" - } - }, - "shebang-command": { - "version": "2.0.0", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "dev": true - }, - "tapable": { - "version": "2.2.1", - "dev": true - }, - "terser-webpack-plugin": { - "version": "5.3.9", - "dev": true, - "requires": { - "@jridgewell/trace-mapping": "^0.3.17", - "jest-worker": "^27.4.5", - "schema-utils": "^3.1.1", - "serialize-javascript": "^6.0.1", - "terser": "^5.16.8" - } - }, - "webpack": { - "version": "5.89.0", - "dev": true, - "requires": { - "@types/eslint-scope": "^3.7.3", - "@types/estree": "^1.0.0", - "@webassemblyjs/ast": "^1.11.5", - "@webassemblyjs/wasm-edit": "^1.11.5", - "@webassemblyjs/wasm-parser": "^1.11.5", - "acorn": "^8.7.1", - "acorn-import-assertions": "^1.9.0", - "browserslist": "^4.14.5", - "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.15.0", - "es-module-lexer": "^1.2.1", - "eslint-scope": "5.1.1", - "events": "^3.2.0", - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.2.9", - "json-parse-even-better-errors": "^2.3.1", - "loader-runner": "^4.2.0", - "mime-types": "^2.1.27", - "neo-async": "^2.6.2", - "schema-utils": "^3.2.0", - "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.7", - "watchpack": "^2.4.0", - "webpack-sources": "^3.2.3" - } - }, - "webpack-cli": { - "version": "5.1.4", - "dev": true, - "requires": { - "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^2.1.1", - "@webpack-cli/info": "^2.0.2", - "@webpack-cli/serve": "^2.0.5", - "colorette": "^2.0.14", - "commander": "^10.0.1", - "cross-spawn": "^7.0.3", - "envinfo": "^7.7.3", - "fastest-levenshtein": "^1.0.12", - "import-local": "^3.0.2", - "interpret": "^3.1.1", - "rechoir": "^0.8.0", - "webpack-merge": "^5.7.3" - } - }, - "webpack-sources": { - "version": "3.2.3", - "dev": true - }, - "which": { - "version": "2.0.2", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, + "@opentelemetry/context-async-hooks": { + "version": "file:packages/opentelemetry-context-async-hooks", + "requires": { + "@opentelemetry/api": ">=1.0.0 <1.8.0", + "@types/mocha": "10.0.6", + "@types/node": "18.6.5", + "codecov": "3.8.3", + "cross-var": "1.1.0", + "lerna": "6.6.2", + "mocha": "10.2.0", + "nyc": "15.1.0", + "ts-mocha": "10.0.0", + "typescript": "4.4.4" + } + }, + "@opentelemetry/context-zone": { + "version": "file:packages/opentelemetry-context-zone", + "requires": { + "@opentelemetry/context-zone-peer-dep": "1.21.0", + "cross-var": "1.1.0", + "lerna": "6.6.2", + "typescript": "4.4.4", + "zone.js": "^0.11.0" + } + }, "@opentelemetry/context-zone-peer-dep": { "version": "file:packages/opentelemetry-context-zone-peer-dep", "requires": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": ">=1.0.0 <1.8.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -39331,7 +39238,7 @@ "typescript": "4.4.4", "webpack": "5.89.0", "webpack-cli": "5.1.4", - "zone.js": "0.11.4" + "zone.js": "0.13.3" }, "dependencies": { "@webpack-cli/configtest": { @@ -39468,10 +39375,12 @@ } }, "zone.js": { - "version": "0.11.4", + "version": "0.13.3", + "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.13.3.tgz", + "integrity": "sha512-MKPbmZie6fASC/ps4dkmIhaT5eonHkEt6eAy80K42tAm0G2W+AahLJjbfi6X9NPdciOE9GRFTTM8u2IiF6O3ww==", "dev": true, "requires": { - "tslib": "^2.0.0" + "tslib": "^2.3.0" } } } @@ -39480,7 +39389,7 @@ "version": "file:packages/opentelemetry-core", "requires": { "@opentelemetry/api": ">=1.0.0 <1.8.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -39567,10 +39476,10 @@ "version": "file:packages/opentelemetry-exporter-jaeger", "requires": { "@opentelemetry/api": "^1.0.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -39589,17 +39498,16 @@ "@opentelemetry/exporter-logs-otlp-grpc": { "version": "file:experimental/packages/exporter-logs-otlp-grpc", "requires": { - "@babel/core": "7.23.6", "@grpc/grpc-js": "^1.7.1", "@grpc/proto-loader": "^0.7.10", "@opentelemetry/api": "1.7.0", - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-logs": "0.47.0", + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-logs": "0.48.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -39619,13 +39527,14 @@ "version": "file:experimental/packages/exporter-logs-otlp-http", "requires": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-logs": "0.47.0", + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-logs": "0.48.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -39792,15 +39701,16 @@ "version": "file:experimental/packages/exporter-logs-otlp-proto", "requires": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-proto-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-logs": "0.47.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-proto-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-logs": "0.48.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -39964,16 +39874,15 @@ "@opentelemetry/exporter-metrics-otlp-grpc": { "version": "file:experimental/packages/opentelemetry-exporter-metrics-otlp-grpc", "requires": { - "@babel/core": "7.23.6", "@grpc/grpc-js": "^1.7.1", "@grpc/proto-loader": "^0.7.10", "@opentelemetry/api": "1.7.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.47.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.48.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -39993,12 +39902,13 @@ "version": "file:experimental/packages/opentelemetry-exporter-metrics-otlp-http", "requires": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -40164,15 +40074,14 @@ "@opentelemetry/exporter-metrics-otlp-proto": { "version": "file:experimental/packages/opentelemetry-exporter-metrics-otlp-proto", "requires": { - "@babel/core": "7.23.6", "@opentelemetry/api": "1.7.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.47.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-proto-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.48.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-proto-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -40192,10 +40101,10 @@ "version": "file:experimental/packages/opentelemetry-exporter-prometheus", "requires": { "@opentelemetry/api": "1.7.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -40212,16 +40121,15 @@ "@opentelemetry/exporter-trace-otlp-grpc": { "version": "file:experimental/packages/exporter-trace-otlp-grpc", "requires": { - "@babel/core": "7.23.6", "@grpc/grpc-js": "^1.7.1", "@grpc/proto-loader": "^0.7.10", "@opentelemetry/api": "1.7.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -40241,12 +40149,13 @@ "version": "file:experimental/packages/exporter-trace-otlp-http", "requires": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -40413,13 +40322,14 @@ "version": "file:experimental/packages/exporter-trace-otlp-proto", "requires": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-proto-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-proto-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -40584,11 +40494,12 @@ "version": "file:packages/opentelemetry-exporter-zipkin", "requires": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "^1.0.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -40755,8 +40666,9 @@ "version": "file:experimental/packages/opentelemetry-instrumentation", "requires": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/sdk-metrics": "1.20.0", + "@opentelemetry/sdk-metrics": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/semver": "7.5.6", @@ -40768,7 +40680,7 @@ "codecov": "3.8.3", "cpx": "1.5.0", "cross-var": "1.1.0", - "import-in-the-middle": "^1.7.2", + "import-in-the-middle": "1.7.1", "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", "karma-coverage": "2.2.1", @@ -40826,6 +40738,17 @@ "tapable": "^2.2.0" } }, + "import-in-the-middle": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-1.7.1.tgz", + "integrity": "sha512-1LrZPDtW+atAxH42S6288qyDFNQ2YCty+2mxEPRtfazH6Z5QwkaBSTS2ods7hnVJioF6rkRfNoA6A/MstpFXLg==", + "requires": { + "acorn": "^8.8.2", + "acorn-import-assertions": "^1.9.0", + "cjs-module-lexer": "^1.2.2", + "module-details-from-path": "^1.0.3" + } + }, "interpret": { "version": "3.1.1", "dev": true @@ -40929,14 +40852,15 @@ "version": "file:experimental/packages/opentelemetry-instrumentation-fetch", "requires": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-zone": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-web": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/context-zone": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-web": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -41105,12 +41029,12 @@ "@grpc/grpc-js": "^1.7.1", "@grpc/proto-loader": "^0.7.10", "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@protobuf-ts/grpc-transport": "2.9.3", "@protobuf-ts/runtime": "2.9.3", "@protobuf-ts/runtime-rpc": "2.9.3", @@ -41133,13 +41057,13 @@ "version": "file:experimental/packages/opentelemetry-instrumentation-http", "requires": { "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/request-promise-native": "1.0.21", @@ -41177,14 +41101,15 @@ "version": "file:experimental/packages/opentelemetry-instrumentation-xml-http-request", "requires": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-zone": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-web": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/context-zone": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-web": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -41346,13 +41271,252 @@ } } }, + "@opentelemetry/integration-tests-api": { + "version": "file:integration-tests/api", + "requires": { + "@opentelemetry/api": "^1.0.0", + "@types/mocha": "9.1.1", + "@types/node": "18.6.5", + "codecov": "3.8.3", + "cross-var": "1.1.0", + "lerna": "6.6.2", + "mocha": "10.0.0", + "nyc": "15.1.0" + }, + "dependencies": { + "@types/mocha": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz", + "integrity": "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==", + "dev": true + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "optional": true + }, + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "mocha": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.0.0.tgz", + "integrity": "sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA==", + "dev": true, + "requires": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.3", + "debug": "4.3.4", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.2.0", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "5.0.1", + "ms": "2.1.3", + "nanoid": "3.3.3", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "workerpool": "6.2.1", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "dependencies": { + "minimatch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + } + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + } + } + }, "@opentelemetry/opentelemetry-browser-detector": { "version": "file:experimental/packages/opentelemetry-browser-detector", "requires": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -41516,8 +41680,9 @@ "version": "file:experimental/packages/otlp-exporter-base", "requires": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/core": "1.20.0", + "@opentelemetry/core": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -41680,14 +41845,13 @@ "@opentelemetry/otlp-grpc-exporter-base": { "version": "file:experimental/packages/otlp-grpc-exporter-base", "requires": { - "@babel/core": "7.23.6", "@grpc/grpc-js": "^1.7.1", "@opentelemetry/api": "1.7.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", - "@opentelemetry/otlp-transformer": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", + "@opentelemetry/otlp-transformer": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -41709,9 +41873,10 @@ "version": "file:experimental/packages/otlp-proto-exporter-base", "requires": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/otlp-exporter-base": "0.47.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/otlp-exporter-base": "0.48.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -41732,12 +41897,12 @@ "version": "file:experimental/packages/otlp-transformer", "requires": { "@opentelemetry/api": "1.7.0", - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-logs": "0.47.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-logs": "0.48.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/webpack-env": "1.16.3", "babel-plugin-istanbul": "6.1.1", @@ -41821,7 +41986,7 @@ "version": "file:packages/opentelemetry-propagator-b3", "requires": { "@opentelemetry/api": ">=1.0.0 <1.8.0", - "@opentelemetry/core": "1.20.0", + "@opentelemetry/core": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "codecov": "3.8.3", @@ -41838,7 +42003,7 @@ "version": "file:packages/opentelemetry-propagator-jaeger", "requires": { "@opentelemetry/api": ">=1.0.0 <1.8.0", - "@opentelemetry/core": "1.20.0", + "@opentelemetry/core": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -41925,9 +42090,9 @@ "version": "file:packages/opentelemetry-resources", "requires": { "@opentelemetry/api": ">=1.0.0 <1.8.0", - "@opentelemetry/core": "1.20.0", + "@opentelemetry/core": "1.21.0", "@opentelemetry/resources_1.9.0": "npm:@opentelemetry/resources@1.9.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -42113,10 +42278,11 @@ "version": "file:experimental/packages/sdk-logs", "requires": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": ">=1.4.0 <1.8.0", - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", "@opentelemetry/resources_1.9.0": "npm:@opentelemetry/resources@1.9.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -42314,9 +42480,10 @@ "version": "file:packages/sdk-metrics", "requires": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": ">=1.3.0 <1.8.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", "@types/lodash.merge": "4.6.9", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -42482,21 +42649,21 @@ "version": "file:experimental/packages/opentelemetry-sdk-node", "requires": { "@opentelemetry/api": "1.7.0", - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-jaeger": "1.20.0", - "@opentelemetry/exporter-trace-otlp-grpc": "0.47.0", - "@opentelemetry/exporter-trace-otlp-http": "0.47.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.47.0", - "@opentelemetry/exporter-zipkin": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-logs": "0.47.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-jaeger": "1.21.0", + "@opentelemetry/exporter-trace-otlp-grpc": "0.48.0", + "@opentelemetry/exporter-trace-otlp-http": "0.48.0", + "@opentelemetry/exporter-trace-otlp-proto": "0.48.0", + "@opentelemetry/exporter-zipkin": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-logs": "0.48.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/semver": "7.5.6", @@ -42517,9 +42684,9 @@ "version": "file:packages/opentelemetry-sdk-trace-base", "requires": { "@opentelemetry/api": ">=1.0.0 <1.8.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -42607,13 +42774,13 @@ "version": "file:packages/opentelemetry-sdk-trace-node", "requires": { "@opentelemetry/api": ">=1.0.0 <1.8.0", - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/propagator-jaeger": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/propagator-jaeger": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/semver": "7.5.6", @@ -42633,13 +42800,14 @@ "version": "file:packages/opentelemetry-sdk-trace-web", "requires": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": ">=1.0.0 <1.8.0", - "@opentelemetry/context-zone": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/context-zone": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/jquery": "3.5.29", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -42813,16 +42981,16 @@ "@babel/plugin-transform-runtime": "7.22.15", "@babel/preset-env": "7.22.20", "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-zone-peer-dep": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-trace-otlp-http": "0.47.0", - "@opentelemetry/exporter-zipkin": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/instrumentation-fetch": "0.47.0", - "@opentelemetry/instrumentation-xml-http-request": "0.47.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-web": "1.20.0", + "@opentelemetry/context-zone-peer-dep": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-trace-otlp-http": "0.48.0", + "@opentelemetry/exporter-zipkin": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/instrumentation-fetch": "0.48.0", + "@opentelemetry/instrumentation-xml-http-request": "0.48.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-web": "1.21.0", "babel-loader": "8.3.0", "babel-polyfill": "6.26.0", "browserstack-local": "1.4.8", @@ -43154,11 +43322,11 @@ "requires": { "@opencensus/core": "0.1.0", "@opentelemetry/api": "1.7.0", - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -43178,11 +43346,11 @@ "version": "file:packages/opentelemetry-shim-opentracing", "requires": { "@opentelemetry/api": ">=1.0.0 <1.8.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/propagator-jaeger": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/propagator-jaeger": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "codecov": "3.8.3", @@ -45766,8 +45934,8 @@ "backcompat-node14": { "version": "file:experimental/backwards-compatibility/node14", "requires": { - "@opentelemetry/sdk-node": "0.47.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/sdk-node": "0.48.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/node": "14.18.25", "typescript": "4.4.4" }, @@ -45781,8 +45949,8 @@ "backcompat-node16": { "version": "file:experimental/backwards-compatibility/node16", "requires": { - "@opentelemetry/sdk-node": "0.47.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/sdk-node": "0.48.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/node": "16.11.52", "typescript": "4.4.4" }, @@ -48281,13 +48449,13 @@ "version": "file:examples/esm-http-ts", "requires": { "@opentelemetry/api": "1.7.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.47.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/instrumentation-http": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/exporter-trace-otlp-proto": "0.48.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/instrumentation-http": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" } }, "espree": { @@ -48391,17 +48559,17 @@ "version": "file:examples/otlp-exporter-node", "requires": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-metrics-otlp-grpc": "0.47.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.47.0", - "@opentelemetry/exporter-metrics-otlp-proto": "0.47.0", - "@opentelemetry/exporter-trace-otlp-grpc": "0.47.0", - "@opentelemetry/exporter-trace-otlp-http": "0.47.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-metrics-otlp-grpc": "0.48.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.48.0", + "@opentelemetry/exporter-metrics-otlp-proto": "0.48.0", + "@opentelemetry/exporter-trace-otlp-grpc": "0.48.0", + "@opentelemetry/exporter-trace-otlp-http": "0.48.0", + "@opentelemetry/exporter-trace-otlp-proto": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" } }, "execa": { @@ -49894,14 +50062,14 @@ "version": "file:examples/http", "requires": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/exporter-jaeger": "1.20.0", - "@opentelemetry/exporter-zipkin": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/instrumentation-http": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/exporter-jaeger": "1.21.0", + "@opentelemetry/exporter-zipkin": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/instrumentation-http": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "cross-env": "^6.0.0" } }, @@ -49987,14 +50155,14 @@ "version": "file:examples/https", "requires": { "@opentelemetry/api": "^1.0.0", - "@opentelemetry/exporter-jaeger": "1.20.0", - "@opentelemetry/exporter-zipkin": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/instrumentation-http": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/exporter-jaeger": "1.21.0", + "@opentelemetry/exporter-zipkin": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/instrumentation-http": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "cross-env": "^6.0.0" } }, @@ -50061,17 +50229,6 @@ } } }, - "import-in-the-middle": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-1.7.2.tgz", - "integrity": "sha512-coz7AjRnPyKW36J6JX5Bjz1mcX7MX1H2XsEGseVcnXMdzsAbbAu0HBZhiAem+3SAmuZdi+p8OwoB2qUpTRgjOQ==", - "requires": { - "acorn": "^8.8.2", - "acorn-import-assertions": "^1.9.0", - "cjs-module-lexer": "^1.2.2", - "module-details-from-path": "^1.0.3" - } - }, "import-local": { "version": "3.1.0", "dev": true, @@ -51727,8 +51884,8 @@ "version": "file:experimental/examples/logs", "requires": { "@opentelemetry/api": "^1.7.0", - "@opentelemetry/api-logs": "0.47.0", - "@opentelemetry/sdk-logs": "0.47.0", + "@opentelemetry/api-logs": "0.48.0", + "@opentelemetry/sdk-logs": "0.48.0", "@types/node": "18.6.5", "ts-node": "^10.9.1" }, @@ -54131,13 +54288,13 @@ "@opencensus/instrumentation-http": "0.1.0", "@opencensus/nodejs-base": "0.1.0", "@opentelemetry/api": "1.7.0", - "@opentelemetry/exporter-prometheus": "0.47.0", - "@opentelemetry/exporter-trace-otlp-grpc": "0.47.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-node": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", - "@opentelemetry/shim-opencensus": "0.47.0" + "@opentelemetry/exporter-prometheus": "0.48.0", + "@opentelemetry/exporter-trace-otlp-grpc": "0.48.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-node": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", + "@opentelemetry/shim-opencensus": "0.48.0" } }, "opentracing": { @@ -54870,8 +55027,8 @@ "version": "file:experimental/examples/prometheus", "requires": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/exporter-prometheus": "0.47.0", - "@opentelemetry/sdk-metrics": "1.20.0" + "@opentelemetry/exporter-prometheus": "0.48.0", + "@opentelemetry/sdk-metrics": "1.21.0" } }, "promise-all-reject-late": { @@ -54909,9 +55066,9 @@ "version": "file:integration-tests/propagation-validation-server", "requires": { "@opentelemetry/api": "^1.0.0", - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "axios": "1.5.1", "body-parser": "1.19.0", "express": "4.17.3", @@ -58312,22 +58469,23 @@ "web-opentelemetry-example": { "version": "file:examples/opentelemetry-web", "requires": { - "@babel/core": "^7.6.0", + "@babel/core": "^7.23.6", + "@babel/preset-env": "^7.22.20", "@opentelemetry/api": "^1.3.0", - "@opentelemetry/context-zone": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.47.0", - "@opentelemetry/exporter-trace-otlp-http": "0.47.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.47.0", - "@opentelemetry/exporter-zipkin": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/instrumentation-fetch": "0.47.0", - "@opentelemetry/instrumentation-xml-http-request": "0.47.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-web": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/context-zone": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.48.0", + "@opentelemetry/exporter-trace-otlp-http": "0.48.0", + "@opentelemetry/exporter-trace-otlp-proto": "0.48.0", + "@opentelemetry/exporter-zipkin": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/instrumentation-fetch": "0.48.0", + "@opentelemetry/instrumentation-xml-http-request": "0.48.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-web": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "babel-loader": "^8.0.6", "ts-loader": "^9.2.6", "typescript": "^4.5.2", diff --git a/packages/opentelemetry-context-async-hooks/package.json b/packages/opentelemetry-context-async-hooks/package.json index 13c5f2ac5e0..0a4990bfe1b 100644 --- a/packages/opentelemetry-context-async-hooks/package.json +++ b/packages/opentelemetry-context-async-hooks/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/context-async-hooks", - "version": "1.20.0", + "version": "1.21.0", "description": "OpenTelemetry AsyncHooks-based Context Manager", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/packages/opentelemetry-context-zone-peer-dep/package.json b/packages/opentelemetry-context-zone-peer-dep/package.json index d183ebeec8a..53c143ba17d 100644 --- a/packages/opentelemetry-context-zone-peer-dep/package.json +++ b/packages/opentelemetry-context-zone-peer-dep/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/context-zone-peer-dep", - "version": "1.20.0", + "version": "1.21.0", "description": "OpenTelemetry Context Zone with peer dependency for zone.js", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -54,6 +54,7 @@ }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": ">=1.0.0 <1.8.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -79,11 +80,11 @@ "typescript": "4.4.4", "webpack": "5.89.0", "webpack-cli": "5.1.4", - "zone.js": "0.11.4" + "zone.js": "0.13.3" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.8.0", - "zone.js": "^0.10.2 || ^0.11.0" + "zone.js": "^0.10.2 || ^0.11.0 || ^0.13.0" }, "sideEffects": false, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-context-zone-peer-dep" diff --git a/packages/opentelemetry-context-zone/package.json b/packages/opentelemetry-context-zone/package.json index 06beae1a0c2..b09c844e953 100644 --- a/packages/opentelemetry-context-zone/package.json +++ b/packages/opentelemetry-context-zone/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/context-zone", - "version": "1.20.0", + "version": "1.21.0", "description": "OpenTelemetry Context Zone", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -50,32 +50,12 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.23.6", - "@types/mocha": "10.0.6", - "@types/node": "18.6.5", - "@types/sinon": "10.0.20", - "@types/webpack-env": "1.16.3", - "babel-loader": "8.3.0", - "codecov": "3.8.3", "cross-var": "1.1.0", - "karma": "6.4.2", - "karma-chrome-launcher": "3.1.0", - "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.36", - "karma-webpack": "4.0.2", "lerna": "6.6.2", - "mocha": "10.2.0", - "nyc": "15.1.0", - "sinon": "15.1.2", - "ts-loader": "8.4.0", - "ts-mocha": "10.0.0", - "typescript": "4.4.4", - "webpack": "5.89.0", - "webpack-cli": "5.1.4", - "webpack-merge": "5.10.0" + "typescript": "4.4.4" }, "dependencies": { - "@opentelemetry/context-zone-peer-dep": "1.20.0", + "@opentelemetry/context-zone-peer-dep": "1.21.0", "zone.js": "^0.11.0" }, "sideEffects": true, diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json index cd69f8139d9..8352567ceaa 100644 --- a/packages/opentelemetry-core/package.json +++ b/packages/opentelemetry-core/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/core", - "version": "1.20.0", + "version": "1.21.0", "description": "OpenTelemetry Core provides constants and utilities shared by all OpenTelemetry SDK packages.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -91,7 +91,7 @@ "@opentelemetry/api": ">=1.0.0 <1.8.0" }, "dependencies": { - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/semantic-conventions": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-core", "sideEffects": false diff --git a/packages/opentelemetry-core/src/platform/node/environment.ts b/packages/opentelemetry-core/src/platform/node/environment.ts index 749633f08ba..48658693fe8 100644 --- a/packages/opentelemetry-core/src/platform/node/environment.ts +++ b/packages/opentelemetry-core/src/platform/node/environment.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import * as os from 'os'; import { DEFAULT_ENVIRONMENT, ENVIRONMENT, @@ -27,11 +26,5 @@ import { */ export function getEnv(): Required { const processEnv = parseEnvironment(process.env as RAW_ENVIRONMENT); - return Object.assign( - { - HOSTNAME: os.hostname(), - }, - DEFAULT_ENVIRONMENT, - processEnv - ); + return Object.assign({}, DEFAULT_ENVIRONMENT, processEnv); } diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json index dc6151b48d5..9c902b882f0 100644 --- a/packages/opentelemetry-exporter-jaeger/package.json +++ b/packages/opentelemetry-exporter-jaeger/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-jaeger", - "version": "1.20.0", + "version": "1.21.0", "description": "OpenTelemetry Exporter Jaeger allows user to send collected traces to Jaeger", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -45,7 +45,7 @@ }, "devDependencies": { "@opentelemetry/api": "^1.0.0", - "@opentelemetry/resources": "1.20.0", + "@opentelemetry/resources": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/sinon": "10.0.20", @@ -63,9 +63,9 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "jaeger-client": "^3.15.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-exporter-jaeger", diff --git a/packages/opentelemetry-exporter-zipkin/package.json b/packages/opentelemetry-exporter-zipkin/package.json index 2a13d614367..1c815a03298 100644 --- a/packages/opentelemetry-exporter-zipkin/package.json +++ b/packages/opentelemetry-exporter-zipkin/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-zipkin", - "version": "1.20.0", + "version": "1.21.0", "description": "OpenTelemetry Zipkin Exporter allows the user to send collected traces to Zipkin.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -61,6 +61,7 @@ }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "^1.0.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -92,10 +93,10 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-exporter-zipkin", "sideEffects": false diff --git a/packages/opentelemetry-exporter-zipkin/src/version.js b/packages/opentelemetry-exporter-zipkin/src/version.js deleted file mode 100644 index 2090d63abf3..00000000000 --- a/packages/opentelemetry-exporter-zipkin/src/version.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -/* - * 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. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.VERSION = void 0; -// this is autogenerated file, see scripts/version-update.js -exports.VERSION = '1.16.0'; diff --git a/packages/opentelemetry-propagator-b3/package.json b/packages/opentelemetry-propagator-b3/package.json index cfccc129edc..fa26ac2ef52 100644 --- a/packages/opentelemetry-propagator-b3/package.json +++ b/packages/opentelemetry-propagator-b3/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/propagator-b3", - "version": "1.20.0", + "version": "1.21.0", "description": "OpenTelemetry B3 propagator provides context propagation for systems that are using the B3 header format", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -51,7 +51,7 @@ "access": "public" }, "dependencies": { - "@opentelemetry/core": "1.20.0" + "@opentelemetry/core": "1.21.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.8.0" diff --git a/packages/opentelemetry-propagator-jaeger/package.json b/packages/opentelemetry-propagator-jaeger/package.json index 71d9dec1a5c..d29a95eb126 100644 --- a/packages/opentelemetry-propagator-jaeger/package.json +++ b/packages/opentelemetry-propagator-jaeger/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/propagator-jaeger", - "version": "1.20.0", + "version": "1.21.0", "description": "OpenTelemetry Jaeger propagator provides HTTP header propagation for systems that are using Jaeger HTTP header format.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -81,7 +81,7 @@ "@opentelemetry/api": ">=1.0.0 <1.8.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0" + "@opentelemetry/core": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-propagator-jaeger", "sideEffects": false diff --git a/packages/opentelemetry-resources/package.json b/packages/opentelemetry-resources/package.json index faa68d9cbb8..0ecb875cdd2 100644 --- a/packages/opentelemetry-resources/package.json +++ b/packages/opentelemetry-resources/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resources", - "version": "1.20.0", + "version": "1.21.0", "description": "OpenTelemetry SDK resources", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -91,8 +91,8 @@ "@opentelemetry/api": ">=1.0.0 <1.8.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-resources", "sideEffects": false diff --git a/packages/opentelemetry-sdk-trace-base/package.json b/packages/opentelemetry-sdk-trace-base/package.json index d07fe339910..4dedb26a3b0 100644 --- a/packages/opentelemetry-sdk-trace-base/package.json +++ b/packages/opentelemetry-sdk-trace-base/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-trace-base", - "version": "1.20.0", + "version": "1.21.0", "description": "OpenTelemetry Tracing", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -93,9 +93,9 @@ "@opentelemetry/api": ">=1.0.0 <1.8.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-base", "sideEffects": false diff --git a/packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts b/packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts index fef5c80dc0f..f069aac0c7d 100644 --- a/packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts +++ b/packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts @@ -221,7 +221,7 @@ export abstract class BatchSpanProcessorBase const flush = () => { this._isExporting = true; this._flushOneBatch() - .then(() => { + .finally(() => { this._isExporting = false; if (this._finishedSpans.length > 0) { this._clearTimer(); diff --git a/packages/opentelemetry-sdk-trace-base/test/common/Tracer.test.ts b/packages/opentelemetry-sdk-trace-base/test/common/Tracer.test.ts index 359816874dd..9d5d07ea144 100644 --- a/packages/opentelemetry-sdk-trace-base/test/common/Tracer.test.ts +++ b/packages/opentelemetry-sdk-trace-base/test/common/Tracer.test.ts @@ -28,7 +28,6 @@ import { TraceFlags, TraceState, } from '@opentelemetry/api'; -import { getSpan } from '@opentelemetry/api/build/src/trace/context-utils'; import { InstrumentationLibrary, sanitizeAttributes, @@ -303,7 +302,7 @@ describe('Tracer', () => { const samplerContext = shouldSampleSpy.firstCall.args[0]; const processorContext = onStartSpy.firstCall.args[1]; assert.strictEqual(samplerContext, processorContext); - assert.strictEqual(getSpan(samplerContext), undefined); + assert.strictEqual(trace.getSpan(samplerContext), undefined); }); it('should sample a trace when OTEL_TRACES_SAMPLER_ARG is unset', () => { @@ -361,7 +360,7 @@ describe('Tracer', () => { tracer.startActiveSpan('my-span', span => { try { assert(spy.calledWith('my-span')); - assert.strictEqual(getSpan(context.active()), span); + assert.strictEqual(trace.getSpan(context.active()), span); return 1; } finally { span.end(); @@ -387,7 +386,7 @@ describe('Tracer', () => { span => { try { assert(spy.calledWith('my-span', { attributes: { foo: 'bar' } })); - assert.strictEqual(getSpan(context.active()), span); + assert.strictEqual(trace.getSpan(context.active()), span); return 1; } finally { span.end(); @@ -421,7 +420,7 @@ describe('Tracer', () => { assert( spy.calledWith('my-span', { attributes: { foo: 'bar' } }, ctx) ); - assert.strictEqual(getSpan(context.active()), span); + assert.strictEqual(trace.getSpan(context.active()), span); assert.strictEqual(ctx.getValue(ctxKey), 'bar'); return 1; } finally { diff --git a/packages/opentelemetry-sdk-trace-base/test/common/export/BatchSpanProcessorBase.test.ts b/packages/opentelemetry-sdk-trace-base/test/common/export/BatchSpanProcessorBase.test.ts index 83fb3ebe44f..251971385c1 100644 --- a/packages/opentelemetry-sdk-trace-base/test/common/export/BatchSpanProcessorBase.test.ts +++ b/packages/opentelemetry-sdk-trace-base/test/common/export/BatchSpanProcessorBase.test.ts @@ -387,6 +387,57 @@ describe('BatchSpanProcessorBase', () => { }); }); + it('should still export when previously failed', async () => { + // The scenario is made of several parts: + // 1. The exporter tries to export some spans + // 2. While it does so, more spans are processed + // 3. The exporter fails + // 4. Spans arriving during step 2 should be exported + + let firstCall = true; + const fillingExportStub = sinon + .stub(exporter, 'export') + .callsFake((spans, cb) => { + // The first time export is called, add some spans to the processor. + // Any other time, call through. We don't simply restore the stub + // so we can count the calls with `sinon.assert` + if (!firstCall) { + return fillingExportStub.wrappedMethod.call(exporter, spans, cb); + } + + // Step 2: During export, add another span + firstCall = false; + processSpan(); + + return fillingExportStub.wrappedMethod.call(exporter, spans, () => { + // Step 3: Mock failure + cb({ + code: ExportResultCode.FAILED, + }); + }); + }); + + const clock = sinon.useFakeTimers(); + + // Step 1: Export a span + processSpan(); + await clock.runAllAsync(); + + clock.restore(); + fillingExportStub.restore(); + + // Step 4: Make sure all spans were processed + assert.equal(exporter['_finishedSpans'].length, 2); + assert.equal(processor['_finishedSpans'].length, 0); + sinon.assert.calledTwice(fillingExportStub); + + function processSpan() { + const span = createSampledSpan('test'); + processor.onStart(span, ROOT_CONTEXT); + processor.onEnd(span); + } + }); + it('should wait for pending resource on flush', async () => { const tracer = new BasicTracerProvider({ resource: new Resource( diff --git a/packages/opentelemetry-sdk-trace-node/package.json b/packages/opentelemetry-sdk-trace-node/package.json index dda03d5c4ef..bd6c1774977 100644 --- a/packages/opentelemetry-sdk-trace-node/package.json +++ b/packages/opentelemetry-sdk-trace-node/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-trace-node", - "version": "1.20.0", + "version": "1.21.0", "description": "OpenTelemetry Node SDK provides automatic telemetry (tracing, metrics, etc) for Node.js applications", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -46,8 +46,8 @@ }, "devDependencies": { "@opentelemetry/api": ">=1.0.0 <1.8.0", - "@opentelemetry/resources": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/resources": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "@types/semver": "7.5.6", @@ -65,11 +65,11 @@ "@opentelemetry/api": ">=1.0.0 <1.8.0" }, "dependencies": { - "@opentelemetry/context-async-hooks": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/propagator-jaeger": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/context-async-hooks": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/propagator-jaeger": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "semver": "^7.5.2" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node", diff --git a/packages/opentelemetry-sdk-trace-web/package.json b/packages/opentelemetry-sdk-trace-web/package.json index 6d3da218afa..f7ebf99881d 100644 --- a/packages/opentelemetry-sdk-trace-web/package.json +++ b/packages/opentelemetry-sdk-trace-web/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-trace-web", - "version": "1.20.0", + "version": "1.21.0", "description": "OpenTelemetry Web Tracer", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -56,10 +56,11 @@ }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": ">=1.0.0 <1.8.0", - "@opentelemetry/context-zone": "1.20.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/resources": "1.20.0", + "@opentelemetry/context-zone": "1.21.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/resources": "1.21.0", "@types/jquery": "3.5.29", "@types/mocha": "10.0.6", "@types/node": "18.6.5", @@ -92,9 +93,9 @@ "@opentelemetry/api": ">=1.0.0 <1.8.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0" + "@opentelemetry/core": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-web", "sideEffects": false diff --git a/packages/opentelemetry-semantic-conventions/package.json b/packages/opentelemetry-semantic-conventions/package.json index 744f5c3236f..1ee7586da33 100644 --- a/packages/opentelemetry-semantic-conventions/package.json +++ b/packages/opentelemetry-semantic-conventions/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/semantic-conventions", - "version": "1.20.0", + "version": "1.21.0", "description": "OpenTelemetry semantic conventions", "main": "build/src/index.js", "module": "build/esm/index.js", diff --git a/packages/opentelemetry-shim-opentracing/package.json b/packages/opentelemetry-shim-opentracing/package.json index bb601392a3d..8cd0f414fee 100644 --- a/packages/opentelemetry-shim-opentracing/package.json +++ b/packages/opentelemetry-shim-opentracing/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/shim-opentracing", - "version": "1.20.0", + "version": "1.21.0", "description": "OpenTracing to OpenTelemetry shim", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -43,9 +43,9 @@ }, "devDependencies": { "@opentelemetry/api": ">=1.0.0 <1.8.0", - "@opentelemetry/propagator-b3": "1.20.0", - "@opentelemetry/propagator-jaeger": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", + "@opentelemetry/propagator-b3": "1.21.0", + "@opentelemetry/propagator-jaeger": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", "@types/mocha": "10.0.6", "@types/node": "18.6.5", "codecov": "3.8.3", @@ -60,8 +60,8 @@ "@opentelemetry/api": ">=1.0.0 <1.8.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/semantic-conventions": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/semantic-conventions": "1.21.0", "opentracing": "^0.14.4" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-shim-opentracing", diff --git a/packages/sdk-metrics/package.json b/packages/sdk-metrics/package.json index 95cbe1fc413..38495b57d3a 100644 --- a/packages/sdk-metrics/package.json +++ b/packages/sdk-metrics/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-metrics", - "version": "1.20.0", + "version": "1.21.0", "description": "OpenTelemetry metrics SDK", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -55,6 +55,7 @@ }, "devDependencies": { "@babel/core": "7.23.6", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": ">=1.3.0 <1.8.0", "@types/lodash.merge": "4.6.9", "@types/mocha": "10.0.6", @@ -84,8 +85,8 @@ "@opentelemetry/api": ">=1.3.0 <1.8.0" }, "dependencies": { - "@opentelemetry/core": "1.20.0", - "@opentelemetry/resources": "1.20.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/resources": "1.21.0", "lodash.merge": "^4.6.2" }, "homepage": "/~https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/sdk-metrics", diff --git a/packages/sdk-metrics/src/MeterProvider.ts b/packages/sdk-metrics/src/MeterProvider.ts index f10cf42b9b4..68d46057794 100644 --- a/packages/sdk-metrics/src/MeterProvider.ts +++ b/packages/sdk-metrics/src/MeterProvider.ts @@ -35,6 +35,7 @@ export interface MeterProviderOptions { /** Resource associated with metric telemetry */ resource?: IResource; views?: View[]; + readers?: MetricReader[]; } /** @@ -54,6 +55,12 @@ export class MeterProvider implements IMeterProvider { this._sharedState.viewRegistry.addView(view); } } + + if (options?.readers != null && options.readers.length > 0) { + for (const metricReader of options.readers) { + this.addMetricReader(metricReader); + } + } } /** @@ -77,7 +84,13 @@ export class MeterProvider implements IMeterProvider { * Register a {@link MetricReader} to the meter provider. After the * registration, the MetricReader can start metrics collection. * + *

NOTE: {@link MetricReader} instances MUST be added before creating any instruments. + * A {@link MetricReader} instance registered later may receive no or incomplete metric data. + * * @param metricReader the metric reader to be registered. + * + * @deprecated This method will be removed in SDK 2.0. Please use + * {@link MeterProviderOptions.readers} via the {@link MeterProvider} constructor instead */ addMetricReader(metricReader: MetricReader) { const collector = new MetricCollector(this._sharedState, metricReader); diff --git a/packages/sdk-metrics/src/version.js b/packages/sdk-metrics/src/version.js deleted file mode 100644 index 2090d63abf3..00000000000 --- a/packages/sdk-metrics/src/version.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -/* - * 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. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.VERSION = void 0; -// this is autogenerated file, see scripts/version-update.js -exports.VERSION = '1.16.0'; diff --git a/packages/sdk-metrics/test/Instruments.test.ts b/packages/sdk-metrics/test/Instruments.test.ts index 56ecf03af67..ab466c295a1 100644 --- a/packages/sdk-metrics/test/Instruments.test.ts +++ b/packages/sdk-metrics/test/Instruments.test.ts @@ -751,7 +751,12 @@ describe('Instruments', () => { }); function setup() { - const meterProvider = new MeterProvider({ resource: defaultResource }); + const deltaReader = new TestDeltaMetricReader(); + const cumulativeReader = new TestMetricReader(); + const meterProvider = new MeterProvider({ + resource: defaultResource, + readers: [deltaReader, cumulativeReader], + }); const meter = meterProvider.getMeter( defaultInstrumentationScope.name, defaultInstrumentationScope.version, @@ -759,10 +764,6 @@ function setup() { schemaUrl: defaultInstrumentationScope.schemaUrl, } ); - const deltaReader = new TestDeltaMetricReader(); - meterProvider.addMetricReader(deltaReader); - const cumulativeReader = new TestMetricReader(); - meterProvider.addMetricReader(cumulativeReader); return { meterProvider, diff --git a/packages/sdk-metrics/test/MeterProvider.test.ts b/packages/sdk-metrics/test/MeterProvider.test.ts index be075f0fa61..615fcffab30 100644 --- a/packages/sdk-metrics/test/MeterProvider.test.ts +++ b/packages/sdk-metrics/test/MeterProvider.test.ts @@ -73,9 +73,11 @@ describe('MeterProvider', () => { }); it('get meter with same identity', async () => { - const meterProvider = new MeterProvider({ resource: defaultResource }); const reader = new TestMetricReader(); - meterProvider.addMetricReader(reader); + const meterProvider = new MeterProvider({ + resource: defaultResource, + readers: [reader], + }); // Create meter and instrument, needs observation on instrument, otherwise the scope will not be reported. // name+version pair 1 @@ -131,6 +133,7 @@ describe('MeterProvider', () => { describe('addView', () => { it('with existing instrument should rename', async () => { + const reader = new TestMetricReader(); const meterProvider = new MeterProvider({ resource: defaultResource, // Add view to rename 'non-renamed-instrument' to 'renamed-instrument' @@ -141,11 +144,9 @@ describe('MeterProvider', () => { instrumentName: 'non-renamed-instrument', }), ], + readers: [reader], }); - const reader = new TestMetricReader(); - meterProvider.addMetricReader(reader); - // Create meter and instrument. const myMeter = meterProvider.getMeter('meter1', 'v1.0.0'); const counter = myMeter.createCounter('non-renamed-instrument'); @@ -200,6 +201,8 @@ describe('MeterProvider', () => { }); it('with attributeKeys should drop non-listed attributes', async () => { + const reader = new TestMetricReader(); + // Add view to drop all attributes except 'attrib1' const meterProvider = new MeterProvider({ resource: defaultResource, @@ -209,11 +212,9 @@ describe('MeterProvider', () => { instrumentName: 'non-renamed-instrument', }), ], + readers: [reader], }); - const reader = new TestMetricReader(); - meterProvider.addMetricReader(reader); - // Create meter and instrument. const myMeter = meterProvider.getMeter('meter1', 'v1.0.0'); const counter = myMeter.createCounter('non-renamed-instrument'); @@ -266,6 +267,8 @@ describe('MeterProvider', () => { }); it('with no meter name should apply view to instruments of all meters', async () => { + const reader = new TestMetricReader(); + // Add view that renames 'test-counter' to 'renamed-instrument' const meterProvider = new MeterProvider({ resource: defaultResource, @@ -275,11 +278,9 @@ describe('MeterProvider', () => { instrumentName: 'test-counter', }), ], + readers: [reader], }); - const reader = new TestMetricReader(); - meterProvider.addMetricReader(reader); - // Create two meters. const meter1 = meterProvider.getMeter('meter1', 'v1.0.0'); const meter2 = meterProvider.getMeter('meter2', 'v1.0.0'); @@ -339,6 +340,7 @@ describe('MeterProvider', () => { }); it('with meter name should apply view to only the selected meter', async () => { + const reader = new TestMetricReader(); const meterProvider = new MeterProvider({ resource: defaultResource, views: [ @@ -349,11 +351,9 @@ describe('MeterProvider', () => { meterName: 'meter1', }), ], + readers: [reader], }); - const reader = new TestMetricReader(); - meterProvider.addMetricReader(reader); - // Create two meters. const meter1 = meterProvider.getMeter('meter1', 'v1.0.0'); const meter2 = meterProvider.getMeter('meter2', 'v1.0.0'); @@ -413,6 +413,7 @@ describe('MeterProvider', () => { }); it('with different instrument types does not throw', async () => { + const reader = new TestMetricReader(); const meterProvider = new MeterProvider({ resource: defaultResource, // Add Views to rename both instruments (of different types) to the same name. @@ -428,9 +429,8 @@ describe('MeterProvider', () => { meterName: 'meter1', }), ], + readers: [reader], }); - const reader = new TestMetricReader(); - meterProvider.addMetricReader(reader); // Create meter and instruments. const meter = meterProvider.getMeter('meter1', 'v1.0.0'); @@ -481,6 +481,8 @@ describe('MeterProvider', () => { const msBoundaries = [0, 1, 2, 3, 4, 5]; const sBoundaries = [10, 50, 250, 1000]; + const reader = new TestMetricReader(); + const meterProvider = new MeterProvider({ resource: defaultResource, views: [ @@ -493,11 +495,9 @@ describe('MeterProvider', () => { aggregation: new ExplicitBucketHistogramAggregation(sBoundaries), }), ], + readers: [reader], }); - const reader = new TestMetricReader(); - meterProvider.addMetricReader(reader); - // Create meter and histograms, with different units. const meter = meterProvider.getMeter('meter1', 'v1.0.0'); const histogram1 = meter.createHistogram('test-histogram-ms', { @@ -543,14 +543,14 @@ describe('MeterProvider', () => { describe('shutdown', () => { it('should shutdown all registered metric readers', async () => { - const meterProvider = new MeterProvider({ resource: defaultResource }); const reader1 = new TestMetricReader(); const reader2 = new TestMetricReader(); const reader1ShutdownSpy = sinon.spy(reader1, 'shutdown'); const reader2ShutdownSpy = sinon.spy(reader2, 'shutdown'); - - meterProvider.addMetricReader(reader1); - meterProvider.addMetricReader(reader2); + const meterProvider = new MeterProvider({ + resource: defaultResource, + readers: [reader1, reader2], + }); await meterProvider.shutdown({ timeoutMillis: 1234 }); await meterProvider.shutdown(); @@ -569,14 +569,14 @@ describe('MeterProvider', () => { describe('forceFlush', () => { it('should forceFlush all registered metric readers', async () => { - const meterProvider = new MeterProvider({ resource: defaultResource }); const reader1 = new TestMetricReader(); const reader2 = new TestMetricReader(); const reader1ForceFlushSpy = sinon.spy(reader1, 'forceFlush'); const reader2ForceFlushSpy = sinon.spy(reader2, 'forceFlush'); - - meterProvider.addMetricReader(reader1); - meterProvider.addMetricReader(reader2); + const meterProvider = new MeterProvider({ + resource: defaultResource, + readers: [reader1, reader2], + }); await meterProvider.forceFlush({ timeoutMillis: 1234 }); await meterProvider.forceFlush({ timeoutMillis: 5678 }); diff --git a/packages/sdk-metrics/test/export/ConsoleMetricExporter.test.ts b/packages/sdk-metrics/test/export/ConsoleMetricExporter.test.ts index fe46fa9f71e..6409f6aa04a 100644 --- a/packages/sdk-metrics/test/export/ConsoleMetricExporter.test.ts +++ b/packages/sdk-metrics/test/export/ConsoleMetricExporter.test.ts @@ -50,7 +50,7 @@ describe('ConsoleMetricExporter', () => { let previousConsoleDir: any; let exporter: ConsoleMetricExporter; let meterProvider: MeterProvider; - let meterReader: PeriodicExportingMetricReader; + let metricReader: PeriodicExportingMetricReader; let meter: metrics.Meter; beforeEach(() => { @@ -58,20 +58,22 @@ describe('ConsoleMetricExporter', () => { console.dir = () => {}; exporter = new ConsoleMetricExporter(); - meterProvider = new MeterProvider({ resource: defaultResource }); - meter = meterProvider.getMeter('ConsoleMetricExporter', '1.0.0'); - meterReader = new PeriodicExportingMetricReader({ + metricReader = new PeriodicExportingMetricReader({ exporter: exporter, exportIntervalMillis: 100, exportTimeoutMillis: 100, }); - meterProvider.addMetricReader(meterReader); + meterProvider = new MeterProvider({ + resource: defaultResource, + readers: [metricReader], + }); + meter = meterProvider.getMeter('ConsoleMetricExporter', '1.0.0'); }); afterEach(async () => { console.dir = previousConsoleDir; - await meterReader.shutdown(); + await metricReader.shutdown(); }); it('should export information about metric', async () => { diff --git a/packages/sdk-metrics/test/export/InMemoryMetricExporter.test.ts b/packages/sdk-metrics/test/export/InMemoryMetricExporter.test.ts index 38a3f985869..1e14a8ed5e1 100644 --- a/packages/sdk-metrics/test/export/InMemoryMetricExporter.test.ts +++ b/packages/sdk-metrics/test/export/InMemoryMetricExporter.test.ts @@ -45,24 +45,26 @@ async function waitForNumberOfExports( describe('InMemoryMetricExporter', () => { let exporter: InMemoryMetricExporter; let meterProvider: MeterProvider; - let meterReader: PeriodicExportingMetricReader; + let metricReader: PeriodicExportingMetricReader; let meter: metrics.Meter; beforeEach(() => { exporter = new InMemoryMetricExporter(AggregationTemporality.CUMULATIVE); - meterProvider = new MeterProvider({ resource: defaultResource }); - meter = meterProvider.getMeter('InMemoryMetricExporter', '1.0.0'); - meterReader = new PeriodicExportingMetricReader({ + metricReader = new PeriodicExportingMetricReader({ exporter: exporter, exportIntervalMillis: 100, exportTimeoutMillis: 100, }); - meterProvider.addMetricReader(meterReader); + meterProvider = new MeterProvider({ + resource: defaultResource, + readers: [metricReader], + }); + meter = meterProvider.getMeter('InMemoryMetricExporter', '1.0.0'); }); afterEach(async () => { await exporter.shutdown(); - await meterReader.shutdown(); + await metricReader.shutdown(); }); it('should return failed result code', done => { @@ -85,7 +87,7 @@ describe('InMemoryMetricExporter', () => { }; exporter.export(resourceMetrics, result => { assert.ok(result.code === ExportResultCode.FAILED); - meterReader.shutdown().then(() => { + metricReader.shutdown().then(() => { done(); }); }); @@ -108,7 +110,7 @@ describe('InMemoryMetricExporter', () => { assert.ok(otherMetrics.length === 0); await exporter.shutdown(); - await meterReader.shutdown(); + await metricReader.shutdown(); }); it('should be able to access metric', async () => { @@ -146,6 +148,6 @@ describe('InMemoryMetricExporter', () => { const histogramDataPoint = histogramMetric.dataPoints.shift(); assert.ok(histogramDataPoint); - await meterReader.shutdown(); + await metricReader.shutdown(); }); }); diff --git a/packages/sdk-metrics/test/export/MetricReader.test.ts b/packages/sdk-metrics/test/export/MetricReader.test.ts index c0643a60da9..b08cde5e38d 100644 --- a/packages/sdk-metrics/test/export/MetricReader.test.ts +++ b/packages/sdk-metrics/test/export/MetricReader.test.ts @@ -73,16 +73,18 @@ describe('MetricReader', () => { describe('setMetricProducer', () => { it('The SDK MUST NOT allow a MetricReader instance to be registered on more than one MeterProvider instance', () => { const reader = new TestMetricReader(); - const meterProvider1 = new MeterProvider(); - const meterProvider2 = new MeterProvider(); - - meterProvider1.addMetricReader(reader); assert.throws( - () => meterProvider1.addMetricReader(reader), + () => + new MeterProvider({ + readers: [reader, reader], + }), /MetricReader can not be bound to a MeterProvider again/ ); assert.throws( - () => meterProvider2.addMetricReader(reader), + () => + new MeterProvider({ + readers: [reader], + }), /MetricReader can not be bound to a MeterProvider again/ ); }); @@ -138,7 +140,6 @@ describe('MetricReader', () => { }); it('should collect metrics from the SDK and the additional metricProducers', async () => { - const meterProvider = new MeterProvider({ resource: defaultResource }); const additionalProducer = new TestMetricProducer({ resourceMetrics: { resource: new Resource({ @@ -150,7 +151,10 @@ describe('MetricReader', () => { const reader = new TestMetricReader({ metricProducers: [additionalProducer], }); - meterProvider.addMetricReader(reader); + const meterProvider = new MeterProvider({ + resource: defaultResource, + readers: [reader], + }); // Make a measurement meterProvider @@ -182,14 +186,15 @@ describe('MetricReader', () => { }); it('should merge the errors from the SDK and all metricProducers', async () => { - const meterProvider = new MeterProvider(); const reader = new TestMetricReader({ metricProducers: [ new TestMetricProducer({ errors: ['err1'] }), new TestMetricProducer({ errors: ['err2'] }), ], }); - meterProvider.addMetricReader(reader); + const meterProvider = new MeterProvider({ + readers: [reader], + }); // Provide a callback throwing an error too meterProvider diff --git a/packages/sdk-metrics/test/regression/cumulative-exponential-histogram.test.ts b/packages/sdk-metrics/test/regression/cumulative-exponential-histogram.test.ts index 79dcfc434f0..2462ddf5c81 100644 --- a/packages/sdk-metrics/test/regression/cumulative-exponential-histogram.test.ts +++ b/packages/sdk-metrics/test/regression/cumulative-exponential-histogram.test.ts @@ -46,7 +46,6 @@ describe('cumulative-exponential-histogram', () => { }); const doTest = async (histogramAggregation: Aggregation) => { - const meterProvider = new MeterProvider(); const reader = new TestMetricReader({ aggregationTemporalitySelector() { return AggregationTemporality.CUMULATIVE; @@ -57,8 +56,10 @@ describe('cumulative-exponential-histogram', () => { : Aggregation.Default(); }, }); + const meterProvider = new MeterProvider({ + readers: [reader], + }); - meterProvider.addMetricReader(reader); const meter = meterProvider.getMeter('my-meter'); const hist = meter.createHistogram('testhist'); diff --git a/packages/sdk-metrics/test/regression/two-metric-readers-async-instrument.test.ts b/packages/sdk-metrics/test/regression/two-metric-readers-async-instrument.test.ts index a1301be0ecc..74913f9476b 100644 --- a/packages/sdk-metrics/test/regression/two-metric-readers-async-instrument.test.ts +++ b/packages/sdk-metrics/test/regression/two-metric-readers-async-instrument.test.ts @@ -23,12 +23,11 @@ import { assertDataPoint, assertMetricData } from '../util'; describe('two-metric-readers-async-instrument', () => { it('both metric readers should collect metrics', async () => { - const meterProvider = new MeterProvider(); const reader1 = new TestDeltaMetricReader(); const reader2 = new TestDeltaMetricReader(); - - meterProvider.addMetricReader(reader1); - meterProvider.addMetricReader(reader2); + const meterProvider = new MeterProvider({ + readers: [reader1, reader2], + }); const meter = meterProvider.getMeter('my-meter'); diff --git a/packages/sdk-metrics/test/state/MeterSharedState.test.ts b/packages/sdk-metrics/test/state/MeterSharedState.test.ts index 55f7fe5386c..9e814a4b439 100644 --- a/packages/sdk-metrics/test/state/MeterSharedState.test.ts +++ b/packages/sdk-metrics/test/state/MeterSharedState.test.ts @@ -48,8 +48,8 @@ describe('MeterSharedState', () => { const meterProvider = new MeterProvider({ resource: defaultResource, views, + readers: readers, }); - readers?.forEach(reader => meterProvider.addMetricReader(reader)); const meter = meterProvider.getMeter('test-meter'); @@ -185,19 +185,17 @@ describe('MeterSharedState', () => { describe('collect', () => { function setupInstruments(views?: View[]) { + const cumulativeReader = new TestMetricReader(); + const deltaReader = new TestDeltaMetricReader(); + const meterProvider = new MeterProvider({ resource: defaultResource, views: views, + readers: [cumulativeReader, deltaReader], }); - const cumulativeReader = new TestMetricReader(); - meterProvider.addMetricReader(cumulativeReader); const cumulativeCollector = cumulativeReader.getMetricCollector(); - - const deltaReader = new TestDeltaMetricReader(); - meterProvider.addMetricReader(deltaReader); const deltaCollector = deltaReader.getMetricCollector(); - const metricCollectors = [cumulativeCollector, deltaCollector]; const meter = meterProvider.getMeter( diff --git a/packages/sdk-metrics/test/state/MetricCollector.test.ts b/packages/sdk-metrics/test/state/MetricCollector.test.ts index 8466a5a95cc..f173a48446d 100644 --- a/packages/sdk-metrics/test/state/MetricCollector.test.ts +++ b/packages/sdk-metrics/test/state/MetricCollector.test.ts @@ -55,10 +55,12 @@ describe('MetricCollector', () => { describe('collect', () => { function setupInstruments() { - const meterProvider = new MeterProvider({ resource: defaultResource }); - const reader = new TestMetricReader(); - meterProvider.addMetricReader(reader); + const meterProvider = new MeterProvider({ + resource: defaultResource, + readers: [reader], + }); + const metricCollector = reader.getMetricCollector(); const meter = meterProvider.getMeter( diff --git a/packages/template/package.json b/packages/template/package.json index 7625de4c8bb..f144239f2e2 100644 --- a/packages/template/package.json +++ b/packages/template/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/template", - "version": "1.20.0", + "version": "1.21.0", "private": true, "publishConfig": { "access": "restricted" diff --git a/packages/template/src/version.js b/packages/template/src/version.js deleted file mode 100644 index 2090d63abf3..00000000000 --- a/packages/template/src/version.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -/* - * 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. - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.VERSION = void 0; -// this is autogenerated file, see scripts/version-update.js -exports.VERSION = '1.16.0'; diff --git a/selenium-tests/package.json b/selenium-tests/package.json index 551fe52f4c0..8af0f1f07d6 100644 --- a/selenium-tests/package.json +++ b/selenium-tests/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/selenium-tests", - "version": "1.21.0", + "version": "1.22.0", "private": true, "description": "OpenTelemetry Selenium Tests", "main": "index.js", @@ -56,16 +56,16 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/context-zone-peer-dep": "1.20.0", - "@opentelemetry/core": "1.20.0", - "@opentelemetry/exporter-trace-otlp-http": "0.47.0", - "@opentelemetry/exporter-zipkin": "1.20.0", - "@opentelemetry/instrumentation": "0.47.0", - "@opentelemetry/instrumentation-fetch": "0.47.0", - "@opentelemetry/instrumentation-xml-http-request": "0.47.0", - "@opentelemetry/sdk-metrics": "1.20.0", - "@opentelemetry/sdk-trace-base": "1.20.0", - "@opentelemetry/sdk-trace-web": "1.20.0", + "@opentelemetry/context-zone-peer-dep": "1.21.0", + "@opentelemetry/core": "1.21.0", + "@opentelemetry/exporter-trace-otlp-http": "0.48.0", + "@opentelemetry/exporter-zipkin": "1.21.0", + "@opentelemetry/instrumentation": "0.48.0", + "@opentelemetry/instrumentation-fetch": "0.48.0", + "@opentelemetry/instrumentation-xml-http-request": "0.48.0", + "@opentelemetry/sdk-metrics": "1.21.0", + "@opentelemetry/sdk-trace-base": "1.21.0", + "@opentelemetry/sdk-trace-web": "1.21.0", "zone.js": "0.11.4" } }