diff --git a/CHANGELOG.md b/CHANGELOG.md
index 84a21c4c5d..33c3c17e8d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,13 +19,26 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/
### :house: (Internal)
+## 1.9.1
+
+### :bug: (Bug Fix)
+
+* fix: avoid grpc types dependency [#3551](https://github.com/open-telemetry/opentelemetry-js/pull/3551) @flarna
+* fix(otlp-proto-exporter-base): Match Accept header with Content-Type in the proto exporter
+ [#3562](https://github.com/open-telemetry/opentelemetry-js/pull/3562) @scheler
+* fix: include tracestate in export [#3569](https://github.com/open-telemetry/opentelemetry-js/pull/3569) @flarna
+
+### :house: (Internal)
+
* chore: fix cross project links and missing implicitly exported types [#3533](https://github.com/open-telemetry/opentelemetry-js/pull/3533) @legendecas
+* feat(sdk-metrics): add exponential histogram mapping functions [#3504](https://github.com/open-telemetry/opentelemetry-js/pull/3504) @mwear
## 1.9.0
### :rocket: (Enhancement)
* feat(instrumentation-grpc): set net.peer.name and net.peer.port on client spans [#3430](https://github.com/open-telemetry/opentelemetry-js/pull/3430)
+* feat(exporter-trace-otlp-proto): Add protobuf otlp trace exporter support for browser [#3208](https://github.com/open-telemetry/opentelemetry-js/pull/3208) @pkanal
### :bug: (Bug Fix)
diff --git a/examples/https/package.json b/examples/https/package.json
index 944e31678c..1c5b2c3179 100644
--- a/examples/https/package.json
+++ b/examples/https/package.json
@@ -1,7 +1,7 @@
{
"name": "https-example",
"private": true,
- "version": "0.35.0",
+ "version": "0.35.1",
"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.9.0",
- "@opentelemetry/exporter-zipkin": "1.9.0",
- "@opentelemetry/instrumentation": "0.35.0",
- "@opentelemetry/instrumentation-http": "0.35.0",
- "@opentelemetry/resources": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0",
- "@opentelemetry/sdk-trace-node": "1.9.0",
- "@opentelemetry/semantic-conventions": "1.9.0"
+ "@opentelemetry/exporter-jaeger": "1.9.1",
+ "@opentelemetry/exporter-zipkin": "1.9.1",
+ "@opentelemetry/instrumentation": "0.35.1",
+ "@opentelemetry/instrumentation-http": "0.35.1",
+ "@opentelemetry/resources": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1",
+ "@opentelemetry/sdk-trace-node": "1.9.1",
+ "@opentelemetry/semantic-conventions": "1.9.1"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/https",
"devDependencies": {
diff --git a/examples/opentelemetry-web/examples/fetch-proto/index.html b/examples/opentelemetry-web/examples/fetch-proto/index.html
new file mode 100644
index 0000000000..160a6bd38b
--- /dev/null
+++ b/examples/opentelemetry-web/examples/fetch-proto/index.html
@@ -0,0 +1,20 @@
+
+
+
+
+
+ Fetch Plugin Example
+
+
+
+
+
+
+ Example of using Web Tracer with Fetch plugin with console exporter and proto exporter
+
+
+
+
+
+
+
diff --git a/examples/opentelemetry-web/examples/fetch-proto/index.js b/examples/opentelemetry-web/examples/fetch-proto/index.js
new file mode 100644
index 0000000000..9a9e85184c
--- /dev/null
+++ b/examples/opentelemetry-web/examples/fetch-proto/index.js
@@ -0,0 +1,80 @@
+const { context, trace } = require("@opentelemetry/api");
+const { ConsoleSpanExporter, SimpleSpanProcessor} = require("@opentelemetry/sdk-trace-base");
+const { WebTracerProvider } = require("@opentelemetry/sdk-trace-web");
+const { FetchInstrumentation } = require("@opentelemetry/instrumentation-fetch");
+const { ZoneContextManager } = require("@opentelemetry/context-zone");
+const { B3Propagator } = require("@opentelemetry/propagator-b3");
+const { registerInstrumentations } = require("@opentelemetry/instrumentation");
+const { OTLPTraceExporter: OTLPTraceExporterProto } = require("@opentelemetry/exporter-trace-otlp-proto");
+
+const provider = new WebTracerProvider();
+
+// Note: For production consider using the "BatchSpanProcessor" to reduce the number of requests
+// to your exporter. Using the SimpleSpanProcessor here as it sends the spans immediately to the
+// exporter without delay
+provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
+provider.addSpanProcessor(
+ new SimpleSpanProcessor(new OTLPTraceExporterProto())
+);
+
+provider.register({
+ contextManager: new ZoneContextManager(),
+ propagator: new B3Propagator(),
+});
+
+registerInstrumentations({
+ instrumentations: [
+ new FetchInstrumentation({
+ ignoreUrls: [/localhost:8090\/sockjs-node/],
+ propagateTraceHeaderCorsUrls: [
+ "https://cors-test.appspot.com/test",
+ "https://httpbin.org/get",
+ ],
+ clearTimingResources: true,
+ }),
+ ],
+});
+
+const webTracerWithZone = provider.getTracer("example-tracer-web");
+
+const getData = (url) =>
+ fetch(url, {
+ method: "GET",
+ headers: {
+ Accept: "application/json",
+ "Content-Type": "application/json",
+ },
+ });
+
+// example of keeping track of context between async operations
+const prepareClickEvent = () => {
+ const url = "https://httpbin.org/get";
+
+ const element = document.getElementById("button1");
+
+ const onClick = () => {
+ const singleSpan = webTracerWithZone.startSpan("files-series-info");
+ context.with(trace.setSpan(context.active(), singleSpan), () => {
+ getData(url).then((_data) => {
+ trace
+ .getSpan(context.active())
+ .addEvent("fetching-single-span-completed");
+ singleSpan.end();
+ });
+ });
+ for (let i = 0, j = 5; i < j; i += 1) {
+ const span = webTracerWithZone.startSpan(`files-series-info-${i}`);
+ context.with(trace.setSpan(context.active(), span), () => {
+ getData(url).then((_data) => {
+ trace
+ .getSpan(context.active())
+ .addEvent(`fetching-span-${i}-completed`);
+ span.end();
+ });
+ });
+ }
+ };
+ element.addEventListener("click", onClick);
+};
+
+window.addEventListener("load", prepareClickEvent);
diff --git a/examples/opentelemetry-web/package.json b/examples/opentelemetry-web/package.json
index 34afeb6bd4..4967b0eeff 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.35.0",
+ "version": "0.35.1",
"description": "Example of using @opentelemetry/sdk-trace-web and @opentelemetry/sdk-metrics in browser",
"main": "index.js",
"scripts": {
@@ -43,19 +43,20 @@
},
"dependencies": {
"@opentelemetry/api": "^1.3.0",
- "@opentelemetry/context-zone": "1.9.0",
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/exporter-metrics-otlp-http": "0.35.0",
- "@opentelemetry/exporter-trace-otlp-http": "0.35.0",
- "@opentelemetry/exporter-zipkin": "1.9.0",
- "@opentelemetry/instrumentation": "0.35.0",
- "@opentelemetry/instrumentation-fetch": "0.35.0",
- "@opentelemetry/instrumentation-xml-http-request": "0.35.0",
- "@opentelemetry/propagator-b3": "1.9.0",
- "@opentelemetry/sdk-metrics": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0",
- "@opentelemetry/sdk-trace-web": "1.9.0",
- "@opentelemetry/semantic-conventions": "1.9.0"
+ "@opentelemetry/context-zone": "1.9.1",
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/exporter-metrics-otlp-http": "0.35.1",
+ "@opentelemetry/exporter-trace-otlp-http": "0.35.1",
+ "@opentelemetry/exporter-trace-otlp-proto": "0.35.1",
+ "@opentelemetry/exporter-zipkin": "1.9.1",
+ "@opentelemetry/instrumentation": "0.35.1",
+ "@opentelemetry/instrumentation-fetch": "0.35.1",
+ "@opentelemetry/instrumentation-xml-http-request": "0.35.1",
+ "@opentelemetry/propagator-b3": "1.9.1",
+ "@opentelemetry/sdk-metrics": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1",
+ "@opentelemetry/sdk-trace-web": "1.9.1",
+ "@opentelemetry/semantic-conventions": "1.9.1"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/tracer-web"
}
diff --git a/examples/opentelemetry-web/webpack.dev.config.js b/examples/opentelemetry-web/webpack.dev.config.js
index c3045d79c1..6d3be1090b 100644
--- a/examples/opentelemetry-web/webpack.dev.config.js
+++ b/examples/opentelemetry-web/webpack.dev.config.js
@@ -12,6 +12,7 @@ const common = {
'xml-http-request': 'examples/xml-http-request/index.js',
fetchXhr: 'examples/fetchXhr/index.js',
fetchXhrB3: 'examples/fetchXhrB3/index.js',
+ 'fetch-proto': 'examples/fetch-proto/index.js',
zipkin: 'examples/zipkin/index.js',
},
output: {
@@ -41,7 +42,7 @@ const common = {
resolve: {
modules: [
path.resolve(directory),
- 'node_modules',
+ 'node_modules'
],
extensions: ['.ts', '.js', '.jsx', '.json'],
},
diff --git a/examples/opentelemetry-web/webpack.prod.config.js b/examples/opentelemetry-web/webpack.prod.config.js
index 2eb7d783c1..96f7d69af2 100644
--- a/examples/opentelemetry-web/webpack.prod.config.js
+++ b/examples/opentelemetry-web/webpack.prod.config.js
@@ -12,6 +12,7 @@ const common = {
'xml-http-request': 'examples/xml-http-request/index.js',
fetchXhr: 'examples/fetchXhr/index.js',
fetchXhrB3: 'examples/fetchXhrB3/index.js',
+ "fetch-proto": "examples/fetch-proto/index.js",
zipkin: 'examples/zipkin/index.js',
},
output: {
diff --git a/examples/otlp-exporter-node/package.json b/examples/otlp-exporter-node/package.json
index 7eee8b3479..67425a5379 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.35.0",
+ "version": "0.35.1",
"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.9.0",
- "@opentelemetry/exporter-metrics-otlp-grpc": "0.35.0",
- "@opentelemetry/exporter-metrics-otlp-http": "0.35.0",
- "@opentelemetry/exporter-metrics-otlp-proto": "0.35.0",
- "@opentelemetry/exporter-trace-otlp-grpc": "0.35.0",
- "@opentelemetry/exporter-trace-otlp-http": "0.35.0",
- "@opentelemetry/exporter-trace-otlp-proto": "0.35.0",
- "@opentelemetry/resources": "1.9.0",
- "@opentelemetry/sdk-metrics": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0",
- "@opentelemetry/semantic-conventions": "1.9.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/exporter-metrics-otlp-grpc": "0.35.1",
+ "@opentelemetry/exporter-metrics-otlp-http": "0.35.1",
+ "@opentelemetry/exporter-metrics-otlp-proto": "0.35.1",
+ "@opentelemetry/exporter-trace-otlp-grpc": "0.35.1",
+ "@opentelemetry/exporter-trace-otlp-http": "0.35.1",
+ "@opentelemetry/exporter-trace-otlp-proto": "0.35.1",
+ "@opentelemetry/resources": "1.9.1",
+ "@opentelemetry/sdk-metrics": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1",
+ "@opentelemetry/semantic-conventions": "1.9.1"
},
"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 9416823ca2..8d34640976 100644
--- a/experimental/CHANGELOG.md
+++ b/experimental/CHANGELOG.md
@@ -14,6 +14,16 @@ All notable changes to experimental packages in this project will be documented
### :house: (Internal)
+## 0.35.1
+
+### :bug: (Bug Fix)
+
+* fix: remove JSON syntax error and regenerate tsconfig files [#3566](https://github.com/open-telemetry/opentelemetry-js/pull/3566) @Flarna
+ * Fixes an error where the generated JS files were not included in the esnext package due to a failure of the tsconfig generation
+* fix(sdk-node): register instrumentations early [#3502](https://github.com/open-telemetry/opentelemetry-js/pull/3502) @flarna
+* fix: include tracestate in export [#3569](https://github.com/open-telemetry/opentelemetry-js/pull/3569) @flarna
+* fix(http) Remove outgoing headers normalization [#3557](https://github.com/open-telemetry/opentelemetry-js/pull/3557) @marcinjahn
+
## 0.35.0
### :rocket: (Enhancement)
diff --git a/experimental/backwards-compatability/node14/package.json b/experimental/backwards-compatability/node14/package.json
index 1479ec527b..1d40058ead 100644
--- a/experimental/backwards-compatability/node14/package.json
+++ b/experimental/backwards-compatability/node14/package.json
@@ -1,6 +1,6 @@
{
"name": "backcompat-node14",
- "version": "0.35.0",
+ "version": "0.35.1",
"private": true,
"description": "Backwards compatability 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.35.0",
- "@opentelemetry/sdk-trace-base": "1.9.0"
+ "@opentelemetry/sdk-node": "0.35.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1"
},
"devDependencies": {
"@types/node": "14.18.25",
diff --git a/experimental/backwards-compatability/node16/package.json b/experimental/backwards-compatability/node16/package.json
index c25735166c..25e8e60913 100644
--- a/experimental/backwards-compatability/node16/package.json
+++ b/experimental/backwards-compatability/node16/package.json
@@ -1,6 +1,6 @@
{
"name": "backcompat-node16",
- "version": "0.35.0",
+ "version": "0.35.1",
"private": true,
"description": "Backwards compatability 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.35.0",
- "@opentelemetry/sdk-trace-base": "1.9.0"
+ "@opentelemetry/sdk-node": "0.35.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1"
},
"devDependencies": {
"@types/node": "16.11.52",
diff --git a/experimental/examples/prometheus/package.json b/experimental/examples/prometheus/package.json
index f5a991d5bb..a649056fa3 100644
--- a/experimental/examples/prometheus/package.json
+++ b/experimental/examples/prometheus/package.json
@@ -1,6 +1,6 @@
{
"name": "prometheus-example",
- "version": "0.35.0",
+ "version": "0.35.1",
"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.35.0",
- "@opentelemetry/sdk-metrics": "1.9.0"
+ "@opentelemetry/exporter-prometheus": "0.35.1",
+ "@opentelemetry/sdk-metrics": "1.9.1"
}
}
diff --git a/experimental/packages/api-logs/package.json b/experimental/packages/api-logs/package.json
index 822949a3db..7f6f846e2f 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.35.0",
+ "version": "0.35.1",
"description": "Public logs API for OpenTelemetry",
"main": "build/src/index.js",
"module": "build/esm/index.js",
diff --git a/experimental/packages/exporter-trace-otlp-grpc/package.json b/experimental/packages/exporter-trace-otlp-grpc/package.json
index 46cc3ac3c9..4600780b4a 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.35.0",
+ "version": "0.35.1",
"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",
@@ -50,7 +50,7 @@
"@babel/core": "7.16.0",
"@grpc/proto-loader": "^0.7.3",
"@opentelemetry/api": "^1.0.0",
- "@opentelemetry/otlp-exporter-base": "0.35.0",
+ "@opentelemetry/otlp-exporter-base": "0.35.1",
"@types/mocha": "10.0.0",
"@types/node": "18.6.5",
"@types/sinon": "10.0.13",
@@ -58,7 +58,7 @@
"cpx": "1.5.0",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
@@ -69,11 +69,11 @@
},
"dependencies": {
"@grpc/grpc-js": "^1.7.1",
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/otlp-grpc-exporter-base": "0.35.0",
- "@opentelemetry/otlp-transformer": "0.35.0",
- "@opentelemetry/resources": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/otlp-grpc-exporter-base": "0.35.1",
+ "@opentelemetry/otlp-transformer": "0.35.1",
+ "@opentelemetry/resources": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1"
},
"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 b1e0be41c7..90ac43cab7 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.35.0",
+ "version": "0.35.1",
"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",
@@ -81,7 +81,7 @@
"karma-webpack": "4.0.2",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
@@ -94,11 +94,11 @@
"@opentelemetry/api": "^1.0.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/otlp-exporter-base": "0.35.0",
- "@opentelemetry/otlp-transformer": "0.35.0",
- "@opentelemetry/resources": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/otlp-exporter-base": "0.35.1",
+ "@opentelemetry/otlp-transformer": "0.35.1",
+ "@opentelemetry/resources": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1"
},
"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/karma.conf.js b/experimental/packages/exporter-trace-otlp-proto/karma.conf.js
new file mode 100644
index 0000000000..4c60b54edb
--- /dev/null
+++ b/experimental/packages/exporter-trace-otlp-proto/karma.conf.js
@@ -0,0 +1,26 @@
+/*!
+ * 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
+ *
+ * http://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 karmaWebpackConfig = require('../../../karma.webpack');
+const karmaBaseConfig = require('../../../karma.base');
+
+module.exports = (config) => {
+ config.set(Object.assign({}, karmaBaseConfig, {
+ webpack: karmaWebpackConfig,
+ files: ['test/browser/index-webpack.ts'],
+ preprocessors: { 'test/browser/index-webpack.ts': ['webpack'] }
+ }))
+};
diff --git a/experimental/packages/exporter-trace-otlp-proto/package.json b/experimental/packages/exporter-trace-otlp-proto/package.json
index 1a7d0ed244..920f533084 100644
--- a/experimental/packages/exporter-trace-otlp-proto/package.json
+++ b/experimental/packages/exporter-trace-otlp-proto/package.json
@@ -1,20 +1,29 @@
{
"name": "@opentelemetry/exporter-trace-otlp-proto",
- "version": "0.35.0",
+ "version": "0.35.1",
"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",
+ "esnext": "build/esnext/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
+ "browser": {
+ "./src/platform/index.ts": "./src/platform/browser/index.ts",
+ "./build/esm/platform/index.js": "./build/esm/platform/browser/index.js",
+ "./build/esnext/platform/index.js": "./build/esnext/platform/browser/index.js",
+ "./build/src/platform/index.js": "./build/src/platform/browser/index.js"
+ },
"scripts": {
"prepublishOnly": "npm run compile",
- "compile": "tsc --build",
- "clean": "tsc --build --clean",
+ "compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
+ "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"tdd": "npm run test -- --watch-extensions ts --watch",
- "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
+ "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'",
+ "test:browser": "nyc karma start --single-run",
"version": "node ../../../scripts/version-update.js",
- "watch": "tsc --build --watch",
+ "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
"precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies",
"prewatch": "npm run precompile",
"peer-api-check": "node ../../../scripts/peer-api-check.js",
@@ -35,6 +44,12 @@
"node": ">=14"
},
"files": [
+ "build/esm/**/*.js",
+ "build/esm/**/*.js.map",
+ "build/esm/**/*.d.ts",
+ "build/esnext/**/*.js",
+ "build/esnext/**/*.js.map",
+ "build/esnext/**/*.d.ts",
"build/src/**/*.js",
"build/src/**/*.js.map",
"build/src/**/*.d.ts",
@@ -56,7 +71,7 @@
"cpx": "1.5.0",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
@@ -66,12 +81,12 @@
"@opentelemetry/api": "^1.0.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/otlp-exporter-base": "0.35.0",
- "@opentelemetry/otlp-proto-exporter-base": "0.35.0",
- "@opentelemetry/otlp-transformer": "0.35.0",
- "@opentelemetry/resources": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/otlp-exporter-base": "0.35.1",
+ "@opentelemetry/otlp-proto-exporter-base": "0.35.1",
+ "@opentelemetry/otlp-transformer": "0.35.1",
+ "@opentelemetry/resources": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-trace-otlp-proto",
"sideEffects": false
diff --git a/experimental/packages/exporter-trace-otlp-proto/src/index.ts b/experimental/packages/exporter-trace-otlp-proto/src/index.ts
index 761e8a9262..f0dc6b55e3 100644
--- a/experimental/packages/exporter-trace-otlp-proto/src/index.ts
+++ b/experimental/packages/exporter-trace-otlp-proto/src/index.ts
@@ -13,5 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-export * from './OTLPTraceExporter';
+export { OTLPTraceExporter } from './platform';
diff --git a/experimental/packages/exporter-trace-otlp-proto/src/platform/browser/OTLPTraceExporter.ts b/experimental/packages/exporter-trace-otlp-proto/src/platform/browser/OTLPTraceExporter.ts
new file mode 100644
index 0000000000..890268333f
--- /dev/null
+++ b/experimental/packages/exporter-trace-otlp-proto/src/platform/browser/OTLPTraceExporter.ts
@@ -0,0 +1,72 @@
+/*
+ * 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 { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
+import { getEnv, baggageUtils } from '@opentelemetry/core';
+import {
+ OTLPExporterConfigBase,
+ appendResourcePathToUrl,
+ appendRootPathToUrlIfNeeded,
+} from '@opentelemetry/otlp-exporter-base';
+import {
+ OTLPProtoExporterBrowserBase,
+ ServiceClientType,
+} from '@opentelemetry/otlp-proto-exporter-base';
+import {
+ createExportTraceServiceRequest,
+ IExportTraceServiceRequest,
+} from '@opentelemetry/otlp-transformer';
+
+const DEFAULT_COLLECTOR_RESOURCE_PATH = 'v1/traces';
+const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
+
+/**
+ * Collector Trace Exporter for Web
+ */
+export class OTLPTraceExporter
+ extends OTLPProtoExporterBrowserBase
+ implements SpanExporter
+{
+ constructor(config: OTLPExporterConfigBase = {}) {
+ super(config);
+ this._headers = Object.assign(
+ this._headers,
+ baggageUtils.parseKeyPairsIntoRecord(
+ getEnv().OTEL_EXPORTER_OTLP_TRACES_HEADERS
+ )
+ );
+ }
+ convert(spans: ReadableSpan[]): IExportTraceServiceRequest {
+ return createExportTraceServiceRequest(spans);
+ }
+
+ getDefaultUrl(config: OTLPExporterConfigBase): string {
+ return typeof config.url === 'string'
+ ? config.url
+ : getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT.length > 0
+ ? appendRootPathToUrlIfNeeded(getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT)
+ : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0
+ ? appendResourcePathToUrl(
+ getEnv().OTEL_EXPORTER_OTLP_ENDPOINT,
+ DEFAULT_COLLECTOR_RESOURCE_PATH
+ )
+ : DEFAULT_COLLECTOR_URL;
+ }
+
+ getServiceClientType() {
+ return ServiceClientType.SPANS;
+ }
+}
diff --git a/experimental/packages/exporter-trace-otlp-proto/src/platform/browser/index.ts b/experimental/packages/exporter-trace-otlp-proto/src/platform/browser/index.ts
new file mode 100644
index 0000000000..74d90ff34c
--- /dev/null
+++ b/experimental/packages/exporter-trace-otlp-proto/src/platform/browser/index.ts
@@ -0,0 +1,16 @@
+/*
+ * 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.
+ */
+export { OTLPTraceExporter } from './OTLPTraceExporter';
diff --git a/experimental/packages/exporter-trace-otlp-proto/src/platform/index.ts b/experimental/packages/exporter-trace-otlp-proto/src/platform/index.ts
new file mode 100644
index 0000000000..f6ecd3a34f
--- /dev/null
+++ b/experimental/packages/exporter-trace-otlp-proto/src/platform/index.ts
@@ -0,0 +1,16 @@
+/*
+ * 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.
+ */
+export { OTLPTraceExporter } from './node';
diff --git a/experimental/packages/exporter-trace-otlp-proto/src/OTLPTraceExporter.ts b/experimental/packages/exporter-trace-otlp-proto/src/platform/node/OTLPTraceExporter.ts
similarity index 100%
rename from experimental/packages/exporter-trace-otlp-proto/src/OTLPTraceExporter.ts
rename to experimental/packages/exporter-trace-otlp-proto/src/platform/node/OTLPTraceExporter.ts
diff --git a/experimental/packages/exporter-trace-otlp-proto/src/platform/node/index.ts b/experimental/packages/exporter-trace-otlp-proto/src/platform/node/index.ts
new file mode 100644
index 0000000000..254ac931a5
--- /dev/null
+++ b/experimental/packages/exporter-trace-otlp-proto/src/platform/node/index.ts
@@ -0,0 +1,17 @@
+/*
+ * 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.
+ */
+
+export { OTLPTraceExporter } from './OTLPTraceExporter';
diff --git a/experimental/packages/exporter-trace-otlp-proto/test/browser/CollectorTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-proto/test/browser/CollectorTraceExporter.test.ts
new file mode 100644
index 0000000000..e8187e7296
--- /dev/null
+++ b/experimental/packages/exporter-trace-otlp-proto/test/browser/CollectorTraceExporter.test.ts
@@ -0,0 +1,50 @@
+/*
+ * 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 * as assert from 'assert';
+import * as sinon from 'sinon';
+import { OTLPTraceExporter } from '../../src/platform/browser/index';
+
+describe('OTLPTraceExporter - web', () => {
+ let collectorTraceExporter: OTLPTraceExporter;
+ describe('constructor', () => {
+ let onInitSpy: any;
+ beforeEach(() => {
+ onInitSpy = sinon.stub(OTLPTraceExporter.prototype, 'onInit');
+ const collectorExporterConfig = {
+ hostname: 'foo',
+ url: 'http://foo.bar.com',
+ };
+ collectorTraceExporter = new OTLPTraceExporter(collectorExporterConfig);
+ });
+ afterEach(() => {
+ sinon.restore();
+ });
+ it('should create an instance', () => {
+ assert.ok(typeof collectorTraceExporter !== 'undefined');
+ });
+ it('should call onInit', () => {
+ assert.strictEqual(onInitSpy.callCount, 1);
+ });
+ it('should set hostname', () => {
+ assert.strictEqual(collectorTraceExporter.hostname, 'foo');
+ });
+
+ it('should set url', () => {
+ assert.strictEqual(collectorTraceExporter.url, 'http://foo.bar.com');
+ });
+ });
+});
diff --git a/experimental/packages/exporter-trace-otlp-proto/test/browser/index-webpack.ts b/experimental/packages/exporter-trace-otlp-proto/test/browser/index-webpack.ts
new file mode 100644
index 0000000000..ae7d4b5a9d
--- /dev/null
+++ b/experimental/packages/exporter-trace-otlp-proto/test/browser/index-webpack.ts
@@ -0,0 +1,20 @@
+/*
+ * 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 testsContext = require.context('../browser', true, /test$/);
+testsContext.keys().forEach(testsContext);
+
+const srcContext = require.context('.', true, /src$/);
+srcContext.keys().forEach(srcContext);
diff --git a/experimental/packages/exporter-trace-otlp-proto/test/OTLPTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-proto/test/node/OTLPTraceExporter.test.ts
similarity index 99%
rename from experimental/packages/exporter-trace-otlp-proto/test/OTLPTraceExporter.test.ts
rename to experimental/packages/exporter-trace-otlp-proto/test/node/OTLPTraceExporter.test.ts
index 924c6b4b31..64f0e40ea0 100644
--- a/experimental/packages/exporter-trace-otlp-proto/test/OTLPTraceExporter.test.ts
+++ b/experimental/packages/exporter-trace-otlp-proto/test/node/OTLPTraceExporter.test.ts
@@ -22,13 +22,13 @@ import * as http from 'http';
import * as sinon from 'sinon';
import { Stream, PassThrough } from 'stream';
import * as zlib from 'zlib';
-import { OTLPTraceExporter } from '../src';
+import { OTLPTraceExporter } from '../../src';
import {
ensureExportTraceServiceRequestIsSet,
ensureProtoSpanIsCorrect,
mockedReadableSpan,
MockedResponse,
-} from './traceHelper';
+} from '../traceHelper';
import {
CompressionAlgorithm,
OTLPExporterNodeConfigBase,
diff --git a/experimental/packages/exporter-trace-otlp-proto/tsconfig.esm.json b/experimental/packages/exporter-trace-otlp-proto/tsconfig.esm.json
new file mode 100644
index 0000000000..22887f7b0a
--- /dev/null
+++ b/experimental/packages/exporter-trace-otlp-proto/tsconfig.esm.json
@@ -0,0 +1,34 @@
+{
+ "extends": "../../../tsconfig.base.esm.json",
+ "compilerOptions": {
+ "outDir": "build/esm",
+ "rootDir": "src",
+ "tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
+ },
+ "include": [
+ "src/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../../../api"
+ },
+ {
+ "path": "../../../packages/opentelemetry-core"
+ },
+ {
+ "path": "../../../packages/opentelemetry-resources"
+ },
+ {
+ "path": "../../../packages/opentelemetry-sdk-trace-base"
+ },
+ {
+ "path": "../otlp-exporter-base"
+ },
+ {
+ "path": "../otlp-proto-exporter-base"
+ },
+ {
+ "path": "../otlp-transformer"
+ }
+ ]
+}
diff --git a/experimental/packages/exporter-trace-otlp-proto/tsconfig.esnext.json b/experimental/packages/exporter-trace-otlp-proto/tsconfig.esnext.json
new file mode 100644
index 0000000000..199ea3b325
--- /dev/null
+++ b/experimental/packages/exporter-trace-otlp-proto/tsconfig.esnext.json
@@ -0,0 +1,34 @@
+{
+ "extends": "../../../tsconfig.base.esnext.json",
+ "compilerOptions": {
+ "outDir": "build/esnext",
+ "rootDir": "src",
+ "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo"
+ },
+ "include": [
+ "src/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../../../api"
+ },
+ {
+ "path": "../../../packages/opentelemetry-core"
+ },
+ {
+ "path": "../../../packages/opentelemetry-resources"
+ },
+ {
+ "path": "../../../packages/opentelemetry-sdk-trace-base"
+ },
+ {
+ "path": "../otlp-exporter-base"
+ },
+ {
+ "path": "../otlp-proto-exporter-base"
+ },
+ {
+ "path": "../otlp-transformer"
+ }
+ ]
+}
diff --git a/experimental/packages/opentelemetry-browser-detector/package.json b/experimental/packages/opentelemetry-browser-detector/package.json
index a04c6cf78b..a1b604d274 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.35.0",
+ "version": "0.35.1",
"description": "OpenTelemetry Resource Detector for Browser",
"main": "build/src/index.js",
"module": "build/esm/index.js",
@@ -70,8 +70,8 @@
"@opentelemetry/api": "^1.0.0"
},
"dependencies": {
- "@opentelemetry/resources": "1.9.0",
- "@opentelemetry/semantic-conventions": "1.9.0"
+ "@opentelemetry/resources": "1.9.1",
+ "@opentelemetry/semantic-conventions": "1.9.1"
},
"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 3211e4e20f..ddefef4862 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.35.0",
+ "version": "0.35.1",
"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",
@@ -57,7 +57,7 @@
"cpx": "1.5.0",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
@@ -68,12 +68,12 @@
},
"dependencies": {
"@grpc/grpc-js": "^1.7.1",
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/exporter-metrics-otlp-http": "0.35.0",
- "@opentelemetry/otlp-grpc-exporter-base": "0.35.0",
- "@opentelemetry/otlp-transformer": "0.35.0",
- "@opentelemetry/resources": "1.9.0",
- "@opentelemetry/sdk-metrics": "1.9.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/exporter-metrics-otlp-http": "0.35.1",
+ "@opentelemetry/otlp-grpc-exporter-base": "0.35.1",
+ "@opentelemetry/otlp-transformer": "0.35.1",
+ "@opentelemetry/resources": "1.9.1",
+ "@opentelemetry/sdk-metrics": "1.9.1"
},
"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-http/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json
index acbea110fe..01c9e5f742 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.35.0",
+ "version": "0.35.1",
"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",
@@ -81,7 +81,7 @@
"karma-webpack": "4.0.2",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
@@ -94,11 +94,11 @@
"@opentelemetry/api": "^1.3.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/otlp-exporter-base": "0.35.0",
- "@opentelemetry/otlp-transformer": "0.35.0",
- "@opentelemetry/resources": "1.9.0",
- "@opentelemetry/sdk-metrics": "1.9.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/otlp-exporter-base": "0.35.1",
+ "@opentelemetry/otlp-transformer": "0.35.1",
+ "@opentelemetry/resources": "1.9.1",
+ "@opentelemetry/sdk-metrics": "1.9.1"
},
"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-proto/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json
index 742f0ef098..df98d761fa 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.35.0",
+ "version": "0.35.1",
"description": "OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector using protobuf over HTTP",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
@@ -56,7 +56,7 @@
"cpx": "1.5.0",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
@@ -66,13 +66,13 @@
"@opentelemetry/api": "^1.3.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/exporter-metrics-otlp-http": "0.35.0",
- "@opentelemetry/otlp-exporter-base": "0.35.0",
- "@opentelemetry/otlp-proto-exporter-base": "0.35.0",
- "@opentelemetry/otlp-transformer": "0.35.0",
- "@opentelemetry/resources": "1.9.0",
- "@opentelemetry/sdk-metrics": "1.9.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/exporter-metrics-otlp-http": "0.35.1",
+ "@opentelemetry/otlp-exporter-base": "0.35.1",
+ "@opentelemetry/otlp-proto-exporter-base": "0.35.1",
+ "@opentelemetry/otlp-transformer": "0.35.1",
+ "@opentelemetry/resources": "1.9.1",
+ "@opentelemetry/sdk-metrics": "1.9.1"
},
"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-prometheus/package.json b/experimental/packages/opentelemetry-exporter-prometheus/package.json
index 020fb4233e..685ea68a1e 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.35.0",
+ "version": "0.35.1",
"description": "OpenTelemetry Exporter Prometheus provides a metrics endpoint for Prometheus",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
@@ -44,14 +44,14 @@
},
"devDependencies": {
"@opentelemetry/api": "^1.3.0",
- "@opentelemetry/semantic-conventions": "1.9.0",
+ "@opentelemetry/semantic-conventions": "1.9.1",
"@types/mocha": "10.0.0",
"@types/node": "18.6.5",
"@types/sinon": "10.0.13",
"codecov": "3.8.3",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-mocha": "10.0.0",
"typescript": "4.4.4"
@@ -60,9 +60,9 @@
"@opentelemetry/api": "^1.3.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/resources": "1.9.0",
- "@opentelemetry/sdk-metrics": "1.9.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/resources": "1.9.1",
+ "@opentelemetry/sdk-metrics": "1.9.1"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-prometheus",
"sideEffects": false
diff --git a/experimental/packages/opentelemetry-instrumentation-fetch/package.json b/experimental/packages/opentelemetry-instrumentation-fetch/package.json
index 99d90251d5..7e3a2719a8 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.35.0",
+ "version": "0.35.1",
"description": "OpenTelemetry fetch automatic instrumentation package.",
"main": "build/src/index.js",
"module": "build/esm/index.js",
@@ -56,9 +56,9 @@
"devDependencies": {
"@babel/core": "7.16.0",
"@opentelemetry/api": "^1.0.0",
- "@opentelemetry/context-zone": "1.9.0",
- "@opentelemetry/propagator-b3": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0",
+ "@opentelemetry/context-zone": "1.9.1",
+ "@opentelemetry/propagator-b3": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1",
"@types/mocha": "10.0.0",
"@types/node": "18.6.5",
"@types/sinon": "10.0.13",
@@ -74,7 +74,7 @@
"karma-webpack": "4.0.2",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
@@ -87,10 +87,10 @@
"@opentelemetry/api": "^1.0.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/instrumentation": "0.35.0",
- "@opentelemetry/sdk-trace-web": "1.9.0",
- "@opentelemetry/semantic-conventions": "1.9.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/instrumentation": "0.35.1",
+ "@opentelemetry/sdk-trace-web": "1.9.1",
+ "@opentelemetry/semantic-conventions": "1.9.1"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-fetch",
"sideEffects": false
diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/package.json b/experimental/packages/opentelemetry-instrumentation-grpc/package.json
index c66861143c..5bc49bcc37 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.35.0",
+ "version": "0.35.1",
"description": "OpenTelemetry grpc automatic instrumentation package.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
@@ -48,10 +48,10 @@
"@grpc/grpc-js": "^1.7.1",
"@grpc/proto-loader": "^0.7.3",
"@opentelemetry/api": "^1.3.0",
- "@opentelemetry/context-async-hooks": "1.9.0",
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0",
- "@opentelemetry/sdk-trace-node": "1.9.0",
+ "@opentelemetry/context-async-hooks": "1.9.1",
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1",
+ "@opentelemetry/sdk-trace-node": "1.9.1",
"@types/mocha": "10.0.0",
"@types/node": "18.6.5",
"@types/semver": "7.3.9",
@@ -61,7 +61,7 @@
"mocha": "10.0.0",
"node-pre-gyp": "0.17.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"semver": "7.3.5",
"sinon": "15.0.0",
"ts-mocha": "10.0.0",
@@ -71,8 +71,8 @@
"@opentelemetry/api": "^1.3.0"
},
"dependencies": {
- "@opentelemetry/instrumentation": "0.35.0",
- "@opentelemetry/semantic-conventions": "1.9.0"
+ "@opentelemetry/instrumentation": "0.35.1",
+ "@opentelemetry/semantic-conventions": "1.9.1"
},
"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/grpc-js/clientUtils.ts
index 050eee24b1..8c98a10936 100644
--- a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts
+++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts
@@ -33,7 +33,7 @@ import { CALL_SPAN_ENDED } from './serverUtils';
import { EventEmitter } from 'events';
import { AttributeNames } from '../enums/AttributeNames';
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
-import { metadataCaptureType } from '../types';
+import { metadataCaptureType } from '../internal-types';
import { GRPC_STATUS_CODE_OK } from '../status-code';
/**
diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts
index 9147f455a0..2e5c833b19 100644
--- a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts
+++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts
@@ -20,7 +20,8 @@ import {
isWrapped,
} from '@opentelemetry/instrumentation';
import { InstrumentationBase } from '@opentelemetry/instrumentation';
-import { GrpcInstrumentationConfig, metadataCaptureType } from '../types';
+import { GrpcInstrumentationConfig } from '../types';
+import { metadataCaptureType } from '../internal-types';
import {
ServerCallWithMeta,
SendUnaryDataCallback,
diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/clientUtils.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/clientUtils.ts
index 47de2ecf34..af56330a85 100644
--- a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/clientUtils.ts
+++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/clientUtils.ts
@@ -25,7 +25,7 @@ import {
findIndex,
} from '../utils';
import { AttributeNames } from '../enums/AttributeNames';
-import { metadataCaptureType } from '../types';
+import { metadataCaptureType } from '../internal-types';
import { GRPC_STATUS_CODE_OK } from '../status-code';
/**
diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/index.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/index.ts
index 436e04ada4..4df381eb66 100644
--- a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/index.ts
+++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/index.ts
@@ -27,7 +27,8 @@ import {
SendUnaryDataCallback,
GrpcClientFunc,
} from './types';
-import { GrpcInstrumentationConfig, metadataCaptureType } from '../types';
+import { GrpcInstrumentationConfig } from '../types';
+import { metadataCaptureType } from '../internal-types';
import {
context,
propagation,
diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/internal-types.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/internal-types.ts
new file mode 100644
index 0000000000..d0052f7643
--- /dev/null
+++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/internal-types.ts
@@ -0,0 +1,32 @@
+/*
+ * 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 { Span } from '@opentelemetry/api';
+import type * as grpcJsTypes from '@grpc/grpc-js';
+import type * as grpcTypes from 'grpc';
+
+export type metadataCaptureType = {
+ client: {
+ captureRequestMetadata: (
+ span: Span,
+ metadata: grpcJsTypes.Metadata | grpcTypes.Metadata
+ ) => void;
+ captureResponseMetadata: (
+ span: Span,
+ metadata: grpcJsTypes.Metadata | grpcTypes.Metadata
+ ) => void;
+ };
+};
diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/types.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/types.ts
index 67940a48e0..dd08d8224b 100644
--- a/experimental/packages/opentelemetry-instrumentation-grpc/src/types.ts
+++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/types.ts
@@ -15,9 +15,6 @@
*/
import { InstrumentationConfig } from '@opentelemetry/instrumentation';
-import { Span } from '@opentelemetry/api';
-import type * as grpcJsTypes from '@grpc/grpc-js';
-import type * as grpcTypes from 'grpc';
export type IgnoreMatcher = string | RegExp | ((str: string) => boolean);
@@ -34,16 +31,3 @@ export interface GrpcInstrumentationConfig extends InstrumentationConfig {
};
};
}
-
-export type metadataCaptureType = {
- client: {
- captureRequestMetadata: (
- span: Span,
- metadata: grpcJsTypes.Metadata | grpcTypes.Metadata
- ) => void;
- captureResponseMetadata: (
- span: Span,
- metadata: grpcJsTypes.Metadata | grpcTypes.Metadata
- ) => void;
- };
-};
diff --git a/experimental/packages/opentelemetry-instrumentation-http/package.json b/experimental/packages/opentelemetry-instrumentation-http/package.json
index 0cc0414c89..7cae297fe3 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.35.0",
+ "version": "0.35.1",
"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.3.0",
- "@opentelemetry/context-async-hooks": "1.9.0",
- "@opentelemetry/sdk-metrics": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0",
- "@opentelemetry/sdk-trace-node": "1.9.0",
+ "@opentelemetry/context-async-hooks": "1.9.1",
+ "@opentelemetry/sdk-metrics": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1",
+ "@opentelemetry/sdk-trace-node": "1.9.1",
"@types/mocha": "10.0.0",
"@types/node": "18.6.5",
"@types/request-promise-native": "1.0.18",
@@ -63,7 +63,7 @@
"nyc": "15.1.0",
"request": "2.88.2",
"request-promise-native": "1.0.9",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"superagent": "8.0.0",
"ts-mocha": "10.0.0",
@@ -73,9 +73,9 @@
"@opentelemetry/api": "^1.3.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/instrumentation": "0.35.0",
- "@opentelemetry/semantic-conventions": "1.9.0",
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/instrumentation": "0.35.1",
+ "@opentelemetry/semantic-conventions": "1.9.1",
"semver": "^7.3.5"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-http",
diff --git a/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts b/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts
index 4f91ad4cfd..c9a178653e 100644
--- a/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts
+++ b/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts
@@ -276,14 +276,6 @@ export const getRequestInfo = (
origin = `${optionsParsed.protocol || 'http:'}//${hostname}`;
}
- const headers = optionsParsed.headers ?? {};
- optionsParsed.headers = Object.keys(headers).reduce(
- (normalizedHeader, key) => {
- normalizedHeader[key.toLowerCase()] = headers[key];
- return normalizedHeader;
- },
- {} as OutgoingHttpHeaders
- );
// some packages return method in lowercase..
// ensure upperCase for consistency
const method = optionsParsed.method
diff --git a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts
index fb10580739..9ebfe41c80 100644
--- a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts
+++ b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts
@@ -508,11 +508,6 @@ describe('HttpInstrumentation', () => {
'user-agent': testValue,
},
}),
- httpRequest.get(`${protocol}://${hostname}:${serverPort}`, {
- headers: {
- 'uSeR-aGeNt': testValue,
- },
- }),
]);
const spans = memoryExporter.getFinishedSpans();
assert.strictEqual(spans.length, 0);
diff --git a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts
index 8ca18c5e98..2f3af2aaeb 100644
--- a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts
+++ b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts
@@ -460,11 +460,6 @@ describe('HttpsInstrumentation', () => {
'user-agent': testValue,
},
}),
- httpsRequest.get(`${protocol}://${hostname}:${serverPort}`, {
- headers: {
- 'uSeR-aGeNt': testValue,
- },
- }),
]);
const spans = memoryExporter.getFinishedSpans();
assert.strictEqual(spans.length, 0);
diff --git a/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json b/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json
index 04faf9af92..99813efd39 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.35.0",
+ "version": "0.35.1",
"description": "OpenTelemetry XMLHttpRequest automatic instrumentation package.",
"main": "build/src/index.js",
"module": "build/esm/index.js",
@@ -56,9 +56,9 @@
"devDependencies": {
"@babel/core": "7.16.0",
"@opentelemetry/api": "^1.0.0",
- "@opentelemetry/context-zone": "1.9.0",
- "@opentelemetry/propagator-b3": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0",
+ "@opentelemetry/context-zone": "1.9.1",
+ "@opentelemetry/propagator-b3": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1",
"@types/mocha": "10.0.0",
"@types/node": "18.6.5",
"@types/sinon": "10.0.13",
@@ -74,7 +74,7 @@
"karma-webpack": "4.0.2",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
@@ -87,10 +87,10 @@
"@opentelemetry/api": "^1.0.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/instrumentation": "0.35.0",
- "@opentelemetry/sdk-trace-web": "1.9.0",
- "@opentelemetry/semantic-conventions": "1.9.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/instrumentation": "0.35.1",
+ "@opentelemetry/sdk-trace-web": "1.9.1",
+ "@opentelemetry/semantic-conventions": "1.9.1"
},
"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 cdab1c1192..05cc761e75 100644
--- a/experimental/packages/opentelemetry-instrumentation/package.json
+++ b/experimental/packages/opentelemetry-instrumentation/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/instrumentation",
- "version": "0.35.0",
+ "version": "0.35.1",
"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",
@@ -78,7 +78,7 @@
"devDependencies": {
"@babel/core": "7.16.0",
"@opentelemetry/api": "^1.3.0",
- "@opentelemetry/sdk-metrics": "1.9.0",
+ "@opentelemetry/sdk-metrics": "1.9.1",
"@types/mocha": "10.0.0",
"@types/node": "18.6.5",
"@types/semver": "7.3.9",
@@ -97,7 +97,7 @@
"karma-webpack": "4.0.2",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
diff --git a/experimental/packages/opentelemetry-sdk-node/package.json b/experimental/packages/opentelemetry-sdk-node/package.json
index 4388986fb3..bb629ad0b5 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.35.0",
+ "version": "0.35.1",
"description": "OpenTelemetry SDK for Node.js",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
@@ -44,25 +44,25 @@
"access": "public"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/exporter-jaeger": "1.9.0",
- "@opentelemetry/exporter-trace-otlp-grpc": "0.35.0",
- "@opentelemetry/exporter-trace-otlp-http": "0.35.0",
- "@opentelemetry/exporter-trace-otlp-proto": "0.35.0",
- "@opentelemetry/exporter-zipkin": "1.9.0",
- "@opentelemetry/instrumentation": "0.35.0",
- "@opentelemetry/resources": "1.9.0",
- "@opentelemetry/sdk-metrics": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0",
- "@opentelemetry/sdk-trace-node": "1.9.0",
- "@opentelemetry/semantic-conventions": "1.9.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/exporter-jaeger": "1.9.1",
+ "@opentelemetry/exporter-trace-otlp-grpc": "0.35.1",
+ "@opentelemetry/exporter-trace-otlp-http": "0.35.1",
+ "@opentelemetry/exporter-trace-otlp-proto": "0.35.1",
+ "@opentelemetry/exporter-zipkin": "1.9.1",
+ "@opentelemetry/instrumentation": "0.35.1",
+ "@opentelemetry/resources": "1.9.1",
+ "@opentelemetry/sdk-metrics": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1",
+ "@opentelemetry/sdk-trace-node": "1.9.1",
+ "@opentelemetry/semantic-conventions": "1.9.1"
},
"peerDependencies": {
"@opentelemetry/api": ">=1.3.0 <1.5.0"
},
"devDependencies": {
"@opentelemetry/api": ">=1.3.0 <1.5.0",
- "@opentelemetry/context-async-hooks": "1.9.0",
+ "@opentelemetry/context-async-hooks": "1.9.1",
"@types/mocha": "10.0.0",
"@types/node": "18.6.5",
"@types/semver": "7.3.9",
diff --git a/experimental/packages/opentelemetry-sdk-node/src/sdk.ts b/experimental/packages/opentelemetry-sdk-node/src/sdk.ts
index a3af268442..caad9b85e2 100644
--- a/experimental/packages/opentelemetry-sdk-node/src/sdk.ts
+++ b/experimental/packages/opentelemetry-sdk-node/src/sdk.ts
@@ -208,6 +208,10 @@ export class NodeSDK {
return;
}
+ registerInstrumentations({
+ instrumentations: this._instrumentations,
+ });
+
if (this._autoDetectResources) {
await this.detectResources();
}
@@ -255,10 +259,6 @@ export class NodeSDK {
metrics.setGlobalMeterProvider(meterProvider);
}
-
- registerInstrumentations({
- instrumentations: this._instrumentations,
- });
}
public shutdown(): Promise {
diff --git a/experimental/packages/otlp-exporter-base/package.json b/experimental/packages/otlp-exporter-base/package.json
index 52435a0dfd..22c390b1bb 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.35.0",
+ "version": "0.35.1",
"description": "OpenTelemetry OTLP Exporter base (for internal use only)",
"main": "build/src/index.js",
"module": "build/esm/index.js",
@@ -61,7 +61,7 @@
"access": "public"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0"
+ "@opentelemetry/core": "1.9.1"
},
"devDependencies": {
"@opentelemetry/api": "^1.0.0",
diff --git a/experimental/packages/otlp-exporter-base/src/index.ts b/experimental/packages/otlp-exporter-base/src/index.ts
index e1149d2add..9ded103782 100644
--- a/experimental/packages/otlp-exporter-base/src/index.ts
+++ b/experimental/packages/otlp-exporter-base/src/index.ts
@@ -13,7 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-export * from './OTLPExporterBase';
export * from './platform';
-export * from './types';
-export * from './util';
+export { OTLPExporterBase } from './OTLPExporterBase';
+export {
+ OTLPExporterError,
+ OTLPExporterConfigBase,
+ ExportServiceError,
+} from './types';
+export {
+ parseHeaders,
+ appendResourcePathToUrl,
+ appendRootPathToUrlIfNeeded,
+ configureExporterTimeout,
+ invalidTimeout,
+} from './util';
diff --git a/experimental/packages/otlp-exporter-base/src/platform/browser/index.ts b/experimental/packages/otlp-exporter-base/src/platform/browser/index.ts
index c9678a8017..58b8777a97 100644
--- a/experimental/packages/otlp-exporter-base/src/platform/browser/index.ts
+++ b/experimental/packages/otlp-exporter-base/src/platform/browser/index.ts
@@ -14,4 +14,5 @@
* limitations under the License.
*/
-export * from './OTLPExporterBrowserBase';
+export { OTLPExporterBrowserBase } from './OTLPExporterBrowserBase';
+export { sendWithXhr } from './util';
diff --git a/experimental/packages/otlp-exporter-base/src/platform/browser/util.ts b/experimental/packages/otlp-exporter-base/src/platform/browser/util.ts
index 8c311fe0ed..a271a3bf5f 100644
--- a/experimental/packages/otlp-exporter-base/src/platform/browser/util.ts
+++ b/experimental/packages/otlp-exporter-base/src/platform/browser/util.ts
@@ -50,7 +50,7 @@ export function sendWithBeacon(
* @param onError
*/
export function sendWithXhr(
- body: string,
+ body: string | Blob,
url: string,
headers: Record,
exporterTimeout: number,
diff --git a/experimental/packages/otlp-exporter-base/src/platform/index.ts b/experimental/packages/otlp-exporter-base/src/platform/index.ts
index 86a320fde6..fc857a5802 100644
--- a/experimental/packages/otlp-exporter-base/src/platform/index.ts
+++ b/experimental/packages/otlp-exporter-base/src/platform/index.ts
@@ -13,5 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-export * from './node';
-export { OTLPExporterBrowserBase } from './browser';
+
+export {
+ OTLPExporterNodeBase,
+ sendWithHttp,
+ createHttpAgent,
+ configureCompression,
+ OTLPExporterNodeConfigBase,
+ CompressionAlgorithm,
+} from './node';
+export { OTLPExporterBrowserBase, sendWithXhr } from './browser';
diff --git a/experimental/packages/otlp-exporter-base/src/platform/node/index.ts b/experimental/packages/otlp-exporter-base/src/platform/node/index.ts
index 8a75162ea2..b8b13bda20 100644
--- a/experimental/packages/otlp-exporter-base/src/platform/node/index.ts
+++ b/experimental/packages/otlp-exporter-base/src/platform/node/index.ts
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-export * from './OTLPExporterNodeBase';
-export * from './util';
-export * from './types';
+export { OTLPExporterNodeBase } from './OTLPExporterNodeBase';
+export { sendWithHttp, createHttpAgent, configureCompression } from './util';
+export { OTLPExporterNodeConfigBase, CompressionAlgorithm } from './types';
diff --git a/experimental/packages/otlp-grpc-exporter-base/package.json b/experimental/packages/otlp-grpc-exporter-base/package.json
index a75b6c9ca4..c64506e064 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.35.0",
+ "version": "0.35.1",
"description": "OpenTelemetry OTLP-gRPC Exporter base (for internal use only)",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
@@ -51,9 +51,9 @@
"devDependencies": {
"@babel/core": "7.16.0",
"@opentelemetry/api": "^1.0.0",
- "@opentelemetry/otlp-transformer": "0.35.0",
- "@opentelemetry/resources": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0",
+ "@opentelemetry/otlp-transformer": "0.35.1",
+ "@opentelemetry/resources": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1",
"@types/mocha": "10.0.0",
"@types/node": "18.6.5",
"@types/sinon": "10.0.13",
@@ -61,7 +61,7 @@
"cpx": "1.5.0",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
@@ -73,8 +73,8 @@
"dependencies": {
"@grpc/grpc-js": "^1.7.1",
"@grpc/proto-loader": "^0.7.3",
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/otlp-exporter-base": "0.35.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/otlp-exporter-base": "0.35.1"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/otlp-grpc-exporter-base",
"sideEffects": false
diff --git a/experimental/packages/otlp-proto-exporter-base/package.json b/experimental/packages/otlp-proto-exporter-base/package.json
index c1903cd935..a3ae550587 100644
--- a/experimental/packages/otlp-proto-exporter-base/package.json
+++ b/experimental/packages/otlp-proto-exporter-base/package.json
@@ -1,20 +1,28 @@
{
"name": "@opentelemetry/otlp-proto-exporter-base",
- "version": "0.35.0",
+ "version": "0.35.1",
"description": "OpenTelemetry OTLP-HTTP-protobuf Exporter base (for internal use only)",
"main": "build/src/index.js",
+ "module": "build/esm/index.js",
+ "esnext": "build/esnext/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
+ "browser": {
+ "./src/platform/index.ts": "./src/platform/browser/index.ts",
+ "./build/esm/platform/index.js": "./build/esm/platform/browser/index.js",
+ "./build/esnext/platform/index.js": "./build/esnext/platform/browser/index.js",
+ "./build/src/platform/index.js": "./build/src/platform/browser/index.js"
+ },
"scripts": {
"prepublishOnly": "npm run compile",
- "compile": "npm run protos && tsc --build",
- "clean": "tsc --build --clean",
+ "compile": "npm run protos && tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
+ "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"protos": "npm run submodule && node scripts/protos.js",
"submodule": "git submodule sync --recursive && git submodule update --init --recursive",
"version": "node ../../../scripts/version-update.js",
- "watch": "npm run protos && tsc -w",
+ "watch": "npm run protos && tsc -w tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
"precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies",
"prewatch": "npm run precompile"
},
@@ -33,6 +41,12 @@
"node": ">=14"
},
"files": [
+ "build/esm/**/*.js",
+ "build/esm/**/*.js.map",
+ "build/esm/**/*.d.ts",
+ "build/esnext/**/*.js",
+ "build/esnext/**/*.js.map",
+ "build/esnext/**/*.d.ts",
"build/src/**/*.js",
"build/src/**/*.js.map",
"build/src/**/*.d.ts",
@@ -53,7 +67,7 @@
"mocha": "10.0.0",
"nyc": "15.1.0",
"protobufjs-cli": "1.0.2",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
@@ -63,8 +77,8 @@
"@opentelemetry/api": "^1.0.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/otlp-exporter-base": "0.35.0",
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/otlp-exporter-base": "0.35.1",
"protobufjs": "^7.1.2"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/otlp-proto-exporter-base",
diff --git a/experimental/packages/otlp-proto-exporter-base/scripts/protos.js b/experimental/packages/otlp-proto-exporter-base/scripts/protos.js
index e06cc9db44..3f3fbd6c0c 100644
--- a/experimental/packages/otlp-proto-exporter-base/scripts/protos.js
+++ b/experimental/packages/otlp-proto-exporter-base/scripts/protos.js
@@ -45,6 +45,7 @@ async function pbjs(files) {
const outFile = path.join(generatedPath, 'root.js');
const pbjsOptions = [
'-t', 'static-module',
+ '-p', protosPath,
'-w', 'commonjs',
'--null-defaults',
'-o', outFile,
diff --git a/experimental/packages/otlp-proto-exporter-base/src/index.ts b/experimental/packages/otlp-proto-exporter-base/src/index.ts
index e2cc1ee65c..e76b3a3593 100644
--- a/experimental/packages/otlp-proto-exporter-base/src/index.ts
+++ b/experimental/packages/otlp-proto-exporter-base/src/index.ts
@@ -13,7 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-export { OTLPProtoExporterNodeBase } from './OTLPProtoExporterNodeBase';
-export * from './types';
-export * from './util';
+export * from './platform';
diff --git a/experimental/packages/otlp-proto-exporter-base/src/platform/browser/OTLPProtoExporterBrowserBase.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/browser/OTLPProtoExporterBrowserBase.ts
new file mode 100644
index 0000000000..4e9f95d5c0
--- /dev/null
+++ b/experimental/packages/otlp-proto-exporter-base/src/platform/browser/OTLPProtoExporterBrowserBase.ts
@@ -0,0 +1,94 @@
+/*
+ * 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 { diag } from '@opentelemetry/api';
+import { ServiceClientType } from '../types';
+import {
+ OTLPExporterBrowserBase as OTLPExporterBaseMain,
+ OTLPExporterError,
+ OTLPExporterConfigBase,
+ sendWithXhr,
+} from '@opentelemetry/otlp-exporter-base';
+import * as root from '../../generated/root';
+
+interface ExportRequestType unknown }> {
+ create(properties?: T): R;
+ encode(message: T, writer?: protobuf.Writer): protobuf.Writer;
+ decode(reader: protobuf.Reader | Uint8Array, length?: number): R;
+}
+
+/**
+ * Collector Exporter abstract base class
+ */
+export abstract class OTLPProtoExporterBrowserBase<
+ ExportItem,
+ ServiceRequest
+> extends OTLPExporterBaseMain {
+ constructor(config: OTLPExporterConfigBase = {}) {
+ super(config);
+ }
+
+ private _getExportRequestProto(
+ clientType: ServiceClientType
+ ): ExportRequestType {
+ if (clientType === ServiceClientType.SPANS) {
+ // eslint-disable-next-line
+ return root.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest as unknown as ExportRequestType;
+ } else {
+ // eslint-disable-next-line
+ return root.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest as unknown as ExportRequestType;
+ }
+ }
+
+ override send(
+ objects: ExportItem[],
+ onSuccess: () => void,
+ onError: (error: OTLPExporterError) => void
+ ): void {
+ if (this._shutdownOnce.isCalled) {
+ diag.debug('Shutdown already started. Cannot send objects');
+ return;
+ }
+
+ const serviceRequest = this.convert(objects);
+ const exportRequestType = this._getExportRequestProto(
+ this.getServiceClientType()
+ );
+ const message = exportRequestType.create(serviceRequest);
+
+ if (message) {
+ const body = exportRequestType.encode(message).finish();
+ if (body) {
+ sendWithXhr(
+ new Blob([body], { type: 'application/x-protobuf' }),
+ this.url,
+ {
+ ...this._headers,
+ 'Content-Type': 'application/x-protobuf',
+ Accept: 'application/x-protobuf',
+ },
+ this.timeoutMillis,
+ onSuccess,
+ onError
+ );
+ }
+ } else {
+ onError(new OTLPExporterError('No proto'));
+ }
+ }
+
+ abstract getServiceClientType(): ServiceClientType;
+}
diff --git a/experimental/packages/otlp-proto-exporter-base/src/platform/browser/index.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/browser/index.ts
new file mode 100644
index 0000000000..26765ea51f
--- /dev/null
+++ b/experimental/packages/otlp-proto-exporter-base/src/platform/browser/index.ts
@@ -0,0 +1,17 @@
+/*
+ * 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.
+ */
+export { OTLPProtoExporterBrowserBase } from './OTLPProtoExporterBrowserBase';
+export { ServiceClientType } from '../types';
diff --git a/experimental/packages/otlp-proto-exporter-base/src/platform/index.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/index.ts
new file mode 100644
index 0000000000..22efeb0309
--- /dev/null
+++ b/experimental/packages/otlp-proto-exporter-base/src/platform/index.ts
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+export {
+ OTLPProtoExporterNodeBase,
+ ExportRequestType,
+ getExportRequestProto,
+ send,
+} from './node';
+export { OTLPProtoExporterBrowserBase } from './browser';
+export { ServiceClientType } from './types';
diff --git a/experimental/packages/otlp-proto-exporter-base/src/OTLPProtoExporterNodeBase.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/node/OTLPProtoExporterNodeBase.ts
similarity index 98%
rename from experimental/packages/otlp-proto-exporter-base/src/OTLPProtoExporterNodeBase.ts
rename to experimental/packages/otlp-proto-exporter-base/src/platform/node/OTLPProtoExporterNodeBase.ts
index 1d458c5cf6..c0ff4b6b39 100644
--- a/experimental/packages/otlp-proto-exporter-base/src/OTLPProtoExporterNodeBase.ts
+++ b/experimental/packages/otlp-proto-exporter-base/src/platform/node/OTLPProtoExporterNodeBase.ts
@@ -15,7 +15,7 @@
*/
import { diag } from '@opentelemetry/api';
-import { ServiceClientType } from './types';
+import { ServiceClientType } from '../types';
import {
OTLPExporterNodeBase as OTLPExporterBaseMain,
CompressionAlgorithm,
diff --git a/experimental/packages/otlp-proto-exporter-base/src/platform/node/index.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/node/index.ts
new file mode 100644
index 0000000000..c9c84bdac3
--- /dev/null
+++ b/experimental/packages/otlp-proto-exporter-base/src/platform/node/index.ts
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+
+export { OTLPProtoExporterNodeBase } from './OTLPProtoExporterNodeBase';
+export { ExportRequestType, getExportRequestProto, send } from './util';
diff --git a/experimental/packages/otlp-proto-exporter-base/src/util.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/node/util.ts
similarity index 96%
rename from experimental/packages/otlp-proto-exporter-base/src/util.ts
rename to experimental/packages/otlp-proto-exporter-base/src/platform/node/util.ts
index 1d262cd74b..5cdbfa396d 100644
--- a/experimental/packages/otlp-proto-exporter-base/src/util.ts
+++ b/experimental/packages/otlp-proto-exporter-base/src/platform/node/util.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { ServiceClientType } from './types';
+import { ServiceClientType } from '../types';
import { OTLPProtoExporterNodeBase } from './OTLPProtoExporterNodeBase';
import {
CompressionAlgorithm,
@@ -22,7 +22,7 @@ import {
sendWithHttp,
} from '@opentelemetry/otlp-exporter-base';
import type * as protobuf from 'protobufjs';
-import * as root from './generated/root';
+import * as root from '../../generated/root';
export interface ExportRequestType unknown }> {
create(properties?: T): R;
diff --git a/experimental/packages/otlp-proto-exporter-base/src/types.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/types.ts
similarity index 100%
rename from experimental/packages/otlp-proto-exporter-base/src/types.ts
rename to experimental/packages/otlp-proto-exporter-base/src/platform/types.ts
diff --git a/experimental/packages/otlp-proto-exporter-base/tsconfig.esm.json b/experimental/packages/otlp-proto-exporter-base/tsconfig.esm.json
new file mode 100644
index 0000000000..d5c055a849
--- /dev/null
+++ b/experimental/packages/otlp-proto-exporter-base/tsconfig.esm.json
@@ -0,0 +1,24 @@
+{
+ "extends": "../../../tsconfig.base.esm.json",
+ "compilerOptions": {
+ "allowJs": true,
+ "outDir": "build/esm",
+ "rootDir": "src",
+ "tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
+ },
+ "include": [
+ "src/**/*.ts",
+ "src/generated/*.js"
+ ],
+ "references": [
+ {
+ "path": "../../../api"
+ },
+ {
+ "path": "../../../packages/opentelemetry-core"
+ },
+ {
+ "path": "../otlp-exporter-base"
+ }
+ ]
+}
diff --git a/experimental/packages/otlp-proto-exporter-base/tsconfig.esnext.json b/experimental/packages/otlp-proto-exporter-base/tsconfig.esnext.json
new file mode 100644
index 0000000000..2eeda32b24
--- /dev/null
+++ b/experimental/packages/otlp-proto-exporter-base/tsconfig.esnext.json
@@ -0,0 +1,24 @@
+{
+ "extends": "../../../tsconfig.base.esnext.json",
+ "compilerOptions": {
+ "allowJs": true,
+ "outDir": "build/esnext",
+ "rootDir": "src",
+ "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo"
+ },
+ "include": [
+ "src/**/*.ts",
+ "src/generated/*.js"
+ ],
+ "references": [
+ {
+ "path": "../../../api"
+ },
+ {
+ "path": "../../../packages/opentelemetry-core"
+ },
+ {
+ "path": "../otlp-exporter-base"
+ }
+ ]
+}
diff --git a/experimental/packages/otlp-transformer/package.json b/experimental/packages/otlp-transformer/package.json
index ba4462f5c5..d4596fddba 100644
--- a/experimental/packages/otlp-transformer/package.json
+++ b/experimental/packages/otlp-transformer/package.json
@@ -4,7 +4,7 @@
"publishConfig": {
"access": "public"
},
- "version": "0.35.0",
+ "version": "0.35.1",
"description": "Transform OpenTelemetry SDK data into OTLP",
"module": "build/esm/index.js",
"esnext": "build/esnext/index.js",
@@ -66,20 +66,20 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.32",
"karma-webpack": "4.0.2",
- "mkdirp": "1.0.4",
+ "mkdirp": "2.1.3",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
"typescript": "4.4.4",
"webpack": "4.46.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/resources": "1.9.0",
- "@opentelemetry/sdk-metrics": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/resources": "1.9.1",
+ "@opentelemetry/sdk-metrics": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/otlp-transformer",
"sideEffects": false
diff --git a/experimental/packages/otlp-transformer/src/trace/internal.ts b/experimental/packages/otlp-transformer/src/trace/internal.ts
index bebc41c4e8..e4d787349e 100644
--- a/experimental/packages/otlp-transformer/src/trace/internal.ts
+++ b/experimental/packages/otlp-transformer/src/trace/internal.ts
@@ -32,6 +32,7 @@ export function sdkSpanToOtlpSpan(span: ReadableSpan, useHex?: boolean): ISpan {
traceId: useHex ? ctx.traceId : core.hexToBase64(ctx.traceId),
spanId: useHex ? ctx.spanId : core.hexToBase64(ctx.spanId),
parentSpanId: parentSpanId,
+ traceState: ctx.traceState?.serialize(),
name: span.name,
// Span kind is offset by 1 because the API does not define a value for unset
kind: span.kind == null ? 0 : span.kind + 1,
@@ -60,6 +61,7 @@ export function toOtlpLink(link: Link, useHex?: boolean): ILink {
traceId: useHex
? link.context.traceId
: core.hexToBase64(link.context.traceId),
+ traceState: link.context.traceState?.serialize(),
droppedAttributesCount: 0,
};
}
diff --git a/experimental/packages/otlp-transformer/test/trace.test.ts b/experimental/packages/otlp-transformer/test/trace.test.ts
index 6d0682d3d3..7308139004 100644
--- a/experimental/packages/otlp-transformer/test/trace.test.ts
+++ b/experimental/packages/otlp-transformer/test/trace.test.ts
@@ -60,6 +60,7 @@ function createExpectedSpanJson(useHex: boolean) {
traceId: traceId,
spanId: spanId,
parentSpanId: parentSpanId,
+ traceState: 'span=bar',
name: 'span-name',
kind: ESpanKind.SPAN_KIND_CLIENT,
links: [
@@ -67,6 +68,7 @@ function createExpectedSpanJson(useHex: boolean) {
droppedAttributesCount: 0,
spanId: linkSpanId,
traceId: linkTraceId,
+ traceState: 'link=foo',
attributes: [
{
key: 'link-attribute',
@@ -134,7 +136,7 @@ describe('Trace', () => {
traceFlags: 1,
traceId: '00000000000000000000000000000001',
isRemote: false,
- traceState: new TraceState(''),
+ traceState: new TraceState('span=bar'),
}),
parentSpanId: '0000000000000001',
attributes: { 'string-attribute': 'some attribute value' },
@@ -163,7 +165,7 @@ describe('Trace', () => {
traceId: '00000000000000000000000000000002',
traceFlags: 1,
isRemote: false,
- traceState: new TraceState(''),
+ traceState: new TraceState('link=foo'),
},
attributes: {
'link-attribute': 'string value',
diff --git a/integration-tests/propagation-validation-server/package.json b/integration-tests/propagation-validation-server/package.json
index 8e102338ea..e49ef1ac83 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.9.0",
+ "version": "1.9.1",
"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.9.0",
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0",
+ "@opentelemetry/context-async-hooks": "1.9.1",
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1",
"axios": "0.24.0",
"body-parser": "1.19.0",
"express": "4.17.3"
diff --git a/package.json b/package.json
index 0bec743a3b..df63bd8fcd 100644
--- a/package.json
+++ b/package.json
@@ -55,7 +55,7 @@
"eslint-plugin-header": "3.1.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "4.2.1",
- "gh-pages": "4.0.0",
+ "gh-pages": "5.0.0",
"lerna": "6.0.3",
"lerna-changelog": "2.2.0",
"linkinator": "4.0.3",
diff --git a/packages/opentelemetry-context-async-hooks/package.json b/packages/opentelemetry-context-async-hooks/package.json
index 99fbbd1984..c44f6ea93c 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.9.0",
+ "version": "1.9.1",
"description": "OpenTelemetry AsyncHooks-based Context Manager",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
@@ -50,7 +50,7 @@
"codecov": "3.8.3",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"ts-mocha": "10.0.0",
"typescript": "4.4.4"
},
diff --git a/packages/opentelemetry-context-zone-peer-dep/package.json b/packages/opentelemetry-context-zone-peer-dep/package.json
index 842beda518..ff1f4aa78f 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.9.0",
+ "version": "1.9.1",
"description": "OpenTelemetry Context Zone with peer dependency for zone.js",
"main": "build/src/index.js",
"module": "build/esm/index.js",
@@ -71,7 +71,7 @@
"karma-webpack": "4.0.2",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
diff --git a/packages/opentelemetry-context-zone/package.json b/packages/opentelemetry-context-zone/package.json
index 5f5cd308af..b31be1757c 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.9.0",
+ "version": "1.9.1",
"description": "OpenTelemetry Context Zone",
"main": "build/src/index.js",
"module": "build/esm/index.js",
@@ -64,7 +64,7 @@
"karma-webpack": "4.0.2",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
@@ -74,7 +74,7 @@
"webpack-merge": "5.8.0"
},
"dependencies": {
- "@opentelemetry/context-zone-peer-dep": "1.9.0",
+ "@opentelemetry/context-zone-peer-dep": "1.9.1",
"zone.js": "^0.11.0"
},
"sideEffects": true,
diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json
index 9c65520b56..f9cd044ce6 100644
--- a/packages/opentelemetry-core/package.json
+++ b/packages/opentelemetry-core/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/core",
- "version": "1.9.0",
+ "version": "1.9.1",
"description": "OpenTelemetry Core provides constants and utilities shared by all OpenTelemetry SDK packages.",
"main": "build/src/index.js",
"module": "build/esm/index.js",
@@ -80,7 +80,7 @@
"lerna": "6.0.3",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
@@ -91,7 +91,7 @@
"@opentelemetry/api": ">=1.0.0 <1.5.0"
},
"dependencies": {
- "@opentelemetry/semantic-conventions": "1.9.0"
+ "@opentelemetry/semantic-conventions": "1.9.1"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-core",
"sideEffects": false
diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json
index ae60076423..fbfbf01170 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.9.0",
+ "version": "1.9.1",
"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.9.0",
+ "@opentelemetry/resources": "1.9.1",
"@types/mocha": "10.0.0",
"@types/node": "18.6.5",
"@types/sinon": "10.0.13",
@@ -53,7 +53,7 @@
"mocha": "10.0.0",
"nock": "13.0.11",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-mocha": "10.0.0",
"typescript": "4.4.4"
@@ -62,9 +62,9 @@
"@opentelemetry/api": "^1.0.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0",
- "@opentelemetry/semantic-conventions": "1.9.0",
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1",
+ "@opentelemetry/semantic-conventions": "1.9.1",
"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 558606dad3..76a0bbc4d7 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.9.0",
+ "version": "1.9.1",
"description": "OpenTelemetry Zipkin Exporter allows the user to send collected traces to Zipkin.",
"main": "build/src/index.js",
"module": "build/esm/index.js",
@@ -78,7 +78,7 @@
"mocha": "10.0.0",
"nock": "13.0.11",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
@@ -91,10 +91,10 @@
"@opentelemetry/api": "^1.0.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/resources": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0",
- "@opentelemetry/semantic-conventions": "1.9.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/resources": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1",
+ "@opentelemetry/semantic-conventions": "1.9.1"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-exporter-zipkin",
"sideEffects": false
diff --git a/packages/opentelemetry-propagator-b3/package.json b/packages/opentelemetry-propagator-b3/package.json
index a4800b8f8b..f9d3cad28d 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.9.0",
+ "version": "1.9.1",
"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.9.0"
+ "@opentelemetry/core": "1.9.1"
},
"peerDependencies": {
"@opentelemetry/api": ">=1.0.0 <1.5.0"
@@ -64,7 +64,7 @@
"istanbul-instrumenter-loader": "3.0.1",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
"typescript": "4.4.4"
diff --git a/packages/opentelemetry-propagator-jaeger/package.json b/packages/opentelemetry-propagator-jaeger/package.json
index e47bb04e3b..32bc7760cf 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.9.0",
+ "version": "1.9.1",
"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",
@@ -69,7 +69,7 @@
"karma-webpack": "4.0.2",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
@@ -80,7 +80,7 @@
"@opentelemetry/api": ">=1.0.0 <1.5.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0"
+ "@opentelemetry/core": "1.9.1"
},
"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 c6177a592d..59c1054cb2 100644
--- a/packages/opentelemetry-resources/package.json
+++ b/packages/opentelemetry-resources/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/resources",
- "version": "1.9.0",
+ "version": "1.9.1",
"description": "OpenTelemetry SDK resources",
"main": "build/src/index.js",
"module": "build/esm/index.js",
@@ -77,7 +77,7 @@
"mocha": "10.0.0",
"nock": "13.0.11",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-mocha": "10.0.0",
"typescript": "4.4.4",
@@ -89,8 +89,8 @@
"@opentelemetry/api": ">=1.0.0 <1.5.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/semantic-conventions": "1.9.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/semantic-conventions": "1.9.1"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-resources",
"sideEffects": false
diff --git a/packages/opentelemetry-resources/src/Resource.ts b/packages/opentelemetry-resources/src/Resource.ts
index ac368d812e..0dc2072a2f 100644
--- a/packages/opentelemetry-resources/src/Resource.ts
+++ b/packages/opentelemetry-resources/src/Resource.ts
@@ -34,7 +34,7 @@ export class Resource {
}
/**
- * Returns a Resource that indentifies the SDK in use.
+ * Returns a Resource that identifies the SDK in use.
*/
static default(): Resource {
return new Resource({
diff --git a/packages/opentelemetry-sdk-trace-base/package.json b/packages/opentelemetry-sdk-trace-base/package.json
index c7ffaa8f30..b0f0967ead 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.9.0",
+ "version": "1.9.1",
"description": "OpenTelemetry Tracing",
"main": "build/src/index.js",
"module": "build/esm/index.js",
@@ -80,7 +80,7 @@
"karma-webpack": "4.0.2",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
@@ -91,9 +91,9 @@
"@opentelemetry/api": ">=1.0.0 <1.5.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/resources": "1.9.0",
- "@opentelemetry/semantic-conventions": "1.9.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/resources": "1.9.1",
+ "@opentelemetry/semantic-conventions": "1.9.1"
},
"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/ConsoleSpanExporter.ts b/packages/opentelemetry-sdk-trace-base/src/export/ConsoleSpanExporter.ts
index 8f1b8e1978..77b0965598 100644
--- a/packages/opentelemetry-sdk-trace-base/src/export/ConsoleSpanExporter.ts
+++ b/packages/opentelemetry-sdk-trace-base/src/export/ConsoleSpanExporter.ts
@@ -57,6 +57,7 @@ export class ConsoleSpanExporter implements SpanExporter {
return {
traceId: span.spanContext().traceId,
parentId: span.parentSpanId,
+ traceState: span.spanContext().traceState?.serialize(),
name: span.name,
id: span.spanContext().spanId,
kind: span.kind,
diff --git a/packages/opentelemetry-sdk-trace-base/test/common/export/ConsoleSpanExporter.test.ts b/packages/opentelemetry-sdk-trace-base/test/common/export/ConsoleSpanExporter.test.ts
index 633cac3ec7..72642927a3 100644
--- a/packages/opentelemetry-sdk-trace-base/test/common/export/ConsoleSpanExporter.test.ts
+++ b/packages/opentelemetry-sdk-trace-base/test/common/export/ConsoleSpanExporter.test.ts
@@ -15,6 +15,7 @@
*/
import { SpanContext, TraceFlags } from '@opentelemetry/api';
+import { TraceState } from '@opentelemetry/core';
import * as assert from 'assert';
import * as sinon from 'sinon';
import {
@@ -63,6 +64,7 @@ describe('ConsoleSpanExporter', () => {
const span = tracer.startSpan('foo', {
links: [{ context, attributes: { anAttr: 'aValue' } }],
});
+ span.spanContext().traceState = new TraceState('trace=state');
span.addEvent('foobar');
span.end();
@@ -85,6 +87,7 @@ describe('ConsoleSpanExporter', () => {
'status',
'timestamp',
'traceId',
+ 'traceState',
].join(',');
assert.ok(firstSpan.name === 'foo');
diff --git a/packages/opentelemetry-sdk-trace-node/package.json b/packages/opentelemetry-sdk-trace-node/package.json
index f49cf4c553..53a01967b3 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.9.0",
+ "version": "1.9.1",
"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.5.0",
- "@opentelemetry/resources": "1.9.0",
- "@opentelemetry/semantic-conventions": "1.9.0",
+ "@opentelemetry/resources": "1.9.1",
+ "@opentelemetry/semantic-conventions": "1.9.1",
"@types/mocha": "10.0.0",
"@types/node": "18.6.5",
"@types/semver": "7.3.9",
@@ -55,7 +55,7 @@
"codecov": "3.8.3",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-mocha": "10.0.0",
"typescript": "4.4.4"
@@ -64,11 +64,11 @@
"@opentelemetry/api": ">=1.0.0 <1.5.0"
},
"dependencies": {
- "@opentelemetry/context-async-hooks": "1.9.0",
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/propagator-b3": "1.9.0",
- "@opentelemetry/propagator-jaeger": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0",
+ "@opentelemetry/context-async-hooks": "1.9.1",
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/propagator-b3": "1.9.1",
+ "@opentelemetry/propagator-jaeger": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1",
"semver": "^7.3.5"
},
"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 4a456d43a6..285ac03779 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.9.0",
+ "version": "1.9.1",
"description": "OpenTelemetry Web Tracer",
"main": "build/src/index.js",
"module": "build/esm/index.js",
@@ -57,9 +57,9 @@
"devDependencies": {
"@babel/core": "7.16.0",
"@opentelemetry/api": ">=1.0.0 <1.5.0",
- "@opentelemetry/context-zone": "1.9.0",
- "@opentelemetry/propagator-b3": "1.9.0",
- "@opentelemetry/resources": "1.9.0",
+ "@opentelemetry/context-zone": "1.9.1",
+ "@opentelemetry/propagator-b3": "1.9.1",
+ "@opentelemetry/resources": "1.9.1",
"@types/jquery": "3.5.8",
"@types/mocha": "10.0.0",
"@types/node": "18.6.5",
@@ -78,7 +78,7 @@
"karma-webpack": "4.0.2",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
@@ -91,9 +91,9 @@
"@opentelemetry/api": ">=1.0.0 <1.5.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0",
- "@opentelemetry/semantic-conventions": "1.9.0"
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1",
+ "@opentelemetry/semantic-conventions": "1.9.1"
},
"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 8d091a5ce5..7887147efc 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.9.0",
+ "version": "1.9.1",
"description": "OpenTelemetry semantic conventions",
"main": "build/src/index.js",
"module": "build/esm/index.js",
@@ -56,7 +56,7 @@
"mocha": "10.0.0",
"nock": "13.0.11",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-mocha": "10.0.0",
"typescript": "4.4.4"
diff --git a/packages/opentelemetry-shim-opentracing/package.json b/packages/opentelemetry-shim-opentracing/package.json
index cd3beb16ab..1262559717 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.9.0",
+ "version": "1.9.1",
"description": "OpenTracing to OpenTelemetry shim",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
@@ -43,15 +43,15 @@
},
"devDependencies": {
"@opentelemetry/api": ">=1.0.0 <1.5.0",
- "@opentelemetry/propagator-b3": "1.9.0",
- "@opentelemetry/propagator-jaeger": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0",
+ "@opentelemetry/propagator-b3": "1.9.1",
+ "@opentelemetry/propagator-jaeger": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1",
"@types/mocha": "10.0.0",
"@types/node": "18.6.5",
"codecov": "3.8.3",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"ts-mocha": "10.0.0",
"typescript": "4.4.4"
},
@@ -59,8 +59,8 @@
"@opentelemetry/api": ">=1.0.0 <1.5.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/semantic-conventions": "1.9.0",
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/semantic-conventions": "1.9.1",
"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 2112fa5514..bcd67dfb2a 100644
--- a/packages/sdk-metrics/package.json
+++ b/packages/sdk-metrics/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/sdk-metrics",
- "version": "1.9.0",
+ "version": "1.9.1",
"description": "OpenTelemetry metrics SDK",
"main": "build/src/index.js",
"module": "build/esm/index.js",
@@ -68,7 +68,7 @@
"karma-webpack": "4.0.2",
"mocha": "10.0.0",
"nyc": "15.1.0",
- "rimraf": "3.0.2",
+ "rimraf": "4.1.2",
"sinon": "15.0.0",
"ts-mocha": "10.0.0",
"typescript": "4.4.4"
@@ -77,8 +77,8 @@
"@opentelemetry/api": ">=1.3.0 <1.5.0"
},
"dependencies": {
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/resources": "1.9.0",
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/resources": "1.9.1",
"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/aggregator/exponential-histogram/mapping/ExponentMapping.ts b/packages/sdk-metrics/src/aggregator/exponential-histogram/mapping/ExponentMapping.ts
new file mode 100644
index 0000000000..49662b44f4
--- /dev/null
+++ b/packages/sdk-metrics/src/aggregator/exponential-histogram/mapping/ExponentMapping.ts
@@ -0,0 +1,105 @@
+/*
+ * 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 * as ieee754 from './ieee754';
+import * as util from '../util';
+import { Mapping, MappingError } from './types';
+
+/**
+ * ExponentMapping implements exponential mapping functions for
+ * scales <=0. For scales > 0 LogarithmMapping should be used.
+ */
+export class ExponentMapping implements Mapping {
+ private readonly _shift: number;
+
+ constructor(scale: number) {
+ this._shift = -scale;
+ }
+
+ /**
+ * Maps positive floating point values to indexes corresponding to scale
+ * @param value
+ * @returns {number} index for provided value at the current scale
+ */
+ mapToIndex(value: number): number {
+ if (value < ieee754.MIN_VALUE) {
+ return this._minNormalLowerBoundaryIndex();
+ }
+
+ const exp = ieee754.getNormalBase2(value);
+
+ // In case the value is an exact power of two, compute a
+ // correction of -1. Note, we are using a custom _rightShift
+ // to accommodate a 52-bit argument, which the native bitwise
+ // operators do not support
+ const correction = this._rightShift(
+ ieee754.getSignificand(value) - 1,
+ ieee754.SIGNIFICAND_WIDTH
+ );
+
+ return (exp + correction) >> this._shift;
+ }
+
+ /**
+ * Returns the lower bucket boundary for the given index for scale
+ *
+ * @param index
+ * @returns {number}
+ */
+ lowerBoundary(index: number): number {
+ const minIndex = this._minNormalLowerBoundaryIndex();
+ if (index < minIndex) {
+ throw new MappingError(
+ `underflow: ${index} is < minimum lower boundary: ${minIndex}`
+ );
+ }
+ const maxIndex = this._maxNormalLowerBoundaryIndex();
+ if (index > maxIndex) {
+ throw new MappingError(
+ `overflow: ${index} is > maximum lower boundary: ${maxIndex}`
+ );
+ }
+
+ return util.ldexp(1, index << this._shift);
+ }
+
+ /**
+ * The scale used by this mapping
+ * @returns {number}
+ */
+ scale(): number {
+ if (this._shift === 0) {
+ return 0;
+ }
+ return -this._shift;
+ }
+
+ private _minNormalLowerBoundaryIndex(): number {
+ let index = ieee754.MIN_NORMAL_EXPONENT >> this._shift;
+ if (this._shift < 2) {
+ index--;
+ }
+
+ return index;
+ }
+
+ private _maxNormalLowerBoundaryIndex(): number {
+ return ieee754.MAX_NORMAL_EXPONENT >> this._shift;
+ }
+
+ private _rightShift(value: number, shift: number): number {
+ return Math.floor(value * Math.pow(2, -shift));
+ }
+}
diff --git a/packages/sdk-metrics/src/aggregator/exponential-histogram/mapping/LogarithmMapping.ts b/packages/sdk-metrics/src/aggregator/exponential-histogram/mapping/LogarithmMapping.ts
new file mode 100644
index 0000000000..974d9ff84e
--- /dev/null
+++ b/packages/sdk-metrics/src/aggregator/exponential-histogram/mapping/LogarithmMapping.ts
@@ -0,0 +1,108 @@
+/*
+ * 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 * as ieee754 from './ieee754';
+import * as util from '../util';
+import { Mapping, MappingError } from './types';
+
+/**
+ * LogarithmMapping implements exponential mapping functions for scale > 0.
+ * For scales <= 0 the exponent mapping should be used.
+ */
+export class LogarithmMapping implements Mapping {
+ private readonly _scale: number;
+ private readonly _scaleFactor: number;
+ private readonly _inverseFactor: number;
+
+ constructor(scale: number) {
+ this._scale = scale;
+ this._scaleFactor = util.ldexp(Math.LOG2E, scale);
+ this._inverseFactor = util.ldexp(Math.LN2, -scale);
+ }
+
+ /**
+ * Maps positive floating point values to indexes corresponding to scale
+ * @param value
+ * @returns {number} index for provided value at the current scale
+ */
+ mapToIndex(value: number): number {
+ if (value <= ieee754.MIN_VALUE) {
+ return this._minNormalLowerBoundaryIndex() - 1;
+ }
+
+ // exact power of two special case
+ if (ieee754.getSignificand(value) === 0) {
+ const exp = ieee754.getNormalBase2(value);
+ return (exp << this._scale) - 1;
+ }
+
+ // non-power of two cases. use Math.floor to round the scaled logarithm
+ const index = Math.floor(Math.log(value) * this._scaleFactor);
+ const maxIndex = this._maxNormalLowerBoundaryIndex();
+ if (index >= maxIndex) {
+ return maxIndex;
+ }
+
+ return index;
+ }
+
+ /**
+ * Returns the lower bucket boundary for the given index for scale
+ *
+ * @param index
+ * @returns {number}
+ */
+ lowerBoundary(index: number): number {
+ const maxIndex = this._maxNormalLowerBoundaryIndex();
+ if (index >= maxIndex) {
+ if (index === maxIndex) {
+ return 2 * Math.exp((index - (1 << this._scale)) / this._scaleFactor);
+ }
+ throw new MappingError(
+ `overflow: ${index} is > maximum lower boundary: ${maxIndex}`
+ );
+ }
+
+ const minIndex = this._minNormalLowerBoundaryIndex();
+ if (index <= minIndex) {
+ if (index === minIndex) {
+ return ieee754.MIN_VALUE;
+ } else if (index === minIndex - 1) {
+ return Math.exp((index + (1 << this._scale)) / this._scaleFactor) / 2;
+ }
+ throw new MappingError(
+ `overflow: ${index} is < minimum lower boundary: ${minIndex}`
+ );
+ }
+
+ return Math.exp(index * this._inverseFactor);
+ }
+
+ /**
+ * The scale used by this mapping
+ * @returns {number}
+ */
+ scale(): number {
+ return this._scale;
+ }
+
+ private _minNormalLowerBoundaryIndex(): number {
+ return ieee754.MIN_NORMAL_EXPONENT << this._scale;
+ }
+
+ private _maxNormalLowerBoundaryIndex(): number {
+ return ((ieee754.MAX_NORMAL_EXPONENT + 1) << this._scale) - 1;
+ }
+}
diff --git a/packages/sdk-metrics/src/aggregator/exponential-histogram/mapping/getMapping.ts b/packages/sdk-metrics/src/aggregator/exponential-histogram/mapping/getMapping.ts
new file mode 100644
index 0000000000..ce8949b325
--- /dev/null
+++ b/packages/sdk-metrics/src/aggregator/exponential-histogram/mapping/getMapping.ts
@@ -0,0 +1,44 @@
+/*
+ * 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 { ExponentMapping } from './ExponentMapping';
+import { LogarithmMapping } from './LogarithmMapping';
+import { MappingError, Mapping } from './types';
+
+const MIN_SCALE = -10;
+const MAX_SCALE = 20;
+const PREBUILT_MAPPINGS = Array.from({ length: 31 }, (_, i) => {
+ if (i > 10) {
+ return new LogarithmMapping(i - 10);
+ }
+ return new ExponentMapping(i - 10);
+});
+
+/**
+ * getMapping returns an appropriate mapping for the given scale. For scales -10
+ * to 0 the underlying type will be ExponentMapping. For scales 1 to 20 the
+ * underlying type will be LogarithmMapping.
+ * @param scale a number in the range [-10, 20]
+ * @returns {Mapping}
+ */
+export function getMapping(scale: number): Mapping {
+ if (scale > MAX_SCALE || scale < MIN_SCALE) {
+ throw new MappingError(
+ `expected scale >= ${MIN_SCALE} && <= ${MAX_SCALE}, got: ${scale}`
+ );
+ }
+ // mappings are offset by 10. scale -10 is at position 0 and scale 20 is at 30
+ return PREBUILT_MAPPINGS[scale + 10];
+}
diff --git a/packages/sdk-metrics/src/aggregator/exponential-histogram/mapping/ieee754.ts b/packages/sdk-metrics/src/aggregator/exponential-histogram/mapping/ieee754.ts
new file mode 100644
index 0000000000..0dc4f01bc3
--- /dev/null
+++ b/packages/sdk-metrics/src/aggregator/exponential-histogram/mapping/ieee754.ts
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ */
+
+/**
+ * The functions and constants in this file allow us to interact
+ * with the internal representation of an IEEE 64-bit floating point
+ * number. We need to work with all 64-bits, thus, care needs to be
+ * taken when working with Javascript's bitwise operators (<<, >>, &,
+ * |, etc) as they truncate operands to 32-bits. In order to work around
+ * this we work with the 64-bits as two 32-bit halves, perform bitwise
+ * operations on them independently, and combine the results (if needed).
+ */
+
+export const SIGNIFICAND_WIDTH = 52;
+
+/**
+ * EXPONENT_MASK is set to 1 for the hi 32-bits of an IEEE 754
+ * floating point exponent: 0x7ff00000.
+ */
+const EXPONENT_MASK = 0x7ff00000;
+
+/**
+ * SIGNIFICAND_MASK is the mask for the significand portion of the hi 32-bits
+ * of an IEEE 754 double-precision floating-point value: 0xfffff
+ */
+const SIGNIFICAND_MASK = 0xfffff;
+
+/**
+ * EXPONENT_BIAS is the exponent bias specified for encoding
+ * the IEEE 754 double-precision floating point exponent: 1023
+ */
+const EXPONENT_BIAS = 1023;
+
+/**
+ * MIN_NORMAL_EXPONENT is the minimum exponent of a normalized
+ * floating point: -1022.
+ */
+export const MIN_NORMAL_EXPONENT = -EXPONENT_BIAS + 1;
+
+/**
+ * MAX_NORMAL_EXPONENT is the maximum exponent of a normalized
+ * floating point: 1023.
+ */
+export const MAX_NORMAL_EXPONENT = EXPONENT_BIAS;
+
+/**
+ * MIN_VALUE is the smallest normal number
+ */
+export const MIN_VALUE = Math.pow(2, -1022);
+
+/**
+ * getNormalBase2 extracts the normalized base-2 fractional exponent.
+ * This returns k for the equation f x 2**k where f is
+ * in the range [1, 2). Note that this function is not called for
+ * subnormal numbers.
+ * @param {number} value - the value to determine normalized base-2 fractional
+ * exponent for
+ * @returns {number} the normalized base-2 exponent
+ */
+export function getNormalBase2(value: number): number {
+ const dv = new DataView(new ArrayBuffer(8));
+ dv.setFloat64(0, value);
+ // access the raw 64-bit float as 32-bit uints
+ const hiBits = dv.getUint32(0);
+ const expBits = (hiBits & EXPONENT_MASK) >> 20;
+ return expBits - EXPONENT_BIAS;
+}
+
+/**
+ * GetSignificand returns the 52 bit (unsigned) significand as a signed value.
+ * @param {number} value - the floating point number to extract the significand from
+ * @returns {number} The 52-bit significand
+ */
+export function getSignificand(value: number): number {
+ const dv = new DataView(new ArrayBuffer(8));
+ dv.setFloat64(0, value);
+ // access the raw 64-bit float as two 32-bit uints
+ const hiBits = dv.getUint32(0);
+ const loBits = dv.getUint32(4);
+ // extract the significand bits from the hi bits and left shift 32 places note:
+ // we can't use the native << operator as it will truncate the result to 32-bits
+ const significandHiBits = (hiBits & SIGNIFICAND_MASK) * Math.pow(2, 32);
+ // combine the hi and lo bits and return
+ return significandHiBits + loBits;
+}
diff --git a/packages/sdk-metrics/src/aggregator/exponential-histogram/mapping/types.ts b/packages/sdk-metrics/src/aggregator/exponential-histogram/mapping/types.ts
new file mode 100644
index 0000000000..afe6ed9118
--- /dev/null
+++ b/packages/sdk-metrics/src/aggregator/exponential-histogram/mapping/types.ts
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+export class MappingError extends Error {}
+
+/**
+ * The mapping interface is used by the exponential histogram to determine
+ * where to bucket values. The interface is implemented by ExponentMapping,
+ * used for scales [-10, 0] and LogarithmMapping, used for scales [1, 20].
+ */
+export interface Mapping {
+ mapToIndex(value: number): number;
+ lowerBoundary(index: number): number;
+ scale(): number;
+}
diff --git a/packages/sdk-metrics/src/aggregator/exponential-histogram/util.ts b/packages/sdk-metrics/src/aggregator/exponential-histogram/util.ts
new file mode 100644
index 0000000000..356bbab260
--- /dev/null
+++ b/packages/sdk-metrics/src/aggregator/exponential-histogram/util.ts
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+/**
+ * Note: other languages provide this as a built in function. This is
+ * a naive, but functionally correct implementation. This is used sparingly,
+ * when creating a new mapping in a running application.
+ *
+ * ldexp returns frac × 2**exp. With the following special cases:
+ * ldexp(±0, exp) = ±0
+ * ldexp(±Inf, exp) = ±Inf
+ * ldexp(NaN, exp) = NaN
+ * @param frac
+ * @param exp
+ * @returns {number}
+ */
+export function ldexp(frac: number, exp: number): number {
+ if (
+ frac === 0 ||
+ frac === Number.POSITIVE_INFINITY ||
+ frac === Number.NEGATIVE_INFINITY ||
+ Number.isNaN(frac)
+ ) {
+ return frac;
+ }
+ return frac * Math.pow(2, exp);
+}
diff --git a/packages/sdk-metrics/test/aggregator/exponential-histogram/ExponentMapping.test.ts b/packages/sdk-metrics/test/aggregator/exponential-histogram/ExponentMapping.test.ts
new file mode 100644
index 0000000000..8a9ed82157
--- /dev/null
+++ b/packages/sdk-metrics/test/aggregator/exponential-histogram/ExponentMapping.test.ts
@@ -0,0 +1,295 @@
+/*
+ * 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 { ExponentMapping } from '../../../src/aggregator/exponential-histogram/mapping/ExponentMapping';
+import * as ieee754 from '../../../src/aggregator/exponential-histogram/mapping/ieee754';
+import * as assert from 'assert';
+
+const MIN_SCALE = -10;
+const MAX_SCALE = 0;
+
+describe('ExponentMapping', () => {
+ it('maps expected values for scale 0', () => {
+ const mapping = new ExponentMapping(0);
+ assert.strictEqual(mapping.scale(), 0);
+
+ const expectedMappings = [
+ // near +inf
+ [Number.MAX_VALUE, ieee754.MAX_NORMAL_EXPONENT],
+ [Number.MAX_VALUE, 1023],
+ [Math.pow(2, 1023), 1022],
+ [1.0625 * Math.pow(2, 1023), 1023],
+ [Math.pow(2, 1022), 1021],
+ [1.0625 * Math.pow(2, 1023), 1023],
+
+ // near 0
+ [Math.pow(2, -1022), -1023],
+ [1.0625 * Math.pow(2, -1022), -1022],
+ [Math.pow(2, -1021), -1022],
+ [1.0625 * Math.pow(2, -1021), -1021],
+
+ [Math.pow(2, -1022), ieee754.MIN_NORMAL_EXPONENT - 1],
+ [Math.pow(2, -1021), ieee754.MIN_NORMAL_EXPONENT],
+ [Number.MIN_VALUE, ieee754.MIN_NORMAL_EXPONENT - 1],
+
+ // near 1
+ [4, 1],
+ [3, 1],
+ [2, 0],
+ [1.5, 0],
+ [1, -1],
+ [0.75, -1],
+ [0.51, -1],
+ [0.5, -2],
+ [0.26, -2],
+ [0.25, -3],
+ [0.126, -3],
+ [0.125, -4],
+ ];
+
+ expectedMappings.forEach(([value, expected]) => {
+ const result = mapping.mapToIndex(value);
+ assert.strictEqual(
+ result,
+ expected,
+ `expected: ${value} to map to: ${expected}, got: ${result}`
+ );
+ });
+ });
+
+ it('maps expected values for min scale', () => {
+ const mapping = new ExponentMapping(MIN_SCALE);
+ assert.strictEqual(mapping.scale(), MIN_SCALE);
+
+ const expectedMappings = [
+ [1.000001, 0],
+ [1, -1],
+ [Number.MAX_VALUE / 2, 0],
+ [Number.MAX_VALUE, 0],
+ [Number.MIN_VALUE, -1],
+ [0.5, -1],
+ ];
+
+ expectedMappings.forEach(([value, expected]) => {
+ const result = mapping.mapToIndex(value);
+ assert.strictEqual(
+ result,
+ expected,
+ `expected: ${value} to map to: ${expected}, got: ${result}`
+ );
+ });
+ });
+
+ it('maps expected values for scale -1', () => {
+ const mapping = new ExponentMapping(-1);
+ assert.strictEqual(mapping.scale(), -1);
+
+ const expectedMappings = [
+ [17, 2],
+ [16, 1],
+ [15, 1],
+ [9, 1],
+ [8, 1],
+ [5, 1],
+ [4, 0],
+ [3, 0],
+ [2, 0],
+ [1.5, 0],
+ [1, -1],
+ [0.75, -1],
+ [0.5, -1],
+ [0.25, -2],
+ [0.2, -2],
+ [0.13, -2],
+ [0.125, -2],
+ [0.1, -2],
+ [0.0625, -3],
+ [0.06, -3],
+ ];
+
+ expectedMappings.forEach(([value, expected]) => {
+ const result = mapping.mapToIndex(value);
+ assert.strictEqual(
+ result,
+ expected,
+ `expected: ${value} to map to: ${expected}, got: ${result}`
+ );
+ });
+ });
+
+ it('maps expected values for scale -4', () => {
+ const mapping = new ExponentMapping(-4);
+ assert.strictEqual(mapping.scale(), -4);
+
+ const expectedMappings = [
+ [0x1, -1],
+ [0x10, 0],
+ [0x100, 0],
+ [0x1000, 0],
+ [0x10000, 0], // Base == 2**16
+ [0x100000, 1],
+ [0x1000000, 1],
+ [0x10000000, 1],
+ [0x100000000, 1], // == 2**32
+ [0x1000000000, 2],
+ [0x10000000000, 2],
+ [0x100000000000, 2],
+ [0x1000000000000, 2], // 2**48
+ [0x10000000000000, 3],
+ [0x1000000000000000, 3],
+ [0x10000000000000000, 3], // 2**64
+ [0x100000000000000000, 4],
+ [0x1000000000000000000, 4],
+ [0x10000000000000000000, 4],
+ [0x100000000000000000000, 4], // 2**80
+ [0x1000000000000000000000, 5],
+
+ [1 / 0x1, -1],
+ [1 / 0x10, -1],
+ [1 / 0x100, -1],
+ [1 / 0x1000, -1],
+ [1 / 0x10000, -2], // 2**-16
+ [1 / 0x100000, -2],
+ [1 / 0x1000000, -2],
+ [1 / 0x10000000, -2],
+ [1 / 0x100000000, -3], // 2**-32
+ [1 / 0x1000000000, -3],
+ [1 / 0x10000000000, -3],
+ [1 / 0x100000000000, -3],
+ [1 / 0x1000000000000, -4], // 2**-48
+ [1 / 0x10000000000000, -4],
+ [1 / 0x100000000000000, -4],
+ [1 / 0x1000000000000000, -4],
+ [1 / 0x10000000000000000, -5], // 2**-64
+ [1 / 0x100000000000000000, -5],
+
+ // Max values
+ // below is equivalent to [0x1.FFFFFFFFFFFFFp1023, 63],
+ [
+ Array.from({ length: 13 }, (_, x) => 0xf * Math.pow(16, -x - 1)).reduce(
+ (x, y) => x + y,
+ 1
+ ) * Math.pow(2, 1023),
+ 63,
+ ],
+ [Math.pow(2, 1023), 63],
+ [Math.pow(2, 1019), 63],
+ [Math.pow(2, 1009), 63],
+ [Math.pow(2, 1008), 62],
+ [Math.pow(2, 1007), 62],
+ [Math.pow(2, 1000), 62],
+ [Math.pow(2, 993), 62],
+ [Math.pow(2, 992), 61],
+ [Math.pow(2, 991), 61],
+
+ // Min and subnormal values
+ [Math.pow(2, -1074), -64],
+ [Math.pow(2, -1073), -64],
+ [Math.pow(2, -1072), -64],
+ [Math.pow(2, -1057), -64],
+ [Math.pow(2, -1056), -64],
+ [Math.pow(2, -1041), -64],
+ [Math.pow(2, -1040), -64],
+ [Math.pow(2, -1025), -64],
+ [Math.pow(2, -1024), -64],
+ [Math.pow(2, -1023), -64],
+ [Math.pow(2, -1022), -64],
+ [Math.pow(2, -1009), -64],
+ [Math.pow(2, -1008), -64],
+ [Math.pow(2, -1007), -63],
+ [Math.pow(2, -993), -63],
+ [Math.pow(2, -992), -63],
+ [Math.pow(2, -991), -62],
+ [Math.pow(2, -977), -62],
+ [Math.pow(2, -976), -62],
+ [Math.pow(2, -975), -61],
+ ];
+
+ expectedMappings.forEach(([value, expected]) => {
+ const result = mapping.mapToIndex(value);
+ assert.strictEqual(
+ result,
+ expected,
+ `expected: ${value} to map to: ${expected}, got: ${result}`
+ );
+ });
+ });
+
+ it('handles max index for all scales', () => {
+ for (let scale = MIN_SCALE; scale <= MAX_SCALE; scale++) {
+ const mapping = new ExponentMapping(scale);
+ const index = mapping.mapToIndex(Number.MAX_VALUE);
+ const maxIndex = ((ieee754.MAX_NORMAL_EXPONENT + 1) >> -scale) - 1;
+ assert.strictEqual(
+ index,
+ maxIndex,
+ `expected index: ${index} and ${maxIndex} to be equal for scale: ${scale}`
+ );
+
+ const boundary = mapping.lowerBoundary(index);
+ assert.strictEqual(boundary, roundedBoundary(scale, maxIndex));
+
+ assert.throws(() => {
+ // one larger will overflow
+ mapping.lowerBoundary(index + 1);
+ });
+ }
+ });
+
+ it('handles min index for all scales', () => {
+ for (let scale = MIN_SCALE; scale <= MAX_SCALE; scale++) {
+ const mapping = new ExponentMapping(scale);
+ const minIndex = mapping.mapToIndex(ieee754.MIN_VALUE);
+ let expectedMinIndex = ieee754.MIN_NORMAL_EXPONENT >> -scale;
+ if (ieee754.MIN_NORMAL_EXPONENT % (1 << -scale) === 0) {
+ expectedMinIndex--;
+ }
+ assert.strictEqual(
+ minIndex,
+ expectedMinIndex,
+ `expected expectedMinIndex: ${expectedMinIndex} and ${minIndex} to be equal for scale: ${scale}`
+ );
+
+ const boundary = mapping.lowerBoundary(minIndex);
+ const expectedBoundary = roundedBoundary(scale, expectedMinIndex);
+ assert.strictEqual(boundary, expectedBoundary);
+
+ //one smaller will underflow
+ assert.throws(() => {
+ mapping.lowerBoundary(minIndex - 1);
+ });
+
+ // subnormals map to the min index
+ [
+ ieee754.MIN_VALUE / 2,
+ ieee754.MIN_VALUE / 3,
+ Math.pow(2, -1050),
+ Math.pow(2, -1073),
+ 1.0625 * Math.pow(2, -1073),
+ Math.pow(2, -1074),
+ ].forEach(value => {
+ assert.strictEqual(mapping.mapToIndex(value), expectedMinIndex);
+ });
+ }
+ });
+});
+
+function roundedBoundary(scale: number, index: number): number {
+ let result = Math.pow(2, index);
+ for (let i = scale; i < 0; i++) {
+ result = result * result;
+ }
+ return result;
+}
diff --git a/packages/sdk-metrics/test/aggregator/exponential-histogram/LogarithmMapping.test.ts b/packages/sdk-metrics/test/aggregator/exponential-histogram/LogarithmMapping.test.ts
new file mode 100644
index 0000000000..d6d04bf814
--- /dev/null
+++ b/packages/sdk-metrics/test/aggregator/exponential-histogram/LogarithmMapping.test.ts
@@ -0,0 +1,177 @@
+/*
+ * 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 { LogarithmMapping } from '../../../src/aggregator/exponential-histogram/mapping/LogarithmMapping';
+import * as ieee754 from '../../../src/aggregator/exponential-histogram/mapping/ieee754';
+import * as assert from 'assert';
+import { assertInEpsilon } from './helpers';
+
+const MIN_SCALE = 1;
+const MAX_SCALE = 20;
+
+describe('LogarithmMapping', () => {
+ it('maps values for scale 1', () => {
+ const mapping = new LogarithmMapping(1);
+ assert.strictEqual(mapping.scale(), 1);
+
+ const expectedMappings = [
+ [15, 7],
+ [9, 6],
+ [7, 5],
+ [5, 4],
+ [3, 3],
+ [2.5, 2],
+ [1.5, 1],
+ [1.2, 0],
+ [1, -1],
+ [0.75, -1],
+ [0.55, -2],
+ [0.45, -3],
+ ];
+
+ expectedMappings.forEach(([value, expected]) => {
+ const result = mapping.mapToIndex(value);
+ assert.strictEqual(
+ result,
+ expected,
+ `expected: ${value} to map to: ${expected}, got: ${result}`
+ );
+ });
+ });
+
+ it('computes boundary', () => {
+ [1, 2, 3, 4, 10, 15].forEach(scale => {
+ const mapping = new LogarithmMapping(scale);
+ [-100, -10, -1, 0, 1, 10, 100].forEach(index => {
+ const boundary = mapping.lowerBoundary(index);
+ const mappedIndex = mapping.mapToIndex(boundary);
+
+ assert.ok(index - 1 <= mappedIndex);
+ assert.ok(index >= mappedIndex);
+ assertInEpsilon(roundedBoundary(scale, index), boundary, 1e-9);
+ });
+ });
+ });
+
+ it('handles max index for each scale', () => {
+ for (let scale = MIN_SCALE; scale <= MAX_SCALE; scale++) {
+ const mapping = new LogarithmMapping(scale);
+ const index = mapping.mapToIndex(Number.MAX_VALUE);
+
+ // the max index is one less than the first index that
+ // overflows Number.MAX_VALUE
+ const maxIndex = ((ieee754.MAX_NORMAL_EXPONENT + 1) << scale) - 1;
+
+ assert.strictEqual(index, maxIndex);
+
+ const boundary = mapping.lowerBoundary(index);
+ const base = mapping.lowerBoundary(1);
+
+ assert.ok(
+ boundary < Number.MAX_VALUE,
+ `expected boundary: ${boundary} to be < max value: ${Number.MAX_VALUE}`
+ );
+
+ assertInEpsilon(
+ base - 1,
+ (Number.MAX_VALUE - boundary) / boundary,
+ 10e-6
+ );
+ }
+ });
+
+ it('handles min index for each scale', () => {
+ for (let scale = MIN_SCALE; scale <= MAX_SCALE; scale++) {
+ const mapping = new LogarithmMapping(scale);
+ const minIndex = mapping.mapToIndex(ieee754.MIN_VALUE);
+
+ const expectedMinIndex = (ieee754.MIN_NORMAL_EXPONENT << scale) - 1;
+ assert.strictEqual(minIndex, expectedMinIndex);
+
+ const expectedBoundary = roundedBoundary(scale, expectedMinIndex);
+ assert.ok(expectedBoundary < ieee754.MIN_VALUE);
+
+ const expectedUpperBoundary = roundedBoundary(
+ scale,
+ expectedMinIndex + 1
+ );
+ assert.strictEqual(ieee754.MIN_VALUE, expectedUpperBoundary);
+
+ const mappedLowerBoundary = mapping.lowerBoundary(minIndex + 1);
+ assertInEpsilon(ieee754.MIN_VALUE, mappedLowerBoundary, 1e-6);
+
+ // subnormals map to the min index
+ [
+ ieee754.MIN_VALUE / 2,
+ ieee754.MIN_VALUE / 3,
+ ieee754.MIN_VALUE / 100,
+ Math.pow(2, -1050),
+ Math.pow(2, -1073),
+ 1.0625 * Math.pow(2, -1073),
+ Math.pow(2, -1074),
+ ].forEach(value => {
+ const result = mapping.mapToIndex(value);
+ assert.strictEqual(result, expectedMinIndex);
+ });
+
+ const mappedMinLower = mapping.lowerBoundary(minIndex);
+
+ assertInEpsilon(expectedBoundary, mappedMinLower, 1e-6);
+
+ // one smaller will underflow
+ assert.throws(() => {
+ mapping.lowerBoundary(minIndex - 1);
+ });
+ }
+ });
+
+ it('maps max float to max index for each scale', () => {
+ for (let scale = MIN_SCALE; scale <= MAX_SCALE; scale++) {
+ const mapping = new LogarithmMapping(scale);
+ const index = mapping.mapToIndex(Number.MAX_VALUE);
+ const maxIndex = ((ieee754.MAX_NORMAL_EXPONENT + 1) << scale) - 1;
+ assert.strictEqual(maxIndex, index);
+
+ const boundary = mapping.lowerBoundary(index);
+ const base = mapping.lowerBoundary(1);
+
+ assert.ok(boundary < Number.MAX_VALUE);
+ assertInEpsilon(base - 1, (Number.MAX_VALUE - boundary) / boundary, 1e-6);
+
+ //one larger will overflow
+ assert.throws(() => {
+ mapping.lowerBoundary(index + 1);
+ });
+ }
+ });
+});
+
+function roundedBoundary(scale: number, index: number): number {
+ while (scale > 0) {
+ if (index < -1022) {
+ index /= 2;
+ scale--;
+ } else {
+ break;
+ }
+ }
+
+ let result = Math.pow(2, index);
+ for (let i = scale; i > 0; i--) {
+ result = Math.sqrt(result);
+ }
+
+ return result;
+}
diff --git a/packages/sdk-metrics/test/aggregator/exponential-histogram/getMapping.test.ts b/packages/sdk-metrics/test/aggregator/exponential-histogram/getMapping.test.ts
new file mode 100644
index 0000000000..4d7326be54
--- /dev/null
+++ b/packages/sdk-metrics/test/aggregator/exponential-histogram/getMapping.test.ts
@@ -0,0 +1,45 @@
+/*
+ * 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 { ExponentMapping } from '../../../src/aggregator/exponential-histogram/mapping/ExponentMapping';
+import { LogarithmMapping } from '../../../src/aggregator/exponential-histogram/mapping/LogarithmMapping';
+import { getMapping } from '../../../src/aggregator/exponential-histogram/mapping/getMapping';
+import * as assert from 'assert';
+
+const MIN_SCALE = -10;
+const MAX_SCALE = 20;
+
+describe('getMapping', () => {
+ it('returns correct mapping for all scales', () => {
+ for (let scale = MIN_SCALE; scale <= MAX_SCALE; scale++) {
+ const mapping = getMapping(scale);
+ if (scale > 0) {
+ assert.ok(mapping instanceof LogarithmMapping);
+ } else {
+ assert.ok(mapping instanceof ExponentMapping);
+ }
+ assert.strictEqual(mapping.scale(), scale);
+ }
+ });
+
+ it('throws for invalid scales', () => {
+ assert.throws(() => {
+ getMapping(MIN_SCALE - 1);
+ });
+ assert.throws(() => {
+ getMapping(MAX_SCALE + 1);
+ });
+ });
+});
diff --git a/packages/sdk-metrics/test/aggregator/exponential-histogram/helpers.ts b/packages/sdk-metrics/test/aggregator/exponential-histogram/helpers.ts
new file mode 100644
index 0000000000..a2241fbf66
--- /dev/null
+++ b/packages/sdk-metrics/test/aggregator/exponential-histogram/helpers.ts
@@ -0,0 +1,33 @@
+/*
+ * 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 * as assert from 'assert';
+
+export function assertInEpsilon(
+ actual: number,
+ expected: number,
+ epsilon: number
+) {
+ assert.ok(!Number.isNaN(actual), 'unexpected NaN for actual argument');
+ assert.ok(!Number.isNaN(expected), 'unexpected NaN for expected argument');
+ assert.ok(actual !== 0, 'unexpected 0 for actual argument');
+
+ const relErr = Math.abs(actual - expected) / Math.abs(actual);
+
+ assert.ok(
+ relErr < epsilon,
+ `expected relative error: ${relErr} to be < ${epsilon}`
+ );
+}
diff --git a/packages/sdk-metrics/test/aggregator/exponential-histogram/ieee754.test.ts b/packages/sdk-metrics/test/aggregator/exponential-histogram/ieee754.test.ts
new file mode 100644
index 0000000000..3db0da3268
--- /dev/null
+++ b/packages/sdk-metrics/test/aggregator/exponential-histogram/ieee754.test.ts
@@ -0,0 +1,58 @@
+/*
+ * 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 * as ieee754 from '../../../src/aggregator/exponential-histogram/mapping/ieee754';
+import * as assert from 'assert';
+
+describe('ieee754 helpers', () => {
+ describe('MIN_NORMAL_EXPONENT', () => {
+ it('has expected value', () => {
+ assert.strictEqual(ieee754.MIN_NORMAL_EXPONENT, -1022);
+ });
+ });
+
+ describe('MAX_NORMAL_EXPONENT', () => {
+ it('has expected value', () => {
+ assert.strictEqual(ieee754.MAX_NORMAL_EXPONENT, 1023);
+ });
+ });
+
+ describe('getNormalBase2', () => {
+ it('extracts exponent', () => {
+ assert.strictEqual(
+ ieee754.getNormalBase2(Math.pow(2, 1023)),
+ ieee754.MAX_NORMAL_EXPONENT
+ );
+ assert.strictEqual(ieee754.getNormalBase2(Math.pow(2, 1022)), 1022);
+ assert.strictEqual(ieee754.getNormalBase2(18.9), 4);
+ assert.strictEqual(ieee754.getNormalBase2(1), 0);
+ assert.strictEqual(ieee754.getNormalBase2(Math.pow(2, -1021)), -1021);
+ assert.strictEqual(ieee754.getNormalBase2(Math.pow(2, -1022)), -1022);
+
+ // Subnormals below
+ assert.strictEqual(ieee754.getNormalBase2(Math.pow(2, -1023)), -1023);
+ assert.strictEqual(ieee754.getNormalBase2(Math.pow(2, -1024)), -1023);
+ assert.strictEqual(ieee754.getNormalBase2(Math.pow(2, -1025)), -1023);
+ assert.strictEqual(ieee754.getNormalBase2(Math.pow(2, -1074)), -1023);
+ });
+ });
+
+ describe('getSignificand', () => {
+ it('returns expected values', () => {
+ // The number 1.5 has a single most-significant bit set, i.e., 1<<51.
+ assert.strictEqual(ieee754.getSignificand(1.5), Math.pow(2, 51));
+ });
+ });
+});
diff --git a/packages/template/package.json b/packages/template/package.json
index 3f0e9e70c7..ff6de03cfb 100644
--- a/packages/template/package.json
+++ b/packages/template/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/template",
- "version": "1.9.0",
+ "version": "1.9.1",
"private": true,
"publishConfig": {
"access": "restricted"
diff --git a/selenium-tests/package.json b/selenium-tests/package.json
index 388d4ccadf..be4f1d42a1 100644
--- a/selenium-tests/package.json
+++ b/selenium-tests/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/selenium-tests",
- "version": "1.9.0",
+ "version": "1.9.1",
"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.9.0",
- "@opentelemetry/core": "1.9.0",
- "@opentelemetry/exporter-trace-otlp-http": "0.35.0",
- "@opentelemetry/exporter-zipkin": "1.9.0",
- "@opentelemetry/instrumentation": "0.35.0",
- "@opentelemetry/instrumentation-fetch": "0.35.0",
- "@opentelemetry/instrumentation-xml-http-request": "0.35.0",
- "@opentelemetry/sdk-metrics": "1.9.0",
- "@opentelemetry/sdk-trace-base": "1.9.0",
- "@opentelemetry/sdk-trace-web": "1.9.0",
+ "@opentelemetry/context-zone-peer-dep": "1.9.1",
+ "@opentelemetry/core": "1.9.1",
+ "@opentelemetry/exporter-trace-otlp-http": "0.35.1",
+ "@opentelemetry/exporter-zipkin": "1.9.1",
+ "@opentelemetry/instrumentation": "0.35.1",
+ "@opentelemetry/instrumentation-fetch": "0.35.1",
+ "@opentelemetry/instrumentation-xml-http-request": "0.35.1",
+ "@opentelemetry/sdk-metrics": "1.9.1",
+ "@opentelemetry/sdk-trace-base": "1.9.1",
+ "@opentelemetry/sdk-trace-web": "1.9.1",
"zone.js": "0.11.4"
}
}
diff --git a/tsconfig.esm.json b/tsconfig.esm.json
index 3c3cb876dd..afd8742243 100644
--- a/tsconfig.esm.json
+++ b/tsconfig.esm.json
@@ -11,6 +11,9 @@
{
"path": "experimental/packages/exporter-trace-otlp-http/tsconfig.esm.json"
},
+ {
+ "path": "experimental/packages/exporter-trace-otlp-proto/tsconfig.esm.json"
+ },
{
"path": "experimental/packages/opentelemetry-browser-detector/tsconfig.esm.json"
},
@@ -29,6 +32,9 @@
{
"path": "experimental/packages/otlp-exporter-base/tsconfig.esm.json"
},
+ {
+ "path": "experimental/packages/otlp-proto-exporter-base/tsconfig.esm.json"
+ },
{
"path": "experimental/packages/otlp-transformer/tsconfig.esm.json"
},
diff --git a/tsconfig.esnext.json b/tsconfig.esnext.json
index 63c1e27aa4..c826225f26 100644
--- a/tsconfig.esnext.json
+++ b/tsconfig.esnext.json
@@ -11,6 +11,9 @@
{
"path": "experimental/packages/exporter-trace-otlp-http/tsconfig.esnext.json"
},
+ {
+ "path": "experimental/packages/exporter-trace-otlp-proto/tsconfig.esnext.json"
+ },
{
"path": "experimental/packages/opentelemetry-browser-detector/tsconfig.esnext.json"
},
@@ -29,6 +32,9 @@
{
"path": "experimental/packages/otlp-exporter-base/tsconfig.esnext.json"
},
+ {
+ "path": "experimental/packages/otlp-proto-exporter-base/tsconfig.esnext.json"
+ },
{
"path": "experimental/packages/otlp-transformer/tsconfig.esnext.json"
},