diff --git a/.github/workflows/backcompat.yml b/.github/workflows/backcompat.yml
deleted file mode 100644
index 93ef7428e2..0000000000
--- a/.github/workflows/backcompat.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-name: Backwards Compatability
-
-on:
- push:
- branches: [master]
- pull_request:
-
-jobs:
- types-node:
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v2
-
- - name: restore lerna
- uses: actions/cache@master # must use unreleased master to cache multiple paths
- id: cache
- with:
- path: |
- node_modules
- packages/*/node_modules
- metapackages/*/node_modules
- key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}
-
- - name: Bootstrap
- if: steps.cache.outputs.cache-hit != 'true'
- run: |
- npm install --only=dev --ignore-scripts
- npx lerna bootstrap --no-ci --ignore-scripts -- --only=dev
-
- - name: Install and Build API Dependencies
- run: npx lerna bootstrap --no-ci --scope backcompat-* --include-filtered-dependencies
-
- - name:
- run: |
- npm run test:backcompat
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index c7c67816fd..9ed8ba8fbe 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -11,11 +11,14 @@ jobs:
- name: Checkout 🛎️
uses: actions/checkout@v2
- - name: Install and Build 🔧
- run: |
+ - name: Install Dependencies
npm install --ignore-scripts
- npx lerna bootstrap --scope @opentelemetry/api --include-filtered-dependencies
- npm run docs
+ npx lerna bootstrap --no-ci --scope @opentelemetry/api --include-dependencies
+
+ - name: Build 🔧
+ run: |
+ npx lerna run compile --scope @opentelemetry/api
+ npx lerna run docs
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@releases/v3
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index f24f2dd2c5..c6407aa0be 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -48,8 +48,15 @@ jobs:
npm run lint
npm run lint:examples
- - name: Install and Build API Dependencies
- run: npx lerna bootstrap --no-ci --scope @opentelemetry/api --include-filtered-dependencies
+ - name: Install API Dependencies
+ run: |
+ npm install --ignore-scripts
+ npx lerna bootstrap --no-ci --scope @opentelemetry/api --include-dependencies
+
+ - name: Build 🔧
+ run: |
+ npx lerna run compile --scope @opentelemetry/api
+ npx lerna run docs
- name: Test Docs
run: npm run docs-test
diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml
index a9e94981c4..d40859a133 100644
--- a/.github/workflows/unit-test.yml
+++ b/.github/workflows/unit-test.yml
@@ -30,6 +30,8 @@ jobs:
run: npm install --ignore-scripts
- name: Boostrap Dependencies
run: npx lerna bootstrap --no-ci
+ - name: Build
+ run: npm run compile
- name: Unit tests
run: npm run test
- name: Report Coverage
@@ -58,6 +60,8 @@ jobs:
run: npm install --ignore-scripts
- name: Boostrap Dependencies
run: npx lerna bootstrap --no-ci
+ - name: Build
+ run: npm run compile
- name: Unit tests
run: npm run test:browser
- name: Report Coverage
diff --git a/.github/workflows/w3c-integration-test.yml b/.github/workflows/w3c-integration-test.yml
index 4a1864d93e..2ac16c3e46 100644
--- a/.github/workflows/w3c-integration-test.yml
+++ b/.github/workflows/w3c-integration-test.yml
@@ -12,10 +12,14 @@ jobs:
- name: Checkout 🛎️
uses: actions/checkout@v2
- - name: Install and Build 🔧
+ - name: Install
run: |
npm install --ignore-scripts
- npx lerna bootstrap --scope=propagation-validation-server --include-dependencies
+ npx lerna bootstrap --no-ci --scope=propagation-validation-server --include-dependencies
+
+ - name: Build 🔧
+ run: npm run compile
+ working-directory: ./integration-tests/propagation-validation-server
- name: Run W3C Test harness
run: ./integration-tests/tracecontext-integration-test.sh
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2a71f13f57..c7ab978162 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,63 @@ All notable changes to this project will be documented in this file.
## Unreleased
+## 0.14.0
+
+### :boom: Breaking Change
+
+* `opentelemetry-api`, `opentelemetry-metrics`
+ * [#1709](https://github.com/open-telemetry/opentelemetry-js/pull/1709) refactor: batch observer to be independent from metric types ([@legendecas](https://github.com/legendecas))
+* `opentelemetry-api`, `opentelemetry-instrumentation-http`, `opentelemetry-instrumentation-xml-http-request`, `opentelemetry-plugin-fetch`, `opentelemetry-plugin-grpc-js`, `opentelemetry-plugin-grpc`, `opentelemetry-plugin-http`, `opentelemetry-shim-opentracing`
+ * [#1734](https://github.com/open-telemetry/opentelemetry-js/pull/1734) chore: requires user to pass context to propagation APIs ([@Flarna](https://github.com/Flarna))
+* `opentelemetry-api`, `opentelemetry-core`, `opentelemetry-grpc-utils`, `opentelemetry-node`, `opentelemetry-plugin-fetch`, `opentelemetry-plugin-grpc-js`, `opentelemetry-plugin-grpc`, `opentelemetry-plugin-http`
+ * [#1715](https://github.com/open-telemetry/opentelemetry-js/pull/1715) chore: moving plugin from api to core ([@obecny](https://github.com/obecny))
+
+### :rocket: (Enhancement)
+
+* `opentelemetry-semantic-conventions`
+ * [#1684](https://github.com/open-telemetry/opentelemetry-js/pull/1684) feat(semantic-conventions): messaging specifications ([@nirsky](https://github.com/nirsky))
+* `opentelemetry-tracing`
+ * [#1685](https://github.com/open-telemetry/opentelemetry-js/pull/1685) chore: remove ordered attribute dropping ([@dyladan](https://github.com/dyladan))
+* `opentelemetry-api`, `opentelemetry-core`, `opentelemetry-sdk-node`, `opentelemetry-shim-opentracing`, `opentelemetry-tracing`
+ * [#1687](https://github.com/open-telemetry/opentelemetry-js/pull/1687) chore: rename CorrelationContext to Baggage ([@dyladan](https://github.com/dyladan))
+* `opentelemetry-exporter-prometheus`
+ * [#1697](https://github.com/open-telemetry/opentelemetry-js/pull/1697) fix(exporter-prometheus): add appendTimestamp option to ExporterConfig ([@antoniomrfranco](https://github.com/antoniomrfranco))
+* `opentelemetry-exporter-collector-proto`, `opentelemetry-exporter-collector`
+ * [#1661](https://github.com/open-telemetry/opentelemetry-js/pull/1661) Use http keep-alive in collector exporter ([@lonewolf3739](https://github.com/lonewolf3739))
+* `opentelemetry-plugin-http`, `opentelemetry-semantic-conventions`
+ * [#1625](https://github.com/open-telemetry/opentelemetry-js/pull/1625) feat(opentelemetry-js): add content size attributes to HTTP spans ([@nijotz](https://github.com/nijotz))
+* `opentelemetry-exporter-collector`
+ * [#1708](https://github.com/open-telemetry/opentelemetry-js/pull/1708) feat(exporter-collector): implement concurrencyLimit option ([@dobesv](https://github.com/dobesv))
+* `opentelemetry-api`, `opentelemetry-core`, `opentelemetry-grpc-utils`, `opentelemetry-node`, `opentelemetry-plugin-fetch`, `opentelemetry-plugin-grpc-js`, `opentelemetry-plugin-grpc`, `opentelemetry-plugin-http`
+ * [#1715](https://github.com/open-telemetry/opentelemetry-js/pull/1715) chore: moving plugin from api to core ([@obecny](https://github.com/obecny))
+
+### :bug: (Bug Fix)
+
+* `opentelemetry-exporter-jaeger`
+ * [#1758](https://github.com/open-telemetry/opentelemetry-js/pull/1758) fix(@opentelemetry/exporter-jaeger): fixed issue #1757 ([@debagger](https://github.com/debagger))
+* `opentelemetry-exporter-collector-grpc`, `opentelemetry-exporter-collector-proto`, `opentelemetry-exporter-collector`
+ * [#1751](https://github.com/open-telemetry/opentelemetry-js/pull/1751) Fixing Span status when exporting span ([@obecny](https://github.com/obecny))
+* `opentelemetry-instrumentation-http`, `opentelemetry-plugin-http`
+ * [#1747](https://github.com/open-telemetry/opentelemetry-js/pull/1747) feat: fixing failing test ([@obecny](https://github.com/obecny))
+* `opentelemetry-instrumentation-xml-http-request`
+ * [#1720](https://github.com/open-telemetry/opentelemetry-js/pull/1720) fix(xhr): check for resource timing support ([@bradfrosty](https://github.com/bradfrosty))
+
+### Committers: 13
+
+* Antônio Franco ([@antoniomrfranco](https://github.com/antoniomrfranco))
+* Bartlomiej Obecny ([@obecny](https://github.com/obecny))
+* Brad Frost ([@bradfrosty](https://github.com/bradfrosty))
+* Daniel Dyla ([@dyladan](https://github.com/dyladan))
+* Dobes Vandermeer ([@dobesv](https://github.com/dobesv))
+* Gerhard Stöbich ([@Flarna](https://github.com/Flarna))
+* Mikhail Sokolov ([@debagger](https://github.com/debagger))
+* Nik Zap ([@nijotz](https://github.com/nijotz))
+* Nir Hadassi ([@nirsky](https://github.com/nirsky))
+* Shovnik Bhattacharya ([@shovnik](https://github.com/shovnik))
+* Srikanth Chekuri ([@lonewolf3739](https://github.com/lonewolf3739))
+* Valentin Marchaud ([@vmarchaud](https://github.com/vmarchaud))
+* legendecas ([@legendecas](https://github.com/legendecas))
+
## 0.13.0
### :boom: Breaking Change
@@ -72,7 +129,7 @@ All notable changes to this project will be documented in this file.
* `opentelemetry-context-zone-peer-dep`, `opentelemetry-web`
* [#1616](https://github.com/open-telemetry/opentelemetry-js/pull/1616) docs: zone ctx manager can only be used with es2015 ([@dyladan](https://github.com/dyladan))
-#### Committers: 16
+### Committers: 16
* Andrew ([@AndrewGrachov](https://github.com/AndrewGrachov))
* Bartlomiej Obecny ([@obecny](https://github.com/obecny))
@@ -267,7 +324,7 @@ All notable changes to this project will be documented in this file.
* Other
* [#1431](https://github.com/open-telemetry/opentelemetry-js/pull/1431) Fix typo in document. ([@dengliming](https://github.com/dengliming))
-#### Committers: 21
+### Committers: 21
* Andrew ([@AndrewGrachov](https://github.com/AndrewGrachov))
* Bartlomiej Obecny ([@obecny](https://github.com/obecny))
@@ -391,7 +448,7 @@ All notable changes to this project will be documented in this file.
* `opentelemetry-api`, `opentelemetry-metrics`
* [#1272](https://github.com/open-telemetry/opentelemetry-js/pull/1272) feat: adding new metric: up down sum observer ([@obecny](https://github.com/obecny))
-#### Committers: 21
+### Committers: 21
* Adam Egyed ([@adamegyed](https://github.com/adamegyed))
* Aravin ([@aravinsiva](https://github.com/aravinsiva))
@@ -469,7 +526,7 @@ All notable changes to this project will be documented in this file.
* [#1142](https://github.com/open-telemetry/opentelemetry-js/pull/1142) chore: template prometheus endpoint in examples rather than hardcode ([@naseemkullah](https://github.com/naseemkullah))
* [#1217](https://github.com/open-telemetry/opentelemetry-js/pull/1217) chore: fix markdown linting and add npm script ([@dyladan](https://github.com/dyladan))
-#### Committers: 13
+### Committers: 13
* David W. ([@davidwitten](https://github.com/davidwitten))
* Bartlomiej Obecny ([@obecny](https://github.com/obecny))
@@ -504,7 +561,7 @@ All notable changes to this project will be documented in this file.
* `opentelemetry-api`
* [#1106](https://github.com/open-telemetry/opentelemetry-js/pull/1106) chore: improve API documentation ([@mayurkale22](https://github.com/mayurkale22))
-#### Committers: 7
+### Committers: 7
* Bartlomiej Obecny ([@obecny](https://github.com/obecny))
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
@@ -535,7 +592,7 @@ All notable changes to this project will be documented in this file.
* `opentelemetry-core`
* [#1080](https://github.com/open-telemetry/opentelemetry-js/pull/1080) docs: document CorrelationContext propagator under Built-in Implement… ([@rubenvp8510](https://github.com/rubenvp8510))
-#### Committers: 5
+### Committers: 5
* Marian Zagoruiko ([@mzahor](https://github.com/mzahor))
* Mayur Kale ([@mayurkale22](https://github.com/mayurkale22))
@@ -574,7 +631,7 @@ All notable changes to this project will be documented in this file.
* `opentelemetry-exporter-prometheus`
* [#1056](https://github.com/open-telemetry/opentelemetry-js/pull/1056) fix readme: setting labelKeys when creating the counter ([@luebken](https://github.com/luebken))
-#### Committers: 9
+### Committers: 9
* Alan Storm ([@astorm](https://github.com/astorm))
* Amir Blum ([@BlumAmir](https://github.com/BlumAmir))
@@ -635,7 +692,7 @@ Released 2020-05-12
* [#1003](https://github.com/open-telemetry/opentelemetry-js/pull/1003) chore: test on node 14 ([@dyladan](https://github.com/dyladan))
* [#990](https://github.com/open-telemetry/opentelemetry-js/pull/990) fix(opentracing-shim): update opentracing shim example ([@sleighzy](https://github.com/sleighzy))
-#### Committers: 7
+### Committers: 7
* legendecas ([@legendecas](https://github.com/legendecas))
* Valentin Marchaud ([@vmarchaud](https://github.com/vmarchaud))
@@ -670,7 +727,7 @@ Released 2020-04-23
* `opentelemetry-metrics`
* [#930](https://github.com/open-telemetry/opentelemetry-js/pull/930) feat(aggregators): implement histogram aggregator ([@vmarchaud](https://github.com/vmarchaud))
-#### Committers: 5
+### Committers: 5
* Naseem ([@naseemkullah](https://github.com/naseemkullah))
* Matthew Wear ([@mwear](https://github.com/mwear))
@@ -701,7 +758,7 @@ Released 2020-04-08
* `opentelemetry-propagator-jaeger`
* [#937](https://github.com/open-telemetry/opentelemetry-js/pull/937) fix: Jaeger propagator example of usage" ([@shivkanya9146](https://github.com/shivkanya9146))
-#### Committers: 4
+### Committers: 4
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
* Naseem ([@naseemkullah](https://github.com/naseemkullah))
@@ -729,7 +786,7 @@ Released 2020-04-01
* `opentelemetry-node`
* [#921](https://github.com/open-telemetry/opentelemetry-js/pull/921) chore: fix Require Path in README [@shivkanya9146](https://github.com/shivkanya9146))
-#### Committers: 4
+### Committers: 4
* Mayur Kale ([@mayurkale22](https://github.com/mayurkale22))
* Bartlomiej Obecny ([@obecny](https://github.com/obecny))
@@ -763,7 +820,7 @@ Released 2020-03-27
* `opentelemetry-context-base`, `opentelemetry-core`, `opentelemetry-plugin-document-load`, `opentelemetry-plugin-user-interaction`, `opentelemetry-web`
* [#906](https://github.com/open-telemetry/opentelemetry-js/pull/906) chore: fixing documentation for web tracer provider, fixing examples … ([@obecny](https://github.com/obecny))
-#### Committers: 4
+### Committers: 4
* Bartlomiej Obecny ([@obecny](https://github.com/obecny))
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
@@ -783,7 +840,7 @@ Released 2020-03-19
* `opentelemetry-metrics`
* [#881](https://github.com/open-telemetry/opentelemetry-js/pull/881) fix: @opentelemetry/metrics fails to run due to bad import ([@mayurkale22](https://github.com/mayurkale22))
-#### Committers: 2
+### Committers: 2
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
* Mayur Kale ([@mayurkale22](https://github.com/mayurkale22))
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1fcba1986e..9b11c62a81 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -2,6 +2,19 @@
We'd love your help!
+## Development Quick Start
+
+To get the project started quickly, you can follow these steps. For more
+detailed instructions, see [development](#development) below.
+
+```sh
+git clone https://github.com/open-telemetry/opentelemetry-js.git
+cd opentelemetry-js
+npm install
+npm run compile
+npm test
+```
+
## Report a bug or requesting feature
Reporting bugs is an important contribution. Please make sure to include:
@@ -57,15 +70,102 @@ Remember to always work in a branch of your local copy, as you might otherwise h
Please also see [GitHub workflow](https://github.com/open-telemetry/community/blob/master/CONTRIBUTING.md#github-workflow) section of general project contributing guide.
-### Running the tests
+## Development
+
+### Tools used
+
+- [NPM](https://npmjs.com)
+- [TypeScript](https://www.typescriptlang.org/)
+- [lerna](https://github.com/lerna/lerna) to manage dependencies, compilations, and links between packages. Most lerna commands should be run by calling the provided npm scripts.
+- [MochaJS](https://mochajs.org/) for tests
+- [gts](https://github.com/google/gts)
+- [eslint](https://eslint.org/)
+
+Most of the commands needed for development are accessed as [npm scripts](https://docs.npmjs.com/cli/v6/using-npm/scripts). It is recommended that you use the provided npm scripts instead of using `lerna run` in most cases.
+
+### Install dependencies
+
+This will install all dependencies for the root project and all modules managed by `lerna`. By default, a `postinstall` script will run `lerna bootstrap` automatically after an install. This can be avoided using the `--ignore-scripts` option if desired.
+
+```sh
+npm install
+```
+
+### Compile modules
+
+All modules are managed as a composite typescript project using [Project References](https://www.typescriptlang.org/docs/handbook/project-references.html). This means that a breaking change in one module will be reflected in compilations of its dependent modules automatically.
+
+DO NOT use lerna to compile all modules unless you know what you are doing because this will cause a new typescript process to be spawned for every module in the project.
+
+```sh
+# Build all modules
+npm run compile
+
+# Remove compiled output
+npm run clean
+```
+
+These commands can also be run for specific packages instead of the whole project, which can speed up compilations while developing.
+
+```sh
+# Build a single module and all of its dependencies
+cd packages/opentelemetry-module-name
+npm run compile
+```
+
+Finally, builds can be run continuously as files change using the `watch` npm script.
+
+```sh
+# Build all modules
+npm run watch
+
+# Build a single module and all of its dependencies
+cd packages/opentelemetry-module-name
+npm run watch
+```
+
+### Running tests
+
+Similar to compilations, tests can be run from the root to run all tests or from a single module to run only the tests for that module.
+
+```sh
+# Test all modules
+npm test
+
+# Test a single module
+cd packages/opentelemetry-module-name
+npm test
+```
+
+### Linting
+
+This project uses a combination of `gts` and `eslint`. Just like tests and compilation, linting can be done for all packages or only a single package.
+
+```sh
+# Lint all modules
+npm lint
+
+# Lint a single module
+cd packages/opentelemetry-module-name
+npm lint
+```
+
+There is also a script which will automatically fix many linting errors.
+
+```sh
+# Lint all modules, fixing errors
+npm lint:fix
+
+# Lint a single module, fixing errors
+cd packages/opentelemetry-module-name
+npm lint:fix
+```
+
+### Adding a package
-The `opentelemetry-js` project is written in TypeScript.
+To add a new package, copy `packages/template` to your new package directory and modify the `package.json` file to reflect your desired package settings. If the package will not support browser, the `karma.conf` file may be deleted. If the package will support es5 targets, the reference to `tsconfig.base.json` in `tsconfig.json` should be changed to `tsconfig.es5.json`.
-- `npm install` to install dependencies.
-- `npm run compile` compiles the code, checking for type errors.
-- `npm run bootstrap` Bootstrap the packages in the current Lerna repo. Installs all of their dependencies and links any cross-dependencies.
-- `npm test` tests code the same way that our CI will test it.
-- `npm run lint:fix` lint (and maybe fix) any changes.
+After adding the package, run `npm install` from the root of the project. This will update the `tsconfig.json` project references automatically and install all dependencies in your new package.
### Guidelines for Pull Requests
diff --git a/README.md b/README.md
index 7465856da0..4f55cd5259 100644
--- a/README.md
+++ b/README.md
@@ -120,8 +120,9 @@ estimates, and subject to change.
## Contributing
We'd love your help!. Use tags [up-for-grabs][up-for-grabs-issues] and
-[good first issue][good-first-issues] to get started with the project. Follow
-[CONTRIBUTING](CONTRIBUTING.md) guide to report issues or submit a proposal.
+[good first issue][good-first-issues] to get started with the project. For
+instructions to build and make changes to this project, see the
+[CONTRIBUTING](CONTRIBUTING.md) guide.
We have a weekly SIG meeting! See the [community page](https://github.com/open-telemetry/community#javascript-sdk) for meeting details and notes.
@@ -224,6 +225,16 @@ To request automatic tracing support for a module not on this list, please [file
|----------------------------------------------------------|-----------------------------------------------------------------------------------------|
| [@opentelemetry/shim-opentracing][otel-shim-opentracing] | OpenTracing shim allows existing OpenTracing instrumentation to report to OpenTelemetry |
+## Upgrade guidelines
+
+### 0.14.0 to 0.15.0
+
+[PR-1764](https://github.com/open-telemetry/opentelemetry-js/pull/1764) removed some APIs from `Tracer`:
+
+- `Tracer.getCurrentSpan()`: use `api.getSpan(api.context.active())`
+- `Tracer.withSpan(span)`: use `api.context.with(api.setSpan(api.context.active(), span))`
+- `Tracer.bind(target)`: use `api.context.bind(target)`
+
## Useful links
- For more information on OpenTelemetry, visit:
diff --git a/backwards-compatability/node10/package.json b/backwards-compatability/node10/package.json
index 700b51775b..7035321e69 100644
--- a/backwards-compatability/node10/package.json
+++ b/backwards-compatability/node10/package.json
@@ -1,6 +1,6 @@
{
"name": "backcompat-node10",
- "version": "0.13.0",
+ "version": "0.14.0",
"private": true,
"description": "Backwards compatability app for node8 types and the OpenTelemetry Node.js SDK",
"main": "index.js",
@@ -8,8 +8,8 @@
"test:backcompat": "tsc --noEmit index.ts"
},
"dependencies": {
- "@opentelemetry/sdk-node": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0"
+ "@opentelemetry/sdk-node": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0"
},
"devDependencies": {
"@types/node": "10.17.48",
diff --git a/backwards-compatability/node10/tsconfig.json b/backwards-compatability/node10/tsconfig.json
new file mode 100644
index 0000000000..0e5977e0b9
--- /dev/null
+++ b/backwards-compatability/node10/tsconfig.json
@@ -0,0 +1,18 @@
+{
+ "extends": "../../tsconfig.es5.json",
+ "compilerOptions": {
+ "rootDir": ".",
+ "outDir": "build"
+ },
+ "include": [
+ "index.ts"
+ ],
+ "references": [
+ {
+ "path": "../../packages/opentelemetry-sdk-node"
+ },
+ {
+ "path": "../../packages/opentelemetry-tracing"
+ }
+ ]
+}
diff --git a/backwards-compatability/node12/package.json b/backwards-compatability/node12/package.json
index a384df6134..97bc42f53e 100644
--- a/backwards-compatability/node12/package.json
+++ b/backwards-compatability/node12/package.json
@@ -1,6 +1,6 @@
{
"name": "backcompat-node12",
- "version": "0.13.0",
+ "version": "0.14.0",
"private": true,
"description": "Backwards compatability app for node8 types and the OpenTelemetry Node.js SDK",
"main": "index.js",
@@ -8,8 +8,8 @@
"test:backcompat": "tsc --noEmit index.ts"
},
"dependencies": {
- "@opentelemetry/sdk-node": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0"
+ "@opentelemetry/sdk-node": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0"
},
"devDependencies": {
"@types/node": "12.19.8",
diff --git a/backwards-compatability/node12/tsconfig.json b/backwards-compatability/node12/tsconfig.json
new file mode 100644
index 0000000000..0e5977e0b9
--- /dev/null
+++ b/backwards-compatability/node12/tsconfig.json
@@ -0,0 +1,18 @@
+{
+ "extends": "../../tsconfig.es5.json",
+ "compilerOptions": {
+ "rootDir": ".",
+ "outDir": "build"
+ },
+ "include": [
+ "index.ts"
+ ],
+ "references": [
+ {
+ "path": "../../packages/opentelemetry-sdk-node"
+ },
+ {
+ "path": "../../packages/opentelemetry-tracing"
+ }
+ ]
+}
diff --git a/backwards-compatability/node8/package.json b/backwards-compatability/node8/package.json
index 2ffd49e28d..6e20988d8d 100644
--- a/backwards-compatability/node8/package.json
+++ b/backwards-compatability/node8/package.json
@@ -1,6 +1,6 @@
{
"name": "backcompat-node8",
- "version": "0.13.0",
+ "version": "0.14.0",
"private": true,
"description": "Backwards compatability app for node8 types and the OpenTelemetry Node.js SDK",
"main": "index.js",
@@ -8,8 +8,8 @@
"test:backcompat": "tsc --noEmit index.ts"
},
"dependencies": {
- "@opentelemetry/sdk-node": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0"
+ "@opentelemetry/sdk-node": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0"
},
"devDependencies": {
"@types/node": "8.10.66",
diff --git a/backwards-compatability/node8/tsconfig.json b/backwards-compatability/node8/tsconfig.json
new file mode 100644
index 0000000000..0e5977e0b9
--- /dev/null
+++ b/backwards-compatability/node8/tsconfig.json
@@ -0,0 +1,18 @@
+{
+ "extends": "../../tsconfig.es5.json",
+ "compilerOptions": {
+ "rootDir": ".",
+ "outDir": "build"
+ },
+ "include": [
+ "index.ts"
+ ],
+ "references": [
+ {
+ "path": "../../packages/opentelemetry-sdk-node"
+ },
+ {
+ "path": "../../packages/opentelemetry-tracing"
+ }
+ ]
+}
diff --git a/benchmark/tracer.js b/benchmark/tracer.js
index ab636e924e..274cd6de99 100644
--- a/benchmark/tracer.js
+++ b/benchmark/tracer.js
@@ -2,10 +2,9 @@
const benchmark = require('./benchmark');
const opentelemetry = require('../packages/opentelemetry-api');
-const { NoopLogger } = require('../packages/opentelemetry-core');
const { BasicTracerProvider, BatchSpanProcessor, InMemorySpanExporter, SimpleSpanProcessor } = require('../packages/opentelemetry-tracing');
-const logger = new NoopLogger();
+const logger = new opentelemetry.NoopLogger();
const setups = [
{
diff --git a/examples/basic-tracer-node/index.js b/examples/basic-tracer-node/index.js
index 45888437c2..fd046c0d45 100644
--- a/examples/basic-tracer-node/index.js
+++ b/examples/basic-tracer-node/index.js
@@ -37,9 +37,8 @@ exporter.shutdown();
function doWork(parent) {
// Start another span. In this example, the main method already started a
// span, so that'll be the parent span, and this will be a child span.
- const span = tracer.startSpan('doWork', {
- parent,
- });
+ const ctx = opentelemetry.setSpan(opentelemetry.context.active(), parent);
+ const span = tracer.startSpan('doWork', undefined, ctx);
// simulate some random work.
for (let i = 0; i <= Math.floor(Math.random() * 40000000); i += 1) {
diff --git a/examples/basic-tracer-node/package.json b/examples/basic-tracer-node/package.json
index f4d8a35497..988d71af7a 100644
--- a/examples/basic-tracer-node/package.json
+++ b/examples/basic-tracer-node/package.json
@@ -1,7 +1,7 @@
{
"name": "example-basic-tracer-node",
"private": true,
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "Example of using @opentelemetry/tracing in Node.js",
"main": "index.js",
"scripts": {
@@ -24,9 +24,9 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/exporter-jaeger": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0"
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/exporter-jaeger": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme"
}
diff --git a/examples/collector-exporter-node/docker/docker-compose.yaml b/examples/collector-exporter-node/docker/docker-compose.yaml
index e93b603c49..97423dfa95 100644
--- a/examples/collector-exporter-node/docker/docker-compose.yaml
+++ b/examples/collector-exporter-node/docker/docker-compose.yaml
@@ -2,14 +2,14 @@ version: "3"
services:
# Collector
collector:
- image: otel/opentelemetry-collector:0.13.0
+ image: otel/opentelemetry-collector:0.16.0
# image: otel/opentelemetry-collector:latest
command: ["--config=/conf/collector-config.yaml", "--log-level=DEBUG"]
volumes:
- ./collector-config.yaml:/conf/collector-config.yaml
ports:
- "9464:9464"
- - "55680:55680"
+ - "4317:4317"
- "55681:55681"
depends_on:
- zipkin-all-in-one
diff --git a/examples/collector-exporter-node/package.json b/examples/collector-exporter-node/package.json
index 3cafd8ad31..4a15a37d8d 100644
--- a/examples/collector-exporter-node/package.json
+++ b/examples/collector-exporter-node/package.json
@@ -1,7 +1,7 @@
{
"name": "example-collector-exporter-node",
"private": true,
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "Example of using @opentelemetry/collector-exporter in Node.js",
"main": "index.js",
"scripts": {
@@ -28,13 +28,13 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/exporter-collector": "^0.13.0",
- "@opentelemetry/exporter-collector-grpc": "^0.13.0",
- "@opentelemetry/exporter-collector-proto": "^0.13.0",
- "@opentelemetry/metrics": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0"
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/exporter-collector": "^0.14.0",
+ "@opentelemetry/exporter-collector-grpc": "^0.14.0",
+ "@opentelemetry/exporter-collector-proto": "^0.14.0",
+ "@opentelemetry/metrics": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme"
}
diff --git a/examples/collector-exporter-node/tracing.js b/examples/collector-exporter-node/tracing.js
index cb522c01ee..af9b617b04 100644
--- a/examples/collector-exporter-node/tracing.js
+++ b/examples/collector-exporter-node/tracing.js
@@ -39,9 +39,8 @@ setTimeout(() => {
function doWork(parent) {
// Start another span. In this example, the main method already started a
// span, so that'll be the parent span, and this will be a child span.
- const span = tracer.startSpan('doWork', {
- parent,
- });
+ const ctx = opentelemetry.setSpan(opentelemetry.context.active(), parent);
+ const span = tracer.startSpan('doWork', undefined, ctx);
// simulate some random work.
for (let i = 0; i <= Math.floor(Math.random() * 40000000); i += 1) {
diff --git a/examples/grpc-js/client.js b/examples/grpc-js/client.js
index ee4090260e..958f29ef11 100644
--- a/examples/grpc-js/client.js
+++ b/examples/grpc-js/client.js
@@ -1,5 +1,6 @@
'use strict';
+const api = require('@opentelemetry/api');
const tracer = require('./tracer')('example-grpc-client');
// eslint-disable-next-line import/order
const grpc = require('@grpc/grpc-js');
@@ -14,7 +15,7 @@ function main() {
// the span, which is created to track work that happens outside of the
// request lifecycle entirely.
const span = tracer.startSpan('client.js:main()');
- tracer.withSpan(span, () => {
+ api.context.with(api.setSpan(api.context.active(), span), () => {
console.log('Client traceId ', span.context().traceId);
const client = new services.GreeterClient(
`localhost:${PORT}`,
diff --git a/examples/grpc-js/package.json b/examples/grpc-js/package.json
index 0b03b286e5..1b5eef21eb 100644
--- a/examples/grpc-js/package.json
+++ b/examples/grpc-js/package.json
@@ -1,7 +1,7 @@
{
"name": "grpc-js-example",
"private": true,
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "Example of @grpc/grpc-js integration with OpenTelemetry",
"main": "index.js",
"scripts": {
@@ -29,12 +29,12 @@
},
"dependencies": {
"@grpc/grpc-js": "^1.0.5",
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/exporter-jaeger": "^0.13.0",
- "@opentelemetry/exporter-zipkin": "^0.13.0",
- "@opentelemetry/node": "^0.13.0",
- "@opentelemetry/plugin-grpc-js": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/exporter-jaeger": "^0.14.0",
+ "@opentelemetry/exporter-zipkin": "^0.14.0",
+ "@opentelemetry/node": "^0.14.0",
+ "@opentelemetry/plugin-grpc-js": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"google-protobuf": "^3.9.2"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme",
diff --git a/examples/grpc-js/server.js b/examples/grpc-js/server.js
index 1d71833ff1..6bd451b918 100644
--- a/examples/grpc-js/server.js
+++ b/examples/grpc-js/server.js
@@ -1,5 +1,6 @@
'use strict';
+const api = require('@opentelemetry/api');
const tracer = require('./tracer')(('example-grpc-server'));
// eslint-disable-next-line import/order
const grpc = require('@grpc/grpc-js');
@@ -21,11 +22,10 @@ function startServer() {
}
function sayHello(call, callback) {
- const currentSpan = tracer.getCurrentSpan();
+ const currentSpan = api.getSpan(api.context.active());
// display traceid in the terminal
console.log(`traceid: ${currentSpan.context().traceId}`);
const span = tracer.startSpan('server.js:sayHello()', {
- parent: currentSpan,
kind: 1, // server
attributes: { key: 'value' },
});
diff --git a/examples/grpc/client.js b/examples/grpc/client.js
index 5541113af7..5bb4b630aa 100644
--- a/examples/grpc/client.js
+++ b/examples/grpc/client.js
@@ -1,5 +1,6 @@
'use strict';
+const api = require('@opentelemetry/api');
const tracer = require('./tracer')('example-grpc-client');
// eslint-disable-next-line import/order
const grpc = require('grpc');
@@ -14,7 +15,7 @@ function main() {
// the span, which is created to track work that happens outside of the
// request lifecycle entirely.
const span = tracer.startSpan('client.js:main()');
- tracer.withSpan(span, () => {
+ api.context.with(api.setSpan(api.context.active(), span), () => {
console.log('Client traceId ', span.context().traceId);
const client = new services.GreeterClient(
`localhost:${PORT}`,
diff --git a/examples/grpc/package.json b/examples/grpc/package.json
index 7824e0d784..30d33f0f38 100644
--- a/examples/grpc/package.json
+++ b/examples/grpc/package.json
@@ -1,7 +1,7 @@
{
"name": "grpc-example",
"private": true,
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "Example of gRPC integration with OpenTelemetry",
"main": "index.js",
"scripts": {
@@ -28,15 +28,15 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/exporter-jaeger": "^0.13.0",
- "@opentelemetry/exporter-zipkin": "^0.13.0",
- "@opentelemetry/node": "^0.13.0",
- "@opentelemetry/plugin-grpc": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/exporter-jaeger": "^0.14.0",
+ "@opentelemetry/exporter-zipkin": "^0.14.0",
+ "@opentelemetry/node": "^0.14.0",
+ "@opentelemetry/plugin-grpc": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"google-protobuf": "^3.9.2",
"grpc": "^1.23.3",
- "node-pre-gyp": "0.13.0"
+ "node-pre-gyp": "0.14.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme",
"devDependencies": {
diff --git a/examples/grpc/server.js b/examples/grpc/server.js
index 1b9d533172..40db771365 100644
--- a/examples/grpc/server.js
+++ b/examples/grpc/server.js
@@ -1,5 +1,6 @@
'use strict';
+const api = require('@opentelemetry/api');
const tracer = require('./tracer')(('example-grpc-server'));
// eslint-disable-next-line import/order
const grpc = require('grpc');
@@ -20,7 +21,7 @@ function startServer() {
}
function sayHello(call, callback) {
- const currentSpan = tracer.getCurrentSpan();
+ const currentSpan = api.getSpan(api.context.active());
// display traceid in the terminal
console.log(`traceid: ${currentSpan.context().traceId}`);
const span = tracer.startSpan('server.js:sayHello()', {
diff --git a/examples/http/client.js b/examples/http/client.js
index 5a88497f66..a27ba0355e 100644
--- a/examples/http/client.js
+++ b/examples/http/client.js
@@ -1,5 +1,6 @@
'use strict';
+const api = require('@opentelemetry/api');
const tracer = require('./tracer')('example-http-client');
// eslint-disable-next-line import/order
const http = require('http');
@@ -10,7 +11,7 @@ function makeRequest() {
// the span, which is created to track work that happens outside of the
// request lifecycle entirely.
const span = tracer.startSpan('makeRequest');
- tracer.withSpan(span, () => {
+ api.context.with(api.setSpan(api.context.active(), span), () => {
http.get({
host: 'localhost',
port: 8080,
diff --git a/examples/http/package.json b/examples/http/package.json
index b28a607d6e..1e971b4e9c 100644
--- a/examples/http/package.json
+++ b/examples/http/package.json
@@ -1,7 +1,7 @@
{
"name": "http-example",
"private": true,
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "Example of HTTP integration with OpenTelemetry",
"main": "index.js",
"scripts": {
@@ -28,12 +28,12 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/exporter-jaeger": "^0.13.0",
- "@opentelemetry/exporter-zipkin": "^0.13.0",
- "@opentelemetry/node": "^0.13.0",
- "@opentelemetry/plugin-http": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0"
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/exporter-jaeger": "^0.14.0",
+ "@opentelemetry/exporter-zipkin": "^0.14.0",
+ "@opentelemetry/node": "^0.14.0",
+ "@opentelemetry/plugin-http": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme",
"devDependencies": {
diff --git a/examples/http/server.js b/examples/http/server.js
index d142badf83..d7a90310fb 100644
--- a/examples/http/server.js
+++ b/examples/http/server.js
@@ -1,5 +1,6 @@
'use strict';
+const api = require('@opentelemetry/api');
const tracer = require('./tracer')('example-http-server');
// eslint-disable-next-line import/order
const http = require('http');
@@ -19,11 +20,10 @@ function startServer(port) {
/** A function which handles requests and send response. */
function handleRequest(request, response) {
- const currentSpan = tracer.getCurrentSpan();
+ const currentSpan = api.getSpan(api.context.active());
// display traceid in the terminal
console.log(`traceid: ${currentSpan.context().traceId}`);
const span = tracer.startSpan('handleRequest', {
- parent: currentSpan,
kind: 1, // server
attributes: { key: 'value' },
});
diff --git a/examples/https/client.js b/examples/https/client.js
index e5b1825163..d842becef3 100644
--- a/examples/https/client.js
+++ b/examples/https/client.js
@@ -1,5 +1,6 @@
'use strict';
+const api = require('@opentelemetry/api');
const tracer = require('./tracer')('example-https-client');
// eslint-disable-next-line import/order
const https = require('https');
@@ -10,7 +11,7 @@ function makeRequest() {
// the span, which is created to track work that happens outside of the
// request lifecycle entirely.
const span = tracer.startSpan('makeRequest');
- tracer.withSpan(span, () => {
+ api.context.with(api.setSpan(api.context.active(), span), () => {
https.get({
host: 'localhost',
port: 443,
diff --git a/examples/https/package.json b/examples/https/package.json
index 607757841c..f397c47ee2 100644
--- a/examples/https/package.json
+++ b/examples/https/package.json
@@ -1,7 +1,7 @@
{
"name": "https-example",
"private": true,
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "Example of HTTPs integration with OpenTelemetry",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
@@ -29,12 +29,12 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/exporter-jaeger": "^0.13.0",
- "@opentelemetry/exporter-zipkin": "^0.13.0",
- "@opentelemetry/node": "^0.13.0",
- "@opentelemetry/plugin-https": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0"
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/exporter-jaeger": "^0.14.0",
+ "@opentelemetry/exporter-zipkin": "^0.14.0",
+ "@opentelemetry/node": "^0.14.0",
+ "@opentelemetry/plugin-https": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme",
"devDependencies": {
diff --git a/examples/https/server.js b/examples/https/server.js
index 105005fea8..a3d480f568 100644
--- a/examples/https/server.js
+++ b/examples/https/server.js
@@ -1,5 +1,6 @@
'use strict';
+const api = require('@opentelemetry/api');
// eslint-disable-next-line import/order
const tracer = require('./tracer')('example-https-server');
const fs = require('fs');
@@ -24,11 +25,10 @@ function startServer(port) {
/** A function which handles requests and send response. */
function handleRequest(request, response) {
- const currentSpan = tracer.getCurrentSpan();
+ const currentSpan = api.getSpan(api.context.active());
// display traceid in the terminal
console.log(`traceid: ${currentSpan.context().traceId}`);
const span = tracer.startSpan('handleRequest', {
- parent: currentSpan,
kind: 1, // server
attributes: { key: 'value' },
});
diff --git a/examples/metrics/package.json b/examples/metrics/package.json
index cfd52be8c8..d6c885b127 100644
--- a/examples/metrics/package.json
+++ b/examples/metrics/package.json
@@ -1,7 +1,7 @@
{
"name": "example-metrics",
"private": true,
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "Example of using @opentelemetry/metrics",
"main": "index.js",
"scripts": {
@@ -26,9 +26,9 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/exporter-prometheus": "^0.13.0",
- "@opentelemetry/metrics": "^0.13.0"
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/exporter-prometheus": "^0.14.0",
+ "@opentelemetry/metrics": "^0.14.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme"
}
diff --git a/examples/opentracing-shim/package.json b/examples/opentracing-shim/package.json
index 9cad40640f..012e46502a 100644
--- a/examples/opentracing-shim/package.json
+++ b/examples/opentracing-shim/package.json
@@ -1,7 +1,7 @@
{
"name": "opentracing-shim",
"private": true,
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "Example of using @opentelemetry/shim-opentracing in Node.js",
"main": "index.js",
"scripts": {
@@ -29,11 +29,11 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
- "@opentelemetry/exporter-jaeger": "^0.13.0",
- "@opentelemetry/exporter-zipkin": "^0.13.0",
- "@opentelemetry/node": "^0.13.0",
- "@opentelemetry/shim-opentracing": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/exporter-jaeger": "^0.14.0",
+ "@opentelemetry/exporter-zipkin": "^0.14.0",
+ "@opentelemetry/node": "^0.14.0",
+ "@opentelemetry/shim-opentracing": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"opentracing": "^0.14.4"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme",
diff --git a/examples/prometheus/package.json b/examples/prometheus/package.json
index 5500ae9c67..1a4a216b60 100644
--- a/examples/prometheus/package.json
+++ b/examples/prometheus/package.json
@@ -1,6 +1,6 @@
{
"name": "prometheus-example",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "Example of using @opentelemetry/metrics and @opentelemetry/exporter-prometheus",
"main": "index.js",
"scripts": {
@@ -9,7 +9,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"dependencies": {
- "@opentelemetry/exporter-prometheus": "^0.13.0",
- "@opentelemetry/metrics": "^0.13.0"
+ "@opentelemetry/exporter-prometheus": "^0.14.0",
+ "@opentelemetry/metrics": "^0.14.0"
}
}
diff --git a/examples/tracer-web/examples/document-load/index.js b/examples/tracer-web/examples/document-load/index.js
index fe72746a5e..148bbe6c64 100644
--- a/examples/tracer-web/examples/document-load/index.js
+++ b/examples/tracer-web/examples/document-load/index.js
@@ -1,3 +1,4 @@
+import { context, getSpan, setSpan } from '@opentelemetry/api';
import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
import { WebTracerProvider } from '@opentelemetry/web';
import { DocumentLoad } from '@opentelemetry/plugin-document-load';
@@ -52,31 +53,29 @@ const prepareClickEvent = () => {
}
const mainSpan = tracer.startSpan('click button');
- tracer.withSpan(mainSpan, () => {
- const span1 = tracer.startSpan('files-series-info-1', {
- parent: tracer.getCurrentSpan(),
- });
+ context.with(setSpan(context.active(), mainSpan), () => {
+ const span1 = tracer.startSpan('files-series-info-1');
- const span2 = tracer.startSpan('files-series-info-2', {
- parent: tracer.getCurrentSpan(),
- });
+ const span2 = tracer.startSpan('files-series-info-2');
- tracer.withSpan(span1, () => {
+ context.with(setSpan(context.active(), span1), () => {
getData(url1).then((data) => {
- console.log('current span is span1', tracer.getCurrentSpan() === span1);
+ const curSpan = getSpan(context.active());
+ console.log('current span is span1', curSpan === span1);
console.log('info from package.json', data.description, data.version);
- tracer.getCurrentSpan().addEvent('fetching-span1-completed');
+ curSpan.addEvent('fetching-span1-completed');
span1.end();
finish();
});
});
- tracer.withSpan(span2, () => {
+ context.with(setSpan(context.active(), span2), () => {
getData(url2).then((data) => {
setTimeout(() => {
- console.log('current span is span2', tracer.getCurrentSpan() === span2);
+ const curSpan = getSpan(context.active());
+ console.log('current span is span2', curSpan === span2);
console.log('info from package.json', data.description, data.version);
- tracer.getCurrentSpan().addEvent('fetching-span2-completed');
+ curSpan.addEvent('fetching-span2-completed');
span2.end();
finish();
}, 100);
diff --git a/examples/tracer-web/examples/fetch/index.js b/examples/tracer-web/examples/fetch/index.js
index 6717136bee..3ee96052b6 100644
--- a/examples/tracer-web/examples/fetch/index.js
+++ b/examples/tracer-web/examples/fetch/index.js
@@ -1,5 +1,6 @@
'use strict';
+import { context, getSpan, setSpan } from '@opentelemetry/api';
import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
import { CollectorTraceExporter } from '@opentelemetry/exporter-collector';
import { WebTracerProvider } from '@opentelemetry/web';
@@ -44,22 +45,18 @@ const prepareClickEvent = () => {
const element = document.getElementById('button1');
const onClick = () => {
- const singleSpan = webTracerWithZone.startSpan(`files-series-info`, {
- parent: webTracerWithZone.getCurrentSpan(),
- });
- webTracerWithZone.withSpan(singleSpan, () => {
+ const singleSpan = webTracerWithZone.startSpan(`files-series-info`);
+ context.with(setSpan(context.active(), singleSpan), () => {
getData(url).then((_data) => {
- webTracerWithZone.getCurrentSpan().addEvent('fetching-single-span-completed');
+ 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}`, {
- parent: webTracerWithZone.getCurrentSpan(),
- });
- webTracerWithZone.withSpan(span, () => {
+ const span = webTracerWithZone.startSpan(`files-series-info-${i}`);
+ context.with(setSpan(context.active(), span), () => {
getData(url).then((_data) => {
- webTracerWithZone.getCurrentSpan().addEvent(`fetching-span-${i}-completed`);
+ getSpan(context.active()).addEvent(`fetching-span-${i}-completed`);
span.end();
});
});
diff --git a/examples/tracer-web/examples/xml-http-request/index.js b/examples/tracer-web/examples/xml-http-request/index.js
index 2532037bc9..cc8a8a4839 100644
--- a/examples/tracer-web/examples/xml-http-request/index.js
+++ b/examples/tracer-web/examples/xml-http-request/index.js
@@ -1,3 +1,4 @@
+import { context, getSpan, setSpan } from '@opentelemetry/api';
import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
import { WebTracerProvider } from '@opentelemetry/web';
import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request';
@@ -49,15 +50,13 @@ const prepareClickEvent = () => {
const onClick = () => {
for (let i = 0, j = 5; i < j; i += 1) {
- const span1 = webTracerWithZone.startSpan(`files-series-info-${i}`, {
- parent: webTracerWithZone.getCurrentSpan(),
- });
- webTracerWithZone.withSpan(span1, () => {
+ const span1 = webTracerWithZone.startSpan(`files-series-info-${i}`);
+ context.with(setSpan(context.active(), span1), () => {
getData(url1).then((_data) => {
- webTracerWithZone.getCurrentSpan().addEvent('fetching-span1-completed');
+ getSpan(context.active()).addEvent('fetching-span1-completed');
span1.end();
}, ()=> {
- webTracerWithZone.getCurrentSpan().addEvent('fetching-error');
+ getSpan(context.active()).addEvent('fetching-error');
span1.end();
});
});
diff --git a/examples/tracer-web/package.json b/examples/tracer-web/package.json
index d802ca286e..dc193fe18b 100644
--- a/examples/tracer-web/package.json
+++ b/examples/tracer-web/package.json
@@ -1,7 +1,7 @@
{
"name": "web-tracer-example",
"private": true,
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "Example of using @opentelemetry/web in browser",
"main": "index.js",
"scripts": {
@@ -34,18 +34,18 @@
"webpack-merge": "^4.2.2"
},
"dependencies": {
- "@opentelemetry/context-zone": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/exporter-collector": "^0.13.0",
- "@opentelemetry/exporter-zipkin": "^0.13.0",
- "@opentelemetry/metrics": "^0.13.0",
- "@opentelemetry/propagator-b3": "^0.13.0",
+ "@opentelemetry/context-zone": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/exporter-collector": "^0.14.0",
+ "@opentelemetry/exporter-zipkin": "^0.14.0",
+ "@opentelemetry/metrics": "^0.14.0",
+ "@opentelemetry/propagator-b3": "^0.14.0",
"@opentelemetry/plugin-document-load": "^0.9.0",
- "@opentelemetry/plugin-fetch": "^0.13.0",
+ "@opentelemetry/plugin-fetch": "^0.14.0",
"@opentelemetry/plugin-user-interaction": "^0.9.0",
- "@opentelemetry/instrumentation-xml-http-request": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
- "@opentelemetry/web": "^0.13.0"
+ "@opentelemetry/instrumentation-xml-http-request": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
+ "@opentelemetry/web": "^0.14.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme"
}
diff --git a/getting-started/example/package.json b/getting-started/example/package.json
index 017338e85f..854143c03f 100644
--- a/getting-started/example/package.json
+++ b/getting-started/example/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/getting-started-example",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide",
"main": "app.js",
"scripts": {
diff --git a/getting-started/monitored-example/package.json b/getting-started/monitored-example/package.json
index 2bee602814..01b5fe032e 100644
--- a/getting-started/monitored-example/package.json
+++ b/getting-started/monitored-example/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/getting-started-monitored-example",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide",
"main": "app.js",
"scripts": {
@@ -9,8 +9,8 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"dependencies": {
- "@opentelemetry/exporter-prometheus": "^0.13.0",
- "@opentelemetry/metrics": "^0.13.0",
+ "@opentelemetry/exporter-prometheus": "^0.14.0",
+ "@opentelemetry/metrics": "^0.14.0",
"axios": "^0.21.0",
"express": "^4.17.1"
}
diff --git a/getting-started/traced-example/package.json b/getting-started/traced-example/package.json
index 3d3b0a4004..20ebe558f6 100644
--- a/getting-started/traced-example/package.json
+++ b/getting-started/traced-example/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/getting-started-traced-example",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide",
"main": "app.js",
"scripts": {
@@ -9,13 +9,13 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"dependencies": {
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/exporter-zipkin": "^0.13.0",
- "@opentelemetry/node": "^0.13.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/exporter-zipkin": "^0.14.0",
+ "@opentelemetry/node": "^0.14.0",
"@opentelemetry/plugin-express": "^0.11.0",
- "@opentelemetry/plugin-http": "^0.13.0",
- "@opentelemetry/plugin-https": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/plugin-http": "^0.14.0",
+ "@opentelemetry/plugin-https": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"axios": "^0.21.0",
"express": "^4.17.1"
}
diff --git a/getting-started/ts-example/monitored-example/package.json b/getting-started/ts-example/monitored-example/package.json
index b514867cc6..05c338cf15 100644
--- a/getting-started/ts-example/monitored-example/package.json
+++ b/getting-started/ts-example/monitored-example/package.json
@@ -14,8 +14,8 @@
"ts-node": "8.10.2"
},
"dependencies": {
- "@opentelemetry/exporter-prometheus": "^0.13.0",
- "@opentelemetry/metrics": "^0.13.0",
+ "@opentelemetry/exporter-prometheus": "^0.14.0",
+ "@opentelemetry/metrics": "^0.14.0",
"axios": "^0.21.0",
"express": "^4.17.1"
}
diff --git a/getting-started/ts-example/traced-example/package.json b/getting-started/ts-example/traced-example/package.json
index 1cd660dbc3..09494cbbb4 100644
--- a/getting-started/ts-example/traced-example/package.json
+++ b/getting-started/ts-example/traced-example/package.json
@@ -14,13 +14,13 @@
"ts-node": "9.1.1"
},
"dependencies": {
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/exporter-zipkin": "^0.13.0",
- "@opentelemetry/node": "^0.13.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/exporter-zipkin": "^0.14.0",
+ "@opentelemetry/node": "^0.14.0",
"@opentelemetry/plugin-express": "^0.11.0",
- "@opentelemetry/plugin-http": "^0.13.0",
- "@opentelemetry/plugin-https": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/plugin-http": "^0.14.0",
+ "@opentelemetry/plugin-https": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"axios": "^0.21.0",
"express": "^4.17.1"
}
diff --git a/integration-tests/propagation-validation-server/package.json b/integration-tests/propagation-validation-server/package.json
index 673a6cd08f..1fab21572c 100644
--- a/integration-tests/propagation-validation-server/package.json
+++ b/integration-tests/propagation-validation-server/package.json
@@ -1,19 +1,25 @@
{
"name": "propagation-validation-server",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "server for w3c tests",
"main": "validation_server.js",
"private": true,
"repository": "open-telemetry/opentelemetry-js",
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
+ "scripts": {
+ "compile": "tsc --build"
+ },
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/context-async-hooks": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/context-async-hooks": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"axios": "0.21.0",
"body-parser": "1.19.0",
"express": "4.17.1"
+ },
+ "devDependencies": {
+ "typescript": "3.9.7"
}
}
diff --git a/integration-tests/propagation-validation-server/tsconfig.json b/integration-tests/propagation-validation-server/tsconfig.json
new file mode 100644
index 0000000000..187a1228e9
--- /dev/null
+++ b/integration-tests/propagation-validation-server/tsconfig.json
@@ -0,0 +1,22 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "compilerOptions": {
+ "rootDir": ".",
+ "outDir": "build"
+ },
+ "include": [],
+ "references": [
+ {
+ "path": "../../packages/opentelemetry-api"
+ },
+ {
+ "path": "../../packages/opentelemetry-context-async-hooks"
+ },
+ {
+ "path": "../../packages/opentelemetry-core"
+ },
+ {
+ "path": "../../packages/opentelemetry-tracing"
+ }
+ ]
+}
diff --git a/integration-tests/propagation-validation-server/validation-server.js b/integration-tests/propagation-validation-server/validation-server.js
index 4818fb2761..badcddb769 100644
--- a/integration-tests/propagation-validation-server/validation-server.js
+++ b/integration-tests/propagation-validation-server/validation-server.js
@@ -1,7 +1,7 @@
const axios = require("axios");
const { HttpTraceContext } = require("@opentelemetry/core");
const { BasicTracerProvider } = require("@opentelemetry/tracing");
-const { context, propagation, trace, ROOT_CONTEXT } = require("@opentelemetry/api");
+const { context, propagation, setSpan, trace, ROOT_CONTEXT } = require("@opentelemetry/api");
const {
AsyncHooksContextManager,
} = require("@opentelemetry/context-async-hooks");
@@ -36,7 +36,7 @@ app.post("/verify-tracecontext", (req, res) => {
req.body.map((action) => {
const span = tracer.startSpan("propagate-w3c");
let promise;
- tracer.withSpan(span, () => {
+ context.with(setSpan(context.active(), span), () => {
const headers = {};
propagation.inject(context.active(), headers);
promise = axios
diff --git a/lerna.json b/lerna.json
index 55f8b325c5..3c885c959f 100644
--- a/lerna.json
+++ b/lerna.json
@@ -8,7 +8,7 @@
"packages/*",
"integration-tests/*"
],
- "version": "0.13.0",
+ "version": "0.14.0",
"changelog": {
"repo": "open-telemetry/opentelemetry-js",
"labels": {
diff --git a/metapackages/plugins-node-core/package.json b/metapackages/plugins-node-core/package.json
index 795875182c..954861e605 100644
--- a/metapackages/plugins-node-core/package.json
+++ b/metapackages/plugins-node-core/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/plugins-node-core",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "Metapackage which bundles all opentelemetry node core plugins",
"author": "OpenTelemetry Authors",
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme",
@@ -16,9 +16,9 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
- "@opentelemetry/plugin-grpc": "^0.13.0",
- "@opentelemetry/plugin-grpc-js": "^0.13.0",
- "@opentelemetry/plugin-http": "^0.13.0",
- "@opentelemetry/plugin-https": "^0.13.0"
+ "@opentelemetry/plugin-grpc": "^0.14.0",
+ "@opentelemetry/plugin-grpc-js": "^0.14.0",
+ "@opentelemetry/plugin-http": "^0.14.0",
+ "@opentelemetry/plugin-https": "^0.14.0"
}
}
diff --git a/metapackages/plugins-web-core/package.json b/metapackages/plugins-web-core/package.json
index 3301a45666..f026966afa 100644
--- a/metapackages/plugins-web-core/package.json
+++ b/metapackages/plugins-web-core/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/plugins-web-core",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "Metapackage which bundles all opentelemetry web core plugins",
"author": "OpenTelemetry Authors",
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme",
@@ -16,6 +16,6 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
- "@opentelemetry/instrumentation-xml-http-request": "^0.13.0"
+ "@opentelemetry/instrumentation-xml-http-request": "^0.14.0"
}
}
diff --git a/package.json b/package.json
index 206e8ff165..511657f6c3 100644
--- a/package.json
+++ b/package.json
@@ -1,24 +1,25 @@
{
"name": "opentelemetry-base",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry is a distributed tracing and stats collection framework.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"scripts": {
+ "compile": "tsc --build",
+ "watch": "tsc --build --watch",
+ "clean": "tsc --build --clean",
"bench": "node benchmark",
- "clean": "lerna run clean",
- "postinstall": "npm run bootstrap",
- "precompile": "tsc --version",
+ "postinstall": "update-ts-references && npm run bootstrap",
+ "postcompile": "npm run submodule && npm run protos:copy",
+ "submodule": "git submodule sync --recursive && git submodule update --init --recursive",
+ "protos:copy": "lerna run protos:copy",
"version:update": "lerna run version:update",
- "compile": "lerna run compile",
"test": "lerna run test",
"test:browser": "lerna run test:browser",
"test:backcompat": "lerna run test:backcompat",
"bootstrap": "lerna bootstrap",
- "bump": "lerna publish",
"codecov": "lerna run codecov",
"codecov:browser": "lerna run codecov:browser",
- "changelog": "lerna-changelog",
"predocs-test": "npm run docs",
"docs-test": "lerna run docs-test",
"docs": "lerna run docs",
@@ -57,7 +58,8 @@
"lerna": "3.22.1",
"lerna-changelog": "1.0.1",
"markdownlint-cli": "0.25.0",
- "typescript": "3.9.7"
+ "typescript": "3.9.7",
+ "update-ts-references": "^1.3.0"
},
"husky": {
"hooks": {
diff --git a/packages/opentelemetry-api/README.md b/packages/opentelemetry-api/README.md
index 180ab4c7e2..0f91bb0bca 100644
--- a/packages/opentelemetry-api/README.md
+++ b/packages/opentelemetry-api/README.md
@@ -160,7 +160,7 @@ const api = require("@opentelemetry/api");
const tracer = api.trace.getTracer("my-library-name", "0.2.3");
async function doSomething() {
- const span = tracer.startSpan("doSomething", { parent: tracer.getCurrentSpan() });
+ const span = tracer.startSpan("doSomething");
try {
const result = await doSomethingElse();
span.end();
diff --git a/packages/opentelemetry-api/package.json b/packages/opentelemetry-api/package.json
index 86daddc359..f3e0d5e40f 100644
--- a/packages/opentelemetry-api/package.json
+++ b/packages/opentelemetry-api/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/api",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "Public API for OpenTelemetry",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
@@ -10,6 +10,8 @@
},
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
"test:browser": "nyc karma start --single-run",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
@@ -17,13 +19,10 @@
"build": "npm run compile",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
+ "version": "node ../../scripts/version-update.js",
"docs-test": "linkinator docs/out --silent --skip david-dm.org",
- "docs": "typedoc --tsconfig tsconfig.json --exclude test/**/*.ts",
- "prepare": "npm run compile",
- "watch": "tsc -w"
+ "docs": "typedoc --tsconfig tsconfig.docs.json",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -52,7 +51,7 @@
"access": "public"
},
"dependencies": {
- "@opentelemetry/context-base": "^0.13.0"
+ "@opentelemetry/context-base": "^0.14.0"
},
"devDependencies": {
"@types/mocha": "8.2.0",
diff --git a/packages/opentelemetry-api/src/api/global-utils.ts b/packages/opentelemetry-api/src/api/global-utils.ts
index 297836e009..5d6ad7de3e 100644
--- a/packages/opentelemetry-api/src/api/global-utils.ts
+++ b/packages/opentelemetry-api/src/api/global-utils.ts
@@ -65,4 +65,4 @@ export function makeGetter(
* version. If the global API is not compatible with the API package
* attempting to get it, a NOOP API implementation will be returned.
*/
-export const API_BACKWARDS_COMPATIBILITY_VERSION = 2;
+export const API_BACKWARDS_COMPATIBILITY_VERSION = 3;
diff --git a/packages/opentelemetry-api/src/context/context.ts b/packages/opentelemetry-api/src/context/context.ts
index 104e8f5945..4dc2b4c47c 100644
--- a/packages/opentelemetry-api/src/context/context.ts
+++ b/packages/opentelemetry-api/src/context/context.ts
@@ -18,11 +18,9 @@ import { Context, createContextKey } from '@opentelemetry/context-base';
import { Baggage, NoopSpan, Span, SpanContext } from '../';
/**
- * Active span key
+ * span key
*/
-const ACTIVE_SPAN_KEY = createContextKey(
- 'OpenTelemetry Context Key ACTIVE_SPAN'
-);
+const SPAN_KEY = createContextKey('OpenTelemetry Context Key SPAN');
/**
* Shared key for indicating if instrumentation should be suppressed beyond
@@ -38,49 +36,45 @@ const SUPPRESS_INSTRUMENTATION_KEY = createContextKey(
const BAGGAGE_KEY = createContextKey('OpenTelemetry Baggage Key');
/**
- * Return the active span if one exists
+ * Return the span if one exists
*
* @param context context to get span from
*/
-export function getActiveSpan(context: Context): Span | undefined {
- return (context.getValue(ACTIVE_SPAN_KEY) as Span) || undefined;
+export function getSpan(context: Context): Span | undefined {
+ return (context.getValue(SPAN_KEY) as Span) || undefined;
}
/**
- * Set the active span on a context
+ * Set the span on a context
*
* @param context context to use as parent
* @param span span to set active
*/
-export function setActiveSpan(context: Context, span: Span): Context {
- return context.setValue(ACTIVE_SPAN_KEY, span);
+export function setSpan(context: Context, span: Span): Context {
+ return context.setValue(SPAN_KEY, span);
}
/**
- * Wrap extracted span context in a NoopSpan and set as active span in a new
+ * Wrap span context in a NoopSpan and set as span in a new
* context
*
* @param context context to set active span on
* @param spanContext span context to be wrapped
*/
-export function setExtractedSpanContext(
+export function setSpanContext(
context: Context,
spanContext: SpanContext
): Context {
- return setActiveSpan(context, new NoopSpan(spanContext));
+ return setSpan(context, new NoopSpan(spanContext));
}
/**
- * Get the span context of the parent span if it exists,
- * or the extracted span context if there is no active
- * span.
+ * Get the span context of the span if it exists.
*
* @param context context to get values from
*/
-export function getParentSpanContext(
- context: Context
-): SpanContext | undefined {
- return getActiveSpan(context)?.context();
+export function getSpanContext(context: Context): SpanContext | undefined {
+ return getSpan(context)?.context();
}
/**
diff --git a/packages/opentelemetry-api/src/trace/NoopTracer.ts b/packages/opentelemetry-api/src/trace/NoopTracer.ts
index d733c930ea..bb25bcbe1d 100644
--- a/packages/opentelemetry-api/src/trace/NoopTracer.ts
+++ b/packages/opentelemetry-api/src/trace/NoopTracer.ts
@@ -18,16 +18,12 @@ import { Span, SpanOptions, Tracer, SpanContext } from '..';
import { Context } from '@opentelemetry/context-base';
import { NoopSpan, NOOP_SPAN } from './NoopSpan';
import { isSpanContextValid } from './spancontext-utils';
-import { getParentSpanContext } from '../context/context';
+import { getSpanContext } from '../context/context';
/**
* No-op implementations of {@link Tracer}.
*/
export class NoopTracer implements Tracer {
- getCurrentSpan(): Span {
- return NOOP_SPAN;
- }
-
// startSpan starts a noop span.
startSpan(name: string, options?: SpanOptions, context?: Context): Span {
const root = Boolean(options?.root);
@@ -35,7 +31,7 @@ export class NoopTracer implements Tracer {
return NOOP_SPAN;
}
- const parentFromContext = context && getParentSpanContext(context);
+ const parentFromContext = context && getSpanContext(context);
if (
isSpanContext(parentFromContext) &&
@@ -46,17 +42,6 @@ export class NoopTracer implements Tracer {
return NOOP_SPAN;
}
}
-
- withSpan ReturnType>(
- span: Span,
- fn: T
- ): ReturnType {
- return fn();
- }
-
- bind(target: T, _span?: Span): T {
- return target;
- }
}
function isSpanContext(spanContext: any): spanContext is SpanContext {
diff --git a/packages/opentelemetry-api/src/trace/ProxyTracer.ts b/packages/opentelemetry-api/src/trace/ProxyTracer.ts
index e2216eed5e..c6e22433e7 100644
--- a/packages/opentelemetry-api/src/trace/ProxyTracer.ts
+++ b/packages/opentelemetry-api/src/trace/ProxyTracer.ts
@@ -31,25 +31,10 @@ export class ProxyTracer implements Tracer {
public readonly version?: string
) {}
- getCurrentSpan(): Span | undefined {
- return this._getTracer().getCurrentSpan();
- }
-
startSpan(name: string, options?: SpanOptions): Span {
return this._getTracer().startSpan(name, options);
}
- withSpan ReturnType>(
- span: Span,
- fn: T
- ): ReturnType {
- return this._getTracer().withSpan(span, fn);
- }
-
- bind(target: T, span?: Span): T {
- return this._getTracer().bind(target, span);
- }
-
/**
* Try to get a tracer from the proxy tracer provider.
* If the proxy tracer provider has no delegate, return a noop tracer.
diff --git a/packages/opentelemetry-api/src/trace/tracer.ts b/packages/opentelemetry-api/src/trace/tracer.ts
index 6ba051cfee..abc72a53f3 100644
--- a/packages/opentelemetry-api/src/trace/tracer.ts
+++ b/packages/opentelemetry-api/src/trace/tracer.ts
@@ -27,24 +27,9 @@ import { SpanOptions } from './SpanOptions';
*/
export interface Tracer {
/**
- * Returns the current Span from the current context if available.
+ * Starts a new {@link Span}. Start the span without setting it on context.
*
- * If there is no Span associated with the current context, `undefined` is
- * returned.
- *
- * To install a {@link Span} to the current Context use
- * {@link Tracer.withSpan}.
- *
- * @returns Span The currently active Span
- */
- getCurrentSpan(): Span | undefined;
-
- /**
- * Starts a new {@link Span}. Start the span without setting it as the current
- * span in this tracer's context.
- *
- * This method do NOT modify the current Context. To install a {@link
- * Span} to the current Context use {@link Tracer.withSpan}.
+ * This method do NOT modify the current Context.
*
* @param name The name of the span
* @param [options] SpanOptions used for span creation
@@ -56,32 +41,4 @@ export interface Tracer {
* span.end();
*/
startSpan(name: string, options?: SpanOptions, context?: Context): Span;
-
- /**
- * Executes the function given by fn within the context provided by Span.
- *
- * This is a convenience method for creating spans attached to the tracer's
- * context. Applications that need more control over the span lifetime should
- * use {@link Tracer.startSpan} instead.
- *
- * @param span The span that provides the context
- * @param fn The function to be executed inside the provided context
- * @example
- * tracer.withSpan(span, () => {
- * tracer.getCurrentSpan().addEvent("parent's event");
- * doSomeOtherWork(); // Here "span" is the current Span.
- * });
- */
- withSpan ReturnType>(
- span: Span,
- fn: T
- ): ReturnType;
-
- /**
- * Bind a span as the target's context or propagate the current one.
- *
- * @param target Any object to which a context need to be set
- * @param [context] Optionally specify the context which you want to bind
- */
- bind(target: T, context?: Span): T;
}
diff --git a/packages/opentelemetry-api/src/version.ts b/packages/opentelemetry-api/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-api/src/version.ts
+++ b/packages/opentelemetry-api/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-api/test/api/api.test.ts b/packages/opentelemetry-api/test/api/api.test.ts
index d2ca5daab5..01aaf32df6 100644
--- a/packages/opentelemetry-api/test/api/api.test.ts
+++ b/packages/opentelemetry-api/test/api/api.test.ts
@@ -36,8 +36,6 @@ import api, {
} from '../../src';
describe('API', () => {
- const functions = ['getCurrentSpan', 'startSpan', 'withSpan'];
-
it('should expose a tracer provider via getTracerProvider', () => {
const tracer = api.trace.getTracerProvider();
assert.ok(tracer);
@@ -59,20 +57,6 @@ describe('API', () => {
metrics.disable();
});
- it('should not crash', () => {
- functions.forEach(fn => {
- const tracer = api.trace.getTracerProvider();
- try {
- ((tracer as unknown) as { [fn: string]: Function })[fn](); // Try to run the function
- assert.ok(true, fn);
- } catch (err) {
- if (err.message !== 'Method not implemented.') {
- assert.ok(true, fn);
- }
- }
- });
- });
-
it('should use the global tracer provider', () => {
api.trace.setGlobalTracerProvider(new TestTracerProvider());
const tracer = api.trace.getTracerProvider().getTracer('name');
diff --git a/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts b/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts
index bfc06b8133..3730968323 100644
--- a/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts
+++ b/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts
@@ -22,7 +22,7 @@ import {
SpanKind,
TraceFlags,
context,
- setExtractedSpanContext,
+ setSpanContext,
} from '../../src';
describe('NoopTracer', () => {
@@ -40,24 +40,6 @@ describe('NoopTracer', () => {
}),
NOOP_SPAN
);
-
- assert.deepStrictEqual(tracer.getCurrentSpan(), NOOP_SPAN);
- });
-
- it('should not crash when .withSpan()', done => {
- const tracer = new NoopTracer();
- tracer.withSpan(NOOP_SPAN, () => {
- return done();
- });
- });
-
- it('should not crash when .bind()', done => {
- const tracer = new NoopTracer();
- const fn = () => {
- return done();
- };
- const patchedFn = tracer.bind(fn, NOOP_SPAN);
- return patchedFn();
});
it('should propagate valid spanContext on the span (from context)', () => {
@@ -70,7 +52,7 @@ describe('NoopTracer', () => {
const span = tracer.startSpan(
'test-1',
{},
- setExtractedSpanContext(context.active(), parent)
+ setSpanContext(context.active(), parent)
);
assert(span.context().traceId === parent.traceId);
assert(span.context().spanId === parent.spanId);
diff --git a/packages/opentelemetry-api/test/proxy-implementations/proxy-tracer.test.ts b/packages/opentelemetry-api/test/proxy-implementations/proxy-tracer.test.ts
index 7a110cbfa3..41db382f3d 100644
--- a/packages/opentelemetry-api/test/proxy-implementations/proxy-tracer.test.ts
+++ b/packages/opentelemetry-api/test/proxy-implementations/proxy-tracer.test.ts
@@ -56,8 +56,6 @@ describe('ProxyTracer', () => {
}),
NOOP_SPAN
);
-
- assert.deepStrictEqual(tracer.getCurrentSpan(), NOOP_SPAN);
});
});
@@ -96,18 +94,9 @@ describe('ProxyTracer', () => {
beforeEach(() => {
delegateSpan = new NoopSpan();
delegateTracer = {
- bind(target) {
- return target;
- },
- getCurrentSpan() {
- return delegateSpan;
- },
startSpan() {
return delegateSpan;
},
- withSpan(span, fn) {
- return fn();
- },
};
tracer = provider.getTracer('test');
diff --git a/packages/opentelemetry-api/tsconfig.docs.json b/packages/opentelemetry-api/tsconfig.docs.json
new file mode 100644
index 0000000000..627fa3ff3e
--- /dev/null
+++ b/packages/opentelemetry-api/tsconfig.docs.json
@@ -0,0 +1,15 @@
+{
+ "compilerOptions": {
+ "rootDir": ".",
+ "outDir": "build"
+ },
+ "include": [
+ "src/**/*.ts"
+ ],
+ "typedocOptions": {
+ "name": "OpenTelemetry API for JavaScript",
+ "out": "docs/out",
+ "mode": "file",
+ "hideGenerator": true
+ }
+}
diff --git a/packages/opentelemetry-api/tsconfig.json b/packages/opentelemetry-api/tsconfig.json
index 79cc5cefac..8223abee15 100644
--- a/packages/opentelemetry-api/tsconfig.json
+++ b/packages/opentelemetry-api/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.es5",
+ "extends": "../../tsconfig.es5.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -8,10 +8,9 @@
"src/**/*.ts",
"test/**/*.ts"
],
- "typedocOptions": {
- "name": "OpenTelemetry API for JavaScript",
- "out": "docs/out",
- "mode": "file",
- "hideGenerator": true
- }
+ "references": [
+ {
+ "path": "../opentelemetry-context-base"
+ }
+ ]
}
diff --git a/packages/opentelemetry-context-async-hooks/package.json b/packages/opentelemetry-context-async-hooks/package.json
index a5404c3e0f..349d03fec9 100644
--- a/packages/opentelemetry-context-async-hooks/package.json
+++ b/packages/opentelemetry-context-async-hooks/package.json
@@ -1,21 +1,19 @@
{
"name": "@opentelemetry/context-async-hooks",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry AsyncHooks-based Context Manager",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "clean": "rimraf build/*",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile"
+ "version": "node ../../scripts/version-update.js"
},
"keywords": [
"opentelemetry",
@@ -55,6 +53,6 @@
"typescript": "3.9.7"
},
"dependencies": {
- "@opentelemetry/context-base": "^0.13.0"
+ "@opentelemetry/context-base": "^0.14.0"
}
}
diff --git a/packages/opentelemetry-context-async-hooks/src/version.ts b/packages/opentelemetry-context-async-hooks/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-context-async-hooks/src/version.ts
+++ b/packages/opentelemetry-context-async-hooks/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-context-async-hooks/tsconfig.json b/packages/opentelemetry-context-async-hooks/tsconfig.json
index a2042cd68b..bf8999c67b 100644
--- a/packages/opentelemetry-context-async-hooks/tsconfig.json
+++ b/packages/opentelemetry-context-async-hooks/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,10 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-context-base"
+ }
]
}
diff --git a/packages/opentelemetry-context-base/package.json b/packages/opentelemetry-context-base/package.json
index 3ac9fd7a4c..76cb1a6587 100644
--- a/packages/opentelemetry-context-base/package.json
+++ b/packages/opentelemetry-context-base/package.json
@@ -1,22 +1,20 @@
{
"name": "@opentelemetry/context-base",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry Base Context Manager",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "clean": "rimraf build/*",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
- "watch": "tsc -w"
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
diff --git a/packages/opentelemetry-context-base/src/version.ts b/packages/opentelemetry-context-base/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-context-base/src/version.ts
+++ b/packages/opentelemetry-context-base/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-context-base/tsconfig.json b/packages/opentelemetry-context-base/tsconfig.json
index ca8d7656bb..b8d88215e4 100644
--- a/packages/opentelemetry-context-base/tsconfig.json
+++ b/packages/opentelemetry-context-base/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.es5",
+ "extends": "../../tsconfig.es5.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
diff --git a/packages/opentelemetry-context-zone-peer-dep/README.md b/packages/opentelemetry-context-zone-peer-dep/README.md
index 15edbcb0dd..421fa937a2 100644
--- a/packages/opentelemetry-context-zone-peer-dep/README.md
+++ b/packages/opentelemetry-context-zone-peer-dep/README.md
@@ -22,6 +22,7 @@ npm install --save @opentelemetry/context-zone-peer-dep
## Usage
```js
+import { context, getSpan, setSpan } from '@opentelemetry/api';
import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
import { WebTracerProvider } from '@opentelemetry/web';
import { ZoneContextManager } from '@opentelemetry/context-zone-peer-dep';
@@ -35,21 +36,21 @@ providerWithZone.register({
// Example how the ZoneContextManager keeps the reference to the correct context during async operations
const webTracerWithZone = providerWithZone.getTracer('default');
const span1 = webTracerWithZone.startSpan('foo1');
-webTracerWithZone.withSpan(span1, () => {
- console.log('Current span is span1', webTracerWithZone.getCurrentSpan() === span1);
+context.with(setSpan(context.active(), span1, () => {
+ console.log('Current span is span1', getSpan(context.active()) === span1);
setTimeout(() => {
const span2 = webTracerWithZone.startSpan('foo2');
- console.log('Current span is span1', webTracerWithZone.getCurrentSpan() === span1);
- webTracerWithZone.withSpan(span2, () => {
- console.log('Current span is span2', webTracerWithZone.getCurrentSpan() === span2);
+ console.log('Current span is span1', getSpan(context.active()) === span1);
+ context.with(setSpan(context.active(), span2, () => {
+ console.log('Current span is span2', getSpan(context.active()) === span2);
setTimeout(() => {
- console.log('Current span is span2', webTracerWithZone.getCurrentSpan() === span2);
+ console.log('Current span is span2', getSpan(context.active()) === span2);
}, 500);
});
// there is a timeout which still keeps span2 active
- console.log('Current span is span2', webTracerWithZone.getCurrentSpan() === span2);
+ console.log('Current span is span2', getSpan(context.active()) === span2);
}, 500);
- console.log('Current span is span1', webTracerWithZone.getCurrentSpan() === span1);
+ console.log('Current span is span1', getSpan(context.active()) === span1);
});
```
diff --git a/packages/opentelemetry-context-zone-peer-dep/package.json b/packages/opentelemetry-context-zone-peer-dep/package.json
index b851740e97..45eafacde6 100644
--- a/packages/opentelemetry-context-zone-peer-dep/package.json
+++ b/packages/opentelemetry-context-zone-peer-dep/package.json
@@ -1,21 +1,20 @@
{
"name": "@opentelemetry/context-zone-peer-dep",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry Context Zone with peer dependency for zone.js",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "clean": "rimraf build/*",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
+ "version": "node ../../scripts/version-update.js",
"tdd": "karma start",
"test:browser": "nyc karma start --single-run",
- "watch": "tsc -w"
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -71,7 +70,7 @@
"zone.js": "0.11.3"
},
"dependencies": {
- "@opentelemetry/context-base": "^0.13.0"
+ "@opentelemetry/context-base": "^0.14.0"
},
"peerDependencies": {
"zone.js": "^0.10.2 || ^0.11.0"
diff --git a/packages/opentelemetry-context-zone-peer-dep/src/version.ts b/packages/opentelemetry-context-zone-peer-dep/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-context-zone-peer-dep/src/version.ts
+++ b/packages/opentelemetry-context-zone-peer-dep/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-context-zone-peer-dep/tsconfig.json b/packages/opentelemetry-context-zone-peer-dep/tsconfig.json
index 33ecce9d6d..2e7c26e39c 100644
--- a/packages/opentelemetry-context-zone-peer-dep/tsconfig.json
+++ b/packages/opentelemetry-context-zone-peer-dep/tsconfig.json
@@ -1,13 +1,20 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build",
"skipLibCheck": true
},
- "files": [ "node_modules/zone.js/dist/zone.js.d.ts"],
+ "files": [
+ "node_modules/zone.js/dist/zone.js.d.ts"
+ ],
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-context-base"
+ }
]
}
diff --git a/packages/opentelemetry-context-zone/README.md b/packages/opentelemetry-context-zone/README.md
index 4e26999004..e2c3ae72e1 100644
--- a/packages/opentelemetry-context-zone/README.md
+++ b/packages/opentelemetry-context-zone/README.md
@@ -19,6 +19,7 @@ npm install --save @opentelemetry/context-zone
## Usage
```js
+import { context, getSpan, setSpan } from '@opentelemetry/api';
import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
import { WebTracerProvider } from '@opentelemetry/web';
import { ZoneContextManager } from '@opentelemetry/context-zone';
@@ -32,21 +33,22 @@ provider.register({
// Example how the ZoneContextManager keeps the reference to the correct context during async operations
const webTracerWithZone = providerWithZone.getTracer('default');
const span1 = webTracerWithZone.startSpan('foo1');
-webTracerWithZone.withSpan(span1, () => {
- console.log('Current span is span1', webTracerWithZone.getCurrentSpan() === span1);
+
+context.with(setSpan(context.active(), span1), () => {
+ console.log('Current span is span1', getSpan(context.active()) === span1);
setTimeout(() => {
const span2 = webTracerWithZone.startSpan('foo2');
- console.log('Current span is span1', webTracerWithZone.getCurrentSpan() === span1);
- webTracerWithZone.withSpan(span2, () => {
- console.log('Current span is span2', webTracerWithZone.getCurrentSpan() === span2);
+ console.log('Current span is span1', getSpan(context.active()) === span1);
+ context.with(setSpan(context.active(), span2), () => {
+ console.log('Current span is span2', getSpan(context.active()) === span2);
setTimeout(() => {
- console.log('Current span is span2', webTracerWithZone.getCurrentSpan() === span2);
+ console.log('Current span is span2', getSpan(context.active()) === span2);
}, 500);
});
// there is a timeout which still keeps span2 active
- console.log('Current span is span2', webTracerWithZone.getCurrentSpan() === span2);
+ console.log('Current span is span2', getSpan(context.active()) === span2);
}, 500);
- console.log('Current span is span1', webTracerWithZone.getCurrentSpan() === span1);
+ console.log('Current span is span1', getSpan(context.active()) === span1);
});
```
diff --git a/packages/opentelemetry-context-zone/package.json b/packages/opentelemetry-context-zone/package.json
index e3e6756b8b..5ac8ee0b36 100644
--- a/packages/opentelemetry-context-zone/package.json
+++ b/packages/opentelemetry-context-zone/package.json
@@ -1,18 +1,17 @@
{
"name": "@opentelemetry/context-zone",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry Context Zone",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "clean": "rimraf build/*",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
- "watch": "tsc -w"
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -65,7 +64,7 @@
"webpack-merge": "5.6.1"
},
"dependencies": {
- "@opentelemetry/context-zone-peer-dep": "^0.13.0",
+ "@opentelemetry/context-zone-peer-dep": "^0.14.0",
"zone.js": "^0.11.0"
},
"sideEffects": true
diff --git a/packages/opentelemetry-context-zone/src/version.ts b/packages/opentelemetry-context-zone/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-context-zone/src/version.ts
+++ b/packages/opentelemetry-context-zone/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-context-zone/tsconfig.json b/packages/opentelemetry-context-zone/tsconfig.json
index 33ecce9d6d..e714c6958f 100644
--- a/packages/opentelemetry-context-zone/tsconfig.json
+++ b/packages/opentelemetry-context-zone/tsconfig.json
@@ -1,13 +1,20 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build",
"skipLibCheck": true
},
- "files": [ "node_modules/zone.js/dist/zone.js.d.ts"],
+ "files": [
+ "node_modules/zone.js/dist/zone.js.d.ts"
+ ],
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-context-zone-peer-dep"
+ }
]
}
diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json
index c71daf853c..53a72577a6 100644
--- a/packages/opentelemetry-core/package.json
+++ b/packages/opentelemetry-core/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/core",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry Core provides default and no-op implementations of the OpenTelemetry types for trace and metrics",
"main": "build/src/index.js",
"browser": {
@@ -10,6 +10,8 @@
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts --exclude 'test/platform/browser/**/*.ts'",
"test:browser": "nyc karma start --single-run",
"tdd": "npm run tdd:node",
@@ -17,14 +19,10 @@
"tdd:browser": "karma start",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "clean": "rimraf build/*",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "precompile": "tsc --version",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
- "version:update": "node ../../scripts/version-update.js",
- "watch": "tsc -w"
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -52,7 +50,7 @@
"access": "public"
},
"devDependencies": {
- "@opentelemetry/propagator-b3": "^0.13.0",
+ "@opentelemetry/propagator-b3": "^0.14.0",
"@types/mocha": "8.2.0",
"@types/node": "14.14.12",
"@types/semver": "7.3.4",
@@ -78,8 +76,8 @@
"webpack": "4.44.2"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/context-base": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/context-base": "^0.14.0",
"semver": "^7.1.3"
}
}
diff --git a/packages/opentelemetry-core/src/context/propagation/HttpTraceContext.ts b/packages/opentelemetry-core/src/context/propagation/HttpTraceContext.ts
index 9675a864cb..5957b2228d 100644
--- a/packages/opentelemetry-core/src/context/propagation/HttpTraceContext.ts
+++ b/packages/opentelemetry-core/src/context/propagation/HttpTraceContext.ts
@@ -16,8 +16,8 @@
import {
Context,
- getParentSpanContext,
- setExtractedSpanContext,
+ getSpanContext,
+ setSpanContext,
SpanContext,
TextMapGetter,
TextMapPropagator,
@@ -86,7 +86,7 @@ export function parseTraceParent(traceParent: string): SpanContext | null {
*/
export class HttpTraceContext implements TextMapPropagator {
inject(context: Context, carrier: unknown, setter: TextMapSetter) {
- const spanContext = getParentSpanContext(context);
+ const spanContext = getSpanContext(context);
if (!spanContext) return;
const traceParent = `${VERSION}-${spanContext.traceId}-${
@@ -126,7 +126,7 @@ export class HttpTraceContext implements TextMapPropagator {
typeof state === 'string' ? state : undefined
);
}
- return setExtractedSpanContext(context, spanContext);
+ return setSpanContext(context, spanContext);
}
fields(): string[] {
diff --git a/packages/opentelemetry-core/src/context/propagation/composite.ts b/packages/opentelemetry-core/src/context/propagation/composite.ts
index 7048c3e7d4..27b4101ee4 100644
--- a/packages/opentelemetry-core/src/context/propagation/composite.ts
+++ b/packages/opentelemetry-core/src/context/propagation/composite.ts
@@ -20,8 +20,8 @@ import {
TextMapPropagator,
Logger,
TextMapSetter,
+ NoopLogger,
} from '@opentelemetry/api';
-import { NoopLogger } from '../../common/NoopLogger';
import { CompositePropagatorConfig } from './types';
/** Combines multiple propagators into a single propagator. */
diff --git a/packages/opentelemetry-core/src/index.ts b/packages/opentelemetry-core/src/index.ts
index a8167a61d9..6430c84cbd 100644
--- a/packages/opentelemetry-core/src/index.ts
+++ b/packages/opentelemetry-core/src/index.ts
@@ -18,7 +18,6 @@ export * from './common/attributes';
export * from './common/ConsoleLogger';
export * from './common/global-error-handler';
export * from './common/logging-error-handler';
-export * from './common/NoopLogger';
export * from './common/time';
export * from './common/types';
export * from './ExportResult';
diff --git a/packages/opentelemetry-core/src/trace/sampler/ParentBasedSampler.ts b/packages/opentelemetry-core/src/trace/sampler/ParentBasedSampler.ts
index e0966068c1..eb21a01829 100644
--- a/packages/opentelemetry-core/src/trace/sampler/ParentBasedSampler.ts
+++ b/packages/opentelemetry-core/src/trace/sampler/ParentBasedSampler.ts
@@ -17,7 +17,7 @@
import {
Attributes,
Context,
- getParentSpanContext,
+ getSpanContext,
Link,
Sampler,
SamplingResult,
@@ -67,7 +67,7 @@ export class ParentBasedSampler implements Sampler {
attributes: Attributes,
links: Link[]
): SamplingResult {
- const parentContext = getParentSpanContext(context);
+ const parentContext = getSpanContext(context);
if (!parentContext) {
return this._root.shouldSample(
diff --git a/packages/opentelemetry-core/src/version.ts b/packages/opentelemetry-core/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-core/src/version.ts
+++ b/packages/opentelemetry-core/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-core/test/context/HttpTraceContext.test.ts b/packages/opentelemetry-core/test/context/HttpTraceContext.test.ts
index 44dbb2632f..d0c6148fd5 100644
--- a/packages/opentelemetry-core/test/context/HttpTraceContext.test.ts
+++ b/packages/opentelemetry-core/test/context/HttpTraceContext.test.ts
@@ -19,8 +19,8 @@ import {
defaultTextMapSetter,
SpanContext,
TraceFlags,
- getParentSpanContext,
- setExtractedSpanContext,
+ getSpanContext,
+ setSpanContext,
} from '@opentelemetry/api';
import { ROOT_CONTEXT } from '@opentelemetry/context-base';
import * as assert from 'assert';
@@ -48,7 +48,7 @@ describe('HttpTraceContext', () => {
};
httpTraceContext.inject(
- setExtractedSpanContext(ROOT_CONTEXT, spanContext),
+ setSpanContext(ROOT_CONTEXT, spanContext),
carrier,
defaultTextMapSetter
);
@@ -68,7 +68,7 @@ describe('HttpTraceContext', () => {
};
httpTraceContext.inject(
- setExtractedSpanContext(ROOT_CONTEXT, spanContext),
+ setSpanContext(ROOT_CONTEXT, spanContext),
carrier,
defaultTextMapSetter
);
@@ -84,7 +84,7 @@ describe('HttpTraceContext', () => {
it('should extract context of a sampled span from carrier', () => {
carrier[TRACE_PARENT_HEADER] =
'00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01';
- const extractedSpanContext = getParentSpanContext(
+ const extractedSpanContext = getSpanContext(
httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
);
@@ -99,7 +99,7 @@ describe('HttpTraceContext', () => {
it('should extract context of a sampled span from carrier using a future version', () => {
carrier[TRACE_PARENT_HEADER] =
'cc-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01';
- const extractedSpanContext = getParentSpanContext(
+ const extractedSpanContext = getSpanContext(
httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
);
@@ -114,7 +114,7 @@ describe('HttpTraceContext', () => {
it('should extract context of a sampled span from carrier using a future version and future fields', () => {
carrier[TRACE_PARENT_HEADER] =
'cc-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01-what-the-future-will-be-like';
- const extractedSpanContext = getParentSpanContext(
+ const extractedSpanContext = getSpanContext(
httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
);
@@ -128,7 +128,7 @@ describe('HttpTraceContext', () => {
it('returns null if traceparent header is missing', () => {
assert.deepStrictEqual(
- getParentSpanContext(
+ getSpanContext(
httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
),
undefined
@@ -138,7 +138,7 @@ describe('HttpTraceContext', () => {
it('returns null if traceparent header is invalid', () => {
carrier[TRACE_PARENT_HEADER] = 'invalid!';
assert.deepStrictEqual(
- getParentSpanContext(
+ getSpanContext(
httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
),
undefined
@@ -151,7 +151,7 @@ describe('HttpTraceContext', () => {
'00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01-extra';
assert.deepStrictEqual(
- getParentSpanContext(
+ getSpanContext(
httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
),
undefined
@@ -162,7 +162,7 @@ describe('HttpTraceContext', () => {
carrier[TRACE_PARENT_HEADER] = [
'00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01',
];
- const extractedSpanContext = getParentSpanContext(
+ const extractedSpanContext = getSpanContext(
httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
);
assert.deepStrictEqual(extractedSpanContext, {
@@ -177,7 +177,7 @@ describe('HttpTraceContext', () => {
carrier[TRACE_PARENT_HEADER] =
'00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01';
carrier[TRACE_STATE_HEADER] = 'foo=bar,baz=qux';
- const extractedSpanContext = getParentSpanContext(
+ const extractedSpanContext = getSpanContext(
httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
);
@@ -195,7 +195,7 @@ describe('HttpTraceContext', () => {
carrier[TRACE_PARENT_HEADER] =
'00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01';
carrier[TRACE_STATE_HEADER] = ['foo=bar,baz=qux', 'quux=quuz'];
- const extractedSpanContext = getParentSpanContext(
+ const extractedSpanContext = getSpanContext(
httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
);
assert.deepStrictEqual(extractedSpanContext, {
@@ -249,7 +249,7 @@ describe('HttpTraceContext', () => {
Object.getOwnPropertyNames(testCases).forEach(testCase => {
carrier[TRACE_PARENT_HEADER] = testCases[testCase];
- const extractedSpanContext = getParentSpanContext(
+ const extractedSpanContext = getSpanContext(
httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
);
assert.deepStrictEqual(extractedSpanContext, undefined, testCase);
@@ -260,7 +260,7 @@ describe('HttpTraceContext', () => {
carrier[TRACE_PARENT_HEADER] =
'00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01';
carrier[TRACE_STATE_HEADER] = 'foo=1 \t , \t bar=2, \t baz=3 ';
- const extractedSpanContext = getParentSpanContext(
+ const extractedSpanContext = getSpanContext(
httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
);
diff --git a/packages/opentelemetry-core/test/context/composite.test.ts b/packages/opentelemetry-core/test/context/composite.test.ts
index 9c85ab9eec..e9dfe65f12 100644
--- a/packages/opentelemetry-core/test/context/composite.test.ts
+++ b/packages/opentelemetry-core/test/context/composite.test.ts
@@ -19,8 +19,8 @@ import {
defaultTextMapSetter,
TextMapPropagator,
SpanContext,
- getParentSpanContext,
- setExtractedSpanContext,
+ getSpanContext,
+ setSpanContext,
} from '@opentelemetry/api';
import { Context, ROOT_CONTEXT } from '@opentelemetry/context-base';
import * as assert from 'assert';
@@ -64,7 +64,7 @@ describe('Composite Propagator', () => {
traceFlags: 1,
traceState: new TraceState('foo=bar'),
};
- ctxWithSpanContext = setExtractedSpanContext(ROOT_CONTEXT, spanContext);
+ ctxWithSpanContext = setSpanContext(ROOT_CONTEXT, spanContext);
});
it('should inject context using all configured propagators', () => {
@@ -113,7 +113,7 @@ describe('Composite Propagator', () => {
const composite = new CompositePropagator({
propagators: [new B3MultiPropagator(), new HttpTraceContext()],
});
- const spanContext = getParentSpanContext(
+ const spanContext = getSpanContext(
composite.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
);
@@ -132,7 +132,7 @@ describe('Composite Propagator', () => {
const composite = new CompositePropagator({
propagators: [new ThrowingPropagator(), new HttpTraceContext()],
});
- const spanContext = getParentSpanContext(
+ const spanContext = getSpanContext(
composite.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
);
diff --git a/packages/opentelemetry-core/test/platform/BasePlugin.test.ts b/packages/opentelemetry-core/test/platform/BasePlugin.test.ts
index 912d4bc4a1..b55fde8850 100644
--- a/packages/opentelemetry-core/test/platform/BasePlugin.test.ts
+++ b/packages/opentelemetry-core/test/platform/BasePlugin.test.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import { NoopTracerProvider } from '@opentelemetry/api';
+import { NoopTracerProvider, NoopLogger } from '@opentelemetry/api';
import * as assert from 'assert';
import * as path from 'path';
-import { BasePlugin, NoopLogger } from '../../src';
+import { BasePlugin } from '../../src';
import * as types from '../trace/fixtures/test-package/foo/bar/internal';
const provider = new NoopTracerProvider();
diff --git a/packages/opentelemetry-core/test/platform/browser/BasePlugin.test.ts b/packages/opentelemetry-core/test/platform/browser/BasePlugin.test.ts
index 202d74e350..919acbba1b 100644
--- a/packages/opentelemetry-core/test/platform/browser/BasePlugin.test.ts
+++ b/packages/opentelemetry-core/test/platform/browser/BasePlugin.test.ts
@@ -14,9 +14,13 @@
* limitations under the License.
*/
-import { NOOP_TRACER, NoopTracerProvider } from '@opentelemetry/api';
+import {
+ NOOP_TRACER,
+ NoopTracerProvider,
+ NoopLogger,
+} from '@opentelemetry/api';
import * as assert from 'assert';
-import { BasePlugin, NoopLogger } from '../../../src';
+import { BasePlugin } from '../../../src';
const provider = new NoopTracerProvider();
const logger = new NoopLogger();
diff --git a/packages/opentelemetry-core/test/trace/ParentBasedSampler.test.ts b/packages/opentelemetry-core/test/trace/ParentBasedSampler.test.ts
index f3af5a2e0c..e6c388ebe7 100644
--- a/packages/opentelemetry-core/test/trace/ParentBasedSampler.test.ts
+++ b/packages/opentelemetry-core/test/trace/ParentBasedSampler.test.ts
@@ -17,11 +17,7 @@ import * as assert from 'assert';
import * as api from '@opentelemetry/api';
import { AlwaysOnSampler } from '../../src/trace/sampler/AlwaysOnSampler';
import { ParentBasedSampler } from '../../src/trace/sampler/ParentBasedSampler';
-import {
- TraceFlags,
- SpanKind,
- setExtractedSpanContext,
-} from '@opentelemetry/api';
+import { TraceFlags, SpanKind, setSpanContext } from '@opentelemetry/api';
import { AlwaysOffSampler } from '../../src/trace/sampler/AlwaysOffSampler';
import { TraceIdRatioBasedSampler } from '../../src';
@@ -62,7 +58,7 @@ describe('ParentBasedSampler', () => {
};
assert.deepStrictEqual(
sampler.shouldSample(
- setExtractedSpanContext(api.ROOT_CONTEXT, spanContext),
+ setSpanContext(api.ROOT_CONTEXT, spanContext),
traceId,
spanName,
SpanKind.CLIENT,
@@ -103,7 +99,7 @@ describe('ParentBasedSampler', () => {
};
assert.deepStrictEqual(
sampler.shouldSample(
- setExtractedSpanContext(api.ROOT_CONTEXT, spanContext),
+ setSpanContext(api.ROOT_CONTEXT, spanContext),
traceId,
spanName,
SpanKind.CLIENT,
diff --git a/packages/opentelemetry-core/tsconfig.json b/packages/opentelemetry-core/tsconfig.json
index a2042cd68b..838b29bc26 100644
--- a/packages/opentelemetry-core/tsconfig.json
+++ b/packages/opentelemetry-core/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,16 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-context-base"
+ },
+ {
+ "path": "../opentelemetry-propagator-b3"
+ }
]
}
diff --git a/packages/opentelemetry-exporter-collector-grpc/README.md b/packages/opentelemetry-exporter-collector-grpc/README.md
index a48e2fae3e..fc22a83308 100644
--- a/packages/opentelemetry-exporter-collector-grpc/README.md
+++ b/packages/opentelemetry-exporter-collector-grpc/README.md
@@ -6,7 +6,7 @@
[![devDependencies][devDependencies-image]][devDependencies-url]
[![Apache License][license-image]][license-image]
-This module provides exporter for web and node to be used with [opentelemetry-collector][opentelemetry-collector-url] - last tested with version **0.6.0**.
+This module provides exporter for web and node to be used with [opentelemetry-collector][opentelemetry-collector-url] - last tested with version **0.16.0**.
## Installation
@@ -24,7 +24,7 @@ const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-g
const collectorOptions = {
serviceName: 'basic-service',
- url: '' // url is optional and can be omitted - default is localhost:55680
+ url: '' // url is optional and can be omitted - default is localhost:4317
};
const provider = new BasicTracerProvider();
@@ -45,7 +45,7 @@ const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-g
const collectorOptions = {
serviceName: 'basic-service',
- url: '', // url is optional and can be omitted - default is localhost:55680
+ url: '', // url is optional and can be omitted - default is localhost:4317
credentials: grpc.credentials.createSsl(
fs.readFileSync('./ca.crt'),
fs.readFileSync('./client.key'),
@@ -74,7 +74,7 @@ metadata.set('k', 'v');
const collectorOptions = {
serviceName: 'basic-service',
- url: '', // url is optional and can be omitted - default is localhost:55680
+ url: '', // url is optional and can be omitted - default is localhost:4317
metadata, // // an optional grpc.Metadata object to be sent with each request
};
diff --git a/packages/opentelemetry-exporter-collector-grpc/package.json b/packages/opentelemetry-exporter-collector-grpc/package.json
index af5ed9a3dd..a0f40a4c49 100644
--- a/packages/opentelemetry-exporter-collector-grpc/package.json
+++ b/packages/opentelemetry-exporter-collector-grpc/package.json
@@ -1,23 +1,21 @@
{
"name": "@opentelemetry/exporter-collector-grpc",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
- "clean": "rimraf build/*",
- "compile": "npm run version:update && tsc -p .",
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"postcompile": "npm run submodule && npm run protos:copy",
- "precompile": "tsc --version",
- "prepare": "npm run compile",
"protos:copy": "cpx protos/opentelemetry/**/*.* build/protos/opentelemetry",
"submodule": "git submodule sync --recursive && git submodule update --init --recursive",
"tdd": "npm run test -- --watch-extensions ts --watch",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
- "version:update": "node ../../scripts/version-update.js",
+ "version": "node ../../scripts/version-update.js",
"watch": "npm run protos:copy && tsc -w"
},
"keywords": [
@@ -65,12 +63,12 @@
},
"dependencies": {
"@grpc/proto-loader": "^0.5.4",
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/exporter-collector": "^0.13.0",
- "@opentelemetry/metrics": "^0.13.0",
- "@opentelemetry/resources": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/exporter-collector": "^0.14.0",
+ "@opentelemetry/metrics": "^0.14.0",
+ "@opentelemetry/resources": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"grpc": "^1.24.2"
}
}
diff --git a/packages/opentelemetry-exporter-collector-grpc/protos b/packages/opentelemetry-exporter-collector-grpc/protos
index 313a868be2..59c488bfb8 160000
--- a/packages/opentelemetry-exporter-collector-grpc/protos
+++ b/packages/opentelemetry-exporter-collector-grpc/protos
@@ -1 +1 @@
-Subproject commit 313a868be259dce6c6516dd417d3ad5fd3321acf
+Subproject commit 59c488bfb8fb6d0458ad6425758b70259ff4a2bd
diff --git a/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts b/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts
index 33fd740f10..9e2417805e 100644
--- a/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts
+++ b/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts
@@ -23,7 +23,7 @@ import { CollectorExporterConfigNode, ServiceClientType } from './types';
import { CollectorExporterNodeBase } from './CollectorExporterNodeBase';
const DEFAULT_SERVICE_NAME = 'collector-metric-exporter';
-const DEFAULT_COLLECTOR_URL = 'localhost:55680';
+const DEFAULT_COLLECTOR_URL = 'localhost:4317';
/**
* Collector Metric Exporter for Node
diff --git a/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts b/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts
index 2b607aaba6..da36d28c80 100644
--- a/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts
+++ b/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts
@@ -23,7 +23,7 @@ import {
import { CollectorExporterConfigNode, ServiceClientType } from './types';
const DEFAULT_SERVICE_NAME = 'collector-trace-exporter';
-const DEFAULT_COLLECTOR_URL = 'localhost:55680';
+const DEFAULT_COLLECTOR_URL = 'localhost:4317';
/**
* Collector Trace Exporter for Node
diff --git a/packages/opentelemetry-exporter-collector-grpc/src/version.ts b/packages/opentelemetry-exporter-collector-grpc/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-exporter-collector-grpc/src/version.ts
+++ b/packages/opentelemetry-exporter-collector-grpc/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-exporter-collector-grpc/test/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-collector-grpc/test/CollectorMetricExporter.test.ts
index 8a80a336ac..ca2e8767a7 100644
--- a/packages/opentelemetry-exporter-collector-grpc/test/CollectorMetricExporter.test.ts
+++ b/packages/opentelemetry-exporter-collector-grpc/test/CollectorMetricExporter.test.ts
@@ -229,7 +229,7 @@ describe('CollectorMetricExporter - node (getDefaultUrl)', () => {
it('should default to localhost', done => {
const collectorExporter = new CollectorMetricExporter({});
setTimeout(() => {
- assert.strictEqual(collectorExporter['url'], 'localhost:55680');
+ assert.strictEqual(collectorExporter['url'], 'localhost:4317');
done();
});
});
diff --git a/packages/opentelemetry-exporter-collector-grpc/test/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-collector-grpc/test/CollectorTraceExporter.test.ts
index e27623d6c7..365eb91e3e 100644
--- a/packages/opentelemetry-exporter-collector-grpc/test/CollectorTraceExporter.test.ts
+++ b/packages/opentelemetry-exporter-collector-grpc/test/CollectorTraceExporter.test.ts
@@ -194,7 +194,7 @@ describe('CollectorTraceExporter - node (getDefaultUrl)', () => {
it('should default to localhost', done => {
const collectorExporter = new CollectorTraceExporter({});
setTimeout(() => {
- assert.strictEqual(collectorExporter['url'], 'localhost:55680');
+ assert.strictEqual(collectorExporter['url'], 'localhost:4317');
done();
});
});
diff --git a/packages/opentelemetry-exporter-collector-grpc/test/helper.ts b/packages/opentelemetry-exporter-collector-grpc/test/helper.ts
index a45eecff16..a425e5de93 100644
--- a/packages/opentelemetry-exporter-collector-grpc/test/helper.ts
+++ b/packages/opentelemetry-exporter-collector-grpc/test/helper.ts
@@ -308,7 +308,11 @@ export function ensureExportedSpanIsCorrect(
assert.strictEqual(span.droppedLinksCount, 0, 'droppedLinksCount is wrong');
assert.deepStrictEqual(
span.status,
- { code: 'STATUS_CODE_OK', message: '' },
+ {
+ code: 'STATUS_CODE_OK',
+ deprecatedCode: 'DEPRECATED_STATUS_CODE_OK',
+ message: '',
+ },
'status is wrong'
);
}
diff --git a/packages/opentelemetry-exporter-collector-grpc/tsconfig.json b/packages/opentelemetry-exporter-collector-grpc/tsconfig.json
index a2042cd68b..bfdc997b94 100644
--- a/packages/opentelemetry-exporter-collector-grpc/tsconfig.json
+++ b/packages/opentelemetry-exporter-collector-grpc/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,25 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-exporter-collector"
+ },
+ {
+ "path": "../opentelemetry-metrics"
+ },
+ {
+ "path": "../opentelemetry-resources"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ }
]
}
diff --git a/packages/opentelemetry-exporter-collector-proto/README.md b/packages/opentelemetry-exporter-collector-proto/README.md
index 64c10d1db3..054b37ba07 100644
--- a/packages/opentelemetry-exporter-collector-proto/README.md
+++ b/packages/opentelemetry-exporter-collector-proto/README.md
@@ -6,7 +6,7 @@
[![devDependencies][devDependencies-image]][devDependencies-url]
[![Apache License][license-image]][license-image]
-This module provides exporter for node to be used with [opentelemetry-collector][opentelemetry-collector-url] - last tested with version **0.6.0**.
+This module provides exporter for node to be used with [opentelemetry-collector][opentelemetry-collector-url] - last tested with version **0.16.0**.
## Installation
diff --git a/packages/opentelemetry-exporter-collector-proto/package.json b/packages/opentelemetry-exporter-collector-proto/package.json
index 0e0ad3783a..ccd3d88868 100644
--- a/packages/opentelemetry-exporter-collector-proto/package.json
+++ b/packages/opentelemetry-exporter-collector-proto/package.json
@@ -1,23 +1,21 @@
{
"name": "@opentelemetry/exporter-collector-proto",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
- "clean": "rimraf build/*",
- "compile": "npm run version:update && tsc -p .",
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"postcompile": "npm run submodule && npm run protos:copy",
- "precompile": "tsc --version",
- "prepare": "npm run compile",
"protos:copy": "cpx protos/opentelemetry/**/*.* build/protos/opentelemetry",
"submodule": "git submodule sync --recursive && git submodule update --init --recursive",
"tdd": "npm run test -- --watch-extensions ts --watch",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
- "version:update": "node ../../scripts/version-update.js",
+ "version": "node ../../scripts/version-update.js",
"watch": "npm run protos:copy && tsc -w"
},
"keywords": [
@@ -65,12 +63,12 @@
},
"dependencies": {
"@grpc/proto-loader": "^0.5.4",
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/exporter-collector": "^0.13.0",
- "@opentelemetry/metrics": "^0.13.0",
- "@opentelemetry/resources": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/exporter-collector": "^0.14.0",
+ "@opentelemetry/metrics": "^0.14.0",
+ "@opentelemetry/resources": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"protobufjs": "^6.9.0"
}
}
diff --git a/packages/opentelemetry-exporter-collector-proto/protos b/packages/opentelemetry-exporter-collector-proto/protos
index 313a868be2..59c488bfb8 160000
--- a/packages/opentelemetry-exporter-collector-proto/protos
+++ b/packages/opentelemetry-exporter-collector-proto/protos
@@ -1 +1 @@
-Subproject commit 313a868be259dce6c6516dd417d3ad5fd3321acf
+Subproject commit 59c488bfb8fb6d0458ad6425758b70259ff4a2bd
diff --git a/packages/opentelemetry-exporter-collector-proto/src/version.ts b/packages/opentelemetry-exporter-collector-proto/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-exporter-collector-proto/src/version.ts
+++ b/packages/opentelemetry-exporter-collector-proto/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-exporter-collector-proto/test/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-collector-proto/test/CollectorMetricExporter.test.ts
index 572947bd12..2547dfeac1 100644
--- a/packages/opentelemetry-exporter-collector-proto/test/CollectorMetricExporter.test.ts
+++ b/packages/opentelemetry-exporter-collector-proto/test/CollectorMetricExporter.test.ts
@@ -20,7 +20,6 @@ import {
} from '@opentelemetry/exporter-collector';
import * as api from '@opentelemetry/api';
import * as metrics from '@opentelemetry/metrics';
-import * as core from '@opentelemetry/core';
import * as http from 'http';
import * as assert from 'assert';
import * as sinon from 'sinon';
@@ -64,7 +63,7 @@ describe('CollectorMetricExporter - node with proto over http', () => {
foo: 'bar',
},
hostname: 'foo',
- logger: new core.NoopLogger(),
+ logger: new api.NoopLogger(),
serviceName: 'bar',
attributes: {},
url: 'http://foo.bar.com',
diff --git a/packages/opentelemetry-exporter-collector-proto/test/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-collector-proto/test/CollectorTraceExporter.test.ts
index 6120493c93..e6f8367aa1 100644
--- a/packages/opentelemetry-exporter-collector-proto/test/CollectorTraceExporter.test.ts
+++ b/packages/opentelemetry-exporter-collector-proto/test/CollectorTraceExporter.test.ts
@@ -19,7 +19,7 @@ import {
CollectorExporterNodeConfigBase,
} from '@opentelemetry/exporter-collector';
-import * as core from '@opentelemetry/core';
+import { NoopLogger } from '@opentelemetry/api';
import { ReadableSpan } from '@opentelemetry/tracing';
import * as http from 'http';
import * as assert from 'assert';
@@ -59,7 +59,7 @@ describe('CollectorTraceExporter - node with proto over http', () => {
foo: 'bar',
},
hostname: 'foo',
- logger: new core.NoopLogger(),
+ logger: new NoopLogger(),
serviceName: 'bar',
attributes: {},
url: 'http://foo.bar.com',
diff --git a/packages/opentelemetry-exporter-collector-proto/tsconfig.json b/packages/opentelemetry-exporter-collector-proto/tsconfig.json
index a2042cd68b..bfdc997b94 100644
--- a/packages/opentelemetry-exporter-collector-proto/tsconfig.json
+++ b/packages/opentelemetry-exporter-collector-proto/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,25 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-exporter-collector"
+ },
+ {
+ "path": "../opentelemetry-metrics"
+ },
+ {
+ "path": "../opentelemetry-resources"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ }
]
}
diff --git a/packages/opentelemetry-exporter-collector/README.md b/packages/opentelemetry-exporter-collector/README.md
index 473f7b6261..1d0cf969d9 100644
--- a/packages/opentelemetry-exporter-collector/README.md
+++ b/packages/opentelemetry-exporter-collector/README.md
@@ -6,7 +6,7 @@
[![devDependencies][devDependencies-image]][devDependencies-url]
[![Apache License][license-image]][license-image]
-This module provides exporter for web and node to be used with [opentelemetry-collector][opentelemetry-collector-url] - last tested with version **0.12.0**.
+This module provides exporter for web and node to be used with [opentelemetry-collector][opentelemetry-collector-url] - last tested with version **0.16.0**.
## Installation
diff --git a/packages/opentelemetry-exporter-collector/package.json b/packages/opentelemetry-exporter-collector/package.json
index 1a78b7e36c..7e729c1690 100644
--- a/packages/opentelemetry-exporter-collector/package.json
+++ b/packages/opentelemetry-exporter-collector/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/exporter-collector",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
@@ -10,19 +10,17 @@
"./build/src/platform/index.js": "./build/src/platform/browser/index.js"
},
"scripts": {
- "clean": "rimraf build/*",
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "compile": "npm run version:update && tsc -p .",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "precompile": "tsc --version",
- "prepare": "npm run compile",
"tdd": "npm run test -- --watch-extensions ts --watch",
"tdd:browser": "karma start",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'",
"test:browser": "nyc karma start --single-run",
- "version:update": "node ../../scripts/version-update.js",
- "watch": "tsc -w"
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -79,11 +77,11 @@
"webpack-merge": "5.6.1"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/metrics": "^0.13.0",
- "@opentelemetry/resources": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/metrics": "^0.14.0",
+ "@opentelemetry/resources": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"axios": "^0.21.0"
}
}
diff --git a/packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts b/packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts
index cb4d535d94..fc75a2a806 100644
--- a/packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts
+++ b/packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts
@@ -14,12 +14,8 @@
* limitations under the License.
*/
-import { Attributes, Logger } from '@opentelemetry/api';
-import {
- ExportResult,
- ExportResultCode,
- NoopLogger,
-} from '@opentelemetry/core';
+import { Attributes, Logger, NoopLogger } from '@opentelemetry/api';
+import { ExportResult, ExportResultCode } from '@opentelemetry/core';
import {
CollectorExporterError,
CollectorExporterConfigBase,
diff --git a/packages/opentelemetry-exporter-collector/src/transform.ts b/packages/opentelemetry-exporter-collector/src/transform.ts
index ed0d4cdcfa..090ad496be 100644
--- a/packages/opentelemetry-exporter-collector/src/transform.ts
+++ b/packages/opentelemetry-exporter-collector/src/transform.ts
@@ -18,6 +18,8 @@ import {
Attributes,
Link,
SpanKind,
+ Status,
+ StatusCode,
TimedEvent,
TraceState,
} from '@opentelemetry/api';
@@ -184,12 +186,45 @@ export function toCollectorSpan(
droppedAttributesCount: 0,
events: toCollectorEvents(span.events),
droppedEventsCount: 0,
- status: span.status,
+ status: toCollectorStatus(span.status),
links: toCollectorLinks(span, useHex),
droppedLinksCount: 0,
};
}
+/**
+ * Converts StatusCode
+ * @param code
+ */
+export function toCollectorCode(
+ code: StatusCode
+): opentelemetryProto.trace.v1.StatusCode {
+ switch (code) {
+ case StatusCode.OK:
+ return opentelemetryProto.trace.v1.StatusCode.OK;
+ case StatusCode.UNSET:
+ return opentelemetryProto.trace.v1.StatusCode.UNSET;
+ default:
+ return opentelemetryProto.trace.v1.StatusCode.ERROR;
+ }
+}
+
+/**
+ * Converts status
+ * @param status
+ */
+export function toCollectorStatus(
+ status: Status
+): opentelemetryProto.trace.v1.Status {
+ const spanStatus: opentelemetryProto.trace.v1.Status = {
+ code: toCollectorCode(status.code),
+ };
+ if (typeof status.message !== 'undefined') {
+ spanStatus.message = status.message;
+ }
+ return spanStatus;
+}
+
/**
* Converts resource
* @param resource
diff --git a/packages/opentelemetry-exporter-collector/src/types.ts b/packages/opentelemetry-exporter-collector/src/types.ts
index ab6423b8f9..2c82aa8813 100644
--- a/packages/opentelemetry-exporter-collector/src/types.ts
+++ b/packages/opentelemetry-exporter-collector/src/types.ts
@@ -15,7 +15,6 @@
*/
import { SpanKind, Logger, Attributes } from '@opentelemetry/api';
-import * as api from '@opentelemetry/api';
/* eslint-disable @typescript-eslint/no-namespace */
export namespace opentelemetryProto {
@@ -254,7 +253,32 @@ export namespace opentelemetryProto {
status?: Status;
}
- export type Status = api.Status;
+ export interface Status {
+ /** The status code of this message. */
+ code: StatusCode;
+ /** A developer-facing error message. */
+ message?: string;
+ }
+
+ /**
+ * An enumeration of status codes.
+ * https://github.com/open-telemetry/opentelemetry-proto/blob/master/opentelemetry/proto/trace/v1/trace.proto#L304
+ */
+ export enum StatusCode {
+ /**
+ * The default status.
+ */
+ UNSET = 0,
+ /**
+ * The operation has been validated by an Application developer or
+ * Operator to have completed successfully.
+ */
+ OK = 1,
+ /**
+ * The operation contains an error.
+ */
+ ERROR = 2,
+ }
export interface TraceConfig {
constantSampler?: ConstantSampler | null;
diff --git a/packages/opentelemetry-exporter-collector/src/util.ts b/packages/opentelemetry-exporter-collector/src/util.ts
index 1cb1b18aae..739698f0e0 100644
--- a/packages/opentelemetry-exporter-collector/src/util.ts
+++ b/packages/opentelemetry-exporter-collector/src/util.ts
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-import { Logger } from '@opentelemetry/api';
-import { NoopLogger } from '@opentelemetry/core';
+import { Logger, NoopLogger } from '@opentelemetry/api';
/**
* Parses headers from config leaving only those that have defined values
diff --git a/packages/opentelemetry-exporter-collector/src/version.ts b/packages/opentelemetry-exporter-collector/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-exporter-collector/src/version.ts
+++ b/packages/opentelemetry-exporter-collector/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-exporter-collector/test/browser/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-collector/test/browser/CollectorMetricExporter.test.ts
index 934dc72c15..9a8d39491d 100644
--- a/packages/opentelemetry-exporter-collector/test/browser/CollectorMetricExporter.test.ts
+++ b/packages/opentelemetry-exporter-collector/test/browser/CollectorMetricExporter.test.ts
@@ -15,7 +15,7 @@
*/
import * as api from '@opentelemetry/api';
-import { ExportResultCode, NoopLogger } from '@opentelemetry/core';
+import { ExportResultCode } from '@opentelemetry/core';
import * as assert from 'assert';
import * as sinon from 'sinon';
import { CollectorMetricExporter } from '../../src/platform/browser/index';
@@ -85,7 +85,7 @@ describe('CollectorMetricExporter - web', () => {
describe('when "sendBeacon" is available', () => {
beforeEach(() => {
collectorExporter = new CollectorMetricExporter({
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
url: 'http://foo.bar.com',
serviceName: 'bar',
});
@@ -196,7 +196,7 @@ describe('CollectorMetricExporter - web', () => {
beforeEach(() => {
(window.navigator as any).sendBeacon = false;
collectorExporter = new CollectorMetricExporter({
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
url: 'http://foo.bar.com',
serviceName: 'bar',
});
@@ -330,7 +330,7 @@ describe('CollectorMetricExporter - web', () => {
beforeEach(() => {
collectorExporterConfig = {
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
headers: customHeaders,
};
server = sinon.fakeServer.create();
diff --git a/packages/opentelemetry-exporter-collector/test/browser/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-collector/test/browser/CollectorTraceExporter.test.ts
index 776a01c04b..968b3ae8f5 100644
--- a/packages/opentelemetry-exporter-collector/test/browser/CollectorTraceExporter.test.ts
+++ b/packages/opentelemetry-exporter-collector/test/browser/CollectorTraceExporter.test.ts
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-import { NoopLogger, ExportResultCode } from '@opentelemetry/core';
+import { NoopLogger } from '@opentelemetry/api';
+import { ExportResultCode } from '@opentelemetry/core';
import { ReadableSpan } from '@opentelemetry/tracing';
import * as assert from 'assert';
import * as sinon from 'sinon';
diff --git a/packages/opentelemetry-exporter-collector/test/common/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-collector/test/common/CollectorMetricExporter.test.ts
index 82b8186ba6..fb1b7bb446 100644
--- a/packages/opentelemetry-exporter-collector/test/common/CollectorMetricExporter.test.ts
+++ b/packages/opentelemetry-exporter-collector/test/common/CollectorMetricExporter.test.ts
@@ -15,7 +15,7 @@
*/
import * as api from '@opentelemetry/api';
-import { ExportResultCode, NoopLogger } from '@opentelemetry/core';
+import { ExportResultCode } from '@opentelemetry/core';
import * as assert from 'assert';
import * as sinon from 'sinon';
import { CollectorExporterBase } from '../../src/CollectorExporterBase';
@@ -62,7 +62,7 @@ describe('CollectorMetricExporter - common', () => {
onInitSpy = sinon.stub(CollectorMetricExporter.prototype, 'onInit');
collectorExporterConfig = {
hostname: 'foo',
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
serviceName: 'bar',
attributes: {},
url: 'http://foo.bar.com',
@@ -126,7 +126,7 @@ describe('CollectorMetricExporter - common', () => {
});
it('should set default logger', () => {
- assert.ok(collectorExporter.logger instanceof NoopLogger);
+ assert.ok(collectorExporter.logger instanceof api.NoopLogger);
});
});
});
@@ -212,7 +212,7 @@ describe('CollectorMetricExporter - common', () => {
);
collectorExporterConfig = {
hostname: 'foo',
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
serviceName: 'bar',
attributes: {},
url: 'http://foo.bar.com',
diff --git a/packages/opentelemetry-exporter-collector/test/common/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-collector/test/common/CollectorTraceExporter.test.ts
index fa08f1b185..7dc89886ac 100644
--- a/packages/opentelemetry-exporter-collector/test/common/CollectorTraceExporter.test.ts
+++ b/packages/opentelemetry-exporter-collector/test/common/CollectorTraceExporter.test.ts
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-import { ExportResultCode, NoopLogger } from '@opentelemetry/core';
+import { NoopLogger } from '@opentelemetry/api';
+import { ExportResultCode } from '@opentelemetry/core';
import { ReadableSpan } from '@opentelemetry/tracing';
import * as assert from 'assert';
import * as sinon from 'sinon';
diff --git a/packages/opentelemetry-exporter-collector/test/common/utils.test.ts b/packages/opentelemetry-exporter-collector/test/common/utils.test.ts
index b5fb8d3507..3f31225de1 100644
--- a/packages/opentelemetry-exporter-collector/test/common/utils.test.ts
+++ b/packages/opentelemetry-exporter-collector/test/common/utils.test.ts
@@ -16,7 +16,7 @@
import * as assert from 'assert';
import * as sinon from 'sinon';
-import { NoopLogger } from '@opentelemetry/core';
+import { NoopLogger } from '@opentelemetry/api';
import { parseHeaders } from '../../src/util';
describe('utils', () => {
diff --git a/packages/opentelemetry-exporter-collector/test/helper.ts b/packages/opentelemetry-exporter-collector/test/helper.ts
index b451bd1443..1d45c2dfaf 100644
--- a/packages/opentelemetry-exporter-collector/test/helper.ts
+++ b/packages/opentelemetry-exporter-collector/test/helper.ts
@@ -507,7 +507,7 @@ export function ensureSpanIsCorrect(
assert.strictEqual(span.droppedLinksCount, 0, 'droppedLinksCount is wrong');
assert.deepStrictEqual(
span.status,
- { code: api.StatusCode.OK },
+ { code: opentelemetryProto.trace.v1.StatusCode.OK },
'status is wrong'
);
}
diff --git a/packages/opentelemetry-exporter-collector/test/node/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-collector/test/node/CollectorMetricExporter.test.ts
index 1d65447481..42c2297682 100644
--- a/packages/opentelemetry-exporter-collector/test/node/CollectorMetricExporter.test.ts
+++ b/packages/opentelemetry-exporter-collector/test/node/CollectorMetricExporter.test.ts
@@ -81,7 +81,7 @@ describe('CollectorMetricExporter - node with json over http', () => {
foo: 'bar',
},
hostname: 'foo',
- logger: new core.NoopLogger(),
+ logger: new api.NoopLogger(),
serviceName: 'bar',
attributes: {},
url: 'http://foo.bar.com',
diff --git a/packages/opentelemetry-exporter-collector/test/node/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-collector/test/node/CollectorTraceExporter.test.ts
index e9c2de8fb5..69a7b1fe57 100644
--- a/packages/opentelemetry-exporter-collector/test/node/CollectorTraceExporter.test.ts
+++ b/packages/opentelemetry-exporter-collector/test/node/CollectorTraceExporter.test.ts
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import { NoopLogger } from '@opentelemetry/api';
import * as core from '@opentelemetry/core';
import { ReadableSpan } from '@opentelemetry/tracing';
import * as http from 'http';
@@ -71,7 +72,7 @@ describe('CollectorTraceExporter - node with json over http', () => {
foo: 'bar',
},
hostname: 'foo',
- logger: new core.NoopLogger(),
+ logger: new NoopLogger(),
serviceName: 'bar',
attributes: {},
url: 'http://foo.bar.com',
diff --git a/packages/opentelemetry-exporter-collector/tsconfig.json b/packages/opentelemetry-exporter-collector/tsconfig.json
index a2042cd68b..4410230d44 100644
--- a/packages/opentelemetry-exporter-collector/tsconfig.json
+++ b/packages/opentelemetry-exporter-collector/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,22 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-metrics"
+ },
+ {
+ "path": "../opentelemetry-resources"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ }
]
}
diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json
index 06ba6e1eeb..a92a8249bf 100644
--- a/packages/opentelemetry-exporter-jaeger/package.json
+++ b/packages/opentelemetry-exporter-jaeger/package.json
@@ -1,22 +1,20 @@
{
"name": "@opentelemetry/exporter-jaeger",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry Exporter Jaeger allows user to send collected traces to Jaeger",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "clean": "rimraf build/*",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
- "watch": "tsc -w"
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -42,7 +40,7 @@
"access": "public"
},
"devDependencies": {
- "@opentelemetry/resources": "^0.13.0",
+ "@opentelemetry/resources": "^0.14.0",
"@types/mocha": "8.2.0",
"@types/node": "14.14.12",
"@types/sinon": "9.0.9",
@@ -58,9 +56,9 @@
"typescript": "3.9.7"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"jaeger-client": "^3.15.0"
}
}
diff --git a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts
index f9bac2207a..8ae8890b63 100644
--- a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts
+++ b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts
@@ -15,11 +15,7 @@
*/
import * as api from '@opentelemetry/api';
-import {
- ExportResult,
- ExportResultCode,
- NoopLogger,
-} from '@opentelemetry/core';
+import { ExportResult, ExportResultCode } from '@opentelemetry/core';
import { ReadableSpan, SpanExporter } from '@opentelemetry/tracing';
import { Socket } from 'dgram';
import { spanToThrift } from './transform';
@@ -39,7 +35,7 @@ export class JaegerExporter implements SpanExporter {
constructor(config: jaegerTypes.ExporterConfig) {
const localConfig = Object.assign({}, config);
- this._logger = localConfig.logger || new NoopLogger();
+ this._logger = localConfig.logger || new api.NoopLogger();
const tags: jaegerTypes.Tag[] = localConfig.tags || [];
this._onShutdownFlushTimeout =
typeof localConfig.flushTimeout === 'number'
diff --git a/packages/opentelemetry-exporter-jaeger/src/transform.ts b/packages/opentelemetry-exporter-jaeger/src/transform.ts
index 457e5fe7cf..ea102bcf40 100644
--- a/packages/opentelemetry-exporter-jaeger/src/transform.ts
+++ b/packages/opentelemetry-exporter-jaeger/src/transform.ts
@@ -55,9 +55,9 @@ export function spanToThrift(span: ReadableSpan): ThriftSpan {
if (span.status.message) {
tags.push({ key: 'status.message', value: span.status.message });
}
- // Ensure that if Status.Code is not OK, that we set the "error" tag on the
+ // Ensure that if Status.Code is ERROR, that we set the "error" tag on the
// Jaeger span.
- if (span.status.code !== StatusCode.OK) {
+ if (span.status.code === StatusCode.ERROR) {
tags.push({ key: 'error', value: true });
}
diff --git a/packages/opentelemetry-exporter-jaeger/src/version.ts b/packages/opentelemetry-exporter-jaeger/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-exporter-jaeger/src/version.ts
+++ b/packages/opentelemetry-exporter-jaeger/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts
index 35311875bb..122759e018 100644
--- a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts
+++ b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts
@@ -16,11 +16,7 @@
import * as assert from 'assert';
import { JaegerExporter } from '../src';
-import {
- ExportResult,
- ExportResultCode,
- NoopLogger,
-} from '@opentelemetry/core';
+import { ExportResult, ExportResultCode } from '@opentelemetry/core';
import * as api from '@opentelemetry/api';
import { ThriftProcess } from '../src/types';
import { ReadableSpan } from '@opentelemetry/tracing';
@@ -48,7 +44,7 @@ describe('JaegerExporter', () => {
serviceName: 'opentelemetry',
host: 'remotehost',
port: 8080,
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
tags: [{ key: 'opentelemetry-exporter-jaeger', value: '0.1.0' }],
});
assert.ok(typeof exporter.export === 'function');
diff --git a/packages/opentelemetry-exporter-jaeger/test/transform.test.ts b/packages/opentelemetry-exporter-jaeger/test/transform.test.ts
index df3b65785b..4bfcc9e981 100644
--- a/packages/opentelemetry-exporter-jaeger/test/transform.test.ts
+++ b/packages/opentelemetry-exporter-jaeger/test/transform.test.ts
@@ -21,7 +21,7 @@ import { Resource } from '@opentelemetry/resources';
import * as api from '@opentelemetry/api';
import { ThriftUtils, Utils, ThriftReferenceType } from '../src/types';
import { hrTimeToMicroseconds } from '@opentelemetry/core';
-import { TraceFlags } from '@opentelemetry/api';
+import { StatusCode, TraceFlags } from '@opentelemetry/api';
describe('transform', () => {
const spanContext = {
@@ -302,5 +302,79 @@ describe('transform', () => {
'0000000000000000'
);
});
+ it('should set error flag only if span.status.code is ERROR', () => {
+ const readableSpan: ReadableSpan = {
+ name: 'my-span',
+ kind: api.SpanKind.INTERNAL,
+ spanContext,
+ startTime: [1566156729, 709],
+ endTime: [1566156731, 709],
+ ended: true,
+ status: {
+ code: api.StatusCode.OK,
+ },
+ attributes: {
+ testBool: true,
+ testString: 'test',
+ testNum: 3.142,
+ },
+ links: [
+ {
+ context: {
+ traceId: 'a4cda95b652f4a1592b449d5929fda1b',
+ spanId: '3e0c63257de34c92',
+ },
+ attributes: {
+ testBool: true,
+ testString: 'test',
+ testNum: 3.142,
+ },
+ },
+ ],
+ events: [
+ {
+ name: 'something happened',
+ attributes: {
+ error: true,
+ },
+ time: [1566156729, 809],
+ },
+ ],
+ duration: [32, 800000000],
+ resource: new Resource({
+ service: 'ui',
+ version: 1,
+ cost: 112.12,
+ }),
+ instrumentationLibrary: {
+ name: 'default',
+ version: '0.0.1',
+ },
+ };
+ let thriftSpan = spanToThrift(readableSpan);
+ assert.strictEqual(
+ thriftSpan.tags.find(tag => tag.key === 'error'),
+ undefined,
+ 'If span status OK, no error tag'
+ );
+
+ readableSpan.status.code = StatusCode.UNSET;
+ thriftSpan = spanToThrift(readableSpan);
+ assert.strictEqual(
+ thriftSpan.tags.find(tag => tag.key === 'error'),
+ undefined,
+ 'If span status USET, no error tag'
+ );
+
+ readableSpan.status.code = StatusCode.ERROR;
+ thriftSpan = spanToThrift(readableSpan);
+ const errorTag = thriftSpan.tags.find(tag => tag.key === 'error');
+
+ assert.strictEqual(
+ errorTag?.vBool,
+ true,
+ 'If span status ERROR, error tag must be true'
+ );
+ });
});
});
diff --git a/packages/opentelemetry-exporter-jaeger/tsconfig.json b/packages/opentelemetry-exporter-jaeger/tsconfig.json
index a2042cd68b..2496415881 100644
--- a/packages/opentelemetry-exporter-jaeger/tsconfig.json
+++ b/packages/opentelemetry-exporter-jaeger/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,19 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-resources"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ }
]
}
diff --git a/packages/opentelemetry-exporter-prometheus/package.json b/packages/opentelemetry-exporter-prometheus/package.json
index 51e9ce17fd..8047b2dfea 100644
--- a/packages/opentelemetry-exporter-prometheus/package.json
+++ b/packages/opentelemetry-exporter-prometheus/package.json
@@ -1,22 +1,20 @@
{
"name": "@opentelemetry/exporter-prometheus",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry Exporter Prometheus provides a metrics endpoint for Prometheus",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "clean": "rimraf build/*",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
- "watch": "tsc -w"
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -53,8 +51,8 @@
"typescript": "3.9.7"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/metrics": "^0.13.0"
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/metrics": "^0.14.0"
}
}
diff --git a/packages/opentelemetry-exporter-prometheus/src/PrometheusExporter.ts b/packages/opentelemetry-exporter-prometheus/src/PrometheusExporter.ts
index 9bc14117e6..d47745980c 100644
--- a/packages/opentelemetry-exporter-prometheus/src/PrometheusExporter.ts
+++ b/packages/opentelemetry-exporter-prometheus/src/PrometheusExporter.ts
@@ -17,7 +17,6 @@
import * as api from '@opentelemetry/api';
import {
ExportResult,
- NoopLogger,
globalErrorHandler,
ExportResultCode,
} from '@opentelemetry/core';
@@ -55,7 +54,7 @@ export class PrometheusExporter implements MetricExporter {
* @param callback Callback to be called after a server was started
*/
constructor(config: ExporterConfig = {}, callback?: () => void) {
- this._logger = config.logger || new NoopLogger();
+ this._logger = config.logger || new api.NoopLogger();
this._port = config.port || PrometheusExporter.DEFAULT_OPTIONS.port;
this._prefix = config.prefix || PrometheusExporter.DEFAULT_OPTIONS.prefix;
this._appendTimestamp =
diff --git a/packages/opentelemetry-exporter-prometheus/src/version.ts b/packages/opentelemetry-exporter-prometheus/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-exporter-prometheus/src/version.ts
+++ b/packages/opentelemetry-exporter-prometheus/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-exporter-prometheus/tsconfig.json b/packages/opentelemetry-exporter-prometheus/tsconfig.json
index a2042cd68b..42b254c549 100644
--- a/packages/opentelemetry-exporter-prometheus/tsconfig.json
+++ b/packages/opentelemetry-exporter-prometheus/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,16 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-metrics"
+ }
]
}
diff --git a/packages/opentelemetry-exporter-zipkin/package.json b/packages/opentelemetry-exporter-zipkin/package.json
index f63db3a27a..1b1f16cb76 100644
--- a/packages/opentelemetry-exporter-zipkin/package.json
+++ b/packages/opentelemetry-exporter-zipkin/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/exporter-zipkin",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry Zipkin Exporter allows the user to send collected traces to Zipkin.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
@@ -10,19 +10,17 @@
"./build/src/platform/index.js": "./build/src/platform/browser/index.js"
},
"scripts": {
- "clean": "rimraf build/*",
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "compile": "npm run version:update && tsc -p .",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "precompile": "tsc --version",
- "prepare": "npm run compile",
"tdd": "npm run test -- --watch-extensions ts --watch",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'",
"test:browser": "nyc karma start --single-run",
- "version:update": "node ../../scripts/version-update.js",
- "watch": "tsc -w"
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -77,9 +75,9 @@
"webpack-merge": "5.6.1"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/resources": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0"
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/resources": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0"
}
}
diff --git a/packages/opentelemetry-exporter-zipkin/src/version.ts b/packages/opentelemetry-exporter-zipkin/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-exporter-zipkin/src/version.ts
+++ b/packages/opentelemetry-exporter-zipkin/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-exporter-zipkin/src/zipkin.ts b/packages/opentelemetry-exporter-zipkin/src/zipkin.ts
index cceb8d7d19..93a8fe3006 100644
--- a/packages/opentelemetry-exporter-zipkin/src/zipkin.ts
+++ b/packages/opentelemetry-exporter-zipkin/src/zipkin.ts
@@ -15,11 +15,7 @@
*/
import * as api from '@opentelemetry/api';
-import {
- ExportResult,
- ExportResultCode,
- NoopLogger,
-} from '@opentelemetry/core';
+import { ExportResult, ExportResultCode } from '@opentelemetry/core';
import { SpanExporter, ReadableSpan } from '@opentelemetry/tracing';
import { prepareSend } from './platform/index';
import * as zipkinTypes from './types';
@@ -46,7 +42,7 @@ export class ZipkinExporter implements SpanExporter {
constructor(config: zipkinTypes.ExporterConfig = {}) {
const urlStr = config.url || ZipkinExporter.DEFAULT_URL;
- this._logger = config.logger || new NoopLogger();
+ this._logger = config.logger || new api.NoopLogger();
this._send = prepareSend(this._logger, urlStr, config.headers);
this._serviceName = config.serviceName;
this._statusCodeTagName = config.statusCodeTagName || statusCodeTagName;
diff --git a/packages/opentelemetry-exporter-zipkin/test/browser/zipkin.test.ts b/packages/opentelemetry-exporter-zipkin/test/browser/zipkin.test.ts
index 0ed5ca6b0c..8deac84c17 100644
--- a/packages/opentelemetry-exporter-zipkin/test/browser/zipkin.test.ts
+++ b/packages/opentelemetry-exporter-zipkin/test/browser/zipkin.test.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
+import { NoopLogger } from '@opentelemetry/api';
import {
- NoopLogger,
setGlobalErrorHandler,
loggingErrorHandler,
} from '@opentelemetry/core';
diff --git a/packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts b/packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts
index 0c6773d227..99617f4bd1 100644
--- a/packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts
+++ b/packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts
@@ -18,7 +18,6 @@ import * as api from '@opentelemetry/api';
import {
hrTimeDuration,
hrTimeToMicroseconds,
- NoopLogger,
VERSION,
} from '@opentelemetry/core';
import { Resource, TELEMETRY_SDK_RESOURCE } from '@opentelemetry/resources';
@@ -32,7 +31,7 @@ import {
_toZipkinTags,
} from '../../src/transform';
import * as zipkinTypes from '../../src/types';
-const logger = new NoopLogger();
+const logger = new api.NoopLogger();
const tracer = new BasicTracerProvider({
logger,
}).getTracer('default');
diff --git a/packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts b/packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts
index 2d22232179..aa2e357b71 100644
--- a/packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts
+++ b/packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts
@@ -19,7 +19,6 @@ import * as nock from 'nock';
import { ReadableSpan } from '@opentelemetry/tracing';
import {
ExportResult,
- NoopLogger,
hrTimeToMicroseconds,
ExportResultCode,
} from '@opentelemetry/core';
@@ -77,7 +76,7 @@ describe('Zipkin Exporter - node', () => {
it('should construct an exporter with logger', () => {
const exporter = new ZipkinExporter({
serviceName: 'my-service',
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
});
assert.ok(typeof exporter.export === 'function');
assert.ok(typeof exporter.shutdown === 'function');
@@ -112,7 +111,7 @@ describe('Zipkin Exporter - node', () => {
it('should skip send with empty array', () => {
const exporter = new ZipkinExporter({
serviceName: 'my-service',
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
});
exporter.export([], (result: ExportResult) => {
@@ -188,7 +187,7 @@ describe('Zipkin Exporter - node', () => {
const exporter = new ZipkinExporter({
serviceName: 'my-service',
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
});
exporter.export([span1, span2], (result: ExportResult) => {
@@ -244,7 +243,7 @@ describe('Zipkin Exporter - node', () => {
const exporter = new ZipkinExporter({
serviceName: 'my-service',
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
url: 'https://localhost:9411/api/v2/spans',
});
@@ -261,7 +260,7 @@ describe('Zipkin Exporter - node', () => {
const exporter = new ZipkinExporter({
serviceName: 'my-service',
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
});
exporter.export([getReadableSpan()], (result: ExportResult) => {
@@ -277,7 +276,7 @@ describe('Zipkin Exporter - node', () => {
const exporter = new ZipkinExporter({
serviceName: 'my-service',
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
});
exporter.export([getReadableSpan()], (result: ExportResult) => {
@@ -293,7 +292,7 @@ describe('Zipkin Exporter - node', () => {
const exporter = new ZipkinExporter({
serviceName: 'my-service',
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
});
exporter.export([getReadableSpan()], (result: ExportResult) => {
@@ -305,7 +304,7 @@ describe('Zipkin Exporter - node', () => {
it('should return failed result after shutdown', done => {
const exporter = new ZipkinExporter({
serviceName: 'my-service',
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
});
exporter.shutdown();
@@ -473,7 +472,7 @@ describe('Zipkin Exporter - node', () => {
const exporter = new ZipkinExporter({
serviceName: 'my-service',
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
});
exporter.export([getReadableSpan()], (result: ExportResult) => {
diff --git a/packages/opentelemetry-exporter-zipkin/tsconfig.json b/packages/opentelemetry-exporter-zipkin/tsconfig.json
index a2042cd68b..2496415881 100644
--- a/packages/opentelemetry-exporter-zipkin/tsconfig.json
+++ b/packages/opentelemetry-exporter-zipkin/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,19 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-resources"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ }
]
}
diff --git a/packages/opentelemetry-grpc-utils/package.json b/packages/opentelemetry-grpc-utils/package.json
index 96cff5421e..90950eb067 100644
--- a/packages/opentelemetry-grpc-utils/package.json
+++ b/packages/opentelemetry-grpc-utils/package.json
@@ -1,22 +1,20 @@
{
"name": "@opentelemetry/grpc-utils",
- "version": "0.13.0",
+ "version": "0.14.0",
"private": true,
"description": "OpenTelemetry grpc plugin utility functions.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
"tdd": "npm run test -- --watch-extensions ts --watch",
- "clean": "rimraf build/*",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile"
+ "version": "node ../../scripts/version-update.js"
},
"keywords": [
"opentelemetry",
@@ -44,10 +42,10 @@
"devDependencies": {
"@grpc/grpc-js": "1.2.2",
"@grpc/proto-loader": "0.5.5",
- "@opentelemetry/context-async-hooks": "^0.13.0",
- "@opentelemetry/context-base": "^0.13.0",
- "@opentelemetry/node": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/context-async-hooks": "^0.14.0",
+ "@opentelemetry/context-base": "^0.14.0",
+ "@opentelemetry/node": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"@types/mocha": "8.2.0",
"@types/node": "14.14.12",
"@types/semver": "7.3.4",
@@ -67,9 +65,9 @@
"typescript": "3.9.7"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/semantic-conventions": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/semantic-conventions": "^0.14.0",
"shimmer": "1.2.1"
}
}
diff --git a/packages/opentelemetry-grpc-utils/src/version.ts b/packages/opentelemetry-grpc-utils/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-grpc-utils/src/version.ts
+++ b/packages/opentelemetry-grpc-utils/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-grpc-utils/test/grpcUtils.test.ts b/packages/opentelemetry-grpc-utils/test/grpcUtils.test.ts
index c2f877455a..f53055e620 100644
--- a/packages/opentelemetry-grpc-utils/test/grpcUtils.test.ts
+++ b/packages/opentelemetry-grpc-utils/test/grpcUtils.test.ts
@@ -19,9 +19,11 @@ import {
NoopTracerProvider,
SpanKind,
propagation,
+ NoopLogger,
+ getSpan,
+ setSpan,
} from '@opentelemetry/api';
import {
- NoopLogger,
HttpTraceContext,
BasePlugin,
PluginConfig,
@@ -527,8 +529,8 @@ export const runTests = (
const span = provider
.getTracer('default')
.startSpan('TestSpan', { kind: SpanKind.PRODUCER });
- return provider.getTracer('default').withSpan(span, async () => {
- const rootSpan = provider.getTracer('default').getCurrentSpan();
+ return context.with(setSpan(context.active(), span), async () => {
+ const rootSpan = getSpan(context.active());
if (!rootSpan) {
return assert.ok(false);
}
@@ -623,8 +625,8 @@ export const runTests = (
const span = provider
.getTracer('default')
.startSpan('TestSpan', { kind: SpanKind.PRODUCER });
- return provider.getTracer('default').withSpan(span, async () => {
- const rootSpan = provider.getTracer('default').getCurrentSpan();
+ return context.with(setSpan(context.active(), span), async () => {
+ const rootSpan = getSpan(context.active());
if (!rootSpan) {
return assert.ok(false);
}
diff --git a/packages/opentelemetry-grpc-utils/tsconfig.json b/packages/opentelemetry-grpc-utils/tsconfig.json
index a2042cd68b..08f0364911 100644
--- a/packages/opentelemetry-grpc-utils/tsconfig.json
+++ b/packages/opentelemetry-grpc-utils/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,28 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-context-async-hooks"
+ },
+ {
+ "path": "../opentelemetry-context-base"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-node"
+ },
+ {
+ "path": "../opentelemetry-semantic-conventions"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ }
]
}
diff --git a/packages/opentelemetry-instrumentation-http/package.json b/packages/opentelemetry-instrumentation-http/package.json
index bbce109a76..7583b407b5 100644
--- a/packages/opentelemetry-instrumentation-http/package.json
+++ b/packages/opentelemetry-instrumentation-http/package.json
@@ -1,22 +1,20 @@
{
"name": "@opentelemetry/instrumentation-http",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry http/https automatic instrumentation package.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
"tdd": "npm run test -- --watch-extensions ts --watch",
- "clean": "rimraf build/*",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
- "watch": "tsc -w"
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -43,10 +41,10 @@
"access": "public"
},
"devDependencies": {
- "@opentelemetry/context-async-hooks": "^0.13.0",
- "@opentelemetry/context-base": "^0.13.0",
- "@opentelemetry/node": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/context-async-hooks": "^0.14.0",
+ "@opentelemetry/context-base": "^0.14.0",
+ "@opentelemetry/node": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"@types/got": "9.6.11",
"@types/mocha": "8.2.0",
"@types/node": "14.14.12",
@@ -71,10 +69,10 @@
"typescript": "3.9.7"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/instrumentation": "^0.13.0",
- "@opentelemetry/semantic-conventions": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/instrumentation": "^0.14.0",
+ "@opentelemetry/semantic-conventions": "^0.14.0",
"semver": "^7.1.3"
}
}
diff --git a/packages/opentelemetry-instrumentation-http/src/http.ts b/packages/opentelemetry-instrumentation-http/src/http.ts
index 57859d12f3..7e97214387 100644
--- a/packages/opentelemetry-instrumentation-http/src/http.ts
+++ b/packages/opentelemetry-instrumentation-http/src/http.ts
@@ -21,10 +21,11 @@ import {
SpanKind,
SpanOptions,
Status,
- setActiveSpan,
+ setSpan,
SpanContext,
TraceFlags,
ROOT_CONTEXT,
+ getSpan,
} from '@opentelemetry/api';
import { NoRecordingSpan } from '@opentelemetry/core';
import type * as http from 'http';
@@ -304,7 +305,7 @@ export class HttpInstrumentation extends InstrumentationBase {
this._callResponseHook(span, response);
}
- this.tracer.bind(response);
+ context.bind(response);
this._logger.debug('outgoingRequest on response()');
response.on('end', () => {
this._logger.debug('outgoingRequest on end()');
@@ -410,7 +411,7 @@ export class HttpInstrumentation extends InstrumentationBase {
spanOptions
);
- return instrumentation.tracer.withSpan(span, () => {
+ return context.with(setSpan(context.active(), span), () => {
context.bind(request);
context.bind(response);
@@ -540,7 +541,7 @@ export class HttpInstrumentation extends InstrumentationBase {
optionsParsed.headers = {};
}
propagation.inject(
- setActiveSpan(context.active(), span),
+ setSpan(context.active(), span),
optionsParsed.headers
);
@@ -559,7 +560,7 @@ export class HttpInstrumentation extends InstrumentationBase {
'%s instrumentation outgoingRequest',
component
);
- instrumentation.tracer.bind(request);
+ context.bind(request);
return instrumentation._traceClientRequest(
component,
request,
@@ -580,7 +581,7 @@ export class HttpInstrumentation extends InstrumentationBase {
: this._getConfig().requireParentforIncomingSpans;
let span: Span;
- const currentSpan = this.tracer.getCurrentSpan();
+ const currentSpan = getSpan(context.active());
if (requireParent === true && currentSpan === undefined) {
// TODO: Refactor this when a solution is found in
diff --git a/packages/opentelemetry-instrumentation-http/src/utils.ts b/packages/opentelemetry-instrumentation-http/src/utils.ts
index 32673cb6bf..402d003cc3 100644
--- a/packages/opentelemetry-instrumentation-http/src/utils.ts
+++ b/packages/opentelemetry-instrumentation-http/src/utils.ts
@@ -177,6 +177,66 @@ export const setSpanWithError = (
span.setStatus(status);
};
+/**
+ * Adds attributes for request content-length and content-encoding HTTP headers
+ * @param { IncomingMessage } Request object whose headers will be analyzed
+ * @param { Attributes } Attributes object to be modified
+ */
+export const setRequestContentLengthAttribute = (
+ request: IncomingMessage,
+ attributes: Attributes
+) => {
+ const length = getContentLength(request.headers);
+ if (length === null) return;
+
+ if (isCompressed(request.headers)) {
+ attributes[HttpAttribute.HTTP_REQUEST_CONTENT_LENGTH] = length;
+ } else {
+ attributes[HttpAttribute.HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED] = length;
+ }
+};
+
+/**
+ * Adds attributes for response content-length and content-encoding HTTP headers
+ * @param { IncomingMessage } Response object whose headers will be analyzed
+ * @param { Attributes } Attributes object to be modified
+ */
+export const setResponseContentLengthAttribute = (
+ response: IncomingMessage,
+ attributes: Attributes
+) => {
+ const length = getContentLength(response.headers);
+ if (length === null) return;
+
+ if (isCompressed(response.headers)) {
+ attributes[HttpAttribute.HTTP_RESPONSE_CONTENT_LENGTH] = length;
+ } else {
+ attributes[
+ HttpAttribute.HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED
+ ] = length;
+ }
+};
+
+function getContentLength(
+ headers: OutgoingHttpHeaders | IncomingHttpHeaders
+): number | null {
+ const contentLengthHeader = headers['content-length'];
+ if (contentLengthHeader === undefined) return null;
+
+ const contentLength = parseInt(contentLengthHeader as string, 10);
+ if (isNaN(contentLength)) return null;
+
+ return contentLength;
+}
+
+export const isCompressed = (
+ headers: OutgoingHttpHeaders | IncomingHttpHeaders
+): boolean => {
+ const encoding = headers['content-encoding'];
+
+ return !!encoding && encoding !== 'identity';
+};
+
/**
* Makes sure options is an url object
* return an object with default value and parsed options
@@ -326,6 +386,7 @@ export const getOutgoingRequestAttributesOnResponse = (
[GeneralAttribute.NET_PEER_PORT]: remotePort,
[HttpAttribute.HTTP_HOST]: `${options.hostname}:${remotePort}`,
};
+ setResponseContentLengthAttribute(response, attributes);
if (statusCode) {
attributes[HttpAttribute.HTTP_STATUS_CODE] = statusCode;
@@ -386,6 +447,7 @@ export const getIncomingRequestAttributes = (
if (userAgent !== undefined) {
attributes[HttpAttribute.HTTP_USER_AGENT] = userAgent;
}
+ setRequestContentLengthAttribute(request, attributes);
const httpKindAttributes = getAttributesFromHttpKind(httpVersion);
return Object.assign(attributes, httpKindAttributes);
diff --git a/packages/opentelemetry-instrumentation-http/src/version.ts b/packages/opentelemetry-instrumentation-http/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-instrumentation-http/src/version.ts
+++ b/packages/opentelemetry-instrumentation-http/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-instrumentation-http/test/functionals/http-disable.test.ts b/packages/opentelemetry-instrumentation-http/test/functionals/http-disable.test.ts
index 7a962a56e3..1fff7ea5a0 100644
--- a/packages/opentelemetry-instrumentation-http/test/functionals/http-disable.test.ts
+++ b/packages/opentelemetry-instrumentation-http/test/functionals/http-disable.test.ts
@@ -13,8 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import { NoopTracerProvider, NOOP_TRACER } from '@opentelemetry/api';
-import { NoopLogger } from '@opentelemetry/core';
+import {
+ NoopTracerProvider,
+ NoopLogger,
+ NOOP_TRACER,
+} from '@opentelemetry/api';
import * as assert from 'assert';
import { HttpInstrumentation } from '../../src/http';
import { AddressInfo } from 'net';
@@ -55,7 +58,6 @@ describe('HttpInstrumentation', () => {
beforeEach(() => {
NOOP_TRACER.startSpan = sinon.spy();
- NOOP_TRACER.withSpan = sinon.spy();
});
afterEach(() => {
@@ -79,11 +81,6 @@ describe('HttpInstrumentation', () => {
(NOOP_TRACER.startSpan as sinon.SinonSpy).called,
false
);
-
- assert.strictEqual(
- (NOOP_TRACER.withSpan as sinon.SinonSpy).called,
- false
- );
});
});
});
diff --git a/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts b/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts
index 1bcd42616f..4cf1c175fa 100644
--- a/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts
+++ b/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts
@@ -19,9 +19,10 @@ import {
propagation,
Span as ISpan,
SpanKind,
- getActiveSpan,
+ NoopLogger,
+ getSpan,
+ setSpan,
} from '@opentelemetry/api';
-import { NoopLogger } from '@opentelemetry/core';
import { NodeTracerProvider } from '@opentelemetry/node';
import {
InMemorySpanExporter,
@@ -321,7 +322,7 @@ describe('HttpInstrumentation', () => {
doNock(hostname, testPath, 200, 'Ok');
const name = 'TestRootSpan';
const span = provider.getTracer('default').startSpan(name);
- return provider.getTracer('default').withSpan(span, async () => {
+ return context.with(setSpan(context.active(), span), async () => {
const result = await httpRequest.get(
`${protocol}://${hostname}${testPath}`
);
@@ -364,7 +365,7 @@ describe('HttpInstrumentation', () => {
);
const name = 'TestRootSpan';
const span = provider.getTracer('default').startSpan(name);
- return provider.getTracer('default').withSpan(span, async () => {
+ return context.with(setSpan(context.active(), span), async () => {
const result = await httpRequest.get(
`${protocol}://${hostname}${testPath}`
);
@@ -403,7 +404,7 @@ describe('HttpInstrumentation', () => {
doNock(hostname, testPath, 200, 'Ok', num);
const name = 'TestRootSpan';
const span = provider.getTracer('default').startSpan(name);
- await provider.getTracer('default').withSpan(span, async () => {
+ await context.with(setSpan(context.active(), span), async () => {
for (let i = 0; i < num; i++) {
await httpRequest.get(`${protocol}://${hostname}${testPath}`);
const spans = memoryExporter.getFinishedSpans();
@@ -695,9 +696,9 @@ describe('HttpInstrumentation', () => {
});
it('should not set span as active in context for outgoing request', done => {
- assert.deepStrictEqual(getActiveSpan(context.active()), undefined);
+ assert.deepStrictEqual(getSpan(context.active()), undefined);
http.get(`${protocol}://${hostname}:${serverPort}/test`, res => {
- assert.deepStrictEqual(getActiveSpan(context.active()), undefined);
+ assert.deepStrictEqual(getSpan(context.active()), undefined);
done();
});
});
@@ -794,7 +795,7 @@ describe('HttpInstrumentation', () => {
const span = tracer.startSpan('parentSpan', {
kind: SpanKind.INTERNAL,
});
- tracer.withSpan(span, () => {
+ context.with(setSpan(context.active(), span), () => {
httpRequest
.get(`${protocol}://${hostname}:${serverPort}${testPath}`)
.then(result => {
diff --git a/packages/opentelemetry-instrumentation-http/test/functionals/http-package.test.ts b/packages/opentelemetry-instrumentation-http/test/functionals/http-package.test.ts
index f98c24baf6..4ea82d2765 100644
--- a/packages/opentelemetry-instrumentation-http/test/functionals/http-package.test.ts
+++ b/packages/opentelemetry-instrumentation-http/test/functionals/http-package.test.ts
@@ -14,9 +14,14 @@
* limitations under the License.
*/
-import { context, SpanKind, Span, propagation } from '@opentelemetry/api';
+import {
+ context,
+ SpanKind,
+ Span,
+ propagation,
+ NoopLogger,
+} from '@opentelemetry/api';
import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
-import { NoopLogger } from '@opentelemetry/core';
import { NodeTracerProvider } from '@opentelemetry/node';
import {
InMemorySpanExporter,
diff --git a/packages/opentelemetry-instrumentation-http/test/functionals/https-disable.test.ts b/packages/opentelemetry-instrumentation-http/test/functionals/https-disable.test.ts
index f0eb60b38f..795b304de6 100644
--- a/packages/opentelemetry-instrumentation-http/test/functionals/https-disable.test.ts
+++ b/packages/opentelemetry-instrumentation-http/test/functionals/https-disable.test.ts
@@ -14,8 +14,11 @@
* limitations under the License.
*/
-import { NoopTracerProvider, NOOP_TRACER } from '@opentelemetry/api';
-import { NoopLogger } from '@opentelemetry/core';
+import {
+ NoopTracerProvider,
+ NoopLogger,
+ NOOP_TRACER,
+} from '@opentelemetry/api';
import * as assert from 'assert';
import * as fs from 'fs';
import type { AddressInfo } from 'net';
@@ -64,7 +67,6 @@ describe('HttpsInstrumentation', () => {
beforeEach(() => {
NOOP_TRACER.startSpan = sinon.spy();
- NOOP_TRACER.withSpan = sinon.spy();
});
afterEach(() => {
@@ -88,10 +90,6 @@ describe('HttpsInstrumentation', () => {
);
assert.strictEqual(isWrapped(https.Server.prototype.emit), false);
- assert.strictEqual(
- (NOOP_TRACER.withSpan as sinon.SinonSpy).called,
- false
- );
});
});
});
diff --git a/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts b/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts
index e8a7a18655..7e5c6a4ef2 100644
--- a/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts
+++ b/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts
@@ -20,8 +20,9 @@ import {
propagation,
Span as ISpan,
SpanKind,
+ NoopLogger,
+ setSpan,
} from '@opentelemetry/api';
-import { NoopLogger } from '@opentelemetry/core';
import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
import { ContextManager } from '@opentelemetry/context-base';
import {
@@ -308,7 +309,7 @@ describe('HttpsInstrumentation', () => {
doNock(hostname, testPath, 200, 'Ok');
const name = 'TestRootSpan';
const span = tracer.startSpan(name);
- return tracer.withSpan(span, async () => {
+ return context.with(setSpan(context.active(), span), async () => {
const result = await httpsRequest.get(
`${protocol}://${hostname}${testPath}`
);
@@ -351,7 +352,7 @@ describe('HttpsInstrumentation', () => {
);
const name = 'TestRootSpan';
const span = tracer.startSpan(name);
- return tracer.withSpan(span, async () => {
+ return context.with(setSpan(context.active(), span), async () => {
const result = await httpsRequest.get(
`${protocol}://${hostname}${testPath}`
);
@@ -390,7 +391,7 @@ describe('HttpsInstrumentation', () => {
doNock(hostname, testPath, 200, 'Ok', num);
const name = 'TestRootSpan';
const span = tracer.startSpan(name);
- await tracer.withSpan(span, async () => {
+ await context.with(setSpan(context.active(), span), async () => {
for (let i = 0; i < num; i++) {
await httpsRequest.get(`${protocol}://${hostname}${testPath}`);
const spans = memoryExporter.getFinishedSpans();
diff --git a/packages/opentelemetry-instrumentation-http/test/functionals/https-package.test.ts b/packages/opentelemetry-instrumentation-http/test/functionals/https-package.test.ts
index 826792953b..6169ff1b32 100644
--- a/packages/opentelemetry-instrumentation-http/test/functionals/https-package.test.ts
+++ b/packages/opentelemetry-instrumentation-http/test/functionals/https-package.test.ts
@@ -14,9 +14,14 @@
* limitations under the License.
*/
-import { context, SpanKind, propagation, Span } from '@opentelemetry/api';
+import {
+ context,
+ SpanKind,
+ propagation,
+ NoopLogger,
+ Span,
+} from '@opentelemetry/api';
import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
-import { NoopLogger } from '@opentelemetry/core';
import { NodeTracerProvider } from '@opentelemetry/node';
import {
InMemorySpanExporter,
diff --git a/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts b/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts
index 1a43c057bb..da59b4ea0a 100644
--- a/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts
+++ b/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts
@@ -14,12 +14,13 @@
* limitations under the License.
*/
import {
+ Attributes,
StatusCode,
ROOT_CONTEXT,
SpanKind,
TraceFlags,
+ NoopLogger,
} from '@opentelemetry/api';
-import { NoopLogger } from '@opentelemetry/core';
import { BasicTracerProvider, Span } from '@opentelemetry/tracing';
import { HttpAttribute } from '@opentelemetry/semantic-conventions';
import * as assert from 'assert';
@@ -308,4 +309,145 @@ describe('Utility', () => {
assert.deepEqual(attributes[HttpAttribute.HTTP_ROUTE], undefined);
});
});
+ // Verify the key in the given attributes is set to the given value,
+ // and that no other HTTP Content Length attributes are set.
+ function verifyValueInAttributes(
+ attributes: Attributes,
+ key: string | undefined,
+ value: number
+ ) {
+ const httpAttributes = [
+ HttpAttribute.HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED,
+ HttpAttribute.HTTP_RESPONSE_CONTENT_LENGTH,
+ HttpAttribute.HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED,
+ HttpAttribute.HTTP_REQUEST_CONTENT_LENGTH,
+ ];
+
+ for (const attr of httpAttributes) {
+ if (attr === key) {
+ assert.strictEqual(attributes[attr], value);
+ } else {
+ assert.strictEqual(attributes[attr], undefined);
+ }
+ }
+ }
+
+ describe('setRequestContentLengthAttributes()', () => {
+ it('should set request content-length uncompressed attribute with no content-encoding header', () => {
+ const attributes: Attributes = {};
+ const request = {} as IncomingMessage;
+
+ request.headers = {
+ 'content-length': '1200',
+ };
+ utils.setRequestContentLengthAttribute(request, attributes);
+
+ verifyValueInAttributes(
+ attributes,
+ HttpAttribute.HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED,
+ 1200
+ );
+ });
+
+ it('should set request content-length uncompressed attribute with "identity" content-encoding header', () => {
+ const attributes: Attributes = {};
+ const request = {} as IncomingMessage;
+ request.headers = {
+ 'content-length': '1200',
+ 'content-encoding': 'identity',
+ };
+ utils.setRequestContentLengthAttribute(request, attributes);
+
+ verifyValueInAttributes(
+ attributes,
+ HttpAttribute.HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED,
+ 1200
+ );
+ });
+
+ it('should set request content-length compressed attribute with "gzip" content-encoding header', () => {
+ const attributes: Attributes = {};
+ const request = {} as IncomingMessage;
+ request.headers = {
+ 'content-length': '1200',
+ 'content-encoding': 'gzip',
+ };
+ utils.setRequestContentLengthAttribute(request, attributes);
+
+ verifyValueInAttributes(
+ attributes,
+ HttpAttribute.HTTP_REQUEST_CONTENT_LENGTH,
+ 1200
+ );
+ });
+ });
+
+ describe('setResponseContentLengthAttributes()', () => {
+ it('should set response content-length uncompressed attribute with no content-encoding header', () => {
+ const attributes: Attributes = {};
+
+ const response = {} as IncomingMessage;
+
+ response.headers = {
+ 'content-length': '1200',
+ };
+ utils.setResponseContentLengthAttribute(response, attributes);
+
+ verifyValueInAttributes(
+ attributes,
+ HttpAttribute.HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED,
+ 1200
+ );
+ });
+
+ it('should set response content-length uncompressed attribute with "identity" content-encoding header', () => {
+ const attributes: Attributes = {};
+
+ const response = {} as IncomingMessage;
+
+ response.headers = {
+ 'content-length': '1200',
+ 'content-encoding': 'identity',
+ };
+
+ utils.setResponseContentLengthAttribute(response, attributes);
+
+ verifyValueInAttributes(
+ attributes,
+ HttpAttribute.HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED,
+ 1200
+ );
+ });
+
+ it('should set response content-length compressed attribute with "gzip" content-encoding header', () => {
+ const attributes: Attributes = {};
+
+ const response = {} as IncomingMessage;
+
+ response.headers = {
+ 'content-length': '1200',
+ 'content-encoding': 'gzip',
+ };
+
+ utils.setResponseContentLengthAttribute(response, attributes);
+
+ verifyValueInAttributes(
+ attributes,
+ HttpAttribute.HTTP_RESPONSE_CONTENT_LENGTH,
+ 1200
+ );
+ });
+
+ it('should set no attributes with no content-length header', () => {
+ const attributes: Attributes = {};
+ const message = {} as IncomingMessage;
+
+ message.headers = {
+ 'content-encoding': 'gzip',
+ };
+ utils.setResponseContentLengthAttribute(message, attributes);
+
+ verifyValueInAttributes(attributes, undefined, 1200);
+ });
+ });
});
diff --git a/packages/opentelemetry-instrumentation-http/test/integrations/http-enable.test.ts b/packages/opentelemetry-instrumentation-http/test/integrations/http-enable.test.ts
index 86df32f56e..f0ba3ec005 100644
--- a/packages/opentelemetry-instrumentation-http/test/integrations/http-enable.test.ts
+++ b/packages/opentelemetry-instrumentation-http/test/integrations/http-enable.test.ts
@@ -14,8 +14,13 @@
* limitations under the License.
*/
-import { NoopLogger } from '@opentelemetry/core';
-import { SpanKind, Span, context, propagation } from '@opentelemetry/api';
+import {
+ SpanKind,
+ Span,
+ context,
+ propagation,
+ NoopLogger,
+} from '@opentelemetry/api';
import {
HttpAttribute,
GeneralAttribute,
diff --git a/packages/opentelemetry-instrumentation-http/test/integrations/https-enable.test.ts b/packages/opentelemetry-instrumentation-http/test/integrations/https-enable.test.ts
index b9d68ea8d1..880c2ec0f6 100644
--- a/packages/opentelemetry-instrumentation-http/test/integrations/https-enable.test.ts
+++ b/packages/opentelemetry-instrumentation-http/test/integrations/https-enable.test.ts
@@ -14,8 +14,13 @@
* limitations under the License.
*/
-import { NoopLogger } from '@opentelemetry/core';
-import { SpanKind, Span, context, propagation } from '@opentelemetry/api';
+import {
+ SpanKind,
+ Span,
+ context,
+ propagation,
+ NoopLogger,
+} from '@opentelemetry/api';
import {
HttpAttribute,
GeneralAttribute,
diff --git a/packages/opentelemetry-instrumentation-http/test/utils/DummyPropagation.ts b/packages/opentelemetry-instrumentation-http/test/utils/DummyPropagation.ts
index 0944e1e199..55d82d25b7 100644
--- a/packages/opentelemetry-instrumentation-http/test/utils/DummyPropagation.ts
+++ b/packages/opentelemetry-instrumentation-http/test/utils/DummyPropagation.ts
@@ -17,8 +17,8 @@ import {
Context,
TextMapPropagator,
TraceFlags,
- getParentSpanContext,
- setExtractedSpanContext,
+ getSpanContext,
+ setSpanContext,
} from '@opentelemetry/api';
import type * as http from 'http';
@@ -33,12 +33,12 @@ export class DummyPropagation implements TextMapPropagator {
isRemote: true,
};
if (extractedSpanContext.traceId && extractedSpanContext.spanId) {
- return setExtractedSpanContext(context, extractedSpanContext);
+ return setSpanContext(context, extractedSpanContext);
}
return context;
}
inject(context: Context, headers: { [custom: string]: string }): void {
- const spanContext = getParentSpanContext(context);
+ const spanContext = getSpanContext(context);
if (!spanContext) return;
headers[DummyPropagation.TRACE_CONTEXT_KEY] = spanContext.traceId;
headers[DummyPropagation.SPAN_CONTEXT_KEY] = spanContext.spanId;
diff --git a/packages/opentelemetry-instrumentation-http/test/utils/assertSpan.ts b/packages/opentelemetry-instrumentation-http/test/utils/assertSpan.ts
index 68ea829cb4..d5bea5af46 100644
--- a/packages/opentelemetry-instrumentation-http/test/utils/assertSpan.ts
+++ b/packages/opentelemetry-instrumentation-http/test/utils/assertSpan.ts
@@ -87,6 +87,26 @@ export const assertSpan = (
}
}
if (span.kind === SpanKind.CLIENT) {
+ if (validations.resHeaders['content-length']) {
+ const contentLength = Number(validations.resHeaders['content-length']);
+
+ if (
+ validations.resHeaders['content-encoding'] &&
+ validations.resHeaders['content-encoding'] !== 'identity'
+ ) {
+ assert.strictEqual(
+ span.attributes[HttpAttribute.HTTP_RESPONSE_CONTENT_LENGTH],
+ contentLength
+ );
+ } else {
+ assert.strictEqual(
+ span.attributes[
+ HttpAttribute.HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED
+ ],
+ contentLength
+ );
+ }
+ }
assert.strictEqual(
span.attributes[GeneralAttribute.NET_PEER_NAME],
validations.hostname,
@@ -108,6 +128,26 @@ export const assertSpan = (
);
}
if (span.kind === SpanKind.SERVER) {
+ if (validations.reqHeaders && validations.reqHeaders['content-length']) {
+ const contentLength = validations.reqHeaders['content-length'];
+
+ if (
+ validations.reqHeaders['content-encoding'] &&
+ validations.reqHeaders['content-encoding'] !== 'identity'
+ ) {
+ assert.strictEqual(
+ span.attributes[HttpAttribute.HTTP_REQUEST_CONTENT_LENGTH],
+ contentLength
+ );
+ } else {
+ assert.strictEqual(
+ span.attributes[
+ HttpAttribute.HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED
+ ],
+ contentLength
+ );
+ }
+ }
if (validations.serverName) {
assert.strictEqual(
span.attributes[HttpAttribute.HTTP_SERVER_NAME],
diff --git a/packages/opentelemetry-instrumentation-http/tsconfig.json b/packages/opentelemetry-instrumentation-http/tsconfig.json
index a2042cd68b..ea143a7be3 100644
--- a/packages/opentelemetry-instrumentation-http/tsconfig.json
+++ b/packages/opentelemetry-instrumentation-http/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,31 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-context-async-hooks"
+ },
+ {
+ "path": "../opentelemetry-context-base"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-instrumentation"
+ },
+ {
+ "path": "../opentelemetry-node"
+ },
+ {
+ "path": "../opentelemetry-semantic-conventions"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ }
]
}
diff --git a/packages/opentelemetry-instrumentation-xml-http-request/package.json b/packages/opentelemetry-instrumentation-xml-http-request/package.json
index a1e70bb23e..e9223cbe69 100644
--- a/packages/opentelemetry-instrumentation-xml-http-request/package.json
+++ b/packages/opentelemetry-instrumentation-xml-http-request/package.json
@@ -1,22 +1,20 @@
{
"name": "@opentelemetry/instrumentation-xml-http-request",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry XMLHttpRequest automatic instrumentation package.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "clean": "rimraf build/*",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
+ "version": "node ../../scripts/version-update.js",
"tdd": "karma start",
"test:browser": "nyc karma start --single-run",
- "watch": "tsc -w"
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -45,9 +43,9 @@
},
"devDependencies": {
"@babel/core": "7.12.10",
- "@opentelemetry/context-zone": "^0.13.0",
- "@opentelemetry/propagator-b3": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/context-zone": "^0.14.0",
+ "@opentelemetry/propagator-b3": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"@types/mocha": "8.2.0",
"@types/node": "14.14.12",
"@types/sinon": "9.0.9",
@@ -75,10 +73,10 @@
"webpack-merge": "5.6.1"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/instrumentation": "^0.13.0",
- "@opentelemetry/semantic-conventions": "^0.13.0",
- "@opentelemetry/web": "^0.13.0"
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/instrumentation": "^0.14.0",
+ "@opentelemetry/semantic-conventions": "^0.14.0",
+ "@opentelemetry/web": "^0.14.0"
}
}
diff --git a/packages/opentelemetry-instrumentation-xml-http-request/src/version.ts b/packages/opentelemetry-instrumentation-xml-http-request/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-instrumentation-xml-http-request/src/version.ts
+++ b/packages/opentelemetry-instrumentation-xml-http-request/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-instrumentation-xml-http-request/src/xhr.ts b/packages/opentelemetry-instrumentation-xml-http-request/src/xhr.ts
index 1e5fe3e1fd..b3f96e7f43 100644
--- a/packages/opentelemetry-instrumentation-xml-http-request/src/xhr.ts
+++ b/packages/opentelemetry-instrumentation-xml-http-request/src/xhr.ts
@@ -125,7 +125,7 @@ export class XMLHttpRequestInstrumentation extends InstrumentationBase {
+ api.context.with(api.setSpan(api.context.active(), span), () => {
const childSpan = this.tracer.startSpan('CORS Preflight', {
startTime: corsPreFlightRequest[PTN.FETCH_START],
});
@@ -437,25 +437,28 @@ export class XMLHttpRequestInstrumentation extends InstrumentationBase {
- plugin._tasksCount++;
- xhrMem.sendStartTime = hrTime();
- currentSpan.addEvent(EventNames.METHOD_SEND);
-
- this.addEventListener('abort', onAbort);
- this.addEventListener('error', onError);
- this.addEventListener('load', onLoad);
- this.addEventListener('timeout', onTimeout);
-
- xhrMem.callbackToRemoveEvents = () => {
- unregister(this);
- if (xhrMem.createdResources) {
- xhrMem.createdResources.observer.disconnect();
- }
- };
- plugin._addHeaders(this, spanUrl);
- plugin._addResourceObserver(this, spanUrl);
- });
+ api.context.with(
+ api.setSpan(api.context.active(), currentSpan),
+ () => {
+ plugin._tasksCount++;
+ xhrMem.sendStartTime = hrTime();
+ currentSpan.addEvent(EventNames.METHOD_SEND);
+
+ this.addEventListener('abort', onAbort);
+ this.addEventListener('error', onError);
+ this.addEventListener('load', onLoad);
+ this.addEventListener('timeout', onTimeout);
+
+ xhrMem.callbackToRemoveEvents = () => {
+ unregister(this);
+ if (xhrMem.createdResources) {
+ xhrMem.createdResources.observer.disconnect();
+ }
+ };
+ plugin._addHeaders(this, spanUrl);
+ plugin._addResourceObserver(this, spanUrl);
+ }
+ );
}
return original.apply(this, args);
};
diff --git a/packages/opentelemetry-instrumentation-xml-http-request/test/xhr.test.ts b/packages/opentelemetry-instrumentation-xml-http-request/test/xhr.test.ts
index cc3c4875cf..f5acb4ebf8 100644
--- a/packages/opentelemetry-instrumentation-xml-http-request/test/xhr.test.ts
+++ b/packages/opentelemetry-instrumentation-xml-http-request/test/xhr.test.ts
@@ -213,7 +213,7 @@ describe('xhr', () => {
);
rootSpan = webTracerWithZone.startSpan('root');
- webTracerWithZone.withSpan(rootSpan, () => {
+ api.context.with(api.setSpan(api.context.active(), rootSpan), () => {
getData(
new XMLHttpRequest(),
fileUrl,
@@ -626,46 +626,52 @@ describe('xhr', () => {
})
);
const reusableReq = new XMLHttpRequest();
- webTracerWithZone.withSpan(rootSpan, () => {
- getData(
- reusableReq,
- firstUrl,
- () => {
- fakeNow = 100;
- },
- testAsync
- ).then(() => {
- fakeNow = 0;
- sandbox.clock.tick(1000);
- });
- });
-
- webTracerWithZone.withSpan(rootSpan, () => {
- getData(
- reusableReq,
- secondUrl,
- () => {
- fakeNow = 100;
- },
- testAsync
- ).then(() => {
- fakeNow = 0;
- sandbox.clock.tick(1000);
- done();
- });
-
- assert.strictEqual(
- requests.length,
- 1,
- 'first request not called'
- );
+ api.context.with(
+ api.setSpan(api.context.active(), rootSpan),
+ () => {
+ getData(
+ reusableReq,
+ firstUrl,
+ () => {
+ fakeNow = 100;
+ },
+ testAsync
+ ).then(() => {
+ fakeNow = 0;
+ sandbox.clock.tick(1000);
+ });
+ }
+ );
- requests[0].respond(
- 200,
- { 'Content-Type': 'application/json' },
- '{"foo":"bar"}'
- );
- });
+ api.context.with(
+ api.setSpan(api.context.active(), rootSpan),
+ () => {
+ getData(
+ reusableReq,
+ secondUrl,
+ () => {
+ fakeNow = 100;
+ },
+ testAsync
+ ).then(() => {
+ fakeNow = 0;
+ sandbox.clock.tick(1000);
+ done();
+ });
+
+ assert.strictEqual(
+ requests.length,
+ 1,
+ 'first request not called'
+ );
+
+ requests[0].respond(
+ 200,
+ { 'Content-Type': 'application/json' },
+ '{"foo":"bar"}'
+ );
+ }
+ );
});
it('should clear previous span information', () => {
@@ -738,26 +744,29 @@ describe('xhr', () => {
describe('when request loads and receives an error code', () => {
beforeEach(done => {
- webTracerWithZone.withSpan(rootSpan, () => {
- getData(
- new XMLHttpRequest(),
- url,
- () => {
- fakeNow = 100;
- },
- testAsync
- ).then(() => {
- fakeNow = 0;
- sandbox.clock.tick(1000);
- done();
- });
- assert.strictEqual(requests.length, 1, 'request not called');
- requests[0].respond(
- 400,
- { 'Content-Type': 'text/plain' },
- 'Bad Request'
- );
- });
+ api.context.with(
+ api.setSpan(api.context.active(), rootSpan),
+ () => {
+ getData(
+ new XMLHttpRequest(),
+ url,
+ () => {
+ fakeNow = 100;
+ },
+ testAsync
+ ).then(() => {
+ fakeNow = 0;
+ sandbox.clock.tick(1000);
+ done();
+ });
+ assert.strictEqual(requests.length, 1, 'request not called');
+ requests[0].respond(
+ 400,
+ { 'Content-Type': 'text/plain' },
+ 'Bad Request'
+ );
+ }
+ );
});
it('span should have correct attributes', () => {
const span: tracing.ReadableSpan = exportSpy.args[0][0][0];
@@ -872,18 +881,21 @@ describe('xhr', () => {
describe('when request encounters a network error', () => {
beforeEach(done => {
- webTracerWithZone.withSpan(rootSpan, () => {
- getData(new XMLHttpRequest(), url, () => {}, testAsync).then(
- () => {
- fakeNow = 0;
- sandbox.clock.tick(1000);
- done();
- }
- );
-
- assert.strictEqual(requests.length, 1, 'request not called');
- requests[0].error();
- });
+ api.context.with(
+ api.setSpan(api.context.active(), rootSpan),
+ () => {
+ getData(new XMLHttpRequest(), url, () => {}, testAsync).then(
+ () => {
+ fakeNow = 0;
+ sandbox.clock.tick(1000);
+ done();
+ }
+ );
+
+ assert.strictEqual(requests.length, 1, 'request not called');
+ requests[0].error();
+ }
+ );
});
it('span should have correct attributes', () => {
@@ -961,18 +973,21 @@ describe('xhr', () => {
});
beforeEach(done => {
- webTracerWithZone.withSpan(rootSpan, () => {
- getData(new XMLHttpRequest(), url, () => {}, testAsync).then(
- () => {
- fakeNow = 0;
- sandbox.clock.tick(1000);
- done();
- }
- );
-
- assert.strictEqual(requests.length, 1, 'request not called');
- requests[0].abort();
- });
+ api.context.with(
+ api.setSpan(api.context.active(), rootSpan),
+ () => {
+ getData(new XMLHttpRequest(), url, () => {}, testAsync).then(
+ () => {
+ fakeNow = 0;
+ sandbox.clock.tick(1000);
+ done();
+ }
+ );
+
+ assert.strictEqual(requests.length, 1, 'request not called');
+ requests[0].abort();
+ }
+ );
});
it('span should have correct attributes', () => {
@@ -1050,20 +1065,23 @@ describe('xhr', () => {
});
beforeEach(done => {
- webTracerWithZone.withSpan(rootSpan, () => {
- getData(
- new XMLHttpRequest(),
- url,
- () => {
- sandbox.clock.tick(XHR_TIMEOUT);
- },
- testAsync
- ).then(() => {
- fakeNow = 0;
- sandbox.clock.tick(1000);
- done();
- });
- });
+ api.context.with(
+ api.setSpan(api.context.active(), rootSpan),
+ () => {
+ getData(
+ new XMLHttpRequest(),
+ url,
+ () => {
+ sandbox.clock.tick(XHR_TIMEOUT);
+ },
+ testAsync
+ ).then(() => {
+ fakeNow = 0;
+ sandbox.clock.tick(1000);
+ done();
+ });
+ }
+ );
});
it('span should have correct attributes', () => {
diff --git a/packages/opentelemetry-instrumentation-xml-http-request/tsconfig.json b/packages/opentelemetry-instrumentation-xml-http-request/tsconfig.json
index 71661a842e..76bcef51f2 100644
--- a/packages/opentelemetry-instrumentation-xml-http-request/tsconfig.json
+++ b/packages/opentelemetry-instrumentation-xml-http-request/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build",
@@ -8,5 +8,31 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-context-zone"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-instrumentation"
+ },
+ {
+ "path": "../opentelemetry-propagator-b3"
+ },
+ {
+ "path": "../opentelemetry-semantic-conventions"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ },
+ {
+ "path": "../opentelemetry-web"
+ }
]
}
diff --git a/packages/opentelemetry-instrumentation/package.json b/packages/opentelemetry-instrumentation/package.json
index 2832bfcfa0..8d0ac7633f 100644
--- a/packages/opentelemetry-instrumentation/package.json
+++ b/packages/opentelemetry-instrumentation/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/instrumentation",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "Base class for node which OpenTelemetry instrumentation modules extend",
"author": "OpenTelemetry Authors",
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme",
@@ -27,21 +27,19 @@
"README.md"
],
"scripts": {
- "clean": "rimraf build/*",
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "compile": "npm run version:update && tsc -p .",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "precompile": "tsc --version",
- "prepare": "npm run compile",
"tdd": "npm run tdd:node",
"tdd:node": "npm run test -- --watch-extensions ts --watch",
"tdd:browser": "karma start",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'",
"test:browser": "nyc karma start --single-run",
- "version:update": "node ../../scripts/version-update.js",
- "watch": "tsc -w"
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -56,7 +54,7 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
"require-in-the-middle": "^5.0.3",
"semver": "^7.3.2",
"shimmer": "^1.2.1"
diff --git a/packages/opentelemetry-instrumentation/src/version.ts b/packages/opentelemetry-instrumentation/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-instrumentation/src/version.ts
+++ b/packages/opentelemetry-instrumentation/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-instrumentation/tsconfig.json b/packages/opentelemetry-instrumentation/tsconfig.json
index a2042cd68b..e73d377644 100644
--- a/packages/opentelemetry-instrumentation/tsconfig.json
+++ b/packages/opentelemetry-instrumentation/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,10 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ }
]
}
diff --git a/packages/opentelemetry-metrics/package.json b/packages/opentelemetry-metrics/package.json
index 1e9b46b194..cdd911d237 100644
--- a/packages/opentelemetry-metrics/package.json
+++ b/packages/opentelemetry-metrics/package.json
@@ -1,22 +1,20 @@
{
"name": "@opentelemetry/metrics",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry metrics SDK",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "clean": "rimraf build/*",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
- "watch": "tsc -w"
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -56,8 +54,8 @@
"typescript": "3.9.7"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/resources": "^0.13.0"
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/resources": "^0.14.0"
}
}
diff --git a/packages/opentelemetry-metrics/src/Metric.ts b/packages/opentelemetry-metrics/src/Metric.ts
index e492115cbe..525c166d76 100644
--- a/packages/opentelemetry-metrics/src/Metric.ts
+++ b/packages/opentelemetry-metrics/src/Metric.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import * as api from '@opentelemetry/api';
-import { NoopLogger } from '@opentelemetry/core';
import { Resource } from '@opentelemetry/resources';
import { BaseBoundInstrument } from './BoundInstrument';
import { MetricDescriptor, MetricKind, MetricRecord } from './export/types';
@@ -43,7 +42,7 @@ export abstract class Metric
typeof _options.valueType === 'number'
? _options.valueType
: api.ValueType.DOUBLE;
- this._logger = _options.logger ?? new NoopLogger();
+ this._logger = _options.logger ?? new api.NoopLogger();
this._boundaries = _options.boundaries;
this._descriptor = this._getMetricDescriptor();
}
diff --git a/packages/opentelemetry-metrics/src/version.ts b/packages/opentelemetry-metrics/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-metrics/src/version.ts
+++ b/packages/opentelemetry-metrics/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-metrics/test/Meter.test.ts b/packages/opentelemetry-metrics/test/Meter.test.ts
index c03b8ab369..2a9562cd87 100644
--- a/packages/opentelemetry-metrics/test/Meter.test.ts
+++ b/packages/opentelemetry-metrics/test/Meter.test.ts
@@ -34,7 +34,7 @@ import {
Histogram,
} from '../src';
import * as api from '@opentelemetry/api';
-import { NoopLogger, hrTime, hrTimeToNanoseconds } from '@opentelemetry/core';
+import { hrTime, hrTimeToNanoseconds } from '@opentelemetry/core';
import { BatchObserverResult } from '../src/BatchObserverResult';
import { SumAggregator } from '../src/export/aggregators';
import { SumObserverMetric } from '../src/SumObserverMetric';
@@ -81,7 +81,7 @@ describe('Meter', () => {
beforeEach(() => {
meter = new MeterProvider({
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
}).getMeter('test-meter');
});
diff --git a/packages/opentelemetry-metrics/test/MeterProvider.test.ts b/packages/opentelemetry-metrics/test/MeterProvider.test.ts
index ace5b0b472..f92af4458c 100644
--- a/packages/opentelemetry-metrics/test/MeterProvider.test.ts
+++ b/packages/opentelemetry-metrics/test/MeterProvider.test.ts
@@ -17,7 +17,7 @@
import * as assert from 'assert';
import * as sinon from 'sinon';
import { MeterProvider, Meter, CounterMetric } from '../src';
-import { NoopLogger } from '@opentelemetry/core';
+import { NoopLogger } from '@opentelemetry/api';
describe('MeterProvider', () => {
describe('constructor', () => {
diff --git a/packages/opentelemetry-metrics/test/Processor.test.ts b/packages/opentelemetry-metrics/test/Processor.test.ts
index f7d1ce9c11..d14bd4fe5a 100644
--- a/packages/opentelemetry-metrics/test/Processor.test.ts
+++ b/packages/opentelemetry-metrics/test/Processor.test.ts
@@ -16,7 +16,6 @@
import * as assert from 'assert';
import * as api from '@opentelemetry/api';
-import { NoopLogger } from '@opentelemetry/core';
import { Meter, MeterProvider } from '../src';
describe('Processor', () => {
@@ -27,7 +26,7 @@ describe('Processor', () => {
let counter: api.Counter;
beforeEach(() => {
meter = new MeterProvider({
- logger: new NoopLogger(),
+ logger: new api.NoopLogger(),
interval: 10000,
}).getMeter('test-meter');
counter = meter.createCounter('ungrouped-processor-test');
diff --git a/packages/opentelemetry-metrics/tsconfig.json b/packages/opentelemetry-metrics/tsconfig.json
index a2042cd68b..954354a3a0 100644
--- a/packages/opentelemetry-metrics/tsconfig.json
+++ b/packages/opentelemetry-metrics/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,16 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-resources"
+ }
]
}
diff --git a/packages/opentelemetry-node/package.json b/packages/opentelemetry-node/package.json
index 2f72dee27e..4b67dbef34 100644
--- a/packages/opentelemetry-node/package.json
+++ b/packages/opentelemetry-node/package.json
@@ -1,22 +1,20 @@
{
"name": "@opentelemetry/node",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry Node SDK provides automatic telemetry (tracing, metrics, etc) for Node.js applications",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "clean": "rimraf build/*",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
- "watch": "tsc -w"
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -43,8 +41,8 @@
"access": "public"
},
"devDependencies": {
- "@opentelemetry/context-base": "^0.13.0",
- "@opentelemetry/resources": "^0.13.0",
+ "@opentelemetry/context-base": "^0.14.0",
+ "@opentelemetry/resources": "^0.14.0",
"@types/mocha": "8.2.0",
"@types/node": "14.14.12",
"@types/semver": "7.3.4",
@@ -60,10 +58,10 @@
"typescript": "3.9.7"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/context-async-hooks": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/context-async-hooks": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"require-in-the-middle": "^5.0.0",
"semver": "^7.1.3"
}
diff --git a/packages/opentelemetry-node/src/version.ts b/packages/opentelemetry-node/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-node/src/version.ts
+++ b/packages/opentelemetry-node/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-node/test/NodeTracerProvider.test.ts b/packages/opentelemetry-node/test/NodeTracerProvider.test.ts
index 5fcc81e1b8..851091b0ac 100644
--- a/packages/opentelemetry-node/test/NodeTracerProvider.test.ts
+++ b/packages/opentelemetry-node/test/NodeTracerProvider.test.ts
@@ -17,13 +17,14 @@
import {
context,
TraceFlags,
- setActiveSpan,
- setExtractedSpanContext,
+ NoopLogger,
+ setSpan,
+ setSpanContext,
+ getSpan,
} from '@opentelemetry/api';
import {
AlwaysOnSampler,
AlwaysOffSampler,
- NoopLogger,
NoRecordingSpan,
} from '@opentelemetry/core';
import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
@@ -168,7 +169,7 @@ describe('NodeTracerProvider', () => {
const sampledParent = provider.getTracer('default').startSpan(
'not-sampled-span',
{},
- setExtractedSpanContext(ROOT_CONTEXT, {
+ setSpanContext(ROOT_CONTEXT, {
traceId: 'd4cda95b652f4a1592b449d5929fda1b',
spanId: '6e0c63257de34c92',
traceFlags: TraceFlags.NONE,
@@ -183,11 +184,7 @@ describe('NodeTracerProvider', () => {
const span = provider
.getTracer('default')
- .startSpan(
- 'child-span',
- {},
- setActiveSpan(ROOT_CONTEXT, sampledParent)
- );
+ .startSpan('child-span', {}, setSpan(ROOT_CONTEXT, sampledParent));
assert.ok(span instanceof Span);
assert.strictEqual(span.context().traceFlags, TraceFlags.SAMPLED);
assert.strictEqual(span.isRecording(), true);
@@ -207,49 +204,27 @@ describe('NodeTracerProvider', () => {
});
});
- describe('.getCurrentSpan()', () => {
- it('should return undefined with AsyncHooksContextManager when no span started', () => {
- provider = new NodeTracerProvider({});
- assert.deepStrictEqual(
- provider.getTracer('default').getCurrentSpan(),
- undefined
- );
- });
- });
-
describe('.withSpan()', () => {
it('should run context with AsyncHooksContextManager context manager', done => {
provider = new NodeTracerProvider({});
const span = provider.getTracer('default').startSpan('my-span');
- provider.getTracer('default').withSpan(span, () => {
- assert.deepStrictEqual(
- provider.getTracer('default').getCurrentSpan(),
- span
- );
+ context.with(setSpan(context.active(), span), () => {
+ assert.deepStrictEqual(getSpan(context.active()), span);
return done();
});
- assert.deepStrictEqual(
- provider.getTracer('default').getCurrentSpan(),
- undefined
- );
+ assert.deepStrictEqual(getSpan(context.active()), undefined);
});
it('should run context with AsyncHooksContextManager context manager with multiple spans', done => {
provider = new NodeTracerProvider({});
const span = provider.getTracer('default').startSpan('my-span');
- provider.getTracer('default').withSpan(span, () => {
- assert.deepStrictEqual(
- provider.getTracer('default').getCurrentSpan(),
- span
- );
+ context.with(setSpan(context.active(), span), () => {
+ assert.deepStrictEqual(getSpan(context.active()), span);
const span1 = provider.getTracer('default').startSpan('my-span1');
- provider.getTracer('default').withSpan(span1, () => {
- assert.deepStrictEqual(
- provider.getTracer('default').getCurrentSpan(),
- span1
- );
+ context.with(setSpan(context.active(), span1), () => {
+ assert.deepStrictEqual(getSpan(context.active()), span1);
assert.deepStrictEqual(
span1.context().traceId,
span.context().traceId
@@ -259,29 +234,20 @@ describe('NodeTracerProvider', () => {
});
// when span ended.
// @todo: below check is not running.
- assert.deepStrictEqual(
- provider.getTracer('default').getCurrentSpan(),
- undefined
- );
+ assert.deepStrictEqual(getSpan(context.active()), undefined);
});
it('should find correct context with promises', async () => {
provider = new NodeTracerProvider();
const span = provider.getTracer('default').startSpan('my-span');
- await provider.getTracer('default').withSpan(span, async () => {
+ await context.with(setSpan(context.active(), span), async () => {
for (let i = 0; i < 3; i++) {
await sleep(5).then(() => {
- assert.deepStrictEqual(
- provider.getTracer('default').getCurrentSpan(),
- span
- );
+ assert.deepStrictEqual(getSpan(context.active()), span);
});
}
});
- assert.deepStrictEqual(
- provider.getTracer('default').getCurrentSpan(),
- undefined
- );
+ assert.deepStrictEqual(getSpan(context.active()), undefined);
});
});
@@ -290,13 +256,10 @@ describe('NodeTracerProvider', () => {
const provider = new NodeTracerProvider({});
const span = provider.getTracer('default').startSpan('my-span');
const fn = () => {
- assert.deepStrictEqual(
- provider.getTracer('default').getCurrentSpan(),
- span
- );
+ assert.deepStrictEqual(getSpan(context.active()), span);
return done();
};
- const patchedFn = context.bind(fn, setActiveSpan(context.active(), span));
+ const patchedFn = context.bind(fn, setSpan(context.active(), span));
return patchedFn();
});
});
diff --git a/packages/opentelemetry-node/test/instrumentation/PluginLoader.test.ts b/packages/opentelemetry-node/test/instrumentation/PluginLoader.test.ts
index 954cf7f8ed..8594b1c8b4 100644
--- a/packages/opentelemetry-node/test/instrumentation/PluginLoader.test.ts
+++ b/packages/opentelemetry-node/test/instrumentation/PluginLoader.test.ts
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-import { NoopTracerProvider } from '@opentelemetry/api';
-import { NoopLogger } from '@opentelemetry/core';
+import { NoopTracerProvider, NoopLogger } from '@opentelemetry/api';
import * as assert from 'assert';
import * as path from 'path';
import {
diff --git a/packages/opentelemetry-node/test/instrumentation/utils.test.ts b/packages/opentelemetry-node/test/instrumentation/utils.test.ts
index 0f2eb4f7ac..06ccdd12e0 100644
--- a/packages/opentelemetry-node/test/instrumentation/utils.test.ts
+++ b/packages/opentelemetry-node/test/instrumentation/utils.test.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { NoopLogger } from '@opentelemetry/core';
+import { NoopLogger } from '@opentelemetry/api';
import * as assert from 'assert';
import * as path from 'path';
import * as utils from '../../src/instrumentation/utils';
diff --git a/packages/opentelemetry-node/tsconfig.json b/packages/opentelemetry-node/tsconfig.json
index a2042cd68b..1295aa1d32 100644
--- a/packages/opentelemetry-node/tsconfig.json
+++ b/packages/opentelemetry-node/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,25 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-context-async-hooks"
+ },
+ {
+ "path": "../opentelemetry-context-base"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-resources"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ }
]
}
diff --git a/packages/opentelemetry-plugin-fetch/package.json b/packages/opentelemetry-plugin-fetch/package.json
index 63d42bf23f..97f3056411 100644
--- a/packages/opentelemetry-plugin-fetch/package.json
+++ b/packages/opentelemetry-plugin-fetch/package.json
@@ -1,22 +1,20 @@
{
"name": "@opentelemetry/plugin-fetch",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry fetch automatic instrumentation package.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "clean": "rimraf build/*",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
+ "version": "node ../../scripts/version-update.js",
"tdd": "karma start",
"test:browser": "nyc karma start --single-run",
- "watch": "tsc -w"
+ "watch": "tsc --build --watch"
},
"keywords": [
"fetch",
@@ -45,9 +43,9 @@
},
"devDependencies": {
"@babel/core": "7.12.10",
- "@opentelemetry/context-zone": "^0.13.0",
- "@opentelemetry/propagator-b3": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/context-zone": "^0.14.0",
+ "@opentelemetry/propagator-b3": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"@types/mocha": "8.2.0",
"@types/node": "14.14.12",
"@types/shimmer": "1.0.1",
@@ -76,9 +74,9 @@
"webpack-merge": "5.6.1"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/web": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/web": "^0.14.0",
"shimmer": "^1.2.1"
}
}
diff --git a/packages/opentelemetry-plugin-fetch/src/fetch.ts b/packages/opentelemetry-plugin-fetch/src/fetch.ts
index 6d46638ff2..419a80cb40 100644
--- a/packages/opentelemetry-plugin-fetch/src/fetch.ts
+++ b/packages/opentelemetry-plugin-fetch/src/fetch.ts
@@ -68,7 +68,7 @@ export class FetchPlugin extends core.BasePlugin> {
{
startTime: corsPreFlightRequest[web.PerformanceTimingNames.FETCH_START],
},
- api.setActiveSpan(api.context.active(), span)
+ api.setSpan(api.context.active(), span)
);
web.addSpanNetworkEvents(childSpan, corsPreFlightRequest);
childSpan.end(
@@ -299,16 +299,19 @@ export class FetchPlugin extends core.BasePlugin> {
}
return new Promise((resolve, reject) => {
- return plugin._tracer.withSpan(span, () => {
- plugin._addHeaders(options, url);
- plugin._tasksCount++;
- return original
- .apply(this, [url, options])
- .then(
- onSuccess.bind(this, span, resolve),
- onError.bind(this, span, reject)
- );
- });
+ return api.context.with(
+ api.setSpan(api.context.active(), span),
+ () => {
+ plugin._addHeaders(options, url);
+ plugin._tasksCount++;
+ return original
+ .apply(this, [url, options])
+ .then(
+ onSuccess.bind(this, span, resolve),
+ onError.bind(this, span, reject)
+ );
+ }
+ );
});
};
};
diff --git a/packages/opentelemetry-plugin-fetch/src/version.ts b/packages/opentelemetry-plugin-fetch/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-plugin-fetch/src/version.ts
+++ b/packages/opentelemetry-plugin-fetch/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-plugin-fetch/test/fetch.test.ts b/packages/opentelemetry-plugin-fetch/test/fetch.test.ts
index 647537f6c3..80c3000b1f 100644
--- a/packages/opentelemetry-plugin-fetch/test/fetch.test.ts
+++ b/packages/opentelemetry-plugin-fetch/test/fetch.test.ts
@@ -178,7 +178,7 @@ describe('fetch', () => {
);
rootSpan = webTracerWithZone.startSpan('root');
- webTracerWithZone.withSpan(rootSpan, () => {
+ api.context.with(api.setSpan(api.context.active(), rootSpan), () => {
fakeNow = 0;
getData(fileUrl, method).then(
response => {
diff --git a/packages/opentelemetry-plugin-fetch/tsconfig.json b/packages/opentelemetry-plugin-fetch/tsconfig.json
index 71661a842e..b06e28c796 100644
--- a/packages/opentelemetry-plugin-fetch/tsconfig.json
+++ b/packages/opentelemetry-plugin-fetch/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build",
@@ -8,5 +8,25 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-context-zone"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-propagator-b3"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ },
+ {
+ "path": "../opentelemetry-web"
+ }
]
}
diff --git a/packages/opentelemetry-plugin-grpc-js/package.json b/packages/opentelemetry-plugin-grpc-js/package.json
index c30120eb01..ad6a02c878 100644
--- a/packages/opentelemetry-plugin-grpc-js/package.json
+++ b/packages/opentelemetry-plugin-grpc-js/package.json
@@ -1,22 +1,20 @@
{
"name": "@opentelemetry/plugin-grpc-js",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry @grpc/grpc-js automatic instrumentation package.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
"test:deubg": "ts-mocha --inspect-brk -p tsconfig.json test/**/*.test.ts",
"tdd": "npm run test -- --watch-extensions ts --watch",
- "clean": "rimraf build/*",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile"
+ "version": "node ../../scripts/version-update.js"
},
"keywords": [
"opentelemetry",
@@ -45,11 +43,11 @@
},
"devDependencies": {
"@grpc/grpc-js": "1.2.2",
- "@opentelemetry/context-async-hooks": "^0.13.0",
- "@opentelemetry/context-base": "^0.13.0",
- "@opentelemetry/grpc-utils": "^0.13.0",
- "@opentelemetry/node": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/context-async-hooks": "^0.14.0",
+ "@opentelemetry/context-base": "^0.14.0",
+ "@opentelemetry/grpc-utils": "^0.14.0",
+ "@opentelemetry/node": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"@types/mocha": "8.2.0",
"@types/node": "14.14.12",
"@types/semver": "7.3.4",
@@ -67,9 +65,9 @@
"typescript": "3.9.7"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/semantic-conventions": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/semantic-conventions": "^0.14.0",
"shimmer": "1.2.1"
}
}
diff --git a/packages/opentelemetry-plugin-grpc-js/src/client/utils.ts b/packages/opentelemetry-plugin-grpc-js/src/client/utils.ts
index 9332f7ad76..70632b6ac8 100644
--- a/packages/opentelemetry-plugin-grpc-js/src/client/utils.ts
+++ b/packages/opentelemetry-plugin-grpc-js/src/client/utils.ts
@@ -23,6 +23,7 @@ import {
Status,
propagation,
context,
+ setSpan,
} from '@opentelemetry/api';
import { RpcAttribute } from '@opentelemetry/semantic-conventions';
import type * as grpcJs from '@grpc/grpc-js';
@@ -80,8 +81,8 @@ export function getPatchedClientMethods(
const span = plugin.tracer.startSpan(name, {
kind: SpanKind.CLIENT,
});
- return plugin.tracer.withSpan(span, () =>
- makeGrpcClientRemoteCall(original, args, metadata, this, plugin)(span)
+ return context.with(setSpan(context.active(), span), () =>
+ makeGrpcClientRemoteCall(original, args, metadata, this)(span)
);
};
};
@@ -95,8 +96,7 @@ export function makeGrpcClientRemoteCall(
original: GrpcClientFunc,
args: unknown[],
metadata: grpcJs.Metadata,
- self: grpcJs.Client,
- plugin: GrpcJsPlugin
+ self: grpcJs.Client
): (span: Span) => EventEmitter {
/**
* Patches a callback so that the current span for this trace is also ended
@@ -130,7 +130,7 @@ export function makeGrpcClientRemoteCall(
span.end();
callback(err, res);
};
- return plugin.tracer.bind(wrappedFn);
+ return context.bind(wrappedFn);
}
return (span: Span) => {
@@ -166,7 +166,7 @@ export function makeGrpcClientRemoteCall(
spanEnded = true;
}
};
- plugin.tracer.bind(call);
+ context.bind(call);
call.on('error', (err: grpcJs.ServiceError) => {
if (call[CALL_SPAN_ENDED]) {
return;
diff --git a/packages/opentelemetry-plugin-grpc-js/src/server/clientStreamAndUnary.ts b/packages/opentelemetry-plugin-grpc-js/src/server/clientStreamAndUnary.ts
index 2e92334cb0..bef98b2590 100644
--- a/packages/opentelemetry-plugin-grpc-js/src/server/clientStreamAndUnary.ts
+++ b/packages/opentelemetry-plugin-grpc-js/src/server/clientStreamAndUnary.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { Span, StatusCode } from '@opentelemetry/api';
+import { context, Span, StatusCode } from '@opentelemetry/api';
import type { ServerCallWithMeta, SendUnaryDataCallback } from '../types';
import { grpcStatusCodeToOpenTelemetryStatusCode } from '../utils';
import { RpcAttribute } from '@opentelemetry/semantic-conventions';
@@ -61,6 +61,6 @@ export function clientStreamAndUnaryHandler(
return callback(err, value);
};
- plugin.tracer.bind(call);
+ context.bind(call);
return (original as Function).call({}, call, patchedCallback);
}
diff --git a/packages/opentelemetry-plugin-grpc-js/src/server/patchServer.ts b/packages/opentelemetry-plugin-grpc-js/src/server/patchServer.ts
index e9e8ed6f29..efad948e9c 100644
--- a/packages/opentelemetry-plugin-grpc-js/src/server/patchServer.ts
+++ b/packages/opentelemetry-plugin-grpc-js/src/server/patchServer.ts
@@ -30,6 +30,7 @@ import {
propagation,
Span,
ROOT_CONTEXT,
+ setSpan,
} from '@opentelemetry/api';
import { RpcAttribute } from '@opentelemetry/semantic-conventions';
import { clientStreamAndUnaryHandler } from './clientStreamAndUnary';
@@ -113,7 +114,7 @@ export function patchServer(
[RpcAttribute.GRPC_KIND]: spanOptions.kind,
});
- plugin.tracer.withSpan(span, () => {
+ context.with(setSpan(context.active(), span), () => {
handleServerFunction.call(
self,
plugin,
diff --git a/packages/opentelemetry-plugin-grpc-js/src/server/serverStreamAndBidi.ts b/packages/opentelemetry-plugin-grpc-js/src/server/serverStreamAndBidi.ts
index 138d98e9c9..311097996e 100644
--- a/packages/opentelemetry-plugin-grpc-js/src/server/serverStreamAndBidi.ts
+++ b/packages/opentelemetry-plugin-grpc-js/src/server/serverStreamAndBidi.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { Span, StatusCode } from '@opentelemetry/api';
+import { context, Span, StatusCode } from '@opentelemetry/api';
import { RpcAttribute } from '@opentelemetry/semantic-conventions';
import type * as grpcJs from '@grpc/grpc-js';
import type { GrpcJsPlugin } from '../grpcJs';
@@ -43,7 +43,7 @@ export function serverStreamAndBidiHandler(
}
};
- plugin.tracer.bind(call);
+ context.bind(call);
call.on('finish', () => {
// @grpc/js does not expose a way to check if this call also emitted an error,
// e.g. call.status.code !== 0
diff --git a/packages/opentelemetry-plugin-grpc-js/src/version.ts b/packages/opentelemetry-plugin-grpc-js/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-plugin-grpc-js/src/version.ts
+++ b/packages/opentelemetry-plugin-grpc-js/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-plugin-grpc-js/tsconfig.json b/packages/opentelemetry-plugin-grpc-js/tsconfig.json
index a2042cd68b..00e509fd19 100644
--- a/packages/opentelemetry-plugin-grpc-js/tsconfig.json
+++ b/packages/opentelemetry-plugin-grpc-js/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,31 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-context-async-hooks"
+ },
+ {
+ "path": "../opentelemetry-context-base"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-grpc-utils"
+ },
+ {
+ "path": "../opentelemetry-node"
+ },
+ {
+ "path": "../opentelemetry-semantic-conventions"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ }
]
}
diff --git a/packages/opentelemetry-plugin-grpc/package.json b/packages/opentelemetry-plugin-grpc/package.json
index 6445d5c485..979c4eca51 100644
--- a/packages/opentelemetry-plugin-grpc/package.json
+++ b/packages/opentelemetry-plugin-grpc/package.json
@@ -1,21 +1,19 @@
{
"name": "@opentelemetry/plugin-grpc",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry grpc automatic instrumentation package.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
"tdd": "npm run test -- --watch-extensions ts --watch",
- "clean": "rimraf build/*",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile"
+ "version": "node ../../scripts/version-update.js"
},
"keywords": [
"opentelemetry",
@@ -42,11 +40,11 @@
"access": "public"
},
"devDependencies": {
- "@opentelemetry/context-async-hooks": "^0.13.0",
- "@opentelemetry/context-base": "^0.13.0",
- "@opentelemetry/grpc-utils": "^0.13.0",
- "@opentelemetry/node": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/context-async-hooks": "^0.14.0",
+ "@opentelemetry/context-base": "^0.14.0",
+ "@opentelemetry/grpc-utils": "^0.14.0",
+ "@opentelemetry/node": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"@types/mocha": "8.2.0",
"@types/node": "14.14.12",
"@types/semver": "7.3.4",
@@ -66,9 +64,9 @@
"typescript": "3.9.7"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/semantic-conventions": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/semantic-conventions": "^0.14.0",
"shimmer": "^1.2.1"
}
}
diff --git a/packages/opentelemetry-plugin-grpc/src/grpc.ts b/packages/opentelemetry-plugin-grpc/src/grpc.ts
index f27492438e..a53941c9d9 100644
--- a/packages/opentelemetry-plugin-grpc/src/grpc.ts
+++ b/packages/opentelemetry-plugin-grpc/src/grpc.ts
@@ -23,6 +23,7 @@ import {
SpanOptions,
Status,
ROOT_CONTEXT,
+ setSpan,
} from '@opentelemetry/api';
import { RpcAttribute } from '@opentelemetry/semantic-conventions';
import { BasePlugin } from '@opentelemetry/core';
@@ -194,7 +195,7 @@ export class GrpcPlugin extends BasePlugin {
[RpcAttribute.GRPC_KIND]: spanOptions.kind,
});
- plugin._tracer.withSpan(span, () => {
+ context.with(setSpan(context.active(), span), () => {
switch (type) {
case 'unary':
case 'client_stream':
@@ -286,7 +287,7 @@ export class GrpcPlugin extends BasePlugin {
return callback(err, value, trailer, flags);
}
- plugin._tracer.bind(call);
+ context.bind(call);
return (original as Function).call(self, call, patchedCallback);
}
@@ -305,7 +306,7 @@ export class GrpcPlugin extends BasePlugin {
}
};
- plugin._tracer.bind(call);
+ context.bind(call);
call.on('finish', () => {
span.setStatus(_grpcStatusCodeToSpanStatus(call.status.code));
span.setAttribute(
@@ -392,7 +393,7 @@ export class GrpcPlugin extends BasePlugin {
const span = plugin._tracer.startSpan(name, {
kind: SpanKind.CLIENT,
});
- return plugin._tracer.withSpan(span, () =>
+ return context.with(setSpan(context.active(), span), () =>
plugin._makeGrpcClientRemoteCall(
original,
args,
@@ -448,7 +449,7 @@ export class GrpcPlugin extends BasePlugin {
span.end();
callback(err, res);
};
- return plugin._tracer.bind(wrappedFn);
+ return context.bind(wrappedFn);
}
return (span: Span) => {
@@ -490,7 +491,7 @@ export class GrpcPlugin extends BasePlugin {
spanEnded = true;
}
};
- plugin._tracer.bind(call);
+ context.bind(call);
((call as unknown) as events.EventEmitter).on(
'error',
(err: grpcTypes.ServiceError) => {
diff --git a/packages/opentelemetry-plugin-grpc/src/version.ts b/packages/opentelemetry-plugin-grpc/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-plugin-grpc/src/version.ts
+++ b/packages/opentelemetry-plugin-grpc/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-plugin-grpc/tsconfig.json b/packages/opentelemetry-plugin-grpc/tsconfig.json
index a2042cd68b..00e509fd19 100644
--- a/packages/opentelemetry-plugin-grpc/tsconfig.json
+++ b/packages/opentelemetry-plugin-grpc/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,31 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-context-async-hooks"
+ },
+ {
+ "path": "../opentelemetry-context-base"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-grpc-utils"
+ },
+ {
+ "path": "../opentelemetry-node"
+ },
+ {
+ "path": "../opentelemetry-semantic-conventions"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ }
]
}
diff --git a/packages/opentelemetry-plugin-http/package.json b/packages/opentelemetry-plugin-http/package.json
index fc420c3113..296b247efd 100644
--- a/packages/opentelemetry-plugin-http/package.json
+++ b/packages/opentelemetry-plugin-http/package.json
@@ -1,22 +1,20 @@
{
"name": "@opentelemetry/plugin-http",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry http automatic instrumentation package.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
"tdd": "npm run test -- --watch-extensions ts --watch",
- "clean": "rimraf build/*",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
- "watch": "tsc -w"
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -43,10 +41,10 @@
"access": "public"
},
"devDependencies": {
- "@opentelemetry/context-async-hooks": "^0.13.0",
- "@opentelemetry/context-base": "^0.13.0",
- "@opentelemetry/node": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/context-async-hooks": "^0.14.0",
+ "@opentelemetry/context-base": "^0.14.0",
+ "@opentelemetry/node": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"@types/got": "9.6.11",
"@types/mocha": "8.2.0",
"@types/node": "14.14.12",
@@ -72,9 +70,9 @@
"typescript": "3.9.7"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/semantic-conventions": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/semantic-conventions": "^0.14.0",
"semver": "^7.1.3",
"shimmer": "^1.2.1"
}
diff --git a/packages/opentelemetry-plugin-http/src/http.ts b/packages/opentelemetry-plugin-http/src/http.ts
index ccde0d4a44..c4eecfb3b1 100644
--- a/packages/opentelemetry-plugin-http/src/http.ts
+++ b/packages/opentelemetry-plugin-http/src/http.ts
@@ -23,8 +23,9 @@ import {
Status,
SpanContext,
TraceFlags,
- setActiveSpan,
+ setSpan,
ROOT_CONTEXT,
+ getSpan,
} from '@opentelemetry/api';
import { BasePlugin, NoRecordingSpan } from '@opentelemetry/core';
import type {
@@ -214,7 +215,7 @@ export class HttpPlugin extends BasePlugin {
this._callResponseHook(span, response);
}
- this._tracer.bind(response);
+ context.bind(response);
this._logger.debug('outgoingRequest on response()');
response.on('end', () => {
this._logger.debug('outgoingRequest on end()');
@@ -310,7 +311,7 @@ export class HttpPlugin extends BasePlugin {
return context.with(propagation.extract(ROOT_CONTEXT, headers), () => {
const span = plugin._startHttpSpan(`HTTP ${method}`, spanOptions);
- return plugin._tracer.withSpan(span, () => {
+ return context.with(setSpan(context.active(), span), () => {
context.bind(request);
context.bind(response);
@@ -415,7 +416,7 @@ export class HttpPlugin extends BasePlugin {
optionsParsed.headers = {};
}
propagation.inject(
- setActiveSpan(context.active(), span),
+ setSpan(context.active(), span),
optionsParsed.headers
);
@@ -426,7 +427,7 @@ export class HttpPlugin extends BasePlugin {
);
plugin._logger.debug('%s plugin outgoingRequest', plugin.moduleName);
- plugin._tracer.bind(request);
+ context.bind(request);
return plugin._traceClientRequest(request, optionsParsed, span);
};
}
@@ -442,7 +443,7 @@ export class HttpPlugin extends BasePlugin {
: this._config.requireParentforIncomingSpans;
let span: Span;
- const currentSpan = this._tracer.getCurrentSpan();
+ const currentSpan = getSpan(context.active());
if (requireParent === true && currentSpan === undefined) {
// TODO: Refactor this when a solution is found in
diff --git a/packages/opentelemetry-plugin-http/src/version.ts b/packages/opentelemetry-plugin-http/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-plugin-http/src/version.ts
+++ b/packages/opentelemetry-plugin-http/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-plugin-http/test/functionals/http-disable.test.ts b/packages/opentelemetry-plugin-http/test/functionals/http-disable.test.ts
index 3b80fe84ba..9ed917b509 100644
--- a/packages/opentelemetry-plugin-http/test/functionals/http-disable.test.ts
+++ b/packages/opentelemetry-plugin-http/test/functionals/http-disable.test.ts
@@ -13,8 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import { NoopTracerProvider, NOOP_TRACER } from '@opentelemetry/api';
-import { NoopLogger } from '@opentelemetry/core';
+import {
+ NoopTracerProvider,
+ NoopLogger,
+ NOOP_TRACER,
+} from '@opentelemetry/api';
import * as assert from 'assert';
import * as http from 'http';
import { AddressInfo } from 'net';
@@ -49,7 +52,6 @@ describe('HttpPlugin', () => {
beforeEach(() => {
NOOP_TRACER.startSpan = sinon.spy();
- NOOP_TRACER.withSpan = sinon.spy();
});
afterEach(() => {
@@ -73,10 +75,6 @@ describe('HttpPlugin', () => {
);
assert.strictEqual(http.Server.prototype.emit.__wrapped, undefined);
- assert.strictEqual(
- (NOOP_TRACER.withSpan as sinon.SinonSpy).called,
- false
- );
});
});
});
diff --git a/packages/opentelemetry-plugin-http/test/functionals/http-enable.test.ts b/packages/opentelemetry-plugin-http/test/functionals/http-enable.test.ts
index c453bbf316..b34816f76a 100644
--- a/packages/opentelemetry-plugin-http/test/functionals/http-enable.test.ts
+++ b/packages/opentelemetry-plugin-http/test/functionals/http-enable.test.ts
@@ -19,9 +19,10 @@ import {
propagation,
Span as ISpan,
SpanKind,
- getActiveSpan,
+ NoopLogger,
+ getSpan,
+ setSpan,
} from '@opentelemetry/api';
-import { NoopLogger } from '@opentelemetry/core';
import { NodeTracerProvider } from '@opentelemetry/node';
import {
InMemorySpanExporter,
@@ -338,7 +339,7 @@ describe('HttpPlugin', () => {
doNock(hostname, testPath, 200, 'Ok');
const name = 'TestRootSpan';
const span = provider.getTracer('default').startSpan(name);
- return provider.getTracer('default').withSpan(span, async () => {
+ return context.with(setSpan(context.active(), span), async () => {
const result = await httpRequest.get(
`${protocol}://${hostname}${testPath}`
);
@@ -381,7 +382,7 @@ describe('HttpPlugin', () => {
);
const name = 'TestRootSpan';
const span = provider.getTracer('default').startSpan(name);
- return provider.getTracer('default').withSpan(span, async () => {
+ return context.with(setSpan(context.active(), span), async () => {
const result = await httpRequest.get(
`${protocol}://${hostname}${testPath}`
);
@@ -420,7 +421,7 @@ describe('HttpPlugin', () => {
doNock(hostname, testPath, 200, 'Ok', num);
const name = 'TestRootSpan';
const span = provider.getTracer('default').startSpan(name);
- await provider.getTracer('default').withSpan(span, async () => {
+ await context.with(setSpan(context.active(), span), async () => {
for (let i = 0; i < num; i++) {
await httpRequest.get(`${protocol}://${hostname}${testPath}`);
const spans = memoryExporter.getFinishedSpans();
@@ -712,9 +713,9 @@ describe('HttpPlugin', () => {
});
it('should not set span as active in context for outgoing request', done => {
- assert.deepStrictEqual(getActiveSpan(context.active()), undefined);
+ assert.deepStrictEqual(getSpan(context.active()), undefined);
http.get(`${protocol}://${hostname}:${serverPort}/test`, res => {
- assert.deepStrictEqual(getActiveSpan(context.active()), undefined);
+ assert.deepStrictEqual(getSpan(context.active()), undefined);
done();
});
});
@@ -810,7 +811,7 @@ describe('HttpPlugin', () => {
const span = tracer.startSpan('parentSpan', {
kind: SpanKind.INTERNAL,
});
- tracer.withSpan(span, () => {
+ context.with(setSpan(context.active(), span), () => {
httpRequest
.get(`${protocol}://${hostname}:${serverPort}${testPath}`)
.then(result => {
diff --git a/packages/opentelemetry-plugin-http/test/functionals/http-package.test.ts b/packages/opentelemetry-plugin-http/test/functionals/http-package.test.ts
index e1d3cb72a4..31bb06f48a 100644
--- a/packages/opentelemetry-plugin-http/test/functionals/http-package.test.ts
+++ b/packages/opentelemetry-plugin-http/test/functionals/http-package.test.ts
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-import { context, SpanKind } from '@opentelemetry/api';
+import { context, SpanKind, NoopLogger } from '@opentelemetry/api';
import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
-import { NoopLogger } from '@opentelemetry/core';
import { NodeTracerProvider } from '@opentelemetry/node';
import {
InMemorySpanExporter,
diff --git a/packages/opentelemetry-plugin-http/test/functionals/utils.test.ts b/packages/opentelemetry-plugin-http/test/functionals/utils.test.ts
index 9bfd6126ed..c145413e9a 100644
--- a/packages/opentelemetry-plugin-http/test/functionals/utils.test.ts
+++ b/packages/opentelemetry-plugin-http/test/functionals/utils.test.ts
@@ -19,8 +19,8 @@ import {
ROOT_CONTEXT,
SpanKind,
TraceFlags,
+ NoopLogger,
} from '@opentelemetry/api';
-import { NoopLogger } from '@opentelemetry/core';
import { BasicTracerProvider, Span } from '@opentelemetry/tracing';
import { HttpAttribute } from '@opentelemetry/semantic-conventions';
import * as assert from 'assert';
diff --git a/packages/opentelemetry-plugin-http/test/integrations/http-enable.test.ts b/packages/opentelemetry-plugin-http/test/integrations/http-enable.test.ts
index 8ea38fea17..383a4b3b45 100644
--- a/packages/opentelemetry-plugin-http/test/integrations/http-enable.test.ts
+++ b/packages/opentelemetry-plugin-http/test/integrations/http-enable.test.ts
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-import { NoopLogger } from '@opentelemetry/core';
-import { SpanKind, Span, context } from '@opentelemetry/api';
+import { SpanKind, Span, context, NoopLogger } from '@opentelemetry/api';
import {
HttpAttribute,
GeneralAttribute,
diff --git a/packages/opentelemetry-plugin-http/test/utils/DummyPropagation.ts b/packages/opentelemetry-plugin-http/test/utils/DummyPropagation.ts
index 494062ae8e..d6a700549b 100644
--- a/packages/opentelemetry-plugin-http/test/utils/DummyPropagation.ts
+++ b/packages/opentelemetry-plugin-http/test/utils/DummyPropagation.ts
@@ -17,8 +17,8 @@ import {
Context,
TextMapPropagator,
TraceFlags,
- getParentSpanContext,
- setExtractedSpanContext,
+ getSpanContext,
+ setSpanContext,
} from '@opentelemetry/api';
import * as http from 'http';
@@ -33,12 +33,12 @@ export class DummyPropagation implements TextMapPropagator {
isRemote: true,
};
if (extractedSpanContext.traceId && extractedSpanContext.spanId) {
- return setExtractedSpanContext(context, extractedSpanContext);
+ return setSpanContext(context, extractedSpanContext);
}
return context;
}
inject(context: Context, headers: { [custom: string]: string }): void {
- const spanContext = getParentSpanContext(context);
+ const spanContext = getSpanContext(context);
if (!spanContext) return;
headers[DummyPropagation.TRACE_CONTEXT_KEY] = spanContext.traceId;
headers[DummyPropagation.SPAN_CONTEXT_KEY] = spanContext.spanId;
diff --git a/packages/opentelemetry-plugin-http/tsconfig.json b/packages/opentelemetry-plugin-http/tsconfig.json
index a2042cd68b..08f0364911 100644
--- a/packages/opentelemetry-plugin-http/tsconfig.json
+++ b/packages/opentelemetry-plugin-http/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,28 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-context-async-hooks"
+ },
+ {
+ "path": "../opentelemetry-context-base"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-node"
+ },
+ {
+ "path": "../opentelemetry-semantic-conventions"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ }
]
}
diff --git a/packages/opentelemetry-plugin-https/package.json b/packages/opentelemetry-plugin-https/package.json
index 0e96b067d4..0bddac44d7 100644
--- a/packages/opentelemetry-plugin-https/package.json
+++ b/packages/opentelemetry-plugin-https/package.json
@@ -1,21 +1,19 @@
{
"name": "@opentelemetry/plugin-https",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry https automatic instrumentation package.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
"tdd": "npm run test -- --watch-extensions ts --watch",
- "clean": "rimraf build/*",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile"
+ "version": "node ../../scripts/version-update.js"
},
"keywords": [
"opentelemetry",
@@ -42,10 +40,10 @@
"access": "public"
},
"devDependencies": {
- "@opentelemetry/context-async-hooks": "^0.13.0",
- "@opentelemetry/context-base": "^0.13.0",
- "@opentelemetry/node": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/context-async-hooks": "^0.14.0",
+ "@opentelemetry/context-base": "^0.14.0",
+ "@opentelemetry/node": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"@types/got": "9.6.11",
"@types/mocha": "8.2.0",
"@types/node": "14.14.12",
@@ -71,10 +69,10 @@
"typescript": "3.9.7"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/plugin-http": "^0.13.0",
- "@opentelemetry/semantic-conventions": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/plugin-http": "^0.14.0",
+ "@opentelemetry/semantic-conventions": "^0.14.0",
"semver": "^7.1.3",
"shimmer": "^1.2.1"
}
diff --git a/packages/opentelemetry-plugin-https/src/version.ts b/packages/opentelemetry-plugin-https/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-plugin-https/src/version.ts
+++ b/packages/opentelemetry-plugin-https/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-plugin-https/test/functionals/https-disable.test.ts b/packages/opentelemetry-plugin-https/test/functionals/https-disable.test.ts
index 9d0e8dece6..01b9b71900 100644
--- a/packages/opentelemetry-plugin-https/test/functionals/https-disable.test.ts
+++ b/packages/opentelemetry-plugin-https/test/functionals/https-disable.test.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { NoopLogger } from '@opentelemetry/core';
+import { NoopLogger } from '@opentelemetry/api';
import { Http } from '@opentelemetry/plugin-http';
import * as assert from 'assert';
import * as fs from 'fs';
@@ -64,7 +64,6 @@ describe('HttpsPlugin', () => {
beforeEach(() => {
tracer.startSpan = sinon.spy();
- tracer.withSpan = sinon.spy();
});
afterEach(() => {
@@ -88,7 +87,6 @@ describe('HttpsPlugin', () => {
);
assert.strictEqual(https.Server.prototype.emit.__wrapped, undefined);
- assert.strictEqual((tracer.withSpan as sinon.SinonSpy).called, false);
});
});
});
diff --git a/packages/opentelemetry-plugin-https/test/functionals/https-enable.test.ts b/packages/opentelemetry-plugin-https/test/functionals/https-enable.test.ts
index 10cc3aeb53..4123a046a6 100644
--- a/packages/opentelemetry-plugin-https/test/functionals/https-enable.test.ts
+++ b/packages/opentelemetry-plugin-https/test/functionals/https-enable.test.ts
@@ -20,8 +20,9 @@ import {
propagation,
Span as ISpan,
SpanKind,
+ NoopLogger,
+ setSpan,
} from '@opentelemetry/api';
-import { NoopLogger } from '@opentelemetry/core';
import { NodeTracerProvider } from '@opentelemetry/node';
import { Http, HttpPluginConfig } from '@opentelemetry/plugin-http';
import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
@@ -335,7 +336,7 @@ describe('HttpsPlugin', () => {
doNock(hostname, testPath, 200, 'Ok');
const name = 'TestRootSpan';
const span = tracer.startSpan(name);
- return tracer.withSpan(span, async () => {
+ return context.with(setSpan(context.active(), span), async () => {
const result = await httpsRequest.get(
`${protocol}://${hostname}${testPath}`
);
@@ -378,7 +379,7 @@ describe('HttpsPlugin', () => {
);
const name = 'TestRootSpan';
const span = tracer.startSpan(name);
- return tracer.withSpan(span, async () => {
+ return context.with(setSpan(context.active(), span), async () => {
const result = await httpsRequest.get(
`${protocol}://${hostname}${testPath}`
);
@@ -417,7 +418,7 @@ describe('HttpsPlugin', () => {
doNock(hostname, testPath, 200, 'Ok', num);
const name = 'TestRootSpan';
const span = tracer.startSpan(name);
- await tracer.withSpan(span, async () => {
+ await context.with(setSpan(context.active(), span), async () => {
for (let i = 0; i < num; i++) {
await httpsRequest.get(`${protocol}://${hostname}${testPath}`);
const spans = memoryExporter.getFinishedSpans();
diff --git a/packages/opentelemetry-plugin-https/test/functionals/https-package.test.ts b/packages/opentelemetry-plugin-https/test/functionals/https-package.test.ts
index ff7430afb3..daf3ac7e9e 100644
--- a/packages/opentelemetry-plugin-https/test/functionals/https-package.test.ts
+++ b/packages/opentelemetry-plugin-https/test/functionals/https-package.test.ts
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-import { context, Span, SpanKind } from '@opentelemetry/api';
+import { context, Span, SpanKind, NoopLogger } from '@opentelemetry/api';
import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
-import { NoopLogger } from '@opentelemetry/core';
import { NodeTracerProvider } from '@opentelemetry/node';
import { Http } from '@opentelemetry/plugin-http';
import {
diff --git a/packages/opentelemetry-plugin-https/test/integrations/https-enable.test.ts b/packages/opentelemetry-plugin-https/test/integrations/https-enable.test.ts
index ef291281f5..3fc48cdcad 100644
--- a/packages/opentelemetry-plugin-https/test/integrations/https-enable.test.ts
+++ b/packages/opentelemetry-plugin-https/test/integrations/https-enable.test.ts
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-import { NoopLogger } from '@opentelemetry/core';
import { HttpPluginConfig, Http } from '@opentelemetry/plugin-http';
-import { SpanKind, Span, context } from '@opentelemetry/api';
+import { SpanKind, Span, context, NoopLogger } from '@opentelemetry/api';
import {
HttpAttribute,
GeneralAttribute,
diff --git a/packages/opentelemetry-plugin-https/test/utils/DummyPropagation.ts b/packages/opentelemetry-plugin-https/test/utils/DummyPropagation.ts
index ea2a58fb70..4994bf3c94 100644
--- a/packages/opentelemetry-plugin-https/test/utils/DummyPropagation.ts
+++ b/packages/opentelemetry-plugin-https/test/utils/DummyPropagation.ts
@@ -17,8 +17,8 @@ import {
Context,
TextMapPropagator,
TraceFlags,
- setExtractedSpanContext,
- getParentSpanContext,
+ setSpanContext,
+ getSpanContext,
} from '@opentelemetry/api';
import * as http from 'http';
@@ -33,12 +33,12 @@ export class DummyPropagation implements TextMapPropagator {
isRemote: true,
};
if (extractedSpanContext.traceId && extractedSpanContext.spanId) {
- return setExtractedSpanContext(context, extractedSpanContext);
+ return setSpanContext(context, extractedSpanContext);
}
return context;
}
inject(context: Context, headers: { [custom: string]: string }): void {
- const spanContext = getParentSpanContext(context);
+ const spanContext = getSpanContext(context);
if (!spanContext) return;
headers[DummyPropagation.TRACE_CONTEXT_KEY] = spanContext.traceId;
headers[DummyPropagation.SPAN_CONTEXT_KEY] = spanContext.spanId;
diff --git a/packages/opentelemetry-plugin-https/tsconfig.json b/packages/opentelemetry-plugin-https/tsconfig.json
index a2042cd68b..b4393cd5ea 100644
--- a/packages/opentelemetry-plugin-https/tsconfig.json
+++ b/packages/opentelemetry-plugin-https/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,31 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-context-async-hooks"
+ },
+ {
+ "path": "../opentelemetry-context-base"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-node"
+ },
+ {
+ "path": "../opentelemetry-plugin-http"
+ },
+ {
+ "path": "../opentelemetry-semantic-conventions"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ }
]
}
diff --git a/packages/opentelemetry-propagator-b3/package.json b/packages/opentelemetry-propagator-b3/package.json
index 798a70a4e8..6598df1a9f 100644
--- a/packages/opentelemetry-propagator-b3/package.json
+++ b/packages/opentelemetry-propagator-b3/package.json
@@ -1,22 +1,19 @@
{
"name": "@opentelemetry/propagator-b3",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry B3 propagator provides context propagation for systems that are using the B3 header format",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "build": "npm run compile",
- "clean": "rimraf build/*",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
- "watch": "tsc -w"
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -42,10 +39,10 @@
"access": "public"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0"
+ "@opentelemetry/api": "^0.14.0"
},
"devDependencies": {
- "@opentelemetry/context-base": "^0.13.0",
+ "@opentelemetry/context-base": "^0.14.0",
"@types/mocha": "8.2.0",
"@types/node": "14.14.12",
"codecov": "3.8.1",
diff --git a/packages/opentelemetry-propagator-b3/src/B3MultiPropagator.ts b/packages/opentelemetry-propagator-b3/src/B3MultiPropagator.ts
index fda32b3545..7f0e414c05 100644
--- a/packages/opentelemetry-propagator-b3/src/B3MultiPropagator.ts
+++ b/packages/opentelemetry-propagator-b3/src/B3MultiPropagator.ts
@@ -16,11 +16,11 @@
import {
Context,
- getParentSpanContext,
+ getSpanContext,
isSpanContextValid,
isValidSpanId,
isValidTraceId,
- setExtractedSpanContext,
+ setSpanContext,
TextMapGetter,
TextMapPropagator,
TextMapSetter,
@@ -94,7 +94,7 @@ function getTraceFlags(
*/
export class B3MultiPropagator implements TextMapPropagator {
inject(context: Context, carrier: unknown, setter: TextMapSetter) {
- const spanContext = getParentSpanContext(context);
+ const spanContext = getSpanContext(context);
if (!spanContext || !isSpanContextValid(spanContext)) return;
const debug = context.getValue(B3_DEBUG_FLAG_KEY);
@@ -129,7 +129,7 @@ export class B3MultiPropagator implements TextMapPropagator {
isValidSampledValue(traceFlags)
) {
context = context.setValue(B3_DEBUG_FLAG_KEY, debug);
- return setExtractedSpanContext(context, {
+ return setSpanContext(context, {
traceId,
spanId,
isRemote: true,
diff --git a/packages/opentelemetry-propagator-b3/src/B3SinglePropagator.ts b/packages/opentelemetry-propagator-b3/src/B3SinglePropagator.ts
index 5c8a14a78a..91f8d7d00d 100644
--- a/packages/opentelemetry-propagator-b3/src/B3SinglePropagator.ts
+++ b/packages/opentelemetry-propagator-b3/src/B3SinglePropagator.ts
@@ -16,11 +16,11 @@
import {
Context,
- getParentSpanContext,
+ getSpanContext,
isSpanContextValid,
isValidSpanId,
isValidTraceId,
- setExtractedSpanContext,
+ setSpanContext,
TextMapGetter,
TextMapPropagator,
TextMapSetter,
@@ -53,7 +53,7 @@ function convertToTraceFlags(samplingState: string | undefined): TraceFlags {
*/
export class B3SinglePropagator implements TextMapPropagator {
inject(context: Context, carrier: unknown, setter: TextMapSetter) {
- const spanContext = getParentSpanContext(context);
+ const spanContext = getSpanContext(context);
if (!spanContext || !isSpanContextValid(spanContext)) return;
const samplingState =
@@ -81,7 +81,7 @@ export class B3SinglePropagator implements TextMapPropagator {
context = context.setValue(B3_DEBUG_FLAG_KEY, samplingState);
}
- return setExtractedSpanContext(context, {
+ return setSpanContext(context, {
traceId,
spanId,
isRemote: true,
diff --git a/packages/opentelemetry-propagator-b3/src/version.ts b/packages/opentelemetry-propagator-b3/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-propagator-b3/src/version.ts
+++ b/packages/opentelemetry-propagator-b3/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-propagator-b3/test/B3MultiPropagator.test.ts b/packages/opentelemetry-propagator-b3/test/B3MultiPropagator.test.ts
index f9d76d4e0a..b9f0ae0e0c 100644
--- a/packages/opentelemetry-propagator-b3/test/B3MultiPropagator.test.ts
+++ b/packages/opentelemetry-propagator-b3/test/B3MultiPropagator.test.ts
@@ -17,8 +17,8 @@
import {
defaultTextMapGetter,
defaultTextMapSetter,
- getParentSpanContext,
- setExtractedSpanContext,
+ getSpanContext,
+ setSpanContext,
SpanContext,
TraceFlags,
} from '@opentelemetry/api';
@@ -51,7 +51,7 @@ describe('B3MultiPropagator', () => {
};
b3Propagator.inject(
- setExtractedSpanContext(ROOT_CONTEXT, spanContext),
+ setSpanContext(ROOT_CONTEXT, spanContext),
carrier,
defaultTextMapSetter
);
@@ -87,7 +87,7 @@ describe('B3MultiPropagator', () => {
};
b3Propagator.inject(
- setExtractedSpanContext(ROOT_CONTEXT, spanContext),
+ setSpanContext(ROOT_CONTEXT, spanContext),
carrier,
defaultTextMapSetter
);
@@ -109,7 +109,7 @@ describe('B3MultiPropagator', () => {
const contextWithDebug = ROOT_CONTEXT.setValue(B3_DEBUG_FLAG_KEY, '1');
b3Propagator.inject(
- setExtractedSpanContext(contextWithDebug, spanContext),
+ setSpanContext(contextWithDebug, spanContext),
carrier,
defaultTextMapSetter
);
@@ -129,7 +129,7 @@ describe('B3MultiPropagator', () => {
traceFlags: TraceFlags.NONE,
};
b3Propagator.inject(
- setExtractedSpanContext(ROOT_CONTEXT, emptySpanContext),
+ setSpanContext(ROOT_CONTEXT, emptySpanContext),
carrier,
defaultTextMapSetter
);
@@ -149,7 +149,7 @@ describe('B3MultiPropagator', () => {
carrier,
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'b7ad6b7169203331',
traceId: '0af7651916cd43dd8448eb211c80319c',
@@ -170,7 +170,7 @@ describe('B3MultiPropagator', () => {
carrier,
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'b7ad6b7169203331',
@@ -192,7 +192,7 @@ describe('B3MultiPropagator', () => {
carrier,
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'b7ad6b7169203331',
@@ -214,7 +214,7 @@ describe('B3MultiPropagator', () => {
carrier,
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'b7ad6b7169203331',
@@ -238,7 +238,7 @@ describe('B3MultiPropagator', () => {
carrier,
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'b7ad6b7169203331',
@@ -263,7 +263,7 @@ describe('B3MultiPropagator', () => {
carrier,
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'b7ad6b7169203331',
@@ -286,7 +286,7 @@ describe('B3MultiPropagator', () => {
carrier,
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'b7ad6b7169203331',
@@ -309,7 +309,7 @@ describe('B3MultiPropagator', () => {
carrier,
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'b7ad6b7169203331',
@@ -332,7 +332,7 @@ describe('B3MultiPropagator', () => {
carrier,
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'b7ad6b7169203331',
@@ -350,7 +350,7 @@ describe('B3MultiPropagator', () => {
it('should return undefined', () => {
carrier[X_B3_TRACE_ID] = undefined;
carrier[X_B3_SPAN_ID] = 'b7ad6b7169203331';
- const context = getParentSpanContext(
+ const context = getSpanContext(
b3Propagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
);
assert.deepStrictEqual(context, undefined);
@@ -361,7 +361,7 @@ describe('B3MultiPropagator', () => {
it('should return undefined', () => {
carrier[X_B3_TRACE_ID] = '0af7651916cd43dd8448eb211c80319c';
carrier[X_B3_SPAN_ID] = undefined;
- const context = getParentSpanContext(
+ const context = getSpanContext(
b3Propagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
);
assert.deepStrictEqual(context, undefined);
@@ -373,7 +373,7 @@ describe('B3MultiPropagator', () => {
carrier[X_B3_TRACE_ID] = '0af7651916cd43dd8448eb211c80319c';
carrier[X_B3_SPAN_ID] = 'b7ad6b7169203331';
carrier[X_B3_SAMPLED] = '2';
- const context = getParentSpanContext(
+ const context = getSpanContext(
b3Propagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
);
assert.deepStrictEqual(context, undefined);
@@ -382,7 +382,7 @@ describe('B3MultiPropagator', () => {
describe('AND b3 header is missing', () => {
it('should return undefined', () => {
- const context = getParentSpanContext(
+ const context = getSpanContext(
b3Propagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
);
assert.deepStrictEqual(context, undefined);
@@ -393,7 +393,7 @@ describe('B3MultiPropagator', () => {
it('should return undefined', () => {
carrier[X_B3_TRACE_ID] = 'invalid!';
carrier[X_B3_SPAN_ID] = 'b7ad6b7169203331';
- const context = getParentSpanContext(
+ const context = getSpanContext(
b3Propagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
);
assert.deepStrictEqual(context, undefined);
@@ -410,7 +410,7 @@ describe('B3MultiPropagator', () => {
carrier,
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'b7ad6b7169203331',
traceId: '0af7651916cd43dd8448eb211c80319c',
@@ -459,7 +459,7 @@ describe('B3MultiPropagator', () => {
Object.getOwnPropertyNames(testCases).forEach(testCase => {
carrier[X_B3_TRACE_ID] = testCases[testCase];
- const extractedSpanContext = getParentSpanContext(
+ const extractedSpanContext = getSpanContext(
b3Propagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter)
);
assert.deepStrictEqual(extractedSpanContext, undefined, testCase);
@@ -495,7 +495,7 @@ describe('B3MultiPropagator', () => {
carrier,
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'b7ad6b7169203331',
diff --git a/packages/opentelemetry-propagator-b3/test/B3Propagator.test.ts b/packages/opentelemetry-propagator-b3/test/B3Propagator.test.ts
index b010b159b9..eb0aeb303d 100644
--- a/packages/opentelemetry-propagator-b3/test/B3Propagator.test.ts
+++ b/packages/opentelemetry-propagator-b3/test/B3Propagator.test.ts
@@ -20,8 +20,8 @@ import {
defaultTextMapSetter,
SpanContext,
TraceFlags,
- getParentSpanContext,
- setExtractedSpanContext,
+ getSpanContext,
+ setSpanContext,
} from '@opentelemetry/api';
import { ROOT_CONTEXT } from '@opentelemetry/context-base';
import { B3Propagator } from '../src/B3Propagator';
@@ -55,7 +55,7 @@ describe('B3Propagator', () => {
};
propagator.inject(
- setExtractedSpanContext(ROOT_CONTEXT, spanContext),
+ setSpanContext(ROOT_CONTEXT, spanContext),
carrier,
defaultTextMapSetter
);
@@ -76,7 +76,7 @@ describe('B3Propagator', () => {
};
propagator.inject(
- setExtractedSpanContext(ROOT_CONTEXT, spanContext),
+ setSpanContext(ROOT_CONTEXT, spanContext),
carrier,
defaultTextMapSetter
);
@@ -109,7 +109,7 @@ describe('B3Propagator', () => {
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'e457b5a2e4d86bd1',
traceId: '80f198ee56343ba864fe8b2a57d3eff7',
@@ -125,7 +125,7 @@ describe('B3Propagator', () => {
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: '6e0c63257de34c92',
traceId: 'd4cda95b652f4a1592b449d5929fda1b',
@@ -141,7 +141,7 @@ describe('B3Propagator', () => {
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'e457b5a2e4d86bd1',
traceId: '80f198ee56343ba864fe8b2a57d3eff7',
diff --git a/packages/opentelemetry-propagator-b3/test/B3SinglePropagator.test.ts b/packages/opentelemetry-propagator-b3/test/B3SinglePropagator.test.ts
index a9baa6da54..e02fdae1cb 100644
--- a/packages/opentelemetry-propagator-b3/test/B3SinglePropagator.test.ts
+++ b/packages/opentelemetry-propagator-b3/test/B3SinglePropagator.test.ts
@@ -19,8 +19,8 @@ import {
defaultTextMapSetter,
INVALID_SPANID,
INVALID_TRACEID,
- getParentSpanContext,
- setExtractedSpanContext,
+ getSpanContext,
+ setSpanContext,
SpanContext,
TraceFlags,
} from '@opentelemetry/api';
@@ -49,7 +49,7 @@ describe('B3SinglePropagator', () => {
};
propagator.inject(
- setExtractedSpanContext(ROOT_CONTEXT, spanContext),
+ setSpanContext(ROOT_CONTEXT, spanContext),
carrier,
defaultTextMapSetter
);
@@ -66,7 +66,7 @@ describe('B3SinglePropagator', () => {
};
propagator.inject(
- setExtractedSpanContext(ROOT_CONTEXT, spanContext),
+ setSpanContext(ROOT_CONTEXT, spanContext),
carrier,
defaultTextMapSetter
);
@@ -85,7 +85,7 @@ describe('B3SinglePropagator', () => {
const context = ROOT_CONTEXT.setValue(B3_DEBUG_FLAG_KEY, 'd');
propagator.inject(
- setExtractedSpanContext(context, spanContext),
+ setSpanContext(context, spanContext),
carrier,
defaultTextMapSetter
);
@@ -102,7 +102,7 @@ describe('B3SinglePropagator', () => {
};
propagator.inject(
- setExtractedSpanContext(ROOT_CONTEXT, spanContext),
+ setSpanContext(ROOT_CONTEXT, spanContext),
carrier,
defaultTextMapSetter
);
@@ -118,7 +118,7 @@ describe('B3SinglePropagator', () => {
};
propagator.inject(
- setExtractedSpanContext(ROOT_CONTEXT, spanContext),
+ setSpanContext(ROOT_CONTEXT, spanContext),
carrier,
defaultTextMapSetter
);
@@ -140,7 +140,7 @@ describe('B3SinglePropagator', () => {
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'e457b5a2e4d86bd1',
traceId: '80f198ee56343ba864fe8b2a57d3eff7',
@@ -161,7 +161,7 @@ describe('B3SinglePropagator', () => {
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'e457b5a2e4d86bd1',
traceId: '80f198ee56343ba864fe8b2a57d3eff7',
@@ -182,7 +182,7 @@ describe('B3SinglePropagator', () => {
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'e457b5a2e4d86bd1',
traceId: '80f198ee56343ba864fe8b2a57d3eff7',
@@ -202,7 +202,7 @@ describe('B3SinglePropagator', () => {
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'e457b5a2e4d86bd1',
traceId: '00000000000000004aaba1a52cf8ee09',
@@ -223,7 +223,7 @@ describe('B3SinglePropagator', () => {
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(extractedSpanContext, {
spanId: 'e457b5a2e4d86bd1',
traceId: '80f198ee56343ba864fe8b2a57d3eff7',
@@ -244,7 +244,7 @@ describe('B3SinglePropagator', () => {
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(undefined, extractedSpanContext);
});
@@ -259,7 +259,7 @@ describe('B3SinglePropagator', () => {
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(undefined, extractedSpanContext);
});
@@ -274,7 +274,7 @@ describe('B3SinglePropagator', () => {
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(undefined, extractedSpanContext);
});
@@ -289,7 +289,7 @@ describe('B3SinglePropagator', () => {
defaultTextMapGetter
);
- const extractedSpanContext = getParentSpanContext(context);
+ const extractedSpanContext = getSpanContext(context);
assert.deepStrictEqual(undefined, extractedSpanContext);
});
});
diff --git a/packages/opentelemetry-propagator-b3/tsconfig.json b/packages/opentelemetry-propagator-b3/tsconfig.json
index a2042cd68b..6ab0e214c2 100644
--- a/packages/opentelemetry-propagator-b3/tsconfig.json
+++ b/packages/opentelemetry-propagator-b3/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,13 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-context-base"
+ }
]
}
diff --git a/packages/opentelemetry-resource-detector-aws/package.json b/packages/opentelemetry-resource-detector-aws/package.json
index e5bd9d4ec3..4631dbec91 100644
--- a/packages/opentelemetry-resource-detector-aws/package.json
+++ b/packages/opentelemetry-resource-detector-aws/package.json
@@ -1,21 +1,19 @@
{
"name": "@opentelemetry/resource-detector-aws",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry SDK resource detector for AWS",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "clean": "rimraf build/*",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile"
+ "version": "node ../../scripts/version-update.js"
},
"keywords": [
"opentelemetry",
@@ -56,8 +54,8 @@
"typescript": "3.9.7"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/resources": "^0.13.0"
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/resources": "^0.14.0"
}
}
diff --git a/packages/opentelemetry-resource-detector-aws/src/version.ts b/packages/opentelemetry-resource-detector-aws/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-resource-detector-aws/src/version.ts
+++ b/packages/opentelemetry-resource-detector-aws/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-resource-detector-aws/test/detectors/AwsBeanstalkDetector.test.ts b/packages/opentelemetry-resource-detector-aws/test/detectors/AwsBeanstalkDetector.test.ts
index 9ccebd7066..f132a8015c 100644
--- a/packages/opentelemetry-resource-detector-aws/test/detectors/AwsBeanstalkDetector.test.ts
+++ b/packages/opentelemetry-resource-detector-aws/test/detectors/AwsBeanstalkDetector.test.ts
@@ -21,7 +21,7 @@ import {
assertEmptyResource,
assertServiceResource,
} from '@opentelemetry/resources/test/util/resource-assertions';
-import { NoopLogger } from '@opentelemetry/core';
+import { NoopLogger } from '@opentelemetry/api';
describe('BeanstalkResourceDetector', () => {
const err = new Error('failed to read config file');
diff --git a/packages/opentelemetry-resource-detector-aws/test/detectors/AwsEc2Detector.test.ts b/packages/opentelemetry-resource-detector-aws/test/detectors/AwsEc2Detector.test.ts
index 99461164fd..340328551b 100644
--- a/packages/opentelemetry-resource-detector-aws/test/detectors/AwsEc2Detector.test.ts
+++ b/packages/opentelemetry-resource-detector-aws/test/detectors/AwsEc2Detector.test.ts
@@ -22,7 +22,7 @@ import {
assertCloudResource,
assertHostResource,
} from '@opentelemetry/resources/test/util/resource-assertions';
-import { NoopLogger } from '@opentelemetry/core';
+import { NoopLogger } from '@opentelemetry/api';
const AWS_HOST = 'http://' + awsEc2Detector.AWS_IDMS_ENDPOINT;
const AWS_TOKEN_PATH = awsEc2Detector.AWS_INSTANCE_TOKEN_DOCUMENT_PATH;
diff --git a/packages/opentelemetry-resource-detector-aws/test/detectors/AwsEcsDetector.test.ts b/packages/opentelemetry-resource-detector-aws/test/detectors/AwsEcsDetector.test.ts
index e8bed2b3e5..857e40603d 100644
--- a/packages/opentelemetry-resource-detector-aws/test/detectors/AwsEcsDetector.test.ts
+++ b/packages/opentelemetry-resource-detector-aws/test/detectors/AwsEcsDetector.test.ts
@@ -24,7 +24,7 @@ import {
assertEmptyResource,
assertContainerResource,
} from '@opentelemetry/resources/test/util/resource-assertions';
-import { NoopLogger } from '@opentelemetry/core';
+import { NoopLogger } from '@opentelemetry/api';
import * as os from 'os';
describe('BeanstalkResourceDetector', () => {
diff --git a/packages/opentelemetry-resource-detector-aws/test/detectors/AwsEksDetector.test.ts b/packages/opentelemetry-resource-detector-aws/test/detectors/AwsEksDetector.test.ts
index ce350e2084..7356240bc3 100644
--- a/packages/opentelemetry-resource-detector-aws/test/detectors/AwsEksDetector.test.ts
+++ b/packages/opentelemetry-resource-detector-aws/test/detectors/AwsEksDetector.test.ts
@@ -24,7 +24,7 @@ import {
assertContainerResource,
assertEmptyResource,
} from '@opentelemetry/resources/test/util/resource-assertions';
-import { NoopLogger } from '@opentelemetry/core';
+import { NoopLogger } from '@opentelemetry/api';
const K8S_SVC_URL = awsEksDetector.K8S_SVC_URL;
const AUTH_CONFIGMAP_PATH = awsEksDetector.AUTH_CONFIGMAP_PATH;
diff --git a/packages/opentelemetry-resource-detector-aws/tsconfig.json b/packages/opentelemetry-resource-detector-aws/tsconfig.json
index e4b3b29e6a..954354a3a0 100644
--- a/packages/opentelemetry-resource-detector-aws/tsconfig.json
+++ b/packages/opentelemetry-resource-detector-aws/tsconfig.json
@@ -1,8 +1,22 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
},
- "include": ["src/**/*.ts", "test/**/*.ts"]
+ "include": [
+ "src/**/*.ts",
+ "test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-resources"
+ }
+ ]
}
diff --git a/packages/opentelemetry-resource-detector-gcp/package.json b/packages/opentelemetry-resource-detector-gcp/package.json
index af5980df07..7679978937 100644
--- a/packages/opentelemetry-resource-detector-gcp/package.json
+++ b/packages/opentelemetry-resource-detector-gcp/package.json
@@ -1,21 +1,19 @@
{
"name": "@opentelemetry/resource-detector-gcp",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry SDK resource detector for GCP",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "clean": "rimraf build/*",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile"
+ "version": "node ../../scripts/version-update.js"
},
"keywords": [
"opentelemetry",
@@ -41,7 +39,7 @@
"access": "public"
},
"devDependencies": {
- "@opentelemetry/core": "^0.13.0",
+ "@opentelemetry/core": "^0.14.0",
"@types/mocha": "8.2.0",
"@types/node": "14.14.12",
"@types/semver": "7.3.4",
@@ -56,7 +54,8 @@
"typescript": "3.9.7"
},
"dependencies": {
- "@opentelemetry/resources": "^0.13.0",
+ "@opentelemetry/api": "^0.13.0",
+ "@opentelemetry/resources": "^0.14.0",
"gcp-metadata": "^4.1.4",
"semver": "7.3.4"
}
diff --git a/packages/opentelemetry-resource-detector-gcp/src/version.ts b/packages/opentelemetry-resource-detector-gcp/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-resource-detector-gcp/src/version.ts
+++ b/packages/opentelemetry-resource-detector-gcp/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-resource-detector-gcp/test/detectors/GcpDetector.test.ts b/packages/opentelemetry-resource-detector-gcp/test/detectors/GcpDetector.test.ts
index 4d227919f2..f64e684d08 100644
--- a/packages/opentelemetry-resource-detector-gcp/test/detectors/GcpDetector.test.ts
+++ b/packages/opentelemetry-resource-detector-gcp/test/detectors/GcpDetector.test.ts
@@ -32,7 +32,7 @@ import {
assertContainerResource,
assertEmptyResource,
} from '@opentelemetry/resources/test/util/resource-assertions';
-import { NoopLogger } from '@opentelemetry/core';
+import { NoopLogger } from '@opentelemetry/api';
import { Resource } from '@opentelemetry/resources';
const HEADERS = {
diff --git a/packages/opentelemetry-resource-detector-gcp/tsconfig.json b/packages/opentelemetry-resource-detector-gcp/tsconfig.json
index e4b3b29e6a..6549996003 100644
--- a/packages/opentelemetry-resource-detector-gcp/tsconfig.json
+++ b/packages/opentelemetry-resource-detector-gcp/tsconfig.json
@@ -1,8 +1,19 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
},
- "include": ["src/**/*.ts", "test/**/*.ts"]
+ "include": [
+ "src/**/*.ts",
+ "test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-resources"
+ }
+ ]
}
diff --git a/packages/opentelemetry-resources/package.json b/packages/opentelemetry-resources/package.json
index d3c33aa208..daaaf6b81b 100644
--- a/packages/opentelemetry-resources/package.json
+++ b/packages/opentelemetry-resources/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/resources",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry SDK resources",
"main": "build/src/index.js",
"browser": {
@@ -10,16 +10,14 @@
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "clean": "rimraf build/*",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile"
+ "version": "node ../../scripts/version-update.js"
},
"keywords": [
"opentelemetry",
@@ -60,7 +58,7 @@
"typescript": "3.9.7"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0"
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0"
}
}
diff --git a/packages/opentelemetry-resources/src/platform/node/detect-resources.ts b/packages/opentelemetry-resources/src/platform/node/detect-resources.ts
index 37fa35278d..cb29dc7c40 100644
--- a/packages/opentelemetry-resources/src/platform/node/detect-resources.ts
+++ b/packages/opentelemetry-resources/src/platform/node/detect-resources.ts
@@ -19,9 +19,8 @@ import {
ResourceDetectionConfig,
ResourceDetectionConfigWithLogger,
} from '../../config';
-import { Logger } from '@opentelemetry/api';
+import { Logger, NoopLogger } from '@opentelemetry/api';
import * as util from 'util';
-import { NoopLogger } from '@opentelemetry/core';
/**
* Runs all resource detectors and returns the results merged into a single
diff --git a/packages/opentelemetry-resources/src/version.ts b/packages/opentelemetry-resources/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-resources/src/version.ts
+++ b/packages/opentelemetry-resources/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-resources/test/detectors/EnvDetector.test.ts b/packages/opentelemetry-resources/test/detectors/EnvDetector.test.ts
index df45725cb9..c2056d0031 100644
--- a/packages/opentelemetry-resources/test/detectors/EnvDetector.test.ts
+++ b/packages/opentelemetry-resources/test/detectors/EnvDetector.test.ts
@@ -19,7 +19,7 @@ import {
assertK8sResource,
assertEmptyResource,
} from '../util/resource-assertions';
-import { NoopLogger } from '@opentelemetry/core';
+import { NoopLogger } from '@opentelemetry/api';
describe('envDetector()', () => {
describe('with valid env', () => {
diff --git a/packages/opentelemetry-resources/test/detectors/ProcessDetector.test.ts b/packages/opentelemetry-resources/test/detectors/ProcessDetector.test.ts
index 9290ef5f63..c4f8ce9569 100644
--- a/packages/opentelemetry-resources/test/detectors/ProcessDetector.test.ts
+++ b/packages/opentelemetry-resources/test/detectors/ProcessDetector.test.ts
@@ -19,7 +19,7 @@ import {
assertProcessResource,
assertEmptyResource,
} from '../util/resource-assertions';
-import { NoopLogger } from '@opentelemetry/core';
+import { NoopLogger } from '@opentelemetry/api';
describe('processDetector()', () => {
let sandbox: sinon.SinonSandbox;
diff --git a/packages/opentelemetry-resources/tsconfig.json b/packages/opentelemetry-resources/tsconfig.json
index e4b3b29e6a..951358df05 100644
--- a/packages/opentelemetry-resources/tsconfig.json
+++ b/packages/opentelemetry-resources/tsconfig.json
@@ -1,8 +1,19 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
},
- "include": ["src/**/*.ts", "test/**/*.ts"]
+ "include": [
+ "src/**/*.ts",
+ "test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-core"
+ }
+ ]
}
diff --git a/packages/opentelemetry-sdk-node/package.json b/packages/opentelemetry-sdk-node/package.json
index bf79edfb10..eb2c7820af 100644
--- a/packages/opentelemetry-sdk-node/package.json
+++ b/packages/opentelemetry-sdk-node/package.json
@@ -1,21 +1,19 @@
{
"name": "@opentelemetry/sdk-node",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry SDK for Node.js",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "build": "npm run compile",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
- "watch": "tsc -w"
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -42,19 +40,19 @@
"access": "public"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/context-base": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/metrics": "^0.13.0",
- "@opentelemetry/node": "^0.13.0",
- "@opentelemetry/resource-detector-aws": "^0.13.0",
- "@opentelemetry/resource-detector-gcp": "^0.13.0",
- "@opentelemetry/resources": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/context-base": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/metrics": "^0.14.0",
+ "@opentelemetry/node": "^0.14.0",
+ "@opentelemetry/resource-detector-aws": "^0.14.0",
+ "@opentelemetry/resource-detector-gcp": "^0.14.0",
+ "@opentelemetry/resources": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0",
"nock": "12.0.3"
},
"devDependencies": {
- "@opentelemetry/context-async-hooks": "^0.13.0",
+ "@opentelemetry/context-async-hooks": "^0.14.0",
"@types/mocha": "8.2.0",
"@types/node": "14.14.12",
"@types/semver": "7.3.4",
diff --git a/packages/opentelemetry-sdk-node/src/version.ts b/packages/opentelemetry-sdk-node/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-sdk-node/src/version.ts
+++ b/packages/opentelemetry-sdk-node/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-sdk-node/tsconfig.json b/packages/opentelemetry-sdk-node/tsconfig.json
index a2042cd68b..544fb350f1 100644
--- a/packages/opentelemetry-sdk-node/tsconfig.json
+++ b/packages/opentelemetry-sdk-node/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,37 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-context-async-hooks"
+ },
+ {
+ "path": "../opentelemetry-context-base"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-metrics"
+ },
+ {
+ "path": "../opentelemetry-node"
+ },
+ {
+ "path": "../opentelemetry-resource-detector-aws"
+ },
+ {
+ "path": "../opentelemetry-resource-detector-gcp"
+ },
+ {
+ "path": "../opentelemetry-resources"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ }
]
}
diff --git a/packages/opentelemetry-semantic-conventions/package.json b/packages/opentelemetry-semantic-conventions/package.json
index 8f258d122f..4bf532c43e 100644
--- a/packages/opentelemetry-semantic-conventions/package.json
+++ b/packages/opentelemetry-semantic-conventions/package.json
@@ -1,21 +1,19 @@
{
"name": "@opentelemetry/semantic-conventions",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry semantic conventions",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
- "clean": "rimraf build/*",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
- "watch": "tsc -w"
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
diff --git a/packages/opentelemetry-semantic-conventions/src/version.ts b/packages/opentelemetry-semantic-conventions/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-semantic-conventions/src/version.ts
+++ b/packages/opentelemetry-semantic-conventions/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-semantic-conventions/tsconfig.json b/packages/opentelemetry-semantic-conventions/tsconfig.json
index 4f50329e88..a388bb16f9 100644
--- a/packages/opentelemetry-semantic-conventions/tsconfig.json
+++ b/packages/opentelemetry-semantic-conventions/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.es5",
+ "extends": "../../tsconfig.es5.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
diff --git a/packages/opentelemetry-shim-opentracing/package.json b/packages/opentelemetry-shim-opentracing/package.json
index b5043d870e..b428b529b3 100644
--- a/packages/opentelemetry-shim-opentracing/package.json
+++ b/packages/opentelemetry-shim-opentracing/package.json
@@ -1,21 +1,19 @@
{
"name": "@opentelemetry/shim-opentracing",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTracing to OpenTelemetry shim",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
"tdd": "npm run test -- --watch-extensions ts --watch",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "clean": "rimraf build/*",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile"
+ "version": "node ../../scripts/version-update.js"
},
"keywords": [
"opentelemetry",
@@ -40,7 +38,7 @@
"access": "public"
},
"devDependencies": {
- "@opentelemetry/tracing": "^0.13.0",
+ "@opentelemetry/tracing": "^0.14.0",
"@types/mocha": "8.2.0",
"@types/node": "14.14.12",
"codecov": "3.8.1",
@@ -55,8 +53,8 @@
"typescript": "3.9.7"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
"opentracing": "^0.14.4"
}
}
diff --git a/packages/opentelemetry-shim-opentracing/src/shim.ts b/packages/opentelemetry-shim-opentracing/src/shim.ts
index f24fb4c6a8..c6b41c9a9b 100644
--- a/packages/opentelemetry-shim-opentracing/src/shim.ts
+++ b/packages/opentelemetry-shim-opentracing/src/shim.ts
@@ -15,7 +15,6 @@
*/
import * as api from '@opentelemetry/api';
-import { NoopLogger } from '@opentelemetry/core';
import * as opentracing from 'opentracing';
import { Attributes, AttributeValue } from '@opentelemetry/api';
@@ -50,9 +49,9 @@ function translateSpanOptions(
function getContextWithParent(options: opentracing.SpanOptions) {
if (options.childOf) {
if (options.childOf instanceof SpanShim) {
- return api.setActiveSpan(api.context.active(), options.childOf.getSpan());
+ return api.setSpan(api.context.active(), options.childOf.getSpan());
} else if (options.childOf instanceof SpanContextShim) {
- return api.setExtractedSpanContext(
+ return api.setSpanContext(
api.context.active(),
options.childOf.getSpanContext()
);
@@ -126,7 +125,7 @@ export class TracerShim extends opentracing.Tracer {
super();
this._tracer = tracer;
- this._logger = logger || new NoopLogger();
+ this._logger = logger || new api.NoopLogger();
}
startSpan(
@@ -169,7 +168,7 @@ export class TracerShim extends opentracing.Tracer {
case opentracing.FORMAT_TEXT_MAP: {
api.propagation.inject(
api.setBaggage(
- api.setExtractedSpanContext(api.ROOT_CONTEXT, oTelSpanContext),
+ api.setSpanContext(api.ROOT_CONTEXT, oTelSpanContext),
oTelSpanBaggage
),
carrier
@@ -195,7 +194,7 @@ export class TracerShim extends opentracing.Tracer {
api.ROOT_CONTEXT,
carrier
);
- const spanContext = api.getParentSpanContext(context);
+ const spanContext = api.getSpanContext(context);
const baggage = api.getBaggage(context);
if (!spanContext) {
diff --git a/packages/opentelemetry-shim-opentracing/src/version.ts b/packages/opentelemetry-shim-opentracing/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-shim-opentracing/src/version.ts
+++ b/packages/opentelemetry-shim-opentracing/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-shim-opentracing/tsconfig.json b/packages/opentelemetry-shim-opentracing/tsconfig.json
index a2042cd68b..6f45e41147 100644
--- a/packages/opentelemetry-shim-opentracing/tsconfig.json
+++ b/packages/opentelemetry-shim-opentracing/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,16 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ }
]
}
diff --git a/packages/opentelemetry-tracing/package.json b/packages/opentelemetry-tracing/package.json
index 19c496c350..8b6ac004b2 100644
--- a/packages/opentelemetry-tracing/package.json
+++ b/packages/opentelemetry-tracing/package.json
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/tracing",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry Tracing",
"main": "build/src/index.js",
"browser": {
@@ -10,6 +10,8 @@
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/index-webpack.ts'",
"test:browser": "nyc karma start --single-run",
"tdd": "npm run tdd:node",
@@ -17,13 +19,9 @@
"tdd:browser": "karma start",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "clean": "rimraf build/*",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
- "watch": "tsc -w"
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -74,10 +72,10 @@
"webpack": "4.44.2"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/context-base": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/resources": "^0.13.0",
- "@opentelemetry/semantic-conventions": "^0.13.0"
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/context-base": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/resources": "^0.14.0",
+ "@opentelemetry/semantic-conventions": "^0.14.0"
}
}
diff --git a/packages/opentelemetry-tracing/src/Tracer.ts b/packages/opentelemetry-tracing/src/Tracer.ts
index db19b66c8a..fefdb00dfd 100644
--- a/packages/opentelemetry-tracing/src/Tracer.ts
+++ b/packages/opentelemetry-tracing/src/Tracer.ts
@@ -122,40 +122,6 @@ export class Tracer implements api.Tracer {
return span;
}
- /**
- * Returns the current Span from the current context.
- *
- * If there is no Span associated with the current context, undefined is returned.
- */
- getCurrentSpan(): api.Span | undefined {
- const ctx = api.context.active();
- // Get the current Span from the context or null if none found.
- return api.getActiveSpan(ctx);
- }
-
- /**
- * Enters the context of code where the given Span is in the current context.
- */
- withSpan ReturnType>(
- span: api.Span,
- fn: T
- ): ReturnType {
- // Set given span to context.
- return api.context.with(api.setActiveSpan(api.context.active(), span), fn);
- }
-
- /**
- * Bind a span (or the current one) to the target's context
- */
- bind(target: T, span?: api.Span): T {
- return api.context.bind(
- target,
- span
- ? api.setActiveSpan(api.context.active(), span)
- : api.context.active()
- );
- }
-
/** Returns the active {@link TraceParams}. */
getActiveTraceParams(): TraceParams {
return this._traceParams;
@@ -178,5 +144,5 @@ function getParent(
context: api.Context
): api.SpanContext | undefined {
if (options.root) return undefined;
- return api.getParentSpanContext(context);
+ return api.getSpanContext(context);
}
diff --git a/packages/opentelemetry-tracing/src/version.ts b/packages/opentelemetry-tracing/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-tracing/src/version.ts
+++ b/packages/opentelemetry-tracing/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts b/packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts
index fe212d351c..91e3332008 100644
--- a/packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts
+++ b/packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts
@@ -18,15 +18,15 @@ import {
context,
SpanContext,
TraceFlags,
- ContextManager,
ROOT_CONTEXT,
- setActiveSpan,
- setExtractedSpanContext,
+ NoopLogger,
+ setSpan,
+ setSpanContext,
+ getSpan,
} from '@opentelemetry/api';
import {
AlwaysOnSampler,
AlwaysOffSampler,
- NoopLogger,
NoRecordingSpan,
TraceState,
} from '@opentelemetry/core';
@@ -180,7 +180,7 @@ describe('BasicTracerProvider', () => {
const span = tracer.startSpan(
'my-span',
{},
- setExtractedSpanContext(ROOT_CONTEXT, {
+ setSpanContext(ROOT_CONTEXT, {
traceId: 'd4cda95b652f4a1592b449d5929fda1b',
spanId: '6e0c63257de34c92',
traceFlags: TraceFlags.SAMPLED,
@@ -201,7 +201,7 @@ describe('BasicTracerProvider', () => {
const childSpan = tracer.startSpan(
'child-span',
{},
- setActiveSpan(ROOT_CONTEXT, span)
+ setSpan(ROOT_CONTEXT, span)
);
const context = childSpan.context();
assert.strictEqual(context.traceId, span.context().traceId);
@@ -217,7 +217,7 @@ describe('BasicTracerProvider', () => {
const rootSpan = tracer.startSpan(
'root-span',
{ root: true },
- setActiveSpan(ROOT_CONTEXT, span)
+ setSpan(ROOT_CONTEXT, span)
);
const context = rootSpan.context();
assert.notStrictEqual(context.traceId, overrideParent.context().traceId);
@@ -230,7 +230,7 @@ describe('BasicTracerProvider', () => {
const span = tracer.startSpan(
'my-span',
{},
- setExtractedSpanContext(
+ setSpanContext(
ROOT_CONTEXT,
('invalid-parent' as unknown) as SpanContext
)
@@ -244,7 +244,7 @@ describe('BasicTracerProvider', () => {
const span = tracer.startSpan(
'my-span',
{},
- setExtractedSpanContext(ROOT_CONTEXT, {
+ setSpanContext(ROOT_CONTEXT, {
traceId: '0',
spanId: '0',
traceFlags: TraceFlags.SAMPLED,
@@ -291,24 +291,12 @@ describe('BasicTracerProvider', () => {
});
});
- describe('.getCurrentSpan()', () => {
- it('should return current span when it exists', () => {
- context.setGlobalContextManager({
- active: () => setActiveSpan(ROOT_CONTEXT, ('foo' as any) as Span),
- disable: () => {},
- } as ContextManager);
-
- const tracer = new BasicTracerProvider().getTracer('default');
- assert.deepStrictEqual(tracer.getCurrentSpan(), 'foo');
- });
- });
-
describe('.withSpan()', () => {
it('should run context with NoopContextManager context manager', done => {
const tracer = new BasicTracerProvider().getTracer('default');
const span = tracer.startSpan('my-span');
- tracer.withSpan(span, () => {
- assert.deepStrictEqual(tracer.getCurrentSpan(), undefined);
+ context.with(setSpan(context.active(), span), () => {
+ assert.deepStrictEqual(getSpan(context.active()), undefined);
return done();
});
});
@@ -319,10 +307,10 @@ describe('BasicTracerProvider', () => {
const tracer = new BasicTracerProvider().getTracer('default');
const span = tracer.startSpan('my-span');
const fn = () => {
- assert.deepStrictEqual(tracer.getCurrentSpan(), undefined);
+ assert.deepStrictEqual(getSpan(context.active()), undefined);
return done();
};
- const patchedFn = tracer.bind(fn, span);
+ const patchedFn = context.bind(fn, setSpan(context.active(), span));
return patchedFn();
});
});
diff --git a/packages/opentelemetry-tracing/test/Span.test.ts b/packages/opentelemetry-tracing/test/Span.test.ts
index 1b4819a43d..0ea733373f 100644
--- a/packages/opentelemetry-tracing/test/Span.test.ts
+++ b/packages/opentelemetry-tracing/test/Span.test.ts
@@ -22,13 +22,13 @@ import {
SpanContext,
SpanKind,
TraceFlags,
+ NoopLogger,
} from '@opentelemetry/api';
import {
hrTime,
hrTimeDuration,
hrTimeToMilliseconds,
hrTimeToNanoseconds,
- NoopLogger,
} from '@opentelemetry/core';
import { ExceptionAttribute } from '@opentelemetry/semantic-conventions';
import * as assert from 'assert';
diff --git a/packages/opentelemetry-tracing/test/Tracer.test.ts b/packages/opentelemetry-tracing/test/Tracer.test.ts
index 9e28fa46f8..288a823742 100644
--- a/packages/opentelemetry-tracing/test/Tracer.test.ts
+++ b/packages/opentelemetry-tracing/test/Tracer.test.ts
@@ -23,11 +23,11 @@ import {
TraceFlags,
ROOT_CONTEXT,
suppressInstrumentation,
+ NoopLogger,
} from '@opentelemetry/api';
import { BasicTracerProvider, Tracer, Span } from '../src';
import {
InstrumentationLibrary,
- NoopLogger,
AlwaysOnSampler,
AlwaysOffSampler,
} from '@opentelemetry/core';
diff --git a/packages/opentelemetry-tracing/test/export/InMemorySpanExporter.test.ts b/packages/opentelemetry-tracing/test/export/InMemorySpanExporter.test.ts
index 0cb9de0e53..3f8c916768 100644
--- a/packages/opentelemetry-tracing/test/export/InMemorySpanExporter.test.ts
+++ b/packages/opentelemetry-tracing/test/export/InMemorySpanExporter.test.ts
@@ -20,7 +20,7 @@ import {
SimpleSpanProcessor,
BasicTracerProvider,
} from '../../src';
-import { context, setActiveSpan } from '@opentelemetry/api';
+import { context, setSpan } from '@opentelemetry/api';
import { ExportResult, ExportResultCode } from '@opentelemetry/core';
describe('InMemorySpanExporter', () => {
@@ -37,10 +37,10 @@ describe('InMemorySpanExporter', () => {
const root = provider.getTracer('default').startSpan('root');
const child = provider
.getTracer('default')
- .startSpan('child', {}, setActiveSpan(context.active(), root));
+ .startSpan('child', {}, setSpan(context.active(), root));
const grandChild = provider
.getTracer('default')
- .startSpan('grand-child', {}, setActiveSpan(context.active(), child));
+ .startSpan('grand-child', {}, setSpan(context.active(), child));
assert.strictEqual(memoryExporter.getFinishedSpans().length, 0);
grandChild.end();
@@ -65,7 +65,7 @@ describe('InMemorySpanExporter', () => {
provider
.getTracer('default')
- .startSpan('child', {}, setActiveSpan(context.active(), root))
+ .startSpan('child', {}, setSpan(context.active(), root))
.end();
root.end();
assert.strictEqual(memoryExporter.getFinishedSpans().length, 2);
@@ -75,7 +75,7 @@ describe('InMemorySpanExporter', () => {
// after shutdown no new spans are accepted
provider
.getTracer('default')
- .startSpan('child1', {}, setActiveSpan(context.active(), root))
+ .startSpan('child1', {}, setSpan(context.active(), root))
.end();
assert.strictEqual(memoryExporter.getFinishedSpans().length, 0);
});
diff --git a/packages/opentelemetry-tracing/test/export/TestTracingSpanExporter.ts b/packages/opentelemetry-tracing/test/export/TestTracingSpanExporter.ts
index a5804e8af5..cff7c0e9f4 100644
--- a/packages/opentelemetry-tracing/test/export/TestTracingSpanExporter.ts
+++ b/packages/opentelemetry-tracing/test/export/TestTracingSpanExporter.ts
@@ -21,7 +21,8 @@ import {
Tracer,
SpanProcessor,
} from '../../src';
-import { ExportResult, NoopLogger, AlwaysOnSampler } from '@opentelemetry/core';
+import { ExportResult, AlwaysOnSampler } from '@opentelemetry/core';
+import { NoopLogger } from '@opentelemetry/api';
/**
* A test-only span exporter that naively simulates triggering instrumentation
diff --git a/packages/opentelemetry-tracing/tsconfig.json b/packages/opentelemetry-tracing/tsconfig.json
index a2042cd68b..62cad81a13 100644
--- a/packages/opentelemetry-tracing/tsconfig.json
+++ b/packages/opentelemetry-tracing/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
@@ -7,5 +7,22 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-context-base"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-resources"
+ },
+ {
+ "path": "../opentelemetry-semantic-conventions"
+ }
]
}
diff --git a/packages/opentelemetry-web/package.json b/packages/opentelemetry-web/package.json
index a88984f2e0..6ed5fc8373 100644
--- a/packages/opentelemetry-web/package.json
+++ b/packages/opentelemetry-web/package.json
@@ -1,22 +1,20 @@
{
"name": "@opentelemetry/web",
- "version": "0.13.0",
+ "version": "0.14.0",
"description": "OpenTelemetry Web Tracer",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
- "clean": "rimraf build/*",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile",
+ "version": "node ../../scripts/version-update.js",
"tdd": "karma start",
"test:browser": "nyc karma start --single-run",
- "watch": "tsc -w"
+ "watch": "tsc --build --watch"
},
"keywords": [
"opentelemetry",
@@ -44,9 +42,9 @@
},
"devDependencies": {
"@babel/core": "7.12.10",
- "@opentelemetry/context-zone": "^0.13.0",
- "@opentelemetry/propagator-b3": "^0.13.0",
- "@opentelemetry/resources": "^0.13.0",
+ "@opentelemetry/context-zone": "^0.14.0",
+ "@opentelemetry/propagator-b3": "^0.14.0",
+ "@opentelemetry/resources": "^0.14.0",
"@types/jquery": "3.5.5",
"@types/mocha": "8.2.0",
"@types/node": "14.14.12",
@@ -76,11 +74,11 @@
"webpack-merge": "5.6.1"
},
"dependencies": {
- "@opentelemetry/api": "^0.13.0",
- "@opentelemetry/context-base": "^0.13.0",
- "@opentelemetry/core": "^0.13.0",
- "@opentelemetry/instrumentation": "^0.13.0",
- "@opentelemetry/semantic-conventions": "^0.13.0",
- "@opentelemetry/tracing": "^0.13.0"
+ "@opentelemetry/api": "^0.14.0",
+ "@opentelemetry/context-base": "^0.14.0",
+ "@opentelemetry/core": "^0.14.0",
+ "@opentelemetry/instrumentation": "^0.14.0",
+ "@opentelemetry/semantic-conventions": "^0.14.0",
+ "@opentelemetry/tracing": "^0.14.0"
}
}
diff --git a/packages/opentelemetry-web/src/version.ts b/packages/opentelemetry-web/src/version.ts
index db447568f3..bc552fd543 100644
--- a/packages/opentelemetry-web/src/version.ts
+++ b/packages/opentelemetry-web/src/version.ts
@@ -15,4 +15,4 @@
*/
// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.13.0';
+export const VERSION = '0.14.0';
diff --git a/packages/opentelemetry-web/test/WebTracerProvider.test.ts b/packages/opentelemetry-web/test/WebTracerProvider.test.ts
index 281f901fc5..7cf43c2767 100644
--- a/packages/opentelemetry-web/test/WebTracerProvider.test.ts
+++ b/packages/opentelemetry-web/test/WebTracerProvider.test.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import { context } from '@opentelemetry/api';
+import { context, NoopLogger, getSpan, setSpan } from '@opentelemetry/api';
import { ContextManager } from '@opentelemetry/context-base';
import { ZoneContextManager } from '@opentelemetry/context-zone';
-import { BasePlugin, NoopLogger } from '@opentelemetry/core';
+import { BasePlugin } from '@opentelemetry/core';
import { InstrumentationBase } from '@opentelemetry/instrumentation';
import { B3Propagator } from '@opentelemetry/propagator-b3';
import { Resource, TELEMETRY_SDK_RESOURCE } from '@opentelemetry/resources';
@@ -133,9 +133,9 @@ describe('WebTracerProvider', () => {
const rootSpan = webTracerWithZone.startSpan('rootSpan');
- webTracerWithZone.withSpan(rootSpan, () => {
+ context.with(setSpan(context.active(), rootSpan), () => {
assert.ok(
- webTracerWithZone.getCurrentSpan() === rootSpan,
+ getSpan(context.active()) === rootSpan,
'Current span is rootSpan'
);
const concurrentSpan1 = webTracerWithZone.startSpan(
@@ -145,19 +145,19 @@ describe('WebTracerProvider', () => {
'concurrentSpan2'
);
- webTracerWithZone.withSpan(concurrentSpan1, () => {
+ context.with(setSpan(context.active(), concurrentSpan1), () => {
setTimeout(() => {
assert.ok(
- webTracerWithZone.getCurrentSpan() === concurrentSpan1,
+ getSpan(context.active()) === concurrentSpan1,
'Current span is concurrentSpan1'
);
}, 10);
});
- webTracerWithZone.withSpan(concurrentSpan2, () => {
+ context.with(setSpan(context.active(), concurrentSpan2), () => {
setTimeout(() => {
assert.ok(
- webTracerWithZone.getCurrentSpan() === concurrentSpan2,
+ getSpan(context.active()) === concurrentSpan2,
'Current span is concurrentSpan2'
);
done();
diff --git a/packages/opentelemetry-web/tsconfig.json b/packages/opentelemetry-web/tsconfig.json
index 71661a842e..950d91905b 100644
--- a/packages/opentelemetry-web/tsconfig.json
+++ b/packages/opentelemetry-web/tsconfig.json
@@ -1,5 +1,5 @@
{
- "extends": "../tsconfig.base",
+ "extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build",
@@ -8,5 +8,34 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
+ ],
+ "references": [
+ {
+ "path": "../opentelemetry-api"
+ },
+ {
+ "path": "../opentelemetry-context-base"
+ },
+ {
+ "path": "../opentelemetry-context-zone"
+ },
+ {
+ "path": "../opentelemetry-core"
+ },
+ {
+ "path": "../opentelemetry-instrumentation"
+ },
+ {
+ "path": "../opentelemetry-propagator-b3"
+ },
+ {
+ "path": "../opentelemetry-resources"
+ },
+ {
+ "path": "../opentelemetry-semantic-conventions"
+ },
+ {
+ "path": "../opentelemetry-tracing"
+ }
]
}
diff --git a/packages/template/.eslintignore b/packages/template/.eslintignore
new file mode 100644
index 0000000000..9ef96044fa
--- /dev/null
+++ b/packages/template/.eslintignore
@@ -0,0 +1,2 @@
+build
+
diff --git a/packages/template/.eslintrc.js b/packages/template/.eslintrc.js
new file mode 100644
index 0000000000..9dfe62f9b8
--- /dev/null
+++ b/packages/template/.eslintrc.js
@@ -0,0 +1,9 @@
+module.exports = {
+ "env": {
+ "mocha": true,
+ "commonjs": true,
+ "node": true,
+ "browser": true
+ },
+ ...require('../../eslint.config.js')
+}
diff --git a/packages/template/.npmignore b/packages/template/.npmignore
new file mode 100644
index 0000000000..9505ba9450
--- /dev/null
+++ b/packages/template/.npmignore
@@ -0,0 +1,4 @@
+/bin
+/coverage
+/doc
+/test
diff --git a/packages/template/LICENSE b/packages/template/LICENSE
new file mode 100644
index 0000000000..261eeb9e9f
--- /dev/null
+++ b/packages/template/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
diff --git a/packages/template/README.md b/packages/template/README.md
new file mode 100644
index 0000000000..e42517a3fa
--- /dev/null
+++ b/packages/template/README.md
@@ -0,0 +1,9 @@
+# `@opentelemetry/template`
+
+> TODO: description
+
+## Usage
+
+```typescript
+// TODO: DEMONSTRATE API
+```
diff --git a/packages/opentelemetry-core/src/common/NoopLogger.ts b/packages/template/karma.conf.js
similarity index 52%
rename from packages/opentelemetry-core/src/common/NoopLogger.ts
rename to packages/template/karma.conf.js
index b3db42c994..3019564a15 100644
--- a/packages/opentelemetry-core/src/common/NoopLogger.ts
+++ b/packages/template/karma.conf.js
@@ -1,11 +1,11 @@
-/*
+/*!
* 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
+ * 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,
@@ -14,19 +14,11 @@
* limitations under the License.
*/
-import { Logger } from '@opentelemetry/api';
+const karmaWebpackConfig = require('../../karma.webpack');
+const karmaBaseConfig = require('../../karma.base');
-/** No-op implementation of Logger */
-export class NoopLogger implements Logger {
- // By default does nothing
- debug(_message: string, ..._args: unknown[]) {}
-
- // By default does nothing
- error(_message: string, ..._args: unknown[]) {}
-
- // By default does nothing
- warn(_message: string, ..._args: unknown[]) {}
-
- // By default does nothing
- info(_message: string, ..._args: unknown[]) {}
-}
+module.exports = (config) => {
+ config.set(Object.assign({}, karmaBaseConfig, {
+ webpack: karmaWebpackConfig
+ }))
+};
diff --git a/packages/template/package.json b/packages/template/package.json
new file mode 100644
index 0000000000..60bd4ee71a
--- /dev/null
+++ b/packages/template/package.json
@@ -0,0 +1,87 @@
+{
+ "name": "@opentelemetry/template",
+ "version": "0.14.0",
+ "private": true,
+ "publishConfig": {
+ "access": "restricted"
+ },
+ "description": "> TODO: description",
+ "author": "OpenTelemetry Authors",
+ "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme",
+ "license": "Apache-2.0",
+ "main": "build/src/index.js",
+ "types": "build/src/index.d.ts",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/open-telemetry/opentelemetry-js.git"
+ },
+ "bugs": {
+ "url": "https://github.com/open-telemetry/opentelemetry-js/issues"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ },
+ "scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean"
+ },
+ "Add these to scripts": {
+ "compile": "tsc --build",
+ "clean": "tsc --build --clean",
+ "test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
+ "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
+ "lint": "eslint . --ext .ts",
+ "lint:fix": "eslint . --ext .ts --fix",
+ "version": "node ../../scripts/version-update.js",
+ "watch": "tsc --build --watch"
+ },
+ "Add these to scripts if browser is supported": {
+ "test:browser": "nyc karma start --single-run",
+ "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../"
+ },
+ "keywords": [
+ "opentelemetry",
+ "nodejs",
+ "browser",
+ "tracing",
+ "profiling",
+ "metrics",
+ "stats",
+ "monitoring"
+ ],
+ "files": [
+ "build/src/**/*.js",
+ "build/src/**/*.js.map",
+ "build/src/**/*.d.ts",
+ "LICENSE",
+ "README.md"
+ ],
+ "devDependencies": {
+ "@types/node": "14.14.12",
+ "typescript": "3.9.7"
+ },
+ "Add these to devDependencies for testing": {
+ "@types/mocha": "8.2.0",
+ "@types/sinon": "9.0.9",
+ "codecov": "3.8.1",
+ "istanbul-instrumenter-loader": "3.0.1",
+ "mocha": "7.2.0",
+ "nyc": "15.1.0",
+ "sinon": "9.2.2",
+ "ts-loader": "8.0.12",
+ "ts-mocha": "8.0.0"
+ },
+ "Add these to devDependencies if browser is targeted": {
+ "@types/webpack-env": "1.16.0",
+ "karma": "5.2.3",
+ "karma-chrome-launcher": "3.1.0",
+ "karma-coverage-istanbul-reporter": "3.0.3",
+ "karma-mocha": "2.0.1",
+ "karma-spec-reporter": "0.0.32",
+ "karma-webpack": "4.0.2",
+ "webpack": "4.44.2"
+ },
+ "Add these to devDependencies for linting": {
+ "gts": "2.0.2"
+ }
+}
diff --git a/packages/template/src/index.ts b/packages/template/src/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/template/tsconfig.json b/packages/template/tsconfig.json
new file mode 100644
index 0000000000..4ffdbb48ce
--- /dev/null
+++ b/packages/template/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "compilerOptions": {
+ "rootDir": ".",
+ "outDir": "build"
+ },
+ "include": [
+ "src/**/*.ts",
+ "test/**/*.ts"
+ ],
+ "references": [
+ ]
+}
diff --git a/packages/tsconfig.base.json b/tsconfig.base.json
similarity index 95%
rename from packages/tsconfig.base.json
rename to tsconfig.base.json
index 1b7e8c62dd..83c860a168 100644
--- a/packages/tsconfig.base.json
+++ b/tsconfig.base.json
@@ -2,6 +2,7 @@
"compilerOptions": {
"allowUnreachableCode": false,
"allowUnusedLabels": false,
+ "composite": true,
"declaration": true,
"declarationMap": true,
"forceConsistentCasingInFileNames": true,
diff --git a/packages/tsconfig.es5.json b/tsconfig.es5.json
similarity index 100%
rename from packages/tsconfig.es5.json
rename to tsconfig.es5.json
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000000..22efc769bc
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,117 @@
+{
+ "extends": "./tsconfig.base.json",
+ "files": [],
+ "references": [
+ {
+ "path": "backwards-compatability/node10"
+ },
+ {
+ "path": "backwards-compatability/node12"
+ },
+ {
+ "path": "backwards-compatability/node8"
+ },
+ {
+ "path": "packages/opentelemetry-api"
+ },
+ {
+ "path": "packages/opentelemetry-context-async-hooks"
+ },
+ {
+ "path": "packages/opentelemetry-context-base"
+ },
+ {
+ "path": "packages/opentelemetry-context-zone-peer-dep"
+ },
+ {
+ "path": "packages/opentelemetry-context-zone"
+ },
+ {
+ "path": "packages/opentelemetry-core"
+ },
+ {
+ "path": "packages/opentelemetry-exporter-collector-grpc"
+ },
+ {
+ "path": "packages/opentelemetry-exporter-collector-proto"
+ },
+ {
+ "path": "packages/opentelemetry-exporter-collector"
+ },
+ {
+ "path": "packages/opentelemetry-exporter-jaeger"
+ },
+ {
+ "path": "packages/opentelemetry-exporter-prometheus"
+ },
+ {
+ "path": "packages/opentelemetry-exporter-zipkin"
+ },
+ {
+ "path": "packages/opentelemetry-grpc-utils"
+ },
+ {
+ "path": "packages/opentelemetry-instrumentation-http"
+ },
+ {
+ "path": "packages/opentelemetry-instrumentation-xml-http-request"
+ },
+ {
+ "path": "packages/opentelemetry-instrumentation"
+ },
+ {
+ "path": "packages/opentelemetry-metrics"
+ },
+ {
+ "path": "packages/opentelemetry-node"
+ },
+ {
+ "path": "packages/opentelemetry-plugin-fetch"
+ },
+ {
+ "path": "packages/opentelemetry-plugin-grpc-js"
+ },
+ {
+ "path": "packages/opentelemetry-plugin-grpc"
+ },
+ {
+ "path": "packages/opentelemetry-plugin-http"
+ },
+ {
+ "path": "packages/opentelemetry-plugin-https"
+ },
+ {
+ "path": "packages/opentelemetry-propagator-b3"
+ },
+ {
+ "path": "packages/opentelemetry-resource-detector-aws"
+ },
+ {
+ "path": "packages/opentelemetry-resource-detector-gcp"
+ },
+ {
+ "path": "packages/opentelemetry-resources"
+ },
+ {
+ "path": "packages/opentelemetry-sdk-node"
+ },
+ {
+ "path": "packages/opentelemetry-semantic-conventions"
+ },
+ {
+ "path": "packages/opentelemetry-shim-opentracing"
+ },
+ {
+ "path": "packages/opentelemetry-tracing"
+ },
+ {
+ "path": "packages/opentelemetry-web"
+ },
+ {
+ "path": "packages/template"
+ },
+ {
+ "path": "integration-tests/propagation-validation-server"
+ }
+ ]
+}