-
----
-
-## About this project
-This is the JavaScript version of [OpenTelemetry](https://opentelemetry.io/), a framework for collecting traces and metrics from applications.
-
-## Quick start
-
-### Application Owner
-
-To get started tracing your own application, see the [Getting Started Guide](getting-started/README.md). For more information about automatic instrumentation see [@opentelemetry/node][otel-node], which provides auto-instrumentation for Node.js applications. If the automatic instrumentation does not suit your needs, or you would like to create manual traces, see [@opentelemetry/tracing][otel-tracing]
-
-### Library Author
-
-If you are a library author looking to build OpenTelemetry into your library, please see [the documentation][docs]. As a library author, it is important that you only depend on properties and methods published on the public API. If you use any properties or methods from the SDK that are not officially a part of the public API, your library may break if an [Application Owner](#application-owner) uses a different SDK implementation.
-
-## Release Schedule
-
-OpenTelemetry JS is under active development.
-This release isn't guaranteed to conform to a specific version of the specification, and future
-releases will not attempt to maintain backwards compatibility with the alpha release.
-
-| Component | Initial Version | Release Date |
-| --------------------------- | --------------- | ---------------- |
-| Tracing API | Alpha v0.1.0 | October 14 2019 |
-| Tracing SDK (Node and Web) | Alpha v0.1.0 | October 14 2019 |
-| Jaeger Trace Exporter | Alpha v0.1.0 | October 14 2019 |
-| Trace Context Propagation | Alpha v0.1.0 | October 14 2019 |
-| Zipkin Trace Exporter | Alpha v0.1.0 | October 14 2019 |
-| OpenTracing Bridge | Alpha v0.1.0 | October 14 2019 |
-| Metrics API | Alpha v0.2.0 | November 04 2019 |
-| Metrics SDK | Alpha v0.2.0 | November 04 2019 |
-| Prometheus Metric Exporter | Alpha v0.3.0 | December 13 2019 |
-| Resources | Beta v0.5.0 | March 16 2020 |
-| Metrics SDK (Complete) | Beta v0.5.0 | March 16 2020 |
-| OpenCensus Bridge | Unknown | Unknown |
-| Support for Tags/Baggage | Unknown | Unknown |
-
-## Feature Status
-
-Last updated March 2020
-
-| Feature | API Status | Specification Target | SDK Status |
-| ------------------- | ---------- | -------------------- | ----------- |
-| Tracing | Beta | v0.3 | Beta |
-| Metrics | Beta | v0.3 | Beta |
-| Context | Beta | v0.3 | Beta |
-| Propagation | Beta | v0.3 | Beta |
-| Correlation Context | Alpha | v0.3 | Development |
-| OpenTracing Bridge | N/A | v0.3 | Beta |
-| Resources | N/A | v0.3 | Beta |
-
-See the [project
-milestones](https://github.com/open-telemetry/opentelemetry-js/milestones)
-for details on upcoming releases. The dates and features described here are
-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.
-
-We have a weekly SIG meeting! See the [community page](https://github.com/open-telemetry/community#javascript-sdk) for meeting details and notes.
-
-Approvers ([@open-telemetry/js-approvers](https://github.com/orgs/open-telemetry/teams/javascript-approvers)):
-
-- [Roch Devost](https://github.com/rochdev), DataDog
-- [Brandon Gonzalez](https://github.com/bg451), LightStep
-- [Olivier Albertini](https://github.com/OlivierAlbertini), Ville de Montréal
-- [Valentin Marchaud](https://github.com/vmarchaud), Open Source Contributor
-- [Mark Wolff](https://github.com/markwolff), Microsoft
-- [Bartlomiej Obecny](https://github.com/obecny), LightStep
-
-*Find more about the approver role in [community repository](https://github.com/open-telemetry/community/blob/master/community-membership.md#approver).*
-
-Maintainers ([@open-telemetry/js-maintainers](https://github.com/orgs/open-telemetry/teams/javascript-maintainers)):
-
-- [Mayur Kale](https://github.com/mayurkale22), Google
-- [Daniel Dyla](https://github.com/dyladan), Dynatrace
-
-*Find more about the maintainer role in [community repository](https://github.com/open-telemetry/community/blob/master/community-membership.md#maintainer).*
-
-## Packages
-
-### API
-
-| Package | Description |
-| ----------------------- | -----------------|
-| [@opentelemetry/api][otel-api] | This package provides TypeScript interfaces, enums and no-op implementations for the OpenTelemetry core trace and metrics model. It is intended for use both on the server and in the browser. |
-| [@opentelemetry/core][otel-core] | This package provides default and no-op implementations of the OpenTelemetry api for trace and metrics. It's intended for use both on the server and in the browser. |
-
-### Implementation / SDKs
-
-| Package | Description |
-| ----------------------- | -----------------|
-| [@opentelemetry/tracing][otel-tracing] | This module provides a full control over instrumentation and span creation. It doesn't load [`async_hooks`](https://nodejs.org/api/async_hooks.html) or any instrumentation plugin by default. It is intended for use both on the server and in the browser. |
-| [@opentelemetry/metrics][otel-metrics] | This module provides instruments and meters for reporting of time series data. |
-| [@opentelemetry/node][otel-node] | This module provides automatic tracing for Node.js applications. It is intended for use on the server only. |
-| [@opentelemetry/web][otel-web] | This module provides automated instrumentation and tracing for Web applications. It is intended for use in the browser only. |
-| [@opentelemetry/base][otel-base] | This package provides base code for the SDK packages (tracing and metrics). |
-
-### Exporters
-
-OpenTelemetry is vendor-agnostic and can upload data to any backend with various exporter implementations. Even though, OpenTelemetry provides support for many backends, vendors/users can also implement their own exporters for proprietary and unofficially supported backends. Currently, OpenTelemetry supports:
-
-#### Trace Exporters
-- [@opentelemetry/exporter-jaeger][otel-exporter-jaeger]
-- [@opentelemetry/exporter-zipkin][otel-exporter-zipkin]
-- [@opentelemetry/exporter-collector][otel-exporter-collector]
-
-#### Metric Exporters
-- [@opentelemetry/exporter-prometheus][otel-exporter-prometheus]
-
-### Plugins
-
-OpenTelemetry can collect tracing data automatically using plugins. Vendors/Users can also create and use their own. Currently, OpenTelemetry supports automatic tracing for:
-
-#### Node Plugins
-- [@opentelemetry/plugin-grpc][otel-plugin-grpc]
-- [@opentelemetry/plugin-http][otel-plugin-http]
-- [@opentelemetry/plugin-https][otel-plugin-https]
-- [@opentelemetry/plugin-mongodb][otel-plugin-mongodb]
-- [@opentelemetry/plugin-mysql][otel-plugin-mysql]
-- [@opentelemetry/plugin-pg][otel-plugin-pg]
-- [@opentelemetry/plugin-pg-pool][otel-plugin-pg-pool]
-- [@opentelemetry/plugin-redis][otel-plugin-redis]
-- [@opentelemetry/plugin-ioredis][otel-plugin-ioredis]
-- [@opentelemetry/plugin-dns][otel-plugin-dns] - By default, this plugin is not loaded [#612](https://github.com/open-telemetry/opentelemetry-js/issues/612)
-- [@opentelemetry/plugin-express][otel-plugin-express] - By default, this plugin is not loaded
-
-#### Web Plugins
-- [@opentelemetry/plugin-document-load][otel-plugin-document-load]
-- [@opentelemetry/plugin-xml-http-request][otel-plugin-xml-http-request]
-- [@opentelemetry/plugin-user-interaction][otel-plugin-user-interaction]
-
-To request automatic tracing support for a module not on this list, please [file an issue](https://github.com/open-telemetry/opentelemetry-js/issues). Alternatively, you can [write a plugin yourself](https://github.com/open-telemetry/opentelemetry-js/blob/master/doc/plugin-guide.md).
-
-### Shims
-
-| Package | Description |
-| ----------------------- | -----------------|
-| [@opentelemetry/shim-opentracing][otel-shim-opentracing] | OpenTracing shim allows existing OpenTracing instrumentation to report to OpenTelemetry |
-
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For help or feedback on this project, join us on [gitter][node-gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[node-gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-
-[up-for-grabs-issues]: https://github.com/open-telemetry/OpenTelemetry-js/issues?q=is%3Aissue+is%3Aopen+label%3Aup-for-grabs
-[good-first-issues]: https://github.com/open-telemetry/OpenTelemetry-js/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22
-
-[docs]: https://open-telemetry.github.io/opentelemetry-js
-
-[otel-base]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-base
-[otel-exporter-collector]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-exporter-collector
-[otel-exporter-jaeger]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-exporter-jaeger
-[otel-exporter-prometheus]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-exporter-prometheus
-[otel-exporter-zipkin]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-exporter-zipkin
-[otel-metrics]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-metrics
-[otel-node]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-node
-[otel-plugin-dns]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-dns
-[otel-plugin-document-load]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-document-load
-[otel-plugin-grpc]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-grpc
-[otel-plugin-http]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-http
-[otel-plugin-https]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-https
-[otel-plugin-ioredis]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-ioredis
-[otel-plugin-mongodb]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-mongodb
-[otel-plugin-mysql]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-mysql
-[otel-plugin-pg-pool]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool
-[otel-plugin-pg]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg
-[otel-plugin-redis]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-redis
-[otel-plugin-user-interaction]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-user-interaction
-[otel-plugin-xml-http-request]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-xml-http-request
-[otel-plugin-express]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-express
-[otel-shim-opentracing]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-shim-opentracing
-[otel-tracing]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-tracing
-[otel-web]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-web
-[otel-api]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-api
-[otel-core]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-core
-[generate-api-documentation]: https://github.com/open-telemetry/opentelemetry-js/blob/master/CONTRIBUTING.md#generating-api-documentation
+# TODO
diff --git a/benchmark/README.md b/benchmark/README.md
deleted file mode 100644
index 0cb629d526..0000000000
--- a/benchmark/README.md
+++ /dev/null
@@ -1,119 +0,0 @@
-# Benchmarks
-
-## How to run
-
-To run your benchmark, just:
-```sh
-$ npm run bench
-```
-
-The minimum sample size is set to 10 to perform statistical analysis on benchmark, you can re-configure that in `benchmark.js`.
-
-> NOTE: If you're interested in writing benchmark for other APIs, please write a benchmark in the `benchmark/index.js` module. Please refer to the `benchmark/tracer.js` or `benchmark/propagator.js` for more comprehensive examples.
-
-## Results
-
-### `v0.5.0` release
-
-```
-Beginning NoopTracerProvider Benchmark...
- 5 tests completed.
-
- #startSpan x 766,888,261 ops/sec ±1.81% (20 runs sampled)
- #startSpan:parent x 755,332,363 ops/sec ±1.51% (20 runs sampled)
- #startSpan with attribute x 765,932,668 ops/sec ±1.45% (20 runs sampled)
- #startSpan with 30 attributes x 1,333,216 ops/sec ±10.66% (20 runs sampled)
- #startSpan with 100 attributes x 477,974 ops/sec ±3.66% (20 runs sampled)
-
-Beginning BasicTracerProvider Benchmark...
- 5 tests completed.
-
- #startSpan x 94,710 ops/sec ±19.20% (20 runs sampled)
- #startSpan:parent x 62,938 ops/sec ±3.77% (20 runs sampled)
- #startSpan with attribute x 93,389 ops/sec ±7.70% (20 runs sampled)
- #startSpan with 30 attributes x 33,753 ops/sec ±8.07% (20 runs sampled)
- #startSpan with 100 attributes x 2,497 ops/sec ±14.78% (20 runs sampled)
-
-Beginning BasicTracerProvider with SimpleSpanProcessor Benchmark...
- 5 tests completed.
-
- #startSpan x 100,159 ops/sec ±7.17% (20 runs sampled)
- #startSpan:parent x 63,848 ops/sec ±5.78% (20 runs sampled)
- #startSpan with attribute x 96,301 ops/sec ±9.39% (20 runs sampled)
- #startSpan with 30 attributes x 36,410 ops/sec ±2.21% (20 runs sampled)
- #startSpan with 100 attributes x 3,549 ops/sec ±3.33% (20 runs sampled)
-
-Beginning BasicTracerProvider with BatchSpanProcessor Benchmark...
- 5 tests completed.
-
- #startSpan x 90,992 ops/sec ±17.91% (20 runs sampled)
- #startSpan:parent x 64,590 ops/sec ±4.18% (20 runs sampled)
- #startSpan with attribute x 107,706 ops/sec ±2.21% (20 runs sampled)
- #startSpan with 30 attributes x 24,199 ops/sec ±45.57% (20 runs sampled)
- #startSpan with 100 attributes x 2,645 ops/sec ±9.86% (20 runs sampled)
-
-Beginning B3Propagator Benchmark...
- 2 tests completed.
-
- #Inject x 2,018,725 ops/sec ±3.49% (100 runs sampled)
- #Extract x 2,040,891 ops/sec ±1.75% (100 runs sampled)
-
-Beginning HttpTraceContext Benchmark...
- 2 tests completed.
-
- #Inject x 3,987,007 ops/sec ±1.87% (100 runs sampled)
- #Extract x 1,792,743 ops/sec ±0.93% (100 runs sampled)
-```
-
-### `v0.3.3` release
-
-```
-Beginning NoopTracerProvider Benchmark...
- 5 tests completed.
-
- #startSpan x 731,516,636 ops/sec ±2.57% (20 runs sampled)
- #startSpan:parent x 744,353,590 ops/sec ±3.03% (20 runs sampled)
- #startSpan with attribute x 737,451,332 ops/sec ±3.75% (20 runs sampled)
- #startSpan with 30 attributes x 1,658,688 ops/sec ±1.23% (20 runs sampled)
- #startSpan with 100 attributes x 535,082 ops/sec ±1.55% (20 runs sampled)
-
-Beginning BasicTracerProvider Benchmark...
- 5 tests completed.
-
- #startSpan x 80,633 ops/sec ±3.57% (20 runs sampled)
- #startSpan:parent x 56,228 ops/sec ±2.18% (20 runs sampled)
- #startSpan with attribute x 86,710 ops/sec ±1.80% (20 runs sampled)
- #startSpan with 30 attributes x 36,331 ops/sec ±1.29% (20 runs sampled)
- #startSpan with 100 attributes x 3,549 ops/sec ±3.59% (20 runs sampled)
-
-Beginning BasicTracerProvider with SimpleSpanProcessor Benchmark...
- 5 tests completed.
-
- #startSpan x 74,539 ops/sec ±4.49% (20 runs sampled)
- #startSpan:parent x 48,953 ops/sec ±4.98% (20 runs sampled)
- #startSpan with attribute x 79,686 ops/sec ±2.54% (20 runs sampled)
- #startSpan with 30 attributes x 26,491 ops/sec ±13.68% (20 runs sampled)
- #startSpan with 100 attributes x 2,464 ops/sec ±19.64% (20 runs sampled)
-
-Beginning BasicTracerProvider with BatchSpanProcessor Benchmark...
- 5 tests completed.
-
- #startSpan x 74,974 ops/sec ±3.57% (20 runs sampled)
- #startSpan:parent x 42,390 ops/sec ±20.68% (20 runs sampled)
- #startSpan with attribute x 76,497 ops/sec ±2.93% (20 runs sampled)
- #startSpan with 30 attributes x 33,042 ops/sec ±2.03% (20 runs sampled)
- #startSpan with 100 attributes x 3,459 ops/sec ±4.56% (20 runs sampled)
-
-
-Beginning B3Propagator Benchmark...
- 2 tests completed.
-
- #Inject x 5,086,366 ops/sec ±3.18% (100 runs sampled)
- #Extract x 4,859,557 ops/sec ±3.80% (100 runs sampled)
-
-Beginning HttpTraceContext Benchmark...
- 2 tests completed.
-
- #Inject x 13,660,710 ops/sec ±1.84% (100 runs sampled)
- #Extract x 1,692,010 ops/sec ±0.83% (100 runs sampled)
-```
diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js
deleted file mode 100644
index 8bc04a47b5..0000000000
--- a/benchmark/benchmark.js
+++ /dev/null
@@ -1,22 +0,0 @@
-'use strict';
-
-const Benchmark = require('benchmark');
-const benchmarks = require('beautify-benchmark');
-
-Benchmark.options.maxTime = 0;
-
-module.exports = (minSamples) => {
- Benchmark.options.minSamples = minSamples;
- const suite = new Benchmark.Suite();
-
- return suite
- .on('cycle', event => {
- benchmarks.add(event.target);
- })
- .on('error', event => {
- throw event.target.error;
- })
- .on('complete', function () {
- benchmarks.log();
- });
-};
diff --git a/benchmark/index.js b/benchmark/index.js
deleted file mode 100644
index 745b93b75a..0000000000
--- a/benchmark/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-const execSync = require('child_process').execSync;
-const exec = cmd => execSync(cmd, { stdio: [0, 1, 2] });
-
-exec('node benchmark/tracer.js');
-exec('node benchmark/propagator.js');
diff --git a/benchmark/propagator.js b/benchmark/propagator.js
deleted file mode 100644
index 33e4c5865a..0000000000
--- a/benchmark/propagator.js
+++ /dev/null
@@ -1,45 +0,0 @@
-'use strict';
-
-const benchmark = require('./benchmark');
-const opentelemetry = require('../packages/opentelemetry-core');
-const api = require('../packages/opentelemetry-api');
-const { Context } = require('../packages/opentelemetry-context-base');
-
-const setups = [
- {
- name: 'B3Propagator',
- propagator: new opentelemetry.B3Propagator(),
- injectCarrier: {},
- extractCarrier: {
- 'x-b3-traceid': 'd4cda95b652f4a1592b449d5929fda1b',
- 'x-b3-spanid': '6e0c63257de34c92'
- }
- },
- {
- name: 'HttpTraceContext',
- propagator: new opentelemetry.HttpTraceContext(),
- injectCarrier: {},
- extractCarrier: {
- traceparent: '00-d4cda95b652f4a1592b449d5929fda1b-6e0c63257de34c92-00'
- }
- }
-];
-
-for (const setup of setups) {
- console.log(`Beginning ${setup.name} Benchmark...`);
- const propagator = setup.propagator;
- const suite = benchmark(100)
- .add('#Inject', function () {
- propagator.inject(
- opentelemetry.setExtractedSpanContext(Context.ROOT_CONTEXT, {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92'
- }), setup.injectCarrier, api.defaultSetter);
- })
- .add('#Extract', function () {
- propagator.extract(Context.ROOT_CONTEXT, setup.extractCarrier, api.defaultGetter);
- });
-
- // run async
- suite.run({ async: false });
-}
diff --git a/benchmark/tracer.js b/benchmark/tracer.js
deleted file mode 100644
index ab636e924e..0000000000
--- a/benchmark/tracer.js
+++ /dev/null
@@ -1,71 +0,0 @@
-'use strict';
-
-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 setups = [
- {
- name: 'NoopTracerProvider',
- provider: new opentelemetry.NoopTracerProvider()
- },
- {
- name: 'BasicTracerProvider',
- provider: new BasicTracerProvider({ logger })
- },
- {
- name: 'BasicTracerProvider with SimpleSpanProcessor',
- provider: getProvider(new SimpleSpanProcessor(new InMemorySpanExporter()))
- },
- {
- name: 'BasicTracerProvider with BatchSpanProcessor',
- provider: getProvider(new BatchSpanProcessor(new InMemorySpanExporter()))
- }
-];
-
-for (const setup of setups) {
- console.log(`Beginning ${setup.name} Benchmark...`);
- const tracer = setup.provider.getTracer("benchmark");
- const suite = benchmark(20)
- .add('#startSpan', function () {
- const span = tracer.startSpan('op');
- span.end();
- })
- .add('#startSpan:parent', function () {
- const span = tracer.startSpan('op');
- const childSpan = tracer.startSpan('client-op', { parent: span });
- childSpan.end();
- span.end();
- })
- .add('#startSpan with attribute', function () {
- const span = tracer.startSpan('op');
- span.setAttribute('attr-key-one', 'attr-value-one');
- span.end();
- })
- .add('#startSpan with 30 attributes', function () {
- const span = tracer.startSpan('op');
- for (let j = 0; j < 30; j++) {
- span.setAttribute('attr-key-' + j, 'attr-value-' + j);
- }
- span.end();
- })
- .add('#startSpan with 100 attributes', function () {
- const span = tracer.startSpan('op');
- for (let j = 0; j < 100; j++) {
- span.setAttribute('attr-key-' + j, 'attr-value-' + j);
- }
- span.end();
- });
-
- // run async
- suite.run({ async: false });
-}
-function getProvider(processor) {
- const provider = new BasicTracerProvider({ logger });
- provider.addSpanProcessor(processor);
- return provider;
-}
-
diff --git a/doc/development-guide.md b/doc/development-guide.md
deleted file mode 100644
index ade620efa2..0000000000
--- a/doc/development-guide.md
+++ /dev/null
@@ -1,78 +0,0 @@
-# Development Guide
-
-Before contributing to this open source project, read our [CONTRIBUTING](../CONTRIBUTING.md). We gratefully welcome improvements to documentation as well as to code.
-
-The code base is a monorepo. We use [Lerna](https://lerna.js.org/) for managing inter-module dependencies, which makes it easier to develop coordinated changes between the modules. Instead of running lerna directly, the commands are wrapped with `npm`;
-
-### Requirements
-
-Since this project supports multiple Node versions, using a version
-manager such as [nvm](https://github.com/creationix/nvm) is recommended.
-
-To get started once you have Node installed, run:
-
-```sh
-$ npm install
-```
-
-This will install all the necessary modules.
-
-### Testing
-
-#### Unit Tests
-
-To run the all unit tests, use:
-
-```sh
-$ npm run test
-```
-
-To run the unit tests continuously in watch mode while developing, use:
-
-```sh
-$ npm run tdd
-```
-
-### Linting
-
-We use [gts](https://www.npmjs.com/package/gts) to make sure that new code is conform to our coding standards.
-
-Before raising a pull request, make sure there are no lint problems.
-
-To check the linter, use:
-```sh
-$ npm run lint
-```
-
-To fix the linter, use:
-```sh
-$ npm run lint:fix
-```
-
-### Continuous Integration
-
-We rely on CircleCI 2.0 for our tests. If you want to test how the CI behaves
-locally, you can use the CircleCI Command Line Interface as described here:
-https://circleci.com/docs/2.0/local-jobs/
-
-After installing the `circleci` CLI, simply run one of the following:
-
-```sh
-$ circleci build --job lint
-$ circleci build --job node8
-$ circleci build --job node10
-$ circleci build --job node11
-$ circleci build --job node12
-$ circleci build --job node12-browsers
-```
-
-### Docs
-
-We use [typedoc](https://www.npmjs.com/package/typedoc) to generate the api documentation.
-
-To generate the docs, use:
-```sh
-$ npm run docs
-```
-
-The document will be available under `packages/opentelemetry-api/docs/out` path.
diff --git a/doc/exporter-guide.md b/doc/exporter-guide.md
deleted file mode 100644
index e98a0185b6..0000000000
--- a/doc/exporter-guide.md
+++ /dev/null
@@ -1,54 +0,0 @@
-# Exporter Developer Guide
-
-An exporter sends traces and metrics to any backend that is capable of consuming them. With OpenTelemetry, you can easily add and remove any exporter without requiring changes to your application code.
-
-We provide support for several open source backends and vendors out-of-the-box like Zipkin, Jaeger, and Prometheus, but OpenTelemetry exporters follow a public interface which can be implemented by anyone. This document describes the process for developers to create their own exporter if the provided ones do not meet their needs.
-
-A typical package layout:
-
-```
-opentelemetry-exporter-myexporter
- ├── src
- │ └── index.ts
- │ └── transform.ts
- │ └── types.ts
- │ └── myexporter.ts
- └── test
- └── transform.test.ts
- └── myexporter.test.ts
-```
-
-## Tracing
-
-The `SpanExporter` interface defines which methods the protocol-specific trace/span exporters must implement so that they can be plugged into OpenTelemetry SDK. Span exporters must follow these rules:
-
-1. Implement the `SpanExporter` interface.
-2. Expect to only receive spans which have been sampled.
-3. Expect to only receive spans which are ended.
-4. Do not throw exceptions.
-5. Do not modify received spans.
-6. Do not implement queuing or batching logic because this is handled by Span Processors.
-
-The current `SpanExporter` interface (`0.2.0`) contains 2 methods:
-
-- `export`: Exports a batch of spans. In this method, you’ll process and translate `ReadableSpan` Data into the data that your trace backend accepts, and send them to your tracing backend.
-
-- `shutdown`: Shuts down the exporter. This is an opportunity for exporter to do any cleanup required. `Shutdown` should be called only once for each Exporter instance. After the call to `Shutdown` subsequent calls to Export are not allowed and should return `FailedNotRetryable` error.
-
-Please refer to the [Zipkin Exporter][zipkin-exporter] or [Jaeger Exporter][jaeger-exporter] for more comprehensive examples.
-
-## Metrics
-
-The `MetricExporter` defines the interface that protocol-specific exporters must implement so that they can be plugged into OpenTelemetry SDK and support sending of metrics data.
-
-The current `MetricExporter` interface (`0.2.0`) defines 2 methods:
-
-- `export`: Exports a batch of telemetry data. In this method you’ll process and translate `MetricRecord` Data into the data that your metric backend accepts.
-
-- `shutdown`: Shuts down the exporter. This is an opportunity for exporter to do any cleanup required. `Shutdown` should be called only once for each Exporter instance. After the call to `Shutdown` subsequent calls to Export are not allowed and should return `FailedNotRetryable` error.
-
-Please refer to the [Prometheus Exporter][prometheus-exporter] for more comprehensive examples.
-
-[zipkin-exporter]: https://github.com/open-telemetry/opentelemetry-js/blob/master/packages/opentelemetry-exporter-zipkin
-[jaeger-exporter]: https://github.com/open-telemetry/opentelemetry-js/blob/master/packages/opentelemetry-exporter-jaeger
-[prometheus-exporter]: https://github.com/open-telemetry/opentelemetry-js/blob/master/packages/opentelemetry-exporter-prometheus
diff --git a/doc/plugin-guide.md b/doc/plugin-guide.md
deleted file mode 100644
index 497fa82fa6..0000000000
--- a/doc/plugin-guide.md
+++ /dev/null
@@ -1,51 +0,0 @@
-# Plugin Developer Guide
-
-The `NodeTracerProvider` or `Node-SDK` is driven by a set of plugins that describe how to patch a module to generate trace spans when that module is used. We provide out-of-the-box instrumentation for many popular frameworks and libraries by using a plugin system (see [builtin plugins][builtin-plugins]), and provide a means for developers to create their own.
-
-We strongly recommended to create a dedicated package for newly added plugin, example: `@opentelemetry/plugin-xxx`.
-
-Each plugin must extend the abstract class [BasePlugin][base-plugin] implementing the below methods:
-
-- `patch`: A function describing how the module exports for a given file should be modified.
-
-- `unpatch`: A function describing how the module exports for a given file should be unpatched. This should generally mirror the logic in `patch`; for example, if `patch` wraps a method, `unpatch` should unwrap it.
-
-The core `PluginLoader` class is responsible for loading the instrumented plugins that use a patch mechanism to enable automatic tracing for specific target modules. In order to load new plugin, it should export `plugin` identifier.
-```typescript
-export const plugin = new HttpPlugin(...);
-```
-
-> Example of simple module plugin created and used in the tests.
-https://github.com/open-telemetry/opentelemetry-js/blob/master/packages/opentelemetry-node/test/instrumentation/node_modules/%40opentelemetry/plugin-simple-module/simple-module.js
-
-After the plugin is created, it must be added in the [list of default supported plugins][DEFAULT_INSTRUMENTATION_PLUGINS].
-```typescript
-export const DEFAULT_INSTRUMENTATION_PLUGINS: Plugins = {
- http: {
- enabled: true,
- path: '@opentelemetry/plugin-http',
- },
- grpc: {
- enabled: true,
- path: '@opentelemetry/plugin-grpc',
- },
- // [ADD NEW PLUGIN HERE]
- xxx: {
- enabled: true,
- // You may use a package name or absolute path to the file.
- path: '@opentelemetry/plugin-xxx',
- }
-};
-```
-
-We recommend using [`shimmer`][shimmer] to modify function properties on objects.
-
-Please refer to the [HTTP instrumentation][http-plugin] or [gRPC instrumentation][grpc-plugin] for more comprehensive examples.
-
-
-[shimmer]: https://github.com/othiym23/shimmer
-[builtin-plugins]: https://github.com/open-telemetry/opentelemetry-js#plugins
-[base-plugin]: https://github.com/open-telemetry/opentelemetry-js/blob/master/packages/opentelemetry-core/src/trace/instrumentation/BasePlugin.ts#L29
-[http-plugin]: https://github.com/open-telemetry/opentelemetry-js/blob/master/packages/opentelemetry-plugin-http/src/http.ts#L44
-[grpc-plugin]: https://github.com/open-telemetry/opentelemetry-js/blob/master/packages/opentelemetry-plugin-grpc/src/grpc.ts#L52
-[DEFAULT_INSTRUMENTATION_PLUGINS]: https://github.com/open-telemetry/opentelemetry-js/blob/master/packages/opentelemetry-node/src/config.ts#L29
diff --git a/examples/collector-exporter-node/README.md b/examples/collector-exporter-node/README.md
deleted file mode 100644
index 3b84a51e16..0000000000
--- a/examples/collector-exporter-node/README.md
+++ /dev/null
@@ -1,39 +0,0 @@
-# Overview
-
-This example shows how to use [@opentelemetry/exporter-collector](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-exporter-collector) to instrument a simple Node.js application.
-
-This example will export spans data simultaneously using [Exporter Collector](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-exporter-collector) and grpc. It will use [proto format](https://github.com/open-telemetry/opentelemetry-proto).
-
-
-## Installation
-
-```shell script
-$ # from this directory
-$ npm install
-```
-
-## Run the Application
-
-1. Run docker
-```shell script
-$ # from this directory
-$ npm run docker:start
-```
-
-2. Run app
-```shell script
-$ # from this directory
-$ npm start
-```
-
-3. Open page at http://localhost:9411/zipkin/ - you should be able to see the spans in zipkin
-![Screenshot of the running example](images/spans.png)
-
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more information on tracing, visit:
-
-## LICENSE
-
-Apache License 2.0
diff --git a/examples/collector-exporter-node/docker/collector-config.yaml b/examples/collector-exporter-node/docker/collector-config.yaml
deleted file mode 100644
index 2f64d8b4fc..0000000000
--- a/examples/collector-exporter-node/docker/collector-config.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-receivers:
- otlp:
- endpoint: 0.0.0.0:55678
-
-exporters:
- zipkin:
- url: "http://zipkin-all-in-one:9411/api/v2/spans"
-
-processors:
- batch:
- queued_retry:
-
-service:
- pipelines:
- traces:
- receivers: [otlp]
- exporters: [zipkin]
- processors: [batch, queued_retry]
diff --git a/examples/collector-exporter-node/docker/docker-compose.yaml b/examples/collector-exporter-node/docker/docker-compose.yaml
deleted file mode 100644
index fee8f1aca0..0000000000
--- a/examples/collector-exporter-node/docker/docker-compose.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-version: "2"
-services:
-
- # Collector
- collector:
- image: omnition/opentelemetry-collector-contrib:0.2.8
- command: ["--config=/conf/collector-config.yaml", "--log-level=DEBUG"]
- volumes:
- - ./collector-config.yaml:/conf/collector-config.yaml
- ports:
- - "55678:55678"
- depends_on:
- - zipkin-all-in-one
-
- # Zipkin
- zipkin-all-in-one:
- image: openzipkin/zipkin:latest
- ports:
- - "9411:9411"
diff --git a/examples/collector-exporter-node/images/spans.png b/examples/collector-exporter-node/images/spans.png
deleted file mode 100644
index ae70839afd..0000000000
Binary files a/examples/collector-exporter-node/images/spans.png and /dev/null differ
diff --git a/examples/collector-exporter-node/package.json b/examples/collector-exporter-node/package.json
deleted file mode 100644
index 861b5076b4..0000000000
--- a/examples/collector-exporter-node/package.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "name": "example-collector-exporter-node",
- "private": true,
- "version": "0.6.1",
- "description": "Example of using @opentelemetry/collector-exporter in Node.js",
- "main": "index.js",
- "scripts": {
- "start": "node ./start.js",
- "docker:start": "cd ./docker && docker-compose down && docker-compose up",
- "docker:stop": "cd ./docker && docker-compose down"
- },
- "repository": {
- "type": "git",
- "url": "git+ssh://git@github.com/open-telemetry/opentelemetry-js.git"
- },
- "keywords": [
- "opentelemetry",
- "tracing"
- ],
- "engines": {
- "node": ">=8"
- },
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "bugs": {
- "url": "https://github.com/open-telemetry/opentelemetry-js/issues"
- },
- "dependencies": {
- "@opentelemetry/api": "^0.6.1",
- "@opentelemetry/exporter-collector": "^0.6.1",
- "@opentelemetry/tracing": "^0.6.1"
- },
- "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme"
-}
diff --git a/examples/collector-exporter-node/start.js b/examples/collector-exporter-node/start.js
deleted file mode 100644
index 9acbcc0687..0000000000
--- a/examples/collector-exporter-node/start.js
+++ /dev/null
@@ -1,52 +0,0 @@
-'use strict';
-
-const opentelemetry = require('@opentelemetry/api');
-const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tracing');
-const { CollectorExporter } = require('@opentelemetry/exporter-collector');
-
-const address = '127.0.0.1:55678';
-const exporter = new CollectorExporter({
- serviceName: 'basic-service',
- url: address,
-});
-
-const provider = new BasicTracerProvider();
-provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
-provider.register();
-
-const tracer = opentelemetry.trace.getTracer('example-collector-exporter-node');
-
-// Create a span. A span must be closed.
-const parentSpan = tracer.startSpan('main');
-for (let i = 0; i < 10; i += 1) {
- doWork(parentSpan);
-}
-// Be sure to end the span.
-parentSpan.end();
-
-// give some time before it is closed
-setTimeout(() => {
- // flush and close the connection.
- exporter.shutdown();
-}, 2000);
-
-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,
- });
-
- // simulate some random work.
- for (let i = 0; i <= Math.floor(Math.random() * 40000000); i += 1) {
- // empty
- }
- // Set attributes to the span.
- span.setAttribute('key', 'value');
-
- // Annotate our span to capture metadata about our operation
- span.addEvent('invoking doWork');
-
- // end span
- span.end();
-}
diff --git a/examples/metrics/README.md b/examples/metrics/README.md
deleted file mode 100644
index b5b09885f3..0000000000
--- a/examples/metrics/README.md
+++ /dev/null
@@ -1,41 +0,0 @@
-# Overview
-
-OpenTelemetry metrics allow a user to collect data and export it to a metrics backend like Prometheus.
-
-This is a simple example that demonstrates basic metrics collection and exports those metrics to a Prometheus compatible endpoint.
-
-## Installation
-
-```sh
-$ # from this directory
-$ npm install
-```
-
-How to setup [Prometheus](https://prometheus.io/docs/prometheus/latest/getting_started/) please check
-[Setup Prometheus](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-exporter-prometheus)
-
-## Run the Application
-- Run the example
-
-### Observer
-```sh
-$ npm run start:observer
-```
-
-### Prometheus
-1. In prometheus search for "metric_observer"
-
-### Links
-1. Prometheus Scrape Endpoint http://localhost:9464/metrics
-2. Prometheus graph http://localhost:9090/graph
-
-### Example
-
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more information on OpenTelemetry metrics, visit:
-
-## LICENSE
-
-Apache License 2.0
diff --git a/examples/metrics/metrics/observer.js b/examples/metrics/metrics/observer.js
deleted file mode 100644
index bb398bb95a..0000000000
--- a/examples/metrics/metrics/observer.js
+++ /dev/null
@@ -1,35 +0,0 @@
-'use strict';
-
-const { MeterProvider } = require('@opentelemetry/metrics');
-const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus');
-
-const exporter = new PrometheusExporter(
- {
- startServer: true,
- },
- () => {
- console.log('prometheus scrape endpoint: http://localhost:9464/metrics');
- },
-);
-
-const meter = new MeterProvider({
- exporter,
- interval: 1000,
-}).getMeter('example-observer');
-
-const otelCpuUsage = meter.createObserver('metric_observer', {
- monotonic: false,
- labelKeys: ['pid', 'core'],
- description: 'Example of a observer',
-});
-
-function getCpuUsage() {
- return Math.random();
-}
-
-otelCpuUsage.setCallback((observerResult) => {
- observerResult.observe(getCpuUsage, { pid: process.pid, core: '1' });
- observerResult.observe(getCpuUsage, { pid: process.pid, core: '2' });
- observerResult.observe(getCpuUsage, { pid: process.pid, core: '3' });
- observerResult.observe(getCpuUsage, { pid: process.pid, core: '4' });
-});
diff --git a/examples/metrics/metrics/observer.png b/examples/metrics/metrics/observer.png
deleted file mode 100644
index 7a9184af13..0000000000
Binary files a/examples/metrics/metrics/observer.png and /dev/null differ
diff --git a/examples/metrics/package.json b/examples/metrics/package.json
deleted file mode 100644
index fea2183bfd..0000000000
--- a/examples/metrics/package.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "name": "example-metrics",
- "private": true,
- "version": "0.6.1",
- "description": "Example of using @opentelemetry/metrics",
- "main": "index.js",
- "scripts": {
- "start:observer": "node metrics/observer.js"
- },
- "repository": {
- "type": "git",
- "url": "git+ssh://git@github.com/open-telemetry/opentelemetry-js.git"
- },
- "keywords": [
- "opentelemetry",
- "http",
- "tracing",
- "metrics"
- ],
- "engines": {
- "node": ">=8"
- },
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "bugs": {
- "url": "https://github.com/open-telemetry/opentelemetry-js/issues"
- },
- "dependencies": {
- "@opentelemetry/exporter-prometheus": "^0.6.1",
- "@opentelemetry/metrics": "^0.6.1"
- },
- "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme"
-}
diff --git a/examples/opentracing-shim/README.md b/examples/opentracing-shim/README.md
deleted file mode 100644
index c56e0d3ef2..0000000000
--- a/examples/opentracing-shim/README.md
+++ /dev/null
@@ -1,77 +0,0 @@
-# Overview
-
-OpenTracing shim allows existing OpenTracing instrumentation to report to OpenTelemetry.
-
-This is a simple example that demonstrates how existing OpenTracing instrumentation can be integrated with OpenTelemetry.
-
-The example shows key aspects of tracing such as
-
-- Root Span (on client)
-- Child Span from a remote parent (on server)
-- Span Tag
-- Span Log
-- Make a shim between OpenTracing and OpenTelemetry tracers
-
-## Installation
-```sh
-# from this directory
-$ npm install
-```
-
-## Run the Application
-
-### Zipkin
-- Setup [Zipkin Tracing UI](https://zipkin.io/pages/quickstart.html)
-
-- Run the server
-```sh
-# from this directory
-$ npm run zipkin:server
-```
-
-- Run the client
-```sh
-# from this directory
-$ npm run zipkin:client
-```
-
-- Check trace
-
- `zipkin:client` should output the `traceId` in the terminal.
-
- Go to Zipkin with your browser [http://localhost:9411/zipkin/traces/(your-trace-id)]() (e.g http://localhost:9411/zipkin/traces/4815c3d576d930189725f1f1d1bdfcc6)
-
-
-
-
-### Jaeger
-- Setup [Jaeger Tracing UI](https://www.jaegertracing.io/docs/latest/getting-started/#all-in-one)
-
-- Run the server
-```sh
-# from this directory
-$ npm run jaeger:server
-```
-
-- Run the client
-```sh
-# from this directory
-$ npm run jaeger:client
-```
-
-- Check trace
-
- `jaeger:client` should output the `traceId` in the terminal.
-
- Go to Jaeger with your browser [http://localhost:16686/trace/(your-trace-id)]() (e.g http://localhost:16686/trace/4815c3d576d930189725f1f1d1bdfcc6)
-
-
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more information on OpenTelemetry for Node.js, visit:
-- For more information on OpenTracing, visit:
-
-## LICENSE
-
-Apache License 2.0
\ No newline at end of file
diff --git a/examples/opentracing-shim/client.js b/examples/opentracing-shim/client.js
deleted file mode 100644
index 6f98c2efc5..0000000000
--- a/examples/opentracing-shim/client.js
+++ /dev/null
@@ -1,45 +0,0 @@
-'use strict';
-
-const http = require('http');
-const opentracing = require('opentracing');
-const shim = require('./shim').shim('http_client_service');
-
-opentracing.setGlobalTracer(shim);
-const tracer = opentracing.globalTracer();
-
-makeRequest();
-
-async function makeRequest() {
- const span = tracer.startSpan('make_request');
-
- const headers = {};
- tracer.inject(span, opentracing.FORMAT_HTTP_HEADERS, headers);
-
- http
- .get(
- {
- host: 'localhost',
- port: 3000,
- path: '/',
- headers,
- },
- (resp) => {
- let data = '';
-
- resp.on('data', (chunk) => {
- data += chunk;
- });
-
- resp.on('end', async () => {
- console.log(JSON.parse(data));
- span.finish();
-
- console.log('Sleeping 5 seconds before shutdown to ensure all records are flushed.');
- setTimeout(() => { console.log('Completed.'); }, 5000);
- });
- },
- )
- .on('error', (err) => {
- console.log(`Error: ${err.message}`);
- });
-}
diff --git a/examples/opentracing-shim/images/jaeger-ui.png b/examples/opentracing-shim/images/jaeger-ui.png
deleted file mode 100644
index 489ae445a0..0000000000
Binary files a/examples/opentracing-shim/images/jaeger-ui.png and /dev/null differ
diff --git a/examples/opentracing-shim/images/zipkin-ui.png b/examples/opentracing-shim/images/zipkin-ui.png
deleted file mode 100644
index 83933792ef..0000000000
Binary files a/examples/opentracing-shim/images/zipkin-ui.png and /dev/null differ
diff --git a/examples/opentracing-shim/package.json b/examples/opentracing-shim/package.json
deleted file mode 100644
index d5be857137..0000000000
--- a/examples/opentracing-shim/package.json
+++ /dev/null
@@ -1,43 +0,0 @@
-{
- "name": "opentracing-shim",
- "private": true,
- "version": "0.6.1",
- "description": "Example of using @opentelemetry/shim-opentracing in Node.js",
- "main": "index.js",
- "scripts": {
- "zipkin:client": "cross-env EXPORTER=zipkin node ./client.js",
- "zipkin:server": "cross-env EXPORTER=zipkin node ./server.js",
- "jaeger:client": "cross-env EXPORTER=jaeger node ./client.js",
- "jaeger:server": "cross-env EXPORTER=jaeger node ./server.js"
- },
- "repository": {
- "type": "git",
- "url": "git+ssh://git@github.com/open-telemetry/opentelemetry-js.git"
- },
- "keywords": [
- "opentelemetry",
- "http",
- "tracing",
- "opentracing"
- ],
- "engines": {
- "node": ">=8"
- },
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "bugs": {
- "url": "https://github.com/open-telemetry/opentelemetry-js/issues"
- },
- "dependencies": {
- "@opentelemetry/exporter-jaeger": "^0.6.1",
- "@opentelemetry/exporter-zipkin": "^0.6.1",
- "@opentelemetry/node": "^0.6.1",
- "@opentelemetry/shim-opentracing": "^0.6.1",
- "@opentelemetry/tracing": "^0.6.1",
- "opentracing": "^0.14.4"
- },
- "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme",
- "devDependencies": {
- "cross-env": "^6.0.0"
- }
-}
diff --git a/examples/opentracing-shim/server.js b/examples/opentracing-shim/server.js
deleted file mode 100644
index 23661667e9..0000000000
--- a/examples/opentracing-shim/server.js
+++ /dev/null
@@ -1,58 +0,0 @@
-'use strict';
-
-const http = require('http');
-const opentracing = require('opentracing');
-const utils = require('./utils');
-const shim = require('./shim').shim('http_server_service');
-
-opentracing.setGlobalTracer(shim);
-const tracer = opentracing.globalTracer();
-
-startServer(3000);
-
-function startServer(port) {
- const server = http.createServer(handleRequest);
-
- server.listen(port, (err) => {
- if (err) throw err;
-
- console.log(`Server is listening on ${port}`);
- });
-}
-
-async function handleRequest(req, res) {
- const parentSpan = tracer.extract(
- opentracing.FORMAT_HTTP_HEADERS,
- req.headers,
- );
-
- const span = tracer.startSpan('handle_request', {
- childOf: parentSpan,
- });
-
- span.setTag('custom', 'tag value');
- span.setTag('alpha', '1000');
-
- await doSomething(span);
-
- res.writeHead(200, { 'Content-Type': 'application/json' });
- res.write(
- JSON.stringify({ status: 'OK', traceId: span.context().toTraceId() }),
- );
-
- res.end();
- span.finish();
-}
-
-async function doSomething(parentSpan) {
- const span = tracer.startSpan('do_something', { childOf: parentSpan });
-
- span.setTag('alpha', '200');
- span.setTag('beta', '50');
- span.log({ state: 'waiting' });
-
- // deliberately sleeping to mock some action.
- await utils.sleep(1000);
-
- span.finish();
-}
diff --git a/examples/opentracing-shim/shim.js b/examples/opentracing-shim/shim.js
deleted file mode 100644
index 993445ab26..0000000000
--- a/examples/opentracing-shim/shim.js
+++ /dev/null
@@ -1,27 +0,0 @@
-'use strict';
-
-const { NodeTracerProvider } = require('@opentelemetry/node');
-const { SimpleSpanProcessor } = require('@opentelemetry/tracing');
-const { JaegerExporter } = require('@opentelemetry/exporter-jaeger');
-const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin');
-const { TracerShim } = require('@opentelemetry/shim-opentracing');
-
-function shim(serviceName) {
- const provider = new NodeTracerProvider();
-
- provider.addSpanProcessor(new SimpleSpanProcessor(getExporter(serviceName)));
-
- return new TracerShim(provider.getTracer('opentracing-shim'));
-}
-
-function getExporter(serviceName) {
- const type = process.env.EXPORTER.toLowerCase() || 'jaeger';
-
- if (type.startsWith('z')) {
- return new ZipkinExporter({ serviceName });
- }
-
- return new JaegerExporter({ serviceName, flushInterval: 100 });
-}
-
-exports.shim = shim;
diff --git a/examples/opentracing-shim/utils.js b/examples/opentracing-shim/utils.js
deleted file mode 100644
index a913e95acd..0000000000
--- a/examples/opentracing-shim/utils.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-async function sleep(ms) {
- return new Promise((resolve) => setTimeout(resolve, ms));
-}
-
-exports.sleep = sleep;
diff --git a/examples/prometheus/README.md b/examples/prometheus/README.md
deleted file mode 100644
index 704769b7bc..0000000000
--- a/examples/prometheus/README.md
+++ /dev/null
@@ -1,59 +0,0 @@
-# Overview
-
-OpenTelemetry metrics allow a user to collect data and export it to a metrics backend like Prometheus.
-
-This is a simple example that demonstrates basic metrics collection and exports those metrics to a Prometheus compatible endpoint.
-
-## Installation
-
-```sh
-$ # from this directory
-$ npm install
-```
-
-Setup [Prometheus](https://prometheus.io/docs/prometheus/latest/getting_started/)
-
-## Run the Application
-- Run the server
-
-```sh
-$ # from this directory
-$ npm run start
-```
-
-- Replace the `prometheus.yml` provided by the Prometheus installation with the following:
-
-```yaml
-global:
- scrape_interval: 15s # Default is every 1 minute.
-
-scrape_configs:
- - job_name: 'opentelemetry'
- # metrics_path defaults to '/metrics'
- # scheme defaults to 'http'.
- static_configs:
- - targets: ['localhost:9464']
-
-```
-
-- Start Prometheus
-
-```sh
-$ # from the directory you downloaded prometheus
-$ prometheus --config.file=prometheus.yml
-```
-
-### Prometheus UI
-
-If you are using the default configurations, the prometheus client will be available at
-
-
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more information on OpenTelemetry metrics, visit:
-- For more information on OpenTelemetry for Node.js, visit:
-
-## LICENSE
-
-Apache License 2.0
diff --git a/examples/prometheus/images/prom-ui.png b/examples/prometheus/images/prom-ui.png
deleted file mode 100644
index bc0b39a553..0000000000
Binary files a/examples/prometheus/images/prom-ui.png and /dev/null differ
diff --git a/examples/prometheus/index.js b/examples/prometheus/index.js
deleted file mode 100644
index 5d9b52c17a..0000000000
--- a/examples/prometheus/index.js
+++ /dev/null
@@ -1,39 +0,0 @@
-'use strict';
-
-const { MeterProvider } = require('@opentelemetry/metrics');
-const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus');
-
-const exporter = new PrometheusExporter(
- {
- startServer: true,
- },
- () => {
- console.log('prometheus scrape endpoint: http://localhost:9464/metrics');
- },
-);
-
-const meter = new MeterProvider({
- exporter,
- interval: 1000,
-}).getMeter('example-prometheus');
-
-// Monotonic counters can only be increased.
-const monotonicCounter = meter.createCounter('monotonic_counter', {
- monotonic: true,
- labelKeys: ['pid'],
- description: 'Example of a monotonic counter',
-});
-
-// Non-monotonic counters can be increased or decreased.
-const nonMonotonicCounter = meter.createCounter('non_monotonic_counter', {
- monotonic: false,
- labelKeys: ['pid'],
- description: 'Example of a non-monotonic counter',
-});
-
-const labels = { pid: process.pid };
-
-setInterval(() => {
- monotonicCounter.bind(labels).add(1);
- nonMonotonicCounter.bind(labels).add(Math.random() > 0.5 ? 1 : -1);
-}, 1000);
diff --git a/examples/prometheus/package.json b/examples/prometheus/package.json
deleted file mode 100644
index e5bb322777..0000000000
--- a/examples/prometheus/package.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "name": "prometheus-example",
- "version": "0.6.1",
- "description": "Example of using @opentelemetry/metrics and @opentelemetry/exporter-prometheus",
- "main": "index.js",
- "scripts": {
- "start": "node index.js"
- },
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "dependencies": {
- "@opentelemetry/exporter-prometheus": "^0.6.1",
- "@opentelemetry/metrics": "^0.6.1"
- }
-}
diff --git a/examples/prometheus/prometheus.yml b/examples/prometheus/prometheus.yml
deleted file mode 100644
index 40ade8631d..0000000000
--- a/examples/prometheus/prometheus.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-global:
- scrape_interval: 15s # Default is every 1 minute.
-
-scrape_configs:
- - job_name: 'opentelemetry'
- # metrics_path defaults to '/metrics'
- # scheme defaults to 'http'.
- static_configs:
- - targets: ['localhost:9464']
diff --git a/examples/tracer-web/.eslintrc b/examples/tracer-web/.eslintrc
deleted file mode 100644
index e2338e5e0b..0000000000
--- a/examples/tracer-web/.eslintrc
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "env": {
- "node": true
- },
- "extends": "airbnb-base",
- "parserOptions": {
- "sourceType": "module"
- },
- "rules": {
- "strict": ["error", "global"],
- "no-use-before-define": ["error", "nofunc"],
- "no-console": "off",
- "import/no-unresolved": "off",
- "no-unused-vars": ["error", { "argsIgnorePattern": "^_" }]
- }
-}
diff --git a/examples/tracer-web/README.md b/examples/tracer-web/README.md
deleted file mode 100644
index fef2af26b4..0000000000
--- a/examples/tracer-web/README.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# Overview
-
-This example shows how to use [@opentelemetry/web](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-web) with different plugins and setup to instrument your JavaScript code running in the browser.
-
-## Installation
-
-```sh
-$ # from this directory
-$ npm install
-```
-
-## Run the Application
-
-```sh
-$ # from this directory
-$ npm start
-```
-
-By default, the application will run on port `8090`.
-
-## Examples
-
-### Document Load
-
-To see the results, open the browser at and make sure you have the browser console open. The application is using the `ConsoleSpanExporter` and will post the created spans to the browser console.
-
-The screen will look as follows:
-
-![Screenshot of the running example](images/document-load.png)
-
-### XMLHttpRequest
-
-To see the results, open the browser at and make sure you have the browser console open. The application is using the `ConsoleSpanExporter` and will post the created spans to the browser console.
-The screen will look as follows:
-
-![Screenshot of the running example](images/xml-http-request.png)
-
-
-## Useful links
-
-- For more information on OpenTelemetry, visit:
-- For more information on web tracing, visit:
-
-## LICENSE
-
-Apache License 2.0
diff --git a/examples/tracer-web/examples/document-load/index.html b/examples/tracer-web/examples/document-load/index.html
deleted file mode 100644
index 8df377cc52..0000000000
--- a/examples/tracer-web/examples/document-load/index.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
- Document Load Plugin Example
-
-
-
-
-
-
-
-
-
- Example of using Web Tracer with document load plugin with console exporter and collector exporter
-
-
-
-
-
-
-
diff --git a/examples/tracer-web/examples/document-load/index.js b/examples/tracer-web/examples/document-load/index.js
deleted file mode 100644
index 4228e8730b..0000000000
--- a/examples/tracer-web/examples/document-load/index.js
+++ /dev/null
@@ -1,90 +0,0 @@
-import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
-import { WebTracerProvider } from '@opentelemetry/web';
-import { DocumentLoad } from '@opentelemetry/plugin-document-load';
-import { ZoneContextManager } from '@opentelemetry/context-zone';
-import { CollectorExporter } from '@opentelemetry/exporter-collector';
-
-const provider = new WebTracerProvider({
- plugins: [
- new DocumentLoad(),
- ],
-});
-provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
-provider.addSpanProcessor(new SimpleSpanProcessor(new CollectorExporter()));
-
-provider.register({
- contextManager: new ZoneContextManager(),
-});
-
-const tracer = provider.getTracer('example-tracer-web');
-
-const getData = (url) => new Promise((resolve, reject) => {
- // eslint-disable-next-line no-undef
- const req = new XMLHttpRequest();
- req.open('GET', url, true);
- req.send();
- req.onload = () => {
- let json;
- try {
- json = JSON.parse(req.responseText);
- } catch (e) {
- reject(e);
- }
- resolve(json);
- };
-});
-
-// example of keeping track of context between async operations
-const prepareClickEvent = () => {
- const url1 = 'https://raw.githubusercontent.com/open-telemetry/opentelemetry-js/master/package.json';
- const url2 = 'https://raw.githubusercontent.com/open-telemetry/opentelemetry-js/master/packages/opentelemetry-web/package.json';
-
- const element = document.getElementById('button1');
-
- const onClick = () => {
- let count = 0;
-
- function finish() {
- count++;
- if (count === 2) {
- mainSpan.end();
- }
- }
-
- const mainSpan = tracer.startSpan('click button');
- tracer.withSpan(mainSpan, () => {
- const span1 = tracer.startSpan('files-series-info-1', {
- parent: tracer.getCurrentSpan(),
- });
-
- const span2 = tracer.startSpan('files-series-info-2', {
- parent: tracer.getCurrentSpan(),
- });
-
- tracer.withSpan(span1, () => {
- getData(url1).then((data) => {
- console.log('current span is span1', tracer.getCurrentSpan() === span1);
- console.log('info from package.json', data.description, data.version);
- tracer.getCurrentSpan().addEvent('fetching-span1-completed');
- span1.end();
- finish();
- });
- });
-
- tracer.withSpan(span2, () => {
- getData(url2).then((data) => {
- setTimeout(() => {
- console.log('current span is span2', tracer.getCurrentSpan() === span2);
- console.log('info from package.json', data.description, data.version);
- tracer.getCurrentSpan().addEvent('fetching-span2-completed');
- span2.end();
- finish();
- }, 100);
- });
- });
- });
- };
- element.addEventListener('click', onClick);
-};
-
-window.addEventListener('load', prepareClickEvent);
diff --git a/examples/tracer-web/examples/user-interaction/index.html b/examples/tracer-web/examples/user-interaction/index.html
deleted file mode 100644
index 0209a4d8f2..0000000000
--- a/examples/tracer-web/examples/user-interaction/index.html
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
- User Interaction Example
-
-
-
-
-
-
-
-
-
- Example of using Web Tracer with UserInteractionPlugin and XMLHttpRequestPlugin with console exporter and collector exporter
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/tracer-web/examples/user-interaction/index.js b/examples/tracer-web/examples/user-interaction/index.js
deleted file mode 100644
index a8b67488f6..0000000000
--- a/examples/tracer-web/examples/user-interaction/index.js
+++ /dev/null
@@ -1,83 +0,0 @@
-import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
-import { WebTracerProvider } from '@opentelemetry/web';
-import { XMLHttpRequestPlugin } from '@opentelemetry/plugin-xml-http-request';
-import { UserInteractionPlugin } from '@opentelemetry/plugin-user-interaction';
-import { ZoneContextManager } from '@opentelemetry/context-zone';
-import { CollectorExporter } from '@opentelemetry/exporter-collector';
-import { B3Propagator } from '@opentelemetry/core';
-
-const providerWithZone = new WebTracerProvider({
- plugins: [
- new UserInteractionPlugin(),
- new XMLHttpRequestPlugin({
- ignoreUrls: [/localhost:8090\/sockjs-node/],
- propagateTraceHeaderCorsUrls: [
- 'http://localhost:8090'
- ]
- })
- ]
-});
-
-providerWithZone.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
-providerWithZone.addSpanProcessor(new SimpleSpanProcessor(new CollectorExporter()));
-
-providerWithZone.register({
- contextManager: new ZoneContextManager(),
- propagator: new B3Propagator(),
-});
-
-let lastButtonId = 0;
-
-function btnAddClick() {
- lastButtonId++;
- const btn = document.createElement('button');
- // for easier testing of element xpath
- let navigate = false;
- if (lastButtonId % 2 === 0) {
- btn.setAttribute('id', `button${lastButtonId}`);
- navigate = true;
- }
- btn.setAttribute('class', `buttonClass${lastButtonId}`);
- btn.append(document.createTextNode(`Click ${lastButtonId}`));
- btn.addEventListener('click', onClick.bind(this, navigate));
- document.querySelector('#buttons').append(btn);
-}
-
-function prepareClickEvents() {
- for (let i = 0; i < 5; i++) {
- btnAddClick();
- }
- const btnAdd = document.getElementById('btnAdd');
- btnAdd.addEventListener('click', btnAddClick);
-}
-
-function onClick(navigate) {
- if (navigate) {
- history.pushState({ test: 'testing' }, '', `${location.pathname}`);
- history.pushState({ test: 'testing' }, '', `${location.pathname}#foo=bar1`);
- }
- getData('https://httpbin.org/get?a=1').then(() => {
- getData('https://httpbin.org/get?a=1').then(() => {
- console.log('data downloaded 2');
- });
- getData('https://httpbin.org/get?a=1').then(() => {
- console.log('data downloaded 3');
- });
- console.log('data downloaded 1');
- });
-}
-
-function getData(url, resolve) {
- return new Promise(async (resolve, reject) => {
- const req = new XMLHttpRequest();
- req.open('GET', url, true);
- req.setRequestHeader('Content-Type', 'application/json');
- req.setRequestHeader('Accept', 'application/json');
- req.send();
- req.onload = function () {
- resolve();
- };
- });
-}
-
-window.addEventListener('load', prepareClickEvents);
diff --git a/examples/tracer-web/examples/xml-http-request/index.html b/examples/tracer-web/examples/xml-http-request/index.html
deleted file mode 100644
index 6aa0c561fb..0000000000
--- a/examples/tracer-web/examples/xml-http-request/index.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
- XMLHttpRequest Plugin Example
-
-
-
-
-
-
- Example of using Web Tracer with XMLHttpRequest plugin with console exporter and collector exporter
-
-
-
-
-
-
-
diff --git a/examples/tracer-web/examples/xml-http-request/index.js b/examples/tracer-web/examples/xml-http-request/index.js
deleted file mode 100644
index 7f025ea14b..0000000000
--- a/examples/tracer-web/examples/xml-http-request/index.js
+++ /dev/null
@@ -1,63 +0,0 @@
-import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
-import { WebTracerProvider } from '@opentelemetry/web';
-import { XMLHttpRequestPlugin } from '@opentelemetry/plugin-xml-http-request';
-import { ZoneContextManager } from '@opentelemetry/context-zone';
-import { CollectorExporter } from '@opentelemetry/exporter-collector';
-import { B3Propagator } from '@opentelemetry/core';
-
-const providerWithZone = new WebTracerProvider({
- plugins: [
- new XMLHttpRequestPlugin({
- ignoreUrls: [/localhost:8090\/sockjs-node/],
- propagateTraceHeaderCorsUrls: [
- 'https://httpbin.org/get',
- ],
- }),
- ],
-});
-
-providerWithZone.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
-providerWithZone.addSpanProcessor(new SimpleSpanProcessor(new CollectorExporter()));
-
-providerWithZone.register({
- contextManager: new ZoneContextManager(),
- propagator: new B3Propagator(),
-});
-
-const webTracerWithZone = providerWithZone.getTracer('example-tracer-web');
-
-const getData = (url) => new Promise((resolve, _reject) => {
- // eslint-disable-next-line no-undef
- const req = new XMLHttpRequest();
- req.open('GET', url, true);
- req.setRequestHeader('Content-Type', 'application/json');
- req.setRequestHeader('Accept', 'application/json');
- req.send();
- req.onload = () => {
- resolve();
- };
-});
-
-// example of keeping track of context between async operations
-const prepareClickEvent = () => {
- const url1 = 'https://httpbin.org/get';
-
- const element = document.getElementById('button1');
-
- 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, () => {
- getData(url1).then((_data) => {
- webTracerWithZone.getCurrentSpan().addEvent('fetching-span1-completed');
- span1.end();
- });
- });
- }
- };
- element.addEventListener('click', onClick);
-};
-
-window.addEventListener('load', prepareClickEvent);
diff --git a/examples/tracer-web/images/document-load.png b/examples/tracer-web/images/document-load.png
deleted file mode 100644
index 5a2e23e808..0000000000
Binary files a/examples/tracer-web/images/document-load.png and /dev/null differ
diff --git a/examples/tracer-web/images/xml-http-request.png b/examples/tracer-web/images/xml-http-request.png
deleted file mode 100644
index 640dcd7669..0000000000
Binary files a/examples/tracer-web/images/xml-http-request.png and /dev/null differ
diff --git a/examples/tracer-web/package.json b/examples/tracer-web/package.json
deleted file mode 100644
index 6953494e0e..0000000000
--- a/examples/tracer-web/package.json
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "name": "web-tracer-example",
- "private": true,
- "version": "0.6.1",
- "description": "Example of using @opentelemetry/web in browser",
- "main": "index.js",
- "scripts": {
- "start": "webpack-dev-server -d --progress --colors --port 8090 --config webpack.config.js --hot --inline --host 0.0.0.0 --content-base examples"
- },
- "repository": {
- "type": "git",
- "url": "git+ssh://git@github.com/open-telemetry/opentelemetry-js.git"
- },
- "keywords": [
- "opentelemetry",
- "tracing",
- "web"
- ],
- "engines": {
- "node": ">=8"
- },
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "bugs": {
- "url": "https://github.com/open-telemetry/opentelemetry-js/issues"
- },
- "devDependencies": {
- "@babel/core": "^7.6.0",
- "babel-loader": "^8.0.6",
- "ts-loader": "^6.0.4",
- "webpack": "^4.35.2",
- "webpack-cli": "^3.3.9",
- "webpack-dev-server": "^3.8.1",
- "webpack-merge": "^4.2.2"
- },
- "dependencies": {
- "@opentelemetry/context-zone": "^0.6.1",
- "@opentelemetry/core": "^0.6.1",
- "@opentelemetry/exporter-collector": "^0.6.1",
- "@opentelemetry/plugin-document-load": "^0.6.1",
- "@opentelemetry/plugin-user-interaction": "^0.6.1",
- "@opentelemetry/plugin-xml-http-request": "^0.6.1",
- "@opentelemetry/tracing": "^0.6.1",
- "@opentelemetry/web": "^0.6.1"
- },
- "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme"
-}
diff --git a/examples/tracer-web/webpack.config.js b/examples/tracer-web/webpack.config.js
deleted file mode 100644
index b23949d731..0000000000
--- a/examples/tracer-web/webpack.config.js
+++ /dev/null
@@ -1,57 +0,0 @@
-const webpack = require('webpack');
-const webpackMerge = require('webpack-merge');
-const path = require('path');
-
-const directory = path.resolve(__dirname);
-
-const common = {
- mode: 'development',
- entry: {
- 'document-load': 'examples/document-load/index.js',
- 'xml-http-request': 'examples/xml-http-request/index.js',
- 'user-interaction': 'examples/user-interaction/index.js',
- },
- output: {
- path: path.resolve(__dirname, 'dist'),
- filename: '[name].js',
- sourceMapFilename: '[file].map',
- },
- target: 'web',
- module: {
- rules: [
- {
- test: /\.js[x]?$/,
- exclude: /(node_modules)/,
- use: {
- loader: 'babel-loader',
- },
- },
- {
- test: /\.ts$/,
- exclude: /(node_modules)/,
- use: {
- loader: 'ts-loader',
- },
- },
- ],
- },
- resolve: {
- modules: [
- path.resolve(directory),
- 'node_modules',
- ],
- extensions: ['.ts', '.js', '.jsx', '.json'],
- },
-};
-
-module.exports = webpackMerge(common, {
- devtool: 'eval-source-map',
- devServer: {
- contentBase: path.resolve(__dirname),
- },
- plugins: [
- new webpack.DefinePlugin({
- 'process.env.NODE_ENV': JSON.stringify('development'),
- }),
- ],
-});
diff --git a/getting-started/README.md b/getting-started/README.md
deleted file mode 100644
index ce7b341dc5..0000000000
--- a/getting-started/README.md
+++ /dev/null
@@ -1,366 +0,0 @@
-# Getting Started with OpenTelemetry JS
-
-This guide will walk you through the setup and configuration process for a tracing backend (in this case [Zipkin](https://zipkin.io), but [Jaeger](https://www.jaegertracing.io) would be simple to use as well), a metrics backend like [Prometheus](https://prometheus.io), and auto-instrumentation of NodeJS. [You can find the guide for TypeScript here](ts-example/README.md#getting-started-with-opentelemetry-js-typescript).
-
-1. [Tracing Your Application with OpenTelemetry](#tracing-your-application-with-opentelemetry)
- 1. [Setting up a Tracing Backend](#setting-up-a-tracing-backend)
- 2. [Trace Your NodeJS Application](#trace-your-nodejs-application)
- 1. [Install the required OpenTelemetry libraries](#install-the-required-opentelemetry-libraries)
- 2. [Initialize a global tracer](#initialize-a-global-tracer)
- 3. [Initialize and register a trace exporter](#initialize-and-register-a-trace-exporter)
-2. [Collect Metrics Using OpenTelemetry](#collect-metrics-using-opentelemetry)
- 1. [Set up a Metrics Backend](#set-up-a-metrics-backend)
- 2. [Monitor Your NodeJS Application](#monitor-your-nodejs-application)
- 1. [Install the required OpenTelemetry metrics libraries](#install-the-required-opentelemetry-metrics-libraries)
- 2. [Initialize a meter and collect metrics](#initialize-a-meter-and-collect-metrics)
- 3. [Initialize and register a metrics exporter](#initialize-and-register-a-metrics-exporter)
-
-## Tracing Your Application with OpenTelemetry
-
-([link to TypeScript version](ts-example/README.md#tracing-your-application-with-opentelemetry))
-
-This guide assumes you are going to be using Zipkin as your tracing backend, but modifying it for Jaeger should be straightforward.
-
-An example application which can be used with this guide can be found at in the [example directory](example). You can see what it looks like with tracing enabled in the [traced-example directory](traced-example).
-
-### Setting up a Tracing Backend
-
-([link to TypeScript version](ts-example/README.md#setting-up-a-tracing-backend))
-
-The first thing we will need before we can start collecting traces is a tracing backend like Zipkin that we can export traces to. If you already have a supported tracing backend (Zipkin or Jaeger), you can skip this step. If not, you will need to run one.
-
-In order to set up Zipkin as quickly as possible, run the latest [Docker Zipkin](https://github.com/openzipkin/docker-zipkin) container, exposing port `9411`. If you can’t run Docker containers, you will need to download and run Zipkin by following the Zipkin [quickstart guide](https://zipkin.io/pages/quickstart.html).
-
-```sh
-$ docker run --rm -d -p 9411:9411 --name zipkin openzipkin/zipkin
-```
-
-Browse to to ensure that you can see the Zipkin UI.
-
-
-
-### Trace Your NodeJS Application
-
-([link to TypeScript version](ts-example/README.md#trace-your-nodejs-application))
-
-This guide uses the example application provided in the `example` directory, but the steps to instrument your own application should be broadly the same. Here is an overview of what we will be doing.
-
-1. Install the required OpenTelemetry libraries
-2. Initialize a global tracer
-3. Initialize and register a trace exporter
-
-#### Install the required OpenTelemetry libraries
-
-([link to TypeScript version](ts-example/README.md#install-the-required-opentelemetry-libraries))
-
-To create traces on NodeJS, you will need `@opentelemetry/node`, `@opentelemetry/core`, and any plugins required by your application such as gRPC, or HTTP. If you are using the example application, you will need to install `@opentelemetry/plugin-http`.
-
-```sh
-$ npm install \
- @opentelemetry/core \
- @opentelemetry/node \
- @opentelemetry/plugin-http
-```
-
-#### Initialize a global tracer
-
-([link to TypeScript version](ts-example/README.md#initialize-a-global-tracer))
-
-All tracing initialization should happen before your application’s code runs. The easiest way to do this is to initialize tracing in a separate file that is required using node’s `-r` option before application code runs.
-
-Create a file named `tracing.js` and add the following code:
-
-```javascript
-'use strict';
-
-const { LogLevel } = require("@opentelemetry/core");
-const { NodeTracerProvider } = require("@opentelemetry/node");
-
-const provider = new NodeTracerProvider({
- logLevel: LogLevel.ERROR
-});
-
-provider.register();
-```
-
-If you run your application now with `node -r ./tracing.js app.js`, your application will create and propagate traces over HTTP. If an already instrumented service that supports [Trace Context](https://www.w3.org/TR/trace-context/) headers calls your application using HTTP, and you call another application using HTTP, the Trace Context headers will be correctly propagated.
-
-If you wish to see a completed trace, however, there is one more step. You must register an exporter to send traces to a tracing backend.
-
-#### Initialize and Register a Trace Exporter
-
-([link to TypeScript version](ts-example/README.md#initialize-and-register-a-trace-exporter))
-
-This guide uses the Zipkin tracing backend, but if you are using another backend like [Jaeger](https://www.jaegertracing.io), this is where you would make your change.
-
-To export traces, we will need a few more dependencies. Install them with the following command:
-
-```sh
-$ npm install \
- @opentelemetry/tracing \
- @opentelemetry/exporter-zipkin
-
-$ # for jaeger you would run this command:
-$ # npm install @opentelemetry/exporter-jaeger
-```
-
-After these dependencies are installed, we will need to initialize and register them. Modify `tracing.js` so that it matches the following code snippet, replacing the service name `"getting-started"` with your own service name if you wish.
-
-```javascript
-'use strict';
-
-const { LogLevel } = require("@opentelemetry/core");
-const { NodeTracerProvider } = require("@opentelemetry/node");
-const { SimpleSpanProcessor } = require("@opentelemetry/tracing");
-const { ZipkinExporter } = require("@opentelemetry/exporter-zipkin");
-
-const provider = new NodeTracerProvider({
- logLevel: LogLevel.ERROR
-});
-
-provider.register();
-
-provider.addSpanProcessor(
- new SimpleSpanProcessor(
- new ZipkinExporter({
- serviceName: "getting-started",
- // If you are running your tracing backend on another host,
- // you can point to it using the `url` parameter of the
- // exporter config.
- })
- )
-);
-
-console.log("tracing initialized");
-```
-
-Now if you run your application with the `tracing.js` file loaded, and you send requests to your application over HTTP (in the sample application just browse to http://localhost:8080), you will see traces exported to your tracing backend that look like this:
-
-```sh
-$ node -r ./tracing.js app.js
-```
-
-
-
-**Note:** Some spans appear to be duplicated, but they are not. This is because the sample application is both the client and the server for these requests. You see one span that is the client side request timing, and one span that is the server side request timing. Anywhere they don’t overlap is network time.
-
-## Collect Metrics Using OpenTelemetry
-
-([link to TypeScript version](ts-example/README.md#collect-metrics-using-opentelemetry))
-
-This guide assumes you are going to be using Prometheus as your metrics backend. It is currently the only metrics backend supported by OpenTelemetry JS.
-
-**Note**: This section is a work in progress
-
-### Set up a Metrics Backend
-
-([link to TypeScript version](ts-example/README.md#set-up-a-metrics-backend))
-
-Now that we have end-to-end traces, we will collect and export some basic metrics.
-
-Currently, the only supported metrics backend is [Prometheus](https://prometheus.io). Head to the [Prometheus download page](https://prometheus.io/download/) and download the latest release of Prometheus for your operating system.
-
-Open a command line and `cd` into the directory where you downloaded the Prometheus tarball. Untar it and change into the newly created directory.
-
-```sh
-$ cd Downloads
-
-$ # Replace the file name below with your downloaded tarball
-$ tar xvfz prometheus-2.14.0.darwin-amd64.tar
-
-$ # Replace the dir below with your created directory
-$ cd prometheus-2.14.0.darwin-amd64
-
-$ ls
-LICENSE console_libraries data prometheus.yml tsdb
-NOTICE consoles prometheus promtool
-```
-
-The created directory should have a file named `prometheus.yml`. This is the file used to configure Prometheus. For now, just make sure Prometheus starts by running the `./prometheus` binary in the folder and browse to .
-
-```sh
-$ ./prometheus
-# some output elided for brevity
-msg="Starting Prometheus" version="(version=2.14.0, branch=HEAD, revision=edeb7a44cbf745f1d8be4ea6f215e79e651bfe19)"
-# some output elided for brevity
-level=info ts=2019-11-21T20:39:40.262Z caller=web.go:496 component=web msg="Start listening for connections" address=0.0.0.0:9090
-# some output elided for brevity
-level=info ts=2019-11-21T20:39:40.383Z caller=main.go:626 msg="Server is ready to receive web requests."
-```
-
-
-
-Once we know prometheus starts, replace the contents of `prometheus.yml` with the following:
-
-```yaml
-# my global config
-global:
- scrape_interval: 15s # Set the scrape interval to every 15 seconds.
-
-scrape_configs:
- - job_name: 'opentelemetry'
- # metrics_path defaults to '/metrics'
- # scheme defaults to 'http'.
- static_configs:
- - targets: ['localhost:9464']
-```
-
-### Monitor Your NodeJS Application
-
-([link to TypeScript version](ts-example/README.md#monitor-your-nodejs-application))
-
-An example application which can be used with this guide can be found at in the [example directory](example). You can see what it looks like with metric monitoring enabled in the [monitored-example directory](monitored-example).
-
-1. Install the required OpenTelemetry metrics libraries
-2. Initialize a meter and collect metrics
-3. Initialize and register a metrics exporter
-
-#### Install the required OpenTelemetry metrics libraries
-
-([link to TypeScript version](ts-example/README.md#install-the-required-opentelemetry-metrics-libraries))
-
-To create metrics on NodeJS, you will need `@opentelemetry/metrics`.
-
-```sh
-$ npm install \
- @opentelemetry/metrics
-```
-
-#### Initialize a meter and collect metrics
-
-([link to TypeScript version](ts-example/README.md#initialize-a-meter-and-collect-metrics))
-
-In order to create and monitor metrics, we will need a `Meter`. In OpenTelemetry, a `Meter` is the mechanism used to create and manage metrics, labels, and metric exporters.
-
-Create a file named `monitoring.js` and add the following code:
-
-```javascript
-'use strict';
-
-const { MeterProvider } = require('@opentelemetry/metrics');
-
-const meter = new MeterProvider().getMeter('your-meter-name');
-```
-
-Now, you can require this file from your application code and use the `Meter` to create and manage metrics. The simplest of these metrics is a counter. Let's create and export from our `monitoring.js` file a middleware function that express can use to count all requests by route. Modify the `monitoring.js` file so that it looks like this:
-
-```javascript
-'use strict';
-
-const { MeterProvider } = require('@opentelemetry/metrics');
-
-const meter = new MeterProvider().getMeter('your-meter-name');
-
-const requestCount = meter.createCounter("requests", {
- monotonic: true,
- labelKeys: ["route"],
- description: "Count all incoming requests"
-});
-
-const boundInstruments = new Map();
-
-module.exports.countAllRequests = () => {
- return (req, res, next) => {
- if (!boundInstruments.has(req.path)) {
- const labels = { route: req.path };
- const boundCounter = requestCount.bind(labels);
- boundInstruments.set(req.path, boundCounter);
- }
-
- boundInstruments.get(req.path).add(1);
- next();
- };
-};
-```
-
-Now let's import and use this middleware in our application code:
-
-```javascript
-const { countAllRequests } = require("./monitoring");
-const app = express();
-app.use(countAllRequests());
-```
-
-Now, when we make requests to our service our meter will count all requests.
-
-**Note**: Creating a new `labelSet` and `binding` on every request is not ideal as creating the `labelSet` can often be an expensive operation. This is why instruments are created and stored in a `Map` according to the route key.
-
-#### Initialize and register a metrics exporter
-
-([link to TypeScript version](ts-example/README.md#initialize-and-register-a-metrics-exporter))
-
-Counting metrics is only useful if we can export them somewhere that we can see them. For this, we're going to use prometheus. Creating and registering a metrics exporter is much like the tracing exporter above. First we will need to install the prometheus exporter.
-
-```sh
-$ npm install @opentelemetry/exporter-prometheus
-```
-
-Next, modify your `monitoring.js` file to look like this:
-
-```javascript
-"use strict";
-
-const { MeterProvider } = require('@opentelemetry/metrics');
-const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus');
-
-const exporter = new PrometheusExporter(
- {
- startServer: true,
- },
- () => {
- console.log('prometheus scrape endpoint: http://localhost:9464/metrics');
- },
-);
-
-const meter = new MeterProvider({
- exporter,
- interval: 1000,
-}).getMeter('your-meter-name');
-
-const requestCount = meter.createCounter("requests", {
- monotonic: true,
- labelKeys: ["route"],
- description: "Count all incoming requests"
-});
-
-const boundInstruments = new Map();
-
-module.exports.countAllRequests = () => {
- return (req, res, next) => {
- if (!boundInstruments.has(req.path)) {
- const labels = { route: req.path };
- const boundCounter = requestCount.bind(labels);
- boundInstruments.set(req.path, boundCounter);
- }
-
- boundInstruments.get(req.path).add(1);
- next();
- };
-};
-```
-
-Ensure prometheus is running by running the `prometheus` binary from earlier and start your application.
-
-```sh
-$ npm start
-
-> @opentelemetry/getting-started@1.0.0 start /App/opentelemetry-js/getting-started/monitored-example
-> node app.js
-
-prometheus scrape endpoint: http://localhost:9464/metrics
-Listening for requests on http://localhost:8080
-```
-
-Now, each time you browse to you should see "Hello from the backend" in your browser and your metrics in prometheus should update. You can verify the current metrics by browsing to , which should look like this:
-
-```
-# HELP requests Count all incoming requests
-# TYPE requests counter
-requests{route="/"} 1
-requests{route="/middle-tier"} 2
-requests{route="/backend"} 4
-```
-
-You should also be able to see gathered metrics in your prometheus web UI.
-
-
diff --git a/getting-started/example/app.js b/getting-started/example/app.js
deleted file mode 100644
index 86c1a6e802..0000000000
--- a/getting-started/example/app.js
+++ /dev/null
@@ -1,42 +0,0 @@
-"use strict";
-
-const PORT = process.env.PORT || "8080";
-
-const express = require("express");
-const axios = require("axios");
-
-const app = express();
-
-app.get("/", (req, res) => {
- axios
- .get(`http://localhost:${PORT}/middle-tier`)
- .then(() => axios.get(`http://localhost:${PORT}/middle-tier`))
- .then(result => {
- res.send(result.data);
- })
- .catch(err => {
- console.error(err);
- res.status(500).send();
- });
-});
-
-app.get("/middle-tier", (req, res) => {
- axios
- .get(`http://localhost:${PORT}/backend`)
- .then(() => axios.get(`http://localhost:${PORT}/backend`))
- .then(result => {
- res.send(result.data);
- })
- .catch(err => {
- console.error(err);
- res.status(500).send();
- });
-});
-
-app.get("/backend", (req, res) => {
- res.send("Hello from the backend");
-});
-
-app.listen(parseInt(PORT, 10), () => {
- console.log(`Listening for requests on http://localhost:${PORT}`);
-});
diff --git a/getting-started/example/package.json b/getting-started/example/package.json
deleted file mode 100644
index f0949e9575..0000000000
--- a/getting-started/example/package.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "name": "@opentelemetry/getting-started",
- "version": "1.0.0",
- "description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide",
- "main": "app.js",
- "scripts": {
- "start": "node app.js"
- },
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "dependencies": {
- "axios": "^0.19.0",
- "express": "^4.17.1"
- }
-}
diff --git a/getting-started/images/prometheus-graph.png b/getting-started/images/prometheus-graph.png
deleted file mode 100644
index c4e174ffd3..0000000000
Binary files a/getting-started/images/prometheus-graph.png and /dev/null differ
diff --git a/getting-started/images/prometheus.png b/getting-started/images/prometheus.png
deleted file mode 100644
index ef94a1faf0..0000000000
Binary files a/getting-started/images/prometheus.png and /dev/null differ
diff --git a/getting-started/images/zipkin-trace.png b/getting-started/images/zipkin-trace.png
deleted file mode 100644
index 6a14bef5e7..0000000000
Binary files a/getting-started/images/zipkin-trace.png and /dev/null differ
diff --git a/getting-started/images/zipkin.png b/getting-started/images/zipkin.png
deleted file mode 100644
index aef14edfbb..0000000000
Binary files a/getting-started/images/zipkin.png and /dev/null differ
diff --git a/getting-started/monitored-example/app.js b/getting-started/monitored-example/app.js
deleted file mode 100644
index 2144423d6a..0000000000
--- a/getting-started/monitored-example/app.js
+++ /dev/null
@@ -1,44 +0,0 @@
-"use strict";
-
-const PORT = process.env.PORT || "8080";
-
-const express = require("express");
-const axios = require("axios");
-
-const { countAllRequests } = require("./monitoring");
-const app = express();
-app.use(countAllRequests());
-
-app.get("/", (req, res) => {
- axios
- .get(`http://localhost:${PORT}/middle-tier`)
- .then(() => axios.get(`http://localhost:${PORT}/middle-tier`))
- .then(result => {
- res.send(result.data);
- })
- .catch(err => {
- console.error(err);
- res.status(500).send();
- });
-});
-
-app.get("/middle-tier", (req, res) => {
- axios
- .get(`http://localhost:${PORT}/backend`)
- .then(() => axios.get(`http://localhost:${PORT}/backend`))
- .then(result => {
- res.send(result.data);
- })
- .catch(err => {
- console.error(err);
- res.status(500).send();
- });
-});
-
-app.get("/backend", (req, res) => {
- res.send("Hello from the backend");
-});
-
-app.listen(parseInt(PORT, 10), () => {
- console.log(`Listening for requests on http://localhost:${PORT}`);
-});
diff --git a/getting-started/monitored-example/monitoring.js b/getting-started/monitored-example/monitoring.js
deleted file mode 100644
index 3f34387711..0000000000
--- a/getting-started/monitored-example/monitoring.js
+++ /dev/null
@@ -1,39 +0,0 @@
-"use strict";
-
-const { MeterProvider } = require('@opentelemetry/metrics');
-const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus');
-
-const exporter = new PrometheusExporter(
- {
- startServer: true,
- },
- () => {
- console.log('prometheus scrape endpoint: http://localhost:9464/metrics');
- },
-);
-
-const meter = new MeterProvider({
- exporter,
- interval: 1000,
-}).getMeter('example-monitored');
-
-const requestCount = meter.createCounter("requests", {
- monotonic: true,
- labelKeys: ["route"],
- description: "Count all incoming requests"
-});
-
-const boundInstruments = new Map();
-
-module.exports.countAllRequests = () => {
- return (req, res, next) => {
- if (!boundInstruments.has(req.path)) {
- const labels = { route: req.path };
- const boundCounter = requestCount.bind(labels);
- boundInstruments.set(req.path, boundCounter);
- }
-
- boundInstruments.get(req.path).add(1);
- next();
- };
-};
diff --git a/getting-started/monitored-example/package.json b/getting-started/monitored-example/package.json
deleted file mode 100644
index b7e87655c5..0000000000
--- a/getting-started/monitored-example/package.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "name": "@opentelemetry/getting-started",
- "version": "1.0.0",
- "description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide",
- "main": "app.js",
- "scripts": {
- "start": "node app.js"
- },
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "dependencies": {
- "@opentelemetry/metrics": "^0.6.1",
- "axios": "^0.19.0",
- "express": "^4.17.1"
- }
-}
diff --git a/getting-started/traced-example/app.js b/getting-started/traced-example/app.js
deleted file mode 100644
index 86c1a6e802..0000000000
--- a/getting-started/traced-example/app.js
+++ /dev/null
@@ -1,42 +0,0 @@
-"use strict";
-
-const PORT = process.env.PORT || "8080";
-
-const express = require("express");
-const axios = require("axios");
-
-const app = express();
-
-app.get("/", (req, res) => {
- axios
- .get(`http://localhost:${PORT}/middle-tier`)
- .then(() => axios.get(`http://localhost:${PORT}/middle-tier`))
- .then(result => {
- res.send(result.data);
- })
- .catch(err => {
- console.error(err);
- res.status(500).send();
- });
-});
-
-app.get("/middle-tier", (req, res) => {
- axios
- .get(`http://localhost:${PORT}/backend`)
- .then(() => axios.get(`http://localhost:${PORT}/backend`))
- .then(result => {
- res.send(result.data);
- })
- .catch(err => {
- console.error(err);
- res.status(500).send();
- });
-});
-
-app.get("/backend", (req, res) => {
- res.send("Hello from the backend");
-});
-
-app.listen(parseInt(PORT, 10), () => {
- console.log(`Listening for requests on http://localhost:${PORT}`);
-});
diff --git a/getting-started/traced-example/package.json b/getting-started/traced-example/package.json
deleted file mode 100644
index fd690d0062..0000000000
--- a/getting-started/traced-example/package.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "name": "@opentelemetry/getting-started",
- "version": "1.0.0",
- "description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide",
- "main": "app.js",
- "scripts": {
- "start": "node -r ./tracing.js app.js"
- },
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "dependencies": {
- "@opentelemetry/core": "^0.6.1",
- "@opentelemetry/exporter-zipkin": "^0.6.1",
- "@opentelemetry/node": "^0.6.1",
- "@opentelemetry/plugin-http": "^0.6.1",
- "@opentelemetry/tracing": "^0.6.1",
- "axios": "^0.19.0",
- "express": "^4.17.1"
- }
-}
diff --git a/getting-started/traced-example/tracing.js b/getting-started/traced-example/tracing.js
deleted file mode 100644
index fcb5b2e610..0000000000
--- a/getting-started/traced-example/tracing.js
+++ /dev/null
@@ -1,22 +0,0 @@
-"use strict";
-
-const { LogLevel } = require("@opentelemetry/core");
-const { NodeTracerProvider } = require("@opentelemetry/node");
-const { SimpleSpanProcessor } = require("@opentelemetry/tracing");
-const { ZipkinExporter } = require("@opentelemetry/exporter-zipkin");
-
-const provider = new NodeTracerProvider({ logLevel: LogLevel.ERROR });
-
-provider.addSpanProcessor(
- new SimpleSpanProcessor(
- new ZipkinExporter({
- serviceName: "getting-started"
- // If you are running your tracing backend on another host,
- // you can point to it using the `url` parameter of the
- // exporter config.
- })
- )
-);
-
-provider.register();
-console.log("tracing initialized");
diff --git a/getting-started/ts-example/README.md b/getting-started/ts-example/README.md
deleted file mode 100644
index 4414049bf7..0000000000
--- a/getting-started/ts-example/README.md
+++ /dev/null
@@ -1,364 +0,0 @@
-# Getting Started with OpenTelemetry JS (TypeScript)
-
-This TypeScript guide will walk you through the setup and configuration process for a tracing backend (in this case [Zipkin](https://zipkin.io), but [Jaeger](https://www.jaegertracing.io) would be simple to use as well), a metrics backend like [Prometheus](https://prometheus.io), and auto-instrumentation of NodeJS. [You can find the guide for JavaScript here](../README.md#getting-started-with-opentelemetry-js).
-
-1. [Tracing Your Application with OpenTelemetry](#tracing-your-application-with-opentelemetry)
- 1. [Setting up a Tracing Backend](#setting-up-a-tracing-backend)
- 2. [Trace Your NodeJS Application](#trace-your-nodejs-application)
- 1. [Install the required OpenTelemetry libraries](#install-the-required-opentelemetry-libraries)
- 2. [Initialize a global tracer](#initialize-a-global-tracer)
- 3. [Initialize and register a trace exporter](#initialize-and-register-a-trace-exporter)
-2. [Collect Metrics Using OpenTelemetry](#collect-metrics-using-opentelemetry)
- 1. [Set up a Metrics Backend](#set-up-a-metrics-backend)
- 2. [Monitor Your NodeJS Application](#monitor-your-nodejs-application)
- 1. [Install the required OpenTelemetry metrics libraries](#install-the-required-opentelemetry-metrics-libraries)
- 2. [Initialize a meter and collect metrics](#initialize-a-meter-and-collect-metrics)
- 3. [Initialize and register a metrics exporter](#initialize-and-register-a-metrics-exporter)
-
-## Tracing Your Application with OpenTelemetry
-
-([link to JavaScript version](../README.md#tracing-your-application-with-opentelemetry))
-
-This guide assumes you are going to be using Zipkin as your tracing backend, but modifying it for Jaeger should be straightforward.
-
-An example application which can be used with this guide can be found at in the same directory.
-
-### Setting up a Tracing Backend
-
-([link to JavaScript version](../README.md#setting-up-a-tracing-backend))
-
-The first thing we will need before we can start collecting traces is a tracing backend like Zipkin that we can export traces to. If you already have a supported tracing backend (Zipkin or Jaeger), you can skip this step. If not, you will need to run one.
-
-In order to set up Zipkin as quickly as possible, run the latest [Docker Zipkin](https://github.com/openzipkin/docker-zipkin) container, exposing port `9411`. If you can’t run Docker containers, you will need to download and run Zipkin by following the Zipkin [quickstart guide](https://zipkin.io/pages/quickstart.html).
-
-```sh
-$ docker run --rm -d -p 9411:9411 --name zipkin openzipkin/zipkin
-```
-
-Browse to to ensure that you can see the Zipkin UI.
-
-
-
-### Trace Your NodeJS Application
-
-([link to JavaScript version](../README.md#trace-your-nodejs-application))
-
-This guide uses the example application provided in the `example` directory, but the steps to instrument your own application should be broadly the same. Here is an overview of what we will be doing.
-
-1. Install the required OpenTelemetry libraries
-2. Initialize a global tracer
-3. Initialize and register a trace exporter
-
-#### Install the required OpenTelemetry libraries
-
-([link to JavaScript version](../README.md#install-the-required-opentelemetry-libraries))
-
-To create traces on NodeJS, you will need `@opentelemetry/node`, `@opentelemetry/core`, and any plugins required by your application such as gRPC, or HTTP. If you are using the example application, you will need to install `@opentelemetry/plugin-http`.
-
-```sh
-$ npm install \
- @opentelemetry/core \
- @opentelemetry/node \
- @opentelemetry/plugin-http \
- @opentelemetry/api
-```
-
-#### Initialize a global tracer
-
-([link to JavaScript version](../README.md#initialize-a-global-tracer))
-
-All tracing initialization should happen before your application’s code runs. The easiest way to do this is to initialize tracing in a separate file that is required using node’s `-r` option before application code runs.
-
-Create a file named `tracing.ts` and add the following code:
-
-```typescript
-import * as opentelemetry from '@opentelemetry/api';
-import { LogLevel } from '@opentelemetry/core';
-import { NodeTracerProvider } from '@opentelemetry/node';
-
-const provider: NodeTracerProvider = new NodeTracerProvider({
- logLevel: LogLevel.ERROR
-});
-
-provider.register();
-```
-
-If you run your application now with `ts-node -r ./tracing.ts app.ts`, your application will create and propagate traces over HTTP. If an already instrumented service that supports [Trace Context](https://www.w3.org/TR/trace-context/) headers calls your application using HTTP, and you call another application using HTTP, the Trace Context headers will be correctly propagated.
-
-If you wish to see a completed trace, however, there is one more step. You must register an exporter to send traces to a tracing backend.
-
-#### Initialize and Register a Trace Exporter
-
-([link to JavaScript version](../README.md#initialize-and-register-a-trace-exporter))
-
-This guide uses the Zipkin tracing backend, but if you are using another backend like [Jaeger](https://www.jaegertracing.io), this is where you would make your change.
-
-To export traces, we will need a few more dependencies. Install them with the following command:
-
-```sh
-$ npm install \
- @opentelemetry/tracing \
- @opentelemetry/exporter-zipkin
-
-$ # for jaeger you would run this command:
-$ # npm install @opentelemetry/exporter-jaeger
-```
-
-After these dependencies are installed, we will need to initialize and register them. Modify `tracing.ts` so that it matches the following code snippet, replacing the service name `"getting-started"` with your own service name if you wish.
-
-```typescript
-import { LogLevel } from '@opentelemetry/core';
-import { NodeTracerProvider } from '@opentelemetry/node';
-
-import { SimpleSpanProcessor } from '@opentelemetry/tracing';
-import { ZipkinExporter } from '@opentelemetry/exporter-zipkin';
-// For Jaeger, use the following line instead:
-// import { JaegerExporter } from '@opentelemetry/exporter-jaeger';
-
-const provider: NodeTracerProvider = new NodeTracerProvider({
- logLevel: LogLevel.ERROR
-});
-
-provider.register();
-
-provider.addSpanProcessor(
- new SimpleSpanProcessor(
- new ZipkinExporter({
- // For Jaeger, use the following line instead:
- // new JaegerExporter({
- serviceName: "getting-started"
- // If you are running your tracing backend on another host,
- // you can point to it using the `url` parameter of the
- // exporter config.
- })
- )
-);
-
-console.log("tracing initialized");
-```
-
-Now if you run your application with the `tracing.ts` file loaded, and you send requests to your application over HTTP (in the sample application just browse to http://localhost:8080), you will see traces exported to your tracing backend that look like this:
-
-```sh
-$ ts-node -r ./tracing.ts app.ts
-```
-
-
-
-**Note:** Some spans appear to be duplicated, but they are not. This is because the sample application is both the client and the server for these requests. You see one span that is the client side request timing, and one span that is the server side request timing. Anywhere they don’t overlap is network time.
-
-## Collect Metrics Using OpenTelemetry
-
-([link to JavaScript version](../README.md#collect-metrics-using-opentelemetry))
-
-This guide assumes you are going to be using Prometheus as your metrics backend. It is currently the only metrics backend supported by OpenTelemetry JS.
-
-**Note**: This section is a work in progress
-
-### Set up a Metrics Backend
-
-([link to JavaScript version](../README.md#set-up-a-metrics-backend))
-
-Now that we have end-to-end traces, we will collect and export some basic metrics.
-
-Currently, the only supported metrics backend is [Prometheus](https://prometheus.io). Head to the [Prometheus download page](https://prometheus.io/download/) and download the latest release of Prometheus for your operating system.
-
-Open a command line and `cd` into the directory where you downloaded the Prometheus tarball. Untar it and change into the newly created directory.
-
-```sh
-$ cd Downloads
-
-$ # Replace the file name below with your downloaded tarball
-$ tar xvfz prometheus-2.14.0.darwin-amd64.tar
-
-$ # Replace the dir below with your created directory
-$ cd prometheus-2.14.0.darwin-amd64
-
-$ ls
-LICENSE console_libraries data prometheus.yml tsdb
-NOTICE consoles prometheus promtool
-```
-
-The created directory should have a file named `prometheus.yml`. This is the file used to configure Prometheus. For now, just make sure Prometheus starts by running the `./prometheus` binary in the folder and browse to .
-
-```sh
-$ ./prometheus
-# some output elided for brevity
-msg="Starting Prometheus" version="(version=2.14.0, branch=HEAD, revision=edeb7a44cbf745f1d8be4ea6f215e79e651bfe19)"
-# some output elided for brevity
-level=info ts=2019-11-21T20:39:40.262Z caller=web.go:496 component=web msg="Start listening for connections" address=0.0.0.0:9090
-# some output elided for brevity
-level=info ts=2019-11-21T20:39:40.383Z caller=main.go:626 msg="Server is ready to receive web requests."
-```
-
-
-
-Once we know prometheus starts, replace the contents of `prometheus.yml` with the following:
-
-```yaml
-# my global config
-global:
- scrape_interval: 15s # Set the scrape interval to every 15 seconds.
-
-scrape_configs:
- - job_name: 'opentelemetry'
- # metrics_path defaults to '/metrics'
- # scheme defaults to 'http'.
- static_configs:
- - targets: ['localhost:9464']
-```
-
-### Monitor Your NodeJS Application
-
-([link to JavaScript version](../README.md#monitor-your-nodejs-application))
-
-An example application which can be used with this guide can be found at in the current directory.
-
-1. Install the required OpenTelemetry metrics libraries
-2. Initialize a meter and collect metrics
-3. Initialize and register a metrics exporter
-
-#### Install the required OpenTelemetry metrics libraries
-
-([link to JavaScript version](../README.md#install-the-required-opentelemetry-metrics-libraries))
-
-To create metrics on NodeJS, you will need `@opentelemetry/metrics`.
-
-```sh
-$ npm install @opentelemetry/metrics
-```
-
-#### Initialize a meter and collect metrics
-
-([link to JavaScript version](../README.md#initialize-a-meter-and-collect-metrics))
-
-In order to create and monitor metrics, we will need a `Meter`. In OpenTelemetry, a `Meter` is the mechanism used to create and manage metrics, labels, and metric exporters.
-
-Create a file named `monitoring.ts` and add the following code:
-
-```typescript
-import { MeterProvider } from '@opentelemetry/metrics';
-
-const meter = new MeterProvider().getMeter('your-meter-name');
-```
-
-Now, you can require this file from your application code and use the `Meter` to create and manage metrics. The simplest of these metrics is a counter. Let's create and export from our `monitoring.ts` file a middleware function that express can use to count all requests by route. Modify the `monitoring.ts` file so that it looks like this:
-
-```typescript
-import { MeterProvider } from '@opentelemetry/metrics';
-import { Metric, BoundCounter } from '@opentelemetry/api';
-
-const meter = new MeterProvider().getMeter('your-meter-name');
-
-const requestCount: Metric = meter.createCounter("requests", {
- monotonic: true,
- labelKeys: ["route"],
- description: "Count all incoming requests"
-});
-
-const handles = new Map();
-
-export const countAllRequests = () => {
- return (req, res, next) => {
- if (!handles.has(req.path)) {
- const labels = { route: req.path };
- const handle = requestCount.bind(labels);
- handles.set(req.path, handle);
- }
-
- handles.get(req.path).add(1);
- next();
- };
-};
-```
-
-Now let's import and use this middleware in our application code:
-
-```typescript
-import { countAllRequests } from "./monitoring";
-const app = express();
-app.use(countAllRequests());
-```
-
-Now, when we make requests to our service our meter will count all requests.
-
-**Note**: Creating a new `labelSet` and `handle` on every request is not ideal as creating the `labelSet` can often be an expensive operation. This is why handles are created and stored in a `Map` according to the route key.
-
-#### Initialize and register a metrics exporter
-
-([link to JavaScript version](../README.md#initialize-and-register-a-metrics-exporter))
-
-Counting metrics is only useful if we can export them somewhere that we can see them. For this, we're going to use prometheus. Creating and registering a metrics exporter is much like the tracing exporter above. First we will need to install the prometheus exporter.
-
-```sh
-$ npm install @opentelemetry/exporter-prometheus
-```
-
-Next, modify your `monitoring.ts` file to look like this:
-
-```typescript
-import { MeterProvider } from '@opentelemetry/metrics';
-import { Metric, BoundCounter } from '@opentelemetry/api';
-import { PrometheusExporter } from '@opentelemetry/exporter-prometheus';
-
-const exporter = new PrometheusExporter(
- {
- startServer: true,
- },
- () => {
- console.log('prometheus scrape endpoint: http://localhost:9464/metrics');
- },
-);
-
-const meter = new MeterProvider({
- exporter,
- interval: 1000,
-}).getMeter('your-meter-name');
-
-const requestCount: Metric = meter.createCounter("requests", {
- monotonic: true,
- labelKeys: ["route"],
- description: "Count all incoming requests"
-});
-
-const handles = new Map();
-
-export const countAllRequests = () => {
- return (req, res, next) => {
- if (!handles.has(req.path)) {
- const labels = { route: req.path };
- const handle = requestCount.bind(labels);
- handles.set(req.path, handle);
- }
-
- handles.get(req.path).add(1);
- next();
- };
-};
-```
-
-Ensure prometheus is running by running the `prometheus` binary from earlier and start your application.
-
-```sh
-$ npm start
-
-> @opentelemetry/getting-started@1.0.0 start /Users/.../opentelemetry-js/getting-started/example/ts
-> ts-node app.ts
-
-prometheus scrape endpoint: http://localhost:9464/metrics
-Listening for requests on http://localhost:8080
-```
-
-Now, each time you browse to you should see "Hello from the backend" in your browser and your metrics in prometheus should update. You can verify the current metrics by browsing to , which should look like this:
-
-```
-# HELP requests Count all incoming requests
-# TYPE requests counter
-requests{route="/"} 1
-requests{route="/middle-tier"} 2
-requests{route="/backend"} 4
-```
-
-You should also be able to see gathered metrics in your prometheus web UI.
-
-
diff --git a/getting-started/ts-example/app.ts b/getting-started/ts-example/app.ts
deleted file mode 100644
index 64e861c152..0000000000
--- a/getting-started/ts-example/app.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import * as express from "express";
-import axios from "axios";
-
-import { countAllRequests } from "./monitoring";
-
-const PORT: string = process.env.PORT || "8080";
-
-const app = express();
-
-app.get("/", (req, res) => {
- axios
- .get(`http://localhost:${PORT}/middle-tier`)
- .then(() => axios.get(`http://localhost:${PORT}/middle-tier`))
- .then(result => {
- res.send(result.data);
- })
- .catch(err => {
- console.error(err);
- res.status(500).send();
- });
-});
-
-app.get("/middle-tier", (req, res) => {
- axios
- .get(`http://localhost:${PORT}/backend`)
- .then(() => axios.get(`http://localhost:${PORT}/backend`))
- .then(result => {
- res.send(result.data);
- })
- .catch(err => {
- console.error(err);
- res.status(500).send();
- });
-});
-
-app.get("/backend", (req, res) => {
- res.send("Hello from the backend");
-});
-
-app.use(countAllRequests());
-
-app.listen(parseInt(PORT, 10), () => {
- console.log(`Listening for requests on http://localhost:${PORT}`);
-});
diff --git a/getting-started/ts-example/monitoring.ts b/getting-started/ts-example/monitoring.ts
deleted file mode 100644
index a7e544d762..0000000000
--- a/getting-started/ts-example/monitoring.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import { MeterProvider } from '@opentelemetry/metrics';
-import { Metric, BoundCounter } from '@opentelemetry/api';
-import { PrometheusExporter } from '@opentelemetry/exporter-prometheus';
-
-const exporter = new PrometheusExporter(
- {
- startServer: true,
- },
- () => {
- console.log('prometheus scrape endpoint: http://localhost:9464/metrics');
- },
-);
-
-const meter = new MeterProvider({
- exporter,
- interval: 1000,
-}).getMeter('example-ts');
-
-const requestCount: Metric = meter.createCounter("requests", {
- monotonic: true,
- labelKeys: ["route"],
- description: "Count all incoming requests"
-});
-
-const handles = new Map();
-
-export const countAllRequests = () => {
- return (req, res, next) => {
- if (!handles.has(req.path)) {
- const labels = { route: req.path };
- const handle = requestCount.bind(labels);
- handles.set(req.path, handle);
- }
-
- handles.get(req.path).add(1);
- next();
- };
-};
diff --git a/getting-started/ts-example/package.json b/getting-started/ts-example/package.json
deleted file mode 100644
index 681ffeae32..0000000000
--- a/getting-started/ts-example/package.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "name": "@opentelemetry/getting-started-ts",
- "version": "1.0.0",
- "description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide",
- "main": "app.ts",
- "scripts": {
- "start": "ts-node app.ts",
- "start-tracing": "ts-node -r ./tracing.ts app.ts"
- },
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "devDependencies": {
- "ts-node": "^8.6.2"
- },
- "dependencies": {
- "@opentelemetry/api": "^0.6.1",
- "@opentelemetry/core": "^0.6.1",
- "@opentelemetry/exporter-prometheus": "^0.6.1",
- "@opentelemetry/exporter-zipkin": "^0.6.1",
- "@opentelemetry/metrics": "^0.6.1",
- "@opentelemetry/node": "^0.6.1",
- "@opentelemetry/plugin-http": "^0.6.1",
- "@opentelemetry/tracing": "^0.6.1",
- "axios": "^0.19.1",
- "express": "^4.17.1"
- }
-}
diff --git a/getting-started/ts-example/tracing.ts b/getting-started/ts-example/tracing.ts
deleted file mode 100644
index 7afb8077a7..0000000000
--- a/getting-started/ts-example/tracing.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { LogLevel } from '@opentelemetry/core';
-import { NodeTracerProvider } from "@opentelemetry/node";
-import { SimpleSpanProcessor } from "@opentelemetry/tracing";
-import { ZipkinExporter } from "@opentelemetry/exporter-zipkin";
-
-const provider: NodeTracerProvider = new NodeTracerProvider({
- logLevel: LogLevel.ERROR
-});
-
-provider.register();
-
-provider.addSpanProcessor(
- new SimpleSpanProcessor(
- new ZipkinExporter({
- serviceName: "getting-started"
- // If you are running your tracing backend on another host,
- // you can point to it using the `url` parameter of the
- // exporter config.
- })
- )
-);
-
-console.log("tracing initialized");
diff --git a/lerna.json b/lerna.json
index 56065fc8f9..3af16baa9d 100644
--- a/lerna.json
+++ b/lerna.json
@@ -2,13 +2,13 @@
"lerna": "3.13.4",
"npmClient": "npm",
"packages": [
- "benchmark/*",
"packages/*",
- "packages/opentelemetry-plugin-postgres/*"
+ "plugins/*",
+ "plugins/opentelemetry-plugin-postgres/*"
],
"version": "0.6.1",
"changelog": {
- "repo": "open-telemetry/opentelemetry-js",
+ "repo": "open-telemetry/opentelemetry-js-contrib",
"labels": {
"breaking": ":boom: Breaking Change",
"enhancement": ":rocket: (Enhancement)",
diff --git a/package.json b/package.json
index 2ec08f85bc..30f440061b 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,10 @@
{
- "name": "opentelemetry-base",
+ "name": "opentelemetry-contrib",
"version": "0.6.1",
"description": "OpenTelemetry is a distributed tracing and stats collection framework.",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"scripts": {
- "bench": "node benchmark",
"clean": "lerna run clean",
"postinstall": "npm run bootstrap",
"precompile": "tsc --version",
@@ -18,10 +17,6 @@
"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",
- "docs-deploy": "gh-pages --dist packages/opentelemetry-api/docs/out",
"lint": "lerna run lint",
"lint:fix": "lerna run lint:fix",
"lint:examples": "eslint ./examples/**/*.js",
diff --git a/packages/opentelemetry-api/README.md b/packages/opentelemetry-api/README.md
deleted file mode 100644
index 2e8d75cd41..0000000000
--- a/packages/opentelemetry-api/README.md
+++ /dev/null
@@ -1,202 +0,0 @@
-# OpenTelemetry API for JavaScript
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![devDependencies][devDependencies-image]][devDependencies-url]
-[![Apache License][license-image]][license-image]
-
-This package provides everything needed to interact with the OpenTelemetry API, including all TypeScript interfaces, enums, and no-op implementations. It is intended for use both on the server and in the browser.
-
-## Quick Start
-
-To get started tracing you need to install the SDK and plugins, create a TracerProvider, and register it with the API.
-
-### Install Dependencies
-
-```sh
-$ # Install tracing dependencies
-$ npm install \
- @opentelemetry/core \
- @opentelemetry/node \
- @opentelemetry/tracing \
- @opentelemetry/exporter-jaeger \ # add exporters as needed
- @opentelemetry/plugin-http # add plugins as needed
-
-$ # Install metrics dependencies
-$ npm install \
- @opentelemetry/metrics \
- @opentelemetry/exporter-prometheus # add exporters as needed
-```
-
-### Initialize the SDK
-
-Before any other module in your application is loaded, you must initialize the global tracer and meter providers. If you fail to initialize a provider, no-op implementations will be provided to any library which acquires them from the API.
-
-To collect traces and metrics, you will have to tell the SDK where to export telemetry data to. This example uses Jaeger and Prometheus, but exporters exist for [other tracing backends][other-tracing-backends]. If you're not sure if there is an exporter for your tracing backend, contact your tracing provider.
-
-#### Tracing
-
-```javascript
-const { NodeTracerProvider } = require("@opentelemetry/node");
-const { SimpleSpanProcessor } = require("@opentelemetry/tracing");
-const { JaegerExporter } = require("@opentelemetry/exporter-jaeger");
-
-const tracerProvider = new NodeTracerProvider();
-
-/**
- * The SimpleSpanProcessor does no batching and exports spans
- * immediately when they end. For most production use cases,
- * OpenTelemetry recommends use of the BatchSpanProcessor.
- */
-tracerProvider.addSpanProcessor(
- new SimpleSpanProcessor(
- new JaegerExporter(
- /* export options */
- )
- )
-);
-
-/**
- * Registering the provider with the API allows it to be discovered
- * and used by instrumentation libraries. The OpenTelemetry API provides
- * methods to set global SDK implementations, but the default SDK provides
- * a convenience method named `register` which registers same defaults
- * for you.
- *
- * By default the NodeTracerProvider uses Trace Context for propagation
- * and AsyncHooksScopeManager for context management. To learn about
- * customizing this behavior, see API Registration Options below.
- */
-tracerProvider.register();
-```
-
-#### Metrics
-
-```javascript
-const api = require("@opentelemetry/api");
-const { MeterProvider } = require("@opentelemetry/metrics");
-const { PrometheusExporter } = require("@opentelemetry/exporter-prometheus");
-
-const meterProvider = new MeterProvider({
- // The Prometheus exporter runs an HTTP server which
- // the Prometheus backend scrapes to collect metrics.
- exporter: new PrometheusExporter({ startServer: true }),
- interval: 1000,
-});
-
-/**
- * Registering the provider with the API allows it to be discovered
- * and used by instrumentation libraries.
- */
-api.metrics.setGlobalMeterProvider(meterProvider);
-```
-
-## Advanced Use
-### API Registration Options
-
-If you prefer to choose your own propagator or context manager, you may pass an options object into the `tracerProvider.register()` method. Omitted or `undefined` options will be replaced by a default value and `null` values will be skipped.
-
-```javascript
-const { B3Propagator } = require("@opentelemetry/core");
-
-tracerProvider.register({
- // Use B3 Propagation
- propagator: new B3Propagator(),
-
- // Skip registering a default context manager
- contextManager: null,
-});
-```
-
-### API Methods
-
-If you are writing an instrumentation library, or prefer to call the API methods directly rather than using the `register` method on the Tracer/Meter Provider, OpenTelemetry provides direct access to the underlying API methods through the `@opentelemetry/api` package. API entry points are defined as global singleton objects `trace`, `metrics`, `propagation`, and `context` which contain methods used to initialize SDK implementations and acquire resources from the API.
-
-- [Trace API Documentation][trace-api-docs]
-- [Metrics API Documentation][metrics-api-docs]
-- [Propagation API Documentation][propagation-api-docs]
-- [Context API Documentation][context-api-docs]
-
-```javascript
-const api = require("@opentelemetry/api");
-
-/* Initialize TraceProvider */
-api.trace.setGlobalTracerProvider(traceProvider);
-/* returns traceProvider (no-op if a working provider has not been initialized) */
-api.trace.getTracerProvider();
-/* returns a tracer from the registered global tracer provider (no-op if a working provider has not been initialized); */
-api.trace.getTracer(name, version);
-
-/* Initialize MeterProvider */
-api.metrics.setGlobalMeterProvider(meterProvider);
-/* returns meterProvider (no-op if a working provider has not been initialized) */
-api.metrics.getMeterProvider();
-/* returns a meter from the registered global meter provider (no-op if a working provider has not been initialized); */
-api.metrics.getMeter(name, version);
-
-/* Initialize Propagator */
-api.propagation.setGlobalPropagator(httpTraceContextPropagator);
-
-/* Initialize Context Manager */
-api.context.setGlobalContextManager(asyncHooksContextManager);
-```
-
-### Library Authors
-
-Library authors need only to depend on the `@opentelemetry/api` package and trust that the application owners which use their library will initialize an appropriate SDK.
-
-```javascript
-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() });
- try {
- const result = await doSomethingElse();
- span.end();
- return result;
- } catch (err) {
- span.setStatus({
- // use an appropriate status code here
- code: api.CanonicalCode.INTERNAL,
- message: err.message,
- });
- span.end();
- return null;
- }
-}
-```
-
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more about OpenTelemetry JavaScript:
-- For help or feedback on this project, join us on [gitter][gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-api
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-api
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-api
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-api&type=dev
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/api
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fapi.svg
-
-[trace-api-docs]: https://open-telemetry.github.io/opentelemetry-js/classes/traceapi.html
-[metrics-api-docs]: https://open-telemetry.github.io/opentelemetry-js/classes/metricsapi.html
-[propagation-api-docs]: https://open-telemetry.github.io/opentelemetry-js/classes/propagationapi.html
-[context-api-docs]: https://open-telemetry.github.io/opentelemetry-js/classes/contextapi.html
-
-[web]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-web
-[tracing]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-tracing
-[node]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-node
-[metrics]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-metrics
-
-[other-tracing-backends]: https://github.com/open-telemetry/opentelemetry-js#trace-exporters
diff --git a/packages/opentelemetry-api/package.json b/packages/opentelemetry-api/package.json
deleted file mode 100644
index d3a5b5e287..0000000000
--- a/packages/opentelemetry-api/package.json
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "name": "@opentelemetry/api",
- "version": "0.6.1",
- "description": "Public API for OpenTelemetry",
- "main": "build/src/index.js",
- "types": "build/src/index.d.ts",
- "repository": "open-telemetry/opentelemetry-js",
- "scripts": {
- "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 ../../",
- "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "build": "npm run compile",
- "lint": "gts check",
- "lint:fix": "gts fix",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "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"
- },
- "keywords": [
- "opentelemetry",
- "nodejs",
- "browser",
- "tracing",
- "profiling",
- "metrics",
- "stats",
- "monitoring"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "dependencies": {
- "@opentelemetry/context-base": "^0.6.1"
- },
- "devDependencies": {
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.8",
- "@types/webpack-env": "1.13.9",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "istanbul-instrumenter-loader": "^3.0.1",
- "karma": "^4.4.1",
- "karma-chrome-launcher": "^3.1.0",
- "karma-coverage-istanbul-reporter": "^2.1.0",
- "karma-mocha": "^1.3.0",
- "karma-spec-reporter": "^0.0.32",
- "karma-webpack": "^4.0.2",
- "linkinator": "^2.0.3",
- "mocha": "^6.1.0",
- "nyc": "^15.0.0",
- "ts-loader": "^6.0.4",
- "ts-mocha": "^6.0.0",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typedoc": "^0.15.0",
- "typescript": "3.7.2",
- "webpack": "^4.35.2"
- }
-}
diff --git a/packages/opentelemetry-api/src/api/context.ts b/packages/opentelemetry-api/src/api/context.ts
deleted file mode 100644
index 3c5f7f0ea7..0000000000
--- a/packages/opentelemetry-api/src/api/context.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- ContextManager,
- NoopContextManager,
- Context,
-} from '@opentelemetry/context-base';
-
-/**
- * Singleton object which represents the entry point to the OpenTelemetry Context API
- */
-export class ContextAPI {
- private static _instance?: ContextAPI;
- private _contextManager: ContextManager = new NoopContextManager();
-
- /** Empty private constructor prevents end users from constructing a new instance of the API */
- private constructor() {}
-
- /** Get the singleton instance of the Context API */
- public static getInstance(): ContextAPI {
- if (!this._instance) {
- this._instance = new ContextAPI();
- }
-
- return this._instance;
- }
-
- /**
- * Set the current context manager. Returns the initialized context manager
- */
- public setGlobalContextManager(
- contextManager: ContextManager
- ): ContextManager {
- this._contextManager = contextManager;
- return contextManager;
- }
-
- /**
- * Get the currently active context
- */
- public active(): Context {
- return this._contextManager.active();
- }
-
- /**
- * Execute a function with an active context
- *
- * @param context context to be active during function execution
- * @param fn function to execute in a context
- */
- public with ReturnType>(
- context: Context,
- fn: T
- ): ReturnType {
- return this._contextManager.with(context, fn);
- }
-
- /**
- * Bind a context to a target function or event emitter
- *
- * @param target function or event emitter to bind
- * @param context context to bind to the event emitter or function. Defaults to the currently active context
- */
- public bind(target: T, context: Context = this.active()): T {
- return this._contextManager.bind(target, context);
- }
-}
diff --git a/packages/opentelemetry-api/src/api/metrics.ts b/packages/opentelemetry-api/src/api/metrics.ts
deleted file mode 100644
index 118c20db99..0000000000
--- a/packages/opentelemetry-api/src/api/metrics.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Meter } from '../metrics/Meter';
-import { MeterProvider } from '../metrics/MeterProvider';
-import { NOOP_METER_PROVIDER } from '../metrics/NoopMeterProvider';
-
-/**
- * Singleton object which represents the entry point to the OpenTelemetry Metrics API
- */
-export class MetricsAPI {
- private static _instance?: MetricsAPI;
- private _meterProvider: MeterProvider = NOOP_METER_PROVIDER;
-
- /** Empty private constructor prevents end users from constructing a new instance of the API */
- private constructor() {}
-
- /** Get the singleton instance of the Metrics API */
- public static getInstance(): MetricsAPI {
- if (!this._instance) {
- this._instance = new MetricsAPI();
- }
-
- return this._instance;
- }
-
- /**
- * Set the current global meter. Returns the initialized global meter provider.
- */
- public setGlobalMeterProvider(provider: MeterProvider): MeterProvider {
- this._meterProvider = provider;
- return provider;
- }
-
- /**
- * Returns the global meter provider.
- */
- public getMeterProvider(): MeterProvider {
- return this._meterProvider;
- }
-
- /**
- * Returns a meter from the global meter provider.
- */
- public getMeter(name: string, version?: string): Meter {
- return this.getMeterProvider().getMeter(name, version);
- }
-}
diff --git a/packages/opentelemetry-api/src/api/propagation.ts b/packages/opentelemetry-api/src/api/propagation.ts
deleted file mode 100644
index f26c3c6f80..0000000000
--- a/packages/opentelemetry-api/src/api/propagation.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Context } from '@opentelemetry/context-base';
-import { defaultGetter, GetterFunction } from '../context/propagation/getter';
-import { HttpTextPropagator } from '../context/propagation/HttpTextPropagator';
-import { NOOP_HTTP_TEXT_PROPAGATOR } from '../context/propagation/NoopHttpTextPropagator';
-import { defaultSetter, SetterFunction } from '../context/propagation/setter';
-import { ContextAPI } from './context';
-
-const contextApi = ContextAPI.getInstance();
-
-/**
- * Singleton object which represents the entry point to the OpenTelemetry Propagation API
- */
-export class PropagationAPI {
- private static _instance?: PropagationAPI;
- private _propagator: HttpTextPropagator = NOOP_HTTP_TEXT_PROPAGATOR;
-
- /** Empty private constructor prevents end users from constructing a new instance of the API */
- private constructor() {}
-
- /** Get the singleton instance of the Propagator API */
- public static getInstance(): PropagationAPI {
- if (!this._instance) {
- this._instance = new PropagationAPI();
- }
-
- return this._instance;
- }
-
- /**
- * Set the current propagator. Returns the initialized propagator
- */
- public setGlobalPropagator(
- propagator: HttpTextPropagator
- ): HttpTextPropagator {
- this._propagator = propagator;
- return propagator;
- }
-
- /**
- * Inject context into a carrier to be propagated inter-process
- *
- * @param carrier carrier to inject context into
- * @param setter Function used to set values on the carrier
- * @param context Context carrying tracing data to inject. Defaults to the currently active context.
- */
- public inject(
- carrier: Carrier,
- setter: SetterFunction = defaultSetter,
- context = contextApi.active()
- ): void {
- return this._propagator.inject(context, carrier, setter);
- }
-
- /**
- * Extract context from a carrier
- *
- * @param carrier Carrier to extract context from
- * @param getter Function used to extract keys from a carrier
- * @param context Context which the newly created context will inherit from. Defaults to the currently active context.
- */
- public extract(
- carrier: Carrier,
- getter: GetterFunction = defaultGetter,
- context = contextApi.active()
- ): Context {
- return this._propagator.extract(context, carrier, getter);
- }
-}
diff --git a/packages/opentelemetry-api/src/api/trace.ts b/packages/opentelemetry-api/src/api/trace.ts
deleted file mode 100644
index 4af88e70e6..0000000000
--- a/packages/opentelemetry-api/src/api/trace.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { NOOP_TRACER_PROVIDER } from '../trace/NoopTracerProvider';
-import { TracerProvider } from '../trace/tracer_provider';
-import { Tracer } from '../trace/tracer';
-
-/**
- * Singleton object which represents the entry point to the OpenTelemetry Tracing API
- */
-export class TraceAPI {
- private static _instance?: TraceAPI;
- private _tracerProvider: TracerProvider = NOOP_TRACER_PROVIDER;
-
- /** Empty private constructor prevents end users from constructing a new instance of the API */
- private constructor() {}
-
- /** Get the singleton instance of the Trace API */
- public static getInstance(): TraceAPI {
- if (!this._instance) {
- this._instance = new TraceAPI();
- }
-
- return this._instance;
- }
-
- /**
- * Set the current global tracer. Returns the initialized global tracer provider
- */
- public setGlobalTracerProvider(provider: TracerProvider): TracerProvider {
- this._tracerProvider = provider;
- return provider;
- }
-
- /**
- * Returns the global tracer provider.
- */
- public getTracerProvider(): TracerProvider {
- return this._tracerProvider;
- }
-
- /**
- * Returns a tracer from the global tracer provider.
- */
- public getTracer(name: string, version?: string): Tracer {
- return this.getTracerProvider().getTracer(name, version);
- }
-}
diff --git a/packages/opentelemetry-api/src/common/Logger.ts b/packages/opentelemetry-api/src/common/Logger.ts
deleted file mode 100644
index abb8885a15..0000000000
--- a/packages/opentelemetry-api/src/common/Logger.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export type LogFunction = (message: string, ...args: unknown[]) => void;
-
-/** Defines a logger interface. */
-export interface Logger {
- error: LogFunction;
- warn: LogFunction;
- info: LogFunction;
- debug: LogFunction;
-}
diff --git a/packages/opentelemetry-api/src/common/Time.ts b/packages/opentelemetry-api/src/common/Time.ts
deleted file mode 100644
index 0723d9cc43..0000000000
--- a/packages/opentelemetry-api/src/common/Time.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** High resolution HrTime: [seconds: number, nanoseconds: number] */
-export type HrTime = [number, number];
-
-/**
- * Defines TimeInput.
- *
- * hrtime, epoch milliseconds, performance.now() or Date
- */
-export type TimeInput = HrTime | number | Date;
diff --git a/packages/opentelemetry-api/src/context/propagation/HttpTextPropagator.ts b/packages/opentelemetry-api/src/context/propagation/HttpTextPropagator.ts
deleted file mode 100644
index 84c5dbd03e..0000000000
--- a/packages/opentelemetry-api/src/context/propagation/HttpTextPropagator.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Context } from '@opentelemetry/context-base';
-import { SetterFunction } from './setter';
-import { GetterFunction } from './getter';
-
-/**
- * Injects {@link Context} into and extracts it from carriers that travel
- * in-band across process boundaries. Encoding is expected to conform to the
- * HTTP Header Field semantics. Values are often encoded as RPC/HTTP request
- * headers.
- *
- * The carrier of propagated data on both the client (injector) and server
- * (extractor) side is usually an object such as http headers.
- */
-export interface HttpTextPropagator {
- /**
- * Injects values from a given {@link Context} into a carrier.
- *
- * OpenTelemetry defines a common set of format values (HttpTextPropagator), and
- * each has an expected `carrier` type.
- *
- * @param context the Context from which to extract values to transmit over
- * the wire.
- * @param carrier the carrier of propagation fields, such as http request
- * headers.
- * @param setter a function which accepts a carrier, key, and value, which
- * sets the key on the carrier to the value.
- */
- inject(context: Context, carrier: unknown, setter: SetterFunction): void;
-
- /**
- * Given a {@link Context} and a carrier, extract context values from a
- * carrier and return a new context, created from the old context, with the
- * extracted values.
- *
- * @param context the Context from which to extract values to transmit over
- * the wire.
- * @param carrier the carrier of propagation fields, such as http request
- * headers.
- * @param getter a function which accepts a carrier and a key, and returns
- * the value from the carrier identified by the key.
- */
- extract(context: Context, carrier: unknown, getter: GetterFunction): Context;
-}
diff --git a/packages/opentelemetry-api/src/context/propagation/NoopHttpTextPropagator.ts b/packages/opentelemetry-api/src/context/propagation/NoopHttpTextPropagator.ts
deleted file mode 100644
index f36922d875..0000000000
--- a/packages/opentelemetry-api/src/context/propagation/NoopHttpTextPropagator.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Context } from '@opentelemetry/context-base';
-import { HttpTextPropagator } from './HttpTextPropagator';
-
-/**
- * No-op implementations of {@link HttpTextPropagator}.
- */
-export class NoopHttpTextPropagator implements HttpTextPropagator {
- /** Noop inject function does nothing */
- inject(context: Context, carrier: unknown, setter: Function): void {}
- /** Noop extract function does nothing and returns the input context */
- extract(context: Context, carrier: unknown, getter: Function): Context {
- return context;
- }
-}
-
-export const NOOP_HTTP_TEXT_PROPAGATOR = new NoopHttpTextPropagator();
diff --git a/packages/opentelemetry-api/src/context/propagation/getter.ts b/packages/opentelemetry-api/src/context/propagation/getter.ts
deleted file mode 100644
index 158bd0fdd1..0000000000
--- a/packages/opentelemetry-api/src/context/propagation/getter.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export type GetterFunction = (
- carrier: Carrier,
- key: string
-) => unknown;
-
-/**
- * Default getter which just does a simple property access. Returns
- * undefined if the key is not set.
- *
- * @param carrier
- * @param key
- */
-export function defaultGetter(carrier: any, key: string): unknown {
- return carrier[key];
-}
diff --git a/packages/opentelemetry-api/src/context/propagation/setter.ts b/packages/opentelemetry-api/src/context/propagation/setter.ts
deleted file mode 100644
index 29c6abed73..0000000000
--- a/packages/opentelemetry-api/src/context/propagation/setter.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export type SetterFunction = (
- carrier: Carrier,
- key: string,
- value: unknown
-) => void;
-
-/**
- * Default setter which sets value via direct property access
- *
- * @param carrier
- * @param key
- */
-export function defaultSetter(carrier: any, key: string, value: unknown) {
- carrier[key] = value;
-}
diff --git a/packages/opentelemetry-api/src/correlation_context/CorrelationContext.ts b/packages/opentelemetry-api/src/correlation_context/CorrelationContext.ts
deleted file mode 100644
index e0de5eca1a..0000000000
--- a/packages/opentelemetry-api/src/correlation_context/CorrelationContext.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { EntryValue } from './EntryValue';
-
-/**
- * CorrelationContext represents collection of entries. Each key of
- * CorrelationContext is associated with exactly one value. CorrelationContext
- * is serializable, to facilitate propagating it not only inside the process
- * but also across process boundaries. CorrelationContext is used to annotate
- * telemetry with the name:value pair Entry. Those values can be used to add
- * dimension to the metric or additional contest properties to logs and traces.
- */
-export interface CorrelationContext {
- [entryKey: string]: EntryValue;
-}
diff --git a/packages/opentelemetry-api/src/correlation_context/EntryValue.ts b/packages/opentelemetry-api/src/correlation_context/EntryValue.ts
deleted file mode 100644
index 5db17aff63..0000000000
--- a/packages/opentelemetry-api/src/correlation_context/EntryValue.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * {@link EntryValue} contains properties associated with a {@link
- * CorrelationContext}.
- */
-export interface EntryValue {
- /** `String` value of the `EntryValue`. */
- value: string;
- /**
- * ttl is an integer that represents number of hops an entry can
- * propagate.
- */
- ttl?: EntryTtl;
-}
-
-/**
- * EntryTtl is an integer that represents number of hops an entry can propagate.
- *
- * For now, ONLY special values (0 and -1) are supported.
- */
-export enum EntryTtl {
- /**
- * NO_PROPAGATION is considered to have local context and is used within the
- * process it created.
- */
- NO_PROPAGATION = 0,
-
- /** UNLIMITED_PROPAGATION can propagate unlimited hops. */
- UNLIMITED_PROPAGATION = -1,
-}
diff --git a/packages/opentelemetry-api/src/index.ts b/packages/opentelemetry-api/src/index.ts
deleted file mode 100644
index 070ed01c05..0000000000
--- a/packages/opentelemetry-api/src/index.ts
+++ /dev/null
@@ -1,75 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './common/Logger';
-export * from './common/Time';
-export * from './context/propagation/getter';
-export * from './context/propagation/HttpTextPropagator';
-export * from './context/propagation/NoopHttpTextPropagator';
-export * from './context/propagation/setter';
-export * from './correlation_context/CorrelationContext';
-export * from './correlation_context/EntryValue';
-export * from './metrics/BoundInstrument';
-export * from './metrics/Meter';
-export * from './metrics/MeterProvider';
-export * from './metrics/Metric';
-export * from './metrics/NoopMeter';
-export * from './metrics/NoopMeterProvider';
-export * from './metrics/ObserverResult';
-export * from './trace/attributes';
-export * from './trace/Event';
-export * from './trace/instrumentation/Plugin';
-export * from './trace/link_context';
-export * from './trace/link';
-export * from './trace/NoopSpan';
-export * from './trace/NoopTracer';
-export * from './trace/NoopTracerProvider';
-export * from './trace/Sampler';
-export * from './trace/span_context';
-export * from './trace/span_kind';
-export * from './trace/span';
-export * from './trace/SpanOptions';
-export * from './trace/status';
-export * from './trace/TimedEvent';
-export * from './trace/trace_flags';
-export * from './trace/trace_state';
-export * from './trace/tracer_provider';
-export * from './trace/tracer';
-
-export { Context } from '@opentelemetry/context-base';
-
-import { ContextAPI } from './api/context';
-/** Entrypoint for context API */
-export const context = ContextAPI.getInstance();
-
-import { TraceAPI } from './api/trace';
-/** Entrypoint for trace API */
-export const trace = TraceAPI.getInstance();
-
-import { MetricsAPI } from './api/metrics';
-/** Entrypoint for metrics API */
-export const metrics = MetricsAPI.getInstance();
-
-import { PropagationAPI } from './api/propagation';
-/** Entrypoint for propagation API */
-export const propagation = PropagationAPI.getInstance();
-
-export default {
- trace,
- metrics,
- context,
- propagation,
-};
diff --git a/packages/opentelemetry-api/src/metrics/BoundInstrument.ts b/packages/opentelemetry-api/src/metrics/BoundInstrument.ts
deleted file mode 100644
index 87defee0dc..0000000000
--- a/packages/opentelemetry-api/src/metrics/BoundInstrument.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { CorrelationContext } from '../correlation_context/CorrelationContext';
-import { SpanContext } from '../trace/span_context';
-import { ObserverResult } from './ObserverResult';
-
-/** An Instrument for Counter Metric. */
-export interface BoundCounter {
- /**
- * Adds the given value to the current value. Values cannot be negative.
- * @param value the value to add.
- */
- add(value: number): void;
-}
-
-/** Measure to report instantaneous measurement of a value. */
-export interface BoundMeasure {
- /**
- * Records the given value to this measure.
- * @param value the measurement to record.
- * @param correlationContext the correlationContext associated with the
- * measurements.
- * @param spanContext the {@link SpanContext} that identifies the {@link Span}
- * for which the measurements are associated with.
- */
- record(value: number): void;
- record(value: number, correlationContext: CorrelationContext): void;
- record(
- value: number,
- correlationContext: CorrelationContext,
- spanContext: SpanContext
- ): void;
-}
-
-/** Base interface for the Observer metrics. */
-export interface BoundObserver {
- /**
- * Sets callback for the observer. The callback is called once and then it
- * sets observers for values. The observers are called periodically to
- * retrieve the value.
- * @param callback
- */
- setCallback(callback: (observerResult: ObserverResult) => void): void;
-}
diff --git a/packages/opentelemetry-api/src/metrics/Meter.ts b/packages/opentelemetry-api/src/metrics/Meter.ts
deleted file mode 100644
index 5231629c91..0000000000
--- a/packages/opentelemetry-api/src/metrics/Meter.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Metric, MetricOptions } from './Metric';
-import { BoundCounter, BoundMeasure, BoundObserver } from './BoundInstrument';
-
-/**
- * An interface to allow the recording metrics.
- *
- * {@link Metric}s are used for recording pre-defined aggregation (`Counter`),
- * or raw values (`Measure`) in which the aggregation and labels
- * for the exported metric are deferred.
- */
-export interface Meter {
- /**
- * Creates and returns a new `Measure`.
- * @param name the name of the metric.
- * @param [options] the metric options.
- */
- createMeasure(name: string, options?: MetricOptions): Metric;
-
- /**
- * Creates a new `Counter` metric. Generally, this kind of metric when the
- * value is a quantity, the sum is of primary interest, and the event count
- * and value distribution are not of primary interest.
- * @param name the name of the metric.
- * @param [options] the metric options.
- */
- createCounter(name: string, options?: MetricOptions): Metric;
-
- /**
- * Creates a new `Observer` metric.
- * @param name the name of the metric.
- * @param [options] the metric options.
- */
- createObserver(name: string, options?: MetricOptions): Metric;
-}
diff --git a/packages/opentelemetry-api/src/metrics/MeterProvider.ts b/packages/opentelemetry-api/src/metrics/MeterProvider.ts
deleted file mode 100644
index 8802acb615..0000000000
--- a/packages/opentelemetry-api/src/metrics/MeterProvider.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Meter } from './Meter';
-
-/**
- * MeterProvider provides an interface for creating {@link Meter}s
- */
-export interface MeterProvider {
- /**
- * Returns a Meter, creating one if one with the given name and version is
- * not already created.
- *
- * @param name The name of the meter or instrumentation library.
- * @param version The version of the meter or instrumentation library.
- * @returns Meter A Meter with the given name and version
- */
- getMeter(name: string, version?: string): Meter;
-}
diff --git a/packages/opentelemetry-api/src/metrics/Metric.ts b/packages/opentelemetry-api/src/metrics/Metric.ts
deleted file mode 100644
index d57896a1d3..0000000000
--- a/packages/opentelemetry-api/src/metrics/Metric.ts
+++ /dev/null
@@ -1,142 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { CorrelationContext } from '../correlation_context/CorrelationContext';
-import { SpanContext } from '../trace/span_context';
-import { ObserverResult } from './ObserverResult';
-
-/**
- * Options needed for metric creation
- */
-export interface MetricOptions {
- /** The name of the component that reports the Metric. */
- component?: string;
-
- /**
- * The description of the Metric.
- * @default ''
- */
- description?: string;
-
- /**
- * The unit of the Metric values.
- * @default '1'
- */
- unit?: string;
-
- /** The list of label keys for the Metric. */
- labelKeys?: string[];
-
- /** The map of constant labels for the Metric. */
- constantLabels?: Map;
-
- /**
- * Indicates the metric is a verbose metric that is disabled by default
- * @default false
- */
- disabled?: boolean;
-
- /**
- * Asserts that this metric may only increase (e.g. time spent).
- */
- monotonic?: boolean;
-
- /**
- * (Measure only, default true) Asserts that this metric will only accept
- * non-negative values (e.g. disk usage).
- */
- absolute?: boolean;
-
- /**
- * Indicates the type of the recorded value.
- * @default {@link ValueType.DOUBLE}
- */
- valueType?: ValueType;
-}
-
-/** The Type of value. It describes how the data is reported. */
-export enum ValueType {
- INT,
- DOUBLE,
-}
-
-/**
- * Metric represents a base class for different types of metric
- * pre aggregations.
- */
-export interface Metric {
- /**
- * Returns a Instrument associated with specified Labels.
- * It is recommended to keep a reference to the Instrument instead of always
- * calling this method for every operations.
- * @param labels key-values pairs that are associated with a specific metric
- * that you want to record.
- */
- bind(labels: Labels): T;
-
- /**
- * Removes the Instrument from the metric, if it is present.
- * @param labels key-values pairs that are associated with a specific metric.
- */
- unbind(labels: Labels): void;
-
- /**
- * Clears all timeseries from the Metric.
- */
- clear(): void;
-}
-
-export interface MetricUtils {
- /**
- * Adds the given value to the current value. Values cannot be negative.
- */
- add(value: number, labels: Labels): void;
-
- /**
- * Sets a callback where user can observe value for certain labels
- * @param callback a function that will be called once to set observers
- * for values
- */
- setCallback(callback: (observerResult: ObserverResult) => void): void;
-
- /**
- * Sets the given value. Values can be negative.
- */
- set(value: number, labels: Labels): void;
-
- /**
- * Records the given value to this measure.
- */
- record(value: number, labels: Labels): void;
-
- record(
- value: number,
- labels: Labels,
- correlationContext: CorrelationContext
- ): void;
-
- record(
- value: number,
- labels: Labels,
- correlationContext: CorrelationContext,
- spanContext: SpanContext
- ): void;
-}
-
-/**
- * key-value pairs passed by the user.
- */
-export type Labels = { [key: string]: string };
diff --git a/packages/opentelemetry-api/src/metrics/NoopMeter.ts b/packages/opentelemetry-api/src/metrics/NoopMeter.ts
deleted file mode 100644
index bfc2e70a93..0000000000
--- a/packages/opentelemetry-api/src/metrics/NoopMeter.ts
+++ /dev/null
@@ -1,150 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Meter } from './Meter';
-import { MetricOptions, Metric, Labels, MetricUtils } from './Metric';
-import { BoundMeasure, BoundCounter, BoundObserver } from './BoundInstrument';
-import { CorrelationContext } from '../correlation_context/CorrelationContext';
-import { SpanContext } from '../trace/span_context';
-import { ObserverResult } from './ObserverResult';
-
-/**
- * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses
- * constant NoopMetrics for all of its methods.
- */
-export class NoopMeter implements Meter {
- constructor() {}
-
- /**
- * Returns constant noop measure.
- * @param name the name of the metric.
- * @param [options] the metric options.
- */
- createMeasure(name: string, options?: MetricOptions): Metric {
- return NOOP_MEASURE_METRIC;
- }
-
- /**
- * Returns a constant noop counter.
- * @param name the name of the metric.
- * @param [options] the metric options.
- */
- createCounter(name: string, options?: MetricOptions): Metric {
- return NOOP_COUNTER_METRIC;
- }
-
- /**
- * Returns constant noop observer.
- * @param name the name of the metric.
- * @param [options] the metric options.
- */
- createObserver(name: string, options?: MetricOptions): Metric {
- return NOOP_OBSERVER_METRIC;
- }
-}
-
-export class NoopMetric implements Metric {
- private readonly _instrument: T;
-
- constructor(instrument: T) {
- this._instrument = instrument;
- }
- /**
- * Returns a Bound Instrument associated with specified Labels.
- * It is recommended to keep a reference to the Bound Instrument instead of
- * always calling this method for every operations.
- * @param labels key-values pairs that are associated with a specific metric
- * that you want to record.
- */
- bind(labels: Labels): T {
- return this._instrument;
- }
-
- /**
- * Removes the Binding from the metric, if it is present.
- * @param labels key-values pairs that are associated with a specific metric.
- */
- unbind(labels: Labels): void {
- return;
- }
-
- /**
- * Clears all timeseries from the Metric.
- */
- clear(): void {
- return;
- }
-}
-
-export class NoopCounterMetric extends NoopMetric
- implements Pick {
- add(value: number, labels: Labels) {
- this.bind(labels).add(value);
- }
-}
-
-export class NoopMeasureMetric extends NoopMetric
- implements Pick {
- record(
- value: number,
- labels: Labels,
- correlationContext?: CorrelationContext,
- spanContext?: SpanContext
- ) {
- if (typeof correlationContext === 'undefined') {
- this.bind(labels).record(value);
- } else if (typeof spanContext === 'undefined') {
- this.bind(labels).record(value, correlationContext);
- } else {
- this.bind(labels).record(value, correlationContext, spanContext);
- }
- }
-}
-
-export class NoopObserverMetric extends NoopMetric
- implements Pick {
- setCallback(callback: (observerResult: ObserverResult) => void): void {}
-}
-
-export class NoopBoundCounter implements BoundCounter {
- add(value: number): void {
- return;
- }
-}
-
-export class NoopBoundMeasure implements BoundMeasure {
- record(
- value: number,
- correlationContext?: CorrelationContext,
- spanContext?: SpanContext
- ): void {
- return;
- }
-}
-
-export class NoopBoundObserver implements BoundObserver {
- setCallback(callback: (observerResult: ObserverResult) => void): void {}
-}
-
-export const NOOP_METER = new NoopMeter();
-export const NOOP_BOUND_COUNTER = new NoopBoundCounter();
-export const NOOP_COUNTER_METRIC = new NoopCounterMetric(NOOP_BOUND_COUNTER);
-
-export const NOOP_BOUND_MEASURE = new NoopBoundMeasure();
-export const NOOP_MEASURE_METRIC = new NoopMeasureMetric(NOOP_BOUND_MEASURE);
-
-export const NOOP_BOUND_OBSERVER = new NoopBoundObserver();
-export const NOOP_OBSERVER_METRIC = new NoopObserverMetric(NOOP_BOUND_OBSERVER);
diff --git a/packages/opentelemetry-api/src/metrics/NoopMeterProvider.ts b/packages/opentelemetry-api/src/metrics/NoopMeterProvider.ts
deleted file mode 100644
index 182463611c..0000000000
--- a/packages/opentelemetry-api/src/metrics/NoopMeterProvider.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Meter } from './Meter';
-import { MeterProvider } from './MeterProvider';
-import { NOOP_METER } from './NoopMeter';
-
-/**
- * An implementation of the {@link MeterProvider} which returns an impotent Meter
- * for all calls to `getMeter`
- */
-export class NoopMeterProvider implements MeterProvider {
- getMeter(_name?: string, _version?: string): Meter {
- return NOOP_METER;
- }
-}
-
-export const NOOP_METER_PROVIDER = new NoopMeterProvider();
diff --git a/packages/opentelemetry-api/src/metrics/ObserverResult.ts b/packages/opentelemetry-api/src/metrics/ObserverResult.ts
deleted file mode 100644
index 6fb4edba70..0000000000
--- a/packages/opentelemetry-api/src/metrics/ObserverResult.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Labels } from './Metric';
-
-/**
- * Interface that is being used in function setCallback for Observer Metric
- */
-export interface ObserverResult {
- observers: Map;
- observe(callback: Function, labels: Labels): void;
-}
diff --git a/packages/opentelemetry-api/src/trace/Event.ts b/packages/opentelemetry-api/src/trace/Event.ts
deleted file mode 100644
index c3238c5393..0000000000
--- a/packages/opentelemetry-api/src/trace/Event.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Attributes } from './attributes';
-
-/** A text annotation with a set of attributes. */
-export interface Event {
- /** The name of the event. */
- name: string;
- /** The attributes of the event. */
- attributes?: Attributes;
-}
diff --git a/packages/opentelemetry-api/src/trace/NoopSpan.ts b/packages/opentelemetry-api/src/trace/NoopSpan.ts
deleted file mode 100644
index 342a587413..0000000000
--- a/packages/opentelemetry-api/src/trace/NoopSpan.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { TimeInput } from '../common/Time';
-import { Attributes } from './attributes';
-import { Span } from './span';
-import { SpanContext } from './span_context';
-import { Status } from './status';
-import { TraceFlags } from './trace_flags';
-
-export const INVALID_TRACE_ID = '0';
-export const INVALID_SPAN_ID = '0';
-const INVALID_SPAN_CONTEXT: SpanContext = {
- traceId: INVALID_TRACE_ID,
- spanId: INVALID_SPAN_ID,
- traceFlags: TraceFlags.NONE,
-};
-
-/**
- * The NoopSpan is the default {@link Span} that is used when no Span
- * implementation is available. All operations are no-op including context
- * propagation.
- */
-export class NoopSpan implements Span {
- constructor(
- private readonly _spanContext: SpanContext = INVALID_SPAN_CONTEXT
- ) {}
-
- // Returns a SpanContext.
- context(): SpanContext {
- return this._spanContext;
- }
-
- // By default does nothing
- setAttribute(key: string, value: unknown): this {
- return this;
- }
-
- // By default does nothing
- setAttributes(attributes: Attributes): this {
- return this;
- }
-
- // By default does nothing
- addEvent(name: string, attributes?: Attributes): this {
- return this;
- }
-
- // By default does nothing
- setStatus(status: Status): this {
- return this;
- }
-
- // By default does nothing
- updateName(name: string): this {
- return this;
- }
-
- // By default does nothing
- end(endTime?: TimeInput): void {}
-
- // isRecording always returns false for noopSpan.
- isRecording(): boolean {
- return false;
- }
-}
-
-export const NOOP_SPAN = new NoopSpan();
diff --git a/packages/opentelemetry-api/src/trace/NoopTracer.ts b/packages/opentelemetry-api/src/trace/NoopTracer.ts
deleted file mode 100644
index ed4c63f834..0000000000
--- a/packages/opentelemetry-api/src/trace/NoopTracer.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Span, SpanOptions, Tracer } from '..';
-import { NOOP_SPAN } from './NoopSpan';
-
-/**
- * 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): Span {
- return NOOP_SPAN;
- }
-
- withSpan ReturnType>(
- span: Span,
- fn: T
- ): ReturnType {
- return fn();
- }
-
- bind(target: T, span?: Span): T {
- return target;
- }
-}
-
-export const NOOP_TRACER = new NoopTracer();
diff --git a/packages/opentelemetry-api/src/trace/NoopTracerProvider.ts b/packages/opentelemetry-api/src/trace/NoopTracerProvider.ts
deleted file mode 100644
index 9398d51608..0000000000
--- a/packages/opentelemetry-api/src/trace/NoopTracerProvider.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { NOOP_TRACER } from './NoopTracer';
-import { Tracer } from './tracer';
-import { TracerProvider } from './tracer_provider';
-
-/**
- * An implementation of the {@link TracerProvider} which returns an impotent Tracer
- * for all calls to `getTracer`
- */
-export class NoopTracerProvider implements TracerProvider {
- getTracer(_name?: string, _version?: string): Tracer {
- return NOOP_TRACER;
- }
-}
-
-export const NOOP_TRACER_PROVIDER = new NoopTracerProvider();
diff --git a/packages/opentelemetry-api/src/trace/Sampler.ts b/packages/opentelemetry-api/src/trace/Sampler.ts
deleted file mode 100644
index 798b5450f7..0000000000
--- a/packages/opentelemetry-api/src/trace/Sampler.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { SpanContext } from './span_context';
-
-/**
- * This interface represent a sampler. Sampling is a mechanism to control the
- * noise and overhead introduced by OpenTelemetry by reducing the number of
- * samples of traces collected and sent to the backend.
- */
-export interface Sampler {
- /**
- * Checks whether span needs to be created and tracked.
- *
- * TODO: Consider to add required arguments https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/sampling-api.md#shouldsample
- * @param [parentContext] Parent span context. Typically taken from the wire.
- * Can be null.
- * @returns whether span should be sampled or not.
- */
- shouldSample(parentContext?: SpanContext): boolean;
-
- /** Returns the sampler name or short description with the configuration. */
- toString(): string;
-}
diff --git a/packages/opentelemetry-api/src/trace/SpanOptions.ts b/packages/opentelemetry-api/src/trace/SpanOptions.ts
deleted file mode 100644
index bfda7e001c..0000000000
--- a/packages/opentelemetry-api/src/trace/SpanOptions.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Attributes } from './attributes';
-import { Link } from './link';
-import { SpanKind } from './span_kind';
-import { Span } from './span';
-import { SpanContext } from './span_context';
-
-/**
- * Options needed for span creation
- */
-export interface SpanOptions {
- /**
- * The SpanKind of a span
- * @default {@link SpanKind.INTERNAL}
- */
- kind?: SpanKind;
-
- /** A spans attributes */
- attributes?: Attributes;
-
- /** A spans links */
- links?: Link[];
-
- /**
- * This option is NOT RECOMMENDED for normal use and should ONLY be used
- * if your application manages context manually without the global context
- * manager, or you are trying to override the parent extracted from context.
- *
- * A parent `SpanContext` (or `Span`, for convenience) that the newly-started
- * span will be the child of. This overrides the parent span extracted from
- * the currently active context.
- *
- * A null value here should prevent the SDK from extracting a parent from
- * the current context, forcing the new span to be a root span.
- */
- parent?: Span | SpanContext | null;
-
- /** A manually specified start time for the created `Span` object. */
- startTime?: number;
-}
diff --git a/packages/opentelemetry-api/src/trace/TimedEvent.ts b/packages/opentelemetry-api/src/trace/TimedEvent.ts
deleted file mode 100644
index 3218bfa604..0000000000
--- a/packages/opentelemetry-api/src/trace/TimedEvent.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Event } from './Event';
-import { HrTime } from '../common/Time';
-
-/**
- * Represents a timed event.
- * A timed event is an event with a timestamp.
- */
-export interface TimedEvent extends Event {
- time: HrTime;
-}
diff --git a/packages/opentelemetry-api/src/trace/attributes.ts b/packages/opentelemetry-api/src/trace/attributes.ts
deleted file mode 100644
index 188b1e574a..0000000000
--- a/packages/opentelemetry-api/src/trace/attributes.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** Defines a attributes interface. */
-export interface Attributes {
- [attributeKey: string]: unknown;
-}
diff --git a/packages/opentelemetry-api/src/trace/instrumentation/Plugin.ts b/packages/opentelemetry-api/src/trace/instrumentation/Plugin.ts
deleted file mode 100644
index c255fbe857..0000000000
--- a/packages/opentelemetry-api/src/trace/instrumentation/Plugin.ts
+++ /dev/null
@@ -1,104 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Logger } from '../../common/Logger';
-import { TracerProvider } from '../tracer_provider';
-
-/** Interface Plugin to apply patch. */
-// tslint:disable-next-line:no-any
-export interface Plugin {
- /**
- * Contains all supported versions.
- * All versions must be compatible with [semver](https://semver.org/spec/v2.0.0.html) format.
- * If the version is not supported, we won't apply instrumentation patch (see `enable` method).
- * If omitted, all versions of the module will be patched.
- */
- supportedVersions?: string[];
-
- /**
- * Name of the module that the plugin instrument.
- */
- moduleName: string;
-
- /**
- * Method that enables the instrumentation patch.
- * @param moduleExports The value of the `module.exports` property that would
- * normally be exposed by the required module. ex: `http`, `https` etc.
- * @param TracerProvider a tracer provider.
- * @param logger a logger instance.
- * @param [config] an object to configure the plugin.
- */
- enable(
- moduleExports: T,
- TracerProvider: TracerProvider,
- logger: Logger,
- config?: PluginConfig
- ): T;
-
- /** Method to disable the instrumentation */
- disable(): void;
-}
-
-export interface PluginConfig {
- /**
- * Whether to enable the plugin.
- * @default true
- */
- enabled?: boolean;
-
- /**
- * Path of the trace plugin to load.
- * @default '@opentelemetry/plugin-http' in case of http.
- */
- path?: string;
-
- /**
- * Request methods that match any string in ignoreMethods will not be traced.
- */
- ignoreMethods?: string[];
-
- /**
- * URLs that partially match any regex in ignoreUrls will not be traced.
- * In addition, URLs that are _exact matches_ of strings in ignoreUrls will
- * also not be traced.
- */
- ignoreUrls?: Array;
-
- /**
- * List of internal files that need patch and are not exported by
- * default.
- */
- internalFilesExports?: PluginInternalFiles;
-
- /**
- * If true, additional information about query parameters and
- * results will be attached (as `attributes`) to spans representing
- * database operations.
- */
- enhancedDatabaseReporting?: boolean;
-}
-
-export interface PluginInternalFilesVersion {
- [pluginName: string]: string;
-}
-
-/**
- * Each key should be the name of the module to trace, and its value
- * a mapping of a property name to a internal plugin file name.
- */
-export interface PluginInternalFiles {
- [versions: string]: PluginInternalFilesVersion;
-}
diff --git a/packages/opentelemetry-api/src/trace/link.ts b/packages/opentelemetry-api/src/trace/link.ts
deleted file mode 100644
index 2125b82b6c..0000000000
--- a/packages/opentelemetry-api/src/trace/link.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Attributes } from './attributes';
-import { LinkContext } from './link_context';
-
-/**
- * A pointer from the current {@link Span} to another span in the same trace or
- * in a different trace. Used (for example) in batching operations, where a
- * single batch handler processes multiple requests from different traces.
- */
-export interface Link {
- /** The {@link LinkContext} of a linked span. */
- context: LinkContext;
- /** A set of {@link Attributes} on the link. */
- attributes?: Attributes;
-}
diff --git a/packages/opentelemetry-api/src/trace/link_context.ts b/packages/opentelemetry-api/src/trace/link_context.ts
deleted file mode 100644
index 5493f039a6..0000000000
--- a/packages/opentelemetry-api/src/trace/link_context.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { SpanContext } from './span_context';
-
-/**
- * A pointer to another span.
- */
-export type LinkContext = Pick;
diff --git a/packages/opentelemetry-api/src/trace/span.ts b/packages/opentelemetry-api/src/trace/span.ts
deleted file mode 100644
index 2a725afdc2..0000000000
--- a/packages/opentelemetry-api/src/trace/span.ts
+++ /dev/null
@@ -1,103 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Attributes } from './attributes';
-import { SpanContext } from './span_context';
-import { Status } from './status';
-import { TimeInput } from '../common/Time';
-
-/**
- * An interface that represents a span. A span represents a single operation
- * within a trace. Examples of span might include remote procedure calls or a
- * in-process function calls to sub-components. A Trace has a single, top-level
- * "root" Span that in turn may have zero or more child Spans, which in turn
- * may have children.
- */
-export interface Span {
- /**
- * Returns the {@link SpanContext} object associated with this Span.
- *
- * @returns the SpanContext object associated with this Span.
- */
- context(): SpanContext;
-
- /**
- * Sets an attribute to the span.
- *
- * @param key the key for this attribute.
- * @param value the value for this attribute.
- */
- setAttribute(key: string, value: unknown): this;
-
- /**
- * Sets attributes to the span.
- *
- * @param attributes the attributes that will be added.
- */
- setAttributes(attributes: Attributes): this;
-
- /**
- * Adds an event to the Span.
- *
- * @param name the name of the event.
- * @param [attributesOrStartTime] the attributes that will be added; these are
- * associated with this event. Can be also a start time
- * if type is {@type TimeInput} and 3rd param is undefined
- * @param [startTime] start time of the event.
- */
- addEvent(
- name: string,
- attributesOrStartTime?: Attributes | TimeInput,
- startTime?: TimeInput
- ): this;
-
- /**
- * Sets a status to the span. If used, this will override the default Span
- * status. Default is {@link CanonicalCode.OK}.
- *
- * @param status the Status to set.
- */
- setStatus(status: Status): this;
-
- /**
- * Updates the Span name.
- *
- * @param name the Span name.
- */
- updateName(name: string): this;
-
- /**
- * Marks the end of Span execution.
- *
- * Call to End of a Span MUST not have any effects on child spans. Those may
- * still be running and can be ended later.
- *
- * Do not return `this`. The Span generally should not be used after it
- * is ended so chaining is not desired in this context.
- *
- * @param [endTime] the time to set as Span's end time. If not provided,
- * use the current time as the span's end time.
- */
- end(endTime?: TimeInput): void;
-
- /**
- * Returns the flag whether this span will be recorded.
- *
- * @returns true if this Span is active and recording information like events
- * with the AddEvent operation and attributes using setAttributes.
- */
- isRecording(): boolean;
-}
diff --git a/packages/opentelemetry-api/src/trace/span_context.ts b/packages/opentelemetry-api/src/trace/span_context.ts
deleted file mode 100644
index b99be63fc9..0000000000
--- a/packages/opentelemetry-api/src/trace/span_context.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { TraceFlags } from './trace_flags';
-import { TraceState } from './trace_state';
-
-/**
- * A SpanContext represents the portion of a {@link Span} which must be
- * serialized and propagated along side of a {@link CorrelationContext}.
- */
-export interface SpanContext {
- /**
- * The ID of the trace that this span belongs to. It is worldwide unique
- * with practically sufficient probability by being made as 16 randomly
- * generated bytes, encoded as a 32 lowercase hex characters corresponding to
- * 128 bits.
- */
- traceId: string;
- /**
- * The ID of the Span. It is globally unique with practically sufficient
- * probability by being made as 8 randomly generated bytes, encoded as a 16
- * lowercase hex characters corresponding to 64 bits.
- */
- spanId: string;
- /**
- * Only true if the SpanContext was propagated from a remote parent.
- */
- isRemote?: boolean;
- /**
- * Trace flags to propagate.
- *
- * It is represented as 1 byte (bitmap). Bit to represent whether trace is
- * sampled or not. When set, the least significant bit documents that the
- * caller may have recorded trace data. A caller who does not record trace
- * data out-of-band leaves this flag unset.
- *
- * SAMPLED = 0x1 and NONE = 0x0;
- */
- traceFlags: TraceFlags;
- /**
- * Tracing-system-specific info to propagate.
- *
- * The tracestate field value is a `list` as defined below. The `list` is a
- * series of `list-members` separated by commas `,`, and a list-member is a
- * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs
- * surrounding `list-members` are ignored. There can be a maximum of 32
- * `list-members` in a `list`.
- * More Info: https://www.w3.org/TR/trace-context/#tracestate-field
- *
- * Examples:
- * Single tracing system (generic format):
- * tracestate: rojo=00f067aa0ba902b7
- * Multiple tracing systems (with different formatting):
- * tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE
- */
- traceState?: TraceState;
-}
diff --git a/packages/opentelemetry-api/src/trace/span_kind.ts b/packages/opentelemetry-api/src/trace/span_kind.ts
deleted file mode 100644
index a6ca9b522c..0000000000
--- a/packages/opentelemetry-api/src/trace/span_kind.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Type of span. Can be used to specify additional relationships between spans
- * in addition to a parent/child relationship.
- */
-export enum SpanKind {
- /** Default value. Indicates that the span is used internally. */
- INTERNAL = 0,
-
- /**
- * Indicates that the span covers server-side handling of an RPC or other
- * remote request.
- */
- SERVER = 1,
-
- /**
- * Indicates that the span covers the client-side wrapper around an RPC or
- * other remote request.
- */
- CLIENT = 2,
-
- /**
- * Indicates that the span describes producer sending a message to a
- * broker. Unlike client and server, there is no direct critical path latency
- * relationship between producer and consumer spans.
- */
- PRODUCER = 3,
-
- /**
- * Indicates that the span describes consumer receiving a message from a
- * broker. Unlike client and server, there is no direct critical path latency
- * relationship between producer and consumer spans.
- */
- CONSUMER = 4,
-}
diff --git a/packages/opentelemetry-api/src/trace/status.ts b/packages/opentelemetry-api/src/trace/status.ts
deleted file mode 100644
index e9fa7201d8..0000000000
--- a/packages/opentelemetry-api/src/trace/status.ts
+++ /dev/null
@@ -1,163 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * The status of a Span by providing a standard CanonicalCode in conjunction
- * with an optional descriptive message.
- */
-export interface Status {
- /** The canonical code of this message. */
- code: CanonicalCode;
- /** A developer-facing error message. */
- message?: string;
-}
-
-/**
- * An enumeration of canonical status codes.
- */
-export enum CanonicalCode {
- /**
- * Not an error; returned on success
- */
- OK = 0,
- /**
- * The operation was cancelled (typically by the caller).
- */
- CANCELLED = 1,
- /**
- * Unknown error. An example of where this error may be returned is
- * if a status value received from another address space belongs to
- * an error-space that is not known in this address space. Also
- * errors raised by APIs that do not return enough error information
- * may be converted to this error.
- */
- UNKNOWN = 2,
- /**
- * Client specified an invalid argument. Note that this differs
- * from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
- * that are problematic regardless of the state of the system
- * (e.g., a malformed file name).
- */
- INVALID_ARGUMENT = 3,
- /**
- * Deadline expired before operation could complete. For operations
- * that change the state of the system, this error may be returned
- * even if the operation has completed successfully. For example, a
- * successful response from a server could have been delayed long
- * enough for the deadline to expire.
- */
- DEADLINE_EXCEEDED = 4,
- /**
- * Some requested entity (e.g., file or directory) was not found.
- */
- NOT_FOUND = 5,
- /**
- * Some entity that we attempted to create (e.g., file or directory)
- * already exists.
- */
- ALREADY_EXISTS = 6,
- /**
- * The caller does not have permission to execute the specified
- * operation. PERMISSION_DENIED must not be used for rejections
- * caused by exhausting some resource (use RESOURCE_EXHAUSTED
- * instead for those errors). PERMISSION_DENIED must not be
- * used if the caller can not be identified (use UNAUTHENTICATED
- * instead for those errors).
- */
- PERMISSION_DENIED = 7,
- /**
- * Some resource has been exhausted, perhaps a per-user quota, or
- * perhaps the entire file system is out of space.
- */
- RESOURCE_EXHAUSTED = 8,
- /**
- * Operation was rejected because the system is not in a state
- * required for the operation's execution. For example, directory
- * to be deleted may be non-empty, an rmdir operation is applied to
- * a non-directory, etc.
- *
- * A litmus test that may help a service implementor in deciding
- * between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:
- *
- * - Use UNAVAILABLE if the client can retry just the failing call.
- * - Use ABORTED if the client should retry at a higher-level
- * (e.g., restarting a read-modify-write sequence).
- * - Use FAILED_PRECONDITION if the client should not retry until
- * the system state has been explicitly fixed. E.g., if an "rmdir"
- * fails because the directory is non-empty, FAILED_PRECONDITION
- * should be returned since the client should not retry unless
- * they have first fixed up the directory by deleting files from it.
- * - Use FAILED_PRECONDITION if the client performs conditional
- * REST Get/Update/Delete on a resource and the resource on the
- * server does not match the condition. E.g., conflicting
- * read-modify-write on the same resource.
- */
- FAILED_PRECONDITION = 9,
- /**
- * The operation was aborted, typically due to a concurrency issue
- * like sequencer check failures, transaction aborts, etc.
- *
- * See litmus test above for deciding between FAILED_PRECONDITION,
- * ABORTED, and UNAVAILABLE.
- */
- ABORTED = 10,
- /**
- * Operation was attempted past the valid range. E.g., seeking or
- * reading past end of file.
- *
- * Unlike INVALID_ARGUMENT, this error indicates a problem that may
- * be fixed if the system state changes. For example, a 32-bit file
- * system will generate INVALID_ARGUMENT if asked to read at an
- * offset that is not in the range [0,2^32-1], but it will generate
- * OUT_OF_RANGE if asked to read from an offset past the current
- * file size.
- *
- * There is a fair bit of overlap between FAILED_PRECONDITION and
- * OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific
- * error) when it applies so that callers who are iterating through
- * a space can easily look for an OUT_OF_RANGE error to detect when
- * they are done.
- */
- OUT_OF_RANGE = 11,
- /**
- * Operation is not implemented or not supported/enabled in this service.
- */
- UNIMPLEMENTED = 12,
- /**
- * Internal errors. Means some invariants expected by underlying
- * system has been broken. If you see one of these errors,
- * something is very broken.
- */
- INTERNAL = 13,
- /**
- * The service is currently unavailable. This is a most likely a
- * transient condition and may be corrected by retrying with
- * a backoff.
- *
- * See litmus test above for deciding between FAILED_PRECONDITION,
- * ABORTED, and UNAVAILABLE.
- */
- UNAVAILABLE = 14,
- /**
- * Unrecoverable data loss or corruption.
- */
- DATA_LOSS = 15,
- /**
- * The request does not have valid authentication credentials for the
- * operation.
- */
- UNAUTHENTICATED = 16,
-}
diff --git a/packages/opentelemetry-api/src/trace/trace_flags.ts b/packages/opentelemetry-api/src/trace/trace_flags.ts
deleted file mode 100644
index 8a593ec254..0000000000
--- a/packages/opentelemetry-api/src/trace/trace_flags.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * An enumeration that represents global trace flags. These flags are
- * propagated to all child {@link Span}. These determine features such as
- * whether a Span should be traced. It is implemented as a bitmask.
- */
-export enum TraceFlags {
- /** Represents no flag set. */
- NONE = 0x0,
- /** Bit to represent whether trace is sampled in trace flags. */
- SAMPLED = 0x1 << 0,
-}
diff --git a/packages/opentelemetry-api/src/trace/trace_state.ts b/packages/opentelemetry-api/src/trace/trace_state.ts
deleted file mode 100644
index b137eba60b..0000000000
--- a/packages/opentelemetry-api/src/trace/trace_state.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Tracestate carries system-specific configuration data, represented as a list
- * of key-value pairs. TraceState allows multiple tracing systems to
- * participate in the same trace.
- */
-export interface TraceState {
- /**
- * Adds or updates the TraceState that has the given `key` if it is
- * present. The new State will always be added in the front of the
- * list of states.
- *
- * @param key key of the TraceState entry.
- * @param value value of the TraceState entry.
- */
- set(key: string, value: string): void;
-
- /**
- * Removes the TraceState Entry that has the given `key` if it is present.
- *
- * @param key the key for the TraceState Entry to be removed.
- */
- unset(key: string): void;
-
- /**
- * Returns the value to which the specified key is mapped, or `undefined` if
- * this map contains no mapping for the key.
- *
- * @param key with which the specified value is to be associated.
- * @returns the value to which the specified key is mapped, or `undefined` if
- * this map contains no mapping for the key.
- */
- get(key: string): string | undefined;
-
- // TODO: Consider to add support for merging an object as well by also
- // accepting a single internalTraceState argument similar to the constructor.
-
- /**
- * Serializes the TraceState to a `list` as defined below. The `list` is a
- * series of `list-members` separated by commas `,`, and a list-member is a
- * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs
- * surrounding `list-members` are ignored. There can be a maximum of 32
- * `list-members` in a `list`.
- *
- * @returns the serialized string.
- */
- serialize(): string;
-}
diff --git a/packages/opentelemetry-api/src/trace/tracer.ts b/packages/opentelemetry-api/src/trace/tracer.ts
deleted file mode 100644
index e57f2ee176..0000000000
--- a/packages/opentelemetry-api/src/trace/tracer.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Context } from '@opentelemetry/context-base';
-import { Span } from './span';
-import { SpanOptions } from './SpanOptions';
-
-/**
- * Tracer provides an interface for creating {@link Span}s and propagating
- * context in-process.
- *
- * Users may choose to use manual or automatic Context propagation. Because of
- * that this class offers APIs to facilitate both usages.
- */
-export interface Tracer {
- /**
- * Returns the current Span from the current context if available.
- *
- * If there is no Span associated with the current context, null is returned.
- *
- * @returns Span The currently active Span
- */
- getCurrentSpan(): Span | undefined;
-
- /**
- * Starts a new {@link Span}.
- * @param name The name of the span
- * @param [options] SpanOptions used for span creation
- * @param [context] Context to use to extract parent
- * @returns Span The newly created span
- */
- startSpan(name: string, options?: SpanOptions, context?: Context): Span;
-
- /**
- * Executes the function given by fn within the context provided by Span
- *
- * @param span The span that provides the context
- * @param fn The function to be executed inside the provided context
- * @example
- * tracer.withSpan(span, function() { ... });
- */
- 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/trace/tracer_provider.ts b/packages/opentelemetry-api/src/trace/tracer_provider.ts
deleted file mode 100644
index 63c6c50285..0000000000
--- a/packages/opentelemetry-api/src/trace/tracer_provider.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Tracer } from './tracer';
-
-/**
- * TracerProvider provides an interface for creating {@link Tracer}s
- */
-export interface TracerProvider {
- /**
- * Returns a Tracer, creating one if one with the given name and version is
- * not already created.
- *
- * If there is no Span associated with the current context, `null` is
- * returned.
- *
- * @param name The name of the tracer or instrumentation library.
- * @param version The version of the tracer or instrumentation library.
- * @returns Tracer A Tracer with the given name and version
- */
- getTracer(name: string, version?: string): Tracer;
-}
diff --git a/packages/opentelemetry-api/test/api/api.test.ts b/packages/opentelemetry-api/test/api/api.test.ts
deleted file mode 100644
index e9994038cc..0000000000
--- a/packages/opentelemetry-api/test/api/api.test.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import api, {
- TraceFlags,
- NoopSpan,
- NoopTracerProvider,
- NoopTracer,
- SpanOptions,
- Span,
-} 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);
- assert.strictEqual(typeof tracer, 'object');
- });
-
- describe('GlobalTracerProvider', () => {
- const spanContext = {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.NONE,
- };
- const dummySpan = new NoopSpan(spanContext);
-
- afterEach(() => {
- api.trace.setGlobalTracerProvider(new NoopTracerProvider());
- });
-
- 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');
- const span = tracer.startSpan('test');
- assert.deepStrictEqual(span, dummySpan);
- });
-
- class TestTracer extends NoopTracer {
- startSpan(name: string, options?: SpanOptions): Span {
- return dummySpan;
- }
- }
-
- class TestTracerProvider extends NoopTracerProvider {
- getTracer(_name: string, version?: string) {
- return new TestTracer();
- }
- }
- });
-});
diff --git a/packages/opentelemetry-api/test/noop-implementations/noop-meter.test.ts b/packages/opentelemetry-api/test/noop-implementations/noop-meter.test.ts
deleted file mode 100644
index 7b86f5d59d..0000000000
--- a/packages/opentelemetry-api/test/noop-implementations/noop-meter.test.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import {
- NoopMeterProvider,
- NOOP_BOUND_COUNTER,
- NOOP_BOUND_MEASURE,
- NOOP_COUNTER_METRIC,
- NOOP_MEASURE_METRIC,
-} from '../../src';
-
-describe('NoopMeter', () => {
- it('should not crash', () => {
- const meter = new NoopMeterProvider().getMeter('test-noop');
- const counter = meter.createCounter('some-name');
- const labels = {};
-
- // ensure NoopMetric does not crash.
- counter.bind(labels).add(1);
- counter.unbind(labels);
-
- // ensure the correct noop const is returned
- assert.strictEqual(counter, NOOP_COUNTER_METRIC);
- assert.strictEqual(counter.bind(labels), NOOP_BOUND_COUNTER);
- counter.clear();
-
- const measure = meter.createMeasure('some-name');
- measure.bind(labels).record(1);
-
- // ensure the correct noop const is returned
- assert.strictEqual(measure, NOOP_MEASURE_METRIC);
- assert.strictEqual(measure.bind(labels), NOOP_BOUND_MEASURE);
-
- const options = {
- component: 'tests',
- description: 'the testing package',
- };
-
- const measureWithOptions = meter.createMeasure('some-name', options);
- assert.strictEqual(measureWithOptions, NOOP_MEASURE_METRIC);
- const counterWithOptions = meter.createCounter('some-name', options);
- assert.strictEqual(counterWithOptions, NOOP_COUNTER_METRIC);
- });
-});
diff --git a/packages/opentelemetry-api/test/noop-implementations/noop-span.test.ts b/packages/opentelemetry-api/test/noop-implementations/noop-span.test.ts
deleted file mode 100644
index 76b9a14621..0000000000
--- a/packages/opentelemetry-api/test/noop-implementations/noop-span.test.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import {
- CanonicalCode,
- INVALID_SPAN_ID,
- INVALID_TRACE_ID,
- NoopSpan,
- TraceFlags,
-} from '../../src';
-
-describe('NoopSpan', () => {
- it('do not crash', () => {
- const span = new NoopSpan();
- span.setAttribute('my_string_attribute', 'foo');
- span.setAttribute('my_number_attribute', 123);
- span.setAttribute('my_boolean_attribute', false);
- span.setAttribute('my_obj_attribute', { a: true });
- span.setAttribute('my_sym_attribute', Symbol('a'));
- span.setAttributes({
- my_string_attribute: 'foo',
- my_number_attribute: 123,
- });
-
- span.addEvent('sent');
- span.addEvent('sent', { id: '42', key: 'value' });
-
- span.setStatus({ code: CanonicalCode.CANCELLED });
-
- span.updateName('my-span');
-
- assert.ok(!span.isRecording());
- assert.deepStrictEqual(span.context(), {
- traceId: INVALID_TRACE_ID,
- spanId: INVALID_SPAN_ID,
- traceFlags: TraceFlags.NONE,
- });
- span.end();
- });
-});
diff --git a/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts b/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts
deleted file mode 100644
index e49d0c0388..0000000000
--- a/packages/opentelemetry-api/test/noop-implementations/noop-tracer.test.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import { NoopTracer, NOOP_SPAN, SpanKind } from '../../src';
-
-describe('NoopTracer', () => {
- it('should not crash', () => {
- const tracer = new NoopTracer();
-
- assert.deepStrictEqual(tracer.startSpan('span-name'), NOOP_SPAN);
- assert.deepStrictEqual(
- tracer.startSpan('span-name1', { kind: SpanKind.CLIENT }),
- NOOP_SPAN
- );
- assert.deepStrictEqual(
- tracer.startSpan('span-name2', {
- kind: SpanKind.CLIENT,
- }),
- 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();
- });
-});
diff --git a/packages/opentelemetry-api/tsconfig.json b/packages/opentelemetry-api/tsconfig.json
deleted file mode 100644
index df95d9cc57..0000000000
--- a/packages/opentelemetry-api/tsconfig.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ],
- "typedocOptions": {
- "name": "OpenTelemetry API for JavaScript",
- "out": "docs/out",
- "mode": "file",
- "hideGenerator": true
- }
-}
diff --git a/packages/opentelemetry-base/README.md b/packages/opentelemetry-base/README.md
deleted file mode 100644
index 9cf3819ca4..0000000000
--- a/packages/opentelemetry-base/README.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# OpenTelemetry Base
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![devDependencies][devDependencies-image]][devDependencies-url]
-[![Apache License][license-image]][license-image]
-
-This package provides base code for the SDK packages.
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more about OpenTelemetry JavaScript:
-- For help or feedback on this project, join us on [gitter][gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-base
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-base
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-base
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-base&type=dev
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/base
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fbase.svg
diff --git a/packages/opentelemetry-base/package.json b/packages/opentelemetry-base/package.json
deleted file mode 100644
index 8072e38ee6..0000000000
--- a/packages/opentelemetry-base/package.json
+++ /dev/null
@@ -1,62 +0,0 @@
-{
- "name": "@opentelemetry/base",
- "version": "0.6.1",
- "description": "OpenTelemetry base provides base code for the SDK packages",
- "main": "build/src/index.js",
- "browser": {
- "./src/platform/index.ts": "./src/platform/browser/index.ts",
- "./build/src/platform/index.js": "./build/src/platform/browser/index.js"
- },
- "types": "build/src/index.d.ts",
- "repository": "open-telemetry/opentelemetry-js",
- "scripts": {
- "test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
- "tdd": "npm run tdd:node",
- "tdd:node": "npm run test -- --watch-extensions ts --watch",
- "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "clean": "rimraf build/*",
- "lint": "gts check",
- "lint:fix": "gts fix",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile"
- },
- "keywords": [
- "opentelemetry",
- "nodejs",
- "tracing",
- "profiling",
- "metrics",
- "stats"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.8",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "mocha": "^6.1.0",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "3.7.2"
- }
-}
diff --git a/packages/opentelemetry-base/src/ExportResult.ts b/packages/opentelemetry-base/src/ExportResult.ts
deleted file mode 100644
index 3f94eddd57..0000000000
--- a/packages/opentelemetry-base/src/ExportResult.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export enum ExportResult {
- SUCCESS,
- FAILED_NOT_RETRYABLE,
- FAILED_RETRYABLE,
-}
diff --git a/packages/opentelemetry-base/src/index.ts b/packages/opentelemetry-base/src/index.ts
deleted file mode 100644
index 1c2e67e6b7..0000000000
--- a/packages/opentelemetry-base/src/index.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './ExportResult';
-export * from './platform';
diff --git a/packages/opentelemetry-base/src/platform/browser/constants.ts b/packages/opentelemetry-base/src/platform/browser/constants.ts
deleted file mode 100644
index f37897b468..0000000000
--- a/packages/opentelemetry-base/src/platform/browser/constants.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { VERSION } from '../../version';
-
-/** Constants describing the SDK in use */
-export const SDK_INFO = {
- NAME: 'opentelemetry',
- RUNTIME: 'browser',
- LANGUAGE: 'webjs',
- VERSION: VERSION,
-};
diff --git a/packages/opentelemetry-base/src/platform/browser/index.ts b/packages/opentelemetry-base/src/platform/browser/index.ts
deleted file mode 100644
index 953b08f4da..0000000000
--- a/packages/opentelemetry-base/src/platform/browser/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './constants';
diff --git a/packages/opentelemetry-base/src/platform/index.ts b/packages/opentelemetry-base/src/platform/index.ts
deleted file mode 100644
index 6c6d039c91..0000000000
--- a/packages/opentelemetry-base/src/platform/index.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Use the node platform by default. The "browser" field of package.json is used
-// to override this file to use `./browser/index.ts` when packaged with
-// webpack, Rollup, etc.
-export * from './node';
diff --git a/packages/opentelemetry-base/src/platform/node/constants.ts b/packages/opentelemetry-base/src/platform/node/constants.ts
deleted file mode 100644
index 33c475d428..0000000000
--- a/packages/opentelemetry-base/src/platform/node/constants.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { VERSION } from '../../version';
-
-/** Constants describing the SDK in use */
-export const SDK_INFO = {
- NAME: 'opentelemetry',
- RUNTIME: 'node',
- LANGUAGE: 'nodejs',
- VERSION: VERSION,
-};
diff --git a/packages/opentelemetry-base/src/platform/node/index.ts b/packages/opentelemetry-base/src/platform/node/index.ts
deleted file mode 100644
index 953b08f4da..0000000000
--- a/packages/opentelemetry-base/src/platform/node/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './constants';
diff --git a/packages/opentelemetry-context-async-hooks/README.md b/packages/opentelemetry-context-async-hooks/README.md
deleted file mode 100644
index 4a8044a919..0000000000
--- a/packages/opentelemetry-context-async-hooks/README.md
+++ /dev/null
@@ -1,58 +0,0 @@
-# OpenTelemetry AsyncHooks-based Context Manager
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![devDependencies][devDependencies-image]][devDependencies-url]
-[![Apache License][license-image]][license-image]
-
-This package provides [async-hooks][async-hooks-doc] based context manager which is used internally by OpenTelemetry plugins to propagate specific context between function calls and async operations. It only targets NodeJS since async-hooks is only available there.
-
-## What is a ContextManager ?
-
-The definition and why they exist is available on [the readme of the context-base package][def-context-manager].
-
-### Implementation in NodeJS
-
-NodeJS has a specific API to track async context: [async-hooks][async-hooks-doc], it allows to track creation of new async operation and their respective parent.
-This package only handle storing a specific object for a given async hooks context.
-
-### Limitations
-
-Even if the API is native to NodeJS, it doesn't cover all possible cases of context propagation but there is a big effort from the NodeJS team to fix those. That's why we generally advise to be on the latest LTS to benefit from performance and bug fixes.
-
-There are known modules that break context propagation ([some of them are listed there][pkgs-that-break-ah]), so it's possible that the context manager doesn't work with them.
-
-### Prior arts
-
-Context propagation is a big subject when talking about tracing in NodeJS, if you want more information about that here are some resources:
-- https://www.npmjs.com/package/continuation-local-storage (which was the old way of doing context propagation)
-- Datadog's own implementation for their Javascript tracer: [here][dd-js-tracer-scope]
-- OpenTracing implementation: [here][opentracing-scope]
-- Discussion about context propagation by the NodeJS diagnostics working group: [here][diag-team-scope-discussion]
-
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more about OpenTelemetry JavaScript:
-- For help or feedback on this project, join us on [gitter][gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-context-async-hooks
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-context-async-hooks
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-context-async-hooks
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-context-async-hooks&type=dev
-[async-hooks-doc]: http://nodejs.org/dist/latest/docs/api/async_hooks.html
-[def-context-manager]: https://github.com/open-telemetry/opentelemetry-js/blob/master/packages/opentelemetry-context-base/README.md
-[dd-js-tracer-scope]: https://github.com/DataDog/dd-trace-js/tree/master/packages/dd-trace/src/scope
-[opentracing-scope]: https://github.com/opentracing/opentracing-javascript/pull/113
-[diag-team-scope-discussion]: https://github.com/nodejs/diagnostics/issues/300
-[pkgs-that-break-ah]: https://github.com/nodejs/diagnostics/blob/master/tracing/AsyncHooks/problematic-modules.md
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/context-async-hooks
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fcontext-async-hooks.svg
diff --git a/packages/opentelemetry-context-async-hooks/package.json b/packages/opentelemetry-context-async-hooks/package.json
deleted file mode 100644
index ce54c7ccfd..0000000000
--- a/packages/opentelemetry-context-async-hooks/package.json
+++ /dev/null
@@ -1,61 +0,0 @@
-{
- "name": "@opentelemetry/context-async-hooks",
- "version": "0.6.1",
- "description": "OpenTelemetry AsyncHooks-based Context Manager",
- "main": "build/src/index.js",
- "types": "build/src/index.d.ts",
- "repository": "open-telemetry/opentelemetry-js",
- "scripts": {
- "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": "gts check",
- "lint:fix": "gts fix",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile"
- },
- "keywords": [
- "opentelemetry",
- "nodejs",
- "tracing",
- "profiling",
- "metrics",
- "stats"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.8",
- "@types/shimmer": "^1.0.1",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "mocha": "^6.1.0",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "3.7.2"
- },
- "dependencies": {
- "@opentelemetry/context-base": "^0.6.1"
- }
-}
diff --git a/packages/opentelemetry-context-async-hooks/src/AsyncHooksContextManager.ts b/packages/opentelemetry-context-async-hooks/src/AsyncHooksContextManager.ts
deleted file mode 100644
index 138ab5e2f0..0000000000
--- a/packages/opentelemetry-context-async-hooks/src/AsyncHooksContextManager.ts
+++ /dev/null
@@ -1,246 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { ContextManager, Context } from '@opentelemetry/context-base';
-import * as asyncHooks from 'async_hooks';
-import { EventEmitter } from 'events';
-
-type Func = (...args: unknown[]) => T;
-
-type PatchedEventEmitter = {
- /**
- * Store a map for each event of all original listener and their "patched"
- * version so when the listener is removed by the user, we remove the
- * corresponding "patched" function.
- */
- __ot_listeners?: { [name: string]: WeakMap, Func> };
-} & EventEmitter;
-
-const ADD_LISTENER_METHODS = [
- 'addListener' as 'addListener',
- 'on' as 'on',
- 'once' as 'once',
- 'prependListener' as 'prependListener',
- 'prependOnceListener' as 'prependOnceListener',
-];
-
-export class AsyncHooksContextManager implements ContextManager {
- private _asyncHook: asyncHooks.AsyncHook;
- private _contexts: {
- [uid: number]: Context | undefined | null;
- } = Object.create(null);
-
- constructor() {
- this._asyncHook = asyncHooks.createHook({
- init: this._init.bind(this),
- destroy: this._destroy.bind(this),
- promiseResolve: this._destroy.bind(this),
- });
- }
-
- active(): Context {
- return (
- this._contexts[asyncHooks.executionAsyncId()] || Context.ROOT_CONTEXT
- );
- }
-
- with ReturnType>(
- context: Context,
- fn: T
- ): ReturnType {
- const uid = asyncHooks.executionAsyncId();
- const oldContext = this._contexts[uid];
- this._contexts[uid] = context;
- try {
- return fn();
- } catch (err) {
- throw err;
- } finally {
- if (oldContext === undefined) {
- this._destroy(uid);
- } else {
- this._contexts[uid] = oldContext;
- }
- }
- }
-
- bind(target: T, context: Context): T {
- // if no specific context to propagate is given, we use the current one
- if (context === undefined) {
- context = this.active();
- }
- if (target instanceof EventEmitter) {
- return this._bindEventEmitter(target, context);
- } else if (typeof target === 'function') {
- return this._bindFunction(target, context);
- }
- return target;
- }
-
- enable(): this {
- this._asyncHook.enable();
- return this;
- }
-
- disable(): this {
- this._asyncHook.disable();
- this._contexts = {};
- return this;
- }
-
- private _bindFunction(target: T, context: Context): T {
- const manager = this;
- const contextWrapper = function(this: {}, ...args: unknown[]) {
- return manager.with(context, () => target.apply(this, args));
- };
- Object.defineProperty(contextWrapper, 'length', {
- enumerable: false,
- configurable: true,
- writable: false,
- value: target.length,
- });
- /**
- * It isn't possible to tell Typescript that contextWrapper is the same as T
- * so we forced to cast as any here.
- */
- // tslint:disable-next-line:no-any
- return contextWrapper as any;
- }
-
- /**
- * By default, EventEmitter call their callback with their context, which we do
- * not want, instead we will bind a specific context to all callbacks that
- * go through it.
- * @param target EventEmitter a instance of EventEmitter to patch
- * @param context the context we want to bind
- */
- private _bindEventEmitter(
- target: T,
- context: Context
- ): T {
- const ee = (target as unknown) as PatchedEventEmitter;
- if (ee.__ot_listeners !== undefined) return target;
- ee.__ot_listeners = {};
-
- // patch methods that add a listener to propagate context
- ADD_LISTENER_METHODS.forEach(methodName => {
- if (ee[methodName] === undefined) return;
- ee[methodName] = this._patchAddListener(ee, ee[methodName], context);
- });
- // patch methods that remove a listener
- if (typeof ee.removeListener === 'function') {
- ee.removeListener = this._patchRemoveListener(ee, ee.removeListener);
- }
- if (typeof ee.off === 'function') {
- ee.off = this._patchRemoveListener(ee, ee.off);
- }
- // patch method that remove all listeners
- if (typeof ee.removeAllListeners === 'function') {
- ee.removeAllListeners = this._patchRemoveAllListeners(
- ee,
- ee.removeAllListeners
- );
- }
- return target;
- }
-
- /**
- * Patch methods that remove a given listener so that we match the "patched"
- * version of that listener (the one that propagate context).
- * @param ee EventEmitter instance
- * @param original reference to the patched method
- */
- private _patchRemoveListener(ee: PatchedEventEmitter, original: Function) {
- return function(this: {}, event: string, listener: Func) {
- if (
- ee.__ot_listeners === undefined ||
- ee.__ot_listeners[event] === undefined
- ) {
- return original.call(this, event, listener);
- }
- const events = ee.__ot_listeners[event];
- const patchedListener = events.get(listener);
- return original.call(this, event, patchedListener || listener);
- };
- }
-
- /**
- * Patch methods that remove all listeners so we remove our
- * internal references for a given event.
- * @param ee EventEmitter instance
- * @param original reference to the patched method
- */
- private _patchRemoveAllListeners(
- ee: PatchedEventEmitter,
- original: Function
- ) {
- return function(this: {}, event: string) {
- if (
- ee.__ot_listeners === undefined ||
- ee.__ot_listeners[event] === undefined
- ) {
- return original.call(this, event);
- }
- delete ee.__ot_listeners[event];
- return original.call(this, event);
- };
- }
-
- /**
- * Patch methods on an event emitter instance that can add listeners so we
- * can force them to propagate a given context.
- * @param ee EventEmitter instance
- * @param original reference to the patched method
- * @param [context] context to propagate when calling listeners
- */
- private _patchAddListener(
- ee: PatchedEventEmitter,
- original: Function,
- context: Context
- ) {
- const contextManager = this;
- return function(this: {}, event: string, listener: Func) {
- if (ee.__ot_listeners === undefined) ee.__ot_listeners = {};
- let listeners = ee.__ot_listeners[event];
- if (listeners === undefined) {
- listeners = new WeakMap();
- ee.__ot_listeners[event] = listeners;
- }
- const patchedListener = contextManager.bind(listener, context);
- // store a weak reference of the user listener to ours
- listeners.set(listener, patchedListener);
- return original.call(this, event, patchedListener);
- };
- }
-
- /**
- * Init hook will be called when userland create a async context, setting the
- * context as the current one if it exist.
- * @param uid id of the async context
- */
- private _init(uid: number) {
- this._contexts[uid] = this._contexts[asyncHooks.executionAsyncId()];
- }
-
- /**
- * Destroy hook will be called when a given context is no longer used so we can
- * remove its attached context.
- * @param uid uid of the async context
- */
- private _destroy(uid: number) {
- delete this._contexts[uid];
- }
-}
diff --git a/packages/opentelemetry-context-async-hooks/src/index.ts b/packages/opentelemetry-context-async-hooks/src/index.ts
deleted file mode 100644
index e0dd94f9ea..0000000000
--- a/packages/opentelemetry-context-async-hooks/src/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './AsyncHooksContextManager';
diff --git a/packages/opentelemetry-context-async-hooks/test/AsyncHooksContextManager.test.ts b/packages/opentelemetry-context-async-hooks/test/AsyncHooksContextManager.test.ts
deleted file mode 100644
index 5bc4b99ede..0000000000
--- a/packages/opentelemetry-context-async-hooks/test/AsyncHooksContextManager.test.ts
+++ /dev/null
@@ -1,290 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import { AsyncHooksContextManager } from '../src';
-import { EventEmitter } from 'events';
-import { Context } from '@opentelemetry/context-base';
-
-describe('AsyncHooksContextManager', () => {
- let contextManager: AsyncHooksContextManager;
- const key1 = Context.createKey('test key 1');
-
- beforeEach(() => {
- contextManager = new AsyncHooksContextManager();
- contextManager.enable();
- });
-
- afterEach(() => {
- contextManager.disable();
- });
-
- describe('.enable()', () => {
- it('should work', () => {
- assert.doesNotThrow(() => {
- contextManager = new AsyncHooksContextManager();
- assert(
- contextManager.enable() === contextManager,
- 'should return this'
- );
- });
- });
- });
-
- describe('.disable()', () => {
- it('should work', () => {
- assert.doesNotThrow(() => {
- assert(
- contextManager.disable() === contextManager,
- 'should return this'
- );
- });
- contextManager.enable();
- });
- });
-
- describe('.with()', () => {
- it('should run the callback (null as target)', done => {
- contextManager.with(Context.ROOT_CONTEXT, done);
- });
-
- it('should run the callback (object as target)', done => {
- const test = Context.ROOT_CONTEXT.setValue(key1, 1);
- contextManager.with(test, () => {
- assert.strictEqual(
- contextManager.active(),
- test,
- 'should have context'
- );
- return done();
- });
- });
-
- it('should run the callback (when disabled)', done => {
- contextManager.disable();
- contextManager.with(Context.ROOT_CONTEXT, () => {
- contextManager.enable();
- return done();
- });
- });
-
- it('should rethrow errors', done => {
- assert.throws(() => {
- contextManager.with(Context.ROOT_CONTEXT, () => {
- throw new Error('This should be rethrown');
- });
- });
- return done();
- });
-
- it('should finally restore an old context', done => {
- const ctx1 = Context.ROOT_CONTEXT.setValue(key1, 'ctx1');
- const ctx2 = Context.ROOT_CONTEXT.setValue(key1, 'ctx2');
- contextManager.with(ctx1, () => {
- assert.strictEqual(contextManager.active(), ctx1);
- contextManager.with(ctx2, () => {
- assert.strictEqual(contextManager.active(), ctx2);
- });
- assert.strictEqual(contextManager.active(), ctx1);
- return done();
- });
- });
- });
-
- describe('.bind(function)', () => {
- it('should return the same target (when enabled)', () => {
- const test = { a: 1 };
- assert.deepStrictEqual(
- contextManager.bind(test, Context.ROOT_CONTEXT),
- test
- );
- });
-
- it('should return the same target (when disabled)', () => {
- contextManager.disable();
- const test = { a: 1 };
- assert.deepStrictEqual(
- contextManager.bind(test, Context.ROOT_CONTEXT),
- test
- );
- contextManager.enable();
- });
-
- it('should return current context (when enabled)', done => {
- const context = Context.ROOT_CONTEXT.setValue(key1, 1);
- const fn = contextManager.bind(() => {
- assert.strictEqual(
- contextManager.active(),
- context,
- 'should have context'
- );
- return done();
- }, context);
- fn();
- });
-
- /**
- * Even if asynchooks is disabled, the context propagation will
- * still works but it might be lost after any async op.
- */
- it('should return current context (when disabled)', done => {
- contextManager.disable();
- const context = Context.ROOT_CONTEXT.setValue(key1, 1);
- const fn = contextManager.bind(() => {
- assert.strictEqual(
- contextManager.active(),
- context,
- 'should have context'
- );
- return done();
- }, context);
- fn();
- });
-
- it('should fail to return current context (when disabled + async op)', done => {
- contextManager.disable();
- const context = Context.ROOT_CONTEXT.setValue(key1, 1);
- const fn = contextManager.bind(() => {
- setTimeout(() => {
- assert.strictEqual(
- contextManager.active(),
- Context.ROOT_CONTEXT,
- 'should have no context'
- );
- return done();
- }, 100);
- }, context);
- fn();
- });
-
- it('should return current context (when re-enabled + async op)', done => {
- contextManager.enable();
- const context = Context.ROOT_CONTEXT.setValue(key1, 1);
- const fn = contextManager.bind(() => {
- setTimeout(() => {
- assert.strictEqual(
- contextManager.active(),
- context,
- 'should have context'
- );
- return done();
- }, 100);
- }, context);
- fn();
- });
- });
-
- describe('.bind(event-emitter)', () => {
- it('should return the same target (when enabled)', () => {
- const ee = new EventEmitter();
- assert.deepStrictEqual(contextManager.bind(ee, Context.ROOT_CONTEXT), ee);
- });
-
- it('should return the same target (when disabled)', () => {
- const ee = new EventEmitter();
- contextManager.disable();
- assert.deepStrictEqual(contextManager.bind(ee, Context.ROOT_CONTEXT), ee);
- contextManager.enable();
- });
-
- it('should return current context and removeListener (when enabled)', done => {
- const ee = new EventEmitter();
- const context = Context.ROOT_CONTEXT.setValue(key1, 1);
- const patchedEe = contextManager.bind(ee, context);
- const handler = () => {
- assert.deepStrictEqual(contextManager.active(), context);
- patchedEe.removeListener('test', handler);
- assert.strictEqual(patchedEe.listeners('test').length, 0);
- return done();
- };
- patchedEe.on('test', handler);
- assert.strictEqual(patchedEe.listeners('test').length, 1);
- patchedEe.emit('test');
- });
-
- it('should return current context and removeAllListener (when enabled)', done => {
- const ee = new EventEmitter();
- const context = Context.ROOT_CONTEXT.setValue(key1, 1);
- const patchedEe = contextManager.bind(ee, context);
- const handler = () => {
- assert.deepStrictEqual(contextManager.active(), context);
- patchedEe.removeAllListeners('test');
- assert.strictEqual(patchedEe.listeners('test').length, 0);
- return done();
- };
- patchedEe.on('test', handler);
- assert.strictEqual(patchedEe.listeners('test').length, 1);
- patchedEe.emit('test');
- });
-
- /**
- * Even if asynchooks is disabled, the context propagation will
- * still works but it might be lost after any async op.
- */
- it('should return context (when disabled)', done => {
- contextManager.disable();
- const ee = new EventEmitter();
- const context = Context.ROOT_CONTEXT.setValue(key1, 1);
- const patchedEe = contextManager.bind(ee, context);
- const handler = () => {
- assert.deepStrictEqual(contextManager.active(), context);
- patchedEe.removeListener('test', handler);
- assert.strictEqual(patchedEe.listeners('test').length, 0);
- contextManager.enable();
- return done();
- };
- patchedEe.on('test', handler);
- assert.strictEqual(patchedEe.listeners('test').length, 1);
- patchedEe.emit('test');
- });
-
- it('should not return current context (when disabled + async op)', done => {
- contextManager.disable();
- const ee = new EventEmitter();
- const context = Context.ROOT_CONTEXT.setValue(key1, 1);
- const patchedEe = contextManager.bind(ee, context);
- const handler = () => {
- setImmediate(() => {
- assert.deepStrictEqual(contextManager.active(), Context.ROOT_CONTEXT);
- patchedEe.removeAllListeners('test');
- assert.strictEqual(patchedEe.listeners('test').length, 0);
- return done();
- });
- };
- patchedEe.on('test', handler);
- assert.strictEqual(patchedEe.listeners('test').length, 1);
- patchedEe.emit('test');
- });
-
- it('should return current context (when enabled + async op)', done => {
- contextManager.enable();
- const ee = new EventEmitter();
- const context = Context.ROOT_CONTEXT.setValue(key1, 1);
- const patchedEe = contextManager.bind(ee, context);
- const handler = () => {
- setImmediate(() => {
- assert.deepStrictEqual(contextManager.active(), context);
- patchedEe.removeAllListeners('test');
- assert.strictEqual(patchedEe.listeners('test').length, 0);
- return done();
- });
- };
- patchedEe.on('test', handler);
- assert.strictEqual(patchedEe.listeners('test').length, 1);
- patchedEe.emit('test');
- });
- });
-});
diff --git a/packages/opentelemetry-context-base/README.md b/packages/opentelemetry-context-base/README.md
deleted file mode 100644
index efba889845..0000000000
--- a/packages/opentelemetry-context-base/README.md
+++ /dev/null
@@ -1,39 +0,0 @@
-# OpenTelemetry Base Context Manager
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![devDependencies][devDependencies-image]][devDependencies-url]
-[![Apache License][license-image]][license-image]
-
-This package provides the ContextManager interface (which is used by concrete implementations) and a no-op implementation (which is used internally when no context propagation is defined). It's intended for use both on the server and in the browser.
-
-## What is a Context Manager ?
-
-To understand why they exists, we'll need to understand how Javascript works: when you make native function call (networks, setInterval etc) you generally call C++ code that will later callback your own code.
-
-A common issue when tracing a request in javascript is to link the function that have made the native call to the callback that the native code called when the response is there. Imagine you want to track for which user you made the request, you need some sort of "context/context aware storage".
-
-ContextManager's aim to offer exactly that, it's API offer to store an object in the current context (`with()`) and if needed, `bind()` to a specific function call to find it back when the callback fire, which can later get retrieved using `active()`.
-
-This package only include the interface and a Noop implementation, for more information please see the [async-hooks based ContextManager][ah-context-manager] for NodeJS.
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more about OpenTelemetry JavaScript:
-- For help or feedback on this project, join us on [gitter][gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-context-base
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-context-base
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-context-base
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-context-base&type=dev
-[ah-context-manager]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-context-async-hooks
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/context-base
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fcontext-base.svg
diff --git a/packages/opentelemetry-context-base/package.json b/packages/opentelemetry-context-base/package.json
deleted file mode 100644
index 52cd58348e..0000000000
--- a/packages/opentelemetry-context-base/package.json
+++ /dev/null
@@ -1,59 +0,0 @@
-{
- "name": "@opentelemetry/context-base",
- "version": "0.6.1",
- "description": "OpenTelemetry Base Context Manager",
- "main": "build/src/index.js",
- "types": "build/src/index.d.ts",
- "repository": "open-telemetry/opentelemetry-js",
- "scripts": {
- "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": "gts check",
- "lint:fix": "gts 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"
- },
- "keywords": [
- "opentelemetry",
- "nodejs",
- "browser",
- "tracing",
- "profiling",
- "metrics",
- "stats"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.8",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "mocha": "^6.1.0",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "3.7.2"
- }
-}
diff --git a/packages/opentelemetry-context-base/src/NoopContextManager.ts b/packages/opentelemetry-context-base/src/NoopContextManager.ts
deleted file mode 100644
index 62fbb88068..0000000000
--- a/packages/opentelemetry-context-base/src/NoopContextManager.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as types from './types';
-import { Context } from './context';
-
-export class NoopContextManager implements types.ContextManager {
- active(): Context {
- return Context.ROOT_CONTEXT;
- }
-
- with ReturnType>(
- context: Context,
- fn: T
- ): ReturnType {
- return fn();
- }
-
- bind(target: T, context?: Context): T {
- return target;
- }
-
- enable(): this {
- return this;
- }
-
- disable(): this {
- return this;
- }
-}
diff --git a/packages/opentelemetry-context-base/src/context.ts b/packages/opentelemetry-context-base/src/context.ts
deleted file mode 100644
index 8b42d7e9af..0000000000
--- a/packages/opentelemetry-context-base/src/context.ts
+++ /dev/null
@@ -1,83 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Class which stores and manages current context values. All methods which
- * update context such as get and delete do not modify an existing context,
- * but create a new one with updated values.
- */
-export class Context {
- private _currentContext: Map;
-
- /** The root context is used as the default parent context when there is no active context */
- public static readonly ROOT_CONTEXT = new Context();
-
- /**
- * This is another identifier to the root context which allows developers to easily search the
- * codebase for direct uses of context which need to be removed in later PRs.
- *
- * It's existence is temporary and it should be removed when all references are fixed.
- */
- public static readonly TODO = Context.ROOT_CONTEXT;
-
- /** Get a key to uniquely identify a context value */
- public static createKey(description: string) {
- return Symbol(description);
- }
-
- /**
- * Construct a new context which inherits values from an optional parent context.
- *
- * @param parentContext a context from which to inherit values
- */
- private constructor(parentContext?: Map) {
- this._currentContext = parentContext ? new Map(parentContext) : new Map();
- }
-
- /**
- * Get a value from the context.
- *
- * @param key key which identifies a context value
- */
- getValue(key: symbol): unknown {
- return this._currentContext.get(key);
- }
-
- /**
- * Create a new context which inherits from this context and has
- * the given key set to the given value.
- *
- * @param key context key for which to set the value
- * @param value value to set for the given key
- */
- setValue(key: symbol, value: unknown): Context {
- const context = new Context(this._currentContext);
- context._currentContext.set(key, value);
- return context;
- }
-
- /**
- * Return a new context which inherits from this context but does
- * not contain a value for the given key.
- *
- * @param key context key for which to clear a value
- */
- deleteValue(key: symbol): Context {
- const context = new Context(this._currentContext);
- context._currentContext.delete(key);
- return context;
- }
-}
diff --git a/packages/opentelemetry-context-base/src/index.ts b/packages/opentelemetry-context-base/src/index.ts
deleted file mode 100644
index 25bf328c13..0000000000
--- a/packages/opentelemetry-context-base/src/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './types';
-export * from './context';
-export * from './NoopContextManager';
diff --git a/packages/opentelemetry-context-base/src/types.ts b/packages/opentelemetry-context-base/src/types.ts
deleted file mode 100644
index 9624387ac7..0000000000
--- a/packages/opentelemetry-context-base/src/types.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Context } from './context';
-
-export interface ContextManager {
- /**
- * Get the current active context
- */
- active(): Context;
-
- /**
- * Run the fn callback with object set as the current active context
- * @param context Any object to set as the current active context
- * @param fn A callback to be immediately run within a specific context
- */
- with ReturnType>(
- context: Context,
- fn: T
- ): ReturnType;
-
- /**
- * Bind an object as the current context (or a specific one)
- * @param target Any object to which a context need to be set
- * @param [context] Optionally specify the context which you want to assign
- */
- bind(target: T, context?: Context): T;
-
- /**
- * Enable context management
- */
- enable(): this;
-
- /**
- * Disable context management
- */
- disable(): this;
-}
diff --git a/packages/opentelemetry-context-base/test/NoopContextManager.test.ts b/packages/opentelemetry-context-base/test/NoopContextManager.test.ts
deleted file mode 100644
index af0323fedb..0000000000
--- a/packages/opentelemetry-context-base/test/NoopContextManager.test.ts
+++ /dev/null
@@ -1,107 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import { NoopContextManager, Context } from '../src';
-
-describe('NoopContextManager', () => {
- let contextManager: NoopContextManager;
-
- describe('.enable()', () => {
- it('should work', () => {
- assert.doesNotThrow(() => {
- contextManager = new NoopContextManager();
- assert(
- contextManager.enable() === contextManager,
- 'should return this'
- );
- });
- });
- });
-
- describe('.disable()', () => {
- it('should work', () => {
- assert.doesNotThrow(() => {
- assert(
- contextManager.disable() === contextManager,
- 'should return this'
- );
- });
- contextManager.enable();
- });
- });
-
- describe('.with()', () => {
- it('should run the callback (Context.ROOT_CONTEXT as target)', done => {
- contextManager.with(Context.ROOT_CONTEXT, done);
- });
-
- it('should run the callback (object as target)', done => {
- const key = Context.createKey('test key 1');
- const test = Context.ROOT_CONTEXT.setValue(key, 1);
- contextManager.with(test, () => {
- assert.strictEqual(
- contextManager.active(),
- Context.ROOT_CONTEXT,
- 'should not have context'
- );
- return done();
- });
- });
-
- it('should run the callback (when disabled)', done => {
- contextManager.disable();
- contextManager.with(Context.ROOT_CONTEXT, () => {
- contextManager.enable();
- return done();
- });
- });
- });
-
- describe('.active()', () => {
- it('should always return Context.ROOT_CONTEXT (when enabled)', () => {
- assert.strictEqual(
- contextManager.active(),
- Context.ROOT_CONTEXT,
- 'should not have context'
- );
- });
-
- it('should always return Context.ROOT_CONTEXT (when disabled)', () => {
- contextManager.disable();
- assert.strictEqual(
- contextManager.active(),
- Context.ROOT_CONTEXT,
- 'should not have context'
- );
- contextManager.enable();
- });
- });
-
- describe('.bind()', () => {
- it('should return the same target (when enabled)', () => {
- const test = { a: 1 };
- assert.deepStrictEqual(contextManager.bind(test), test);
- });
-
- it('should return the same target (when disabled)', () => {
- contextManager.disable();
- const test = { a: 1 };
- assert.deepStrictEqual(contextManager.bind(test), test);
- contextManager.enable();
- });
- });
-});
diff --git a/packages/opentelemetry-context-zone-peer-dep/README.md b/packages/opentelemetry-context-zone-peer-dep/README.md
deleted file mode 100644
index 4a0d2d9bd8..0000000000
--- a/packages/opentelemetry-context-zone-peer-dep/README.md
+++ /dev/null
@@ -1,71 +0,0 @@
-# OpenTelemetry Context Zone Peer Dependency
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![devDependencies][devDependencies-image]][devDependencies-url]
-[![Apache License][license-image]][license-image]
-
-This module provides *Zone Context Manager with a peer dependency for [zone-js]* for Web applications.
-If you use Angular you already have the [zone-js] and you should use this package.
-If you don't have your own [zone-js] please use [@opentelemetry/context-zone]
-
-
-## Installation
-
-```bash
-npm install --save @opentelemetry/context-zone-peer-dep
-```
-
-## Usage
-```js
-import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
-import { WebTracer } from '@opentelemetry/web';
-import { ZoneContextManager } from '@opentelemetry/context-zone-peer-dep';
-
-const webTracerWithZone = new WebTracer({
- contextManager: new ZoneContextManager()
-});
-webTracerWithZone.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
-
-// Example how the ZoneContextManager keeps the reference to the correct context during async operations
-const span1 = webTracerWithZone.startSpan('foo1');
-webTracerWithZone.withSpan(span1, () => {
- console.log('Current span is span1', webTracerWithZone.getCurrentSpan() === 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);
- setTimeout(() => {
- console.log('Current span is span2', webTracerWithZone.getCurrentSpan() === span2);
- }, 500);
- });
- // there is a timeout which still keeps span2 active
- console.log('Current span is span2', webTracerWithZone.getCurrentSpan() === span2);
- }, 500);
- console.log('Current span is span1', webTracerWithZone.getCurrentSpan() === span1);
-});
-
-```
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more about OpenTelemetry JavaScript:
-- For help or feedback on this project, join us on [gitter][gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-context-zone-peer-dep
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-context-zone-peer-dep
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-context-zone-peer-dep
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-web&type=dev
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/context-zone-peer-dep
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fcontext-zone-peer-dep.svg
-[zone-js]: https://www.npmjs.com/package/zone.js
-[@opentelemetry/context-zone]: https://www.npmjs.com/package/@opentelemetry/context-zone
diff --git a/packages/opentelemetry-context-zone-peer-dep/package.json b/packages/opentelemetry-context-zone-peer-dep/package.json
deleted file mode 100644
index 1171b269b0..0000000000
--- a/packages/opentelemetry-context-zone-peer-dep/package.json
+++ /dev/null
@@ -1,81 +0,0 @@
-{
- "name": "@opentelemetry/context-zone-peer-dep",
- "version": "0.6.1",
- "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": {
- "lint": "gts check",
- "lint:fix": "gts 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",
- "tdd": "karma start",
- "test:browser": "nyc karma start --single-run",
- "watch": "tsc -w"
- },
- "keywords": [
- "opentelemetry",
- "web",
- "tracing",
- "profiling",
- "metrics",
- "stats"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@babel/core": "^7.6.0",
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.8",
- "@types/sinon": "^7.0.13",
- "@types/webpack-env": "1.13.9",
- "@types/zone.js": "^0.5.12",
- "babel-loader": "^8.0.6",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "istanbul-instrumenter-loader": "^3.0.1",
- "karma": "^4.4.1",
- "karma-chrome-launcher": "^3.1.0",
- "karma-coverage-istanbul-reporter": "^2.1.0",
- "karma-mocha": "^1.3.0",
- "karma-spec-reporter": "^0.0.32",
- "karma-webpack": "^4.0.2",
- "mocha": "^6.1.0",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "sinon": "^7.5.0",
- "ts-loader": "^6.0.4",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "^3.6.3",
- "webpack": "^4.35.2",
- "webpack-cli": "^3.3.9",
- "zone.js": "^0.10.2"
- },
- "dependencies": {
- "@opentelemetry/context-base": "^0.6.1"
- },
- "peerDependencies": {
- "zone.js": "^0.10.2"
- },
- "sideEffects": false
-}
diff --git a/packages/opentelemetry-context-zone-peer-dep/src/ZoneContextManager.ts b/packages/opentelemetry-context-zone-peer-dep/src/ZoneContextManager.ts
deleted file mode 100644
index cd388f94b8..0000000000
--- a/packages/opentelemetry-context-zone-peer-dep/src/ZoneContextManager.ts
+++ /dev/null
@@ -1,251 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { ContextManager, Context } from '@opentelemetry/context-base';
-import { Func, TargetWithEvents } from './types';
-import { isListenerObject } from './util';
-
-/* Key name to be used to save a context reference in Zone */
-const ZONE_CONTEXT_KEY = 'OT_ZONE_CONTEXT';
-
-/**
- * ZoneContextManager
- * This module provides an easy functionality for tracing action between asynchronous operations in web.
- * It was not possible with standard [StackContextManager]{@link https://github.com/open-telemetry/opentelemetry-js/blob/master/packages/opentelemetry-web/src/StackContextManager.ts}.
- * It heavily depends on [zone.js]{@link https://www.npmjs.com/package/zone.js}.
- * It stores the information about context in zone. Each Context will have always new Zone;
- * It also supports binding a certain Span to a target that has "addEventListener" and "removeEventListener".
- * When this happens a new zone is being created and the provided Span is being assigned to this zone.
- */
-export class ZoneContextManager implements ContextManager {
- /**
- * whether the context manager is enabled or not
- */
- private _enabled = false;
-
- /**
- * Helps to create a unique name for the zones - part of zone name
- */
- private _zoneCounter = 0;
-
- /**
- * Returns the active context from certain zone name
- * @param activeZone
- */
- private _activeContextFromZone(activeZone: Zone | undefined): Context {
- return (
- (activeZone && activeZone.get(ZONE_CONTEXT_KEY)) || Context.ROOT_CONTEXT
- );
- }
-
- /**
- * @param target Function to be executed within the context
- * @param context A context (span) to be executed within target function
- */
- private _bindFunction(target: T, context: Context): T {
- const manager = this;
- const contextWrapper = function(this: any, ...args: unknown[]) {
- return manager.with(context, () => target.apply(this, args));
- };
- Object.defineProperty(contextWrapper, 'length', {
- enumerable: false,
- configurable: true,
- writable: false,
- value: target.length,
- });
- return (contextWrapper as unknown) as T;
- }
-
- /**
- * @param obj target object on which the listeners will be patched
- * @param context A context (span) to be bind to target
- */
- private _bindListener(obj: T, context: Context): T {
- const target = (obj as unknown) as TargetWithEvents;
- if (target.__ot_listeners !== undefined) {
- return obj;
- }
- target.__ot_listeners = {};
-
- if (typeof target.addEventListener === 'function') {
- target.addEventListener = this._patchAddEventListener(
- target,
- target.addEventListener,
- context
- );
- }
-
- if (typeof target.removeEventListener === 'function') {
- target.removeEventListener = this._patchRemoveEventListener(
- target,
- target.removeEventListener
- );
- }
-
- return obj;
- }
-
- /**
- * Creates a new unique zone name
- */
- private _createZoneName() {
- this._zoneCounter++;
- const random = Math.random();
- return `${this._zoneCounter}-${random}`;
- }
-
- /**
- * Creates a new zone
- * @param zoneName zone name
- * @param context A context (span) to be bind with Zone
- */
- private _createZone(zoneName: string, context: unknown): Zone {
- return Zone.root.fork({
- name: zoneName,
- properties: {
- [ZONE_CONTEXT_KEY]: context,
- },
- });
- }
-
- /**
- * Returns the active zone
- */
- private _getActiveZone(): Zone | undefined {
- return Zone.current;
- }
-
- /**
- * Patches addEventListener method
- * @param target any target that has "addEventListener" method
- * @param original reference to the patched method
- * @param [context] context to be bind to the listener
- */
- private _patchAddEventListener(
- target: TargetWithEvents,
- original: Function,
- context: Context
- ) {
- const contextManager = this;
-
- return function(this: {}, event: string, listener: Func, opts?: any) {
- if (target.__ot_listeners === undefined) {
- target.__ot_listeners = {};
- }
- let listeners = target.__ot_listeners[event];
- if (listeners === undefined) {
- listeners = new WeakMap();
- target.__ot_listeners[event] = listeners;
- }
- const patchedListener = contextManager.bind(listener, context);
- // store a weak reference of the user listener to ours
- listeners.set(listener, patchedListener);
- return original.call(this, event, patchedListener, opts);
- };
- }
-
- /**
- * Patches removeEventListener method
- * @param target any target that has "removeEventListener" method
- * @param original reference to the patched method
- */
- private _patchRemoveEventListener(
- target: TargetWithEvents,
- original: Function
- ) {
- return function(this: {}, event: string, listener: Func) {
- if (
- target.__ot_listeners === undefined ||
- target.__ot_listeners[event] === undefined
- ) {
- return original.call(this, event, listener);
- }
- const events = target.__ot_listeners[event];
- const patchedListener = events.get(listener);
- events.delete(listener);
- return original.call(this, event, patchedListener || listener);
- };
- }
-
- /**
- * Returns the active context
- */
- active(): Context {
- if (!this._enabled) {
- return Context.ROOT_CONTEXT;
- }
- const activeZone = this._getActiveZone();
-
- const active = this._activeContextFromZone(activeZone);
- if (active) {
- return active;
- }
-
- return Context.ROOT_CONTEXT;
- }
-
- /**
- * Binds a the certain context or the active one to the target function and then returns the target
- * @param target
- * @param context A context (span) to be bind to target
- */
- bind(target: T | TargetWithEvents, context: Context): T {
- // if no specific context to propagate is given, we use the current one
- if (context === undefined) {
- context = this.active();
- }
- if (typeof target === 'function') {
- return this._bindFunction(target, context);
- } else if (isListenerObject(target)) {
- this._bindListener(target, context);
- }
- return (target as unknown) as T;
- }
-
- /**
- * Disable the context manager (clears all the contexts)
- */
- disable(): this {
- this._enabled = false;
- return this;
- }
-
- /**
- * Enables the context manager and creates a default(root) context
- */
- enable(): this {
- this._enabled = true;
- return this;
- }
-
- /**
- * Calls the callback function [fn] with the provided [context].
- * If [context] is undefined then it will use the active context.
- * The context will be set as active
- * @param context A context (span) to be called with provided callback
- * @param fn Callback function
- */
- with ReturnType>(
- context: Context | null,
- fn: () => ReturnType
- ): ReturnType {
- const zoneName = this._createZoneName();
-
- const newZone = this._createZone(zoneName, context);
-
- return newZone.run(fn, context);
- }
-}
diff --git a/packages/opentelemetry-context-zone-peer-dep/src/index.ts b/packages/opentelemetry-context-zone-peer-dep/src/index.ts
deleted file mode 100644
index cee3639760..0000000000
--- a/packages/opentelemetry-context-zone-peer-dep/src/index.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './ZoneContextManager';
-export * from './types';
diff --git a/packages/opentelemetry-context-zone-peer-dep/src/types.ts b/packages/opentelemetry-context-zone-peer-dep/src/types.ts
deleted file mode 100644
index e67614be70..0000000000
--- a/packages/opentelemetry-context-zone-peer-dep/src/types.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export type Func = (...args: unknown[]) => T;
-
-/**
- * Minimum requirements that the object needs to have so that it can bind to the events instead of function
- * this is "addEventListener" and "removeEventListener" - see {@link isListenerObject}
- */
-export interface TargetWithEvents {
- addEventListener?(
- event: string,
- listener: (...args: any[]) => void,
- opts?: { once: boolean }
- ): any;
- removeEventListener?(
- event: string,
- listener: (...args: any[]) => void,
- opts?: { once: boolean }
- ): any;
- __ot_listeners?: { [name: string]: WeakMap, Func> };
-}
diff --git a/packages/opentelemetry-context-zone-peer-dep/src/util.ts b/packages/opentelemetry-context-zone-peer-dep/src/util.ts
deleted file mode 100644
index 98022f9219..0000000000
--- a/packages/opentelemetry-context-zone-peer-dep/src/util.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { TargetWithEvents } from './types';
-
-/**
- * check if an object has addEventListener and removeEventListener functions then it will return true
- * @param obj
- */
-export function isListenerObject(obj: TargetWithEvents = {}): boolean {
- return (
- typeof obj.addEventListener === 'function' &&
- typeof obj.removeEventListener === 'function'
- );
-}
diff --git a/packages/opentelemetry-context-zone-peer-dep/test/ZoneContextManager.test.ts b/packages/opentelemetry-context-zone-peer-dep/test/ZoneContextManager.test.ts
deleted file mode 100644
index 49571bf4bd..0000000000
--- a/packages/opentelemetry-context-zone-peer-dep/test/ZoneContextManager.test.ts
+++ /dev/null
@@ -1,336 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import 'zone.js';
-import * as sinon from 'sinon';
-import * as assert from 'assert';
-import { ZoneContextManager } from '../src';
-import { Context } from '@opentelemetry/context-base';
-
-let clock: any;
-
-describe('ZoneContextManager', () => {
- let contextManager: ZoneContextManager;
- const key1 = Context.createKey('test key 1');
- const key2 = Context.createKey('test key 2');
-
- beforeEach(() => {
- clock = sinon.useFakeTimers();
- contextManager = new ZoneContextManager();
- contextManager.enable();
- });
-
- afterEach(() => {
- clock.restore();
- contextManager.disable();
- });
-
- describe('.enable()', () => {
- it('should work', () => {
- const ctx = Context.ROOT_CONTEXT.setValue(key1, 1);
- assert.doesNotThrow(() => {
- assert(
- contextManager.enable() === contextManager,
- 'should return this'
- );
- contextManager.with(ctx, () => {
- assert(contextManager.active() === ctx, 'should have root context');
- });
- });
- });
- });
-
- describe('.disable()', () => {
- it('should work', () => {
- const ctx = Context.ROOT_CONTEXT.setValue(key1, 1);
- assert.doesNotThrow(() => {
- assert(
- contextManager.disable() === contextManager,
- 'should return this'
- );
- contextManager.with(ctx, () => {
- assert(
- contextManager.active() === Context.ROOT_CONTEXT,
- 'should have root context'
- );
- });
- });
- });
- });
-
- describe('.with()', () => {
- it('should run the callback (null as target)', done => {
- contextManager.with(null, done);
- });
-
- it('should run the callback (object as target)', done => {
- const test = Context.ROOT_CONTEXT.setValue(key1, 1);
- contextManager.with(test, () => {
- assert.strictEqual(
- contextManager.active(),
- test,
- 'should have context'
- );
- return done();
- });
- });
-
- it('should run the callback (when disabled)', done => {
- contextManager.disable();
- contextManager.with(null, () => {
- contextManager.enable();
- return done();
- });
- });
-
- it('should rethrow errors', done => {
- assert.throws(() => {
- contextManager.with(null, () => {
- throw new Error('This should be rethrown');
- });
- });
- return done();
- });
-
- it('should finally restore an old context, including the async task', done => {
- const ctx1 = Context.ROOT_CONTEXT.setValue(key1, 'ctx1');
- const ctx2 = Context.ROOT_CONTEXT.setValue(key1, 'ctx2');
- const ctx3 = Context.ROOT_CONTEXT.setValue(key1, 'ctx3');
-
- contextManager.with(ctx1, () => {
- assert.strictEqual(contextManager.active(), ctx1);
- contextManager.with(ctx2, () => {
- assert.strictEqual(contextManager.active(), ctx2);
- contextManager.with(ctx3, () => {
- assert.strictEqual(contextManager.active(), ctx3);
- });
- assert.strictEqual(contextManager.active(), ctx2);
- });
- assert.strictEqual(contextManager.active(), ctx1);
- setTimeout(() => {
- assert.strictEqual(contextManager.active(), ctx1);
- done();
- }, 500);
- clock.tick(500);
- });
- assert.strictEqual(contextManager.active(), window);
- });
-
- it('should finally restore an old context when context is an object, including the async task', done => {
- const ctx1 = Context.ROOT_CONTEXT.setValue(key1, 1);
- const ctx2 = Context.ROOT_CONTEXT.setValue(key1, 2);
- const ctx3 = Context.ROOT_CONTEXT.setValue(key1, 3);
- contextManager.with(ctx1, () => {
- assert.strictEqual(contextManager.active(), ctx1);
- contextManager.with(ctx2, () => {
- assert.strictEqual(contextManager.active(), ctx2);
- contextManager.with(ctx3, () => {
- assert.strictEqual(contextManager.active(), ctx3);
- });
- assert.strictEqual(contextManager.active(), ctx2);
- });
- assert.strictEqual(contextManager.active(), ctx1);
- setTimeout(() => {
- assert.strictEqual(contextManager.active(), ctx1);
- done();
- }, 500);
- clock.tick(500);
- });
- assert.strictEqual(contextManager.active(), window);
- });
- it('should correctly return the contexts for 3 parallel actions', () => {
- const rootSpan = Context.ROOT_CONTEXT.setValue(key1, 'root');
- contextManager.with(rootSpan, () => {
- assert.ok(
- contextManager.active().getValue(key1) === 'root',
- 'Current span is rootSpan'
- );
- const concurrentSpan1 = Context.ROOT_CONTEXT.setValue(
- key2,
- 'concurrentSpan1'
- );
- const concurrentSpan2 = Context.ROOT_CONTEXT.setValue(
- key2,
- 'concurrentSpan2'
- );
- const concurrentSpan3 = Context.ROOT_CONTEXT.setValue(
- key2,
- 'concurrentSpan3'
- );
-
- contextManager.with(concurrentSpan1, () => {
- setTimeout(() => {
- assert.ok(
- contextManager.active().getValue(key2) === concurrentSpan1,
- 'Current span is concurrentSpan1'
- );
- }, 10);
- });
-
- contextManager.with(concurrentSpan2, () => {
- setTimeout(() => {
- assert.ok(
- contextManager.active().getValue(key2) === concurrentSpan2,
- 'Current span is concurrentSpan2'
- );
- }, 20);
- });
-
- contextManager.with(concurrentSpan3, () => {
- setTimeout(() => {
- assert.ok(
- contextManager.active().getValue(key2) === concurrentSpan3,
- 'Current span is concurrentSpan3'
- );
- }, 30);
- });
- });
- });
- });
-
- describe('.bind(function)', () => {
- it('should call the function with previously assigned context', () => {
- class Obj {
- title: string;
-
- constructor(title: string) {
- this.title = title;
- }
-
- getTitle() {
- return (contextManager.active().getValue(key1) as Obj).title;
- }
- }
-
- const obj1 = new Obj('a1');
- const ctx = Context.ROOT_CONTEXT.setValue(key1, obj1);
- obj1.title = 'a2';
- const obj2 = new Obj('b1');
- const wrapper: any = contextManager.bind(obj2.getTitle, ctx);
- assert.ok(wrapper(), 'a2');
- });
-
- it('should return the same target (when enabled)', () => {
- const test = { a: 1 };
- assert.deepStrictEqual(
- contextManager.bind(test, Context.ROOT_CONTEXT),
- test
- );
- });
-
- it('should return the same target (when disabled)', () => {
- contextManager.disable();
- const test = { a: 1 };
- assert.deepStrictEqual(
- contextManager.bind(test, Context.ROOT_CONTEXT),
- test
- );
- contextManager.enable();
- });
-
- it('should return current context (when enabled)', done => {
- const context = Context.ROOT_CONTEXT.setValue(key1, { a: 1 });
- const fn: any = contextManager.bind(() => {
- assert.strictEqual(
- contextManager.active(),
- context,
- 'should have context'
- );
- return done();
- }, context);
- fn();
- });
-
- it('should return root context (when disabled)', done => {
- contextManager.disable();
- const context = Context.ROOT_CONTEXT.setValue(key1, { a: 1 });
- const fn: any = contextManager.bind(() => {
- assert.strictEqual(
- contextManager.active(),
- Context.ROOT_CONTEXT,
- 'should have context'
- );
- return done();
- }, context);
- fn();
- });
-
- it('should bind the the certain context to the target "addEventListener" function', done => {
- const ctx1 = Context.ROOT_CONTEXT.setValue(key1, 1);
- const element = document.createElement('div');
-
- contextManager.bind(element, ctx1);
-
- element.addEventListener('click', () => {
- assert.strictEqual(contextManager.active(), ctx1);
- setTimeout(() => {
- assert.strictEqual(contextManager.active(), ctx1);
- done();
- }, 500);
- clock.tick(500);
- });
-
- element.dispatchEvent(
- new CustomEvent('click', {
- bubbles: true,
- cancelable: false,
- composed: true,
- })
- );
- });
-
- it('should preserve zone when creating new click event inside zone', done => {
- const ctx1 = Context.ROOT_CONTEXT.setValue(key1, 1);
- const element = document.createElement('div');
-
- contextManager.bind(element, ctx1);
-
- element.addEventListener('click', () => {
- assert.strictEqual(contextManager.active(), ctx1);
- setTimeout(() => {
- assert.strictEqual(contextManager.active(), ctx1);
- const element2 = document.createElement('div');
-
- element2.addEventListener('click', () => {
- assert.strictEqual(contextManager.active(), ctx1);
- setTimeout(() => {
- assert.strictEqual(contextManager.active(), ctx1);
- done();
- }, 500);
- clock.tick(500);
- });
-
- element2.dispatchEvent(
- new CustomEvent('click', {
- bubbles: true,
- cancelable: false,
- composed: true,
- })
- );
- }, 500);
- clock.tick(500);
- });
-
- element.dispatchEvent(
- new CustomEvent('click', {
- bubbles: true,
- cancelable: false,
- composed: true,
- })
- );
- });
- });
-});
diff --git a/packages/opentelemetry-context-zone-peer-dep/test/utils.test.ts b/packages/opentelemetry-context-zone-peer-dep/test/utils.test.ts
deleted file mode 100644
index b0b7fab844..0000000000
--- a/packages/opentelemetry-context-zone-peer-dep/test/utils.test.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import * as utils from '../src/util';
-
-describe('ZoneContextManager utils', () => {
- describe('isListenerObject', () => {
- describe('when object contains "addEventListener" and "removeEventListener"', () => {
- it('should return true', () => {
- const obj = {
- addEventListener: function() {},
- removeEventListener: function() {},
- };
- assert.strictEqual(utils.isListenerObject(obj), true);
- });
- });
- describe('when object doesn\'t contain "addEventListener" and "removeEventListener"', () => {
- it('should return true', () => {
- const obj = {};
- assert.strictEqual(utils.isListenerObject(obj), false);
- });
- });
- describe('when object contains "addEventListener" only', () => {
- it('should return false', () => {
- const obj = {
- addEventListener: function() {},
- };
- assert.strictEqual(utils.isListenerObject(obj), false);
- });
- });
- describe('when object contains "removeEventListener" only', () => {
- it('should return false', () => {
- const obj = {
- removeEventListener: function() {},
- };
- assert.strictEqual(utils.isListenerObject(obj), false);
- });
- });
- });
-});
diff --git a/packages/opentelemetry-context-zone/README.md b/packages/opentelemetry-context-zone/README.md
deleted file mode 100644
index 0b23b884d3..0000000000
--- a/packages/opentelemetry-context-zone/README.md
+++ /dev/null
@@ -1,71 +0,0 @@
-# OpenTelemetry Context Zone
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![devDependencies][devDependencies-image]][devDependencies-url]
-[![Apache License][license-image]][license-image]
-
-This module provides *Zone Context Manager with bundled [zone-js]* for Web applications.
-If you have your own [zone-js] please use [@opentelemetry/context-zone-peer-dep]
-If you use Angular it means you already have the [zone-js] and you should use [@opentelemetry/context-zone-peer-dep]
-
-
-## Installation
-
-```bash
-npm install --save @opentelemetry/context-zone
-```
-
-## Usage
-```js
-import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
-import { WebTracer } from '@opentelemetry/web';
-import { ZoneContextManager } from '@opentelemetry/context-zone';
-
-const webTracerWithZone = new WebTracer({
- contextManager: new ZoneContextManager()
-});
-webTracerWithZone.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
-
-// Example how the ZoneContextManager keeps the reference to the correct context during async operations
-const span1 = webTracerWithZone.startSpan('foo1');
-webTracerWithZone.withSpan(span1, () => {
- console.log('Current span is span1', webTracerWithZone.getCurrentSpan() === 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);
- setTimeout(() => {
- console.log('Current span is span2', webTracerWithZone.getCurrentSpan() === span2);
- }, 500);
- });
- // there is a timeout which still keeps span2 active
- console.log('Current span is span2', webTracerWithZone.getCurrentSpan() === span2);
- }, 500);
- console.log('Current span is span1', webTracerWithZone.getCurrentSpan() === span1);
-});
-
-```
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more about OpenTelemetry JavaScript:
-- For help or feedback on this project, join us on [gitter][gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-context-zone
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-context-zone
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-context-zone
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-web&type=dev
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/context-zone
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fcontext-zone.svg
-[zone-js]: https://www.npmjs.com/package/zone.js
-[@opentelemetry/context-zone-peer-dep]: https://www.npmjs.com/package/@opentelemetry/context-zone-peer-dep
diff --git a/packages/opentelemetry-context-zone/package.json b/packages/opentelemetry-context-zone/package.json
deleted file mode 100644
index 134a63333c..0000000000
--- a/packages/opentelemetry-context-zone/package.json
+++ /dev/null
@@ -1,73 +0,0 @@
-{
- "name": "@opentelemetry/context-zone",
- "version": "0.6.1",
- "description": "OpenTelemetry Context Zone",
- "main": "build/src/index.js",
- "types": "build/src/index.d.ts",
- "repository": "open-telemetry/opentelemetry-js",
- "scripts": {
- "lint": "gts check",
- "lint:fix": "gts 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"
- },
- "keywords": [
- "opentelemetry",
- "web",
- "tracing",
- "profiling",
- "metrics",
- "stats"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@babel/core": "^7.6.0",
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.8",
- "@types/sinon": "^7.0.13",
- "@types/webpack-env": "1.13.9",
- "babel-loader": "^8.0.6",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "karma": "^4.1.0",
- "karma-chrome-launcher": "^2.2.0",
- "karma-mocha": "^1.3.0",
- "karma-spec-reporter": "^0.0.32",
- "karma-webpack": "^4.0.2",
- "mocha": "^6.1.0",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "sinon": "^7.5.0",
- "ts-loader": "^6.0.4",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "^3.6.3",
- "webpack": "^4.35.2",
- "webpack-cli": "^3.3.9",
- "webpack-merge": "^4.2.2"
- },
- "dependencies": {
- "@opentelemetry/context-zone-peer-dep": "^0.6.1",
- "zone.js": "^0.10.2"
- },
- "sideEffects": true
-}
diff --git a/packages/opentelemetry-context-zone/src/index.ts b/packages/opentelemetry-context-zone/src/index.ts
deleted file mode 100644
index cd86de18ab..0000000000
--- a/packages/opentelemetry-context-zone/src/index.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from '@opentelemetry/context-zone-peer-dep';
-import 'zone.js';
diff --git a/packages/opentelemetry-context-zone/tsconfig.json b/packages/opentelemetry-context-zone/tsconfig.json
deleted file mode 100644
index ab49dd3fbd..0000000000
--- a/packages/opentelemetry-context-zone/tsconfig.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "files": [ "node_modules/zone.js/dist/zone.js.d.ts"],
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ]
-}
diff --git a/packages/opentelemetry-core/README.md b/packages/opentelemetry-core/README.md
deleted file mode 100644
index 491c1041f8..0000000000
--- a/packages/opentelemetry-core/README.md
+++ /dev/null
@@ -1,117 +0,0 @@
-# OpenTelemetry Core
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![devDependencies][devDependencies-image]][devDependencies-url]
-[![Apache License][license-image]][license-image]
-
-This package provides default implementations of the OpenTelemetry API for trace and metrics. It's intended for use both on the server and in the browser.
-
-## Built-in Implementations
-
-- [Built-in Propagators](#built-in-propagators)
- * [HttpTraceContext Propagator](#httptracecontext-propagator)
- * [B3 Propagator](#b3-propagator)
- * [Composite Propagator](#composite-propagator)
-- [Built-in Sampler](#built-in-sampler)
- * [Always Sampler](#always-sampler)
- * [Never Sampler](#never-sampler)
- * [Probability Sampler](#probability-sampler)
-
-### Built-in Propagators
-
-#### HttpTraceContext Propagator
-OpenTelemetry provides a text-based approach to propagate context to remote services using the [W3C Trace Context](https://www.w3.org/TR/trace-context/) HTTP headers.
-
-> This is used as a default Propagator
-
-```js
-const api = require("@opentelemetry/api");
-const { HttpTraceContext } = require("@opentelemetry/core");
-
-/* Set Global Propagator */
-api.propagation.setGlobalPropagator(new HttpTraceContext());
-```
-
-#### B3 Propagator
-This is propagator for the B3 HTTP header format, which sends a `SpanContext` on the wire in an HTTP request, allowing other services to create spans with the right context. Based on: https://github.com/openzipkin/b3-propagation
-
-```js
-const api = require("@opentelemetry/api");
-const { B3Propagator } = require("@opentelemetry/core");
-
-/* Set Global Propagator */
-api.propagation.setGlobalPropagator(new B3Propagator());
-```
-
-#### Composite Propagator
-Combines multiple propagators into a single propagator.
-
-```js
-const api = require("@opentelemetry/api");
-const { CompositePropagator } = require("@opentelemetry/core");
-
-/* Set Global Propagator */
-api.propagation.setGlobalPropagator(new CompositePropagator());
-```
-
-### Built-in Sampler
-Sampler is used to make decisions on `Span` sampling.
-
-#### Always Sampler
-Samples every trace regardless of upstream sampling decisions.
-
-> This is used as a default Sampler
-
-```js
-const { NodeTracerProvider } = require("@opentelemetry/node");
-const { ALWAYS_SAMPLER } = require("@opentelemetry/core");
-
-const tracerProvider = new NodeTracerProvider({
- sampler: ALWAYS_SAMPLER
-});
-```
-
-#### Never Sampler
-Doesn't sample any trace, regardless of upstream sampling decisions.
-
-```js
-const { NodeTracerProvider } = require("@opentelemetry/node");
-const { NEVER_SAMPLER } = require("@opentelemetry/core");
-
-const tracerProvider = new NodeTracerProvider({
- sampler: NEVER_SAMPLER
-});
-```
-
-#### Probability Sampler
-Samples a configurable percentage of traces, and additionally samples any trace that was sampled upstream.
-
-```js
-const { NodeTracerProvider } = require("@opentelemetry/node");
-const { ProbabilitySampler } = require("@opentelemetry/core");
-
-const tracerProvider = new NodeTracerProvider({
- sampler: new ProbabilitySampler(0.5)
-});
-```
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more about OpenTelemetry JavaScript:
-- For help or feedback on this project, join us on [gitter][gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-core
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-core
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-core
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-core&type=dev
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/core
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fcore.svg
diff --git a/packages/opentelemetry-core/karma.conf.js b/packages/opentelemetry-core/karma.conf.js
deleted file mode 100644
index 7183aab033..0000000000
--- a/packages/opentelemetry-core/karma.conf.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-const karmaWebpackConfig = require('../../karma.webpack');
-const karmaBaseConfig = require('../../karma.base');
-
-module.exports = (config) => {
- config.set(Object.assign({}, karmaBaseConfig, {
- webpack: karmaWebpackConfig
- }))
-};
diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json
deleted file mode 100644
index 0b1b3cee36..0000000000
--- a/packages/opentelemetry-core/package.json
+++ /dev/null
@@ -1,85 +0,0 @@
-{
- "name": "@opentelemetry/core",
- "version": "0.6.1",
- "description": "OpenTelemetry Core provides default and no-op implementations of the OpenTelemetry types for trace and metrics",
- "main": "build/src/index.js",
- "browser": {
- "./src/platform/index.ts": "./src/platform/browser/index.ts",
- "./build/src/platform/index.js": "./build/src/platform/browser/index.js"
- },
- "types": "build/src/index.d.ts",
- "repository": "open-telemetry/opentelemetry-js",
- "scripts": {
- "test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
- "test:browser": "nyc karma start --single-run",
- "tdd": "npm run tdd:node",
- "tdd:node": "npm run test -- --watch-extensions ts --watch",
- "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": "gts check",
- "lint:fix": "gts 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"
- },
- "keywords": [
- "opentelemetry",
- "nodejs",
- "browser",
- "tracing",
- "profiling",
- "metrics",
- "stats"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.8",
- "@types/semver": "^6.2.0",
- "@types/sinon": "^7.0.13",
- "@types/webpack-env": "1.13.9",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "istanbul-instrumenter-loader": "^3.0.1",
- "karma": "^4.4.1",
- "karma-chrome-launcher": "^3.1.0",
- "karma-coverage-istanbul-reporter": "^2.1.0",
- "karma-mocha": "^1.3.0",
- "karma-spec-reporter": "^0.0.32",
- "karma-webpack": "^4.0.2",
- "mocha": "^6.1.0",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "sinon": "^7.5.0",
- "ts-loader": "^6.0.4",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "3.7.2",
- "webpack": "^4.35.2"
- },
- "dependencies": {
- "@opentelemetry/api": "^0.6.1",
- "@opentelemetry/context-base": "^0.6.1",
- "semver": "^7.1.3"
- }
-}
diff --git a/packages/opentelemetry-core/src/common/ConsoleLogger.ts b/packages/opentelemetry-core/src/common/ConsoleLogger.ts
deleted file mode 100644
index 561fa74d95..0000000000
--- a/packages/opentelemetry-core/src/common/ConsoleLogger.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Logger } from '@opentelemetry/api';
-import { LogLevel } from './types';
-
-export class ConsoleLogger implements Logger {
- constructor(level: LogLevel = LogLevel.INFO) {
- if (level >= LogLevel.DEBUG) {
- this.debug = (...args) => {
- console.debug(...args);
- };
- }
- if (level >= LogLevel.INFO) {
- this.info = (...args) => {
- console.info(...args);
- };
- }
- if (level >= LogLevel.WARN) {
- this.warn = (...args) => {
- console.warn(...args);
- };
- }
- if (level >= LogLevel.ERROR) {
- this.error = (...args) => {
- console.error(...args);
- };
- }
- }
-
- debug(message: string, ...args: unknown[]) {}
-
- error(message: string, ...args: unknown[]) {}
-
- warn(message: string, ...args: unknown[]) {}
-
- info(message: string, ...args: unknown[]) {}
-}
diff --git a/packages/opentelemetry-core/src/common/NoopLogger.ts b/packages/opentelemetry-core/src/common/NoopLogger.ts
deleted file mode 100644
index f0b1edd1d3..0000000000
--- a/packages/opentelemetry-core/src/common/NoopLogger.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Logger } from '@opentelemetry/api';
-
-/** 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[]) {}
-}
diff --git a/packages/opentelemetry-core/src/common/time.ts b/packages/opentelemetry-core/src/common/time.ts
deleted file mode 100644
index 13416ca2d7..0000000000
--- a/packages/opentelemetry-core/src/common/time.ts
+++ /dev/null
@@ -1,175 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as types from '@opentelemetry/api';
-import { otperformance as performance } from '../platform';
-import { TimeOriginLegacy } from './types';
-
-const NANOSECOND_DIGITS = 9;
-const SECOND_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS);
-
-/**
- * Converts a number to HrTime
- * @param epochMillis
- */
-function numberToHrtime(epochMillis: number): types.HrTime {
- const epochSeconds = epochMillis / 1000;
- // Decimals only.
- const seconds = Math.trunc(epochSeconds);
- // Round sub-nanosecond accuracy to nanosecond.
- const nanos =
- Number((epochSeconds - seconds).toFixed(NANOSECOND_DIGITS)) *
- SECOND_TO_NANOSECONDS;
- return [seconds, nanos];
-}
-
-function getTimeOrigin(): number {
- let timeOrigin = performance.timeOrigin;
- if (typeof timeOrigin !== 'number') {
- const perf: TimeOriginLegacy = (performance as unknown) as TimeOriginLegacy;
- timeOrigin = perf.timing && perf.timing.fetchStart;
- }
- return timeOrigin;
-}
-
-/**
- * Returns an hrtime calculated via performance component.
- * @param performanceNow
- */
-export function hrTime(performanceNow?: number): types.HrTime {
- const timeOrigin = numberToHrtime(getTimeOrigin());
- const now = numberToHrtime(
- typeof performanceNow === 'number' ? performanceNow : performance.now()
- );
-
- let seconds = timeOrigin[0] + now[0];
- let nanos = timeOrigin[1] + now[1];
-
- // Nanoseconds
- if (nanos > SECOND_TO_NANOSECONDS) {
- nanos -= SECOND_TO_NANOSECONDS;
- seconds += 1;
- }
-
- return [seconds, nanos];
-}
-
-/**
- *
- * Converts a TimeInput to an HrTime, defaults to _hrtime().
- * @param time
- */
-export function timeInputToHrTime(time: types.TimeInput): types.HrTime {
- // process.hrtime
- if (isTimeInputHrTime(time)) {
- return time as types.HrTime;
- } else if (typeof time === 'number') {
- // Must be a performance.now() if it's smaller than process start time.
- if (time < getTimeOrigin()) {
- return hrTime(time);
- } else {
- // epoch milliseconds or performance.timeOrigin
- return numberToHrtime(time);
- }
- } else if (time instanceof Date) {
- return [time.getTime(), 0];
- } else {
- throw TypeError('Invalid input type');
- }
-}
-
-/**
- * Returns a duration of two hrTime.
- * @param startTime
- * @param endTime
- */
-export function hrTimeDuration(
- startTime: types.HrTime,
- endTime: types.HrTime
-): types.HrTime {
- let seconds = endTime[0] - startTime[0];
- let nanos = endTime[1] - startTime[1];
-
- // overflow
- if (nanos < 0) {
- seconds -= 1;
- // negate
- nanos += SECOND_TO_NANOSECONDS;
- }
-
- return [seconds, nanos];
-}
-
-/**
- * Convert hrTime to timestamp, for example "2019-05-14T17:00:00.000123456Z"
- * @param hrTime
- */
-export function hrTimeToTimeStamp(hrTime: types.HrTime): string {
- const precision = NANOSECOND_DIGITS;
- const tmp = `${'0'.repeat(precision)}${hrTime[1]}Z`;
- const nanoString = tmp.substr(tmp.length - precision - 1);
- const date = new Date(hrTime[0] * 1000).toISOString();
- return date.replace('000Z', nanoString);
-}
-
-/**
- * Convert hrTime to nanoseconds.
- * @param hrTime
- */
-export function hrTimeToNanoseconds(hrTime: types.HrTime): number {
- return hrTime[0] * SECOND_TO_NANOSECONDS + hrTime[1];
-}
-
-/**
- * Convert hrTime to milliseconds.
- * @param hrTime
- */
-export function hrTimeToMilliseconds(hrTime: types.HrTime): number {
- return Math.round(hrTime[0] * 1e3 + hrTime[1] / 1e6);
-}
-
-/**
- * Convert hrTime to microseconds.
- * @param hrTime
- */
-export function hrTimeToMicroseconds(hrTime: types.HrTime): number {
- return Math.round(hrTime[0] * 1e6 + hrTime[1] / 1e3);
-}
-
-/**
- * check if time is HrTime
- * @param value
- */
-export function isTimeInputHrTime(value: unknown) {
- return (
- Array.isArray(value) &&
- value.length === 2 &&
- typeof value[0] === 'number' &&
- typeof value[1] === 'number'
- );
-}
-
-/**
- * check if input value is a correct types.TimeInput
- * @param value
- */
-export function isTimeInput(value: unknown) {
- return (
- isTimeInputHrTime(value) ||
- typeof value === 'number' ||
- value instanceof Date
- );
-}
diff --git a/packages/opentelemetry-core/src/common/types.ts b/packages/opentelemetry-core/src/common/types.ts
deleted file mode 100644
index eb84ba58b7..0000000000
--- a/packages/opentelemetry-core/src/common/types.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** Defines a log levels. */
-export enum LogLevel {
- ERROR,
- WARN,
- INFO,
- DEBUG,
-}
-
-/**
- * This interface defines a fallback to read a timeOrigin when it is not available on performance.timeOrigin,
- * this happens for example on Safari Mac
- * then the timeOrigin is taken from fetchStart - which is the closest to timeOrigin
- */
-export interface TimeOriginLegacy {
- timing: {
- fetchStart: number;
- };
-}
-
-/**
- * This interface defines the params that are be added to the wrapped function
- * using the "shimmer.wrap"
- */
-export interface ShimWrapped {
- __wrapped: boolean;
- __unwrap: Function;
- __original: Function;
-}
diff --git a/packages/opentelemetry-core/src/context/context.ts b/packages/opentelemetry-core/src/context/context.ts
deleted file mode 100644
index c1890915ce..0000000000
--- a/packages/opentelemetry-core/src/context/context.ts
+++ /dev/null
@@ -1,86 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Span, SpanContext } from '@opentelemetry/api';
-import { Context } from '@opentelemetry/context-base';
-
-/**
- * Active span key
- */
-export const ACTIVE_SPAN_KEY = Context.createKey(
- 'OpenTelemetry Context Key ACTIVE_SPAN'
-);
-const EXTRACTED_SPAN_CONTEXT_KEY = Context.createKey(
- 'OpenTelemetry Context Key EXTRACTED_SPAN_CONTEXT'
-);
-
-/**
- * Return the active 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;
-}
-
-/**
- * Set the active 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);
-}
-
-/**
- * Get the extracted span context from a context
- *
- * @param context context to get span context from
- */
-export function getExtractedSpanContext(
- context: Context
-): SpanContext | undefined {
- return (
- (context.getValue(EXTRACTED_SPAN_CONTEXT_KEY) as SpanContext) || undefined
- );
-}
-
-/**
- * Set the extracted span context on a context
- *
- * @param context context to set span context on
- * @param spanContext span context to set
- */
-export function setExtractedSpanContext(
- context: Context,
- spanContext: SpanContext
-): Context {
- return context.setValue(EXTRACTED_SPAN_CONTEXT_KEY, spanContext);
-}
-
-/**
- * Get the span context of the parent span if it exists,
- * or the extracted span context if there is no active
- * span.
- *
- * @param context context to get values from
- */
-export function getParentSpanContext(
- context: Context
-): SpanContext | undefined {
- return getActiveSpan(context)?.context() || getExtractedSpanContext(context);
-}
diff --git a/packages/opentelemetry-core/src/context/propagation/B3Propagator.ts b/packages/opentelemetry-core/src/context/propagation/B3Propagator.ts
deleted file mode 100644
index ce68edc3e2..0000000000
--- a/packages/opentelemetry-core/src/context/propagation/B3Propagator.ts
+++ /dev/null
@@ -1,90 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- Context,
- GetterFunction,
- HttpTextPropagator,
- SetterFunction,
- TraceFlags,
-} from '@opentelemetry/api';
-import { getParentSpanContext, setExtractedSpanContext } from '../context';
-
-export const X_B3_TRACE_ID = 'x-b3-traceid';
-export const X_B3_SPAN_ID = 'x-b3-spanid';
-export const X_B3_SAMPLED = 'x-b3-sampled';
-const VALID_TRACEID_REGEX = /^[0-9a-f]{32}$/i;
-const VALID_SPANID_REGEX = /^[0-9a-f]{16}$/i;
-const INVALID_ID_REGEX = /^0+$/i;
-
-function isValidTraceId(traceId: string): boolean {
- return VALID_TRACEID_REGEX.test(traceId) && !INVALID_ID_REGEX.test(traceId);
-}
-
-function isValidSpanId(spanId: string): boolean {
- return VALID_SPANID_REGEX.test(spanId) && !INVALID_ID_REGEX.test(spanId);
-}
-
-/**
- * Propagator for the B3 HTTP header format.
- * Based on: https://github.com/openzipkin/b3-propagation
- */
-export class B3Propagator implements HttpTextPropagator {
- inject(context: Context, carrier: unknown, setter: SetterFunction) {
- const spanContext = getParentSpanContext(context);
- if (!spanContext) return;
-
- if (
- isValidTraceId(spanContext.traceId) &&
- isValidSpanId(spanContext.spanId)
- ) {
- setter(carrier, X_B3_TRACE_ID, spanContext.traceId);
- setter(carrier, X_B3_SPAN_ID, spanContext.spanId);
-
- // We set the header only if there is an existing sampling decision.
- // Otherwise we will omit it => Absent.
- if (spanContext.traceFlags !== undefined) {
- setter(carrier, X_B3_SAMPLED, Number(spanContext.traceFlags));
- }
- }
- }
-
- extract(context: Context, carrier: unknown, getter: GetterFunction): Context {
- const traceIdHeader = getter(carrier, X_B3_TRACE_ID);
- const spanIdHeader = getter(carrier, X_B3_SPAN_ID);
- const sampledHeader = getter(carrier, X_B3_SAMPLED);
- const traceId = Array.isArray(traceIdHeader)
- ? traceIdHeader[0]
- : traceIdHeader;
- const spanId = Array.isArray(spanIdHeader) ? spanIdHeader[0] : spanIdHeader;
- const options = Array.isArray(sampledHeader)
- ? sampledHeader[0]
- : sampledHeader;
-
- if (typeof traceId !== 'string' || typeof spanId !== 'string')
- return context;
-
- if (isValidTraceId(traceId) && isValidSpanId(spanId)) {
- return setExtractedSpanContext(context, {
- traceId,
- spanId,
- isRemote: true,
- traceFlags: isNaN(Number(options)) ? TraceFlags.NONE : Number(options),
- });
- }
- return context;
- }
-}
diff --git a/packages/opentelemetry-core/src/context/propagation/HttpTraceContext.ts b/packages/opentelemetry-core/src/context/propagation/HttpTraceContext.ts
deleted file mode 100644
index 4a5d4d698b..0000000000
--- a/packages/opentelemetry-core/src/context/propagation/HttpTraceContext.ts
+++ /dev/null
@@ -1,106 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- Context,
- GetterFunction,
- HttpTextPropagator,
- SetterFunction,
- SpanContext,
- TraceFlags,
-} from '@opentelemetry/api';
-import { TraceState } from '../../trace/TraceState';
-import { getParentSpanContext, setExtractedSpanContext } from '../context';
-
-export const TRACE_PARENT_HEADER = 'traceparent';
-export const TRACE_STATE_HEADER = 'tracestate';
-const VALID_TRACE_PARENT_REGEX = /^00-([\da-f]{32})-([\da-f]{16})-([\da-f]{2})$/;
-const VERSION = '00';
-
-/**
- * Parses information from the [traceparent] span tag and converts it into {@link SpanContext}
- * @param traceParent - A meta property that comes from server.
- * It should be dynamically generated server side to have the server's request trace Id,
- * a parent span Id that was set on the server's request span,
- * and the trace flags to indicate the server's sampling decision
- * (01 = sampled, 00 = not sampled).
- * for example: '{version}-{traceId}-{spanId}-{sampleDecision}'
- * For more information see {@link https://www.w3.org/TR/trace-context/}
- */
-export function parseTraceParent(traceParent: string): SpanContext | null {
- const match = traceParent.match(VALID_TRACE_PARENT_REGEX);
- if (
- !match ||
- match[1] === '00000000000000000000000000000000' ||
- match[2] === '0000000000000000'
- ) {
- return null;
- }
-
- return {
- traceId: match[1],
- spanId: match[2],
- traceFlags: parseInt(match[3], 16),
- };
-}
-
-/**
- * Propagates {@link SpanContext} through Trace Context format propagation.
- *
- * Based on the Trace Context specification:
- * https://www.w3.org/TR/trace-context/
- */
-export class HttpTraceContext implements HttpTextPropagator {
- inject(context: Context, carrier: unknown, setter: SetterFunction) {
- const spanContext = getParentSpanContext(context);
- if (!spanContext) return;
-
- const traceParent = `${VERSION}-${spanContext.traceId}-${
- spanContext.spanId
- }-0${Number(spanContext.traceFlags || TraceFlags.NONE).toString(16)}`;
-
- setter(carrier, TRACE_PARENT_HEADER, traceParent);
- if (spanContext.traceState) {
- setter(carrier, TRACE_STATE_HEADER, spanContext.traceState.serialize());
- }
- }
-
- extract(context: Context, carrier: unknown, getter: GetterFunction): Context {
- const traceParentHeader = getter(carrier, TRACE_PARENT_HEADER);
- if (!traceParentHeader) return context;
- const traceParent = Array.isArray(traceParentHeader)
- ? traceParentHeader[0]
- : traceParentHeader;
- if (typeof traceParent !== 'string') return context;
- const spanContext = parseTraceParent(traceParent);
- if (!spanContext) return context;
-
- spanContext.isRemote = true;
-
- const traceStateHeader = getter(carrier, TRACE_STATE_HEADER);
- if (traceStateHeader) {
- // If more than one `tracestate` header is found, we merge them into a
- // single header.
- const state = Array.isArray(traceStateHeader)
- ? traceStateHeader.join(',')
- : traceStateHeader;
- spanContext.traceState = new TraceState(
- typeof state === 'string' ? state : undefined
- );
- }
- return setExtractedSpanContext(context, spanContext);
- }
-}
diff --git a/packages/opentelemetry-core/src/context/propagation/composite.ts b/packages/opentelemetry-core/src/context/propagation/composite.ts
deleted file mode 100644
index c6010b319e..0000000000
--- a/packages/opentelemetry-core/src/context/propagation/composite.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- Context,
- GetterFunction,
- HttpTextPropagator,
- Logger,
- SetterFunction,
-} from '@opentelemetry/api';
-import { NoopLogger } from '../../common/NoopLogger';
-import { CompositePropagatorConfig } from './types';
-
-/** Combines multiple propagators into a single propagator. */
-export class CompositePropagator implements HttpTextPropagator {
- private readonly _propagators: HttpTextPropagator[];
- private readonly _logger: Logger;
-
- /**
- * Construct a composite propagator from a list of propagators.
- *
- * @param [config] Configuration object for composite propagator
- */
- constructor(config: CompositePropagatorConfig = {}) {
- this._propagators = config.propagators ?? [];
- this._logger = config.logger ?? new NoopLogger();
- }
-
- /**
- * Run each of the configured propagators with the given context and carrier.
- * Propagators are run in the order they are configured, so if multiple
- * propagators write the same carrier key, the propagator later in the list
- * will "win".
- *
- * @param context Context to inject
- * @param carrier Carrier into which context will be injected
- */
- inject(context: Context, carrier: unknown, setter: SetterFunction) {
- for (const propagator of this._propagators) {
- try {
- propagator.inject(context, carrier, setter);
- } catch (err) {
- this._logger.warn(
- `Failed to inject with ${propagator.constructor.name}. Err: ${err.message}`
- );
- }
- }
- }
-
- /**
- * Run each of the configured propagators with the given context and carrier.
- * Propagators are run in the order they are configured, so if multiple
- * propagators write the same context key, the propagator later in the list
- * will "win".
- *
- * @param context Context to add values to
- * @param carrier Carrier from which to extract context
- */
- extract(context: Context, carrier: unknown, getter: GetterFunction): Context {
- return this._propagators.reduce((ctx, propagator) => {
- try {
- return propagator.extract(ctx, carrier, getter);
- } catch (err) {
- this._logger.warn(
- `Failed to inject with ${propagator.constructor.name}. Err: ${err.message}`
- );
- }
- return ctx;
- }, context);
- }
-}
diff --git a/packages/opentelemetry-core/src/context/propagation/types.ts b/packages/opentelemetry-core/src/context/propagation/types.ts
deleted file mode 100644
index 7e32712b8c..0000000000
--- a/packages/opentelemetry-core/src/context/propagation/types.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { HttpTextPropagator, Logger } from '@opentelemetry/api';
-
-/** Configuration object for composite propagator */
-export interface CompositePropagatorConfig {
- /**
- * List of propagators to run. Propagators run in the
- * list order. If a propagator later in the list writes the same context
- * key as a propagator earlier in the list, the later on will "win".
- */
- propagators?: HttpTextPropagator[];
-
- /** Instance of logger */
- logger?: Logger;
-}
diff --git a/packages/opentelemetry-core/src/index.ts b/packages/opentelemetry-core/src/index.ts
deleted file mode 100644
index 60b8b04f92..0000000000
--- a/packages/opentelemetry-core/src/index.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './common/ConsoleLogger';
-export * from './common/NoopLogger';
-export * from './common/time';
-export * from './common/types';
-export * from './version';
-export * from './context/context';
-export * from './context/propagation/B3Propagator';
-export * from './context/propagation/composite';
-export * from './context/propagation/HttpTraceContext';
-export * from './context/propagation/types';
-export * from './platform';
-export * from './trace/instrumentation/BasePlugin';
-export * from './trace/NoRecordingSpan';
-export * from './trace/sampler/ProbabilitySampler';
-export * from './trace/spancontext-utils';
-export * from './trace/TraceState';
-export * from './utils/url';
-export * from './utils/wrap';
diff --git a/packages/opentelemetry-core/src/internal/validators.ts b/packages/opentelemetry-core/src/internal/validators.ts
deleted file mode 100644
index 5b1c941bed..0000000000
--- a/packages/opentelemetry-core/src/internal/validators.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-const VALID_KEY_CHAR_RANGE = '[_0-9a-z-*/]';
-const VALID_KEY = `[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`;
-const VALID_VENDOR_KEY = `[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`;
-const VALID_KEY_REGEX = new RegExp(`^(?:${VALID_KEY}|${VALID_VENDOR_KEY})$`);
-const VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/;
-const INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/;
-
-/**
- * Key is opaque string up to 256 characters printable. It MUST begin with a
- * lowercase letter, and can only contain lowercase letters a-z, digits 0-9,
- * underscores _, dashes -, asterisks *, and forward slashes /.
- * For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the
- * vendor name. Vendors SHOULD set the tenant ID at the beginning of the key.
- * see https://www.w3.org/TR/trace-context/#key
- */
-export function validateKey(key: string): boolean {
- return VALID_KEY_REGEX.test(key);
-}
-
-/**
- * Value is opaque string up to 256 characters printable ASCII RFC0020
- * characters (i.e., the range 0x20 to 0x7E) except comma , and =.
- */
-export function validateValue(value: string): boolean {
- return (
- VALID_VALUE_BASE_REGEX.test(value) &&
- !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value)
- );
-}
diff --git a/packages/opentelemetry-core/src/platform/browser/hex-to-base64.ts b/packages/opentelemetry-core/src/platform/browser/hex-to-base64.ts
deleted file mode 100644
index d0441b7772..0000000000
--- a/packages/opentelemetry-core/src/platform/browser/hex-to-base64.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * converts id string into base64
- * @param hexStr - id of span
- */
-export function hexToBase64(hexStr: string): string {
- const hexStrLen = hexStr.length;
- let hexAsciiCharsStr = '';
- for (let i = 0; i < hexStrLen; i += 2) {
- const hexPair = hexStr.substring(i, i + 2);
- const hexVal = parseInt(hexPair, 16);
- hexAsciiCharsStr += String.fromCharCode(hexVal);
- }
- return btoa(hexAsciiCharsStr);
-}
diff --git a/packages/opentelemetry-core/src/platform/browser/id.ts b/packages/opentelemetry-core/src/platform/browser/id.ts
deleted file mode 100644
index 02af4b220e..0000000000
--- a/packages/opentelemetry-core/src/platform/browser/id.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// IE 11 exposes `crypto` as `msCrypto`.
-declare type WindowWithMsCrypto = Window & {
- msCrypto?: Crypto;
-};
-const cryptoLib = window.crypto || (window as WindowWithMsCrypto).msCrypto;
-
-const SPAN_ID_BYTES = 8;
-const TRACE_ID_BYTES = 16;
-const randomBytesArray = new Uint8Array(TRACE_ID_BYTES);
-
-/** Returns a random 16-byte trace ID formatted as a 32-char hex string. */
-export function randomTraceId(): string {
- cryptoLib.getRandomValues(randomBytesArray);
- return toHex(randomBytesArray.slice(0, TRACE_ID_BYTES));
-}
-
-/** Returns a random 8-byte span ID formatted as a 16-char hex string. */
-export function randomSpanId(): string {
- cryptoLib.getRandomValues(randomBytesArray);
- return toHex(randomBytesArray.slice(0, SPAN_ID_BYTES));
-}
-
-/**
- * Get the hex string representation of a byte array
- *
- * @param byteArray
- */
-function toHex(byteArray: Uint8Array) {
- const chars: number[] = new Array(byteArray.length * 2);
- const alpha = 'a'.charCodeAt(0) - 10;
- const digit = '0'.charCodeAt(0);
-
- let p = 0;
- for (let i = 0; i < byteArray.length; i++) {
- let nibble = (byteArray[i] >>> 4) & 0xf;
- chars[p++] = nibble > 9 ? nibble + alpha : nibble + digit;
- nibble = byteArray[i] & 0xf;
- chars[p++] = nibble > 9 ? nibble + alpha : nibble + digit;
- }
-
- return String.fromCharCode.apply(null, chars);
-}
diff --git a/packages/opentelemetry-core/src/platform/browser/index.ts b/packages/opentelemetry-core/src/platform/browser/index.ts
deleted file mode 100644
index 4668bb35aa..0000000000
--- a/packages/opentelemetry-core/src/platform/browser/index.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './id';
-export * from './performance';
-export * from './timer-util';
-export * from './hex-to-base64';
diff --git a/packages/opentelemetry-core/src/platform/browser/performance.ts b/packages/opentelemetry-core/src/platform/browser/performance.ts
deleted file mode 100644
index 2287803e65..0000000000
--- a/packages/opentelemetry-core/src/platform/browser/performance.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export const otperformance = performance;
diff --git a/packages/opentelemetry-core/src/platform/browser/timer-util.ts b/packages/opentelemetry-core/src/platform/browser/timer-util.ts
deleted file mode 100644
index 81245de391..0000000000
--- a/packages/opentelemetry-core/src/platform/browser/timer-util.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** This is Node specific, does nothing in case of browser */
-export function unrefTimer(timer: number): void {}
diff --git a/packages/opentelemetry-core/src/platform/index.ts b/packages/opentelemetry-core/src/platform/index.ts
deleted file mode 100644
index ef7a1e50a8..0000000000
--- a/packages/opentelemetry-core/src/platform/index.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Use the node platform by default. The "browser" field of package.json is used
-// to override this file to use `./browser/index.ts` when packaged with
-// webpack, Rollup, etc.
-export * from './node';
diff --git a/packages/opentelemetry-core/src/platform/node/hex-to-base64.ts b/packages/opentelemetry-core/src/platform/node/hex-to-base64.ts
deleted file mode 100644
index 1ed62f9cf9..0000000000
--- a/packages/opentelemetry-core/src/platform/node/hex-to-base64.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * converts id string into base64
- * @param hexStr - id of span
- */
-export function hexToBase64(hexStr: string): string {
- const hexStrLen = hexStr.length;
- let hexAsciiCharsStr = '';
- for (let i = 0; i < hexStrLen; i += 2) {
- const hexPair = hexStr.substring(i, i + 2);
- const hexVal = parseInt(hexPair, 16);
- hexAsciiCharsStr += String.fromCharCode(hexVal);
- }
-
- return Buffer.from(hexAsciiCharsStr, 'ascii').toString('base64');
-}
diff --git a/packages/opentelemetry-core/src/platform/node/id.ts b/packages/opentelemetry-core/src/platform/node/id.ts
deleted file mode 100644
index fa4cd6a916..0000000000
--- a/packages/opentelemetry-core/src/platform/node/id.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as crypto from 'crypto';
-
-const SPAN_ID_BYTES = 8;
-const TRACE_ID_BYTES = 16;
-
-/**
- * Returns a random 16-byte trace ID formatted/encoded as a 32 lowercase hex
- * characters corresponding to 128 bits.
- */
-export function randomTraceId(): string {
- return crypto.randomBytes(TRACE_ID_BYTES).toString('hex');
-}
-
-/**
- * Returns a random 8-byte span ID formatted/encoded as a 16 lowercase hex
- * characters corresponding to 64 bits.
- */
-export function randomSpanId(): string {
- return crypto.randomBytes(SPAN_ID_BYTES).toString('hex');
-}
diff --git a/packages/opentelemetry-core/src/platform/node/index.ts b/packages/opentelemetry-core/src/platform/node/index.ts
deleted file mode 100644
index 4668bb35aa..0000000000
--- a/packages/opentelemetry-core/src/platform/node/index.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './id';
-export * from './performance';
-export * from './timer-util';
-export * from './hex-to-base64';
diff --git a/packages/opentelemetry-core/src/platform/node/performance.ts b/packages/opentelemetry-core/src/platform/node/performance.ts
deleted file mode 100644
index fd94ee83ed..0000000000
--- a/packages/opentelemetry-core/src/platform/node/performance.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { performance } from 'perf_hooks';
-
-export const otperformance = performance;
diff --git a/packages/opentelemetry-core/src/platform/node/timer-util.ts b/packages/opentelemetry-core/src/platform/node/timer-util.ts
deleted file mode 100644
index 132ba860bc..0000000000
--- a/packages/opentelemetry-core/src/platform/node/timer-util.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * When called, the active Timeout object will not require the Node.js event
- * loop to remain active.
- */
-export function unrefTimer(timer: NodeJS.Timeout): void {
- timer.unref();
-}
diff --git a/packages/opentelemetry-core/src/trace/NoRecordingSpan.ts b/packages/opentelemetry-core/src/trace/NoRecordingSpan.ts
deleted file mode 100644
index cf2920ab37..0000000000
--- a/packages/opentelemetry-core/src/trace/NoRecordingSpan.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { SpanContext, NoopSpan } from '@opentelemetry/api';
-import { INVALID_SPAN_CONTEXT } from '../trace/spancontext-utils';
-
-/**
- * The NoRecordingSpan extends the {@link NoopSpan}, making all operations no-op
- * except context propagation.
- */
-export class NoRecordingSpan extends NoopSpan {
- private readonly _context: SpanContext;
-
- constructor(spanContext: SpanContext) {
- super(spanContext);
- this._context = spanContext || INVALID_SPAN_CONTEXT;
- }
-
- // Returns a SpanContext.
- context(): SpanContext {
- return this._context;
- }
-}
diff --git a/packages/opentelemetry-core/src/trace/TraceState.ts b/packages/opentelemetry-core/src/trace/TraceState.ts
deleted file mode 100644
index cb42e83b64..0000000000
--- a/packages/opentelemetry-core/src/trace/TraceState.ts
+++ /dev/null
@@ -1,97 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as types from '@opentelemetry/api';
-import { validateKey, validateValue } from '../internal/validators';
-
-const MAX_TRACE_STATE_ITEMS = 32;
-const MAX_TRACE_STATE_LEN = 512;
-const LIST_MEMBERS_SEPARATOR = ',';
-const LIST_MEMBER_KEY_VALUE_SPLITTER = '=';
-
-/**
- * TraceState must be a class and not a simple object type because of the spec
- * requirement (https://www.w3.org/TR/trace-context/#tracestate-field).
- *
- * Here is the list of allowed mutations:
- * - New key-value pair should be added into the beginning of the list
- * - The value of any key can be updated. Modified keys MUST be moved to the
- * beginning of the list.
- */
-export class TraceState implements types.TraceState {
- private _internalState: Map = new Map();
-
- constructor(rawTraceState?: string) {
- if (rawTraceState) this._parse(rawTraceState);
- }
-
- set(key: string, value: string): void {
- // TODO: Benchmark the different approaches(map vs list) and
- // use the faster one.
- if (this._internalState.has(key)) this._internalState.delete(key);
- this._internalState.set(key, value);
- }
-
- unset(key: string): void {
- this._internalState.delete(key);
- }
-
- get(key: string): string | undefined {
- return this._internalState.get(key);
- }
-
- serialize(): string {
- return this._keys()
- .reduce((agg: string[], key) => {
- agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + this.get(key));
- return agg;
- }, [])
- .join(LIST_MEMBERS_SEPARATOR);
- }
-
- private _parse(rawTraceState: string) {
- if (rawTraceState.length > MAX_TRACE_STATE_LEN) return;
- this._internalState = rawTraceState
- .split(LIST_MEMBERS_SEPARATOR)
- .reverse() // Store in reverse so new keys (.set(...)) will be placed at the beginning
- .reduce((agg: Map, part: string) => {
- const i = part.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);
- if (i !== -1) {
- const key = part.slice(0, i);
- const value = part.slice(i + 1, part.length);
- if (validateKey(key) && validateValue(value)) {
- agg.set(key, value);
- } else {
- // TODO: Consider to add warning log
- }
- }
- return agg;
- }, new Map());
-
- // Because of the reverse() requirement, trunc must be done after map is created
- if (this._internalState.size > MAX_TRACE_STATE_ITEMS) {
- this._internalState = new Map(
- Array.from(this._internalState.entries())
- .reverse() // Use reverse same as original tracestate parse chain
- .slice(0, MAX_TRACE_STATE_ITEMS)
- );
- }
- }
-
- private _keys(): string[] {
- return Array.from(this._internalState.keys()).reverse();
- }
-}
diff --git a/packages/opentelemetry-core/src/trace/instrumentation/BasePlugin.ts b/packages/opentelemetry-core/src/trace/instrumentation/BasePlugin.ts
deleted file mode 100644
index 601939df36..0000000000
--- a/packages/opentelemetry-core/src/trace/instrumentation/BasePlugin.ts
+++ /dev/null
@@ -1,151 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- Tracer,
- Plugin,
- Logger,
- PluginConfig,
- PluginInternalFiles,
- PluginInternalFilesVersion,
- TracerProvider,
-} from '@opentelemetry/api';
-import * as semver from 'semver';
-import * as path from 'path';
-
-/** This class represent the base to patch plugin. */
-export abstract class BasePlugin implements Plugin {
- supportedVersions?: string[];
- abstract readonly moduleName: string; // required for internalFilesExports
- readonly version?: string; // required for internalFilesExports
- protected readonly _basedir?: string; // required for internalFilesExports
-
- protected _moduleExports!: T;
- protected _tracer!: Tracer;
- protected _logger!: Logger;
- protected _internalFilesExports!: { [module: string]: unknown }; // output for internalFilesExports
- protected readonly _internalFilesList?: PluginInternalFiles; // required for internalFilesExports
- protected _config!: PluginConfig;
-
- constructor(
- protected readonly _tracerName: string,
- protected readonly _tracerVersion?: string
- ) {}
-
- enable(
- moduleExports: T,
- tracerProvider: TracerProvider,
- logger: Logger,
- config?: PluginConfig
- ): T {
- this._moduleExports = moduleExports;
- this._tracer = tracerProvider.getTracer(
- this._tracerName,
- this._tracerVersion
- );
- this._logger = logger;
- this._internalFilesExports = this._loadInternalFilesExports();
- if (config) this._config = config;
- return this.patch();
- }
-
- disable(): void {
- this.unpatch();
- }
-
- /**
- * @TODO: To avoid circular dependencies, internal file loading functionality currently
- * lives in BasePlugin. It is not meant to work in the browser and so this logic
- * should eventually be moved somewhere else where it makes more sense.
- * https://github.com/open-telemetry/opentelemetry-js/issues/285
- */
- private _loadInternalFilesExports(): PluginInternalFiles {
- if (!this._internalFilesList) return {};
- if (!this.version || !this.moduleName || !this._basedir) {
- // log here because internalFilesList was provided, so internal file loading
- // was expected to be working
- this._logger.debug(
- 'loadInternalFiles failed because one of the required fields was missing: moduleName=%s, version=%s, basedir=%s',
- this.moduleName,
- this.version,
- this._basedir
- );
- return {};
- }
- let extraModules: PluginInternalFiles = {};
- this._logger.debug('loadInternalFiles %o', this._internalFilesList);
- Object.keys(this._internalFilesList).forEach(versionRange => {
- this._loadInternalModule(versionRange, extraModules);
- });
- if (Object.keys(extraModules).length === 0) {
- this._logger.debug(
- 'No internal files could be loaded for %s@%s',
- this.moduleName,
- this.version
- );
- }
- return extraModules;
- }
-
- private _loadInternalModule(
- versionRange: string,
- outExtraModules: PluginInternalFiles
- ): void {
- if (semver.satisfies(this.version!, versionRange)) {
- if (Object.keys(outExtraModules).length > 0) {
- this._logger.warn(
- 'Plugin for %s@%s, has overlap version range (%s) for internal files: %o',
- this.moduleName,
- this.version,
- versionRange,
- this._internalFilesList
- );
- }
- this._requireInternalFiles(
- this._internalFilesList![versionRange],
- this._basedir!,
- outExtraModules
- );
- }
- }
-
- private _requireInternalFiles(
- extraModulesList: PluginInternalFilesVersion,
- basedir: string,
- outExtraModules: PluginInternalFiles
- ): void {
- if (!extraModulesList) return;
- Object.keys(extraModulesList).forEach(moduleName => {
- try {
- this._logger.debug('loading File %s', extraModulesList[moduleName]);
- outExtraModules[moduleName] = require(path.join(
- basedir,
- extraModulesList[moduleName]
- ));
- } catch (e) {
- this._logger.error(
- 'Could not load internal file %s of module %s. Error: %s',
- path.join(basedir, extraModulesList[moduleName]),
- this.moduleName,
- e.message
- );
- }
- });
- }
-
- protected abstract patch(): T;
- protected abstract unpatch(): void;
-}
diff --git a/packages/opentelemetry-core/src/trace/sampler/ProbabilitySampler.ts b/packages/opentelemetry-core/src/trace/sampler/ProbabilitySampler.ts
deleted file mode 100644
index 398ebb58df..0000000000
--- a/packages/opentelemetry-core/src/trace/sampler/ProbabilitySampler.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Sampler, SpanContext, TraceFlags } from '@opentelemetry/api';
-
-/** Sampler that samples a given fraction of traces. */
-export class ProbabilitySampler implements Sampler {
- constructor(private readonly _probability: number = 0) {
- this._probability = this._normalize(_probability);
- }
-
- shouldSample(parentContext?: SpanContext) {
- // Respect the parent sampling decision if there is one
- if (parentContext && typeof parentContext.traceFlags !== 'undefined') {
- return (
- (TraceFlags.SAMPLED & parentContext.traceFlags) === TraceFlags.SAMPLED
- );
- }
- if (this._probability >= 1.0) return true;
- else if (this._probability <= 0) return false;
- return Math.random() < this._probability;
- }
-
- toString(): string {
- // TODO: Consider to use `AlwaysSampleSampler` and `NeverSampleSampler`
- // based on the specs.
- return `ProbabilitySampler{${this._probability}}`;
- }
-
- private _normalize(probability: number): number {
- if (typeof probability !== 'number' || isNaN(probability)) return 0;
- return probability >= 1 ? 1 : probability <= 0 ? 0 : probability;
- }
-}
-
-export const ALWAYS_SAMPLER = new ProbabilitySampler(1);
-export const NEVER_SAMPLER = new ProbabilitySampler(0);
diff --git a/packages/opentelemetry-core/src/trace/spancontext-utils.ts b/packages/opentelemetry-core/src/trace/spancontext-utils.ts
deleted file mode 100644
index 42f91368fd..0000000000
--- a/packages/opentelemetry-core/src/trace/spancontext-utils.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { SpanContext, TraceFlags } from '@opentelemetry/api';
-
-export const INVALID_SPANID = '0';
-export const INVALID_TRACEID = '0';
-export const INVALID_SPAN_CONTEXT: SpanContext = {
- traceId: INVALID_TRACEID,
- spanId: INVALID_SPANID,
- traceFlags: TraceFlags.NONE,
-};
-
-/**
- * Returns true if this {@link SpanContext} is valid.
- * @return true if this {@link SpanContext} is valid.
- */
-export function isValid(spanContext: SpanContext): boolean {
- return (
- spanContext.traceId !== INVALID_TRACEID &&
- spanContext.spanId !== INVALID_SPANID
- );
-}
diff --git a/packages/opentelemetry-core/src/utils/url.ts b/packages/opentelemetry-core/src/utils/url.ts
deleted file mode 100644
index 8ed779bca2..0000000000
--- a/packages/opentelemetry-core/src/utils/url.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Check if {@param url} matches {@param urlToMatch}
- * @param url
- * @param urlToMatch
- */
-export function urlMatches(url: string, urlToMatch: string | RegExp): boolean {
- if (typeof urlToMatch === 'string') {
- return url === urlToMatch;
- } else {
- return !!url.match(urlToMatch);
- }
-}
-/**
- * Check if {@param url} should be ignored when comparing against {@param ignoredUrls}
- * @param url
- * @param ignoredUrls
- */
-export function isUrlIgnored(
- url: string,
- ignoredUrls?: Array
-): boolean {
- if (!ignoredUrls) {
- return false;
- }
-
- for (const ignoreUrl of ignoredUrls) {
- if (urlMatches(url, ignoreUrl)) {
- return true;
- }
- }
- return false;
-}
diff --git a/packages/opentelemetry-core/src/utils/wrap.ts b/packages/opentelemetry-core/src/utils/wrap.ts
deleted file mode 100644
index ad3ac6b4c3..0000000000
--- a/packages/opentelemetry-core/src/utils/wrap.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { ShimWrapped } from '../common/types';
-
-/**
- * Checks if certain function has been already wrapped
- * @param func
- */
-export function isWrapped(func: any) {
- return (
- typeof func === 'function' &&
- typeof (func as ShimWrapped).__original === 'function' &&
- typeof (func as ShimWrapped).__unwrap === 'function' &&
- (func as ShimWrapped).__wrapped === true
- );
-}
diff --git a/packages/opentelemetry-core/test/common/ConsoleLogger.test.ts b/packages/opentelemetry-core/test/common/ConsoleLogger.test.ts
deleted file mode 100644
index f35dfe38e4..0000000000
--- a/packages/opentelemetry-core/test/common/ConsoleLogger.test.ts
+++ /dev/null
@@ -1,118 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import { ConsoleLogger } from '../../src/common/ConsoleLogger';
-import { LogLevel } from '../../src/common/types';
-
-describe('ConsoleLogger', () => {
- const origDebug = console.debug;
- const origInfo = console.info;
- const origWarn = console.warn;
- const origError = console.error;
- let debugCalledArgs: unknown;
- let infoCalledArgs: unknown;
- let warnCalledArgs: unknown;
- let errorCalledArgs: unknown;
-
- beforeEach(() => {
- // mock
- console.debug = (...args: unknown[]) => {
- debugCalledArgs = args;
- };
- console.info = (...args: unknown[]) => {
- infoCalledArgs = args;
- };
- console.warn = (...args: unknown[]) => {
- warnCalledArgs = args;
- };
- console.error = (...args: unknown[]) => {
- errorCalledArgs = args;
- };
- });
-
- afterEach(() => {
- // restore
- debugCalledArgs = null;
- infoCalledArgs = null;
- warnCalledArgs = null;
- errorCalledArgs = null;
- console.debug = origDebug;
- console.info = origInfo;
- console.warn = origWarn;
- console.error = origError;
- });
-
- describe('constructor', () => {
- it('should log with default level', () => {
- const consoleLogger = new ConsoleLogger();
- consoleLogger.error('error called %s', 'param1');
- assert.deepStrictEqual(errorCalledArgs, ['error called %s', 'param1']);
- consoleLogger.warn('warn called %s', 'param1');
- assert.deepStrictEqual(warnCalledArgs, ['warn called %s', 'param1']);
- consoleLogger.info('info called %s', 'param1');
- assert.deepStrictEqual(infoCalledArgs, ['info called %s', 'param1']);
- });
-
- it('should log with debug', () => {
- const consoleLogger = new ConsoleLogger(LogLevel.DEBUG);
- consoleLogger.error('error called');
- assert.deepStrictEqual(errorCalledArgs, ['error called']);
- consoleLogger.warn('warn called %s', 'param1');
- assert.deepStrictEqual(warnCalledArgs, ['warn called %s', 'param1']);
- consoleLogger.info('info called %s', 'param1');
- assert.deepStrictEqual(infoCalledArgs, ['info called %s', 'param1']);
- consoleLogger.debug('debug called %s', 'param1');
- assert.deepStrictEqual(debugCalledArgs, ['debug called %s', 'param1']);
- });
-
- it('should log with info', () => {
- const consoleLogger = new ConsoleLogger(LogLevel.INFO);
- consoleLogger.error('error called %s', 'param1');
- assert.deepStrictEqual(errorCalledArgs, ['error called %s', 'param1']);
- consoleLogger.warn('warn called %s', 'param1');
- assert.deepStrictEqual(warnCalledArgs, ['warn called %s', 'param1']);
- consoleLogger.info('info called %s', 'param1');
- assert.deepStrictEqual(infoCalledArgs, ['info called %s', 'param1']);
- consoleLogger.debug('debug called %s', 'param1');
- assert.strictEqual(debugCalledArgs, null);
- });
-
- it('should log with warn', () => {
- const consoleLogger = new ConsoleLogger(LogLevel.WARN);
- consoleLogger.error('error called %s', 'param1');
- assert.deepStrictEqual(errorCalledArgs, ['error called %s', 'param1']);
- consoleLogger.warn('warn called %s', 'param1');
- assert.deepStrictEqual(warnCalledArgs, ['warn called %s', 'param1']);
- consoleLogger.info('info called %s', 'param1');
- assert.strictEqual(infoCalledArgs, null);
- consoleLogger.debug('debug called %s', 'param1');
- assert.strictEqual(debugCalledArgs, null);
- });
-
- it('should log with error', () => {
- const consoleLogger = new ConsoleLogger(LogLevel.ERROR);
- consoleLogger.error('error called %s', 'param1');
- assert.deepStrictEqual(errorCalledArgs, ['error called %s', 'param1']);
- consoleLogger.warn('warn called %s', 'param1');
- assert.strictEqual(warnCalledArgs, null);
- consoleLogger.info('info called %s', 'param1');
- assert.strictEqual(infoCalledArgs, null);
- consoleLogger.debug('debug called %s', 'param1');
- assert.strictEqual(debugCalledArgs, null);
- });
- });
-});
diff --git a/packages/opentelemetry-core/test/common/time.test.ts b/packages/opentelemetry-core/test/common/time.test.ts
deleted file mode 100644
index 54bfa6e09e..0000000000
--- a/packages/opentelemetry-core/test/common/time.test.ts
+++ /dev/null
@@ -1,217 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import { otperformance as performance } from '../../src/platform';
-import * as sinon from 'sinon';
-import * as types from '@opentelemetry/api';
-import {
- hrTime,
- timeInputToHrTime,
- hrTimeDuration,
- hrTimeToNanoseconds,
- hrTimeToMilliseconds,
- hrTimeToMicroseconds,
- hrTimeToTimeStamp,
- isTimeInput,
-} from '../../src/common/time';
-
-describe('time', () => {
- let sandbox: sinon.SinonSandbox;
-
- beforeEach(() => {
- sandbox = sinon.createSandbox();
- });
-
- afterEach(() => {
- sandbox.restore();
- });
-
- describe('#hrTime', () => {
- it('should return hrtime now', () => {
- sandbox.stub(performance, 'timeOrigin').value(11.5);
- sandbox.stub(performance, 'now').callsFake(() => 11.3);
-
- const output = hrTime();
- assert.deepStrictEqual(output, [0, 22800000]);
- });
-
- it('should convert performance now', () => {
- sandbox.stub(performance, 'timeOrigin').value(11.5);
- const performanceNow = 11.3;
-
- const output = hrTime(performanceNow);
- assert.deepStrictEqual(output, [0, 22800000]);
- });
-
- it('should handle nanosecond overflow', () => {
- sandbox.stub(performance, 'timeOrigin').value(11.5);
- const performanceNow = 11.6;
-
- const output = hrTime(performanceNow);
- assert.deepStrictEqual(output, [0, 23100000]);
- });
-
- it('should allow passed "performanceNow" equal to 0', () => {
- sandbox.stub(performance, 'timeOrigin').value(11.5);
- sandbox.stub(performance, 'now').callsFake(() => 11.3);
-
- const output = hrTime(0);
- assert.deepStrictEqual(output, [0, 11500000]);
- });
-
- it('should use performance.now() when "performanceNow" is equal to undefined', () => {
- sandbox.stub(performance, 'timeOrigin').value(11.5);
- sandbox.stub(performance, 'now').callsFake(() => 11.3);
-
- const output = hrTime(undefined);
- assert.deepStrictEqual(output, [0, 22800000]);
- });
-
- it('should use performance.now() when "performanceNow" is equal to null', () => {
- sandbox.stub(performance, 'timeOrigin').value(11.5);
- sandbox.stub(performance, 'now').callsFake(() => 11.3);
-
- const output = hrTime(null as any);
- assert.deepStrictEqual(output, [0, 22800000]);
- });
-
- describe('when timeOrigin is not available', () => {
- it('should use the performance.timing.fetchStart as a fallback', () => {
- Object.defineProperty(performance, 'timing', {
- writable: true,
- value: {
- fetchStart: 11.5,
- },
- });
-
- sandbox.stub(performance, 'timeOrigin').value(undefined);
- sandbox.stub(performance, 'now').callsFake(() => 11.3);
-
- const output = hrTime();
- assert.deepStrictEqual(output, [0, 22800000]);
- });
- });
- });
-
- describe('#timeInputToHrTime', () => {
- it('should convert Date hrTime', () => {
- const timeInput = new Date();
- const output = timeInputToHrTime(timeInput);
- assert.deepStrictEqual(output, [timeInput.getTime(), 0]);
- });
-
- it('should convert epoch milliseconds hrTime', () => {
- const timeInput = Date.now();
- const output = timeInputToHrTime(timeInput);
- assert.deepStrictEqual(output[0], Math.trunc(timeInput / 1000));
- });
-
- it('should convert performance.now() hrTime', () => {
- sandbox.stub(performance, 'timeOrigin').value(111.5);
-
- const timeInput = 11.9;
- const output = timeInputToHrTime(timeInput);
-
- assert.deepStrictEqual(output, [0, 123400000]);
- });
-
- it('should not convert hrtime hrTime', () => {
- sandbox.stub(performance, 'timeOrigin').value(111.5);
-
- const timeInput: [number, number] = [3138971, 245466222];
- const output = timeInputToHrTime(timeInput);
-
- assert.deepStrictEqual(timeInput, output);
- });
- });
-
- describe('#hrTimeDuration', () => {
- it('should return duration', () => {
- const startTime: types.HrTime = [22, 400000000];
- const endTime: types.HrTime = [32, 800000000];
-
- const output = hrTimeDuration(startTime, endTime);
- assert.deepStrictEqual(output, [10, 400000000]);
- });
-
- it('should handle nanosecond overflow', () => {
- const startTime: types.HrTime = [22, 400000000];
- const endTime: types.HrTime = [32, 200000000];
-
- const output = hrTimeDuration(startTime, endTime);
- assert.deepStrictEqual(output, [9, 800000000]);
- });
- });
-
- describe('#hrTimeToTimeStamp', () => {
- it('should return timestamp', () => {
- const time: types.HrTime = [1573513121, 123456];
-
- const output = hrTimeToTimeStamp(time);
- assert.deepStrictEqual(output, '2019-11-11T22:58:41.000123456Z');
- });
- });
-
- describe('#hrTimeToNanoseconds', () => {
- it('should return nanoseconds', () => {
- const output = hrTimeToNanoseconds([1, 200000000]);
- assert.deepStrictEqual(output, 1200000000);
- });
- });
-
- describe('#hrTimeToMilliseconds', () => {
- it('should return milliseconds', () => {
- const output = hrTimeToMilliseconds([1, 200000000]);
- assert.deepStrictEqual(output, 1200);
- });
- });
-
- describe('#hrTimeToMicroeconds', () => {
- it('should return microseconds', () => {
- const output = hrTimeToMicroseconds([1, 200000000]);
- assert.deepStrictEqual(output, 1200000);
- });
- });
- describe('#isTimeInput', () => {
- it('should return true for a number', () => {
- assert.strictEqual(isTimeInput(12), true);
- });
- it('should return true for a date', () => {
- assert.strictEqual(isTimeInput(new Date()), true);
- });
- it('should return true for an array with 2 elements type number', () => {
- assert.strictEqual(isTimeInput([1, 1]), true);
- });
- it('should return FALSE for different cases for an array ', () => {
- assert.strictEqual(isTimeInput([1, 1, 1]), false);
- assert.strictEqual(isTimeInput([1]), false);
- assert.strictEqual(isTimeInput([1, 'a']), false);
- });
- it('should return FALSE for a string', () => {
- assert.strictEqual(isTimeInput('a'), false);
- });
- it('should return FALSE for an object', () => {
- assert.strictEqual(isTimeInput({}), false);
- });
- it('should return FALSE for a null', () => {
- assert.strictEqual(isTimeInput(null), false);
- });
- it('should return FALSE for undefined', () => {
- assert.strictEqual(isTimeInput(undefined), false);
- });
- });
-});
diff --git a/packages/opentelemetry-core/test/context/B3Propagator.test.ts b/packages/opentelemetry-core/test/context/B3Propagator.test.ts
deleted file mode 100644
index 1eb6759c16..0000000000
--- a/packages/opentelemetry-core/test/context/B3Propagator.test.ts
+++ /dev/null
@@ -1,293 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- defaultGetter,
- defaultSetter,
- SpanContext,
- TraceFlags,
-} from '@opentelemetry/api';
-import { Context } from '@opentelemetry/context-base';
-import * as assert from 'assert';
-import {
- getExtractedSpanContext,
- setExtractedSpanContext,
-} from '../../src/context/context';
-import {
- B3Propagator,
- X_B3_SAMPLED,
- X_B3_SPAN_ID,
- X_B3_TRACE_ID,
-} from '../../src/context/propagation/B3Propagator';
-import { TraceState } from '../../src/trace/TraceState';
-
-describe('B3Propagator', () => {
- const b3Propagator = new B3Propagator();
- let carrier: { [key: string]: unknown };
-
- beforeEach(() => {
- carrier = {};
- });
-
- describe('.inject()', () => {
- it('should set b3 traceId and spanId headers', () => {
- const spanContext: SpanContext = {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.SAMPLED,
- };
-
- b3Propagator.inject(
- setExtractedSpanContext(Context.ROOT_CONTEXT, spanContext),
- carrier,
- defaultSetter
- );
- assert.deepStrictEqual(
- carrier[X_B3_TRACE_ID],
- 'd4cda95b652f4a1592b449d5929fda1b'
- );
- assert.deepStrictEqual(carrier[X_B3_SPAN_ID], '6e0c63257de34c92');
- assert.deepStrictEqual(carrier[X_B3_SAMPLED], TraceFlags.SAMPLED);
- });
-
- it('should set b3 traceId and spanId headers - ignore tracestate', () => {
- const spanContext: SpanContext = {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.NONE,
- traceState: new TraceState('foo=bar,baz=qux'),
- isRemote: false,
- };
-
- b3Propagator.inject(
- setExtractedSpanContext(Context.ROOT_CONTEXT, spanContext),
- carrier,
- defaultSetter
- );
- assert.deepStrictEqual(
- carrier[X_B3_TRACE_ID],
- 'd4cda95b652f4a1592b449d5929fda1b'
- );
- assert.deepStrictEqual(carrier[X_B3_SPAN_ID], '6e0c63257de34c92');
- assert.deepStrictEqual(carrier[X_B3_SAMPLED], TraceFlags.NONE);
- });
-
- it('should not inject empty spancontext', () => {
- const emptySpanContext = {
- traceId: '',
- spanId: '',
- traceFlags: TraceFlags.NONE,
- };
- b3Propagator.inject(
- setExtractedSpanContext(Context.ROOT_CONTEXT, emptySpanContext),
- carrier,
- defaultSetter
- );
- assert.deepStrictEqual(carrier[X_B3_TRACE_ID], undefined);
- assert.deepStrictEqual(carrier[X_B3_SPAN_ID], undefined);
- });
- });
-
- describe('.extract()', () => {
- it('should extract context of a unsampled span from carrier', () => {
- carrier[X_B3_TRACE_ID] = '0af7651916cd43dd8448eb211c80319c';
- carrier[X_B3_SPAN_ID] = 'b7ad6b7169203331';
- const extractedSpanContext = getExtractedSpanContext(
- b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- );
-
- assert.deepStrictEqual(extractedSpanContext, {
- spanId: 'b7ad6b7169203331',
- traceId: '0af7651916cd43dd8448eb211c80319c',
- isRemote: true,
- traceFlags: TraceFlags.NONE,
- });
- });
-
- it('should extract context of a sampled span from carrier', () => {
- carrier[X_B3_TRACE_ID] = '0af7651916cd43dd8448eb211c80319c';
- carrier[X_B3_SPAN_ID] = 'b7ad6b7169203331';
- carrier[X_B3_SAMPLED] = '1';
- const extractedSpanContext = getExtractedSpanContext(
- b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- );
-
- assert.deepStrictEqual(extractedSpanContext, {
- spanId: 'b7ad6b7169203331',
- traceId: '0af7651916cd43dd8448eb211c80319c',
- isRemote: true,
- traceFlags: TraceFlags.SAMPLED,
- });
- });
-
- it('should extract context of a sampled span from carrier when sampled is mentioned as boolean true flag', () => {
- carrier[X_B3_TRACE_ID] = '0af7651916cd43dd8448eb211c80319c';
- carrier[X_B3_SPAN_ID] = 'b7ad6b7169203331';
- carrier[X_B3_SAMPLED] = true;
- const extractedSpanContext = getExtractedSpanContext(
- b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- );
-
- assert.deepStrictEqual(extractedSpanContext, {
- spanId: 'b7ad6b7169203331',
- traceId: '0af7651916cd43dd8448eb211c80319c',
- isRemote: true,
- traceFlags: TraceFlags.SAMPLED,
- });
- });
-
- it('should extract context of a sampled span from carrier when sampled is mentioned as boolean false flag', () => {
- carrier[X_B3_TRACE_ID] = '0af7651916cd43dd8448eb211c80319c';
- carrier[X_B3_SPAN_ID] = 'b7ad6b7169203331';
- carrier[X_B3_SAMPLED] = false;
- const extractedSpanContext = getExtractedSpanContext(
- b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- );
-
- assert.deepStrictEqual(extractedSpanContext, {
- spanId: 'b7ad6b7169203331',
- traceId: '0af7651916cd43dd8448eb211c80319c',
- isRemote: true,
- traceFlags: TraceFlags.NONE,
- });
- });
-
- it('should return undefined when traceId is undefined', () => {
- carrier[X_B3_TRACE_ID] = undefined;
- carrier[X_B3_SPAN_ID] = undefined;
- assert.deepStrictEqual(
- getExtractedSpanContext(
- b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- ),
- undefined
- );
- });
-
- it('should return undefined when options and spanId are undefined', () => {
- carrier[X_B3_TRACE_ID] = '0af7651916cd43dd8448eb211c80319c';
- carrier[X_B3_SPAN_ID] = undefined;
- assert.deepStrictEqual(
- getExtractedSpanContext(
- b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- ),
- undefined
- );
- });
-
- it('returns undefined if b3 header is missing', () => {
- assert.deepStrictEqual(
- getExtractedSpanContext(
- b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- ),
- undefined
- );
- });
-
- it('returns undefined if b3 header is invalid', () => {
- carrier[X_B3_TRACE_ID] = 'invalid!';
- assert.deepStrictEqual(
- getExtractedSpanContext(
- b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- ),
- undefined
- );
- });
-
- it('extracts b3 from list of header', () => {
- carrier[X_B3_TRACE_ID] = ['0af7651916cd43dd8448eb211c80319c'];
- carrier[X_B3_SPAN_ID] = 'b7ad6b7169203331';
- carrier[X_B3_SAMPLED] = '01';
- const extractedSpanContext = getExtractedSpanContext(
- b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- );
- assert.deepStrictEqual(extractedSpanContext, {
- spanId: 'b7ad6b7169203331',
- traceId: '0af7651916cd43dd8448eb211c80319c',
- isRemote: true,
- traceFlags: TraceFlags.SAMPLED,
- });
- });
-
- it('should gracefully handle an invalid b3 header', () => {
- // A set of test cases with different invalid combinations of a
- // b3 header. These should all result in a `undefined` SpanContext
- // value being extracted.
-
- const testCases: Record = {
- invalidParts_tooShort: '00-ffffffffffffffffffffffffffffffff',
- invalidParts_tooLong:
- '00-ffffffffffffffffffffffffffffffff-ffffffffffffffff-00-01',
-
- invalidVersion_notHex:
- '0x-ffffffffffffffffffffffffffffffff-ffffffffffffffff-00',
- invalidVersion_tooShort:
- '0-ffffffffffffffffffffffffffffffff-ffffffffffffffff-00',
- invalidVersion_tooLong:
- '000-ffffffffffffffffffffffffffffffff-ffffffffffffffff-00',
-
- invalidTraceId_empty: '00--ffffffffffffffff-01',
- invalidTraceId_notHex:
- '00-fffffffffffffffffffffffffffffffx-ffffffffffffffff-01',
- invalidTraceId_allZeros:
- '00-00000000000000000000000000000000-ffffffffffffffff-01',
- invalidTraceId_tooShort: '00-ffffffff-ffffffffffffffff-01',
- invalidTraceId_tooLong:
- '00-ffffffffffffffffffffffffffffffff00-ffffffffffffffff-01',
-
- invalidSpanId_empty: '00-ffffffffffffffffffffffffffffffff--01',
- invalidSpanId_notHex:
- '00-ffffffffffffffffffffffffffffffff-fffffffffffffffx-01',
- invalidSpanId_allZeros:
- '00-ffffffffffffffffffffffffffffffff-0000000000000000-01',
- invalidSpanId_tooShort:
- '00-ffffffffffffffffffffffffffffffff-ffffffff-01',
- invalidSpanId_tooLong:
- '00-ffffffffffffffffffffffffffffffff-ffffffffffffffff0000-01',
- };
-
- Object.getOwnPropertyNames(testCases).forEach(testCase => {
- carrier[X_B3_TRACE_ID] = testCases[testCase];
-
- const extractedSpanContext = getExtractedSpanContext(
- b3Propagator.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- );
- assert.deepStrictEqual(extractedSpanContext, undefined, testCase);
- });
- });
-
- it('should fail gracefully on bad responses from getter', () => {
- const ctx1 = b3Propagator.extract(
- Context.ROOT_CONTEXT,
- carrier,
- (c, k) => 1 // not a number
- );
- const ctx2 = b3Propagator.extract(
- Context.ROOT_CONTEXT,
- carrier,
- (c, k) => [] // empty array
- );
- const ctx3 = b3Propagator.extract(
- Context.ROOT_CONTEXT,
- carrier,
- (c, k) => undefined // missing value
- );
-
- assert.ok(ctx1 === Context.ROOT_CONTEXT);
- assert.ok(ctx2 === Context.ROOT_CONTEXT);
- assert.ok(ctx3 === Context.ROOT_CONTEXT);
- });
- });
-});
diff --git a/packages/opentelemetry-core/test/context/HttpTraceContext.test.ts b/packages/opentelemetry-core/test/context/HttpTraceContext.test.ts
deleted file mode 100644
index c82e50b636..0000000000
--- a/packages/opentelemetry-core/test/context/HttpTraceContext.test.ts
+++ /dev/null
@@ -1,238 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- defaultGetter,
- defaultSetter,
- SpanContext,
- TraceFlags,
-} from '@opentelemetry/api';
-import { Context } from '@opentelemetry/context-base';
-import * as assert from 'assert';
-import {
- getExtractedSpanContext,
- setExtractedSpanContext,
-} from '../../src/context/context';
-import {
- HttpTraceContext,
- TRACE_PARENT_HEADER,
- TRACE_STATE_HEADER,
-} from '../../src/context/propagation/HttpTraceContext';
-import { TraceState } from '../../src/trace/TraceState';
-
-describe('HttpTraceContext', () => {
- const httpTraceContext = new HttpTraceContext();
- let carrier: { [key: string]: unknown };
-
- beforeEach(() => {
- carrier = {};
- });
-
- describe('.inject()', () => {
- it('should set traceparent header', () => {
- const spanContext: SpanContext = {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.SAMPLED,
- };
-
- httpTraceContext.inject(
- setExtractedSpanContext(Context.ROOT_CONTEXT, spanContext),
- carrier,
- defaultSetter
- );
- assert.deepStrictEqual(
- carrier[TRACE_PARENT_HEADER],
- '00-d4cda95b652f4a1592b449d5929fda1b-6e0c63257de34c92-01'
- );
- assert.deepStrictEqual(carrier[TRACE_STATE_HEADER], undefined);
- });
-
- it('should set traceparent and tracestate header', () => {
- const spanContext: SpanContext = {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.SAMPLED,
- traceState: new TraceState('foo=bar,baz=qux'),
- };
-
- httpTraceContext.inject(
- setExtractedSpanContext(Context.ROOT_CONTEXT, spanContext),
- carrier,
- defaultSetter
- );
- assert.deepStrictEqual(
- carrier[TRACE_PARENT_HEADER],
- '00-d4cda95b652f4a1592b449d5929fda1b-6e0c63257de34c92-01'
- );
- assert.deepStrictEqual(carrier[TRACE_STATE_HEADER], 'foo=bar,baz=qux');
- });
- });
-
- describe('.extract()', () => {
- it('should extract context of a sampled span from carrier', () => {
- carrier[TRACE_PARENT_HEADER] =
- '00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01';
- const extractedSpanContext = getExtractedSpanContext(
- httpTraceContext.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- );
-
- assert.deepStrictEqual(extractedSpanContext, {
- spanId: 'b7ad6b7169203331',
- traceId: '0af7651916cd43dd8448eb211c80319c',
- isRemote: true,
- traceFlags: TraceFlags.SAMPLED,
- });
- });
-
- it('returns null if traceparent header is missing', () => {
- assert.deepStrictEqual(
- getExtractedSpanContext(
- httpTraceContext.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- ),
- undefined
- );
- });
-
- it('returns null if traceparent header is invalid', () => {
- carrier[TRACE_PARENT_HEADER] = 'invalid!';
- assert.deepStrictEqual(
- getExtractedSpanContext(
- httpTraceContext.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- ),
- undefined
- );
- });
-
- it('extracts traceparent from list of header', () => {
- carrier[TRACE_PARENT_HEADER] = [
- '00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01',
- ];
- const extractedSpanContext = getExtractedSpanContext(
- httpTraceContext.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- );
- assert.deepStrictEqual(extractedSpanContext, {
- spanId: 'b7ad6b7169203331',
- traceId: '0af7651916cd43dd8448eb211c80319c',
- isRemote: true,
- traceFlags: TraceFlags.SAMPLED,
- });
- });
-
- it('extracts tracestate from header', () => {
- carrier[TRACE_PARENT_HEADER] =
- '00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01';
- carrier[TRACE_STATE_HEADER] = 'foo=bar,baz=qux';
- const extractedSpanContext = getExtractedSpanContext(
- httpTraceContext.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- );
-
- assert.deepStrictEqual(
- extractedSpanContext!.traceState!.get('foo'),
- 'bar'
- );
- assert.deepStrictEqual(
- extractedSpanContext!.traceState!.get('baz'),
- 'qux'
- );
- });
-
- it('combines multiple tracestate carrier', () => {
- carrier[TRACE_PARENT_HEADER] =
- '00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01';
- carrier[TRACE_STATE_HEADER] = ['foo=bar,baz=qux', 'quux=quuz'];
- const extractedSpanContext = getExtractedSpanContext(
- httpTraceContext.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- );
- assert.deepStrictEqual(extractedSpanContext, {
- spanId: 'b7ad6b7169203331',
- traceId: '0af7651916cd43dd8448eb211c80319c',
- isRemote: true,
- traceFlags: TraceFlags.SAMPLED,
- traceState: new TraceState('foo=bar,baz=qux,quux=quuz'),
- });
- });
-
- it('should gracefully handle an invalid traceparent header', () => {
- // A set of test cases with different invalid combinations of a
- // traceparent header. These should all result in a `null` SpanContext
- // value being extracted.
-
- const testCases: Record = {
- invalidParts_tooShort: '00-ffffffffffffffffffffffffffffffff',
- invalidParts_tooLong:
- '00-ffffffffffffffffffffffffffffffff-ffffffffffffffff-00-01',
-
- invalidVersion_notHex:
- '0x-ffffffffffffffffffffffffffffffff-ffffffffffffffff-00',
- invalidVersion_tooShort:
- '0-ffffffffffffffffffffffffffffffff-ffffffffffffffff-00',
- invalidVersion_tooLong:
- '000-ffffffffffffffffffffffffffffffff-ffffffffffffffff-00',
-
- invalidTraceId_empty: '00--ffffffffffffffff-01',
- invalidTraceId_notHex:
- '00-fffffffffffffffffffffffffffffffx-ffffffffffffffff-01',
- invalidTraceId_allZeros:
- '00-00000000000000000000000000000000-ffffffffffffffff-01',
- invalidTraceId_tooShort: '00-ffffffff-ffffffffffffffff-01',
- invalidTraceId_tooLong:
- '00-ffffffffffffffffffffffffffffffff00-ffffffffffffffff-01',
-
- invalidSpanId_empty: '00-ffffffffffffffffffffffffffffffff--01',
- invalidSpanId_notHex:
- '00-ffffffffffffffffffffffffffffffff-fffffffffffffffx-01',
- invalidSpanId_allZeros:
- '00-ffffffffffffffffffffffffffffffff-0000000000000000-01',
- invalidSpanId_tooShort:
- '00-ffffffffffffffffffffffffffffffff-ffffffff-01',
- invalidSpanId_tooLong:
- '00-ffffffffffffffffffffffffffffffff-ffffffffffffffff0000-01',
- };
-
- Object.getOwnPropertyNames(testCases).forEach(testCase => {
- carrier[TRACE_PARENT_HEADER] = testCases[testCase];
-
- const extractedSpanContext = getExtractedSpanContext(
- httpTraceContext.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- );
- assert.deepStrictEqual(extractedSpanContext, undefined, testCase);
- });
- });
-
- it('should fail gracefully on bad responses from getter', () => {
- const ctx1 = httpTraceContext.extract(
- Context.ROOT_CONTEXT,
- carrier,
- (c, k) => 1 // not a number
- );
- const ctx2 = httpTraceContext.extract(
- Context.ROOT_CONTEXT,
- carrier,
- (c, k) => [] // empty array
- );
- const ctx3 = httpTraceContext.extract(
- Context.ROOT_CONTEXT,
- carrier,
- (c, k) => undefined // missing value
- );
-
- assert.ok(ctx1 === Context.ROOT_CONTEXT);
- assert.ok(ctx2 === Context.ROOT_CONTEXT);
- assert.ok(ctx3 === Context.ROOT_CONTEXT);
- });
- });
-});
diff --git a/packages/opentelemetry-core/test/context/composite.test.ts b/packages/opentelemetry-core/test/context/composite.test.ts
deleted file mode 100644
index 10a21af1f3..0000000000
--- a/packages/opentelemetry-core/test/context/composite.test.ts
+++ /dev/null
@@ -1,165 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- defaultGetter,
- defaultSetter,
- HttpTextPropagator,
- SpanContext,
-} from '@opentelemetry/api';
-import { Context } from '@opentelemetry/context-base';
-import * as assert from 'assert';
-import {
- CompositePropagator,
- HttpTraceContext,
- randomSpanId,
- randomTraceId,
-} from '../../src';
-import {
- getExtractedSpanContext,
- setExtractedSpanContext,
-} from '../../src/context/context';
-import {
- B3Propagator,
- X_B3_SAMPLED,
- X_B3_SPAN_ID,
- X_B3_TRACE_ID,
-} from '../../src/context/propagation/B3Propagator';
-import {
- TRACE_PARENT_HEADER,
- TRACE_STATE_HEADER,
-} from '../../src/context/propagation/HttpTraceContext';
-import { TraceState } from '../../src/trace/TraceState';
-
-describe('Composite Propagator', () => {
- let traceId: string;
- let spanId: string;
-
- beforeEach(() => {
- traceId = randomTraceId();
- spanId = randomSpanId();
- });
-
- describe('inject', () => {
- let carrier: { [key: string]: unknown };
- let spanContext: SpanContext;
- let ctxWithSpanContext: Context;
-
- beforeEach(() => {
- carrier = {};
- spanContext = {
- spanId,
- traceId,
- traceFlags: 1,
- traceState: new TraceState('foo=bar'),
- };
- ctxWithSpanContext = setExtractedSpanContext(
- Context.ROOT_CONTEXT,
- spanContext
- );
- });
-
- it('should inject context using all configured propagators', () => {
- const composite = new CompositePropagator({
- propagators: [new B3Propagator(), new HttpTraceContext()],
- });
- composite.inject(ctxWithSpanContext, carrier, defaultSetter);
-
- assert.strictEqual(carrier[X_B3_TRACE_ID], traceId);
- assert.strictEqual(carrier[X_B3_SPAN_ID], spanId);
- assert.strictEqual(carrier[X_B3_SAMPLED], 1);
- assert.strictEqual(
- carrier[TRACE_PARENT_HEADER],
- `00-${traceId}-${spanId}-01`
- );
- assert.strictEqual(carrier[TRACE_STATE_HEADER], 'foo=bar');
- });
-
- it('should not throw', () => {
- const composite = new CompositePropagator({
- propagators: [new ThrowingPropagator(), new HttpTraceContext()],
- });
- composite.inject(ctxWithSpanContext, carrier, defaultSetter);
-
- assert.strictEqual(
- carrier[TRACE_PARENT_HEADER],
- `00-${traceId}-${spanId}-01`
- );
- });
- });
-
- describe('extract', () => {
- let carrier: { [key: string]: unknown };
-
- beforeEach(() => {
- carrier = {
- [X_B3_TRACE_ID]: traceId,
- [X_B3_SPAN_ID]: spanId,
- [X_B3_SAMPLED]: 1,
- [TRACE_PARENT_HEADER]: `00-${traceId}-${spanId}-01`,
- [TRACE_STATE_HEADER]: 'foo=bar',
- };
- });
-
- it('should extract context using all configured propagators', () => {
- const composite = new CompositePropagator({
- propagators: [new B3Propagator(), new HttpTraceContext()],
- });
- const spanContext = getExtractedSpanContext(
- composite.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- );
-
- if (!spanContext) {
- throw new Error('no extracted context');
- }
-
- assert.strictEqual(spanContext.traceId, traceId);
- assert.strictEqual(spanContext.spanId, spanId);
- assert.strictEqual(spanContext.traceFlags, 1);
- assert.strictEqual(spanContext.isRemote, true);
- assert.strictEqual(spanContext.traceState!.get('foo'), 'bar');
- });
-
- it('should not throw', () => {
- const composite = new CompositePropagator({
- propagators: [new ThrowingPropagator(), new HttpTraceContext()],
- });
- const spanContext = getExtractedSpanContext(
- composite.extract(Context.ROOT_CONTEXT, carrier, defaultGetter)
- );
-
- if (!spanContext) {
- throw new Error('no extracted context');
- }
-
- assert.strictEqual(spanContext.traceId, traceId);
- assert.strictEqual(spanContext.spanId, spanId);
- assert.strictEqual(spanContext.traceFlags, 1);
- assert.strictEqual(spanContext.isRemote, true);
- assert.strictEqual(spanContext.traceState!.get('foo'), 'bar');
- });
- });
-});
-
-class ThrowingPropagator implements HttpTextPropagator {
- inject(context: Context, carrier: unknown) {
- throw new Error('this propagator throws');
- }
-
- extract(context: Context, carrier: unknown): Context {
- throw new Error('This propagator throws');
- }
-}
diff --git a/packages/opentelemetry-core/test/internal/validators.test.ts b/packages/opentelemetry-core/test/internal/validators.test.ts
deleted file mode 100644
index 9324842624..0000000000
--- a/packages/opentelemetry-core/test/internal/validators.test.ts
+++ /dev/null
@@ -1,92 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import { validateKey, validateValue } from '../../src/internal/validators';
-
-describe('validators', () => {
- describe('validateKey', () => {
- const validKeysTestCases = [
- 'abcdefghijklmnopqrstuvwxyz0123456789-_*/',
- 'baz-',
- 'baz_',
- 'baz*',
- 'baz*bar',
- 'baz/',
- 'tracestate',
- 'fw529a3039@dt',
- '6cab5bb-29a@dt',
- ];
- validKeysTestCases.forEach(testCase =>
- it(`returns true when key contains valid chars ${testCase}`, () => {
- assert.ok(validateKey(testCase), `${testCase} should be valid`);
- })
- );
-
- const invalidKeysTestCases = [
- '1_key',
- 'kEy_1',
- 'k'.repeat(257),
- 'key,',
- 'TrAcEsTaTE',
- 'TRACESTATE',
- '',
- '6num',
- ];
- invalidKeysTestCases.forEach(testCase =>
- it(`returns true when key contains invalid chars ${testCase}`, () => {
- assert.ok(!validateKey(testCase), `${testCase} should be invalid`);
- })
- );
- });
-
- describe('validateValue', () => {
- const validValuesTestCases = [
- 'first second',
- 'baz*',
- 'baz$',
- 'baz@',
- 'first-second',
- 'baz~bar',
- 'test-v1:120',
- '-second',
- 'first.second',
- 'TrAcEsTaTE',
- 'TRACESTATE',
- ];
- validValuesTestCases.forEach(testCase =>
- it(`returns true when value contains valid chars ${testCase}`, () => {
- assert.ok(validateValue(testCase));
- })
- );
-
- const invalidValuesTestCases = [
- 'my_value=5',
- 'first,second',
- 'first ',
- 'k'.repeat(257),
- ',baz',
- 'baz,',
- 'baz=',
- '',
- ];
- invalidValuesTestCases.forEach(testCase =>
- it(`returns true when value contains invalid chars ${testCase}`, () => {
- assert.ok(!validateValue(testCase));
- })
- );
- });
-});
diff --git a/packages/opentelemetry-core/test/platform/hex-to-base64.test.ts b/packages/opentelemetry-core/test/platform/hex-to-base64.test.ts
deleted file mode 100644
index 1165ef7b95..0000000000
--- a/packages/opentelemetry-core/test/platform/hex-to-base64.test.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import { hexToBase64 } from '../../src/platform';
-
-describe('hexToBase64', () => {
- it('convert hex to base64', () => {
- const id1 = '7deb739e02e44ef2';
- const id2 = '46cef837b919a16ff26e608c8cf42c80';
- assert.strictEqual(hexToBase64(id1), 'fetzngLkTvI=');
- assert.strictEqual(hexToBase64(id2), 'Rs74N7kZoW/ybmCMjPQsgA==');
- });
-});
diff --git a/packages/opentelemetry-core/test/platform/id.test.ts b/packages/opentelemetry-core/test/platform/id.test.ts
deleted file mode 100644
index 8c4b7d0dc4..0000000000
--- a/packages/opentelemetry-core/test/platform/id.test.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import { randomSpanId, randomTraceId } from '../../src/platform';
-
-describe('randomTraceId', () => {
- it('returns 32 character hex strings', () => {
- const traceId = randomTraceId();
- assert.ok(traceId.match(/[a-f0-9]{32}/));
- assert.ok(!traceId.match(/^0+$/));
- });
-
- it('returns different ids on each call', () => {
- const traceId1 = randomTraceId();
- const traceId2 = randomTraceId();
-
- assert.notDeepStrictEqual(traceId1, traceId2);
- });
-});
-
-describe('randomSpanId', () => {
- it('returns 16 character hex strings', () => {
- const spanId = randomSpanId();
- assert.ok(spanId.match(/[a-f0-9]{16}/));
- assert.ok(!spanId.match(/^0+$/));
- });
-
- it('returns different ids on each call', () => {
- const spanId1 = randomSpanId();
- const spanId2 = randomSpanId();
-
- assert.notDeepStrictEqual(spanId1, spanId2);
- });
-});
diff --git a/packages/opentelemetry-core/test/trace/BasePlugin.test.ts b/packages/opentelemetry-core/test/trace/BasePlugin.test.ts
deleted file mode 100644
index 643b7562dd..0000000000
--- a/packages/opentelemetry-core/test/trace/BasePlugin.test.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { NoopTracerProvider } from '@opentelemetry/api';
-import * as assert from 'assert';
-import * as path from 'path';
-import { BasePlugin, NoopLogger } from '../../src';
-import * as types from './fixtures/test-package/foo/bar/internal';
-
-const provider = new NoopTracerProvider();
-const logger = new NoopLogger();
-
-describe('BasePlugin', () => {
- describe('internalFilesLoader', () => {
- it('should load internally exported files', () => {
- const testPackage = require('./fixtures/test-package');
- const plugin = new TestPlugin();
- assert.doesNotThrow(() => {
- plugin.enable(testPackage, provider, logger);
- });
-
- // @TODO: https://github.com/open-telemetry/opentelemetry-js/issues/285
- if (typeof process !== 'undefined' && process.release.name === 'node') {
- assert.ok(plugin['_internalFilesExports']);
- assert.strictEqual(
- (plugin['_internalFilesExports']
- .internal as typeof types).internallyExportedFunction(),
- true
- );
- assert.strictEqual(
- plugin['_internalFilesExports'].expectUndefined,
- undefined
- );
- assert.strictEqual(
- (plugin['_moduleExports']![
- 'externallyExportedFunction'
- ] as Function)(),
- true
- );
- } else {
- assert.ok(true, 'Internal file loading is not tested in the browser');
- }
- });
- });
-});
-
-class TestPlugin extends BasePlugin<{ [key: string]: Function }> {
- readonly moduleName = 'test-package';
- readonly version = '0.1.0';
- readonly _basedir = basedir;
-
- constructor() {
- super('test-package.opentelemetry');
- }
-
- protected readonly _internalFilesList = {
- '0.1.0': {
- internal: 'foo/bar/internal.js',
- },
- '^1.0.0': {
- expectUndefined: 'foo/bar/internal.js',
- },
- };
-
- protected patch(): { [key: string]: Function } {
- return this._moduleExports;
- }
- protected unpatch(): void {}
-}
-
-const basedir = path.dirname(require.resolve('./fixtures/test-package'));
diff --git a/packages/opentelemetry-core/test/trace/NoRecordingSpan.test.ts b/packages/opentelemetry-core/test/trace/NoRecordingSpan.test.ts
deleted file mode 100644
index b5855280ed..0000000000
--- a/packages/opentelemetry-core/test/trace/NoRecordingSpan.test.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import { NoRecordingSpan } from '../../src/trace/NoRecordingSpan';
-import { TraceFlags } from '@opentelemetry/api';
-
-describe('NoRecordingSpan', () => {
- it('propagates span contexts', () => {
- const spanContext = {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.NONE,
- };
-
- const span = new NoRecordingSpan(spanContext);
- assert.strictEqual(span.context(), spanContext);
- span.end();
- });
-});
diff --git a/packages/opentelemetry-core/test/trace/ProbabilitySampler.test.ts b/packages/opentelemetry-core/test/trace/ProbabilitySampler.test.ts
deleted file mode 100644
index b0426899a2..0000000000
--- a/packages/opentelemetry-core/test/trace/ProbabilitySampler.test.ts
+++ /dev/null
@@ -1,83 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import {
- ProbabilitySampler,
- ALWAYS_SAMPLER,
- NEVER_SAMPLER,
-} from '../../src/trace/sampler/ProbabilitySampler';
-
-describe('ProbabilitySampler', () => {
- it('should return a always sampler for 1', () => {
- const sampler = new ProbabilitySampler(1);
- assert.strictEqual(sampler.shouldSample(), true);
- });
-
- it('should return a always sampler for >1', () => {
- const sampler = new ProbabilitySampler(100);
- assert.strictEqual(sampler.shouldSample(), true);
- assert.strictEqual(sampler.toString(), 'ProbabilitySampler{1}');
- });
-
- it('should return a never sampler for 0', () => {
- const sampler = new ProbabilitySampler(0);
- assert.strictEqual(sampler.shouldSample(), false);
- });
-
- it('should return a never sampler for <0', () => {
- const sampler = new ProbabilitySampler(-1);
- assert.strictEqual(sampler.shouldSample(), false);
- });
-
- it('should sample according to the probability', () => {
- Math.random = () => 1 / 10;
- const sampler = new ProbabilitySampler(0.2);
- assert.strictEqual(sampler.shouldSample(), true);
- assert.strictEqual(sampler.toString(), 'ProbabilitySampler{0.2}');
-
- Math.random = () => 5 / 10;
- assert.strictEqual(sampler.shouldSample(), false);
- });
-
- it('should return true for ALWAYS_SAMPLER', () => {
- assert.strictEqual(ALWAYS_SAMPLER.shouldSample(), true);
- assert.strictEqual(ALWAYS_SAMPLER.toString(), 'ProbabilitySampler{1}');
- });
-
- it('should return false for NEVER_SAMPLER', () => {
- assert.strictEqual(NEVER_SAMPLER.shouldSample(), false);
- assert.strictEqual(NEVER_SAMPLER.toString(), 'ProbabilitySampler{0}');
- });
-
- it('should handle NaN', () => {
- const sampler = new ProbabilitySampler(NaN);
- assert.strictEqual(sampler.shouldSample(), false);
- assert.strictEqual(sampler.toString(), 'ProbabilitySampler{0}');
- });
-
- it('should handle -NaN', () => {
- const sampler = new ProbabilitySampler(-NaN);
- assert.strictEqual(sampler.shouldSample(), false);
- assert.strictEqual(sampler.toString(), 'ProbabilitySampler{0}');
- });
-
- it('should handle undefined', () => {
- const sampler = new ProbabilitySampler(undefined);
- assert.strictEqual(sampler.shouldSample(), false);
- assert.strictEqual(sampler.toString(), 'ProbabilitySampler{0}');
- });
-});
diff --git a/packages/opentelemetry-core/test/trace/fixtures/test-package/foo/bar/internal.d.ts b/packages/opentelemetry-core/test/trace/fixtures/test-package/foo/bar/internal.d.ts
deleted file mode 100644
index 2a1f45f2a7..0000000000
--- a/packages/opentelemetry-core/test/trace/fixtures/test-package/foo/bar/internal.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export declare function internallyExportedFunction(): boolean;
diff --git a/packages/opentelemetry-core/test/trace/fixtures/test-package/foo/bar/internal.js b/packages/opentelemetry-core/test/trace/fixtures/test-package/foo/bar/internal.js
deleted file mode 100644
index 0f0e71ee74..0000000000
--- a/packages/opentelemetry-core/test/trace/fixtures/test-package/foo/bar/internal.js
+++ /dev/null
@@ -1,4 +0,0 @@
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.internallyExportedFunction = function internallyExportedFunction() {
- return true;
-}
diff --git a/packages/opentelemetry-core/test/trace/fixtures/test-package/index.js b/packages/opentelemetry-core/test/trace/fixtures/test-package/index.js
deleted file mode 100644
index bddb4ea002..0000000000
--- a/packages/opentelemetry-core/test/trace/fixtures/test-package/index.js
+++ /dev/null
@@ -1,4 +0,0 @@
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.externallyExportedFunction = function externallyExportedFunction() {
- return true;
-}
diff --git a/packages/opentelemetry-core/test/trace/fixtures/test-package/package.json b/packages/opentelemetry-core/test/trace/fixtures/test-package/package.json
deleted file mode 100644
index e80faeea41..0000000000
--- a/packages/opentelemetry-core/test/trace/fixtures/test-package/package.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "name": "test-package",
- "version": "0.1.1",
- "description": "",
- "main": "index.js",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "author": "",
- "license": "ISC"
-}
diff --git a/packages/opentelemetry-core/test/trace/spancontext-utils.test.ts b/packages/opentelemetry-core/test/trace/spancontext-utils.test.ts
deleted file mode 100644
index 5ffa807efa..0000000000
--- a/packages/opentelemetry-core/test/trace/spancontext-utils.test.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import * as context from '../../src/trace/spancontext-utils';
-import { TraceFlags } from '@opentelemetry/api';
-
-describe('spancontext-utils', () => {
- it('should return true for valid spancontext', () => {
- const spanContext = {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.NONE,
- };
- assert.ok(context.isValid(spanContext));
- });
-
- it('should return false when traceId is invalid', () => {
- const spanContext = {
- traceId: context.INVALID_TRACEID,
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.NONE,
- };
- assert.ok(!context.isValid(spanContext));
- });
-
- it('should return false when spanId is invalid', () => {
- const spanContext = {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: context.INVALID_SPANID,
- traceFlags: TraceFlags.NONE,
- };
- assert.ok(!context.isValid(spanContext));
- });
-
- it('should return false when traceId & spanId is invalid', () => {
- const spanContext = {
- traceId: context.INVALID_TRACEID,
- spanId: context.INVALID_SPANID,
- traceFlags: TraceFlags.NONE,
- };
- assert.ok(!context.isValid(spanContext));
- });
-});
diff --git a/packages/opentelemetry-core/test/trace/tracestate.test.ts b/packages/opentelemetry-core/test/trace/tracestate.test.ts
deleted file mode 100644
index e59e8a0dca..0000000000
--- a/packages/opentelemetry-core/test/trace/tracestate.test.ts
+++ /dev/null
@@ -1,138 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import { TraceState } from '../../src/trace/TraceState';
-
-describe('TraceState', () => {
- describe('.serialize()', () => {
- it('returns serialize string', () => {
- const state = new TraceState('a=1,b=2');
- assert.deepStrictEqual(state.serialize(), 'a=1,b=2');
- });
-
- it('must replace keys and move them to the front', () => {
- const state = new TraceState('a=1,b=2');
- state.set('b', '3');
- assert.deepStrictEqual(state.serialize(), 'b=3,a=1');
- });
-
- it('must add new keys to the front', () => {
- const state = new TraceState();
- state.set('vendorname1', 'opaqueValue1');
- assert.deepStrictEqual(state.serialize(), 'vendorname1=opaqueValue1');
-
- state.set('vendorname2', 'opaqueValue2');
- assert.deepStrictEqual(
- state.serialize(),
- 'vendorname2=opaqueValue2,vendorname1=opaqueValue1'
- );
- });
-
- it('must unset the entries', () => {
- const state = new TraceState('c=4,b=3,a=1');
- state.unset('b');
- assert.deepStrictEqual(state.serialize(), 'c=4,a=1');
- state.unset('c');
- state.unset('A');
- assert.deepStrictEqual(state.serialize(), 'a=1');
- });
- });
-
- describe('.parse()', () => {
- it('must successfully parse valid state value', () => {
- const state = new TraceState(
- 'vendorname2=opaqueValue2,vendorname1=opaqueValue1'
- );
- assert.deepStrictEqual(state.get('vendorname1'), 'opaqueValue1');
- assert.deepStrictEqual(state.get('vendorname2'), 'opaqueValue2');
- assert.deepStrictEqual(
- state.serialize(),
- 'vendorname2=opaqueValue2,vendorname1=opaqueValue1'
- );
- });
-
- it('must drop states when the items are too long', () => {
- const state = new TraceState('a=' + 'b'.repeat(512));
- assert.deepStrictEqual(state.get('a'), undefined);
- assert.deepStrictEqual(state.serialize(), '');
- });
-
- it('must drop states which cannot be parsed', () => {
- const state = new TraceState('a=1,b,c=3');
- assert.deepStrictEqual(state.get('a'), '1');
- assert.deepStrictEqual(state.get('b'), undefined);
- assert.deepStrictEqual(state.get('c'), '3');
- assert.deepStrictEqual(state.serialize(), 'a=1,c=3');
- });
-
- it('must skip states that only have a single value with an equal sign', () => {
- const state = new TraceState('a=1=');
- assert.deepStrictEqual(state.get('a'), undefined);
- });
-
- it('must successfully parse valid state keys', () => {
- const state = new TraceState('a-b=1,c/d=2,p*q=3,x_y=4');
- assert.deepStrictEqual(state.get('a-b'), '1');
- assert.deepStrictEqual(state.get('c/d'), '2');
- assert.deepStrictEqual(state.get('p*q'), '3');
- assert.deepStrictEqual(state.get('x_y'), '4');
- });
-
- it('must successfully parse valid state value with spaces in between', () => {
- const state = new TraceState('a=1,foo=bar baz');
- assert.deepStrictEqual(state.get('foo'), 'bar baz');
- assert.deepStrictEqual(state.serialize(), 'a=1,foo=bar baz');
- });
-
- it('must truncate states with too many items', () => {
- const state = new TraceState(
- new Array(33)
- .fill(0)
- .map((_: null, num: number) => `a${num}=${num}`)
- .join(',')
- );
- assert.deepStrictEqual(state['_keys']().length, 32);
- assert.deepStrictEqual(state.get('a0'), '0');
- assert.deepStrictEqual(state.get('a31'), '31');
- assert.deepStrictEqual(
- state.get('a32'),
- undefined,
- 'should truncate from the tail'
- );
- });
-
- it('should not count invalid items towards max limit', () => {
- const tracestate = new Array(32)
- .fill(0)
- .map((_: null, num: number) => `a${num}=${num}`)
- .concat('invalid.suffix.key=1'); // add invalid key to beginning
- tracestate.unshift('invalid.prefix.key=1');
- tracestate.splice(15, 0, 'invalid.middle.key.a=1');
- tracestate.splice(15, 0, 'invalid.middle.key.b=2');
- tracestate.splice(15, 0, 'invalid.middle.key.c=3');
-
- const state = new TraceState(tracestate.join(','));
-
- assert.deepStrictEqual(state['_keys']().length, 32);
- assert.deepStrictEqual(state.get('a0'), '0');
- assert.deepStrictEqual(state.get('a31'), '31');
- assert.deepStrictEqual(state.get('invalid.middle.key.a'), undefined);
- assert.deepStrictEqual(state.get('invalid.middle.key.b'), undefined);
- assert.deepStrictEqual(state.get('invalid.middle.key.c'), undefined);
- });
- });
-});
diff --git a/packages/opentelemetry-core/test/utils/url.test.ts b/packages/opentelemetry-core/test/utils/url.test.ts
deleted file mode 100644
index 205ec9aa07..0000000000
--- a/packages/opentelemetry-core/test/utils/url.test.ts
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-
-import { isUrlIgnored } from '../../src';
-
-const urlIgnored = 'url should be ignored';
-const urlNotIgnored = 'url should NOT be ignored';
-
-const urlToTest = 'http://myaddress.com/somepath';
-
-describe('BasePlugin - Utils', () => {
- describe('isUrlIgnored', () => {
- describe('when ignored urls are undefined', () => {
- it('should return false', () => {
- assert.strictEqual(isUrlIgnored(urlToTest), false, urlNotIgnored);
- });
- });
- describe('when ignored urls are empty', () => {
- it('should return false', () => {
- assert.strictEqual(isUrlIgnored(urlToTest, []), false, urlNotIgnored);
- });
- });
- describe('when ignored urls is the same as url', () => {
- it('should return true', () => {
- assert.strictEqual(
- isUrlIgnored(urlToTest, ['http://myaddress.com/somepath']),
- true,
- urlIgnored
- );
- });
- });
- describe('when url is part of ignored urls', () => {
- it('should return false', () => {
- assert.strictEqual(
- isUrlIgnored(urlToTest, ['http://myaddress.com/some']),
- false,
- urlNotIgnored
- );
- });
- });
- describe('when ignored urls is part of url - REGEXP', () => {
- it('should return true', () => {
- assert.strictEqual(
- isUrlIgnored(urlToTest, [/.+?myaddress\.com/]),
- true,
- urlIgnored
- );
- });
- });
- describe('when url is part of ignored urls - REGEXP', () => {
- it('should return false', () => {
- assert.strictEqual(
- isUrlIgnored(urlToTest, [/http:\/\/myaddress\.com\/somepath2/]),
- false,
- urlNotIgnored
- );
- });
- });
- });
-});
diff --git a/packages/opentelemetry-core/test/utils/wrap.test.ts b/packages/opentelemetry-core/test/utils/wrap.test.ts
deleted file mode 100644
index 741edc96b2..0000000000
--- a/packages/opentelemetry-core/test/utils/wrap.test.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-
-import { isWrapped, ShimWrapped } from '../../src';
-
-function makeWrapped(
- wrapped: unknown,
- unwrap: any,
- original: any
-): ShimWrapped {
- const wrapper = function() {};
- defineProperty(wrapper, '__wrapped', wrapped);
- defineProperty(wrapper, '__unwrap', unwrap);
- defineProperty(wrapper, '__original', original);
- return (wrapper as unknown) as ShimWrapped;
-}
-
-function defineProperty(obj: any, name: string, value: unknown) {
- var enumerable = !!obj[name] && obj.propertyIsEnumerable(name);
- Object.defineProperty(obj, name, {
- configurable: true,
- enumerable: enumerable,
- writable: true,
- value: value,
- });
-}
-
-const notWrappedFunctions: any[] = [];
-notWrappedFunctions.push(
- makeWrapped(
- false,
- function() {},
- function() {}
- )
-);
-notWrappedFunctions.push(makeWrapped(false, 'foo', function() {}));
-notWrappedFunctions.push(makeWrapped(false, function() {}, 'foo'));
-notWrappedFunctions.push({
- __wrapped: true,
- __unwrap: function() {},
- __original: function() {},
-});
-
-describe('utils-wrap', () => {
- describe('isWrapped', () => {
- it('should return true when function was wrapped', () => {
- const wrapped: ShimWrapped = makeWrapped(
- true,
- function() {},
- function() {}
- );
- assert.strictEqual(isWrapped(wrapped), true, 'function is not wrapped');
- });
-
- it('should return false when function is not wrapped', () => {
- notWrappedFunctions.forEach((wrapped: unknown, index: number) => {
- const result = isWrapped(wrapped as ShimWrapped);
- assert.strictEqual(
- result,
- false,
- `function number #${index} is wrapped`
- );
- });
- });
- });
-});
diff --git a/packages/opentelemetry-exporter-collector/README.md b/packages/opentelemetry-exporter-collector/README.md
deleted file mode 100644
index 6d27c508c1..0000000000
--- a/packages/opentelemetry-exporter-collector/README.md
+++ /dev/null
@@ -1,76 +0,0 @@
-# OpenTelemetry Collector Exporter for web and node
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![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].
-
-## Installation
-
-```bash
-npm install --save @opentelemetry/exporter-collector
-```
-
-## Usage in Web
-```js
-import { SimpleSpanProcessor } from '@opentelemetry/tracing';
-import { WebTracerProvider } from '@opentelemetry/web';
-import { CollectorExporter } from '@opentelemetry/exporter-collector'
-
-const collectorOptions = {
- url: '' // url is optional and can be omitted - default is http://localhost:55678/v1/trace
-};
-
-const provider = new WebTracerProvider();
-const exporter = new CollectorExporter(collectorOptions);
-provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
-
-provider.register();
-
-```
-
-## Usage in Node
-```js
-const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tracing');
-const { CollectorExporter } = require('@opentelemetry/exporter-collector');
-
-const collectorOptions = {
- serviceName: 'basic-service',
- url: '' // url is optional and can be omitted - default is http://localhost:55678/v1/trace
-};
-
-const provider = new BasicTracerProvider();
-const exporter = new CollectorExporter(collectorOptions);
-provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
-
-provider.register();
-
-```
-
-## Running opentelemetry-collector locally to see the traces
-1. Go to examples/basic-tracer-node
-2. run `npm run collector:docker:ot`
-3. Open page at `http://localhost:9411/zipkin/` to observe the traces
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more about OpenTelemetry JavaScript:
-- For help or feedback on this project, join us on [gitter][gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-exporter-collector
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-collector
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-exporter-collector
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-collector&type=dev
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-collector
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-collector.svg
-[opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-collector
diff --git a/packages/opentelemetry-exporter-collector/karma.conf.js b/packages/opentelemetry-exporter-collector/karma.conf.js
deleted file mode 100644
index 86965a0095..0000000000
--- a/packages/opentelemetry-exporter-collector/karma.conf.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-const karmaWebpackConfig = require('../../karma.webpack');
-const karmaBaseConfig = require('../../karma.base');
-
-module.exports = (config) => {
- config.set(Object.assign({}, karmaBaseConfig, {
- webpack: karmaWebpackConfig,
- files: ['test/browser/index-webpack.ts'],
- preprocessors: { 'test/browser/index-webpack.ts': ['webpack'] }
- }))
-};
diff --git a/packages/opentelemetry-exporter-collector/package.json b/packages/opentelemetry-exporter-collector/package.json
deleted file mode 100644
index 5b1e97497d..0000000000
--- a/packages/opentelemetry-exporter-collector/package.json
+++ /dev/null
@@ -1,95 +0,0 @@
-{
- "name": "@opentelemetry/exporter-collector",
- "version": "0.6.1",
- "description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector",
- "main": "build/src/index.js",
- "types": "build/src/index.d.ts",
- "repository": "open-telemetry/opentelemetry-js",
- "browser": {
- "./src/platform/index.ts": "./src/platform/browser/index.ts",
- "./build/src/platform/index.js": "./build/src/platform/browser/index.js"
- },
- "scripts": {
- "lint": "gts check",
- "lint:fix": "gts fix",
- "clean": "rimraf build/*",
- "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "precompile": "tsc --version",
- "compile": "npm run version:update && tsc -p .",
- "postcompile": "npm run submodule && npm run protos:copy",
- "prepare": "npm run compile",
- "protos:copy": "cpx src/platform/node/protos/opentelemetry/**/*.* build/src/platform/node/protos/opentelemetry",
- "submodule": "git submodule sync --recursive && git submodule update --init --recursive",
- "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": "npm run protos:copy && tsc -w"
- },
- "keywords": [
- "opentelemetry",
- "nodejs",
- "browser",
- "tracing",
- "profiling",
- "metrics",
- "stats"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@babel/core": "^7.6.0",
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.8",
- "@types/sinon": "^7.0.13",
- "@types/webpack-env": "1.13.9",
- "babel-loader": "^8.0.6",
- "codecov": "^3.1.0",
- "cpx": "^1.5.0",
- "gts": "^1.0.0",
- "istanbul-instrumenter-loader": "^3.0.1",
- "karma": "^4.4.1",
- "karma-chrome-launcher": "^3.1.0",
- "karma-coverage-istanbul-reporter": "^2.1.0",
- "karma-mocha": "^1.3.0",
- "karma-spec-reporter": "^0.0.32",
- "karma-webpack": "^4.0.2",
- "mocha": "^6.1.0",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "sinon": "^7.5.0",
- "ts-loader": "^6.0.4",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "3.6.4",
- "webpack": "^4.35.2",
- "webpack-cli": "^3.3.9",
- "webpack-merge": "^4.2.2"
- },
- "dependencies": {
- "@grpc/proto-loader": "^0.5.3",
- "@opentelemetry/api": "^0.6.1",
- "@opentelemetry/base": "^0.6.1",
- "@opentelemetry/core": "^0.6.1",
- "@opentelemetry/resources": "^0.6.1",
- "@opentelemetry/tracing": "^0.6.1",
- "google-protobuf": "^3.11.4",
- "grpc": "^1.24.2"
- }
-}
diff --git a/packages/opentelemetry-exporter-collector/src/CollectorExporter.ts b/packages/opentelemetry-exporter-collector/src/CollectorExporter.ts
deleted file mode 100644
index 7199848da8..0000000000
--- a/packages/opentelemetry-exporter-collector/src/CollectorExporter.ts
+++ /dev/null
@@ -1,130 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { ExportResult } from '@opentelemetry/base';
-import { NoopLogger } from '@opentelemetry/core';
-import { ReadableSpan, SpanExporter } from '@opentelemetry/tracing';
-import { Attributes, Logger } from '@opentelemetry/api';
-import { onInit, onShutdown, sendSpans } from './platform/index';
-import { opentelemetryProto } from './types';
-
-/**
- * Collector Exporter Config
- */
-export interface CollectorExporterConfig {
- hostName?: string;
- logger?: Logger;
- serviceName?: string;
- attributes?: Attributes;
- url?: string;
-}
-
-const DEFAULT_SERVICE_NAME = 'collector-exporter';
-const DEFAULT_COLLECTOR_URL = 'http://localhost:55678/v1/trace';
-
-/**
- * Collector Exporter
- */
-export class CollectorExporter implements SpanExporter {
- readonly serviceName: string;
- readonly url: string;
- readonly logger: Logger;
- readonly hostName: string | undefined;
- readonly attributes?: Attributes;
- private _isShutdown: boolean = false;
-
- /**
- * @param config
- */
- constructor(config: CollectorExporterConfig = {}) {
- this.serviceName = config.serviceName || DEFAULT_SERVICE_NAME;
- this.url = config.url || DEFAULT_COLLECTOR_URL;
- if (typeof config.hostName === 'string') {
- this.hostName = config.hostName;
- }
-
- this.attributes = config.attributes;
-
- this.logger = config.logger || new NoopLogger();
-
- this.shutdown = this.shutdown.bind(this);
-
- // platform dependent
- onInit(this);
- }
-
- /**
- * Export spans.
- * @param spans
- * @param resultCallback
- */
- export(
- spans: ReadableSpan[],
- resultCallback: (result: ExportResult) => void
- ) {
- if (this._isShutdown) {
- resultCallback(ExportResult.FAILED_NOT_RETRYABLE);
- return;
- }
-
- this._exportSpans(spans)
- .then(() => {
- resultCallback(ExportResult.SUCCESS);
- })
- .catch(
- (
- error: opentelemetryProto.collector.trace.v1.ExportTraceServiceError
- ) => {
- if (error.message) {
- this.logger.error(error.message);
- }
- if (error.code && error.code < 500) {
- resultCallback(ExportResult.FAILED_NOT_RETRYABLE);
- } else {
- resultCallback(ExportResult.FAILED_RETRYABLE);
- }
- }
- );
- }
-
- private _exportSpans(spans: ReadableSpan[]): Promise {
- return new Promise((resolve, reject) => {
- try {
- this.logger.debug('spans to be sent', spans);
- // Send spans to [opentelemetry collector]{@link https://github.com/open-telemetry/opentelemetry-collector}
- // it will use the appropriate transport layer automatically depends on platform
- sendSpans(spans, resolve, reject, this);
- } catch (e) {
- reject(e);
- }
- });
- }
-
- /**
- * Shutdown the exporter.
- */
- shutdown(): void {
- if (this._isShutdown) {
- this.logger.debug('shutdown already started');
- return;
- }
- this._isShutdown = true;
- this.logger.debug('shutdown started');
-
- // platform dependent
- onShutdown(this);
- }
-}
diff --git a/packages/opentelemetry-exporter-collector/src/index.ts b/packages/opentelemetry-exporter-collector/src/index.ts
deleted file mode 100644
index df00fee615..0000000000
--- a/packages/opentelemetry-exporter-collector/src/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './CollectorExporter';
diff --git a/packages/opentelemetry-exporter-collector/src/platform/browser/index.ts b/packages/opentelemetry-exporter-collector/src/platform/browser/index.ts
deleted file mode 100644
index e2ba0ac5a4..0000000000
--- a/packages/opentelemetry-exporter-collector/src/platform/browser/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './sendSpans';
diff --git a/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts b/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts
deleted file mode 100644
index a718cf17d4..0000000000
--- a/packages/opentelemetry-exporter-collector/src/platform/browser/sendSpans.ts
+++ /dev/null
@@ -1,141 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Logger } from '@opentelemetry/api';
-import { ReadableSpan } from '@opentelemetry/tracing';
-import { CollectorExporter } from '../../CollectorExporter';
-import { toCollectorExportTraceServiceRequest } from '../../transform';
-import * as collectorTypes from '../../types';
-
-/**
- * function that is called once when {@link ExporterCollector} is initialised
- * @param collectorExporter CollectorExporter {@link ExporterCollector}
- */
-export function onInit(collectorExporter: CollectorExporter) {
- window.addEventListener('unload', collectorExporter.shutdown);
-}
-
-/**
- * function to be called once when {@link ExporterCollector} is shutdown
- * @param collectorExporter CollectorExporter {@link ExporterCollector}
- */
-export function onShutdown(collectorExporter: CollectorExporter) {
- window.removeEventListener('unload', collectorExporter.shutdown);
-}
-
-/**
- * function to send spans to the [opentelemetry collector]{@link https://github.com/open-telemetry/opentelemetry-collector}
- * using the standard http/https node module
- * @param spans
- * @param onSuccess
- * @param onError
- * @param collectorExporter
- */
-export function sendSpans(
- spans: ReadableSpan[],
- onSuccess: () => void,
- onError: (error: collectorTypes.CollectorExporterError) => void,
- collectorExporter: CollectorExporter
-) {
- const exportTraceServiceRequest = toCollectorExportTraceServiceRequest(
- spans,
- collectorExporter
- );
-
- const body = JSON.stringify(exportTraceServiceRequest);
-
- if (typeof navigator.sendBeacon === 'function') {
- sendSpansWithBeacon(
- body,
- onSuccess,
- onError,
- collectorExporter.logger,
- collectorExporter.url
- );
- } else {
- sendSpansWithXhr(
- body,
- onSuccess,
- onError,
- collectorExporter.logger,
- collectorExporter.url
- );
- }
-}
-
-/**
- * function to send spans using browser navigator.sendBeacon
- * @param body
- * @param onSuccess
- * @param onError
- * @param logger
- * @param collectorUrl
- */
-function sendSpansWithBeacon(
- body: string,
- onSuccess: () => void,
- onError: (error: collectorTypes.CollectorExporterError) => void,
- logger: Logger,
- collectorUrl: string
-) {
- if (navigator.sendBeacon(collectorUrl, body)) {
- logger.debug('sendBeacon - can send', body);
- onSuccess();
- } else {
- logger.error('sendBeacon - cannot send', body);
- onError({});
- }
-}
-
-/**
- * function to send spans using browser XMLHttpRequest
- * used when navigator.sendBeacon is not available
- * @param body
- * @param onSuccess
- * @param onError
- * @param logger
- * @param collectorUrl
- */
-function sendSpansWithXhr(
- body: string,
- onSuccess: () => void,
- onError: (error: collectorTypes.CollectorExporterError) => void,
- logger: Logger,
- collectorUrl: string
-) {
- const xhr = new XMLHttpRequest();
- xhr.open('POST', collectorUrl);
- xhr.setRequestHeader(collectorTypes.OT_REQUEST_HEADER, '1');
- xhr.setRequestHeader('Accept', 'application/json');
- xhr.setRequestHeader('Content-Type', 'application/json');
- xhr.send(body);
-
- xhr.onreadystatechange = () => {
- if (xhr.readyState === XMLHttpRequest.DONE) {
- if (xhr.status >= 200 && xhr.status <= 299) {
- logger.debug('xhr success', body);
- onSuccess();
- } else {
- logger.error('body', body);
- logger.error('xhr error', xhr);
- onError({
- code: xhr.status,
- message: xhr.responseText,
- });
- }
- }
- };
-}
diff --git a/packages/opentelemetry-exporter-collector/src/platform/index.ts b/packages/opentelemetry-exporter-collector/src/platform/index.ts
deleted file mode 100644
index 16f6fd9be2..0000000000
--- a/packages/opentelemetry-exporter-collector/src/platform/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './node';
diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/README.md b/packages/opentelemetry-exporter-collector/src/platform/node/README.md
deleted file mode 100644
index aee8555b64..0000000000
--- a/packages/opentelemetry-exporter-collector/src/platform/node/README.md
+++ /dev/null
@@ -1,45 +0,0 @@
-### Important!
-**Submodule is always pointing to certain revision number. So updating the master of the submodule repo will not have impact on your code.
-Knowing this if you want to change the submodule to point to a different version (when for example proto has changed) here is how to do it:**
-
-### Updating submodule to point to certain revision number
-
-1. Make sure you are in the same folder as this instruction
-
-2. Update your submodules by running this command
-
-```shell script
- git submodule sync --recursive
- git submodule update --init --recursive
-```
-
-3. Find the SHA which you want to update to and copy it (the long one)
-the latest sha when this guide was written is `e6c3c4a74d57f870a0d781bada02cb2b2c497d14`
-
-4. Enter a submodule directory from this directory
-
-```shell script
- cd protos
-```
-
-5. Updates files in the submodule tree to given commit:
-
-```shell script
- git checkout -q
-```
-
-6. Return to the main directory:
-
-```shell script
- cd ../
-```
-
-7. Please run `git status` you should see something like `Head detached at`. This is correct, go to next step
-
-8. Now thing which is very important. You have to commit this to apply these changes
-
-```shell script
- git commit -am "chore: updating submodule for opentelemetry-proto"
-```
-
-9. If you look now at git log you will notice that the folder `protos` has been changed and it will show what was the previous sha and what is current one
diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/index.ts b/packages/opentelemetry-exporter-collector/src/platform/node/index.ts
deleted file mode 100644
index e2ba0ac5a4..0000000000
--- a/packages/opentelemetry-exporter-collector/src/platform/node/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './sendSpans';
diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/protos b/packages/opentelemetry-exporter-collector/src/platform/node/protos
deleted file mode 160000
index e6c3c4a74d..0000000000
--- a/packages/opentelemetry-exporter-collector/src/platform/node/protos
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit e6c3c4a74d57f870a0d781bada02cb2b2c497d14
diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts b/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts
deleted file mode 100644
index 5b7c9035b7..0000000000
--- a/packages/opentelemetry-exporter-collector/src/platform/node/sendSpans.ts
+++ /dev/null
@@ -1,145 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as protoLoader from '@grpc/proto-loader';
-import { ReadableSpan } from '@opentelemetry/tracing';
-import * as grpc from 'grpc';
-import * as path from 'path';
-
-import { CollectorExporter } from '../../CollectorExporter';
-import * as collectorTypes from '../../types';
-import { toCollectorExportTraceServiceRequest } from '../../transform';
-import { CollectorData, GRPCQueueItem } from './types';
-import { removeProtocol } from './util';
-
-const traceServiceClients: WeakMap<
- CollectorExporter,
- CollectorData
-> = new WeakMap();
-
-/**
- * function that is called once when {@link ExporterCollector} is initialised
- * @param collectorExporter CollectorExporter {@link ExporterCollector}
- */
-export function onInit(collectorExporter: CollectorExporter) {
- traceServiceClients.set(collectorExporter, {
- isShutDown: false,
- grpcSpansQueue: [],
- });
- const serverAddress = removeProtocol(collectorExporter.url);
- const credentials: grpc.ChannelCredentials = grpc.credentials.createInsecure();
-
- const traceServiceProtoPath =
- 'opentelemetry/proto/collector/trace/v1/trace_service.proto';
- const includeDirs = [path.resolve(__dirname, 'protos')];
-
- protoLoader
- .load(traceServiceProtoPath, {
- keepCase: false,
- longs: String,
- enums: String,
- defaults: true,
- oneofs: true,
- includeDirs,
- })
- .then(packageDefinition => {
- const packageObject: any = grpc.loadPackageDefinition(packageDefinition);
- const exporter = traceServiceClients.get(collectorExporter);
- if (!exporter) {
- return;
- }
- exporter.traceServiceClient = new packageObject.opentelemetry.proto.collector.trace.v1.TraceService(
- serverAddress,
- credentials
- );
- if (exporter.grpcSpansQueue.length > 0) {
- const queue = exporter.grpcSpansQueue.splice(0);
- queue.forEach((item: GRPCQueueItem) => {
- sendSpans(
- item.spans,
- item.onSuccess,
- item.onError,
- collectorExporter
- );
- });
- }
- });
-}
-
-/**
- * function to be called once when {@link ExporterCollector} is shutdown
- * @param collectorExporter CollectorExporter {@link ExporterCollector}
- */
-export function onShutdown(collectorExporter: CollectorExporter) {
- const exporter = traceServiceClients.get(collectorExporter);
- if (!exporter) {
- return;
- }
- exporter.isShutDown = true;
-
- if (exporter.traceServiceClient) {
- exporter.traceServiceClient.close();
- }
-}
-
-/**
- * function to send spans to the [opentelemetry collector]{@link https://github.com/open-telemetry/opentelemetry-collector}
- * using the standard http/https node module
- * @param spans
- * @param onSuccess
- * @param onError
- * @param collectorExporter
- */
-export function sendSpans(
- spans: ReadableSpan[],
- onSuccess: () => void,
- onError: (error: collectorTypes.CollectorExporterError) => void,
- collectorExporter: CollectorExporter
-) {
- const exporter = traceServiceClients.get(collectorExporter);
- if (!exporter || exporter.isShutDown) {
- return;
- }
- if (exporter.traceServiceClient) {
- const exportTraceServiceRequest = toCollectorExportTraceServiceRequest(
- spans,
- collectorExporter
- );
-
- exporter.traceServiceClient.export(
- exportTraceServiceRequest,
- (
- err: collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceError
- ) => {
- if (err) {
- collectorExporter.logger.error(
- 'exportTraceServiceRequest',
- exportTraceServiceRequest
- );
- onError(err);
- } else {
- onSuccess();
- }
- }
- );
- } else {
- exporter.grpcSpansQueue.push({
- spans,
- onSuccess,
- onError,
- });
- }
-}
diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/types.ts b/packages/opentelemetry-exporter-collector/src/platform/node/types.ts
deleted file mode 100644
index 8a7786038a..0000000000
--- a/packages/opentelemetry-exporter-collector/src/platform/node/types.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as grpc from 'grpc';
-import { ReadableSpan } from '@opentelemetry/tracing';
-import { CollectorExporterError } from '../../types';
-
-/**
- * Queue item to be used to save temporary spans in case the GRPC service
- * hasn't been fully initialised yet
- */
-export interface GRPCQueueItem {
- spans: ReadableSpan[];
- onSuccess: () => void;
- onError: (error: CollectorExporterError) => void;
-}
-
-/**
- * Trace Service Client for sending spans
- */
-export interface TraceServiceClient extends grpc.Client {
- export: (request: any, callback: Function) => {};
-}
-
-/**
- * Interface to store helper information
- */
-export interface CollectorData {
- traceServiceClient?: TraceServiceClient;
- isShutDown: boolean;
- grpcSpansQueue: GRPCQueueItem[];
-}
diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/util.ts b/packages/opentelemetry-exporter-collector/src/platform/node/util.ts
deleted file mode 100644
index ccc4fb8205..0000000000
--- a/packages/opentelemetry-exporter-collector/src/platform/node/util.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * It will remove http or https from the link as grpc requires link without
- * protocol
- * @param url
- */
-export function removeProtocol(url: string): string {
- return url.replace(/^https?\:\/\//, '');
-}
diff --git a/packages/opentelemetry-exporter-collector/src/transform.ts b/packages/opentelemetry-exporter-collector/src/transform.ts
deleted file mode 100644
index 580434c990..0000000000
--- a/packages/opentelemetry-exporter-collector/src/transform.ts
+++ /dev/null
@@ -1,233 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- Attributes,
- Link,
- SpanKind,
- TimedEvent,
- TraceState,
-} from '@opentelemetry/api';
-import { SDK_INFO } from '@opentelemetry/base';
-import * as core from '@opentelemetry/core';
-import { Resource } from '@opentelemetry/resources';
-import { ReadableSpan } from '@opentelemetry/tracing';
-import { CollectorExporter } from './CollectorExporter';
-import { COLLETOR_SPAN_KIND_MAPPING, opentelemetryProto } from './types';
-import ValueType = opentelemetryProto.common.v1.ValueType;
-
-/**
- * Converts attributes
- * @param attributes
- */
-export function toCollectorAttributes(
- attributes: Attributes
-): opentelemetryProto.common.v1.AttributeKeyValue[] {
- return Object.keys(attributes).map(key => {
- return toCollectorAttributeKeyValue(key, attributes[key]);
- });
-}
-
-/**
- * Converts key and value to AttributeKeyValue
- * @param value event value
- */
-export function toCollectorAttributeKeyValue(
- key: string,
- value: unknown
-): opentelemetryProto.common.v1.AttributeKeyValue {
- let aType: opentelemetryProto.common.v1.ValueType = ValueType.STRING;
- const AttributeKeyValue: opentelemetryProto.common.v1.AttributeKeyValue = {
- key,
- type: 0,
- };
- if (typeof value === 'string') {
- AttributeKeyValue.stringValue = value;
- } else if (typeof value === 'boolean') {
- aType = ValueType.BOOL;
- AttributeKeyValue.boolValue = value;
- } else if (typeof value === 'number') {
- // all numbers will be treated as double
- aType = ValueType.DOUBLE;
- AttributeKeyValue.doubleValue = value;
- }
-
- AttributeKeyValue.type = aType;
-
- return AttributeKeyValue;
-}
-
-/**
- *
- * Converts events
- * @param events array of events
- */
-export function toCollectorEvents(
- timedEvents: TimedEvent[]
-): opentelemetryProto.trace.v1.Span.Event[] {
- return timedEvents.map(timedEvent => {
- const timeUnixNano = core.hrTimeToNanoseconds(timedEvent.time);
- const name = timedEvent.name;
- const attributes = toCollectorAttributes(timedEvent.attributes || {});
- const droppedAttributesCount = 0;
-
- const protoEvent: opentelemetryProto.trace.v1.Span.Event = {
- timeUnixNano,
- name,
- attributes,
- droppedAttributesCount,
- };
-
- return protoEvent;
- });
-}
-
-/**
- * Converts links
- * @param span
- */
-export function toCollectorLinks(
- span: ReadableSpan
-): opentelemetryProto.trace.v1.Span.Link[] {
- return span.links.map((link: Link) => {
- const protoLink: opentelemetryProto.trace.v1.Span.Link = {
- traceId: core.hexToBase64(link.context.traceId),
- spanId: core.hexToBase64(link.context.spanId),
- attributes: toCollectorAttributes(link.attributes || {}),
- droppedAttributesCount: 0,
- };
- return protoLink;
- });
-}
-
-/**
- * Converts span
- * @param span
- */
-export function toCollectorSpan(
- span: ReadableSpan
-): opentelemetryProto.trace.v1.Span {
- return {
- traceId: core.hexToBase64(span.spanContext.traceId),
- spanId: core.hexToBase64(span.spanContext.spanId),
- parentSpanId: span.parentSpanId
- ? core.hexToBase64(span.parentSpanId)
- : undefined,
- traceState: toCollectorTraceState(span.spanContext.traceState),
- name: span.name,
- kind: toCollectorKind(span.kind),
- startTimeUnixNano: core.hrTimeToNanoseconds(span.startTime),
- endTimeUnixNano: core.hrTimeToNanoseconds(span.endTime),
- attributes: toCollectorAttributes(span.attributes),
- droppedAttributesCount: 0,
- events: toCollectorEvents(span.events),
- droppedEventsCount: 0,
- status: span.status,
- links: toCollectorLinks(span),
- droppedLinksCount: 0,
- };
-}
-
-/**
- * Converts resource
- * @param resource
- * @param additionalAttributes
- */
-export function toCollectorResource(
- resource?: Resource,
- additionalAttributes: { [key: string]: any } = {}
-): opentelemetryProto.resource.v1.Resource {
- const attr = Object.assign(
- {},
- additionalAttributes,
- resource ? resource.labels : {}
- );
- const resourceProto: opentelemetryProto.resource.v1.Resource = {
- attributes: toCollectorAttributes(attr),
- droppedAttributesCount: 0,
- };
-
- return resourceProto;
-}
-
-/**
- * Converts span kind
- * @param kind
- */
-export function toCollectorKind(
- kind: SpanKind
-): opentelemetryProto.trace.v1.Span.SpanKind {
- const collectorKind = COLLETOR_SPAN_KIND_MAPPING[kind];
- return typeof collectorKind === 'number'
- ? collectorKind
- : opentelemetryProto.trace.v1.Span.SpanKind.SPAN_KIND_UNSPECIFIED;
-}
-
-/**
- * Converts traceState
- * @param traceState
- */
-export function toCollectorTraceState(
- traceState?: TraceState
-): opentelemetryProto.trace.v1.Span.TraceState | undefined {
- if (!traceState) return undefined;
- return traceState.serialize();
-}
-
-/**
- * Prepares trace service request to be sent to collector
- * @param spans spans
- * @param collectorExporter
- * @param [name] Instrumentation Library Name
- */
-export function toCollectorExportTraceServiceRequest(
- spans: ReadableSpan[],
- collectorExporter: CollectorExporter,
- name: string = ''
-): opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest {
- const spansToBeSent: opentelemetryProto.trace.v1.Span[] = spans.map(span =>
- toCollectorSpan(span)
- );
- const resource: Resource =
- spans.length > 0 ? spans[0].resource : Resource.empty();
-
- const additionalAttributes = Object.assign(
- {},
- collectorExporter.attributes || {},
- {
- 'service.name': collectorExporter.serviceName,
- }
- );
- const protoResource: opentelemetryProto.resource.v1.Resource = toCollectorResource(
- resource,
- additionalAttributes
- );
- const instrumentationLibrarySpans: opentelemetryProto.trace.v1.InstrumentationLibrarySpans = {
- spans: spansToBeSent,
- instrumentationLibrary: {
- name: name || `${SDK_INFO.NAME} - ${SDK_INFO.LANGUAGE}`,
- version: SDK_INFO.VERSION,
- },
- };
- const resourceSpan: opentelemetryProto.trace.v1.ResourceSpans = {
- resource: protoResource,
- instrumentationLibrarySpans: [instrumentationLibrarySpans],
- };
-
- return {
- resourceSpans: [resourceSpan],
- };
-}
diff --git a/packages/opentelemetry-exporter-collector/src/types.ts b/packages/opentelemetry-exporter-collector/src/types.ts
deleted file mode 100644
index 99eacdd0cf..0000000000
--- a/packages/opentelemetry-exporter-collector/src/types.ts
+++ /dev/null
@@ -1,183 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { SpanKind } from '@opentelemetry/api';
-import * as api from '@opentelemetry/api';
-
-// header to prevent instrumentation on request
-export const OT_REQUEST_HEADER = 'x-opentelemetry-outgoing-request';
-
-export namespace opentelemetryProto {
- export namespace collector {
- export namespace trace.v1 {
- export interface TraceService {
- service: opentelemetryProto.collector.trace.v1.TraceService;
- }
-
- export interface ExportTraceServiceRequest {
- resourceSpans: opentelemetryProto.trace.v1.ResourceSpans[];
- }
-
- export interface ExportTraceServiceResponse {}
-
- export interface ExportTraceServiceError {
- code: number;
- details: string;
- metadata: { [key: string]: unknown };
- message: string;
- stack: string;
- }
- }
- }
-
- export namespace resource.v1 {
- export interface Resource {
- attributes: opentelemetryProto.common.v1.AttributeKeyValue[];
- droppedAttributesCount: number;
- }
- }
-
- export namespace trace.v1 {
- export namespace ConstantSampler {
- export enum ConstantDecision {
- ALWAYS_OFF = 0,
- ALWAYS_ON = 1,
- ALWAYS_PARENT = 2,
- }
- }
- export namespace Span {
- export interface Event {
- timeUnixNano: number;
- name: string;
- attributes?: opentelemetryProto.common.v1.AttributeKeyValue[];
- droppedAttributesCount: number;
- }
-
- export interface Link {
- traceId: string;
- spanId: string;
- traceState?: opentelemetryProto.trace.v1.Span.TraceState;
- attributes?: opentelemetryProto.common.v1.AttributeKeyValue[];
- droppedAttributesCount: number;
- }
-
- export enum SpanKind {
- SPAN_KIND_UNSPECIFIED,
- INTERNAL,
- SERVER,
- CLIENT,
- PRODUCER,
- CONSUMER,
- }
- export type TraceState = string | undefined;
- }
-
- export interface ConstantSampler {
- decision?: opentelemetryProto.trace.v1.ConstantSampler.ConstantDecision;
- }
-
- export interface InstrumentationLibrarySpans {
- instrumentationLibrary?: opentelemetryProto.common.v1.InstrumentationLibrary;
- spans: opentelemetryProto.trace.v1.Span[];
- }
-
- export interface ProbabilitySampler {
- samplingProbability?: number | null;
- }
-
- export interface RateLimitingSampler {
- qps?: number | null;
- }
-
- export interface ResourceSpans {
- resource?: opentelemetryProto.resource.v1.Resource;
- instrumentationLibrarySpans: opentelemetryProto.trace.v1.InstrumentationLibrarySpans[];
- }
-
- export interface Span {
- traceId: string;
- spanId: string;
- traceState: opentelemetryProto.trace.v1.Span.TraceState;
- parentSpanId?: string;
- name?: string;
- kind?: opentelemetryProto.trace.v1.Span.SpanKind;
- startTimeUnixNano?: number;
- endTimeUnixNano?: number;
- attributes?: opentelemetryProto.common.v1.AttributeKeyValue[];
- droppedAttributesCount: number;
- events?: opentelemetryProto.trace.v1.Span.Event[];
- droppedEventsCount: number;
- links?: opentelemetryProto.trace.v1.Span.Link[];
- droppedLinksCount: number;
- status?: Status;
- }
-
- export interface Status extends api.Status {}
-
- export interface TraceConfig {
- constantSampler?: ConstantSampler | null;
- probabilitySampler?: ProbabilitySampler | null;
- rateLimitingSampler?: RateLimitingSampler | null;
- }
- }
- export namespace common.v1 {
- export interface AttributeKeyValue {
- key: string;
- type: opentelemetryProto.common.v1.ValueType;
- stringValue?: string;
- intValue?: number;
- doubleValue?: number;
- boolValue?: boolean;
- }
-
- export interface InstrumentationLibrary {
- name: string;
- version: string;
- }
-
- export interface StringKeyValue {
- key: string;
- value: string;
- }
-
- export enum ValueType {
- STRING,
- INT,
- DOUBLE,
- BOOL,
- }
- }
-}
-
-/**
- * Interface for handling error
- */
-export interface CollectorExporterError {
- code?: number;
- message?: string;
- stack?: string;
-}
-
-/**
- * Mapping between api SpanKind and proto SpanKind
- */
-export const COLLETOR_SPAN_KIND_MAPPING = {
- [SpanKind.INTERNAL]: opentelemetryProto.trace.v1.Span.SpanKind.INTERNAL,
- [SpanKind.SERVER]: opentelemetryProto.trace.v1.Span.SpanKind.SERVER,
- [SpanKind.CLIENT]: opentelemetryProto.trace.v1.Span.SpanKind.CLIENT,
- [SpanKind.PRODUCER]: opentelemetryProto.trace.v1.Span.SpanKind.PRODUCER,
- [SpanKind.CONSUMER]: opentelemetryProto.trace.v1.Span.SpanKind.CONSUMER,
-};
diff --git a/packages/opentelemetry-exporter-collector/test/browser/CollectorExporter.test.ts b/packages/opentelemetry-exporter-collector/test/browser/CollectorExporter.test.ts
deleted file mode 100644
index d17551c866..0000000000
--- a/packages/opentelemetry-exporter-collector/test/browser/CollectorExporter.test.ts
+++ /dev/null
@@ -1,222 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { NoopLogger } from '@opentelemetry/core';
-import { ReadableSpan } from '@opentelemetry/tracing';
-import * as assert from 'assert';
-import * as sinon from 'sinon';
-import {
- CollectorExporter,
- CollectorExporterConfig,
-} from '../../src/CollectorExporter';
-import * as collectorTypes from '../../src/types';
-
-import {
- ensureSpanIsCorrect,
- ensureExportTraceServiceRequestIsSet,
- ensureWebResourceIsCorrect,
- mockedReadableSpan,
-} from '../helper';
-const sendBeacon = navigator.sendBeacon;
-
-describe('CollectorExporter - web', () => {
- let collectorExporter: CollectorExporter;
- let collectorExporterConfig: CollectorExporterConfig;
- let spyOpen: any;
- let spySend: any;
- let spyBeacon: any;
- let spans: ReadableSpan[];
-
- beforeEach(() => {
- spyOpen = sinon.stub(XMLHttpRequest.prototype, 'open');
- spySend = sinon.stub(XMLHttpRequest.prototype, 'send');
- spyBeacon = sinon.stub(navigator, 'sendBeacon');
- collectorExporterConfig = {
- hostName: 'foo',
- logger: new NoopLogger(),
- serviceName: 'bar',
- attributes: {},
- url: 'http://foo.bar.com',
- };
- collectorExporter = new CollectorExporter(collectorExporterConfig);
- spans = [];
- spans.push(Object.assign({}, mockedReadableSpan));
- });
-
- afterEach(() => {
- navigator.sendBeacon = sendBeacon;
- spyOpen.restore();
- spySend.restore();
- spyBeacon.restore();
- });
-
- describe('export', () => {
- describe('when "sendBeacon" is available', () => {
- it('should successfully send the spans using sendBeacon', done => {
- collectorExporter.export(spans, function() {});
-
- setTimeout(() => {
- const args = spyBeacon.args[0];
- const url = args[0];
- const body = args[1];
- const json = JSON.parse(
- body
- ) as collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest;
- const span1 =
- json.resourceSpans[0].instrumentationLibrarySpans[0].spans[0];
-
- assert.ok(typeof span1 !== 'undefined', "span doesn't exist");
- if (span1) {
- ensureSpanIsCorrect(span1);
- }
-
- const resource = json.resourceSpans[0].resource;
- assert.ok(typeof resource !== 'undefined', "resource doesn't exist");
- if (resource) {
- ensureWebResourceIsCorrect(resource);
- }
-
- assert.strictEqual(url, 'http://foo.bar.com');
- assert.strictEqual(spyBeacon.callCount, 1);
-
- assert.strictEqual(spyOpen.callCount, 0);
-
- ensureExportTraceServiceRequestIsSet(json);
-
- done();
- });
- });
-
- it('should log the successful message', done => {
- const spyLoggerDebug = sinon.stub(collectorExporter.logger, 'debug');
- const spyLoggerError = sinon.stub(collectorExporter.logger, 'error');
- spyBeacon.restore();
- spyBeacon = sinon.stub(window.navigator, 'sendBeacon').returns(true);
-
- collectorExporter.export(spans, function() {});
-
- setTimeout(() => {
- const response: any = spyLoggerDebug.args[1][0];
- assert.strictEqual(response, 'sendBeacon - can send');
- assert.strictEqual(spyLoggerError.args.length, 0);
-
- done();
- });
- });
-
- it('should log the error message', done => {
- const spyLoggerDebug = sinon.stub(collectorExporter.logger, 'debug');
- const spyLoggerError = sinon.stub(collectorExporter.logger, 'error');
- spyBeacon.restore();
- spyBeacon = sinon.stub(window.navigator, 'sendBeacon').returns(false);
-
- collectorExporter.export(spans, function() {});
-
- setTimeout(() => {
- const response: any = spyLoggerError.args[0][0];
- assert.strictEqual(response, 'sendBeacon - cannot send');
- assert.strictEqual(spyLoggerDebug.args.length, 1);
-
- done();
- });
- });
- });
-
- describe('when "sendBeacon" is NOT available', () => {
- let server: any;
- beforeEach(() => {
- // @ts-ignore
- window.navigator.sendBeacon = false;
- server = sinon.fakeServer.create();
- });
- afterEach(() => {
- server.restore();
- });
-
- it('should successfully send the spans using XMLHttpRequest', done => {
- collectorExporter.export(spans, function() {});
-
- setTimeout(() => {
- const request = server.requests[0];
- assert.strictEqual(request.method, 'POST');
- assert.strictEqual(request.url, 'http://foo.bar.com');
-
- const body = request.requestBody;
- const json = JSON.parse(
- body
- ) as collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest;
- const span1 =
- json.resourceSpans[0].instrumentationLibrarySpans[0].spans[0];
-
- assert.ok(typeof span1 !== 'undefined', "span doesn't exist");
- if (span1) {
- ensureSpanIsCorrect(span1);
- }
-
- const resource = json.resourceSpans[0].resource;
- assert.ok(typeof resource !== 'undefined', "resource doesn't exist");
- if (resource) {
- ensureWebResourceIsCorrect(resource);
- }
-
- assert.strictEqual(spyBeacon.callCount, 0);
-
- ensureExportTraceServiceRequestIsSet(json);
-
- done();
- });
- });
-
- it('should log the successful message', done => {
- const spyLoggerDebug = sinon.stub(collectorExporter.logger, 'debug');
- const spyLoggerError = sinon.stub(collectorExporter.logger, 'error');
-
- collectorExporter.export(spans, function() {});
-
- setTimeout(() => {
- const request = server.requests[0];
- request.respond(200);
-
- const response: any = spyLoggerDebug.args[1][0];
- assert.strictEqual(response, 'xhr success');
- assert.strictEqual(spyLoggerError.args.length, 0);
-
- assert.strictEqual(spyBeacon.callCount, 0);
- done();
- });
- });
-
- it('should log the error message', done => {
- const spyLoggerError = sinon.stub(collectorExporter.logger, 'error');
-
- collectorExporter.export(spans, function() {});
-
- setTimeout(() => {
- const request = server.requests[0];
- request.respond(400);
-
- const response1: any = spyLoggerError.args[0][0];
- const response2: any = spyLoggerError.args[1][0];
- assert.strictEqual(response1, 'body');
- assert.strictEqual(response2, 'xhr error');
-
- assert.strictEqual(spyBeacon.callCount, 0);
- done();
- });
- });
- });
- });
-});
diff --git a/packages/opentelemetry-exporter-collector/test/browser/index-webpack.ts b/packages/opentelemetry-exporter-collector/test/browser/index-webpack.ts
deleted file mode 100644
index 9fdb7117a2..0000000000
--- a/packages/opentelemetry-exporter-collector/test/browser/index-webpack.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// This file is the webpack entry point for the browser Karma tests. It requires
-// all modules ending in "test" from the current folder and all its subfolders.
-const testsContext = require.context('../browser', true, /test$/);
-testsContext.keys().forEach(testsContext);
-
-const testsContextCommon = require.context('../common', true, /test$/);
-testsContextCommon.keys().forEach(testsContextCommon);
-
-const srcContext = require.context('.', true, /src$/);
-srcContext.keys().forEach(srcContext);
diff --git a/packages/opentelemetry-exporter-collector/test/common/CollectorExporter.test.ts b/packages/opentelemetry-exporter-collector/test/common/CollectorExporter.test.ts
deleted file mode 100644
index 175222f0e4..0000000000
--- a/packages/opentelemetry-exporter-collector/test/common/CollectorExporter.test.ts
+++ /dev/null
@@ -1,162 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { ExportResult } from '@opentelemetry/base';
-import { NoopLogger } from '@opentelemetry/core';
-import { ReadableSpan } from '@opentelemetry/tracing';
-import * as assert from 'assert';
-import * as sinon from 'sinon';
-import {
- CollectorExporter,
- CollectorExporterConfig,
-} from '../../src/CollectorExporter';
-import * as platform from '../../src/platform/index';
-
-import { mockedReadableSpan } from '../helper';
-
-describe('CollectorExporter - common', () => {
- let collectorExporter: CollectorExporter;
- let collectorExporterConfig: CollectorExporterConfig;
-
- describe('constructor', () => {
- let onInitSpy: any;
- beforeEach(() => {
- onInitSpy = sinon.stub(platform, 'onInit');
- collectorExporterConfig = {
- hostName: 'foo',
- logger: new NoopLogger(),
- serviceName: 'bar',
- attributes: {},
- url: 'http://foo.bar.com',
- };
- collectorExporter = new CollectorExporter(collectorExporterConfig);
- });
- afterEach(() => {
- onInitSpy.restore();
- });
-
- it('should create an instance', () => {
- assert.ok(typeof collectorExporter !== 'undefined');
- });
-
- it('should call onInit', () => {
- assert.strictEqual(onInitSpy.callCount, 1);
- assert.ok(onInitSpy.args[0][0] === collectorExporter);
- });
-
- describe('when config contains certain params', () => {
- it('should set hostName', () => {
- assert.strictEqual(collectorExporter.hostName, 'foo');
- });
-
- it('should set serviceName', () => {
- assert.strictEqual(collectorExporter.serviceName, 'bar');
- });
-
- it('should set url', () => {
- assert.strictEqual(collectorExporter.url, 'http://foo.bar.com');
- });
-
- it('should set logger', () => {
- assert.ok(collectorExporter.logger === collectorExporterConfig.logger);
- });
- });
-
- describe('when config is missing certain params', () => {
- beforeEach(() => {
- collectorExporter = new CollectorExporter();
- });
-
- it('should set default serviceName', () => {
- assert.strictEqual(collectorExporter.serviceName, 'collector-exporter');
- });
-
- it('should set default logger', () => {
- assert.ok(collectorExporter.logger instanceof NoopLogger);
- });
- });
- });
-
- describe('export', () => {
- let spySend: any;
- beforeEach(() => {
- spySend = sinon.stub(platform, 'sendSpans');
- collectorExporter = new CollectorExporter(collectorExporterConfig);
- });
- afterEach(() => {
- spySend.restore();
- });
-
- it('should export spans as collectorTypes.Spans', done => {
- const spans: ReadableSpan[] = [];
- spans.push(Object.assign({}, mockedReadableSpan));
-
- collectorExporter.export(spans, function() {});
- setTimeout(() => {
- const span1 = spySend.args[0][0][0] as ReadableSpan;
- assert.deepStrictEqual(spans[0], span1);
- done();
- });
- assert.strictEqual(spySend.callCount, 1);
- });
-
- describe('when exporter is shutdown', () => {
- it('should not export anything but return callback with code "FailedNotRetryable"', () => {
- const spans: ReadableSpan[] = [];
- spans.push(Object.assign({}, mockedReadableSpan));
- collectorExporter.shutdown();
- spySend.resetHistory();
-
- const callbackSpy = sinon.spy();
- collectorExporter.export(spans, callbackSpy);
- const returnCode = callbackSpy.args[0][0];
-
- assert.strictEqual(
- returnCode,
- ExportResult.FAILED_NOT_RETRYABLE,
- 'return value is wrong'
- );
- assert.strictEqual(spySend.callCount, 0, 'should not call send');
- });
- });
- });
-
- describe('shutdown', () => {
- let onShutdownSpy: any;
- beforeEach(() => {
- onShutdownSpy = sinon.stub(platform, 'onShutdown');
- collectorExporterConfig = {
- hostName: 'foo',
- logger: new NoopLogger(),
- serviceName: 'bar',
- attributes: {},
- url: 'http://foo.bar.com',
- };
- collectorExporter = new CollectorExporter(collectorExporterConfig);
- });
- afterEach(() => {
- onShutdownSpy.restore();
- });
-
- it('should call onShutdown', done => {
- collectorExporter.shutdown();
- setTimeout(() => {
- assert.ok(onShutdownSpy.args[0][0] === collectorExporter);
- done();
- });
- });
- });
-});
diff --git a/packages/opentelemetry-exporter-collector/test/common/transform.test.ts b/packages/opentelemetry-exporter-collector/test/common/transform.test.ts
deleted file mode 100644
index 266b83aa5c..0000000000
--- a/packages/opentelemetry-exporter-collector/test/common/transform.test.ts
+++ /dev/null
@@ -1,122 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Attributes, TimedEvent } from '@opentelemetry/api';
-import * as assert from 'assert';
-import * as transform from '../../src/transform';
-import { ensureSpanIsCorrect, mockedReadableSpan } from '../helper';
-import { Resource } from '@opentelemetry/resources';
-
-describe('transform', () => {
- describe('toCollectorAttributes', () => {
- it('should convert attribute string', () => {
- const attributes: Attributes = {
- foo: 'bar',
- };
- assert.deepStrictEqual(transform.toCollectorAttributes(attributes), [
- { key: 'foo', type: 0, stringValue: 'bar' },
- ]);
- });
-
- it('should convert attribute integer', () => {
- const attributes: Attributes = {
- foo: 13,
- };
- assert.deepStrictEqual(transform.toCollectorAttributes(attributes), [
- { key: 'foo', type: 2, doubleValue: 13 },
- ]);
- });
-
- it('should convert attribute boolean', () => {
- const attributes: Attributes = {
- foo: true,
- };
- assert.deepStrictEqual(transform.toCollectorAttributes(attributes), [
- { key: 'foo', type: 3, boolValue: true },
- ]);
- });
-
- it('should convert attribute double', () => {
- const attributes: Attributes = {
- foo: 1.34,
- };
- assert.deepStrictEqual(transform.toCollectorAttributes(attributes), [
- { key: 'foo', type: 2, doubleValue: 1.34 },
- ]);
- });
- });
-
- describe('toCollectorEvents', () => {
- it('should convert events to otc events', () => {
- const events: TimedEvent[] = [
- { name: 'foo', time: [123, 123], attributes: { a: 'b' } },
- {
- name: 'foo2',
- time: [321, 321],
- attributes: { c: 'd' },
- },
- ];
- assert.deepStrictEqual(transform.toCollectorEvents(events), [
- {
- timeUnixNano: 123000000123,
- name: 'foo',
- attributes: [{ key: 'a', type: 0, stringValue: 'b' }],
- droppedAttributesCount: 0,
- },
- {
- timeUnixNano: 321000000321,
- name: 'foo2',
- attributes: [{ key: 'c', type: 0, stringValue: 'd' }],
- droppedAttributesCount: 0,
- },
- ]);
- });
- });
-
- describe('toCollectorSpan', () => {
- it('should convert span', () => {
- ensureSpanIsCorrect(transform.toCollectorSpan(mockedReadableSpan));
- });
- });
-
- describe('toCollectorResource', () => {
- it('should convert resource', () => {
- const resource = transform.toCollectorResource(
- new Resource({
- service: 'ui',
- version: 1.0,
- success: true,
- })
- );
- assert.deepStrictEqual(resource, {
- attributes: [
- {
- key: 'service',
- type: 0,
- stringValue: 'ui',
- },
- {
- key: 'version',
- type: 2,
- doubleValue: 1,
- },
- { key: 'success', type: 3, boolValue: true },
- ],
- droppedAttributesCount: 0,
- });
- });
- });
-});
diff --git a/packages/opentelemetry-exporter-collector/test/helper.ts b/packages/opentelemetry-exporter-collector/test/helper.ts
deleted file mode 100644
index 29302aa6ad..0000000000
--- a/packages/opentelemetry-exporter-collector/test/helper.ts
+++ /dev/null
@@ -1,512 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { TraceFlags } from '@opentelemetry/api';
-import { ReadableSpan } from '@opentelemetry/tracing';
-import { Resource } from '@opentelemetry/resources';
-import * as assert from 'assert';
-import { opentelemetryProto } from '../src/types';
-import * as collectorTypes from '../src/types';
-
-if (typeof Buffer === 'undefined') {
- // @ts-ignore
- window.Buffer = {
- from: function(arr: []) {
- return new Uint8Array(arr);
- },
- };
-}
-
-const traceIdArr = [
- 31,
- 16,
- 8,
- 220,
- 142,
- 39,
- 14,
- 133,
- 196,
- 10,
- 13,
- 124,
- 57,
- 57,
- 178,
- 120,
-];
-const spanIdArr = [94, 16, 114, 97, 246, 79, 165, 62];
-const parentIdArr = [120, 168, 145, 80, 152, 134, 67, 136];
-
-const traceIdBase64 = 'HxAI3I4nDoXECg18OTmyeA==';
-const spanIdBase64 = 'XhByYfZPpT4=';
-const parentIdBase64 = 'eKiRUJiGQ4g=';
-
-export const mockedReadableSpan: ReadableSpan = {
- name: 'documentFetch',
- kind: 0,
- spanContext: {
- traceId: '1f1008dc8e270e85c40a0d7c3939b278',
- spanId: '5e107261f64fa53e',
- traceFlags: TraceFlags.SAMPLED,
- },
- parentSpanId: '78a8915098864388',
- startTime: [1574120165, 429803070],
- endTime: [1574120165, 438688070],
- ended: true,
- status: { code: 0 },
- attributes: { component: 'document-load' },
- links: [
- {
- context: {
- traceId: '1f1008dc8e270e85c40a0d7c3939b278',
- spanId: '78a8915098864388',
- },
- attributes: { component: 'document-load' },
- },
- ],
- events: [
- { name: 'fetchStart', time: [1574120165, 429803070] },
- {
- name: 'domainLookupStart',
- time: [1574120165, 429803070],
- },
- { name: 'domainLookupEnd', time: [1574120165, 429803070] },
- {
- name: 'connectStart',
- time: [1574120165, 429803070],
- },
- { name: 'connectEnd', time: [1574120165, 429803070] },
- {
- name: 'requestStart',
- time: [1574120165, 435513070],
- },
- { name: 'responseStart', time: [1574120165, 436923070] },
- {
- name: 'responseEnd',
- time: [1574120165, 438688070],
- },
- ],
- duration: [0, 8885000],
- resource: new Resource({
- service: 'ui',
- version: 1,
- cost: 112.12,
- }),
-};
-
-export function ensureExportedEventsAreCorrect(
- events: opentelemetryProto.trace.v1.Span.Event[]
-) {
- assert.deepStrictEqual(
- events,
- [
- {
- attributes: [],
- timeUnixNano: '1574120165429803008',
- name: 'fetchStart',
- droppedAttributesCount: 0,
- },
- {
- attributes: [],
- timeUnixNano: '1574120165429803008',
- name: 'domainLookupStart',
- droppedAttributesCount: 0,
- },
- {
- attributes: [],
- timeUnixNano: '1574120165429803008',
- name: 'domainLookupEnd',
- droppedAttributesCount: 0,
- },
- {
- attributes: [],
- timeUnixNano: '1574120165429803008',
- name: 'connectStart',
- droppedAttributesCount: 0,
- },
- {
- attributes: [],
- timeUnixNano: '1574120165429803008',
- name: 'connectEnd',
- droppedAttributesCount: 0,
- },
- {
- attributes: [],
- timeUnixNano: '1574120165435513088',
- name: 'requestStart',
- droppedAttributesCount: 0,
- },
- {
- attributes: [],
- timeUnixNano: '1574120165436923136',
- name: 'responseStart',
- droppedAttributesCount: 0,
- },
- {
- attributes: [],
- timeUnixNano: '1574120165438688000',
- name: 'responseEnd',
- droppedAttributesCount: 0,
- },
- ],
- 'exported events are incorrect'
- );
-}
-
-export function ensureExportedAttributesAreCorrect(
- attributes: opentelemetryProto.common.v1.AttributeKeyValue[]
-) {
- assert.deepStrictEqual(
- attributes,
- [
- {
- key: 'component',
- type: 'STRING',
- stringValue: 'document-load',
- intValue: '0',
- doubleValue: 0,
- boolValue: false,
- },
- ],
- 'exported attributes are incorrect'
- );
-}
-
-export function ensureExportedLinksAreCorrect(
- attributes: opentelemetryProto.trace.v1.Span.Link[]
-) {
- assert.deepStrictEqual(
- attributes,
- [
- {
- attributes: [
- {
- key: 'component',
- type: 'STRING',
- stringValue: 'document-load',
- intValue: '0',
- doubleValue: 0,
- boolValue: false,
- },
- ],
- traceId: Buffer.from(traceIdArr),
- spanId: Buffer.from(parentIdArr),
- traceState: '',
- droppedAttributesCount: 0,
- },
- ],
- 'exported links are incorrect'
- );
-}
-
-export function ensureEventsAreCorrect(
- events: opentelemetryProto.trace.v1.Span.Event[]
-) {
- assert.deepStrictEqual(
- events,
- [
- {
- timeUnixNano: 1574120165429803000,
- name: 'fetchStart',
- attributes: [],
- droppedAttributesCount: 0,
- },
- {
- timeUnixNano: 1574120165429803000,
- name: 'domainLookupStart',
- attributes: [],
- droppedAttributesCount: 0,
- },
- {
- timeUnixNano: 1574120165429803000,
- name: 'domainLookupEnd',
- attributes: [],
- droppedAttributesCount: 0,
- },
- {
- timeUnixNano: 1574120165429803000,
- name: 'connectStart',
- attributes: [],
- droppedAttributesCount: 0,
- },
- {
- timeUnixNano: 1574120165429803000,
- name: 'connectEnd',
- attributes: [],
- droppedAttributesCount: 0,
- },
- {
- timeUnixNano: 1574120165435513000,
- name: 'requestStart',
- attributes: [],
- droppedAttributesCount: 0,
- },
- {
- timeUnixNano: 1574120165436923100,
- name: 'responseStart',
- attributes: [],
- droppedAttributesCount: 0,
- },
- {
- timeUnixNano: 1574120165438688000,
- name: 'responseEnd',
- attributes: [],
- droppedAttributesCount: 0,
- },
- ],
- 'events are incorrect'
- );
-}
-
-export function ensureAttributesAreCorrect(
- attributes: opentelemetryProto.common.v1.AttributeKeyValue[]
-) {
- assert.deepStrictEqual(
- attributes,
- [
- {
- key: 'component',
- type: 0,
- stringValue: 'document-load',
- },
- ],
- 'attributes are incorrect'
- );
-}
-
-export function ensureLinksAreCorrect(
- attributes: opentelemetryProto.trace.v1.Span.Link[]
-) {
- assert.deepStrictEqual(
- attributes,
- [
- {
- traceId: traceIdBase64,
- spanId: parentIdBase64,
- attributes: [
- {
- key: 'component',
- type: 0,
- stringValue: 'document-load',
- },
- ],
- droppedAttributesCount: 0,
- },
- ],
- 'links are incorrect'
- );
-}
-
-export function ensureSpanIsCorrect(
- span: collectorTypes.opentelemetryProto.trace.v1.Span
-) {
- if (span.attributes) {
- ensureAttributesAreCorrect(span.attributes);
- }
- if (span.events) {
- ensureEventsAreCorrect(span.events);
- }
- if (span.links) {
- ensureLinksAreCorrect(span.links);
- }
- assert.deepStrictEqual(span.traceId, traceIdBase64, 'traceId is wrong');
- assert.deepStrictEqual(span.spanId, spanIdBase64, 'spanId is wrong');
- assert.deepStrictEqual(
- span.parentSpanId,
- parentIdBase64,
- 'parentIdArr is wrong'
- );
- assert.strictEqual(span.name, 'documentFetch', 'name is wrong');
- assert.strictEqual(
- span.kind,
- opentelemetryProto.trace.v1.Span.SpanKind.INTERNAL,
- 'kind is wrong'
- );
- assert.strictEqual(
- span.startTimeUnixNano,
- 1574120165429803008,
- 'startTimeUnixNano is wrong'
- );
- assert.strictEqual(
- span.endTimeUnixNano,
- 1574120165438688000,
- 'endTimeUnixNano is wrong'
- );
- assert.strictEqual(
- span.droppedAttributesCount,
- 0,
- 'droppedAttributesCount is wrong'
- );
- assert.strictEqual(span.droppedEventsCount, 0, 'droppedEventsCount is wrong');
- assert.strictEqual(span.droppedLinksCount, 0, 'droppedLinksCount is wrong');
- assert.deepStrictEqual(span.status, { code: 0 }, 'status is wrong');
-}
-
-export function ensureExportedSpanIsCorrect(
- span: collectorTypes.opentelemetryProto.trace.v1.Span
-) {
- if (span.attributes) {
- ensureExportedAttributesAreCorrect(span.attributes);
- }
- if (span.events) {
- ensureExportedEventsAreCorrect(span.events);
- }
- if (span.links) {
- ensureExportedLinksAreCorrect(span.links);
- }
- assert.deepStrictEqual(
- span.traceId,
- Buffer.from(traceIdArr),
- 'traceId is wrong'
- );
- assert.deepStrictEqual(
- span.spanId,
- Buffer.from(spanIdArr),
- 'spanId is wrong'
- );
- assert.strictEqual(span.traceState, '', 'traceState is wrong');
- assert.deepStrictEqual(
- span.parentSpanId,
- Buffer.from(parentIdArr),
- 'parentIdArr is wrong'
- );
- assert.strictEqual(span.name, 'documentFetch', 'name is wrong');
- assert.strictEqual(span.kind, 'INTERNAL', 'kind is wrong');
- assert.strictEqual(
- span.startTimeUnixNano,
- '1574120165429803008',
- 'startTimeUnixNano is wrong'
- );
- assert.strictEqual(
- span.endTimeUnixNano,
- '1574120165438688000',
- 'endTimeUnixNano is wrong'
- );
- assert.strictEqual(
- span.droppedAttributesCount,
- 0,
- 'droppedAttributesCount is wrong'
- );
- assert.strictEqual(span.droppedEventsCount, 0, 'droppedEventsCount is wrong');
- assert.strictEqual(span.droppedLinksCount, 0, 'droppedLinksCount is wrong');
- assert.deepStrictEqual(
- span.status,
- { code: 'Ok', message: '' },
- 'status is wrong'
- );
-}
-
-export function ensureWebResourceIsCorrect(
- resource: collectorTypes.opentelemetryProto.resource.v1.Resource
-) {
- assert.deepStrictEqual(resource, {
- attributes: [
- {
- key: 'service.name',
- type: 0,
- stringValue: 'bar',
- },
- {
- key: 'service',
- type: 0,
- stringValue: 'ui',
- },
- { key: 'version', type: 2, doubleValue: 1 },
- {
- key: 'cost',
- type: 2,
- doubleValue: 112.12,
- },
- ],
- droppedAttributesCount: 0,
- });
-}
-
-export function ensureResourceIsCorrect(
- resource: collectorTypes.opentelemetryProto.resource.v1.Resource
-) {
- assert.deepStrictEqual(resource, {
- attributes: [
- {
- key: 'service.name',
- type: 'STRING',
- stringValue: 'basic-service',
- intValue: '0',
- doubleValue: 0,
- boolValue: false,
- },
- {
- key: 'service',
- type: 'STRING',
- stringValue: 'ui',
- intValue: '0',
- doubleValue: 0,
- boolValue: false,
- },
- {
- key: 'version',
- type: 'DOUBLE',
- stringValue: '',
- intValue: '0',
- doubleValue: 1,
- boolValue: false,
- },
- {
- key: 'cost',
- type: 'DOUBLE',
- stringValue: '',
- intValue: '0',
- doubleValue: 112.12,
- boolValue: false,
- },
- ],
- droppedAttributesCount: 0,
- });
-}
-
-export function ensureExportTraceServiceRequestIsSet(
- json: collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest
-) {
- const resourceSpans = json.resourceSpans;
- assert.strictEqual(
- resourceSpans && resourceSpans.length,
- 1,
- 'resourceSpans is missing'
- );
-
- const resource = resourceSpans[0].resource;
- assert.strictEqual(!!resource, true, 'resource is missing');
-
- const instrumentationLibrarySpans =
- resourceSpans[0].instrumentationLibrarySpans;
- assert.strictEqual(
- instrumentationLibrarySpans && instrumentationLibrarySpans.length,
- 1,
- 'instrumentationLibrarySpans is missing'
- );
-
- const instrumentationLibrary =
- instrumentationLibrarySpans[0].instrumentationLibrary;
- assert.strictEqual(
- !!instrumentationLibrary,
- true,
- 'instrumentationLibrary is missing'
- );
-
- const spans = instrumentationLibrarySpans[0].spans;
- assert.strictEqual(spans && spans.length, 1, 'spans are missing');
-}
diff --git a/packages/opentelemetry-exporter-collector/test/node/CollectorExporter.test.ts b/packages/opentelemetry-exporter-collector/test/node/CollectorExporter.test.ts
deleted file mode 100644
index 027b3d7af0..0000000000
--- a/packages/opentelemetry-exporter-collector/test/node/CollectorExporter.test.ts
+++ /dev/null
@@ -1,130 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as protoLoader from '@grpc/proto-loader';
-import * as grpc from 'grpc';
-import * as path from 'path';
-import {
- BasicTracerProvider,
- SimpleSpanProcessor,
-} from '@opentelemetry/tracing';
-
-import * as assert from 'assert';
-import * as sinon from 'sinon';
-import { CollectorExporter } from '../../src/CollectorExporter';
-import * as collectorTypes from '../../src/types';
-
-import {
- ensureResourceIsCorrect,
- ensureExportedSpanIsCorrect,
- mockedReadableSpan,
-} from '../helper';
-
-const traceServiceProtoPath =
- 'opentelemetry/proto/collector/trace/v1/trace_service.proto';
-const includeDirs = [path.resolve(__dirname, '../../src/platform/node/protos')];
-
-const address = '127.0.0.1:1501';
-
-describe('CollectorExporter - node', () => {
- let collectorExporter: CollectorExporter;
- let server: grpc.Server;
- let exportedData:
- | collectorTypes.opentelemetryProto.trace.v1.ResourceSpans
- | undefined;
-
- before(done => {
- server = new grpc.Server();
- protoLoader
- .load(traceServiceProtoPath, {
- keepCase: false,
- longs: String,
- enums: String,
- defaults: true,
- oneofs: true,
- includeDirs,
- })
- .then((packageDefinition: protoLoader.PackageDefinition) => {
- const packageObject: any = grpc.loadPackageDefinition(
- packageDefinition
- );
- server.addService(
- packageObject.opentelemetry.proto.collector.trace.v1.TraceService
- .service,
- {
- Export: (data: {
- request: collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest;
- }) => {
- try {
- exportedData = data.request.resourceSpans[0];
- } catch (e) {
- exportedData = undefined;
- }
- },
- }
- );
- server.bind(address, grpc.ServerCredentials.createInsecure());
- server.start();
- done();
- });
- });
-
- after(() => {
- server.forceShutdown();
- });
-
- beforeEach(done => {
- collectorExporter = new CollectorExporter({
- serviceName: 'basic-service',
- url: address,
- });
-
- const provider = new BasicTracerProvider();
- provider.addSpanProcessor(new SimpleSpanProcessor(collectorExporter));
- done();
- });
-
- afterEach(() => {
- exportedData = undefined;
- });
-
- describe('export', () => {
- it('should export spans', done => {
- const responseSpy = sinon.spy();
- const spans = [Object.assign({}, mockedReadableSpan)];
- collectorExporter.export(spans, responseSpy);
- setTimeout(() => {
- assert.ok(
- typeof exportedData !== 'undefined',
- 'resource' + " doesn't exist"
- );
- let spans;
- let resource;
- if (exportedData) {
- spans = exportedData.instrumentationLibrarySpans[0].spans;
- resource = exportedData.resource;
- ensureExportedSpanIsCorrect(spans[0]);
-
- assert.ok(typeof resource !== 'undefined', "resource doesn't exist");
- if (resource) {
- ensureResourceIsCorrect(resource);
- }
- }
- done();
- }, 200);
- });
- });
-});
diff --git a/packages/opentelemetry-exporter-jaeger/README.md b/packages/opentelemetry-exporter-jaeger/README.md
deleted file mode 100644
index ad8c0a88e0..0000000000
--- a/packages/opentelemetry-exporter-jaeger/README.md
+++ /dev/null
@@ -1,106 +0,0 @@
-# OpenTelemetry Jaeger Trace Exporter
-
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![devDependencies][devDependencies-image]][devDependencies-url]
-[![Apache License][license-image]][license-image]
-
-OpenTelemetry Jaeger Trace Exporter allows the user to send collected traces to Jaeger.
-
-[Jaeger](https://jaeger.readthedocs.io/en/latest/), inspired by [Dapper](https://research.google.com/pubs/pub36356.html) and [OpenZipkin](http://zipkin.io/), is a distributed tracing system released as open source by [Uber Technologies](http://uber.github.io/). It is used for monitoring and troubleshooting microservices-based distributed systems, including:
-
-- Distributed context propagation
-- Distributed transaction monitoring
-- Root cause analysis
-- Service dependency analysis
-- Performance / latency optimization
-
-## Prerequisites
-
-Get up and running with Jaeger in your local environment.
-
-[Jaeger](https://www.jaegertracing.io/docs/latest/) stores and queries traces exported by
-applications instrumented with OpenTelemetry. The easiest way to [start a Jaeger
-server](https://www.jaegertracing.io/docs/latest/getting-started/) is to paste the below:
-
-```bash
-docker run -d --name jaeger \
- -e COLLECTOR_ZIPKIN_HTTP_PORT=9411 \
- -p 5775:5775/udp \
- -p 6831:6831/udp \
- -p 6832:6832/udp \
- -p 5778:5778 \
- -p 16686:16686 \
- -p 14268:14268 \
- -p 9411:9411 \
- jaegertracing/all-in-one:latest
-```
-
-Or run the `jaeger-all-in-one(.exe)` executable from the [binary distribution archives](https://www.jaegertracing.io/download/):
-
-```bash
-jaeger-all-in-one --collector.zipkin.http-port=9411
-```
-
-You can then navigate to http://localhost:16686 to access the Jaeger UI.
-
-## Installation
-
-```bash
-npm install --save @opentelemetry/exporter-jaeger
-```
-
-## Usage
-
-Install the exporter on your application and pass the options, it must contain a service name.
-
-Furthermore, the `host` option (which defaults to `localhost`), can instead be set by the
-`JAEGER_AGENT_HOST` environment variable to reduce in-code config. If both are
-set, the value set by the option in code is authoritative.
-
-```js
-import { JaegerExporter } from '@opentelemetry/exporter-jaeger';
-
-const options = {
- serviceName: 'my-service',
- tags: [], // optional
- host: 'localhost', // optional
- port: 6832, // optional
- maxPacketSize: 65000 // optional
-}
-const exporter = new JaegerExporter(options);
-```
-
-Now, register the exporter.
-
-```js
-tracer.addSpanProcessor(new BatchSpanProcessor(exporter));
-```
-
-You can use built-in `SimpleSpanProcessor` or `BatchSpanProcessor` or write your own.
-
-- [SimpleSpanProcessor](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/sdk-tracing.md#simple-processor): The implementation of `SpanProcessor` that passes ended span directly to the configured `SpanExporter`.
-- [BatchSpanProcessor](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/sdk-tracing.md#batching-processor): The implementation of the `SpanProcessor` that batches ended spans and pushes them to the configured `SpanExporter`. It is recommended to use this `SpanProcessor` for better performance and optimization.
-
-## Useful links
-
-- To know more about Jaeger, visit: https://www.jaegertracing.io/docs/latest/getting-started/
-- For more information on OpenTelemetry, visit:
-- For more about OpenTelemetry JavaScript:
-- For help or feedback on this project, join us on [gitter][gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-exporter-jaeger
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-jaeger
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-exporter-jaeger
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-jaeger&type=dev
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-jaeger
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-jaeger.svg
diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json
deleted file mode 100644
index 7148a4786b..0000000000
--- a/packages/opentelemetry-exporter-jaeger/package.json
+++ /dev/null
@@ -1,65 +0,0 @@
-{
- "name": "@opentelemetry/exporter-jaeger",
- "version": "0.6.1",
- "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": {
- "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": "gts check",
- "lint:fix": "gts 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"
- },
- "keywords": [
- "opentelemetry",
- "nodejs",
- "tracing",
- "profiling",
- "jaeger"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@opentelemetry/resources": "^0.6.1",
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.9",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "mocha": "^6.2.0",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "3.7.2"
- },
- "dependencies": {
- "@opentelemetry/api": "^0.6.1",
- "@opentelemetry/base": "^0.6.1",
- "@opentelemetry/core": "^0.6.1",
- "@opentelemetry/tracing": "^0.6.1",
- "jaeger-client": "^3.15.0"
- }
-}
diff --git a/packages/opentelemetry-exporter-jaeger/src/index.ts b/packages/opentelemetry-exporter-jaeger/src/index.ts
deleted file mode 100644
index 0eeb94aad7..0000000000
--- a/packages/opentelemetry-exporter-jaeger/src/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './jaeger';
diff --git a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts
deleted file mode 100644
index 83f6658492..0000000000
--- a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts
+++ /dev/null
@@ -1,125 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as api from '@opentelemetry/api';
-import { ExportResult } from '@opentelemetry/base';
-import { NoopLogger } from '@opentelemetry/core';
-import { ReadableSpan, SpanExporter } from '@opentelemetry/tracing';
-import { Socket } from 'dgram';
-import { spanToThrift } from './transform';
-import * as jaegerTypes from './types';
-
-/**
- * Format and sends span information to Jaeger Exporter.
- */
-export class JaegerExporter implements SpanExporter {
- private readonly _logger: api.Logger;
- private readonly _process: jaegerTypes.ThriftProcess;
- private readonly _sender: typeof jaegerTypes.UDPSender;
- private readonly _onShutdownFlushTimeout: number;
-
- constructor(config: jaegerTypes.ExporterConfig) {
- this._logger = config.logger || new NoopLogger();
- const tags: jaegerTypes.Tag[] = config.tags || [];
- this._onShutdownFlushTimeout =
- typeof config.flushTimeout === 'number' ? config.flushTimeout : 2000;
-
- config.host = config.host || process.env.JAEGER_AGENT_HOST;
-
- this._sender = new jaegerTypes.UDPSender(config);
- if (this._sender._client instanceof Socket) {
- // unref socket to prevent it from keeping the process running
- this._sender._client.unref();
- }
-
- this._process = {
- serviceName: config.serviceName,
- tags: jaegerTypes.ThriftUtils.getThriftTags(tags),
- };
- this._sender.setProcess(this._process);
- }
-
- /** Exports a list of spans to Jaeger. */
- export(
- spans: ReadableSpan[],
- resultCallback: (result: ExportResult) => void
- ): void {
- if (spans.length === 0) {
- return resultCallback(ExportResult.SUCCESS);
- }
- this._logger.debug('Jaeger exporter export');
- this._sendSpans(spans, resultCallback).catch(err => {
- this._logger.error(`JaegerExporter failed to export: ${err}`);
- });
- }
-
- /** Shutdown exporter. */
- shutdown(): void {
- // Make an optimistic flush.
- this._flush();
- // Sleeping x seconds before closing the sender's connection to ensure
- // all spans are flushed.
- setTimeout(() => {
- this._sender.close();
- }, this._onShutdownFlushTimeout);
- }
-
- /** Transform spans and sends to Jaeger service. */
- private async _sendSpans(
- spans: ReadableSpan[],
- done?: (result: ExportResult) => void
- ) {
- const thriftSpan = spans.map(span => spanToThrift(span));
- for (const span of thriftSpan) {
- try {
- await this._append(span);
- } catch (err) {
- this._logger.error(`failed to append span: ${err}`);
- // TODO right now we break out on first error, is that desirable?
- if (done) return done(ExportResult.FAILED_NOT_RETRYABLE);
- }
- }
- this._logger.debug('successful append for : %s', thriftSpan.length);
-
- // Flush all spans on each export. No-op if span buffer is empty
- await this._flush();
-
- if (done) return done(ExportResult.SUCCESS);
- }
-
- private async _append(span: jaegerTypes.ThriftSpan): Promise {
- return new Promise((resolve, reject) => {
- this._sender.append(span, (count: number, err?: string) => {
- if (err) {
- return reject(new Error(err));
- }
- resolve(count);
- });
- });
- }
-
- private async _flush(): Promise {
- await new Promise((resolve, reject) => {
- this._sender.flush((_count: number, err?: string) => {
- if (err) {
- return reject(new Error(err));
- }
- this._logger.debug('successful flush for %s spans', _count);
- resolve();
- });
- });
- }
-}
diff --git a/packages/opentelemetry-exporter-jaeger/src/transform.ts b/packages/opentelemetry-exporter-jaeger/src/transform.ts
deleted file mode 100644
index 668576ce6e..0000000000
--- a/packages/opentelemetry-exporter-jaeger/src/transform.ts
+++ /dev/null
@@ -1,134 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Link, CanonicalCode, SpanKind } from '@opentelemetry/api';
-import { ReadableSpan } from '@opentelemetry/tracing';
-import {
- hrTimeToMilliseconds,
- hrTimeToMicroseconds,
-} from '@opentelemetry/core';
-import {
- ThriftSpan,
- Tag,
- Log,
- ThriftTag,
- ThriftLog,
- ThriftUtils,
- Utils,
- ThriftReference,
- TagValue,
- ThriftReferenceType,
-} from './types';
-
-const DEFAULT_FLAGS = 0x1;
-
-/**
- * Translate OpenTelemetry ReadableSpan to Jaeger Thrift Span
- * @param span Span to be translated
- */
-export function spanToThrift(span: ReadableSpan): ThriftSpan {
- const traceId = span.spanContext.traceId.padStart(32, '0');
- const traceIdHigh = traceId.slice(0, 16);
- const traceIdLow = traceId.slice(16);
- const parentSpan = span.parentSpanId
- ? Utils.encodeInt64(span.parentSpanId)
- : ThriftUtils.emptyBuffer;
-
- const tags = Object.keys(span.attributes).map(
- (name): Tag => ({ key: name, value: toTagValue(span.attributes[name]) })
- );
- tags.push({ key: 'status.code', value: span.status.code });
- tags.push({ key: 'status.name', value: CanonicalCode[span.status.code] });
- 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
- // Jaeger span.
- if (span.status.code !== CanonicalCode.OK) {
- tags.push({ key: 'error', value: true });
- }
-
- if (span.kind !== undefined) {
- tags.push({ key: 'span.kind', value: SpanKind[span.kind] });
- }
- Object.keys(span.resource.labels).forEach(name =>
- tags.push({
- key: name,
- value: toTagValue(span.resource.labels[name]),
- })
- );
-
- const spanTags: ThriftTag[] = ThriftUtils.getThriftTags(tags);
-
- const logs = span.events.map(
- (event): Log => {
- const fields: Tag[] = [{ key: 'message.id', value: event.name }];
- const attrs = event.attributes;
- if (attrs) {
- Object.keys(attrs).forEach(attr =>
- fields.push({ key: attr, value: toTagValue(attrs[attr]) })
- );
- }
- return { timestamp: hrTimeToMilliseconds(event.time), fields };
- }
- );
- const spanLogs: ThriftLog[] = ThriftUtils.getThriftLogs(logs);
-
- return {
- traceIdLow: Utils.encodeInt64(traceIdLow),
- traceIdHigh: Utils.encodeInt64(traceIdHigh),
- spanId: Utils.encodeInt64(span.spanContext.spanId),
- parentSpanId: parentSpan,
- operationName: span.name,
- references: spanLinksToThriftRefs(span.links, span.parentSpanId),
- flags: span.spanContext.traceFlags || DEFAULT_FLAGS,
- startTime: Utils.encodeInt64(hrTimeToMicroseconds(span.startTime)),
- duration: Utils.encodeInt64(hrTimeToMicroseconds(span.duration)),
- tags: spanTags,
- logs: spanLogs,
- };
-}
-
-/** Translate OpenTelemetry {@link Link}s to Jaeger ThriftReference. */
-function spanLinksToThriftRefs(
- links: Link[],
- parentSpanId?: string
-): ThriftReference[] {
- return links
- .map((link): ThriftReference | null => {
- if (link.context.spanId === parentSpanId) {
- const refType = ThriftReferenceType.CHILD_OF;
- const traceId = link.context.traceId;
- const traceIdHigh = Utils.encodeInt64(traceId.slice(0, 16));
- const traceIdLow = Utils.encodeInt64(traceId.slice(16));
- const spanId = Utils.encodeInt64(link.context.spanId);
- return { traceIdLow, traceIdHigh, spanId, refType };
- }
- return null;
- })
- .filter(ref => !!ref) as ThriftReference[];
-}
-
-/** Translate OpenTelemetry attribute value to Jaeger TagValue. */
-function toTagValue(value: unknown): TagValue {
- const valueType = typeof value;
- if (valueType === 'boolean') {
- return value as boolean;
- } else if (valueType === 'number') {
- return value as number;
- }
- return String(value);
-}
diff --git a/packages/opentelemetry-exporter-jaeger/src/types.ts b/packages/opentelemetry-exporter-jaeger/src/types.ts
deleted file mode 100644
index c902cfd309..0000000000
--- a/packages/opentelemetry-exporter-jaeger/src/types.ts
+++ /dev/null
@@ -1,100 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as types from '@opentelemetry/api';
-
-/**
- * Options for Jaeger configuration
- */
-export interface ExporterConfig {
- logger?: types.Logger;
- serviceName: string;
- tags?: Tag[];
- host?: string; // default: 'localhost'
- port?: number; // default: 6832
- maxPacketSize?: number; // default: 65000
- /** Time to wait for an onShutdown flush to finish before closing the sender */
- flushTimeout?: number; // default: 2000
-}
-
-// Below require is needed as jaeger-client types does not expose the thrift,
-// udp_sender, util etc. modules.
-
-// tslint:disable-next-line:variable-name
-export const UDPSender = require('jaeger-client/dist/src/reporters/udp_sender')
- .default;
-// tslint:disable-next-line:variable-name
-export const Utils = require('jaeger-client/dist/src/util').default;
-// tslint:disable-next-line:variable-name
-export const ThriftUtils = require('jaeger-client/dist/src/thrift').default;
-
-export type TagValue = string | number | boolean;
-
-export interface Tag {
- key: string;
- value: TagValue;
-}
-
-export interface Log {
- timestamp: number;
- fields: Tag[];
-}
-
-export type SenderCallback = (numSpans: number, err?: string) => void;
-
-export interface ThriftProcess {
- serviceName: string;
- tags: ThriftTag[];
-}
-
-export interface ThriftTag {
- key: string;
- vType: string;
- vStr: string;
- vDouble: number;
- vBool: boolean;
-}
-
-export interface ThriftLog {
- timestamp: number;
- fields: ThriftTag[];
-}
-
-export enum ThriftReferenceType {
- CHILD_OF = 'CHILD_OF',
- FOLLOWS_FROM = 'FOLLOWS_FROM',
-}
-
-export interface ThriftReference {
- traceIdLow: Buffer;
- traceIdHigh: Buffer;
- spanId: Buffer;
- refType: ThriftReferenceType;
-}
-
-export interface ThriftSpan {
- traceIdLow: Buffer;
- traceIdHigh: Buffer;
- spanId: Buffer;
- parentSpanId: string | Buffer;
- operationName: string;
- references: ThriftReference[];
- flags: number;
- startTime: number; // milliseconds
- duration: number; // milliseconds
- tags: ThriftTag[];
- logs: ThriftLog[];
-}
diff --git a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts
deleted file mode 100644
index 53105fd3ce..0000000000
--- a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts
+++ /dev/null
@@ -1,154 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import { JaegerExporter } from '../src';
-import { NoopLogger } from '@opentelemetry/core';
-import * as types from '@opentelemetry/api';
-import { ThriftProcess } from '../src/types';
-import { ReadableSpan } from '@opentelemetry/tracing';
-import { ExportResult } from '@opentelemetry/base';
-import { TraceFlags } from '@opentelemetry/api';
-import { Resource } from '@opentelemetry/resources';
-
-describe('JaegerExporter', () => {
- describe('constructor', () => {
- afterEach(() => {
- delete process.env.JAEGER_AGENT_HOST;
- });
-
- it('should construct an exporter', () => {
- const exporter = new JaegerExporter({ serviceName: 'opentelemetry' });
- assert.ok(typeof exporter.export === 'function');
- assert.ok(typeof exporter.shutdown === 'function');
- const process: ThriftProcess = exporter['_sender']._process;
- assert.strictEqual(process.serviceName, 'opentelemetry');
- assert.strictEqual(process.tags.length, 0);
- });
-
- it('should construct an exporter with host, port, logger and tags', () => {
- const exporter = new JaegerExporter({
- serviceName: 'opentelemetry',
- host: 'remotehost',
- port: 8080,
- logger: new NoopLogger(),
- tags: [{ key: 'opentelemetry-exporter-jaeger', value: '0.1.0' }],
- });
- assert.ok(typeof exporter.export === 'function');
- assert.ok(typeof exporter.shutdown === 'function');
-
- const process: ThriftProcess = exporter['_sender']._process;
- assert.strictEqual(exporter['_sender']._host, 'remotehost');
- assert.strictEqual(process.serviceName, 'opentelemetry');
- assert.strictEqual(process.tags.length, 1);
- assert.strictEqual(process.tags[0].key, 'opentelemetry-exporter-jaeger');
- assert.strictEqual(process.tags[0].vType, 'STRING');
- assert.strictEqual(process.tags[0].vStr, '0.1.0');
- });
-
- it('should default to localhost if no host is configured', () => {
- const exporter = new JaegerExporter({
- serviceName: 'opentelemetry',
- });
- assert.strictEqual(exporter['_sender']._host, 'localhost');
- });
-
- it('should respect jaeger host env variable', () => {
- process.env.JAEGER_AGENT_HOST = 'env-set-host';
- const exporter = new JaegerExporter({
- serviceName: 'test-service',
- });
- assert.strictEqual(exporter['_sender']._host, 'env-set-host');
- });
-
- it('should prioritize host option over env variable', () => {
- process.env.JAEGER_AGENT_HOST = 'env-set-host';
- const exporter = new JaegerExporter({
- serviceName: 'test-service',
- host: 'option-set-host',
- });
- assert.strictEqual(exporter['_sender']._host, 'option-set-host');
- });
-
- it('should construct an exporter with flushTimeout', () => {
- const exporter = new JaegerExporter({
- serviceName: 'opentelemetry',
- flushTimeout: 5000,
- });
- assert.ok(typeof exporter.export === 'function');
- assert.ok(typeof exporter.shutdown === 'function');
-
- assert.strictEqual(exporter['_onShutdownFlushTimeout'], 5000);
- });
-
- it('should construct an exporter without flushTimeout', () => {
- const exporter = new JaegerExporter({
- serviceName: 'opentelemetry',
- });
- assert.ok(typeof exporter.export === 'function');
- assert.ok(typeof exporter.shutdown === 'function');
-
- assert.strictEqual(exporter['_onShutdownFlushTimeout'], 2000);
- });
- });
-
- describe('export', () => {
- let exporter: JaegerExporter;
- beforeEach(() => {
- exporter = new JaegerExporter({
- serviceName: 'opentelemetry',
- });
- });
-
- afterEach(() => {
- exporter.shutdown();
- });
-
- it('should skip send with empty list', () => {
- exporter.export([], (result: ExportResult) => {
- assert.strictEqual(result, ExportResult.SUCCESS);
- });
- });
-
- it('should send spans to Jaeger backend and return with Success', () => {
- const spanContext = {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.NONE,
- };
- const readableSpan: ReadableSpan = {
- name: 'my-span1',
- kind: types.SpanKind.CLIENT,
- spanContext,
- startTime: [1566156729, 709],
- endTime: [1566156731, 709],
- ended: true,
- status: {
- code: types.CanonicalCode.DATA_LOSS,
- },
- attributes: {},
- links: [],
- events: [],
- duration: [32, 800000000],
- resource: Resource.empty(),
- };
-
- exporter.export([readableSpan], (result: ExportResult) => {
- assert.strictEqual(result, ExportResult.SUCCESS);
- });
- });
- });
-});
diff --git a/packages/opentelemetry-exporter-jaeger/test/transform.test.ts b/packages/opentelemetry-exporter-jaeger/test/transform.test.ts
deleted file mode 100644
index c79fb6d1b6..0000000000
--- a/packages/opentelemetry-exporter-jaeger/test/transform.test.ts
+++ /dev/null
@@ -1,290 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import { spanToThrift } from '../src/transform';
-import { ReadableSpan } from '@opentelemetry/tracing';
-import { Resource } from '@opentelemetry/resources';
-import * as types from '@opentelemetry/api';
-import { ThriftUtils, Utils, ThriftReferenceType } from '../src/types';
-import { hrTimeToMicroseconds } from '@opentelemetry/core';
-import { TraceFlags } from '@opentelemetry/api';
-
-describe('transform', () => {
- const spanContext = {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.NONE,
- };
-
- describe('spanToThrift', () => {
- it('should convert an OpenTelemetry span to a Thrift', () => {
- const readableSpan: ReadableSpan = {
- name: 'my-span',
- kind: types.SpanKind.INTERNAL,
- spanContext,
- startTime: [1566156729, 709],
- endTime: [1566156731, 709],
- ended: true,
- status: {
- code: types.CanonicalCode.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,
- }),
- };
-
- const thriftSpan = spanToThrift(readableSpan);
- const result = ThriftUtils._thrift.Span.rw.toBuffer(thriftSpan);
- assert.strictEqual(result.err, null);
- assert.deepStrictEqual(thriftSpan.operationName, 'my-span');
- assert.deepStrictEqual(
- thriftSpan.traceIdLow.toString('hex'),
- '92b449d5929fda1b'
- );
- assert.deepStrictEqual(
- thriftSpan.traceIdHigh.toString('hex'),
- 'd4cda95b652f4a15'
- );
- assert.deepStrictEqual(
- thriftSpan.spanId.toString('hex'),
- '6e0c63257de34c92'
- );
- assert.deepStrictEqual(thriftSpan.parentSpanId, ThriftUtils.emptyBuffer);
- assert.deepStrictEqual(thriftSpan.flags, 1);
- assert.deepStrictEqual(
- thriftSpan.startTime,
- Utils.encodeInt64(hrTimeToMicroseconds(readableSpan.startTime))
- );
- assert.strictEqual(thriftSpan.tags.length, 9);
- const [
- tag1,
- tag2,
- tag3,
- tag4,
- tag5,
- tag6,
- tag7,
- tag8,
- tag9,
- ] = thriftSpan.tags;
- assert.strictEqual(tag1.key, 'testBool');
- assert.strictEqual(tag1.vType, 'BOOL');
- assert.strictEqual(tag1.vBool, true);
- assert.strictEqual(tag2.key, 'testString');
- assert.strictEqual(tag2.vType, 'STRING');
- assert.strictEqual(tag2.vStr, 'test');
- assert.strictEqual(tag3.key, 'testNum');
- assert.strictEqual(tag3.vType, 'DOUBLE');
- assert.strictEqual(tag3.vDouble, 3.142);
- assert.strictEqual(tag4.key, 'status.code');
- assert.strictEqual(tag4.vType, 'DOUBLE');
- assert.strictEqual(tag4.vDouble, 0);
- assert.strictEqual(tag5.key, 'status.name');
- assert.strictEqual(tag5.vType, 'STRING');
- assert.strictEqual(tag5.vStr, 'OK');
- assert.strictEqual(tag6.key, 'span.kind');
- assert.strictEqual(tag6.vType, 'STRING');
- assert.strictEqual(tag6.vStr, 'INTERNAL');
- assert.strictEqual(tag7.key, 'service');
- assert.strictEqual(tag7.vType, 'STRING');
- assert.strictEqual(tag7.vStr, 'ui');
- assert.strictEqual(tag8.key, 'version');
- assert.strictEqual(tag8.vType, 'DOUBLE');
- assert.strictEqual(tag8.vDouble, 1);
- assert.strictEqual(tag9.key, 'cost');
- assert.strictEqual(tag9.vType, 'DOUBLE');
- assert.strictEqual(tag9.vDouble, 112.12);
- assert.strictEqual(thriftSpan.references.length, 0);
-
- assert.strictEqual(thriftSpan.logs.length, 1);
- const [log1] = thriftSpan.logs;
- assert.strictEqual(log1.fields.length, 2);
- const [field1, field2] = log1.fields;
- assert.strictEqual(field1.key, 'message.id');
- assert.strictEqual(field1.vType, 'STRING');
- assert.strictEqual(field1.vStr, 'something happened');
- assert.strictEqual(field2.key, 'error');
- assert.strictEqual(field2.vType, 'BOOL');
- assert.strictEqual(field2.vBool, true);
- });
-
- it('should convert an OpenTelemetry span to a Thrift when links, events and attributes are empty', () => {
- const readableSpan: ReadableSpan = {
- name: 'my-span1',
- kind: types.SpanKind.CLIENT,
- spanContext,
- startTime: [1566156729, 709],
- endTime: [1566156731, 709],
- ended: true,
- status: {
- code: types.CanonicalCode.DATA_LOSS,
- message: 'data loss',
- },
- attributes: {},
- links: [],
- events: [],
- duration: [32, 800000000],
- resource: Resource.empty(),
- };
-
- const thriftSpan = spanToThrift(readableSpan);
- const result = ThriftUtils._thrift.Span.rw.toBuffer(thriftSpan);
- assert.strictEqual(result.err, null);
- assert.deepStrictEqual(thriftSpan.operationName, 'my-span1');
- assert.deepStrictEqual(
- thriftSpan.traceIdLow.toString('hex'),
- '92b449d5929fda1b'
- );
- assert.deepStrictEqual(
- thriftSpan.traceIdHigh.toString('hex'),
- 'd4cda95b652f4a15'
- );
- assert.deepStrictEqual(
- thriftSpan.spanId.toString('hex'),
- '6e0c63257de34c92'
- );
- assert.deepStrictEqual(thriftSpan.parentSpanId, ThriftUtils.emptyBuffer);
- assert.deepStrictEqual(thriftSpan.flags, 1);
- assert.strictEqual(thriftSpan.references.length, 0);
- assert.strictEqual(thriftSpan.tags.length, 5);
- const [tag1, tag2, tag3, tag4, tag5] = thriftSpan.tags;
- assert.strictEqual(tag1.key, 'status.code');
- assert.strictEqual(tag1.vType, 'DOUBLE');
- assert.strictEqual(tag1.vDouble, 15);
- assert.strictEqual(tag2.key, 'status.name');
- assert.strictEqual(tag2.vType, 'STRING');
- assert.strictEqual(tag2.vStr, 'DATA_LOSS');
- assert.strictEqual(tag3.key, 'status.message');
- assert.strictEqual(tag3.vType, 'STRING');
- assert.strictEqual(tag3.vStr, 'data loss');
- assert.strictEqual(tag4.key, 'error');
- assert.strictEqual(tag4.vType, 'BOOL');
- assert.strictEqual(tag4.vBool, true);
- assert.strictEqual(tag5.key, 'span.kind');
- assert.strictEqual(tag5.vType, 'STRING');
- assert.strictEqual(tag5.vStr, 'CLIENT');
- assert.strictEqual(thriftSpan.logs.length, 0);
- });
-
- it('should convert an OpenTelemetry span to a Thrift with ThriftReference', () => {
- const readableSpan: ReadableSpan = {
- name: 'my-span',
- kind: types.SpanKind.INTERNAL,
- spanContext,
- startTime: [1566156729, 709],
- endTime: [1566156731, 709],
- ended: true,
- status: {
- code: types.CanonicalCode.OK,
- },
- attributes: {},
- parentSpanId: '3e0c63257de34c92',
- links: [
- {
- context: {
- traceId: 'a4cda95b652f4a1592b449d5929fda1b',
- spanId: '3e0c63257de34c92',
- },
- },
- ],
- events: [],
- duration: [32, 800000000],
- resource: Resource.empty(),
- };
-
- const thriftSpan = spanToThrift(readableSpan);
- const result = ThriftUtils._thrift.Span.rw.toBuffer(thriftSpan);
- assert.strictEqual(result.err, null);
- assert.deepStrictEqual(thriftSpan.operationName, 'my-span');
- assert.deepStrictEqual(
- thriftSpan.parentSpanId.toString('hex'),
- '3e0c63257de34c92'
- );
- assert.strictEqual(thriftSpan.references.length, 1);
- const [ref1] = thriftSpan.references;
- assert.strictEqual(ref1.traceIdLow.toString('hex'), '92b449d5929fda1b');
- assert.strictEqual(ref1.traceIdHigh.toString('hex'), 'a4cda95b652f4a15');
- assert.strictEqual(ref1.spanId.toString('hex'), '3e0c63257de34c92');
- assert.strictEqual(ref1.refType, ThriftReferenceType.CHILD_OF);
- });
-
- it('should left pad trace ids', () => {
- const readableSpan: ReadableSpan = {
- name: 'my-span1',
- kind: types.SpanKind.CLIENT,
- spanContext: {
- traceId: '92b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.NONE,
- },
- startTime: [1566156729, 709],
- endTime: [1566156731, 709],
- ended: true,
- status: {
- code: types.CanonicalCode.DATA_LOSS,
- message: 'data loss',
- },
- attributes: {},
- links: [],
- events: [],
- duration: [32, 800000000],
- resource: Resource.empty(),
- };
-
- const thriftSpan = spanToThrift(readableSpan);
-
- assert.strictEqual(
- thriftSpan.traceIdLow.toString('hex'),
- '92b449d5929fda1b'
- );
- assert.strictEqual(
- thriftSpan.traceIdHigh.toString('hex'),
- '0000000000000000'
- );
- });
- });
-});
diff --git a/packages/opentelemetry-exporter-prometheus/README.md b/packages/opentelemetry-exporter-prometheus/README.md
deleted file mode 100644
index 69ab91e5ff..0000000000
--- a/packages/opentelemetry-exporter-prometheus/README.md
+++ /dev/null
@@ -1,72 +0,0 @@
-# OpenTelemetry Prometheus Metric Exporter
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![devDependencies][devDependencies-image]][devDependencies-url]
-[![Apache License][license-image]][license-image]
-
-The OpenTelemetry Prometheus Metrics Exporter allows the user to send collected [OpenTelemetry Metrics](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-metrics) to Prometheus.
-
-[Prometheus](https://prometheus.io/) is a monitoring system that collects metrics, by scraping exposed endpoints at regular intervals, evaluating rule expressions. It can also trigger alerts if certain conditions are met. For assistance setting up Prometheus, [Click here](https://opencensus.io/codelabs/prometheus/#0) for a guided codelab.
-
-## Installation
-
-```bash
-npm install --save @opentelemetry/metrics
-npm install --save @opentelemetry/exporter-prometheus
-```
-
-## Usage
-
-Create & register the exporter on your application.
-
-```js
-const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus');
-const { MeterProvider } = require('@opentelemetry/metrics');
-
-// Add your port and startServer to the Prometheus options
-const options = {port: 9464, startServer: true};
-const exporter = new PrometheusExporter(options);
-
-// Register the exporter
-const meter = new MeterProvider({
- exporter,
- interval: 1000,
-}).getMeter('example-prometheus');
-
-// Now, start recording data
-const counter = meter.createCounter('metric_name');
-counter.add(10, { [key]: 'value' });
-
-// Record data using Instrument: It is recommended to keep a reference to the Bound Instrument instead of
-// always calling `bind()` method for every operations.
-const boundCounter = counter.bind({ [key]: 'value' });
-boundCounter.add(10);
-
-// .. some other work
-```
-
-## Viewing your metrics
-
-With the above you should now be able to navigate to the Prometheus UI at: http://localhost:9464/metrics
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- To learn more about Prometheus, visit: https://prometheus.io/
-- For more about OpenTelemetry JavaScript:
-- For help or feedback on this project, join us on [gitter][gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-exporter-prometheus
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-prometheus
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-exporter-prometheus
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-prometheus&type=dev
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-prometheus
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-prometheus.svg
diff --git a/packages/opentelemetry-exporter-prometheus/package.json b/packages/opentelemetry-exporter-prometheus/package.json
deleted file mode 100644
index c2f69dc171..0000000000
--- a/packages/opentelemetry-exporter-prometheus/package.json
+++ /dev/null
@@ -1,63 +0,0 @@
-{
- "name": "@opentelemetry/exporter-prometheus",
- "version": "0.6.1",
- "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": {
- "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": "gts check",
- "lint:fix": "gts 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"
- },
- "keywords": [
- "opentelemetry",
- "nodejs",
- "tracing",
- "profiling"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.9",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "mocha": "^6.2.2",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "3.7.2"
- },
- "dependencies": {
- "@opentelemetry/api": "^0.6.1",
- "@opentelemetry/base": "^0.6.1",
- "@opentelemetry/core": "^0.6.1",
- "@opentelemetry/metrics": "^0.6.1",
- "prom-client": "^11.5.3"
- }
-}
diff --git a/packages/opentelemetry-exporter-prometheus/src/export/types.ts b/packages/opentelemetry-exporter-prometheus/src/export/types.ts
deleted file mode 100644
index bfdc74cc19..0000000000
--- a/packages/opentelemetry-exporter-prometheus/src/export/types.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as types from '@opentelemetry/api';
-
-/**
- * Configuration interface for prometheus exporter
- */
-export interface ExporterConfig {
- /**
- * App prefix for metrics, if needed
- *
- * @default ''
- * */
- prefix?: string;
-
- /**
- * Endpoint the metrics should be exposed at with preceding slash
- * @default '/metrics'
- */
- endpoint?: string;
-
- /**
- * Port number for Prometheus exporter server
- *
- * Default registered port is 9464:
- * https://github.com/prometheus/prometheus/wiki/Default-port-allocations
- * @default 9464
- */
- port?: number;
-
- /**
- * Define if the Prometheus exporter server will be started
- * @default false
- */
- startServer?: boolean;
-
- /** Standard logging interface */
- logger?: types.Logger;
-}
diff --git a/packages/opentelemetry-exporter-prometheus/src/index.ts b/packages/opentelemetry-exporter-prometheus/src/index.ts
deleted file mode 100644
index ff3d57cb44..0000000000
--- a/packages/opentelemetry-exporter-prometheus/src/index.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './prometheus';
-export * from './export/types';
diff --git a/packages/opentelemetry-exporter-prometheus/src/prometheus.ts b/packages/opentelemetry-exporter-prometheus/src/prometheus.ts
deleted file mode 100644
index 9d266ecdc1..0000000000
--- a/packages/opentelemetry-exporter-prometheus/src/prometheus.ts
+++ /dev/null
@@ -1,317 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { ExportResult } from '@opentelemetry/base';
-import { NoopLogger, hrTimeToMilliseconds } from '@opentelemetry/core';
-import {
- CounterSumAggregator,
- LastValue,
- MetricExporter,
- MetricRecord,
- MetricDescriptor,
- MetricKind,
- ObserverAggregator,
- Sum,
-} from '@opentelemetry/metrics';
-import * as types from '@opentelemetry/api';
-import { createServer, IncomingMessage, Server, ServerResponse } from 'http';
-import { Counter, Gauge, labelValues, Metric, Registry } from 'prom-client';
-import * as url from 'url';
-import { ExporterConfig } from './export/types';
-
-export class PrometheusExporter implements MetricExporter {
- static readonly DEFAULT_OPTIONS = {
- port: 9464,
- startServer: false,
- endpoint: '/metrics',
- prefix: '',
- };
-
- private readonly _registry = new Registry();
- private readonly _logger: types.Logger;
- private readonly _port: number;
- private readonly _endpoint: string;
- private readonly _server: Server;
- private readonly _prefix?: string;
- private readonly _invalidCharacterRegex = /[^a-z0-9_]/gi;
-
- // This will be required when histogram is implemented. Leaving here so it is not forgotten
- // Histogram cannot have a label named 'le'
- // private static readonly RESERVED_HISTOGRAM_LABEL = 'le';
-
- /**
- * Constructor
- * @param config Exporter configuration
- * @param callback Callback to be called after a server was started
- */
- constructor(config: ExporterConfig = {}, callback?: () => void) {
- this._logger = config.logger || new NoopLogger();
- this._port = config.port || PrometheusExporter.DEFAULT_OPTIONS.port;
- this._prefix = config.prefix || PrometheusExporter.DEFAULT_OPTIONS.prefix;
- this._server = createServer(this._requestHandler);
-
- this._endpoint = (
- config.endpoint || PrometheusExporter.DEFAULT_OPTIONS.endpoint
- ).replace(/^([^/])/, '/$1');
-
- if (config.startServer || PrometheusExporter.DEFAULT_OPTIONS.startServer) {
- this.startServer(callback);
- } else if (callback) {
- callback();
- }
- }
-
- /**
- * Saves the current values of all exported {@link MetricRecord}s so that
- * they can be pulled by the Prometheus backend.
- *
- * In its current state, the exporter saves the current values of all metrics
- * when export is called and returns them when the export endpoint is called.
- * In the future, this should be a no-op and the exporter should reach into
- * the metrics when the export endpoint is called. As there is currently no
- * interface to do this, this is our only option.
- *
- * @param records Metrics to be sent to the prometheus backend
- * @param cb result callback to be called on finish
- */
- export(records: MetricRecord[], cb: (result: ExportResult) => void) {
- if (!this._server) {
- // It is conceivable that the _server may not be started as it is an async startup
- // However unlikely, if this happens the caller may retry the export
- cb(ExportResult.FAILED_RETRYABLE);
- return;
- }
-
- this._logger.debug('Prometheus exporter export');
-
- for (const record of records) {
- this._updateMetric(record);
- }
-
- cb(ExportResult.SUCCESS);
- }
-
- /**
- * Shuts down the export server and clears the registry
- *
- * @param cb called when server is stopped
- */
- shutdown(cb?: () => void) {
- this._registry.clear();
- this.stopServer(cb);
- }
-
- /**
- * Updates the value of a single metric in the registry
- *
- * @param record Metric value to be saved
- */
- private _updateMetric(record: MetricRecord) {
- const metric = this._registerMetric(record);
- if (!metric) return;
-
- const labelValues = this._getLabelValues(
- record.descriptor.labelKeys,
- record.labels
- );
- const point = record.aggregator.toPoint();
-
- if (metric instanceof Counter) {
- // Prometheus counter saves internal state and increments by given value.
- // MetricRecord value is the current state, not the delta to be incremented by.
- // Currently, _registerMetric creates a new counter every time the value changes,
- // so the increment here behaves as a set value (increment from 0)
- metric.inc(
- labelValues,
- point.value as Sum,
- hrTimeToMilliseconds(point.timestamp)
- );
- }
-
- if (metric instanceof Gauge) {
- if (record.aggregator instanceof CounterSumAggregator) {
- metric.set(labelValues, point.value as Sum);
- } else if (record.aggregator instanceof ObserverAggregator) {
- metric.set(
- labelValues,
- point.value as LastValue,
- hrTimeToMilliseconds(point.timestamp)
- );
- }
- }
-
- // TODO: only counter and gauge are implemented in metrics so far
- }
-
- private _getLabelValues(keys: string[], labels: types.Labels) {
- const labelValues: labelValues = {};
- for (let i = 0; i < keys.length; i++) {
- if (labels[keys[i]] !== null) {
- labelValues[keys[i]] = labels[keys[i]];
- }
- }
- return labelValues;
- }
-
- private _registerMetric(record: MetricRecord): Metric | undefined {
- const metricName = this._getPrometheusMetricName(record.descriptor);
- const metric = this._registry.getSingleMetric(metricName);
-
- /**
- * Prometheus library does aggregation, which means its inc method must be called with
- * the value to be incremented by. It does not have a set method. As our MetricRecord
- * contains the current value, not the value to be incremented by, we destroy and
- * recreate counters when they are updated.
- *
- * This works because counters are identified by their name and no other internal ID
- * https://prometheus.io/docs/instrumenting/exposition_formats/
- */
- if (metric instanceof Counter) {
- metric.remove(
- ...record.descriptor.labelKeys.map(k => record.labels[k].toString())
- );
- }
-
- if (metric) return metric;
-
- return this._newMetric(record, metricName);
- }
-
- private _newMetric(record: MetricRecord, name: string): Metric | undefined {
- const metricObject = {
- name,
- // prom-client throws with empty description which is our default
- help: record.descriptor.description || 'description missing',
- labelNames: record.descriptor.labelKeys,
- // list of registries to register the newly created metric
- registers: [this._registry],
- };
-
- switch (record.descriptor.metricKind) {
- case MetricKind.COUNTER:
- // there is no such thing as a non-monotonic counter in prometheus
- return record.descriptor.monotonic
- ? new Counter(metricObject)
- : new Gauge(metricObject);
- case MetricKind.OBSERVER:
- return new Gauge(metricObject);
- default:
- // Other metric types are currently unimplemented
- return undefined;
- }
- }
-
- private _getPrometheusMetricName(descriptor: MetricDescriptor): string {
- return this._sanitizePrometheusMetricName(
- this._prefix ? `${this._prefix}_${descriptor.name}` : descriptor.name
- );
- }
-
- /**
- * Ensures metric names are valid Prometheus metric names by removing
- * characters allowed by OpenTelemetry but disallowed by Prometheus.
- *
- * https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels
- *
- * 1. Names must match `[a-zA-Z_:][a-zA-Z0-9_:]*`
- *
- * 2. Colons are reserved for user defined recording rules.
- * They should not be used by exporters or direct instrumentation.
- *
- * OpenTelemetry metric names are already validated in the Meter when they are created,
- * and they match the format `[a-zA-Z][a-zA-Z0-9_.\-]*` which is very close to a valid
- * prometheus metric name, so we only need to strip characters valid in OpenTelemetry
- * but not valid in prometheus and replace them with '_'.
- *
- * @param name name to be sanitized
- */
- private _sanitizePrometheusMetricName(name: string): string {
- return name.replace(this._invalidCharacterRegex, '_'); // replace all invalid characters with '_'
- }
-
- /**
- * Stops the Prometheus export server
- * @param callback A callback that will be executed once the server is stopped
- */
- stopServer(callback?: () => void) {
- if (!this._server) {
- this._logger.debug(
- `Prometheus stopServer() was called but server was never started.`
- );
- if (callback) {
- callback();
- }
- } else {
- this._server.close(() => {
- this._logger.debug(`Prometheus exporter was stopped`);
- if (callback) {
- callback();
- }
- });
- }
- }
-
- /**
- * Starts the Prometheus export server
- *
- * @param callback called once the server is ready
- */
- startServer(callback?: () => void) {
- this._server.listen(this._port, () => {
- this._logger.debug(
- `Prometheus exporter started on port ${this._port} at endpoint ${this._endpoint}`
- );
- if (callback) {
- callback();
- }
- });
- }
-
- /**
- * Request handler used by http library to respond to incoming requests
- * for the current state of metrics by the Prometheus backend.
- *
- * @param request Incoming HTTP request to export server
- * @param response HTTP response object used to respond to request
- */
- private _requestHandler = (
- request: IncomingMessage,
- response: ServerResponse
- ) => {
- if (url.parse(request.url!).pathname === this._endpoint) {
- this._exportMetrics(response);
- } else {
- this._notFound(response);
- }
- };
-
- /**
- * Responds to incoming message with current state of all metrics.
- */
- private _exportMetrics = (response: ServerResponse) => {
- response.statusCode = 200;
- response.setHeader('content-type', this._registry.contentType);
- response.end(this._registry.metrics() || '# no registered metrics');
- };
-
- /**
- * Responds with 404 status code to all requests that do not match the configured endpoint.
- */
- private _notFound = (response: ServerResponse) => {
- response.statusCode = 404;
- response.end();
- };
-}
diff --git a/packages/opentelemetry-exporter-prometheus/test/prometheus.test.ts b/packages/opentelemetry-exporter-prometheus/test/prometheus.test.ts
deleted file mode 100644
index 2ed9852a54..0000000000
--- a/packages/opentelemetry-exporter-prometheus/test/prometheus.test.ts
+++ /dev/null
@@ -1,529 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { HrTime, ObserverResult } from '@opentelemetry/api';
-import {
- CounterMetric,
- CounterSumAggregator,
- Meter,
- MeterProvider,
- ObserverMetric,
- Point,
-} from '@opentelemetry/metrics';
-import * as assert from 'assert';
-import * as http from 'http';
-import { PrometheusExporter } from '../src';
-
-const mockedHrTime: HrTime = [1586347902211, 0];
-const mockedTimeMS = 1586347902211000;
-
-describe('PrometheusExporter', () => {
- let toPoint: () => Point;
- before(() => {
- toPoint = CounterSumAggregator.prototype.toPoint;
- CounterSumAggregator.prototype.toPoint = function(): Point {
- const point = toPoint.apply(this);
- point.timestamp = mockedHrTime;
- return point;
- };
- });
- after(() => {
- CounterSumAggregator.prototype.toPoint = toPoint;
- });
- describe('constructor', () => {
- it('should construct an exporter', () => {
- const exporter = new PrometheusExporter();
- assert.ok(typeof exporter.startServer === 'function');
- assert.ok(typeof exporter.shutdown === 'function');
- });
-
- it('should start the server if startServer is passed as an option', done => {
- const port = PrometheusExporter.DEFAULT_OPTIONS.port;
- const endpoint = PrometheusExporter.DEFAULT_OPTIONS.endpoint;
- const exporter = new PrometheusExporter(
- {
- startServer: true,
- },
- () => {
- const url = `http://localhost:${port}${endpoint}`;
- http.get(url, function(res: any) {
- assert.strictEqual(res.statusCode, 200);
- exporter.shutdown(() => {
- return done();
- });
- });
- }
- );
- });
-
- it('should not start the server by default', () => {
- const exporter = new PrometheusExporter();
- assert.ok(exporter['_server']!.listening === false);
- });
- });
-
- describe('server', () => {
- it('it should start on startServer() and call the callback', done => {
- const exporter = new PrometheusExporter({
- port: 9722,
- });
- exporter.startServer(() => {
- exporter.shutdown(() => {
- return done();
- });
- });
- });
-
- it('it should listen on the default port and default endpoint', done => {
- const port = PrometheusExporter.DEFAULT_OPTIONS.port;
- const endpoint = PrometheusExporter.DEFAULT_OPTIONS.endpoint;
- const exporter = new PrometheusExporter();
-
- exporter.startServer(() => {
- const url = `http://localhost:${port}${endpoint}`;
- http.get(url, function(res: any) {
- assert.strictEqual(res.statusCode, 200);
- exporter.shutdown(() => {
- return done();
- });
- });
- });
- });
-
- it('it should listen on a custom port and endpoint if provided', done => {
- const port = 9991;
- const endpoint = '/metric';
-
- const exporter = new PrometheusExporter({
- port,
- endpoint,
- });
-
- exporter.startServer(() => {
- const url = `http://localhost:${port}${endpoint}`;
- http.get(url, function(res: any) {
- assert.strictEqual(res.statusCode, 200);
- exporter.shutdown(() => {
- return done();
- });
- });
- });
- });
-
- it('it should not require endpoints to start with a slash', done => {
- const port = 9991;
- const endpoint = 'metric';
-
- const exporter = new PrometheusExporter({
- port,
- endpoint,
- });
-
- exporter.startServer(() => {
- const url = `http://localhost:${port}/metric`;
- http.get(url, function(res: any) {
- assert.strictEqual(res.statusCode, 200);
- exporter.shutdown(() => {
- const exporter2 = new PrometheusExporter({
- port,
- endpoint: `/${endpoint}`,
- });
-
- exporter2.startServer(() => {
- const url = `http://localhost:${port}/metric`;
- http.get(url, function(res: any) {
- assert.strictEqual(res.statusCode, 200);
- exporter2.stopServer(() => {
- return done();
- });
- });
- });
- });
- });
- });
- });
-
- it('it should return a HTTP status 404 if the endpoint does not match', done => {
- const port = 9912;
- const endpoint = '/metrics';
- const exporter = new PrometheusExporter({
- port,
- endpoint,
- });
- exporter.startServer(() => {
- const url = `http://localhost:${port}/invalid`;
-
- http.get(url, function(res: any) {
- assert.strictEqual(res.statusCode, 404);
- exporter.shutdown(() => {
- return done();
- });
- });
- });
- });
-
- it('should call a provided callback regardless of if the server is running', done => {
- const exporter = new PrometheusExporter();
- exporter.shutdown(() => {
- return done();
- });
- });
- });
-
- describe('export', () => {
- let exporter: PrometheusExporter;
- let meter: Meter;
-
- beforeEach(done => {
- exporter = new PrometheusExporter();
- meter = new MeterProvider().getMeter('test-prometheus');
- exporter.startServer(done);
- });
-
- afterEach(done => {
- exporter.shutdown(done);
- });
-
- it('should export a count aggregation', done => {
- const counter = meter.createCounter('counter', {
- description: 'a test description',
- labelKeys: ['key1'],
- });
-
- const boundCounter = counter.bind({ key1: 'labelValue1' });
- boundCounter.add(10);
- meter.collect();
- exporter.export(meter.getBatcher().checkPointSet(), () => {
- // This is to test the special case where counters are destroyed
- // and recreated in the exporter in order to get around prom-client's
- // aggregation and use ours.
- boundCounter.add(10);
- exporter.export(meter.getBatcher().checkPointSet(), () => {
- http
- .get('http://localhost:9464/metrics', res => {
- res.on('data', chunk => {
- const body = chunk.toString();
- const lines = body.split('\n');
-
- assert.strictEqual(
- lines[0],
- '# HELP counter a test description'
- );
-
- assert.deepStrictEqual(lines, [
- '# HELP counter a test description',
- '# TYPE counter counter',
- `counter{key1="labelValue1"} 20 ${mockedTimeMS}`,
- '',
- ]);
-
- done();
- });
- })
- .on('error', errorHandler(done));
- });
- });
- });
-
- it('should export an observer aggregation', done => {
- function getCpuUsage() {
- return Math.random();
- }
-
- const observer = meter.createObserver('metric_observer', {
- description: 'a test description',
- labelKeys: ['pid'],
- }) as ObserverMetric;
-
- observer.setCallback((observerResult: ObserverResult) => {
- observerResult.observe(getCpuUsage, { pid: String(123), core: '1' });
- });
-
- meter.collect();
- exporter.export(meter.getBatcher().checkPointSet(), () => {
- exporter.export(meter.getBatcher().checkPointSet(), () => {
- http
- .get('http://localhost:9464/metrics', res => {
- res.on('data', chunk => {
- const body = chunk.toString();
- const lines = body.split('\n');
-
- assert.strictEqual(
- lines[0],
- '# HELP metric_observer a test description'
- );
-
- assert.strictEqual(lines[1], '# TYPE metric_observer gauge');
-
- const line3 = lines[2].split(' ');
- assert.strictEqual(line3[0], 'metric_observer{pid="123"}');
- assert.ok(
- parseFloat(line3[1]) >= 0 && parseFloat(line3[1]) <= 1
- );
- assert.ok(parseInt(line3[2], 10) <= new Date().getTime());
-
- done();
- });
- })
- .on('error', errorHandler(done));
- });
- });
- });
-
- it('should export multiple labels', done => {
- const counter = meter.createCounter('counter', {
- description: 'a test description',
- labelKeys: ['counterKey1'],
- }) as CounterMetric;
-
- counter.bind({ counterKey1: 'labelValue1' }).add(10);
- counter.bind({ counterKey1: 'labelValue2' }).add(20);
- meter.collect();
- exporter.export(meter.getBatcher().checkPointSet(), () => {
- http
- .get('http://localhost:9464/metrics', res => {
- res.on('data', chunk => {
- const body = chunk.toString();
- const lines = body.split('\n');
-
- assert.deepStrictEqual(lines, [
- '# HELP counter a test description',
- '# TYPE counter counter',
- `counter{counterKey1="labelValue1"} 10 ${mockedTimeMS}`,
- `counter{counterKey1="labelValue2"} 20 ${mockedTimeMS}`,
- '',
- ]);
-
- done();
- });
- })
- .on('error', errorHandler(done));
- });
- });
-
- it('should export a comment if no metrics are registered', done => {
- exporter.export([], () => {
- http
- .get('http://localhost:9464/metrics', res => {
- res.on('data', chunk => {
- const body = chunk.toString();
- const lines = body.split('\n');
-
- assert.deepStrictEqual(lines, ['# no registered metrics']);
-
- done();
- });
- })
- .on('error', errorHandler(done));
- });
- });
-
- it('should add a description if missing', done => {
- const counter = meter.createCounter('counter');
-
- const boundCounter = counter.bind({ key1: 'labelValue1' });
- boundCounter.add(10);
- meter.collect();
- exporter.export(meter.getBatcher().checkPointSet(), () => {
- http
- .get('http://localhost:9464/metrics', res => {
- res.on('data', chunk => {
- const body = chunk.toString();
- const lines = body.split('\n');
-
- assert.deepStrictEqual(lines, [
- '# HELP counter description missing',
- '# TYPE counter counter',
- `counter 10 ${mockedTimeMS}`,
- '',
- ]);
-
- done();
- });
- })
- .on('error', errorHandler(done));
- });
- });
-
- it('should sanitize names', done => {
- const counter = meter.createCounter('counter.bad-name');
- const boundCounter = counter.bind({ key1: 'labelValue1' });
- boundCounter.add(10);
- meter.collect();
- exporter.export(meter.getBatcher().checkPointSet(), () => {
- http
- .get('http://localhost:9464/metrics', res => {
- res.on('data', chunk => {
- const body = chunk.toString();
- const lines = body.split('\n');
-
- assert.deepStrictEqual(lines, [
- '# HELP counter_bad_name description missing',
- '# TYPE counter_bad_name counter',
- `counter_bad_name 10 ${mockedTimeMS}`,
- '',
- ]);
-
- done();
- });
- })
- .on('error', errorHandler(done));
- });
- });
-
- it('should export a non-monotonic counter as a gauge', done => {
- const counter = meter.createCounter('counter', {
- description: 'a test description',
- monotonic: false,
- labelKeys: ['key1'],
- });
-
- counter.bind({ key1: 'labelValue1' }).add(20);
- meter.collect();
- exporter.export(meter.getBatcher().checkPointSet(), () => {
- http
- .get('http://localhost:9464/metrics', res => {
- res.on('data', chunk => {
- assert.deepStrictEqual(chunk.toString().split('\n'), [
- '# HELP counter a test description',
- '# TYPE counter gauge',
- 'counter{key1="labelValue1"} 20',
- '',
- ]);
-
- done();
- });
- })
- .on('error', errorHandler(done));
- });
- });
- });
-
- describe('configuration', () => {
- let meter: Meter;
- let counter: CounterMetric;
- let exporter: PrometheusExporter | undefined;
-
- beforeEach(() => {
- meter = new MeterProvider().getMeter('test-prometheus');
- counter = meter.createCounter('counter') as CounterMetric;
- counter.bind({ key1: 'labelValue1' }).add(10);
- });
-
- afterEach(done => {
- if (exporter) {
- exporter.shutdown(done);
- exporter = undefined;
- } else {
- done();
- }
- });
-
- it('should use a configured name prefix', done => {
- exporter = new PrometheusExporter({
- prefix: 'test_prefix',
- });
-
- exporter.startServer(() => {
- meter.collect();
- exporter!.export(meter.getBatcher().checkPointSet(), () => {
- http
- .get('http://localhost:9464/metrics', res => {
- res.on('data', chunk => {
- const body = chunk.toString();
- const lines = body.split('\n');
-
- assert.deepStrictEqual(lines, [
- '# HELP test_prefix_counter description missing',
- '# TYPE test_prefix_counter counter',
- `test_prefix_counter 10 ${mockedTimeMS}`,
- '',
- ]);
-
- done();
- });
- })
- .on('error', errorHandler(done));
- });
- });
- });
-
- it('should use a configured port', done => {
- exporter = new PrometheusExporter({
- port: 8080,
- });
-
- exporter.startServer(() => {
- meter.collect();
- exporter!.export(meter.getBatcher().checkPointSet(), () => {
- http
- .get('http://localhost:8080/metrics', res => {
- res.on('data', chunk => {
- const body = chunk.toString();
- const lines = body.split('\n');
-
- assert.deepStrictEqual(lines, [
- '# HELP counter description missing',
- '# TYPE counter counter',
- `counter 10 ${mockedTimeMS}`,
- '',
- ]);
-
- done();
- });
- })
- .on('error', errorHandler(done));
- });
- });
- });
-
- it('should use a configured endpoint', done => {
- exporter = new PrometheusExporter({
- endpoint: '/test',
- });
-
- exporter.startServer(() => {
- meter.collect();
- exporter!.export(meter.getBatcher().checkPointSet(), () => {
- http
- .get('http://localhost:9464/test', res => {
- res.on('data', chunk => {
- const body = chunk.toString();
- const lines = body.split('\n');
-
- assert.deepStrictEqual(lines, [
- '# HELP counter description missing',
- '# TYPE counter counter',
- `counter 10 ${mockedTimeMS}`,
- '',
- ]);
-
- done();
- });
- })
- .on('error', errorHandler(done));
- });
- });
- });
- });
-});
-
-function errorHandler(done: Mocha.Done): (err: Error) => void {
- return () => {
- assert.ok(false, 'error getting metrics');
- done();
- };
-}
diff --git a/packages/opentelemetry-exporter-zipkin/README.md b/packages/opentelemetry-exporter-zipkin/README.md
deleted file mode 100644
index 9367d0e0d6..0000000000
--- a/packages/opentelemetry-exporter-zipkin/README.md
+++ /dev/null
@@ -1,68 +0,0 @@
-# OpenTelemetry Zipkin Trace Exporter
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![devDependencies][devDependencies-image]][devDependencies-url]
-[![Apache License][license-image]][license-image]
-
-OpenTelemetry Zipkin Trace Exporter allows the user to send collected traces to Zipkin.
-
-[Zipkin](https://zipkin.io/) is a distributed tracing system. It helps gather timing data needed to troubleshoot latency problems in microservice architectures. It manages both the collection and lookup of this data.
-
-## Installation
-
-```bash
-npm install --save @opentelemetry/exporter-zipkin
-```
-
-## Usage
-
-Install the exporter on your application and pass the options, it must contain a service name.
-
-```js
-const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin');
-
-// Add your zipkin url (`http://localhost:9411/api/v2/spans` is used as
-// default) and application name to the Zipkin options
-const options = {
- url: 'your-zipkin-url',
- serviceName: 'your-application-name'
-}
-const exporter = new ZipkinExporter(options);
-```
-
-Now, register the exporter and start tracing.
-
-```js
-tracer.addSpanProcessor(new BatchSpanProcessor(exporter));
-```
-
-You can use built-in `SimpleSpanProcessor` or `BatchSpanProcessor` or write your own.
-
-- [SimpleSpanProcessor](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/sdk-tracing.md#simple-processor): The implementation of `SpanProcessor` that passes ended span directly to the configured `SpanExporter`.
-- [BatchSpanProcessor](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/sdk-tracing.md#batching-processor): The implementation of the `SpanProcessor` that batches ended spans and pushes them to the configured `SpanExporter`. It is recommended to use this `SpanProcessor` for better performance and optimization.
-
-## Viewing your traces
-
-Please visit the Zipkin UI endpoint http://localhost:9411
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more about OpenTelemetry JavaScript:
-- For Zipkin project at https://zipkin.io/
-- For help or feedback on this project, join us on [gitter][gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-exporter-zipkin
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-zipkin
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-exporter-zipkin
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-zipkin&type=dev
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-zipkin
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-zipkin.svg
diff --git a/packages/opentelemetry-exporter-zipkin/package.json b/packages/opentelemetry-exporter-zipkin/package.json
deleted file mode 100644
index f36753df11..0000000000
--- a/packages/opentelemetry-exporter-zipkin/package.json
+++ /dev/null
@@ -1,63 +0,0 @@
-{
- "name": "@opentelemetry/exporter-zipkin",
- "version": "0.6.1",
- "description": "OpenTelemetry Zipkin Exporter allows the user to send collected traces to Zipkin.",
- "main": "build/src/index.js",
- "types": "build/src/index.d.ts",
- "repository": "open-telemetry/opentelemetry-js",
- "scripts": {
- "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
- "tdd": "npm run test -- --watch-extensions ts --watch",
- "clean": "rimraf build/*",
- "lint": "gts check",
- "lint:fix": "gts 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"
- },
- "keywords": [
- "opentelemetry",
- "nodejs",
- "tracing",
- "profiling"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.9",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "mocha": "^6.2.0",
- "nock": "^11.0.0",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "3.7.2"
- },
- "dependencies": {
- "@opentelemetry/api": "^0.6.1",
- "@opentelemetry/base": "^0.6.1",
- "@opentelemetry/core": "^0.6.1",
- "@opentelemetry/resources": "^0.6.1",
- "@opentelemetry/tracing": "^0.6.1"
- }
-}
diff --git a/packages/opentelemetry-exporter-zipkin/src/index.ts b/packages/opentelemetry-exporter-zipkin/src/index.ts
deleted file mode 100644
index 36741d5455..0000000000
--- a/packages/opentelemetry-exporter-zipkin/src/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './zipkin';
diff --git a/packages/opentelemetry-exporter-zipkin/src/transform.ts b/packages/opentelemetry-exporter-zipkin/src/transform.ts
deleted file mode 100644
index b52e152f7a..0000000000
--- a/packages/opentelemetry-exporter-zipkin/src/transform.ts
+++ /dev/null
@@ -1,103 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as types from '@opentelemetry/api';
-import { ReadableSpan } from '@opentelemetry/tracing';
-import { hrTimeToMicroseconds } from '@opentelemetry/core';
-import * as zipkinTypes from './types';
-import { Resource } from '@opentelemetry/resources';
-
-const ZIPKIN_SPAN_KIND_MAPPING = {
- [types.SpanKind.CLIENT]: zipkinTypes.SpanKind.CLIENT,
- [types.SpanKind.SERVER]: zipkinTypes.SpanKind.SERVER,
- [types.SpanKind.CONSUMER]: zipkinTypes.SpanKind.CONSUMER,
- [types.SpanKind.PRODUCER]: zipkinTypes.SpanKind.PRODUCER,
- // When absent, the span is local.
- [types.SpanKind.INTERNAL]: undefined,
-};
-
-export const statusCodeTagName = 'ot.status_code';
-export const statusDescriptionTagName = 'ot.status_description';
-
-/**
- * Translate OpenTelemetry ReadableSpan to ZipkinSpan format
- * @param span Span to be translated
- */
-export function toZipkinSpan(
- span: ReadableSpan,
- serviceName: string,
- statusCodeTagName: string,
- statusDescriptionTagName: string
-): zipkinTypes.Span {
- const zipkinSpan: zipkinTypes.Span = {
- traceId: span.spanContext.traceId,
- parentId: span.parentSpanId,
- name: span.name,
- id: span.spanContext.spanId,
- kind: ZIPKIN_SPAN_KIND_MAPPING[span.kind],
- timestamp: hrTimeToMicroseconds(span.startTime),
- duration: hrTimeToMicroseconds(span.duration),
- localEndpoint: { serviceName },
- tags: _toZipkinTags(
- span.attributes,
- span.status,
- statusCodeTagName,
- statusDescriptionTagName,
- span.resource
- ),
- annotations: span.events.length
- ? _toZipkinAnnotations(span.events)
- : undefined,
- };
-
- return zipkinSpan;
-}
-
-/** Converts OpenTelemetry Attributes and Status to Zipkin Tags format. */
-export function _toZipkinTags(
- attributes: types.Attributes,
- status: types.Status,
- statusCodeTagName: string,
- statusDescriptionTagName: string,
- resource: Resource
-): zipkinTypes.Tags {
- const tags: { [key: string]: unknown } = {};
- for (const key of Object.keys(attributes)) {
- tags[key] = String(attributes[key]);
- }
- tags[statusCodeTagName] = String(types.CanonicalCode[status.code]);
- if (status.message) {
- tags[statusDescriptionTagName] = status.message;
- }
-
- Object.keys(resource.labels).forEach(
- name => (tags[name] = resource.labels[name])
- );
-
- return tags;
-}
-
-/**
- * Converts OpenTelemetry Events to Zipkin Annotations format.
- */
-export function _toZipkinAnnotations(
- events: types.TimedEvent[]
-): zipkinTypes.Annotation[] {
- return events.map(event => ({
- timestamp: hrTimeToMicroseconds(event.time),
- value: event.name,
- }));
-}
diff --git a/packages/opentelemetry-exporter-zipkin/src/types.ts b/packages/opentelemetry-exporter-zipkin/src/types.ts
deleted file mode 100644
index 343faf09b6..0000000000
--- a/packages/opentelemetry-exporter-zipkin/src/types.ts
+++ /dev/null
@@ -1,178 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as types from '@opentelemetry/api';
-
-/**
- * Exporter config
- */
-export interface ExporterConfig {
- logger?: types.Logger;
- serviceName: string;
- url?: string;
- // Optional mapping overrides for OpenTelemetry status code and description.
- statusCodeTagName?: string;
- statusDescriptionTagName?: string;
-}
-
-/**
- * Zipkin Span
- * @see https://github.com/openzipkin/zipkin-api/blob/master/zipkin2-api.yaml
- */
-export interface Span {
- /**
- * Trace identifier, set on all spans within it.
- */
- traceId: string;
- /**
- * The logical operation this span represents in lowercase (e.g. rpc method).
- * Leave absent if unknown.
- */
- name: string;
- /**
- * The parent span ID or absent if this the root span in a trace.
- */
- parentId?: string;
- /**
- * Unique 64bit identifier for this operation within the trace.
- */
- id: string;
- /**
- * When present, kind clarifies timestamp, duration and remoteEndpoint.
- * When absent, the span is local or incomplete.
- */
- kind?: SpanKind;
- /**
- * Epoch microseconds of the start of this span, possibly absent if
- * incomplete.
- */
- timestamp: number;
- /**
- * Duration in microseconds of the critical path, if known.
- */
- duration: number;
- /**
- * True is a request to store this span even if it overrides sampling policy.
- * This is true when the `X-B3-Flags` header has a value of 1.
- */
- debug?: boolean;
- /**
- * True if we are contributing to a span started by another tracer (ex on a
- * different host).
- */
- shared?: boolean;
- /**
- * The host that recorded this span, primarily for query by service name.
- */
- localEndpoint: Endpoint;
- /**
- * Associates events that explain latency with the time they happened.
- */
- annotations?: Annotation[];
- /**
- * Tags give your span context for search, viewing and analysis.
- */
- tags: Tags;
- /**
- * TODO: `remoteEndpoint`, do we need to support it?
- * When an RPC (or messaging) span, indicates the other side of the
- * connection.
- */
-}
-
-/**
- * Associates an event that explains latency with a timestamp.
- * Unlike log statements, annotations are often codes. Ex. "ws" for WireSend
- * Zipkin v1 core annotations such as "cs" and "sr" have been replaced with
- * Span.Kind, which interprets timestamp and duration.
- */
-export interface Annotation {
- /**
- * Epoch microseconds of this event.
- * For example, 1502787600000000 corresponds to 2017-08-15 09:00 UTC
- */
- timestamp: number;
- /**
- * Usually a short tag indicating an event, like "error"
- * While possible to add larger data, such as garbage collection details, low
- * cardinality event names both keep the size of spans down and also are easy
- * to search against.
- */
- value: string;
-}
-
-/**
- * The network context of a node in the service graph.
- */
-export interface Endpoint {
- /**
- * Lower-case label of this node in the service graph, such as "favstar".
- * Leave absent if unknown.
- * This is a primary label for trace lookup and aggregation, so it should be
- * intuitive and consistent. Many use a name from service discovery.
- */
- serviceName?: string;
- /**
- * The text representation of the primary IPv4 address associated with this
- * connection. Ex. 192.168.99.100 Absent if unknown.
- */
- ipv4?: string;
- /**
- * The text representation of the primary IPv6 address associated with a
- * connection. Ex. 2001:db8::c001 Absent if unknown.
- * Prefer using the ipv4 field for mapped addresses.
- */
- port?: number;
-}
-
-/**
- * Adds context to a span, for search, viewing and analysis.
- * For example, a key "your_app.version" would let you lookup traces by version.
- * A tag "sql.query" isn't searchable, but it can help in debugging when viewing
- * a trace.
- */
-export interface Tags {
- [tagKey: string]: unknown;
-}
-
-/**
- * When present, kind clarifies timestamp, duration and remoteEndpoint. When
- * absent, the span is local or incomplete. Unlike client and server, there
- * is no direct critical path latency relationship between producer and
- * consumer spans.
- * `CLIENT`
- * timestamp is the moment a request was sent to the server.
- * duration is the delay until a response or an error was received.
- * remoteEndpoint is the server.
- * `SERVER`
- * timestamp is the moment a client request was received.
- * duration is the delay until a response was sent or an error.
- * remoteEndpoint is the client.
- * `PRODUCER`
- * timestamp is the moment a message was sent to a destination.
- * duration is the delay sending the message, such as batching.
- * remoteEndpoint is the broker.
- * `CONSUMER`
- * timestamp is the moment a message was received from an origin.
- * duration is the delay consuming the message, such as from backlog.
- * remoteEndpoint - Represents the broker. Leave serviceName absent if unknown.
- */
-export enum SpanKind {
- CLIENT = 'CLIENT',
- SERVER = 'SERVER',
- CONSUMER = 'CONSUMER',
- PRODUCER = 'PRODUCER',
-}
diff --git a/packages/opentelemetry-exporter-zipkin/src/utils.ts b/packages/opentelemetry-exporter-zipkin/src/utils.ts
deleted file mode 100644
index dc5c69b08d..0000000000
--- a/packages/opentelemetry-exporter-zipkin/src/utils.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export const OT_REQUEST_HEADER = 'x-opentelemetry-outgoing-request';
diff --git a/packages/opentelemetry-exporter-zipkin/src/zipkin.ts b/packages/opentelemetry-exporter-zipkin/src/zipkin.ts
deleted file mode 100644
index 56a06469f2..0000000000
--- a/packages/opentelemetry-exporter-zipkin/src/zipkin.ts
+++ /dev/null
@@ -1,168 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as types from '@opentelemetry/api';
-import * as http from 'http';
-import * as https from 'https';
-import * as url from 'url';
-import { NoopLogger } from '@opentelemetry/core';
-import { SpanExporter, ReadableSpan } from '@opentelemetry/tracing';
-import { ExportResult } from '@opentelemetry/base';
-import * as zipkinTypes from './types';
-import {
- toZipkinSpan,
- statusCodeTagName,
- statusDescriptionTagName,
-} from './transform';
-import { OT_REQUEST_HEADER } from './utils';
-/**
- * Zipkin Exporter
- */
-export class ZipkinExporter implements SpanExporter {
- static readonly DEFAULT_URL = 'http://localhost:9411/api/v2/spans';
- private readonly _logger: types.Logger;
- private readonly _serviceName: string;
- private readonly _statusCodeTagName: string;
- private readonly _statusDescriptionTagName: string;
- private readonly _reqOpts: http.RequestOptions;
- private _isShutdown: boolean;
-
- constructor(config: zipkinTypes.ExporterConfig) {
- const urlStr = config.url || ZipkinExporter.DEFAULT_URL;
- const urlOpts = url.parse(urlStr);
-
- this._logger = config.logger || new NoopLogger();
- this._reqOpts = Object.assign(
- {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- [OT_REQUEST_HEADER]: 1,
- },
- },
- urlOpts
- );
- this._serviceName = config.serviceName;
- this._statusCodeTagName = config.statusCodeTagName || statusCodeTagName;
- this._statusDescriptionTagName =
- config.statusDescriptionTagName || statusDescriptionTagName;
- this._isShutdown = false;
- }
-
- /**
- * Export spans.
- */
- export(
- spans: ReadableSpan[],
- resultCallback: (result: ExportResult) => void
- ) {
- this._logger.debug('Zipkin exporter export');
- if (this._isShutdown) {
- setTimeout(() => resultCallback(ExportResult.FAILED_NOT_RETRYABLE));
- return;
- }
- return this._sendSpans(spans, resultCallback);
- }
-
- /**
- * Shutdown exporter. Noop operation in this exporter.
- */
- shutdown() {
- this._logger.debug('Zipkin exporter shutdown');
- if (this._isShutdown) {
- return;
- }
- this._isShutdown = true;
- }
-
- /**
- * Transforms an OpenTelemetry span to a Zipkin span.
- */
- private _toZipkinSpan(span: ReadableSpan): zipkinTypes.Span {
- return toZipkinSpan(
- span,
- this._serviceName,
- this._statusCodeTagName,
- this._statusDescriptionTagName
- );
- }
-
- /**
- * Transform spans and sends to Zipkin service.
- */
- private _sendSpans(
- spans: ReadableSpan[],
- done?: (result: ExportResult) => void
- ) {
- const zipkinSpans = spans.map(span => this._toZipkinSpan(span));
- return this._send(zipkinSpans, (result: ExportResult) => {
- if (done) {
- return done(result);
- }
- });
- }
-
- /**
- * Send spans to the remote Zipkin service.
- */
- private _send(
- zipkinSpans: zipkinTypes.Span[],
- done: (result: ExportResult) => void
- ) {
- if (zipkinSpans.length === 0) {
- this._logger.debug('Zipkin send with empty spans');
- return done(ExportResult.SUCCESS);
- }
-
- const { request } = this._reqOpts.protocol === 'http:' ? http : https;
- const req = request(this._reqOpts, (res: http.IncomingMessage) => {
- let rawData = '';
- res.on('data', chunk => {
- rawData += chunk;
- });
- res.on('end', () => {
- const statusCode = res.statusCode || 0;
- this._logger.debug(
- 'Zipkin response status code: %d, body: %s',
- statusCode,
- rawData
- );
-
- // Consider 2xx and 3xx as success.
- if (statusCode < 400) {
- return done(ExportResult.SUCCESS);
- // Consider 4xx as failed non-retriable.
- } else if (statusCode < 500) {
- return done(ExportResult.FAILED_NOT_RETRYABLE);
- // Consider 5xx as failed retriable.
- } else {
- return done(ExportResult.FAILED_RETRYABLE);
- }
- });
- });
-
- req.on('error', (err: Error) => {
- this._logger.error('Zipkin request error', err);
- return done(ExportResult.FAILED_RETRYABLE);
- });
-
- // Issue request to remote service
- const payload = JSON.stringify(zipkinSpans);
- this._logger.debug('Zipkin request payload: %s', payload);
- req.write(payload, 'utf8');
- req.end();
- }
-}
diff --git a/packages/opentelemetry-exporter-zipkin/test/e2e.test.ts b/packages/opentelemetry-exporter-zipkin/test/e2e.test.ts
deleted file mode 100644
index 643a06a74c..0000000000
--- a/packages/opentelemetry-exporter-zipkin/test/e2e.test.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-describe('Zipkin Exporter E2E', () => {
- it('should report spans to Zipkin server');
-});
diff --git a/packages/opentelemetry-exporter-zipkin/test/transform.test.ts b/packages/opentelemetry-exporter-zipkin/test/transform.test.ts
deleted file mode 100644
index 6f5854d2e6..0000000000
--- a/packages/opentelemetry-exporter-zipkin/test/transform.test.ts
+++ /dev/null
@@ -1,306 +0,0 @@
-/**
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import * as types from '@opentelemetry/api';
-import { Span, BasicTracerProvider } from '@opentelemetry/tracing';
-import {
- NoopLogger,
- hrTimeToMicroseconds,
- hrTimeDuration,
- VERSION,
-} from '@opentelemetry/core';
-import {
- toZipkinSpan,
- _toZipkinTags,
- _toZipkinAnnotations,
- statusCodeTagName,
- statusDescriptionTagName,
-} from '../src/transform';
-import * as zipkinTypes from '../src/types';
-import { Resource } from '@opentelemetry/resources';
-
-const logger = new NoopLogger();
-const tracer = new BasicTracerProvider({
- logger,
-}).getTracer('default');
-const parentId = '5c1c63257de34c67';
-const spanContext: types.SpanContext = {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: types.TraceFlags.SAMPLED,
-};
-
-const DUMMY_RESOUCE = new Resource({
- service: 'ui',
- version: 1,
- cost: 112.12,
-});
-
-describe('transform', () => {
- describe('toZipkinSpan', () => {
- it('should convert an OpenTelemetry span to a Zipkin span', () => {
- const span = new Span(
- tracer,
- 'my-span',
- spanContext,
- types.SpanKind.SERVER,
- parentId
- );
- span.setAttributes({
- key1: 'value1',
- key2: 'value2',
- });
- span.addEvent('my-event', { key3: 'value3' });
- span.end();
-
- const zipkinSpan = toZipkinSpan(
- span.toReadableSpan(),
- 'my-service',
- statusCodeTagName,
- statusDescriptionTagName
- );
- assert.deepStrictEqual(zipkinSpan, {
- kind: 'SERVER',
- annotations: [
- {
- value: 'my-event',
- timestamp: hrTimeToMicroseconds(span.events[0].time),
- },
- ],
- duration: hrTimeToMicroseconds(
- hrTimeDuration(span.startTime, span.endTime)
- ),
- id: span.spanContext.spanId,
- localEndpoint: {
- serviceName: 'my-service',
- },
- name: span.name,
- parentId,
- tags: {
- key1: 'value1',
- key2: 'value2',
- [statusCodeTagName]: 'OK',
- 'telemetry.sdk.language': 'nodejs',
- 'telemetry.sdk.name': 'opentelemetry',
- 'telemetry.sdk.version': VERSION,
- },
- timestamp: hrTimeToMicroseconds(span.startTime),
- traceId: span.spanContext.traceId,
- });
- });
- it("should skip parentSpanId if doesn't exist", () => {
- const span = new Span(
- tracer,
- 'my-span',
- spanContext,
- types.SpanKind.SERVER
- );
- span.end();
-
- const zipkinSpan = toZipkinSpan(
- span.toReadableSpan(),
- 'my-service',
- statusCodeTagName,
- statusDescriptionTagName
- );
- assert.deepStrictEqual(zipkinSpan, {
- kind: 'SERVER',
- annotations: undefined,
- duration: hrTimeToMicroseconds(
- hrTimeDuration(span.startTime, span.endTime)
- ),
- id: span.spanContext.spanId,
- localEndpoint: {
- serviceName: 'my-service',
- },
- name: span.name,
- parentId: undefined,
- tags: {
- [statusCodeTagName]: 'OK',
- 'telemetry.sdk.language': 'nodejs',
- 'telemetry.sdk.name': 'opentelemetry',
- 'telemetry.sdk.version': VERSION,
- },
- timestamp: hrTimeToMicroseconds(span.startTime),
- traceId: span.spanContext.traceId,
- });
- });
- // SpanKind mapping tests
- [
- { ot: types.SpanKind.CLIENT, zipkin: 'CLIENT' },
- { ot: types.SpanKind.SERVER, zipkin: 'SERVER' },
- { ot: types.SpanKind.CONSUMER, zipkin: 'CONSUMER' },
- { ot: types.SpanKind.PRODUCER, zipkin: 'PRODUCER' },
- { ot: types.SpanKind.INTERNAL, zipkin: undefined },
- ].forEach(item =>
- it(`should map OpenTelemetry SpanKind ${
- types.SpanKind[item.ot]
- } to Zipkin ${item.zipkin}`, () => {
- const span = new Span(tracer, 'my-span', spanContext, item.ot);
- span.end();
-
- const zipkinSpan = toZipkinSpan(
- span.toReadableSpan(),
- 'my-service',
- statusCodeTagName,
- statusDescriptionTagName
- );
- assert.deepStrictEqual(zipkinSpan, {
- kind: item.zipkin,
- annotations: undefined,
- duration: hrTimeToMicroseconds(
- hrTimeDuration(span.startTime, span.endTime)
- ),
- id: span.spanContext.spanId,
- localEndpoint: {
- serviceName: 'my-service',
- },
- name: span.name,
- parentId: undefined,
- tags: {
- [statusCodeTagName]: 'OK',
- 'telemetry.sdk.language': 'nodejs',
- 'telemetry.sdk.name': 'opentelemetry',
- 'telemetry.sdk.version': VERSION,
- },
- timestamp: hrTimeToMicroseconds(span.startTime),
- traceId: span.spanContext.traceId,
- });
- })
- );
- });
-
- describe('_toZipkinTags', () => {
- it('should convert OpenTelemetry attributes to Zipkin tags', () => {
- const span = new Span(
- tracer,
- 'my-span',
- spanContext,
- types.SpanKind.SERVER,
- parentId
- );
- span.setAttributes({
- key1: 'value1',
- key2: 'value2',
- });
- const tags: zipkinTypes.Tags = _toZipkinTags(
- span.attributes,
- span.status,
- statusCodeTagName,
- statusDescriptionTagName,
- DUMMY_RESOUCE
- );
-
- assert.deepStrictEqual(tags, {
- key1: 'value1',
- key2: 'value2',
- [statusCodeTagName]: 'OK',
- cost: 112.12,
- service: 'ui',
- version: 1,
- });
- });
- it('should map OpenTelemetry Status.code to a Zipkin tag', () => {
- const span = new Span(
- tracer,
- 'my-span',
- spanContext,
- types.SpanKind.SERVER,
- parentId
- );
- const status: types.Status = {
- code: types.CanonicalCode.ABORTED,
- };
- span.setStatus(status);
- span.setAttributes({
- key1: 'value1',
- key2: 'value2',
- });
- const tags: zipkinTypes.Tags = _toZipkinTags(
- span.attributes,
- span.status,
- statusCodeTagName,
- statusDescriptionTagName,
- Resource.empty()
- );
-
- assert.deepStrictEqual(tags, {
- key1: 'value1',
- key2: 'value2',
- [statusCodeTagName]: 'ABORTED',
- });
- });
- it('should map OpenTelemetry Status.message to a Zipkin tag', () => {
- const span = new Span(
- tracer,
- 'my-span',
- spanContext,
- types.SpanKind.SERVER,
- parentId
- );
- const status: types.Status = {
- code: types.CanonicalCode.ABORTED,
- message: 'my-message',
- };
- span.setStatus(status);
- span.setAttributes({
- key1: 'value1',
- key2: 'value2',
- });
- const tags: zipkinTypes.Tags = _toZipkinTags(
- span.attributes,
- span.status,
- statusCodeTagName,
- statusDescriptionTagName,
- Resource.empty()
- );
-
- assert.deepStrictEqual(tags, {
- key1: 'value1',
- key2: 'value2',
- [statusCodeTagName]: 'ABORTED',
- [statusDescriptionTagName]: status.message,
- });
- });
- });
-
- describe('_toZipkinAnnotations', () => {
- it('should convert OpenTelemetry events to Zipkin annotations', () => {
- const span = new Span(
- tracer,
- 'my-span',
- spanContext,
- types.SpanKind.SERVER,
- parentId
- );
- span.addEvent('my-event1');
- span.addEvent('my-event2', { key1: 'value1' });
-
- const annotations = _toZipkinAnnotations(span.events);
- assert.deepStrictEqual(annotations, [
- {
- value: 'my-event1',
- timestamp: hrTimeToMicroseconds(span.events[0].time),
- },
- {
- value: 'my-event2',
- timestamp: hrTimeToMicroseconds(span.events[1].time),
- },
- ]);
- });
- });
-});
diff --git a/packages/opentelemetry-exporter-zipkin/test/zipkin.test.ts b/packages/opentelemetry-exporter-zipkin/test/zipkin.test.ts
deleted file mode 100644
index bd0105e553..0000000000
--- a/packages/opentelemetry-exporter-zipkin/test/zipkin.test.ts
+++ /dev/null
@@ -1,345 +0,0 @@
-/**
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import * as nock from 'nock';
-import { ReadableSpan } from '@opentelemetry/tracing';
-import { ExportResult } from '@opentelemetry/base';
-import { NoopLogger, hrTimeToMicroseconds } from '@opentelemetry/core';
-import * as types from '@opentelemetry/api';
-import { Resource } from '@opentelemetry/resources';
-import { ZipkinExporter } from '../src';
-import * as zipkinTypes from '../src/types';
-import { OT_REQUEST_HEADER } from '../src/utils';
-import { TraceFlags } from '@opentelemetry/api';
-
-const MICROS_PER_SECS = 1e6;
-
-function getReadableSpan() {
- const startTime = 1566156729709;
- const duration = 2000;
- const readableSpan: ReadableSpan = {
- name: 'my-span',
- kind: types.SpanKind.INTERNAL,
- spanContext: {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.NONE,
- },
- startTime: [startTime, 0],
- endTime: [startTime + duration, 0],
- ended: true,
- duration: [duration, 0],
- status: {
- code: types.CanonicalCode.OK,
- },
- attributes: {},
- links: [],
- events: [],
- resource: Resource.empty(),
- };
- return readableSpan;
-}
-
-describe('ZipkinExporter', () => {
- describe('constructor', () => {
- it('should construct an exporter', () => {
- const exporter = new ZipkinExporter({ serviceName: 'my-service' });
- assert.ok(typeof exporter.export === 'function');
- assert.ok(typeof exporter.shutdown === 'function');
- });
- it('should construct an exporter with url', () => {
- const exporter = new ZipkinExporter({
- serviceName: 'my-service',
- url: 'http://localhost',
- });
- assert.ok(typeof exporter.export === 'function');
- assert.ok(typeof exporter.shutdown === 'function');
- });
- it('should construct an exporter with logger', () => {
- const exporter = new ZipkinExporter({
- serviceName: 'my-service',
- logger: new NoopLogger(),
- });
- assert.ok(typeof exporter.export === 'function');
- assert.ok(typeof exporter.shutdown === 'function');
- });
- it('should construct an exporter with statusCodeTagName', () => {
- const exporter = new ZipkinExporter({
- serviceName: 'my-service',
- statusCodeTagName: 'code',
- });
- assert.ok(typeof exporter.export === 'function');
- assert.ok(typeof exporter.shutdown === 'function');
- });
- it('should construct an exporter with statusDescriptionTagName', () => {
- const exporter = new ZipkinExporter({
- serviceName: 'my-service',
- statusDescriptionTagName: 'description',
- });
- assert.ok(typeof exporter.export === 'function');
- assert.ok(typeof exporter.shutdown === 'function');
- });
- });
-
- describe('export', () => {
- before(() => {
- nock.disableNetConnect();
- });
-
- after(() => {
- nock.enableNetConnect();
- });
-
- it('should skip send with empty array', () => {
- const exporter = new ZipkinExporter({
- serviceName: 'my-service',
- logger: new NoopLogger(),
- });
-
- exporter.export([], (result: ExportResult) => {
- assert.strictEqual(result, ExportResult.SUCCESS);
- });
- });
-
- it('should send spans to Zipkin backend and return with Success', () => {
- let requestBody: [zipkinTypes.Span];
- const scope = nock('http://localhost:9411')
- .post('/api/v2/spans', (body: [zipkinTypes.Span]) => {
- requestBody = body;
- return true;
- })
- .reply(202);
-
- const parentSpanId = '5c1c63257de34c67';
- const startTime = 1566156729709;
- const duration = 2000;
-
- const span1: ReadableSpan = {
- name: 'my-span',
- kind: types.SpanKind.INTERNAL,
- parentSpanId,
- spanContext: {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.NONE,
- },
- startTime: [startTime, 0],
- endTime: [startTime + duration, 0],
- ended: true,
- duration: [duration, 0],
- status: {
- code: types.CanonicalCode.OK,
- },
- attributes: {
- key1: 'value1',
- key2: 'value2',
- },
- links: [],
- events: [
- {
- name: 'my-event',
- time: [startTime + 10, 0],
- attributes: { key3: 'value3' },
- },
- ],
- resource: Resource.empty(),
- };
- const span2: ReadableSpan = {
- name: 'my-span',
- kind: types.SpanKind.SERVER,
- spanContext: {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.NONE,
- },
- startTime: [startTime, 0],
- endTime: [startTime + duration, 0],
- ended: true,
- duration: [duration, 0],
- status: {
- code: types.CanonicalCode.OK,
- },
- attributes: {},
- links: [],
- events: [],
- resource: Resource.empty(),
- };
-
- const exporter = new ZipkinExporter({
- serviceName: 'my-service',
- logger: new NoopLogger(),
- });
-
- exporter.export([span1, span2], (result: ExportResult) => {
- scope.done();
- assert.strictEqual(result, ExportResult.SUCCESS);
- assert.deepStrictEqual(requestBody, [
- // Span 1
- {
- annotations: [
- {
- value: 'my-event',
- timestamp: (startTime + 10) * MICROS_PER_SECS,
- },
- ],
- duration: duration * MICROS_PER_SECS,
- id: span1.spanContext.spanId,
- localEndpoint: {
- serviceName: 'my-service',
- },
- name: span1.name,
- parentId: parentSpanId,
- tags: {
- key1: 'value1',
- key2: 'value2',
- 'ot.status_code': 'OK',
- },
- timestamp: startTime * MICROS_PER_SECS,
- traceId: span1.spanContext.traceId,
- },
- // Span 2
- {
- duration: duration * MICROS_PER_SECS,
- id: span2.spanContext.spanId,
- kind: 'SERVER',
- localEndpoint: {
- serviceName: 'my-service',
- },
- name: span2.name,
- tags: {
- 'ot.status_code': 'OK',
- },
- timestamp: hrTimeToMicroseconds([startTime, 0]),
- traceId: span2.spanContext.traceId,
- },
- ]);
- });
- });
-
- it('should support https protocol', () => {
- const scope = nock('https://localhost:9411')
- .post('/api/v2/spans')
- .reply(200);
-
- const exporter = new ZipkinExporter({
- serviceName: 'my-service',
- logger: new NoopLogger(),
- url: 'https://localhost:9411/api/v2/spans',
- });
-
- exporter.export([getReadableSpan()], (result: ExportResult) => {
- scope.done();
- assert.strictEqual(result, ExportResult.SUCCESS);
- });
- });
-
- it(`should send '${OT_REQUEST_HEADER}' header`, () => {
- const scope = nock('https://localhost:9411')
- .post('/api/v2/spans')
- .reply(function(uri, requestBody, cb) {
- assert.ok(this.req.headers[OT_REQUEST_HEADER]);
- cb(null, [200, 'Ok']);
- });
-
- const exporter = new ZipkinExporter({
- serviceName: 'my-service',
- logger: new NoopLogger(),
- url: 'https://localhost:9411/api/v2/spans',
- });
-
- exporter.export([getReadableSpan()], (result: ExportResult) => {
- scope.done();
- assert.strictEqual(result, ExportResult.SUCCESS);
- });
- });
-
- it('should return FailedNonRetryable with 4xx', () => {
- const scope = nock('http://localhost:9411')
- .post('/api/v2/spans')
- .reply(400);
-
- const exporter = new ZipkinExporter({
- serviceName: 'my-service',
- logger: new NoopLogger(),
- });
-
- exporter.export([getReadableSpan()], (result: ExportResult) => {
- scope.done();
- assert.strictEqual(result, ExportResult.FAILED_NOT_RETRYABLE);
- });
- });
-
- it('should return FailedRetryable with 5xx', () => {
- const scope = nock('http://localhost:9411')
- .post('/api/v2/spans')
- .reply(500);
-
- const exporter = new ZipkinExporter({
- serviceName: 'my-service',
- logger: new NoopLogger(),
- });
-
- exporter.export([getReadableSpan()], (result: ExportResult) => {
- scope.done();
- assert.strictEqual(result, ExportResult.FAILED_RETRYABLE);
- });
- });
-
- it('should return FailedRetryable with socket error', () => {
- const scope = nock('http://localhost:9411')
- .post('/api/v2/spans')
- .replyWithError(new Error('My Socket Error'));
-
- const exporter = new ZipkinExporter({
- serviceName: 'my-service',
- logger: new NoopLogger(),
- });
-
- exporter.export([getReadableSpan()], (result: ExportResult) => {
- scope.done();
- assert.strictEqual(result, ExportResult.FAILED_RETRYABLE);
- });
- });
-
- it('should return FailedNonRetryable after shutdown', done => {
- const exporter = new ZipkinExporter({
- serviceName: 'my-service',
- logger: new NoopLogger(),
- });
-
- exporter.shutdown();
-
- exporter.export([getReadableSpan()], (result: ExportResult) => {
- assert.strictEqual(result, ExportResult.FAILED_NOT_RETRYABLE);
- done();
- });
- });
- });
-
- describe('shutdown', () => {
- before(() => {
- nock.disableNetConnect();
- });
-
- after(() => {
- nock.enableNetConnect();
- });
-
- // @todo: implement
- it('should send by default');
- });
-});
diff --git a/packages/opentelemetry-metrics/README.md b/packages/opentelemetry-metrics/README.md
deleted file mode 100644
index eb516f6948..0000000000
--- a/packages/opentelemetry-metrics/README.md
+++ /dev/null
@@ -1,62 +0,0 @@
-# OpenTelemetry Metrics SDK
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![devDependencies][devDependencies-image]][devDependencies-url]
-[![Apache License][license-image]][license-image]
-
-OpenTelemetry metrics allow a user to collect data and export it to a metrics backend like [Prometheus](https://prometheus.io/).
-
-## Installation
-
-```bash
-npm install --save @opentelemetry/metrics
-```
-
-## Usage
-
-### Counter
-Choose this kind of metric when the value is a quantity, the sum is of primary interest, and the event count and value distribution are not of primary interest. Counters are defined as `Monotonic = true` by default, meaning that positive values are expected.
-
-```js
-const { MeterProvider } = require('@opentelemetry/metrics');
-
-// Initialize the Meter to capture measurements in various ways.
-const meter = new MeterProvider().getMeter('your-meter-name');
-
-const counter = meter.createCounter('metric_name', {
- labelKeys: ["pid"],
- description: "Example of a counter"
-});
-
-const labels = { pid: process.pid };
-
-// Create a BoundInstrument associated with specified label values.
-const boundCounter = counter.bind(labels);
-boundCounter.add(10);
-```
-
-See [examples/prometheus](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/prometheus) for a short example.
-
-### Measure
-***Work in progress***
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more about OpenTelemetry JavaScript:
-- For help or feedback on this project, join us on [gitter][gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-metrics
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-metrics
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-metrics
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-metrics&type=dev
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/metrics
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fmetrics.svg
diff --git a/packages/opentelemetry-metrics/package.json b/packages/opentelemetry-metrics/package.json
deleted file mode 100644
index a4c02a7a9e..0000000000
--- a/packages/opentelemetry-metrics/package.json
+++ /dev/null
@@ -1,65 +0,0 @@
-{
- "name": "@opentelemetry/metrics",
- "version": "0.6.1",
- "description": "OpenTelemetry metrics SDK",
- "main": "build/src/index.js",
- "types": "build/src/index.d.ts",
- "repository": "open-telemetry/opentelemetry-js",
- "scripts": {
- "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": "gts check",
- "lint:fix": "gts 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"
- },
- "keywords": [
- "opentelemetry",
- "nodejs",
- "metrics",
- "stats",
- "profiling"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.9",
- "@types/sinon": "^7.0.13",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "mocha": "^6.2.0",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "sinon": "^7.5.0",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "3.7.2"
- },
- "dependencies": {
- "@opentelemetry/api": "^0.6.1",
- "@opentelemetry/base": "^0.6.1",
- "@opentelemetry/core": "^0.6.1",
- "@opentelemetry/resources": "^0.6.1"
- }
-}
diff --git a/packages/opentelemetry-metrics/src/BoundInstrument.ts b/packages/opentelemetry-metrics/src/BoundInstrument.ts
deleted file mode 100644
index e7db73dd40..0000000000
--- a/packages/opentelemetry-metrics/src/BoundInstrument.ts
+++ /dev/null
@@ -1,154 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as types from '@opentelemetry/api';
-import { Aggregator } from './export/types';
-import { ObserverResult } from './ObserverResult';
-
-/**
- * This class represent the base to BoundInstrument, which is responsible for generating
- * the TimeSeries.
- */
-export class BaseBoundInstrument {
- protected _labels: types.Labels;
- protected _logger: types.Logger;
- protected _monotonic: boolean;
-
- constructor(
- labels: types.Labels,
- logger: types.Logger,
- monotonic: boolean,
- private readonly _disabled: boolean,
- private readonly _valueType: types.ValueType,
- private readonly _aggregator: Aggregator
- ) {
- this._labels = labels;
- this._logger = logger;
- this._monotonic = monotonic;
- }
-
- update(value: number): void {
- if (this._disabled) return;
-
- if (this._valueType === types.ValueType.INT && !Number.isInteger(value)) {
- this._logger.warn(
- `INT value type cannot accept a floating-point value for ${Object.values(
- this._labels
- )}, ignoring the fractional digits.`
- );
- value = Math.trunc(value);
- }
-
- this._aggregator.update(value);
- }
-
- getLabels(): types.Labels {
- return this._labels;
- }
-
- getAggregator(): Aggregator {
- return this._aggregator;
- }
-}
-
-/**
- * BoundCounter allows the SDK to observe/record a single metric event. The
- * value of single instrument in the `Counter` associated with specified Labels.
- */
-export class BoundCounter extends BaseBoundInstrument
- implements types.BoundCounter {
- constructor(
- labels: types.Labels,
- disabled: boolean,
- monotonic: boolean,
- valueType: types.ValueType,
- logger: types.Logger,
- aggregator: Aggregator
- ) {
- super(labels, logger, monotonic, disabled, valueType, aggregator);
- }
-
- add(value: number): void {
- if (this._monotonic && value < 0) {
- this._logger.error(
- `Monotonic counter cannot descend for ${Object.values(this._labels)}`
- );
- return;
- }
-
- this.update(value);
- }
-}
-
-/**
- * BoundMeasure is an implementation of the {@link BoundMeasure} interface.
- */
-export class BoundMeasure extends BaseBoundInstrument
- implements types.BoundMeasure {
- private readonly _absolute: boolean;
-
- constructor(
- labels: types.Labels,
- disabled: boolean,
- monotonic: boolean,
- absolute: boolean,
- valueType: types.ValueType,
- logger: types.Logger,
- aggregator: Aggregator
- ) {
- super(labels, logger, monotonic, disabled, valueType, aggregator);
- this._absolute = absolute;
- }
-
- record(
- value: number,
- correlationContext?: types.CorrelationContext,
- spanContext?: types.SpanContext
- ): void {
- if (this._absolute && value < 0) {
- this._logger.error(
- `Absolute measure cannot contain negative values for $${Object.values(
- this._labels
- )}`
- );
- return;
- }
-
- this.update(value);
- }
-}
-
-/**
- * BoundObserver is an implementation of the {@link BoundObserver} interface.
- */
-export class BoundObserver extends BaseBoundInstrument
- implements types.BoundObserver {
- constructor(
- labels: types.Labels,
- disabled: boolean,
- monotonic: boolean,
- valueType: types.ValueType,
- logger: types.Logger,
- aggregator: Aggregator
- ) {
- super(labels, logger, monotonic, disabled, valueType, aggregator);
- }
-
- setCallback(callback: (observerResult: types.ObserverResult) => void): void {
- const observerResult = new ObserverResult();
- callback(observerResult);
- }
-}
diff --git a/packages/opentelemetry-metrics/src/Meter.ts b/packages/opentelemetry-metrics/src/Meter.ts
deleted file mode 100644
index 091a96b435..0000000000
--- a/packages/opentelemetry-metrics/src/Meter.ts
+++ /dev/null
@@ -1,196 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as types from '@opentelemetry/api';
-import { ConsoleLogger } from '@opentelemetry/core';
-import { Resource } from '@opentelemetry/resources';
-import { BaseBoundInstrument } from './BoundInstrument';
-import { Metric, CounterMetric, MeasureMetric, ObserverMetric } from './Metric';
-import {
- MetricOptions,
- DEFAULT_METRIC_OPTIONS,
- DEFAULT_CONFIG,
- MeterConfig,
-} from './types';
-import { Batcher, UngroupedBatcher } from './export/Batcher';
-import { PushController } from './export/Controller';
-import { NoopExporter } from './export/NoopExporter';
-
-/**
- * Meter is an implementation of the {@link Meter} interface.
- */
-export class Meter implements types.Meter {
- private readonly _logger: types.Logger;
- private readonly _metrics = new Map>();
- private readonly _batcher: Batcher;
- private readonly _resource: Resource;
-
- /**
- * Constructs a new Meter instance.
- */
- constructor(config: MeterConfig = DEFAULT_CONFIG) {
- this._logger = config.logger || new ConsoleLogger(config.logLevel);
- this._batcher = config.batcher ?? new UngroupedBatcher();
- this._resource = config.resource || Resource.createTelemetrySDKResource();
- // start the push controller
- const exporter = config.exporter || new NoopExporter();
- const interval = config.interval;
- new PushController(this, exporter, interval);
- }
-
- /**
- * Creates and returns a new {@link Measure}.
- * @param name the name of the metric.
- * @param [options] the metric options.
- */
- createMeasure(
- name: string,
- options?: types.MetricOptions
- ): types.Metric {
- if (!this._isValidName(name)) {
- this._logger.warn(
- `Invalid metric name ${name}. Defaulting to noop metric implementation.`
- );
- return types.NOOP_MEASURE_METRIC;
- }
- const opt: MetricOptions = {
- absolute: true, // Measures are defined as absolute by default
- monotonic: false, // not applicable to measure, set to false
- logger: this._logger,
- ...DEFAULT_METRIC_OPTIONS,
- ...options,
- };
-
- const measure = new MeasureMetric(name, opt, this._batcher, this._resource);
- this._registerMetric(name, measure);
- return measure;
- }
-
- /**
- * Creates a new counter metric. Generally, this kind of metric when the
- * value is a quantity, the sum is of primary interest, and the event count
- * and value distribution are not of primary interest.
- * @param name the name of the metric.
- * @param [options] the metric options.
- */
- createCounter(
- name: string,
- options?: types.MetricOptions
- ): types.Metric {
- if (!this._isValidName(name)) {
- this._logger.warn(
- `Invalid metric name ${name}. Defaulting to noop metric implementation.`
- );
- return types.NOOP_COUNTER_METRIC;
- }
- const opt: MetricOptions = {
- monotonic: true, // Counters are defined as monotonic by default
- absolute: false, // not applicable to counter, set to false
- logger: this._logger,
- ...DEFAULT_METRIC_OPTIONS,
- ...options,
- };
- const counter = new CounterMetric(name, opt, this._batcher, this._resource);
- this._registerMetric(name, counter);
- return counter;
- }
-
- /**
- * Creates a new observer metric.
- * @param name the name of the metric.
- * @param [options] the metric options.
- */
- createObserver(
- name: string,
- options?: types.MetricOptions
- ): types.Metric {
- if (!this._isValidName(name)) {
- this._logger.warn(
- `Invalid metric name ${name}. Defaulting to noop metric implementation.`
- );
- return types.NOOP_OBSERVER_METRIC;
- }
- const opt: MetricOptions = {
- monotonic: false, // Observers are defined as non-monotonic by default
- absolute: false, // not applicable to observer, set to false
- logger: this._logger,
- ...DEFAULT_METRIC_OPTIONS,
- ...options,
- };
- const observer = new ObserverMetric(
- name,
- opt,
- this._batcher,
- this._resource
- );
- this._registerMetric(name, observer);
- return observer;
- }
-
- /**
- * Collects all the metrics created with this `Meter` for export.
- *
- * Utilizes the batcher to create checkpoints of the current values in
- * each aggregator belonging to the metrics that were created with this
- * meter instance.
- */
- collect() {
- Array.from(this._metrics.values()).forEach(metric => {
- metric.getMetricRecord().forEach(record => {
- this._batcher.process(record);
- });
- });
- }
-
- getBatcher(): Batcher {
- return this._batcher;
- }
-
- /**
- * Registers metric to register.
- * @param name The name of the metric.
- * @param metric The metric to register.
- */
- private _registerMetric(
- name: string,
- metric: Metric
- ): void {
- if (this._metrics.has(name)) {
- this._logger.error(
- `A metric with the name ${name} has already been registered.`
- );
- return;
- }
- this._metrics.set(name, metric);
- }
-
- /**
- * Ensure a metric name conforms to the following rules:
- *
- * 1. They are non-empty strings
- *
- * 2. The first character must be non-numeric, non-space, non-punctuation
- *
- * 3. Subsequent characters must be belong to the alphanumeric characters, '_', '.', and '-'.
- *
- * Names are case insensitive
- *
- * @param name Name of metric to be created
- */
- private _isValidName(name: string): boolean {
- return Boolean(name.match(/^[a-z][a-z0-9_.\-]*$/i));
- }
-}
diff --git a/packages/opentelemetry-metrics/src/MeterProvider.ts b/packages/opentelemetry-metrics/src/MeterProvider.ts
deleted file mode 100644
index 09bd9f8e66..0000000000
--- a/packages/opentelemetry-metrics/src/MeterProvider.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { ConsoleLogger } from '@opentelemetry/core';
-import * as types from '@opentelemetry/api';
-import { Resource } from '@opentelemetry/resources';
-import { Meter } from '.';
-import { DEFAULT_CONFIG, MeterConfig } from './types';
-
-/**
- * This class represents a meter provider which platform libraries can extend
- */
-export class MeterProvider implements types.MeterProvider {
- private readonly _meters: Map = new Map();
- readonly resource: Resource = Resource.createTelemetrySDKResource();
- readonly logger: types.Logger;
-
- constructor(private _config: MeterConfig = DEFAULT_CONFIG) {
- this.logger = _config.logger || new ConsoleLogger(_config.logLevel);
- }
-
- /**
- * Returns a Meter, creating one if one with the given name and version is not already created
- *
- * @returns Meter A Meter with the given name and version
- */
- getMeter(name: string, version = '*', config?: MeterConfig): Meter {
- const key = `${name}@${version}`;
- if (!this._meters.has(key)) {
- this._meters.set(key, new Meter(config || this._config));
- }
-
- return this._meters.get(key)!;
- }
-}
diff --git a/packages/opentelemetry-metrics/src/Metric.ts b/packages/opentelemetry-metrics/src/Metric.ts
deleted file mode 100644
index 6d81b4e2f2..0000000000
--- a/packages/opentelemetry-metrics/src/Metric.ts
+++ /dev/null
@@ -1,213 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as types from '@opentelemetry/api';
-import { Resource } from '@opentelemetry/resources';
-import {
- BoundCounter,
- BaseBoundInstrument,
- BoundMeasure,
- BoundObserver,
-} from './BoundInstrument';
-import { ObserverResult } from './ObserverResult';
-import { MetricOptions } from './types';
-import { MetricKind, MetricDescriptor, MetricRecord } from './export/types';
-import { Batcher } from './export/Batcher';
-import { hashLabels } from './Utils';
-
-/** This is a SDK implementation of {@link Metric} interface. */
-export abstract class Metric
- implements types.Metric {
- protected readonly _monotonic: boolean;
- protected readonly _disabled: boolean;
- protected readonly _valueType: types.ValueType;
- protected readonly _logger: types.Logger;
- private readonly _descriptor: MetricDescriptor;
- private readonly _instruments: Map = new Map();
-
- constructor(
- private readonly _name: string,
- private readonly _options: MetricOptions,
- private readonly _kind: MetricKind,
- readonly resource: Resource
- ) {
- this._monotonic = _options.monotonic;
- this._disabled = _options.disabled;
- this._valueType = _options.valueType;
- this._logger = _options.logger;
- this._descriptor = this._getMetricDescriptor();
- }
-
- /**
- * Returns an Instrument associated with specified Labels.
- * It is recommended to keep a reference to the Instrument instead of always
- * calling this method for each operation.
- * @param labels key-values pairs that are associated with a specific metric
- * that you want to record.
- */
- bind(labels: types.Labels): T {
- const hash = hashLabels(labels);
- if (this._instruments.has(hash)) return this._instruments.get(hash)!;
-
- const instrument = this._makeInstrument(labels);
- this._instruments.set(hash, instrument);
- return instrument;
- }
-
- /**
- * Removes the Instrument from the metric, if it is present.
- * @param labels key-values pairs that are associated with a specific metric.
- */
- unbind(labels: types.Labels): void {
- this._instruments.delete(hashLabels(labels));
- }
-
- /**
- * Clears all Instruments from the Metric.
- */
- clear(): void {
- this._instruments.clear();
- }
-
- getMetricRecord(): MetricRecord[] {
- return Array.from(this._instruments.values()).map(instrument => ({
- descriptor: this._descriptor,
- labels: instrument.getLabels(),
- aggregator: instrument.getAggregator(),
- }));
- }
-
- private _getMetricDescriptor(): MetricDescriptor {
- return {
- name: this._name,
- description: this._options.description,
- unit: this._options.unit,
- metricKind: this._kind,
- valueType: this._valueType,
- labelKeys: this._options.labelKeys,
- monotonic: this._monotonic,
- };
- }
-
- protected abstract _makeInstrument(labels: types.Labels): T;
-}
-
-/** This is a SDK implementation of Counter Metric. */
-export class CounterMetric extends Metric
- implements Pick {
- constructor(
- name: string,
- options: MetricOptions,
- private readonly _batcher: Batcher,
- resource: Resource
- ) {
- super(name, options, MetricKind.COUNTER, resource);
- }
- protected _makeInstrument(labels: types.Labels): BoundCounter {
- return new BoundCounter(
- labels,
- this._disabled,
- this._monotonic,
- this._valueType,
- this._logger,
- // @todo: consider to set to CounterSumAggregator always.
- this._batcher.aggregatorFor(MetricKind.COUNTER)
- );
- }
-
- /**
- * Adds the given value to the current value. Values cannot be negative.
- * @param value the value to add.
- * @param labels key-values pairs that are associated with a specific metric
- * that you want to record.
- */
- add(value: number, labels: types.Labels) {
- this.bind(labels).add(value);
- }
-}
-
-export class MeasureMetric extends Metric
- implements Pick {
- protected readonly _absolute: boolean;
-
- constructor(
- name: string,
- options: MetricOptions,
- private readonly _batcher: Batcher,
- resource: Resource
- ) {
- super(name, options, MetricKind.MEASURE, resource);
-
- this._absolute = options.absolute !== undefined ? options.absolute : true; // Absolute default is true
- }
- protected _makeInstrument(labels: types.Labels): BoundMeasure {
- return new BoundMeasure(
- labels,
- this._disabled,
- this._monotonic,
- this._absolute,
- this._valueType,
- this._logger,
- this._batcher.aggregatorFor(MetricKind.MEASURE)
- );
- }
-
- record(value: number, labels: types.Labels) {
- this.bind(labels).record(value);
- }
-}
-
-/** This is a SDK implementation of Observer Metric. */
-export class ObserverMetric extends Metric
- implements Pick {
- private _observerResult: types.ObserverResult = new ObserverResult();
-
- constructor(
- name: string,
- options: MetricOptions,
- private readonly _batcher: Batcher,
- resource: Resource
- ) {
- super(name, options, MetricKind.OBSERVER, resource);
- }
-
- protected _makeInstrument(labels: types.Labels): BoundObserver {
- return new BoundObserver(
- labels,
- this._disabled,
- this._monotonic,
- this._valueType,
- this._logger,
- this._batcher.aggregatorFor(MetricKind.OBSERVER)
- );
- }
-
- getMetricRecord(): MetricRecord[] {
- this._observerResult.observers.forEach((callback, labels) => {
- const instrument = this.bind(labels);
- instrument.update(callback());
- });
- return super.getMetricRecord();
- }
-
- /**
- * Sets a callback where user can observe value for certain labels
- * @param callback
- */
- setCallback(callback: (observerResult: types.ObserverResult) => void): void {
- callback(this._observerResult);
- }
-}
diff --git a/packages/opentelemetry-metrics/src/ObserverResult.ts b/packages/opentelemetry-metrics/src/ObserverResult.ts
deleted file mode 100644
index 1cb9ecebd4..0000000000
--- a/packages/opentelemetry-metrics/src/ObserverResult.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- ObserverResult as TypeObserverResult,
- Labels,
-} from '@opentelemetry/api';
-
-/**
- * Implementation of {@link TypeObserverResult}
- */
-export class ObserverResult implements TypeObserverResult {
- observers = new Map();
- observe(callback: any, labels: Labels): void {
- this.observers.set(labels, callback);
- }
-}
diff --git a/packages/opentelemetry-metrics/src/Utils.ts b/packages/opentelemetry-metrics/src/Utils.ts
deleted file mode 100644
index 4b94defa89..0000000000
--- a/packages/opentelemetry-metrics/src/Utils.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Labels } from '@opentelemetry/api';
-
-/**
- * Type guard to remove nulls from arrays
- *
- * @param value value to be checked for null equality
- */
-export function notNull(value: T | null): value is T {
- return value !== null;
-}
-
-/**
- * Converting the unordered labels into unique identifier string.
- * @param labels user provided unordered Labels.
- */
-export function hashLabels(labels: Labels): string {
- let keys = Object.keys(labels);
- if (keys.length === 0) return '';
-
- keys = keys.sort();
- return keys.reduce((result, key) => {
- if (result.length > 2) {
- result += ',';
- }
- return (result += key + ':' + labels[key]);
- }, '|#');
-}
diff --git a/packages/opentelemetry-metrics/src/export/Aggregator.ts b/packages/opentelemetry-metrics/src/export/Aggregator.ts
deleted file mode 100644
index d8bd4373b9..0000000000
--- a/packages/opentelemetry-metrics/src/export/Aggregator.ts
+++ /dev/null
@@ -1,85 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Aggregator, Distribution, Point } from './types';
-import { HrTime } from '@opentelemetry/api';
-import { hrTime } from '@opentelemetry/core';
-
-/** Basic aggregator which calculates a Sum from individual measurements. */
-export class CounterSumAggregator implements Aggregator {
- private _current: number = 0;
- private _lastUpdateTime: HrTime = [0, 0];
-
- update(value: number): void {
- this._current += value;
- this._lastUpdateTime = hrTime();
- }
-
- toPoint(): Point {
- return {
- value: this._current,
- timestamp: this._lastUpdateTime,
- };
- }
-}
-
-/** Basic aggregator for Observer which keeps the last recorded value. */
-export class ObserverAggregator implements Aggregator {
- private _current: number = 0;
- private _lastUpdateTime: HrTime = [0, 0];
-
- update(value: number): void {
- this._current = value;
- this._lastUpdateTime = hrTime();
- }
-
- toPoint(): Point {
- return {
- value: this._current,
- timestamp: this._lastUpdateTime,
- };
- }
-}
-
-/** Basic aggregator keeping all raw values (events, sum, max and min). */
-export class MeasureExactAggregator implements Aggregator {
- private _distribution: Distribution;
- private _lastUpdateTime: HrTime = [0, 0];
-
- constructor() {
- this._distribution = {
- min: Infinity,
- max: -Infinity,
- sum: 0,
- count: 0,
- };
- }
-
- update(value: number): void {
- this._distribution.count++;
- this._distribution.sum += value;
- this._distribution.min = Math.min(this._distribution.min, value);
- this._distribution.max = Math.max(this._distribution.max, value);
- this._lastUpdateTime = hrTime();
- }
-
- toPoint(): Point {
- return {
- value: this._distribution,
- timestamp: this._lastUpdateTime,
- };
- }
-}
diff --git a/packages/opentelemetry-metrics/src/export/Batcher.ts b/packages/opentelemetry-metrics/src/export/Batcher.ts
deleted file mode 100644
index 7caec73838..0000000000
--- a/packages/opentelemetry-metrics/src/export/Batcher.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- CounterSumAggregator,
- MeasureExactAggregator,
- ObserverAggregator,
-} from './Aggregator';
-import { MetricRecord, MetricKind, Aggregator } from './types';
-
-/**
- * Base class for all batcher types.
- *
- * The batcher is responsible for storing the aggregators and aggregated
- * values received from updates from metrics in the meter. The stored values
- * will be sent to an exporter for exporting.
- */
-export abstract class Batcher {
- protected readonly _batchMap = new Map();
-
- /** Returns an aggregator based off metric kind. */
- abstract aggregatorFor(metricKind: MetricKind): Aggregator;
-
- /** Stores record information to be ready for exporting. */
- abstract process(record: MetricRecord): void;
-
- checkPointSet(): MetricRecord[] {
- return Array.from(this._batchMap.values());
- }
-}
-
-/**
- * Batcher which retains all dimensions/labels. It accepts all records and
- * passes them for exporting.
- */
-export class UngroupedBatcher extends Batcher {
- aggregatorFor(metricKind: MetricKind): Aggregator {
- switch (metricKind) {
- case MetricKind.COUNTER:
- return new CounterSumAggregator();
- case MetricKind.OBSERVER:
- return new ObserverAggregator();
- default:
- return new MeasureExactAggregator();
- }
- }
-
- process(record: MetricRecord): void {
- const labels = record.descriptor.labelKeys
- .map(k => `${k}=${record.labels[k]}`)
- .join(',');
- this._batchMap.set(record.descriptor.name + labels, record);
- }
-}
diff --git a/packages/opentelemetry-metrics/src/export/ConsoleMetricExporter.ts b/packages/opentelemetry-metrics/src/export/ConsoleMetricExporter.ts
deleted file mode 100644
index 78e5efc069..0000000000
--- a/packages/opentelemetry-metrics/src/export/ConsoleMetricExporter.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- MetricExporter,
- MetricRecord,
- MetricKind,
- Sum,
- Distribution,
-} from './types';
-import { ExportResult } from '@opentelemetry/base';
-
-/**
- * This is implementation of {@link MetricExporter} that prints metrics data to
- * the console. This class can be used for diagnostic purposes.
- */
-export class ConsoleMetricExporter implements MetricExporter {
- export(
- metrics: MetricRecord[],
- resultCallback: (result: ExportResult) => void
- ): void {
- for (const metric of metrics) {
- console.log(metric.descriptor);
- console.log(metric.labels);
- switch (metric.descriptor.metricKind) {
- case MetricKind.COUNTER:
- const sum = metric.aggregator.toPoint().value as Sum;
- console.log('value: ' + sum);
- break;
- default:
- const distribution = metric.aggregator.toPoint()
- .value as Distribution;
- console.log(
- 'min: ' +
- distribution.min +
- ', max: ' +
- distribution.max +
- ', count: ' +
- distribution.count +
- ', sum: ' +
- distribution.sum
- );
- break;
- }
- }
- return resultCallback(ExportResult.SUCCESS);
- }
-
- shutdown(): void {
- // By default does nothing
- }
-}
diff --git a/packages/opentelemetry-metrics/src/export/Controller.ts b/packages/opentelemetry-metrics/src/export/Controller.ts
deleted file mode 100644
index ccef3213eb..0000000000
--- a/packages/opentelemetry-metrics/src/export/Controller.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { unrefTimer } from '@opentelemetry/core';
-import { Meter } from '../Meter';
-import { MetricExporter } from './types';
-import { ExportResult } from '@opentelemetry/base';
-
-const DEFAULT_EXPORT_INTERVAL = 60_000;
-
-export class Controller {}
-
-/** Controller organizes a periodic push of metric data. */
-export class PushController extends Controller {
- private _timer: NodeJS.Timeout;
-
- constructor(
- private readonly _meter: Meter,
- private readonly _exporter: MetricExporter,
- interval: number = DEFAULT_EXPORT_INTERVAL
- ) {
- super();
- this._timer = setInterval(() => {
- this._collect();
- }, interval);
- unrefTimer(this._timer);
- }
-
- private _collect() {
- this._meter.collect();
- this._exporter.export(this._meter.getBatcher().checkPointSet(), result => {
- if (result !== ExportResult.SUCCESS) {
- // @todo: log error
- }
- });
- }
-}
diff --git a/packages/opentelemetry-metrics/src/export/NoopExporter.ts b/packages/opentelemetry-metrics/src/export/NoopExporter.ts
deleted file mode 100644
index 84eab150b8..0000000000
--- a/packages/opentelemetry-metrics/src/export/NoopExporter.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { MetricExporter, MetricRecord } from './types';
-import { ExportResult } from '@opentelemetry/base';
-
-export class NoopExporter implements MetricExporter {
- // By default does nothing
- export(
- metrics: MetricRecord[],
- resultCallback: (result: ExportResult) => void
- ): void {}
-
- // By default does nothing
- shutdown(): void {}
-}
diff --git a/packages/opentelemetry-metrics/src/export/types.ts b/packages/opentelemetry-metrics/src/export/types.ts
deleted file mode 100644
index ff4f1173eb..0000000000
--- a/packages/opentelemetry-metrics/src/export/types.ts
+++ /dev/null
@@ -1,85 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { ValueType, HrTime, Labels } from '@opentelemetry/api';
-import { ExportResult } from '@opentelemetry/base';
-
-/** The kind of metric. */
-export enum MetricKind {
- COUNTER,
- MEASURE,
- OBSERVER,
-}
-
-/** Sum returns an aggregated sum. */
-export type Sum = number;
-
-/** LastValue returns last value. */
-export type LastValue = number;
-
-export interface Distribution {
- min: number;
- max: number;
- count: number;
- sum: number;
-}
-
-export interface MetricRecord {
- readonly descriptor: MetricDescriptor;
- readonly labels: Labels;
- readonly aggregator: Aggregator;
-}
-
-export interface MetricDescriptor {
- readonly name: string;
- readonly description: string;
- readonly unit: string;
- readonly metricKind: MetricKind;
- readonly valueType: ValueType;
- readonly labelKeys: string[];
- readonly monotonic: boolean;
-}
-
-/**
- * Base interface that represents a metric exporter
- */
-export interface MetricExporter {
- /** Exports the list of a given {@link MetricRecord} */
- export(
- metrics: MetricRecord[],
- resultCallback: (result: ExportResult) => void
- ): void;
-
- /** Stops the exporter. */
- shutdown(): void;
-}
-
-/**
- * Base interface for aggregators. Aggregators are responsible for holding
- * aggregated values and taking a snapshot of these values upon export.
- */
-export interface Aggregator {
- /** Updates the current with the new value. */
- update(value: number): void;
-
- /** Returns snapshot of the current point (value with timestamp). */
- toPoint(): Point;
-}
-
-export interface Point {
- value: Sum | LastValue | Distribution;
- timestamp: HrTime;
-}
diff --git a/packages/opentelemetry-metrics/src/index.ts b/packages/opentelemetry-metrics/src/index.ts
deleted file mode 100644
index c9f158528f..0000000000
--- a/packages/opentelemetry-metrics/src/index.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './BoundInstrument';
-export * from './Meter';
-export * from './Metric';
-export * from './MeterProvider';
-export * from './export/Aggregator';
-export * from './export/ConsoleMetricExporter';
-export * from './export/types';
-export * from './export/Aggregator';
diff --git a/packages/opentelemetry-metrics/src/types.ts b/packages/opentelemetry-metrics/src/types.ts
deleted file mode 100644
index 8927a80830..0000000000
--- a/packages/opentelemetry-metrics/src/types.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { LogLevel } from '@opentelemetry/core';
-import { Logger, ValueType } from '@opentelemetry/api';
-import { MetricExporter } from './export/types';
-import { Resource } from '@opentelemetry/resources';
-import { Batcher } from './export/Batcher';
-
-/** Options needed for SDK metric creation. */
-export interface MetricOptions {
- /** The name of the component that reports the Metric. */
- component?: string;
-
- /** The description of the Metric. */
- description: string;
-
- /** The unit of the Metric values. */
- unit: string;
-
- /** The list of label keys for the Metric. */
- labelKeys: string[];
-
- /** The map of constant labels for the Metric. */
- constantLabels?: Map;
-
- /** Indicates the metric is a verbose metric that is disabled by default. */
- disabled: boolean;
-
- /** Monotonic metrics may only increase. */
- monotonic: boolean;
-
- /** (Measure only) Asserts that this metric will only accept non-negative values. */
- absolute: boolean;
-
- /** User provided logger. */
- logger: Logger;
-
- /** Indicates the type of the recorded value. */
- valueType: ValueType;
-}
-
-/** MeterConfig provides an interface for configuring a Meter. */
-export interface MeterConfig {
- /** User provided logger. */
- logger?: Logger;
-
- /** level of logger. */
- logLevel?: LogLevel;
-
- /** Metric exporter. */
- exporter?: MetricExporter;
-
- /** Metric collect interval */
- interval?: number;
-
- /** Resource associated with metric telemetry */
- resource?: Resource;
-
- /** Metric batcher. */
- batcher?: Batcher;
-}
-
-/** Default Meter configuration. */
-export const DEFAULT_CONFIG = {
- logLevel: LogLevel.INFO,
-};
-
-/** The default metric creation options value. */
-export const DEFAULT_METRIC_OPTIONS = {
- disabled: false,
- description: '',
- unit: '1',
- labelKeys: [],
- valueType: ValueType.DOUBLE,
-};
diff --git a/packages/opentelemetry-metrics/test/Batcher.test.ts b/packages/opentelemetry-metrics/test/Batcher.test.ts
deleted file mode 100644
index c09998bd32..0000000000
--- a/packages/opentelemetry-metrics/test/Batcher.test.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import * as types from '@opentelemetry/api';
-import { NoopLogger } from '@opentelemetry/core';
-import { Meter, MeterProvider } from '../src';
-
-describe('Batcher', () => {
- describe('Ungrouped', () => {
- let meter: Meter;
- let fooCounter: types.BoundCounter;
- let barCounter: types.BoundCounter;
- let counter: types.Metric;
- beforeEach(() => {
- meter = new MeterProvider({
- logger: new NoopLogger(),
- interval: 10000,
- }).getMeter('test-meter');
- counter = meter.createCounter('ungrouped-batcher-test', {
- labelKeys: ['key'],
- });
- fooCounter = counter.bind({ key: 'foo' });
- barCounter = counter.bind({ key: 'bar' });
- });
-
- it('should process a batch', () => {
- fooCounter.add(1);
- barCounter.add(1);
- barCounter.add(2);
- meter.collect();
- const checkPointSet = meter.getBatcher().checkPointSet();
- assert.strictEqual(checkPointSet.length, 2);
- for (const record of checkPointSet) {
- switch (record.labels.key) {
- case 'foo':
- assert.strictEqual(record.aggregator.toPoint().value, 1);
- break;
- case 'bar':
- assert.strictEqual(record.aggregator.toPoint().value, 3);
- break;
- default:
- throw new Error('Unknown labelset');
- }
- }
- });
- });
-});
diff --git a/packages/opentelemetry-metrics/test/Meter.test.ts b/packages/opentelemetry-metrics/test/Meter.test.ts
deleted file mode 100644
index dd028bec58..0000000000
--- a/packages/opentelemetry-metrics/test/Meter.test.ts
+++ /dev/null
@@ -1,581 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import {
- Meter,
- Metric,
- CounterMetric,
- MetricKind,
- Sum,
- MeterProvider,
- MeasureMetric,
- Distribution,
- ObserverMetric,
- MetricRecord,
- Aggregator,
-} from '../src';
-import * as types from '@opentelemetry/api';
-import { NoopLogger, hrTime, hrTimeToNanoseconds } from '@opentelemetry/core';
-import {
- CounterSumAggregator,
- ObserverAggregator,
-} from '../src/export/Aggregator';
-import { ValueType } from '@opentelemetry/api';
-import { Resource } from '@opentelemetry/resources';
-import { hashLabels } from '../src/Utils';
-import { Batcher } from '../src/export/Batcher';
-
-describe('Meter', () => {
- let meter: Meter;
- const keya = 'keya';
- const keyb = 'keyb';
- const labels: types.Labels = { [keyb]: 'value2', [keya]: 'value1' };
-
- beforeEach(() => {
- meter = new MeterProvider({
- logger: new NoopLogger(),
- }).getMeter('test-meter');
- });
-
- describe('#counter', () => {
- const performanceTimeOrigin = hrTime();
-
- it('should create a counter', () => {
- const counter = meter.createCounter('name');
- assert.ok(counter instanceof Metric);
- });
-
- it('should create a counter with options', () => {
- const counter = meter.createCounter('name', {
- description: 'desc',
- unit: '1',
- disabled: false,
- monotonic: false,
- });
- assert.ok(counter instanceof Metric);
- });
-
- it('should be able to call add() directly on counter', () => {
- const counter = meter.createCounter('name') as CounterMetric;
- counter.add(10, labels);
- meter.collect();
- const [record1] = meter.getBatcher().checkPointSet();
-
- assert.strictEqual(record1.aggregator.toPoint().value, 10);
- const lastTimestamp = record1.aggregator.toPoint().timestamp;
- assert.ok(
- hrTimeToNanoseconds(lastTimestamp) >
- hrTimeToNanoseconds(performanceTimeOrigin)
- );
- counter.add(10, labels);
- assert.strictEqual(record1.aggregator.toPoint().value, 20);
-
- assert.ok(
- hrTimeToNanoseconds(record1.aggregator.toPoint().timestamp) >
- hrTimeToNanoseconds(lastTimestamp)
- );
- });
-
- it('should return counter with resource', () => {
- const counter = meter.createCounter('name') as CounterMetric;
- assert.ok(counter.resource instanceof Resource);
- });
-
- describe('.bind()', () => {
- it('should create a counter instrument', () => {
- const counter = meter.createCounter('name') as CounterMetric;
- const boundCounter = counter.bind(labels);
- boundCounter.add(10);
- meter.collect();
- const [record1] = meter.getBatcher().checkPointSet();
-
- assert.strictEqual(record1.aggregator.toPoint().value, 10);
- boundCounter.add(10);
- assert.strictEqual(record1.aggregator.toPoint().value, 20);
- });
-
- it('should return the aggregator', () => {
- const counter = meter.createCounter('name') as CounterMetric;
- const boundCounter = counter.bind(labels);
- boundCounter.add(20);
- assert.ok(boundCounter.getAggregator() instanceof CounterSumAggregator);
- assert.strictEqual(boundCounter.getLabels(), labels);
- });
-
- it('should add positive values by default', () => {
- const counter = meter.createCounter('name') as CounterMetric;
- const boundCounter = counter.bind(labels);
- boundCounter.add(10);
- assert.strictEqual(meter.getBatcher().checkPointSet().length, 0);
- meter.collect();
- const [record1] = meter.getBatcher().checkPointSet();
-
- assert.strictEqual(record1.aggregator.toPoint().value, 10);
- boundCounter.add(-100);
- assert.strictEqual(record1.aggregator.toPoint().value, 10);
- });
-
- it('should not add the instrument data when disabled', () => {
- const counter = meter.createCounter('name', {
- disabled: true,
- }) as CounterMetric;
- const boundCounter = counter.bind(labels);
- boundCounter.add(10);
- meter.collect();
- const [record1] = meter.getBatcher().checkPointSet();
- assert.strictEqual(record1.aggregator.toPoint().value, 0);
- });
-
- it('should add negative value when monotonic is set to false', () => {
- const counter = meter.createCounter('name', {
- monotonic: false,
- }) as CounterMetric;
- const boundCounter = counter.bind(labels);
- boundCounter.add(-10);
- meter.collect();
- const [record1] = meter.getBatcher().checkPointSet();
- assert.strictEqual(record1.aggregator.toPoint().value, -10);
- });
-
- it('should return same instrument on same label values', () => {
- const counter = meter.createCounter('name') as CounterMetric;
- const boundCounter = counter.bind(labels);
- boundCounter.add(10);
- const boundCounter1 = counter.bind(labels);
- boundCounter1.add(10);
- meter.collect();
- const [record1] = meter.getBatcher().checkPointSet();
-
- assert.strictEqual(record1.aggregator.toPoint().value, 20);
- assert.strictEqual(boundCounter, boundCounter1);
- });
- });
-
- describe('.unbind()', () => {
- it('should remove a counter instrument', () => {
- const counter = meter.createCounter('name') as CounterMetric;
- const boundCounter = counter.bind(labels);
- assert.strictEqual(counter['_instruments'].size, 1);
- counter.unbind(labels);
- assert.strictEqual(counter['_instruments'].size, 0);
- const boundCounter1 = counter.bind(labels);
- assert.strictEqual(counter['_instruments'].size, 1);
- assert.notStrictEqual(boundCounter, boundCounter1);
- });
-
- it('should not fail when removing non existing instrument', () => {
- const counter = meter.createCounter('name');
- counter.unbind({});
- });
-
- it('should clear all instruments', () => {
- const counter = meter.createCounter('name') as CounterMetric;
- counter.bind(labels);
- assert.strictEqual(counter['_instruments'].size, 1);
- counter.clear();
- assert.strictEqual(counter['_instruments'].size, 0);
- });
- });
-
- describe('.registerMetric()', () => {
- it('skip already registered Metric', () => {
- const counter1 = meter.createCounter('name1') as CounterMetric;
- counter1.bind(labels).add(10);
-
- // should skip below metric
- const counter2 = meter.createCounter('name1', {
- valueType: types.ValueType.INT,
- }) as CounterMetric;
- counter2.bind(labels).add(500);
-
- meter.collect();
- const record = meter.getBatcher().checkPointSet();
-
- assert.strictEqual(record.length, 1);
- assert.deepStrictEqual(record[0].descriptor, {
- description: '',
- labelKeys: [],
- metricKind: MetricKind.COUNTER,
- monotonic: true,
- name: 'name1',
- unit: '1',
- valueType: ValueType.DOUBLE,
- });
- assert.strictEqual(record[0].aggregator.toPoint().value, 10);
- });
- });
-
- describe('names', () => {
- it('should create counter with valid names', () => {
- const counter1 = meter.createCounter('name1');
- const counter2 = meter.createCounter(
- 'Name_with-all.valid_CharacterClasses'
- );
- assert.ok(counter1 instanceof CounterMetric);
- assert.ok(counter2 instanceof CounterMetric);
- });
-
- it('should return no op metric if name is an empty string', () => {
- const counter = meter.createCounter('');
- assert.ok(counter instanceof types.NoopMetric);
- });
-
- it('should return no op metric if name does not start with a letter', () => {
- const counter1 = meter.createCounter('1name');
- const counter_ = meter.createCounter('_name');
- assert.ok(counter1 instanceof types.NoopMetric);
- assert.ok(counter_ instanceof types.NoopMetric);
- });
-
- it('should return no op metric if name is an empty string contain only letters, numbers, ".", "_", and "-"', () => {
- const counter = meter.createCounter('name with invalid characters^&*(');
- assert.ok(counter instanceof types.NoopMetric);
- });
- });
- });
-
- describe('#measure', () => {
- it('should create a measure', () => {
- const measure = meter.createMeasure('name');
- assert.ok(measure instanceof Metric);
- });
-
- it('should create a measure with options', () => {
- const measure = meter.createMeasure('name', {
- description: 'desc',
- unit: '1',
- disabled: false,
- });
- assert.ok(measure instanceof Metric);
- });
-
- it('should be absolute by default', () => {
- const measure = meter.createMeasure('name', {
- description: 'desc',
- unit: '1',
- disabled: false,
- });
- assert.strictEqual((measure as MeasureMetric)['_absolute'], true);
- });
-
- it('should be able to set absolute to false', () => {
- const measure = meter.createMeasure('name', {
- description: 'desc',
- unit: '1',
- disabled: false,
- absolute: false,
- });
- assert.strictEqual((measure as MeasureMetric)['_absolute'], false);
- });
-
- it('should return a measure with resource', () => {
- const measure = meter.createMeasure('name') as MeasureMetric;
- assert.ok(measure.resource instanceof Resource);
- });
-
- describe('names', () => {
- it('should return no op metric if name is an empty string', () => {
- const measure = meter.createMeasure('');
- assert.ok(measure instanceof types.NoopMetric);
- });
-
- it('should return no op metric if name does not start with a letter', () => {
- const measure1 = meter.createMeasure('1name');
- const measure_ = meter.createMeasure('_name');
- assert.ok(measure1 instanceof types.NoopMetric);
- assert.ok(measure_ instanceof types.NoopMetric);
- });
-
- it('should return no op metric if name is an empty string contain only letters, numbers, ".", "_", and "-"', () => {
- const measure = meter.createMeasure('name with invalid characters^&*(');
- assert.ok(measure instanceof types.NoopMetric);
- });
- });
-
- describe('.bind()', () => {
- const performanceTimeOrigin = hrTime();
-
- it('should create a measure instrument', () => {
- const measure = meter.createMeasure('name') as MeasureMetric;
- const boundMeasure = measure.bind(labels);
- assert.doesNotThrow(() => boundMeasure.record(10));
- });
-
- it('should not accept negative values by default', () => {
- const measure = meter.createMeasure('name');
- const boundMeasure = measure.bind(labels);
- boundMeasure.record(-10);
-
- meter.collect();
- const [record1] = meter.getBatcher().checkPointSet();
- assert.deepStrictEqual(
- record1.aggregator.toPoint().value as Distribution,
- {
- count: 0,
- max: -Infinity,
- min: Infinity,
- sum: 0,
- }
- );
- });
-
- it('should not set the instrument data when disabled', () => {
- const measure = meter.createMeasure('name', {
- disabled: true,
- }) as MeasureMetric;
- const boundMeasure = measure.bind(labels);
- boundMeasure.record(10);
-
- meter.collect();
- const [record1] = meter.getBatcher().checkPointSet();
- assert.deepStrictEqual(
- record1.aggregator.toPoint().value as Distribution,
- {
- count: 0,
- max: -Infinity,
- min: Infinity,
- sum: 0,
- }
- );
- });
-
- it('should accept negative (and positive) values when absolute is set to false', () => {
- const measure = meter.createMeasure('name', {
- absolute: false,
- });
- const boundMeasure = measure.bind(labels);
- boundMeasure.record(-10);
- boundMeasure.record(50);
-
- meter.collect();
- const [record1] = meter.getBatcher().checkPointSet();
- assert.deepStrictEqual(
- record1.aggregator.toPoint().value as Distribution,
- {
- count: 2,
- max: 50,
- min: -10,
- sum: 40,
- }
- );
- assert.ok(
- hrTimeToNanoseconds(record1.aggregator.toPoint().timestamp) >
- hrTimeToNanoseconds(performanceTimeOrigin)
- );
- });
-
- it('should return same instrument on same label values', () => {
- const measure = meter.createMeasure('name') as MeasureMetric;
- const boundMeasure1 = measure.bind(labels);
- boundMeasure1.record(10);
- const boundMeasure2 = measure.bind(labels);
- boundMeasure2.record(100);
- meter.collect();
- const [record1] = meter.getBatcher().checkPointSet();
- assert.deepStrictEqual(
- record1.aggregator.toPoint().value as Distribution,
- {
- count: 2,
- max: 100,
- min: 10,
- sum: 110,
- }
- );
- assert.strictEqual(boundMeasure1, boundMeasure2);
- });
- });
-
- describe('.unbind()', () => {
- it('should remove the measure instrument', () => {
- const measure = meter.createMeasure('name') as MeasureMetric;
- const boundMeasure = measure.bind(labels);
- assert.strictEqual(measure['_instruments'].size, 1);
- measure.unbind(labels);
- assert.strictEqual(measure['_instruments'].size, 0);
- const boundMeasure2 = measure.bind(labels);
- assert.strictEqual(measure['_instruments'].size, 1);
- assert.notStrictEqual(boundMeasure, boundMeasure2);
- });
-
- it('should not fail when removing non existing instrument', () => {
- const measure = meter.createMeasure('name');
- measure.unbind({});
- });
-
- it('should clear all instruments', () => {
- const measure = meter.createMeasure('name') as MeasureMetric;
- measure.bind(labels);
- assert.strictEqual(measure['_instruments'].size, 1);
- measure.clear();
- assert.strictEqual(measure['_instruments'].size, 0);
- });
- });
- });
-
- describe('#observer', () => {
- it('should create an observer', () => {
- const measure = meter.createObserver('name') as ObserverMetric;
- assert.ok(measure instanceof Metric);
- });
-
- it('should create observer with options', () => {
- const measure = meter.createObserver('name', {
- description: 'desc',
- unit: '1',
- disabled: false,
- }) as ObserverMetric;
- assert.ok(measure instanceof Metric);
- });
- it('should set callback and observe value ', () => {
- const measure = meter.createObserver('name', {
- description: 'desc',
- labelKeys: ['pid', 'core'],
- }) as ObserverMetric;
-
- function getCpuUsage() {
- return Math.random();
- }
-
- measure.setCallback((observerResult: types.ObserverResult) => {
- observerResult.observe(getCpuUsage, { pid: '123', core: '1' });
- observerResult.observe(getCpuUsage, { pid: '123', core: '2' });
- observerResult.observe(getCpuUsage, { pid: '123', core: '3' });
- observerResult.observe(getCpuUsage, { pid: '123', core: '4' });
- });
-
- const metricRecords: MetricRecord[] = measure.getMetricRecord();
- assert.strictEqual(metricRecords.length, 4);
-
- const metric1 = metricRecords[0];
- const metric2 = metricRecords[1];
- const metric3 = metricRecords[2];
- const metric4 = metricRecords[3];
-
- assert.strictEqual(hashLabels(metric1.labels), '|#core:1,pid:123');
- assert.strictEqual(hashLabels(metric2.labels), '|#core:2,pid:123');
- assert.strictEqual(hashLabels(metric3.labels), '|#core:3,pid:123');
- assert.strictEqual(hashLabels(metric4.labels), '|#core:4,pid:123');
-
- ensureMetric(metric1);
- ensureMetric(metric2);
- ensureMetric(metric3);
- ensureMetric(metric4);
- });
-
- it('should return an observer with resource', () => {
- const observer = meter.createObserver('name') as ObserverMetric;
- assert.ok(observer.resource instanceof Resource);
- });
- });
-
- describe('#getMetrics', () => {
- it('should create a DOUBLE counter', () => {
- const key = 'key';
- const counter = meter.createCounter('counter', {
- description: 'test',
- labelKeys: [key],
- });
- const labels = { [key]: 'counter-value' };
- const boundCounter = counter.bind(labels);
- boundCounter.add(10.45);
-
- meter.collect();
- const record = meter.getBatcher().checkPointSet();
-
- assert.strictEqual(record.length, 1);
- assert.deepStrictEqual(record[0].descriptor, {
- name: 'counter',
- description: 'test',
- metricKind: MetricKind.COUNTER,
- monotonic: true,
- unit: '1',
- valueType: ValueType.DOUBLE,
- labelKeys: ['key'],
- });
- assert.strictEqual(record[0].labels, labels);
- const value = record[0].aggregator.toPoint().value as Sum;
- assert.strictEqual(value, 10.45);
- });
-
- it('should create a INT counter', () => {
- const key = 'key';
- const counter = meter.createCounter('counter', {
- description: 'test',
- labelKeys: [key],
- valueType: types.ValueType.INT,
- });
- const labels = { [key]: 'counter-value' };
- const boundCounter = counter.bind(labels);
- boundCounter.add(10.45);
-
- meter.collect();
- const record = meter.getBatcher().checkPointSet();
-
- assert.strictEqual(record.length, 1);
- assert.deepStrictEqual(record[0].descriptor, {
- name: 'counter',
- description: 'test',
- metricKind: MetricKind.COUNTER,
- monotonic: true,
- unit: '1',
- valueType: ValueType.INT,
- labelKeys: ['key'],
- });
- assert.strictEqual(record[0].labels, labels);
- const value = record[0].aggregator.toPoint().value as Sum;
- assert.strictEqual(value, 10);
- });
- });
-
- it('should allow custom batcher', () => {
- const customMeter = new MeterProvider().getMeter('custom-batcher', '*', {
- batcher: new CustomBatcher(),
- });
- assert.throws(() => {
- const measure = customMeter.createMeasure('myMeasure');
- measure.bind({}).record(1);
- }, /aggregatorFor method not implemented/);
- });
-});
-
-class CustomBatcher extends Batcher {
- process(record: MetricRecord): void {
- throw new Error('process method not implemented.');
- }
- aggregatorFor(metricKind: MetricKind): Aggregator {
- throw new Error('aggregatorFor method not implemented.');
- }
-}
-
-function ensureMetric(metric: MetricRecord) {
- assert.ok(metric.aggregator instanceof ObserverAggregator);
- assert.ok(
- metric.aggregator.toPoint().value >= 0 &&
- metric.aggregator.toPoint().value <= 1
- );
- assert.ok(
- metric.aggregator.toPoint().value >= 0 &&
- metric.aggregator.toPoint().value <= 1
- );
- const descriptor = metric.descriptor;
- assert.strictEqual(descriptor.name, 'name');
- assert.strictEqual(descriptor.description, 'desc');
- assert.strictEqual(descriptor.unit, '1');
- assert.strictEqual(descriptor.metricKind, MetricKind.OBSERVER);
- assert.strictEqual(descriptor.valueType, ValueType.DOUBLE);
- assert.strictEqual(descriptor.monotonic, false);
-}
diff --git a/packages/opentelemetry-metrics/test/MeterProvider.test.ts b/packages/opentelemetry-metrics/test/MeterProvider.test.ts
deleted file mode 100644
index 82877759b3..0000000000
--- a/packages/opentelemetry-metrics/test/MeterProvider.test.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import { MeterProvider, Meter } from '../src';
-import { NoopLogger } from '@opentelemetry/core';
-
-describe('MeterProvider', () => {
- describe('constructor', () => {
- it('should construct an instance without any options', () => {
- const provider = new MeterProvider();
- assert.ok(provider instanceof MeterProvider);
- });
-
- it('should construct an instance with logger', () => {
- const provider = new MeterProvider({
- logger: new NoopLogger(),
- });
- assert.ok(provider instanceof MeterProvider);
- });
- });
-
- describe('getMeter', () => {
- it('should return an instance of Meter', () => {
- const meter = new MeterProvider().getMeter('test-meter-provider');
- assert.ok(meter instanceof Meter);
- });
-
- it('should return the meter with default version without a version option', () => {
- const provider = new MeterProvider();
- const meter1 = provider.getMeter('default');
- const meter2 = provider.getMeter('default', '*');
- assert.deepEqual(meter1, meter2);
- });
-
- it('should return the same Meter instance with same name & version', () => {
- const provider = new MeterProvider();
- const meter1 = provider.getMeter('meter1', 'ver1');
- const meter2 = provider.getMeter('meter1', 'ver1');
- assert.deepEqual(meter1, meter2);
- });
-
- it('should return different Meter instance with different name or version', () => {
- const provider = new MeterProvider();
-
- const meter1 = provider.getMeter('meter1', 'ver1');
- const meter2 = provider.getMeter('meter1');
- assert.notEqual(meter1, meter2);
-
- const meter3 = provider.getMeter('meter2', 'ver2');
- const meter4 = provider.getMeter('meter3', 'ver2');
- assert.notEqual(meter3, meter4);
- });
- });
-});
diff --git a/packages/opentelemetry-metrics/test/export/ConsoleMetricExporter.test.ts b/packages/opentelemetry-metrics/test/export/ConsoleMetricExporter.test.ts
deleted file mode 100644
index d9dc83315f..0000000000
--- a/packages/opentelemetry-metrics/test/export/ConsoleMetricExporter.test.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import * as sinon from 'sinon';
-import { ConsoleMetricExporter, MeterProvider, MetricKind } from '../../src';
-import { ValueType } from '@opentelemetry/api';
-
-describe('ConsoleMetricExporter', () => {
- let consoleExporter: ConsoleMetricExporter;
- let previousConsoleLog: any;
-
- beforeEach(() => {
- previousConsoleLog = console.log;
- console.log = () => {};
- consoleExporter = new ConsoleMetricExporter();
- });
-
- afterEach(() => {
- console.log = previousConsoleLog;
- });
-
- describe('.export()', () => {
- it('should export information about metrics', () => {
- const spyConsole = sinon.spy(console, 'log');
-
- const meter = new MeterProvider().getMeter(
- 'test-console-metric-exporter'
- );
- const counter = meter.createCounter('counter', {
- description: 'a test description',
- labelKeys: ['key1', 'key2'],
- });
- const boundCounter = counter.bind({
- key1: 'labelValue1',
- key2: 'labelValue2',
- });
- boundCounter.add(10);
-
- meter.collect();
- consoleExporter.export(meter.getBatcher().checkPointSet(), () => {});
- assert.strictEqual(spyConsole.args.length, 3);
- const [descriptor, labels, value] = spyConsole.args;
- assert.deepStrictEqual(descriptor, [
- {
- description: 'a test description',
- labelKeys: ['key1', 'key2'],
- metricKind: MetricKind.COUNTER,
- monotonic: true,
- name: 'counter',
- unit: '1',
- valueType: ValueType.DOUBLE,
- },
- ]);
- assert.deepStrictEqual(labels, [
- {
- key1: 'labelValue1',
- key2: 'labelValue2',
- },
- ]);
- assert.deepStrictEqual(value[0], 'value: 10');
- });
- });
-});
diff --git a/packages/opentelemetry-node/.gitignore b/packages/opentelemetry-node/.gitignore
deleted file mode 100644
index ba80b4026b..0000000000
--- a/packages/opentelemetry-node/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Dependency directories
-!test/instrumentation/node_modules
diff --git a/packages/opentelemetry-node/README.md b/packages/opentelemetry-node/README.md
deleted file mode 100644
index 4dd8d84a74..0000000000
--- a/packages/opentelemetry-node/README.md
+++ /dev/null
@@ -1,114 +0,0 @@
-# OpenTelemetry Node SDK
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![devDependencies][devDependencies-image]][devDependencies-url]
-[![Apache License][license-image]][license-image]
-
-This module provides *automated instrumentation and tracing* for Node.js applications.
-
-For manual instrumentation see the
-[@opentelemetry/tracing](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-tracing) package.
-
-## How does automated instrumentation work?
-This package exposes a `NodeTracerProvider` that will automatically hook into the module loader of Node.js.
-
-For this to work, please make sure that `NodeTracerProvider` is initialized before any other module of your application, (like `http` or `express`) is loaded.
-
-OpenTelemetry comes with a growing number of instrumentation plugins for well know modules (see [supported modules](https://github.com/open-telemetry/opentelemetry-js#plugins)) and an API to create custom plugins (see [the plugin developer guide](https://github.com/open-telemetry/opentelemetry-js/blob/master/doc/plugin-guide.md)).
-
-
-Whenever a module is loaded `NodeTracerProvider` will check if a matching instrumentation plugin has been installed.
-
-> **Please note:** This module does *not* bundle any plugins. They need to be installed separately.
-
-If the respective plugin was found, it will be used to patch the original module to add instrumentation code.
-This is done by wrapping all tracing-relevant functions.
-
-This instrumentation code will automatically
-- extract a trace-context identifier from inbound requests to allow distributed tracing (if applicable)
-- make sure that this current trace-context is propagated while the transaction traverses an application (see [@opentelemetry/context-base](https://github.com/open-telemetry/opentelemetry-js/blob/master/packages/opentelemetry-context-base/README.md) for an in-depth explanation)
-- add this trace-context identifier to outbound requests to allow continuing the distributed trace on the next hop (if applicable)
-- create and end spans
-
-In short, this means that this module will use provided plugins to automatically instrument your application to produce spans and provide end-to-end tracing by just adding a few lines of code.
-
-## Creating custom spans on top of auto-instrumentation
-Additionally to automated instrumentation, `NodeTracerProvider` exposes the same API as [@opentelemetry/tracing](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-tracing), allowing creating custom spans if needed.
-
-## Installation
-
-```bash
-npm install --save @opentelemetry/api
-npm install --save @opentelemetry/node
-
-# Install instrumentation plugins
-npm install --save @opentelemetry/plugin-http
-npm install --save @opentelemetry/plugin-https
-```
-
-## Usage
-
-The following code will configure the `NodeTracerProvider` to instrument `http` using `@opentelemetry/plugin-http`.
-
-```js
-const { NodeTracerProvider } = require('@opentelemetry/node');
-
-// Create and configure NodeTracerProvider
-const provider = new NodeTracerProvider({
- plugins: {
- http: {
- enabled: true,
- // You may use a package name or absolute path to the file.
- path: '@opentelemetry/plugin-http',
- // http plugin options
- }
- }
-});
-
-// Initialize the provider
-provider.register()
-
-// Your application code - http will automatically be instrumented if
-// @opentelemetry/plugin-http is present
-const http = require('http');
-```
-
-To enable instrumentation for all [supported modules](https://github.com/open-telemetry/opentelemetry-js#plugins), create an instance of `NodeTracerProvider` without providing any plugin configuration to the constructor.
-
-```js
-const { NodeTracerProvider } = require('@opentelemetry/node');
-
-// Create and initialize NodeTracerProvider
-const provider = new NodeTracerProvider();
-
-// Initialize the provider
-provider.register()
-
-// Your application code
-// ...
-```
-
-## Examples
-See how to automatically instrument [http](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/http) and [gRPC](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/grpc) using node-sdk.
-
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more about OpenTelemetry JavaScript:
-- For help or feedback on this project, join us on [gitter][gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-node
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-node
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-node
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-node&type=dev
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/node
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fnode.svg
diff --git a/packages/opentelemetry-node/package.json b/packages/opentelemetry-node/package.json
deleted file mode 100644
index 9a78149ffe..0000000000
--- a/packages/opentelemetry-node/package.json
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "name": "@opentelemetry/node",
- "version": "0.6.1",
- "description": "OpenTelemetry Node SDK provides automatic telemetry (tracing, metrics, etc) for Node.js applications",
- "main": "build/src/index.js",
- "types": "build/src/index.d.ts",
- "repository": "open-telemetry/opentelemetry-js",
- "scripts": {
- "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": "gts check",
- "lint:fix": "gts fix",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile"
- },
- "keywords": [
- "opentelemetry",
- "nodejs",
- "tracing",
- "profiling",
- "metrics",
- "stats"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@opentelemetry/context-base": "^0.6.1",
- "@opentelemetry/resources": "^0.6.1",
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.8",
- "@types/semver": "^6.0.1",
- "@types/shimmer": "^1.0.1",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "mocha": "^6.1.0",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "shimmer": "^1.2.0",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "3.7.2"
- },
- "dependencies": {
- "@opentelemetry/api": "^0.6.1",
- "@opentelemetry/context-async-hooks": "^0.6.1",
- "@opentelemetry/core": "^0.6.1",
- "@opentelemetry/tracing": "^0.6.1",
- "require-in-the-middle": "^5.0.0",
- "semver": "^7.1.3"
- }
-}
diff --git a/packages/opentelemetry-node/src/NodeTracerProvider.ts b/packages/opentelemetry-node/src/NodeTracerProvider.ts
deleted file mode 100644
index 11a0874e5e..0000000000
--- a/packages/opentelemetry-node/src/NodeTracerProvider.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
-import {
- BasicTracerProvider,
- SDKRegistrationConfig,
-} from '@opentelemetry/tracing';
-import { DEFAULT_INSTRUMENTATION_PLUGINS, NodeTracerConfig } from './config';
-import { PluginLoader } from './instrumentation/PluginLoader';
-
-/**
- * Register this TracerProvider for use with the OpenTelemetry API.
- * Undefined values may be replaced with defaults, and
- * null values will be skipped.
- *
- * @param config Configuration object for SDK registration
- */
-export class NodeTracerProvider extends BasicTracerProvider {
- private readonly _pluginLoader: PluginLoader;
-
- /**
- * Constructs a new Tracer instance.
- */
- constructor(config: NodeTracerConfig = {}) {
- super(config);
-
- this._pluginLoader = new PluginLoader(this, this.logger);
- this._pluginLoader.load(config.plugins || DEFAULT_INSTRUMENTATION_PLUGINS);
- }
-
- stop() {
- this._pluginLoader.unload();
- }
-
- register(config: SDKRegistrationConfig = {}) {
- if (config.contextManager === undefined) {
- config.contextManager = new AsyncHooksContextManager();
- config.contextManager.enable();
- }
-
- super.register(config);
- }
-}
diff --git a/packages/opentelemetry-node/src/config.ts b/packages/opentelemetry-node/src/config.ts
deleted file mode 100644
index 3d93b5bba5..0000000000
--- a/packages/opentelemetry-node/src/config.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Plugins } from './instrumentation/PluginLoader';
-import { TracerConfig } from '@opentelemetry/tracing';
-
-/**
- * NodeTracerConfig provides an interface for configuring a Node Tracer.
- */
-export interface NodeTracerConfig extends TracerConfig {
- /** Plugins options. */
- plugins?: Plugins;
-}
-
-/** List of all default supported plugins */
-export const DEFAULT_INSTRUMENTATION_PLUGINS: Plugins = {
- mongodb: { enabled: true, path: '@opentelemetry/plugin-mongodb' },
- grpc: { enabled: true, path: '@opentelemetry/plugin-grpc' },
- http: { enabled: true, path: '@opentelemetry/plugin-http' },
- https: { enabled: true, path: '@opentelemetry/plugin-https' },
- mysql: { enabled: true, path: '@opentelemetry/plugin-mysql' },
- pg: { enabled: true, path: '@opentelemetry/plugin-pg' },
- redis: { enabled: true, path: '@opentelemetry/plugin-redis' },
- ioredis: { enabled: true, path: '@opentelemetry/plugin-ioredis' },
- 'pg-pool': { enabled: true, path: '@opentelemetry/plugin-pg-pool' },
-};
diff --git a/packages/opentelemetry-node/src/index.ts b/packages/opentelemetry-node/src/index.ts
deleted file mode 100644
index 665900aefb..0000000000
--- a/packages/opentelemetry-node/src/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './NodeTracerProvider';
diff --git a/packages/opentelemetry-node/src/instrumentation/PluginLoader.ts b/packages/opentelemetry-node/src/instrumentation/PluginLoader.ts
deleted file mode 100644
index 5517134bc7..0000000000
--- a/packages/opentelemetry-node/src/instrumentation/PluginLoader.ts
+++ /dev/null
@@ -1,188 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- Logger,
- Plugin,
- PluginConfig,
- TracerProvider,
-} from '@opentelemetry/api';
-import * as hook from 'require-in-the-middle';
-import * as utils from './utils';
-
-// States for the Plugin Loader
-export enum HookState {
- UNINITIALIZED,
- ENABLED,
- DISABLED,
-}
-
-export interface Plugins {
- [pluginName: string]: PluginConfig;
-}
-
-/**
- * Returns the Plugins object that meet the below conditions.
- * Valid criteria: 1. It should be enabled. 2. Should have non-empty path.
- */
-function filterPlugins(plugins: Plugins): Plugins {
- const keys = Object.keys(plugins);
- return keys.reduce((acc: Plugins, key: string) => {
- if (plugins[key].enabled && plugins[key].path) acc[key] = plugins[key];
- return acc;
- }, {});
-}
-
-/**
- * The PluginLoader class can load instrumentation plugins that use a patch
- * mechanism to enable automatic tracing for specific target modules.
- */
-export class PluginLoader {
- /** A list of loaded plugins. */
- private _plugins: Plugin[] = [];
- /**
- * A field that tracks whether the require-in-the-middle hook has been loaded
- * for the first time, as well as whether the hook body is activated or not.
- */
- private _hookState = HookState.UNINITIALIZED;
-
- /** Constructs a new PluginLoader instance. */
- constructor(readonly provider: TracerProvider, readonly logger: Logger) {}
-
- /**
- * Loads a list of plugins. Each plugin module should implement the core
- * {@link Plugin} interface and export an instance named as 'plugin'. This
- * function will attach a hook to be called the first time the module is
- * loaded.
- * @param Plugins an object whose keys are plugin names and whose
- * {@link PluginConfig} values indicate several configuration options.
- */
- load(plugins: Plugins): PluginLoader {
- if (this._hookState === HookState.UNINITIALIZED) {
- const pluginsToLoad = filterPlugins(plugins);
- const modulesToHook = Object.keys(pluginsToLoad);
- // Do not hook require when no module is provided. In this case it is
- // not necessary. With skipping this step we lower our footprint in
- // customer applications and require-in-the-middle won't show up in CPU
- // frames.
- if (modulesToHook.length === 0) {
- this._hookState = HookState.DISABLED;
- return this;
- }
-
- const alreadyRequiredModules = Object.keys(require.cache);
- const requiredModulesToHook = modulesToHook.filter(
- name =>
- alreadyRequiredModules.find(cached => {
- try {
- return require.resolve(name) === cached;
- } catch (err) {
- return false;
- }
- }) !== undefined
- );
- if (requiredModulesToHook.length > 0) {
- this.logger.warn(
- `Some modules (${requiredModulesToHook.join(
- ', '
- )}) were already required when their respective plugin was loaded, some plugins might not work. Make sure the SDK is setup before you require in other modules.`
- );
- }
-
- // Enable the require hook.
- hook(modulesToHook, (exports, name, baseDir) => {
- if (this._hookState !== HookState.ENABLED) return exports;
- const config = pluginsToLoad[name];
- const modulePath = config.path!;
- let version = null;
-
- if (!baseDir) {
- // basedir is the directory where the module is located,
- // or undefined for core modules.
- // lets plugins restrict what they support for core modules (see plugin.supportedVersions)
- version = process.versions.node;
- } else {
- // Get the module version.
- version = utils.getPackageVersion(this.logger, baseDir);
- }
-
- this.logger.info(
- `PluginLoader#load: trying loading ${name}@${version}`
- );
-
- if (!version) return exports;
-
- this.logger.debug(
- `PluginLoader#load: applying patch to ${name}@${version} using ${modulePath} module`
- );
-
- // Expecting a plugin from module;
- try {
- const plugin: Plugin = require(modulePath).plugin;
- if (!utils.isSupportedVersion(version, plugin.supportedVersions)) {
- this.logger.error(
- `PluginLoader#load: Plugin ${name} only supports module ${plugin.moduleName} with the versions: ${plugin.supportedVersions}`
- );
- return exports;
- }
- if (plugin.moduleName !== name) {
- this.logger.error(
- `PluginLoader#load: Entry ${name} use a plugin that instruments ${plugin.moduleName}`
- );
- return exports;
- }
-
- this._plugins.push(plugin);
- // Enable each supported plugin.
- return plugin.enable(exports, this.provider, this.logger, config);
- } catch (e) {
- this.logger.error(
- `PluginLoader#load: could not load plugin ${modulePath} of module ${name}. Error: ${e.message}`
- );
- return exports;
- }
- });
- this._hookState = HookState.ENABLED;
- } else if (this._hookState === HookState.DISABLED) {
- this.logger.error(
- 'PluginLoader#load: Currently cannot re-enable plugin loader.'
- );
- } else {
- this.logger.error('PluginLoader#load: Plugin loader already enabled.');
- }
- return this;
- }
-
- /** Unloads plugins. */
- unload(): PluginLoader {
- if (this._hookState === HookState.ENABLED) {
- for (const plugin of this._plugins) {
- plugin.disable();
- }
- this._plugins = [];
- this._hookState = HookState.DISABLED;
- }
- return this;
- }
-}
-
-/**
- * Adds a search path for plugin modules. Intended for testing purposes only.
- * @param searchPath The path to add.
- */
-export function searchPathForTest(searchPath: string) {
- module.paths.push(searchPath);
-}
diff --git a/packages/opentelemetry-node/src/instrumentation/ext-types.d.ts b/packages/opentelemetry-node/src/instrumentation/ext-types.d.ts
deleted file mode 100644
index bb3be401e0..0000000000
--- a/packages/opentelemetry-node/src/instrumentation/ext-types.d.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-declare module 'require-in-the-middle' {
- namespace hook {
- type Options = {
- internals?: boolean;
- };
- type OnRequireFn = (exports: T, name: string, basedir?: string) => T;
- }
- function hook(modules: string[]|null, options: hook.Options|null, onRequire: hook.OnRequireFn): void;
- function hook(modules: string[]|null, onRequire: hook.OnRequireFn): void;
- function hook(onRequire: hook.OnRequireFn): void;
- export = hook;
- }
diff --git a/packages/opentelemetry-node/src/instrumentation/utils.ts b/packages/opentelemetry-node/src/instrumentation/utils.ts
deleted file mode 100644
index 062682e3fb..0000000000
--- a/packages/opentelemetry-node/src/instrumentation/utils.ts
+++ /dev/null
@@ -1,74 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Logger } from '@opentelemetry/api';
-import * as path from 'path';
-import * as semver from 'semver';
-
-/**
- * Gets the package version.
- * @param logger The logger to use.
- * @param basedir The base directory.
- */
-export function getPackageVersion(
- logger: Logger,
- basedir: string
-): string | null {
- const pjsonPath = path.join(basedir, 'package.json');
- try {
- const version = require(pjsonPath).version;
- // Attempt to parse a string as a semantic version, returning either a
- // SemVer object or null.
- if (!semver.parse(version)) {
- logger.error(
- `getPackageVersion: [${pjsonPath}|${version}] Version string could not be parsed.`
- );
- return null;
- }
- return version;
- } catch (e) {
- logger.error(
- `getPackageVersion: [${pjsonPath}] An error occurred while retrieving version string. ${e.message}`
- );
- return null;
- }
-}
-
-/**
- * Determines if a version is supported
- * @param moduleVersion a version in [semver](https://semver.org/spec/v2.0.0.html) format.
- * @param [supportedVersions] a list of supported versions ([semver](https://semver.org/spec/v2.0.0.html) format).
- */
-export function isSupportedVersion(
- moduleVersion: string,
- supportedVersions?: string[]
-) {
- if (!Array.isArray(supportedVersions) || supportedVersions.length === 0) {
- return true;
- }
-
- return supportedVersions.some(supportedVersion =>
- semver.satisfies(moduleVersion, supportedVersion)
- );
-}
-
-/**
- * Adds a search path for plugin modules. Intended for testing purposes only.
- * @param searchPath The path to add.
- */
-export function searchPathForTest(searchPath: string) {
- module.paths.push(searchPath);
-}
diff --git a/packages/opentelemetry-node/test/NodeTracerProvider.test.ts b/packages/opentelemetry-node/test/NodeTracerProvider.test.ts
deleted file mode 100644
index 1cd0298e62..0000000000
--- a/packages/opentelemetry-node/test/NodeTracerProvider.test.ts
+++ /dev/null
@@ -1,270 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { context, TraceFlags } from '@opentelemetry/api';
-import {
- ALWAYS_SAMPLER,
- NEVER_SAMPLER,
- NoopLogger,
- NoRecordingSpan,
- setActiveSpan,
-} from '@opentelemetry/core';
-import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
-import { Span } from '@opentelemetry/tracing';
-import { Resource, TELEMETRY_SDK_RESOURCE } from '@opentelemetry/resources';
-import * as assert from 'assert';
-import * as path from 'path';
-import { ContextManager } from '@opentelemetry/context-base';
-import { NodeTracerProvider } from '../src/NodeTracerProvider';
-
-const sleep = (time: number) =>
- new Promise(resolve => {
- return setTimeout(resolve, time);
- });
-
-const INSTALLED_PLUGINS_PATH = path.join(
- __dirname,
- 'instrumentation',
- 'node_modules'
-);
-
-describe('NodeTracerProvider', () => {
- let provider: NodeTracerProvider;
- let contextManager: ContextManager;
- before(() => {
- module.paths.push(INSTALLED_PLUGINS_PATH);
- });
-
- beforeEach(() => {
- contextManager = new AsyncHooksContextManager();
- context.setGlobalContextManager(contextManager.enable());
- });
-
- afterEach(() => {
- // clear require cache
- Object.keys(require.cache).forEach(key => delete require.cache[key]);
- provider.stop();
- contextManager.disable();
- });
-
- describe('constructor', () => {
- it('should construct an instance with required only options', () => {
- provider = new NodeTracerProvider();
- assert.ok(provider instanceof NodeTracerProvider);
- });
-
- it('should construct an instance with logger', () => {
- provider = new NodeTracerProvider({
- logger: new NoopLogger(),
- });
- assert.ok(provider instanceof NodeTracerProvider);
- });
-
- it('should construct an instance with sampler', () => {
- provider = new NodeTracerProvider({
- sampler: ALWAYS_SAMPLER,
- });
- assert.ok(provider instanceof NodeTracerProvider);
- });
-
- it('should load user configured plugins', () => {
- provider = new NodeTracerProvider({
- logger: new NoopLogger(),
- plugins: {
- 'simple-module': {
- enabled: true,
- path: '@opentelemetry/plugin-simple-module',
- },
- 'supported-module': {
- enabled: true,
- path: '@opentelemetry/plugin-supported-module',
- enhancedDatabaseReporting: false,
- ignoreMethods: [],
- ignoreUrls: [],
- },
- },
- });
- const pluginLoader = provider['_pluginLoader'];
- assert.strictEqual(pluginLoader['_plugins'].length, 0);
- require('simple-module');
- assert.strictEqual(pluginLoader['_plugins'].length, 1);
- require('supported-module');
- assert.strictEqual(pluginLoader['_plugins'].length, 2);
- });
-
- it('should construct an instance with default attributes', () => {
- provider = new NodeTracerProvider({
- defaultAttributes: {
- region: 'eu-west',
- asg: 'my-asg',
- },
- });
- assert.ok(provider instanceof NodeTracerProvider);
- });
- });
-
- describe('.startSpan()', () => {
- it('should start a span with name only', () => {
- provider = new NodeTracerProvider({
- logger: new NoopLogger(),
- });
- const span = provider.getTracer('default').startSpan('my-span');
- assert.ok(span);
- });
-
- it('should start a span with name and options', () => {
- provider = new NodeTracerProvider({
- logger: new NoopLogger(),
- });
- const span = provider.getTracer('default').startSpan('my-span', {});
- assert.ok(span);
- });
-
- it('should return a default span with no sampling', () => {
- provider = new NodeTracerProvider({
- sampler: NEVER_SAMPLER,
- logger: new NoopLogger(),
- });
- const span = provider.getTracer('default').startSpan('my-span');
- assert.ok(span instanceof NoRecordingSpan);
- assert.strictEqual(span.context().traceFlags, TraceFlags.NONE);
- assert.strictEqual(span.isRecording(), false);
- });
-
- // @todo: implement
- it('should start a Span with always sampling');
-
- it('should set default attributes on span', () => {
- const defaultAttributes = {
- foo: 'bar',
- };
- provider = new NodeTracerProvider({
- defaultAttributes,
- });
-
- const span = provider.getTracer('default').startSpan('my-span') as Span;
- assert.ok(span instanceof Span);
- assert.deepStrictEqual(span.attributes, defaultAttributes);
- });
-
- it('should assign resource to span', () => {
- provider = new NodeTracerProvider({
- logger: new NoopLogger(),
- });
- const span = provider.getTracer('default').startSpan('my-span') as Span;
- assert.ok(span);
- assert.ok(span.resource instanceof Resource);
- assert.equal(
- span.resource.labels[TELEMETRY_SDK_RESOURCE.LANGUAGE],
- 'nodejs'
- );
- });
- });
-
- 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
- );
- return done();
- });
- assert.deepStrictEqual(
- provider.getTracer('default').getCurrentSpan(),
- 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
- );
-
- const span1 = provider.getTracer('default').startSpan('my-span1');
-
- provider.getTracer('default').withSpan(span1, () => {
- assert.deepStrictEqual(
- provider.getTracer('default').getCurrentSpan(),
- span1
- );
- assert.deepStrictEqual(
- span1.context().traceId,
- span.context().traceId
- );
- return done();
- });
- });
- // when span ended.
- // @todo: below check is not running.
- assert.deepStrictEqual(
- provider.getTracer('default').getCurrentSpan(),
- 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 () => {
- for (let i = 0; i < 3; i++) {
- await sleep(5).then(() => {
- assert.deepStrictEqual(
- provider.getTracer('default').getCurrentSpan(),
- span
- );
- });
- }
- });
- assert.deepStrictEqual(
- provider.getTracer('default').getCurrentSpan(),
- undefined
- );
- });
- });
-
- describe('.bind()', () => {
- it('should bind context with AsyncHooksContextManager context manager', done => {
- const provider = new NodeTracerProvider({});
- const span = provider.getTracer('default').startSpan('my-span');
- const fn = () => {
- assert.deepStrictEqual(
- provider.getTracer('default').getCurrentSpan(),
- span
- );
- return done();
- };
- const patchedFn = context.bind(fn, setActiveSpan(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
deleted file mode 100644
index 5093d448f0..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/PluginLoader.test.ts
+++ /dev/null
@@ -1,281 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { NoopTracerProvider } from '@opentelemetry/api';
-import { NoopLogger } from '@opentelemetry/core';
-import * as assert from 'assert';
-import * as path from 'path';
-import {
- HookState,
- PluginLoader,
- Plugins,
- searchPathForTest,
-} from '../../src/instrumentation/PluginLoader';
-
-const INSTALLED_PLUGINS_PATH = path.join(__dirname, 'node_modules');
-
-const simplePlugins: Plugins = {
- 'simple-module': {
- enabled: true,
- path: '@opentelemetry/plugin-simple-module',
- ignoreMethods: [],
- ignoreUrls: [],
- },
-};
-
-const httpPlugins: Plugins = {
- http: {
- enabled: true,
- path: '@opentelemetry/plugin-http-module',
- ignoreMethods: [],
- ignoreUrls: [],
- },
-};
-
-const disablePlugins: Plugins = {
- 'simple-module': {
- enabled: false,
- path: '@opentelemetry/plugin-simple-module',
- },
- nonexistent: {
- enabled: false,
- path: '@opentelemetry/plugin-nonexistent-module',
- },
-};
-
-const nonexistentPlugins: Plugins = {
- nonexistent: {
- enabled: true,
- path: '@opentelemetry/plugin-nonexistent-module',
- },
-};
-
-const missingPathPlugins: Plugins = {
- 'simple-module': {
- enabled: true,
- },
- nonexistent: {
- enabled: true,
- },
-};
-
-const supportedVersionPlugins: Plugins = {
- 'supported-module': {
- enabled: true,
- path: '@opentelemetry/plugin-supported-module',
- },
-};
-
-const notSupportedVersionPlugins: Plugins = {
- 'notsupported-module': {
- enabled: true,
- path: 'notsupported-module',
- },
-};
-
-const alreadyRequiredPlugins: Plugins = {
- 'already-require-module': {
- enabled: true,
- path: '@opentelemetry/plugin-supported-module',
- },
-};
-
-const differentNamePlugins: Plugins = {
- 'random-module': {
- enabled: true,
- path: '@opentelemetry/plugin-http-module',
- },
-};
-
-describe('PluginLoader', () => {
- const provider = new NoopTracerProvider();
- const logger = new NoopLogger();
-
- before(() => {
- module.paths.push(INSTALLED_PLUGINS_PATH);
- searchPathForTest(INSTALLED_PLUGINS_PATH);
- });
-
- afterEach(() => {
- // clear require cache
- Object.keys(require.cache).forEach(key => delete require.cache[key]);
- });
-
- describe('.state()', () => {
- it('returns UNINITIALIZED when first called', () => {
- const pluginLoader = new PluginLoader(provider, logger);
- assert.strictEqual(pluginLoader['_hookState'], HookState.UNINITIALIZED);
- });
-
- it('transitions from UNINITIALIZED to ENABLED', () => {
- const pluginLoader = new PluginLoader(provider, logger);
- pluginLoader.load(simplePlugins);
- assert.strictEqual(pluginLoader['_hookState'], HookState.ENABLED);
- pluginLoader.unload();
- });
-
- it('transitions from ENABLED to DISABLED', () => {
- const pluginLoader = new PluginLoader(provider, logger);
- pluginLoader.load(simplePlugins).unload();
- assert.strictEqual(pluginLoader['_hookState'], HookState.DISABLED);
- });
- });
-
- describe('.load()', () => {
- it('sanity check', () => {
- // Ensure that module fixtures contain values that we expect.
- const simpleModule = require('simple-module');
- const simpleModule001 = require('supported-module');
- const simpleModule100 = require('notsupported-module');
-
- assert.strictEqual(simpleModule.name(), 'simple-module');
- assert.strictEqual(simpleModule001.name(), 'supported-module');
- assert.strictEqual(simpleModule100.name(), 'notsupported-module');
-
- assert.strictEqual(simpleModule.value(), 0);
- assert.strictEqual(simpleModule001.value(), 0);
- assert.strictEqual(simpleModule100.value(), 0);
-
- assert.throws(() => require('nonexistent-module'));
- });
-
- it('should load a plugin and patch the target modules', () => {
- const pluginLoader = new PluginLoader(provider, logger);
- assert.strictEqual(pluginLoader['_plugins'].length, 0);
- pluginLoader.load(simplePlugins);
- // The hook is only called the first time the module is loaded.
- const simpleModule = require('simple-module');
- assert.strictEqual(pluginLoader['_plugins'].length, 1);
- assert.strictEqual(simpleModule.value(), 1);
- assert.strictEqual(simpleModule.name(), 'patched-simple-module');
- pluginLoader.unload();
- });
-
- it('should load a plugin and patch the core module', () => {
- const pluginLoader = new PluginLoader(provider, logger);
- assert.strictEqual(pluginLoader['_plugins'].length, 0);
- pluginLoader.load(httpPlugins);
- // The hook is only called the first time the module is loaded.
- const httpModule = require('http');
- assert.strictEqual(pluginLoader['_plugins'].length, 1);
- assert.strictEqual(httpModule.get(), 'patched');
- pluginLoader.unload();
- });
- // @TODO: simplify this test once we can load module with custom path
- it('should not load the plugin when supported versions does not match', () => {
- const pluginLoader = new PluginLoader(provider, logger);
- assert.strictEqual(pluginLoader['_plugins'].length, 0);
- pluginLoader.load(notSupportedVersionPlugins);
- // The hook is only called the first time the module is loaded.
- require('notsupported-module');
- assert.strictEqual(pluginLoader['_plugins'].length, 0);
- pluginLoader.unload();
- });
- // @TODO: simplify this test once we can load module with custom path
- it('should load a plugin and patch the target modules when supported versions match', () => {
- const pluginLoader = new PluginLoader(provider, logger);
- assert.strictEqual(pluginLoader['_plugins'].length, 0);
- pluginLoader.load(supportedVersionPlugins);
- // The hook is only called the first time the module is loaded.
- const simpleModule = require('supported-module');
- assert.strictEqual(pluginLoader['_plugins'].length, 1);
- assert.strictEqual(simpleModule.value(), 1);
- assert.strictEqual(simpleModule.name(), 'patched-supported-module');
- pluginLoader.unload();
- });
-
- it('should not load a plugin when value is false', () => {
- const pluginLoader = new PluginLoader(provider, logger);
- assert.strictEqual(pluginLoader['_plugins'].length, 0);
- pluginLoader.load(disablePlugins);
- const simpleModule = require('simple-module');
- assert.strictEqual(pluginLoader['_plugins'].length, 0);
- assert.strictEqual(simpleModule.value(), 0);
- assert.strictEqual(simpleModule.name(), 'simple-module');
- pluginLoader.unload();
- });
-
- it('should not load a plugin when value is true but path is missing', () => {
- const pluginLoader = new PluginLoader(provider, logger);
- assert.strictEqual(pluginLoader['_plugins'].length, 0);
- pluginLoader.load(missingPathPlugins);
- const simpleModule = require('simple-module');
- assert.strictEqual(pluginLoader['_plugins'].length, 0);
- assert.strictEqual(simpleModule.value(), 0);
- assert.strictEqual(simpleModule.name(), 'simple-module');
- pluginLoader.unload();
- });
-
- it('should not load a non existing plugin', () => {
- const pluginLoader = new PluginLoader(provider, logger);
- assert.strictEqual(pluginLoader['_plugins'].length, 0);
- pluginLoader.load(nonexistentPlugins);
- assert.strictEqual(pluginLoader['_plugins'].length, 0);
- pluginLoader.unload();
- });
-
- it(`doesn't patch modules for which plugins aren't specified`, () => {
- const pluginLoader = new PluginLoader(provider, logger);
- pluginLoader.load({});
- assert.strictEqual(require('simple-module').value(), 0);
- pluginLoader.unload();
- });
-
- it(`should warn when module was already loaded`, callback => {
- const verifyWarnLogger = {
- error: logger.error,
- info: logger.info,
- debug: logger.debug,
- warn: (message: string, ...args: unknown[]) => {
- assert(message.match(/were already required when/));
- assert(message.match(/(already-require-module)/));
- return callback();
- },
- };
- require('already-require-module');
- const pluginLoader = new PluginLoader(provider, verifyWarnLogger);
- pluginLoader.load(alreadyRequiredPlugins);
- pluginLoader.unload();
- });
-
- it('should not load a plugin that patches a different module that the one configured', () => {
- const pluginLoader = new PluginLoader(provider, logger);
- assert.strictEqual(pluginLoader['_plugins'].length, 0);
- pluginLoader.load(differentNamePlugins);
- // @ts-ignore only to trigger the loading of the plugin
- const randomModule = require('random-module');
- assert.strictEqual(pluginLoader['_plugins'].length, 0);
- pluginLoader.unload();
- });
- });
-
- describe('.unload()', () => {
- it('should unload the plugins and unpatch the target module when unloads', () => {
- const pluginLoader = new PluginLoader(provider, logger);
- assert.strictEqual(pluginLoader['_plugins'].length, 0);
- pluginLoader.load(simplePlugins);
- // The hook is only called the first time the module is loaded.
- const simpleModule = require('simple-module');
- assert.strictEqual(pluginLoader['_plugins'].length, 1);
- assert.strictEqual(simpleModule.value(), 1);
- assert.strictEqual(simpleModule.name(), 'patched-simple-module');
- pluginLoader.unload();
- assert.strictEqual(pluginLoader['_plugins'].length, 0);
- assert.strictEqual(simpleModule.name(), 'simple-module');
- assert.strictEqual(simpleModule.value(), 0);
- });
- });
-});
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-http-module/http-module.js b/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-http-module/http-module.js
deleted file mode 100644
index 2c46ac30ee..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-http-module/http-module.js
+++ /dev/null
@@ -1,22 +0,0 @@
-Object.defineProperty(exports, "__esModule", { value: true });
-const core_1 = require("@opentelemetry/core");
-const shimmer = require("shimmer");
-
-class HttpModulePlugin extends core_1.BasePlugin {
- constructor() {
- super();
- this.moduleName = 'http';
- }
-
- patch() {
- shimmer.wrap(this._moduleExports, 'get', orig => () => 'patched');
- return this._moduleExports;
- }
-
- unpatch() {
- shimmer.unwrap(this._moduleExports, 'get');
- }
-}
-exports.HttpModulePlugin = HttpModulePlugin;
-const plugin = new HttpModulePlugin();
-exports.plugin = plugin;
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-http-module/index.js b/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-http-module/index.js
deleted file mode 100644
index 4847af1405..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-http-module/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-function __export(m) {
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
-}
-Object.defineProperty(exports, "__esModule", { value: true });
-__export(require("./http-module"));
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-http-module/package.json b/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-http-module/package.json
deleted file mode 100644
index 59d87df350..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-http-module/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "@opentelemetry/plugin-simple-module",
- "version": "0.0.1"
-}
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-notsupported-module/index.js b/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-notsupported-module/index.js
deleted file mode 100644
index 1b22b5ce90..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-notsupported-module/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-function __export(m) {
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
-}
-Object.defineProperty(exports, "__esModule", { value: true });
-__export(require("./simple-module"));
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-notsupported-module/package.json b/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-notsupported-module/package.json
deleted file mode 100644
index 4db9e49b1d..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-notsupported-module/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "@opentelemetry/plugin-notsupported-module",
- "version": "1.0.0"
-}
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-notsupported-module/simple-module.js b/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-notsupported-module/simple-module.js
deleted file mode 100644
index 92bb7d4e80..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-notsupported-module/simple-module.js
+++ /dev/null
@@ -1,25 +0,0 @@
-Object.defineProperty(exports, "__esModule", { value: true });
-const core_1 = require("@opentelemetry/core");
-const shimmer = require("shimmer");
-
-class SimpleModulePlugin extends core_1.BasePlugin {
- constructor() {
- super();
- this.moduleName = 'notsupported-module';
- }
-
- patch() {
- shimmer.wrap(this._moduleExports, 'name', orig => () => 'patched-' + orig.apply());
- shimmer.wrap(this._moduleExports, 'value', orig => () => orig.apply() + 1);
- return this._moduleExports;
- }
-
- unpatch() {
- shimmer.unwrap(this._moduleExports, 'name');
- shimmer.unwrap(this._moduleExports, 'value');
- }
-}
-exports.SimpleModulePlugin = SimpleModulePlugin;
-const plugin = new SimpleModulePlugin();
-plugin.supportedVersions = ['1.0.0'];
-exports.plugin = plugin;
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-simple-module/index.js b/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-simple-module/index.js
deleted file mode 100644
index 1b22b5ce90..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-simple-module/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-function __export(m) {
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
-}
-Object.defineProperty(exports, "__esModule", { value: true });
-__export(require("./simple-module"));
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-simple-module/package.json b/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-simple-module/package.json
deleted file mode 100644
index 59d87df350..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-simple-module/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "@opentelemetry/plugin-simple-module",
- "version": "0.0.1"
-}
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-simple-module/simple-module.js b/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-simple-module/simple-module.js
deleted file mode 100644
index 67e8f838d4..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-simple-module/simple-module.js
+++ /dev/null
@@ -1,24 +0,0 @@
-Object.defineProperty(exports, "__esModule", { value: true });
-const core_1 = require("@opentelemetry/core");
-const shimmer = require("shimmer");
-
-class SimpleModulePlugin extends core_1.BasePlugin {
- constructor() {
- super();
- this.moduleName = 'simple-module';
- }
-
- patch() {
- shimmer.wrap(this._moduleExports, 'name', orig => () => 'patched-' + orig.apply());
- shimmer.wrap(this._moduleExports, 'value', orig => () => orig.apply() + 1);
- return this._moduleExports;
- }
-
- unpatch() {
- shimmer.unwrap(this._moduleExports, 'name');
- shimmer.unwrap(this._moduleExports, 'value');
- }
-}
-exports.SimpleModulePlugin = SimpleModulePlugin;
-const plugin = new SimpleModulePlugin();
-exports.plugin = plugin;
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-supported-module/index.js b/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-supported-module/index.js
deleted file mode 100644
index 1b22b5ce90..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-supported-module/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-function __export(m) {
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
-}
-Object.defineProperty(exports, "__esModule", { value: true });
-__export(require("./simple-module"));
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-supported-module/package.json b/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-supported-module/package.json
deleted file mode 100644
index ca18bafa63..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-supported-module/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "@opentelemetry/plugin-supported-module",
- "version": "0.0.1"
-}
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-supported-module/simple-module.js b/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-supported-module/simple-module.js
deleted file mode 100644
index 6395bd261a..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/@opentelemetry/plugin-supported-module/simple-module.js
+++ /dev/null
@@ -1,25 +0,0 @@
-Object.defineProperty(exports, "__esModule", { value: true });
-const core_1 = require("@opentelemetry/core");
-const shimmer = require("shimmer");
-
-class SimpleModulePlugin extends core_1.BasePlugin {
- constructor() {
- super();
- this.moduleName = 'supported-module';
- }
-
- patch() {
- shimmer.wrap(this._moduleExports, 'name', orig => () => 'patched-' + orig.apply());
- shimmer.wrap(this._moduleExports, 'value', orig => () => orig.apply() + 1);
- return this._moduleExports;
- }
-
- unpatch() {
- shimmer.unwrap(this._moduleExports, 'name');
- shimmer.unwrap(this._moduleExports, 'value');
- }
-}
-exports.SimpleModulePlugin = SimpleModulePlugin;
-const plugin = new SimpleModulePlugin();
-plugin.supportedVersions = ['^0.0.1'];
-exports.plugin = plugin;
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/already-require-module/index.js b/packages/opentelemetry-node/test/instrumentation/node_modules/already-require-module/index.js
deleted file mode 100644
index 18c0f69a3b..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/already-require-module/index.js
+++ /dev/null
@@ -1,4 +0,0 @@
-module.exports = {
- name: () => 'already-module',
- value: () => 0,
-};
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/already-require-module/package.json b/packages/opentelemetry-node/test/instrumentation/node_modules/already-require-module/package.json
deleted file mode 100644
index 7ae0ab8f09..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/already-require-module/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "already-module",
- "version": "0.1.0"
-}
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/notsupported-module/index.js b/packages/opentelemetry-node/test/instrumentation/node_modules/notsupported-module/index.js
deleted file mode 100644
index 4fe98dae33..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/notsupported-module/index.js
+++ /dev/null
@@ -1,4 +0,0 @@
-module.exports = {
- name: () => 'notsupported-module',
- value: () => 0,
-};
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/notsupported-module/package.json b/packages/opentelemetry-node/test/instrumentation/node_modules/notsupported-module/package.json
deleted file mode 100644
index 9494b2866e..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/notsupported-module/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "notsupported-module",
- "version": "0.0.1"
-}
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/random-module/index.js b/packages/opentelemetry-node/test/instrumentation/node_modules/random-module/index.js
deleted file mode 100644
index 35a4110c28..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/random-module/index.js
+++ /dev/null
@@ -1,4 +0,0 @@
-module.exports = {
- name: () => 'random-module',
- value: () => 0,
-};
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/random-module/package.json b/packages/opentelemetry-node/test/instrumentation/node_modules/random-module/package.json
deleted file mode 100644
index a5c840081b..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/random-module/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "random-module",
- "version": "0.1.0"
-}
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/simple-module/index.js b/packages/opentelemetry-node/test/instrumentation/node_modules/simple-module/index.js
deleted file mode 100644
index 8ec2e77ffd..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/simple-module/index.js
+++ /dev/null
@@ -1,4 +0,0 @@
-module.exports = {
- name: () => 'simple-module',
- value: () => 0,
-};
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/simple-module/package.json b/packages/opentelemetry-node/test/instrumentation/node_modules/simple-module/package.json
deleted file mode 100644
index 2eba36a5bd..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/simple-module/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "simple-module",
- "version": "0.1.0"
-}
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/supported-module/index.js b/packages/opentelemetry-node/test/instrumentation/node_modules/supported-module/index.js
deleted file mode 100644
index 090d0db5fb..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/supported-module/index.js
+++ /dev/null
@@ -1,4 +0,0 @@
-module.exports = {
- name: () => 'supported-module',
- value: () => 0,
-};
diff --git a/packages/opentelemetry-node/test/instrumentation/node_modules/supported-module/package.json b/packages/opentelemetry-node/test/instrumentation/node_modules/supported-module/package.json
deleted file mode 100644
index ffd520afda..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/node_modules/supported-module/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "supported-module",
- "version": "0.0.1"
-}
diff --git a/packages/opentelemetry-node/test/instrumentation/utils.test.ts b/packages/opentelemetry-node/test/instrumentation/utils.test.ts
deleted file mode 100644
index de0f035694..0000000000
--- a/packages/opentelemetry-node/test/instrumentation/utils.test.ts
+++ /dev/null
@@ -1,96 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { NoopLogger } from '@opentelemetry/core';
-import * as assert from 'assert';
-import * as path from 'path';
-import * as utils from '../../src/instrumentation/utils';
-
-const INSTALLED_PLUGINS_PATH = path.join(__dirname, 'node_modules');
-const TEST_MODULES: Array<{ name: string; version: string | null }> = [
- {
- name: 'simple-module',
- version: '0.1.0',
- },
- {
- name: 'nonexistent-module',
- version: null,
- },
- {
- name: 'http',
- version: null,
- },
-];
-
-describe('Instrumentation#utils', () => {
- const logger = new NoopLogger();
-
- before(() => {
- utils.searchPathForTest(INSTALLED_PLUGINS_PATH);
- });
-
- describe('getPackageVersion', () => {
- TEST_MODULES.forEach(testCase => {
- it(`should return ${testCase.version} for ${testCase.name}`, () => {
- assert.strictEqual(
- utils.getPackageVersion(logger, testCase.name),
- testCase.version
- );
- });
- });
- });
- describe('isSupportedVersion', () => {
- const version = '1.0.1';
-
- it('should return true when supportedVersions is not defined', () => {
- assert.strictEqual(utils.isSupportedVersion('1.0.0', undefined), true);
- });
-
- [
- ['1.X'],
- [version],
- ['1.X.X', '3.X.X'],
- ['^1.0.0'],
- ['~1.0.0', '^0.1.0'],
- ['*'],
- ['>1.0.0'],
- [],
- ].forEach(supportedVersion => {
- it(`should return true when version is equal to ${version} and supportedVersions is equal to ${supportedVersion}`, () => {
- assert.strictEqual(
- utils.isSupportedVersion(version, supportedVersion),
- true
- );
- });
- });
-
- [['0.X'], ['0.1.0'], ['0.X.X'], ['^0.1.0'], ['1.0.0'], ['<1.0.0']].forEach(
- supportedVersion => {
- it(`should return false when version is equal to ${version} and supportedVersions is equal to ${supportedVersion}`, () => {
- assert.strictEqual(
- utils.isSupportedVersion(version, supportedVersion),
- false
- );
- });
- }
- );
-
- it(`should return false when version is equal to null and supportedVersions is equal to '*'`, () => {
- // tslint:disable-next-line:no-any
- assert.strictEqual(utils.isSupportedVersion(null as any, ['*']), false);
- });
- });
-});
diff --git a/packages/opentelemetry-node/test/registration.test.ts b/packages/opentelemetry-node/test/registration.test.ts
deleted file mode 100644
index e36d910d45..0000000000
--- a/packages/opentelemetry-node/test/registration.test.ts
+++ /dev/null
@@ -1,86 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- context,
- NoopHttpTextPropagator,
- NoopTracerProvider,
- propagation,
- trace,
-} from '@opentelemetry/api';
-import { HttpTraceContext } from '@opentelemetry/core';
-import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
-import { NoopContextManager } from '@opentelemetry/context-base';
-import * as assert from 'assert';
-import { NodeTracerProvider } from '../src';
-
-describe('API registration', () => {
- beforeEach(() => {
- context.setGlobalContextManager(new NoopContextManager());
- propagation.setGlobalPropagator(new NoopHttpTextPropagator());
- trace.setGlobalTracerProvider(new NoopTracerProvider());
- });
-
- it('should register default implementations', () => {
- const tracerProvider = new NodeTracerProvider();
- tracerProvider.register();
-
- assert.ok(context['_contextManager'] instanceof AsyncHooksContextManager);
- assert.ok(propagation['_propagator'] instanceof HttpTraceContext);
- assert.ok(trace['_tracerProvider'] === tracerProvider);
- });
-
- it('should register configured implementations', () => {
- const tracerProvider = new NodeTracerProvider();
-
- const contextManager = new NoopContextManager();
- const propagator = new NoopHttpTextPropagator();
-
- tracerProvider.register({
- contextManager,
- propagator,
- });
-
- assert.ok(context['_contextManager'] === contextManager);
- assert.ok(propagation['_propagator'] === propagator);
-
- assert.ok(trace['_tracerProvider'] === tracerProvider);
- });
-
- it('should skip null context manager', () => {
- const tracerProvider = new NodeTracerProvider();
- tracerProvider.register({
- contextManager: null,
- });
-
- assert.ok(context['_contextManager'] instanceof NoopContextManager);
-
- assert.ok(propagation['_propagator'] instanceof HttpTraceContext);
- assert.ok(trace['_tracerProvider'] === tracerProvider);
- });
-
- it('should skip null propagator', () => {
- const tracerProvider = new NodeTracerProvider();
- tracerProvider.register({
- propagator: null,
- });
-
- assert.ok(propagation['_propagator'] instanceof NoopHttpTextPropagator);
-
- assert.ok(context['_contextManager'] instanceof AsyncHooksContextManager);
- assert.ok(trace['_tracerProvider'] === tracerProvider);
- });
-});
diff --git a/packages/opentelemetry-node/tslint.json b/packages/opentelemetry-node/tslint.json
deleted file mode 100644
index 0710b135d0..0000000000
--- a/packages/opentelemetry-node/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-plugin-dns/tslint.json b/packages/opentelemetry-plugin-dns/tslint.json
deleted file mode 100644
index 0710b135d0..0000000000
--- a/packages/opentelemetry-plugin-dns/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-plugin-document-load/LICENSE b/packages/opentelemetry-plugin-document-load/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-plugin-document-load/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-plugin-document-load/karma.conf.js b/packages/opentelemetry-plugin-document-load/karma.conf.js
deleted file mode 100644
index 7183aab033..0000000000
--- a/packages/opentelemetry-plugin-document-load/karma.conf.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-const karmaWebpackConfig = require('../../karma.webpack');
-const karmaBaseConfig = require('../../karma.base');
-
-module.exports = (config) => {
- config.set(Object.assign({}, karmaBaseConfig, {
- webpack: karmaWebpackConfig
- }))
-};
diff --git a/packages/opentelemetry-plugin-document-load/src/version.ts b/packages/opentelemetry-plugin-document-load/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-plugin-document-load/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-plugin-document-load/test/index-webpack.ts b/packages/opentelemetry-plugin-document-load/test/index-webpack.ts
deleted file mode 100644
index 7731f09091..0000000000
--- a/packages/opentelemetry-plugin-document-load/test/index-webpack.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// This file is the webpack entry point for the browser Karma tests. It requires
-// all modules ending in "test" from the current folder and all its subfolders.
-const testsContext = require.context('.', true, /test$/);
-testsContext.keys().forEach(testsContext);
-
-const srcContext = require.context('.', true, /src$/);
-srcContext.keys().forEach(srcContext);
diff --git a/packages/opentelemetry-plugin-document-load/tsconfig.json b/packages/opentelemetry-plugin-document-load/tsconfig.json
deleted file mode 100644
index a2042cd68b..0000000000
--- a/packages/opentelemetry-plugin-document-load/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ]
-}
diff --git a/packages/opentelemetry-plugin-document-load/tslint.json b/packages/opentelemetry-plugin-document-load/tslint.json
deleted file mode 100644
index 0710b135d0..0000000000
--- a/packages/opentelemetry-plugin-document-load/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-plugin-express/LICENSE b/packages/opentelemetry-plugin-express/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-plugin-express/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-plugin-express/src/version.ts b/packages/opentelemetry-plugin-express/src/version.ts
deleted file mode 100644
index 5beb5f65f6..0000000000
--- a/packages/opentelemetry-plugin-express/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.3';
diff --git a/packages/opentelemetry-plugin-express/tsconfig.json b/packages/opentelemetry-plugin-express/tsconfig.json
deleted file mode 100644
index a2042cd68b..0000000000
--- a/packages/opentelemetry-plugin-express/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ]
-}
diff --git a/packages/opentelemetry-plugin-express/tslint.json b/packages/opentelemetry-plugin-express/tslint.json
deleted file mode 100644
index 0710b135d0..0000000000
--- a/packages/opentelemetry-plugin-express/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-plugin-grpc/LICENSE b/packages/opentelemetry-plugin-grpc/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-plugin-grpc/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-plugin-grpc/src/version.ts b/packages/opentelemetry-plugin-grpc/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-plugin-grpc/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-plugin-grpc/tsconfig.json b/packages/opentelemetry-plugin-grpc/tsconfig.json
deleted file mode 100644
index a2042cd68b..0000000000
--- a/packages/opentelemetry-plugin-grpc/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ]
-}
diff --git a/packages/opentelemetry-plugin-grpc/tslint.json b/packages/opentelemetry-plugin-grpc/tslint.json
deleted file mode 100644
index 0710b135d0..0000000000
--- a/packages/opentelemetry-plugin-grpc/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-plugin-http/.npmignore b/packages/opentelemetry-plugin-http/.npmignore
deleted file mode 100644
index 9505ba9450..0000000000
--- a/packages/opentelemetry-plugin-http/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/bin
-/coverage
-/doc
-/test
diff --git a/packages/opentelemetry-plugin-http/LICENSE b/packages/opentelemetry-plugin-http/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-plugin-http/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-plugin-http/src/version.ts b/packages/opentelemetry-plugin-http/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-plugin-http/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-plugin-http/tsconfig.json b/packages/opentelemetry-plugin-http/tsconfig.json
deleted file mode 100644
index a2042cd68b..0000000000
--- a/packages/opentelemetry-plugin-http/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ]
-}
diff --git a/packages/opentelemetry-plugin-http/tslint.json b/packages/opentelemetry-plugin-http/tslint.json
deleted file mode 100644
index 0710b135d0..0000000000
--- a/packages/opentelemetry-plugin-http/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-plugin-https/.npmignore b/packages/opentelemetry-plugin-https/.npmignore
deleted file mode 100644
index 9505ba9450..0000000000
--- a/packages/opentelemetry-plugin-https/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/bin
-/coverage
-/doc
-/test
diff --git a/packages/opentelemetry-plugin-https/LICENSE b/packages/opentelemetry-plugin-https/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-plugin-https/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-plugin-https/src/version.ts b/packages/opentelemetry-plugin-https/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-plugin-https/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-plugin-https/tsconfig.json b/packages/opentelemetry-plugin-https/tsconfig.json
deleted file mode 100644
index a2042cd68b..0000000000
--- a/packages/opentelemetry-plugin-https/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ]
-}
diff --git a/packages/opentelemetry-plugin-https/tslint.json b/packages/opentelemetry-plugin-https/tslint.json
deleted file mode 100644
index 0710b135d0..0000000000
--- a/packages/opentelemetry-plugin-https/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-plugin-ioredis/.npmignore b/packages/opentelemetry-plugin-ioredis/.npmignore
deleted file mode 100644
index 9505ba9450..0000000000
--- a/packages/opentelemetry-plugin-ioredis/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/bin
-/coverage
-/doc
-/test
diff --git a/packages/opentelemetry-plugin-ioredis/LICENSE b/packages/opentelemetry-plugin-ioredis/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-plugin-ioredis/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-plugin-ioredis/src/version.ts b/packages/opentelemetry-plugin-ioredis/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-plugin-ioredis/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-plugin-ioredis/tsconfig.json b/packages/opentelemetry-plugin-ioredis/tsconfig.json
deleted file mode 100644
index a2042cd68b..0000000000
--- a/packages/opentelemetry-plugin-ioredis/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ]
-}
diff --git a/packages/opentelemetry-plugin-ioredis/tslint.json b/packages/opentelemetry-plugin-ioredis/tslint.json
deleted file mode 100644
index 0710b135d0..0000000000
--- a/packages/opentelemetry-plugin-ioredis/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-plugin-mongodb/.npmignore b/packages/opentelemetry-plugin-mongodb/.npmignore
deleted file mode 100644
index 9505ba9450..0000000000
--- a/packages/opentelemetry-plugin-mongodb/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/bin
-/coverage
-/doc
-/test
diff --git a/packages/opentelemetry-plugin-mongodb/LICENSE b/packages/opentelemetry-plugin-mongodb/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-plugin-mongodb/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-plugin-mongodb/src/version.ts b/packages/opentelemetry-plugin-mongodb/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-plugin-mongodb/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-plugin-mongodb/tsconfig.json b/packages/opentelemetry-plugin-mongodb/tsconfig.json
deleted file mode 100644
index a2042cd68b..0000000000
--- a/packages/opentelemetry-plugin-mongodb/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ]
-}
diff --git a/packages/opentelemetry-plugin-mongodb/tslint.json b/packages/opentelemetry-plugin-mongodb/tslint.json
deleted file mode 100644
index 0710b135d0..0000000000
--- a/packages/opentelemetry-plugin-mongodb/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-plugin-mysql/.npmignore b/packages/opentelemetry-plugin-mysql/.npmignore
deleted file mode 100644
index 9505ba9450..0000000000
--- a/packages/opentelemetry-plugin-mysql/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/bin
-/coverage
-/doc
-/test
diff --git a/packages/opentelemetry-plugin-mysql/LICENSE b/packages/opentelemetry-plugin-mysql/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-plugin-mysql/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-plugin-mysql/src/version.ts b/packages/opentelemetry-plugin-mysql/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-plugin-mysql/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-plugin-mysql/tsconfig.json b/packages/opentelemetry-plugin-mysql/tsconfig.json
deleted file mode 100644
index a2042cd68b..0000000000
--- a/packages/opentelemetry-plugin-mysql/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ]
-}
diff --git a/packages/opentelemetry-plugin-mysql/tslint.json b/packages/opentelemetry-plugin-mysql/tslint.json
deleted file mode 100644
index 0710b135d0..0000000000
--- a/packages/opentelemetry-plugin-mysql/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/.npmignore b/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/.npmignore
deleted file mode 100644
index 9505ba9450..0000000000
--- a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/bin
-/coverage
-/doc
-/test
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/LICENSE b/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/version.ts b/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/.npmignore b/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/.npmignore
deleted file mode 100644
index 9505ba9450..0000000000
--- a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/bin
-/coverage
-/doc
-/test
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/LICENSE b/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/version.ts b/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-plugin-redis/.npmignore b/packages/opentelemetry-plugin-redis/.npmignore
deleted file mode 100644
index 9505ba9450..0000000000
--- a/packages/opentelemetry-plugin-redis/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/bin
-/coverage
-/doc
-/test
diff --git a/packages/opentelemetry-plugin-redis/LICENSE b/packages/opentelemetry-plugin-redis/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-plugin-redis/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-plugin-redis/src/version.ts b/packages/opentelemetry-plugin-redis/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-plugin-redis/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-plugin-redis/tsconfig.json b/packages/opentelemetry-plugin-redis/tsconfig.json
deleted file mode 100644
index a2042cd68b..0000000000
--- a/packages/opentelemetry-plugin-redis/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ]
-}
diff --git a/packages/opentelemetry-plugin-redis/tslint.json b/packages/opentelemetry-plugin-redis/tslint.json
deleted file mode 100644
index 0710b135d0..0000000000
--- a/packages/opentelemetry-plugin-redis/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-plugin-user-interaction/LICENSE b/packages/opentelemetry-plugin-user-interaction/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-plugin-user-interaction/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-plugin-user-interaction/src/version.ts b/packages/opentelemetry-plugin-user-interaction/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-plugin-user-interaction/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-plugin-user-interaction/test/index-webpack.ts b/packages/opentelemetry-plugin-user-interaction/test/index-webpack.ts
deleted file mode 100644
index 7731f09091..0000000000
--- a/packages/opentelemetry-plugin-user-interaction/test/index-webpack.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// This file is the webpack entry point for the browser Karma tests. It requires
-// all modules ending in "test" from the current folder and all its subfolders.
-const testsContext = require.context('.', true, /test$/);
-testsContext.keys().forEach(testsContext);
-
-const srcContext = require.context('.', true, /src$/);
-srcContext.keys().forEach(srcContext);
diff --git a/packages/opentelemetry-plugin-user-interaction/tsconfig.json b/packages/opentelemetry-plugin-user-interaction/tsconfig.json
deleted file mode 100644
index ab49dd3fbd..0000000000
--- a/packages/opentelemetry-plugin-user-interaction/tsconfig.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "files": [ "node_modules/zone.js/dist/zone.js.d.ts"],
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ]
-}
diff --git a/packages/opentelemetry-plugin-user-interaction/tslint.json b/packages/opentelemetry-plugin-user-interaction/tslint.json
deleted file mode 100644
index 0710b135d0..0000000000
--- a/packages/opentelemetry-plugin-user-interaction/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-plugin-xml-http-request/.npmignore b/packages/opentelemetry-plugin-xml-http-request/.npmignore
deleted file mode 100644
index 9505ba9450..0000000000
--- a/packages/opentelemetry-plugin-xml-http-request/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/bin
-/coverage
-/doc
-/test
diff --git a/packages/opentelemetry-plugin-xml-http-request/LICENSE b/packages/opentelemetry-plugin-xml-http-request/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-plugin-xml-http-request/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-plugin-xml-http-request/karma.conf.js b/packages/opentelemetry-plugin-xml-http-request/karma.conf.js
deleted file mode 100644
index 7183aab033..0000000000
--- a/packages/opentelemetry-plugin-xml-http-request/karma.conf.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-const karmaWebpackConfig = require('../../karma.webpack');
-const karmaBaseConfig = require('../../karma.base');
-
-module.exports = (config) => {
- config.set(Object.assign({}, karmaBaseConfig, {
- webpack: karmaWebpackConfig
- }))
-};
diff --git a/packages/opentelemetry-plugin-xml-http-request/src/version.ts b/packages/opentelemetry-plugin-xml-http-request/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-plugin-xml-http-request/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-plugin-xml-http-request/test/index-webpack.ts b/packages/opentelemetry-plugin-xml-http-request/test/index-webpack.ts
deleted file mode 100644
index 7731f09091..0000000000
--- a/packages/opentelemetry-plugin-xml-http-request/test/index-webpack.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// This file is the webpack entry point for the browser Karma tests. It requires
-// all modules ending in "test" from the current folder and all its subfolders.
-const testsContext = require.context('.', true, /test$/);
-testsContext.keys().forEach(testsContext);
-
-const srcContext = require.context('.', true, /src$/);
-srcContext.keys().forEach(srcContext);
diff --git a/packages/opentelemetry-plugin-xml-http-request/tsconfig.json b/packages/opentelemetry-plugin-xml-http-request/tsconfig.json
deleted file mode 100644
index a2042cd68b..0000000000
--- a/packages/opentelemetry-plugin-xml-http-request/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ]
-}
diff --git a/packages/opentelemetry-plugin-xml-http-request/tslint.json b/packages/opentelemetry-plugin-xml-http-request/tslint.json
deleted file mode 100644
index 0710b135d0..0000000000
--- a/packages/opentelemetry-plugin-xml-http-request/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-propagator-jaeger/.npmignore b/packages/opentelemetry-propagator-jaeger/.npmignore
deleted file mode 100644
index 9505ba9450..0000000000
--- a/packages/opentelemetry-propagator-jaeger/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/bin
-/coverage
-/doc
-/test
diff --git a/packages/opentelemetry-propagator-jaeger/LICENSE b/packages/opentelemetry-propagator-jaeger/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-propagator-jaeger/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-propagator-jaeger/README.md b/packages/opentelemetry-propagator-jaeger/README.md
deleted file mode 100644
index 4c7769dcc6..0000000000
--- a/packages/opentelemetry-propagator-jaeger/README.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# OpenTelemetry Propagator Jaeger
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![devDependencies][devDependencies-image]][devDependencies-url]
-[![Apache License][license-image]][license-image]
-
-OpenTelemetry Jaeger propagator provides HTTP header propagation for systems that are using Jaeger HTTP header format.
-
-Format:
-{trace-id}:{span-id}:{parent-span-id}:{flags}
-
-* {trace-id}
- * 64-bit or 128-bit random number in base16 format.
- * Can be variable length, shorter values are 0-padded on the left.
- * Value of 0 is invalid.
-
-* {span-id}
- * 64-bit random number in base16 format.
-
-* {parent-span-id}
- * Set to 0 because this field is deprecated.
-* {flags}
- * One byte bitmap, as two hex digits.
-
-Example of usage:
-```javascript
-const { NodeTracerProvider } = require('@opentelemetry/node');
-const { JaegerHttpTracePropagator } = require('@opentelemetry/propagator-jaeger');
-
-const provider = new NodeTracerProvider();
-provider.register({
- // Use Jaeger propagator
- propagator: new JaegerHttpTracePropagator()
-});
-```
-
-## Trace on Jaeger UI
-
-![example image](jaeger-tracing.png)
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more about OpenTelemetry JavaScript:
-- For help or feedback on this project, join us on [gitter][gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-propagator-jaeger
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-propagator-jaeger
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-propagator-jaeger
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-propagator-jaeger&type=dev
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/propagator-jaeger
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fpropagator-jaeger.svg
diff --git a/packages/opentelemetry-propagator-jaeger/jaeger-tracing.png b/packages/opentelemetry-propagator-jaeger/jaeger-tracing.png
deleted file mode 100644
index 0c8693a2b5..0000000000
Binary files a/packages/opentelemetry-propagator-jaeger/jaeger-tracing.png and /dev/null differ
diff --git a/packages/opentelemetry-propagator-jaeger/karma.conf.js b/packages/opentelemetry-propagator-jaeger/karma.conf.js
deleted file mode 100644
index edcd9f055f..0000000000
--- a/packages/opentelemetry-propagator-jaeger/karma.conf.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-const karmaWebpackConfig = require('../../karma.webpack');
-const karmaBaseConfig = require('../../karma.base');
-
-module.exports = (config) => {
- config.set(Object.assign({}, karmaBaseConfig, {
- webpack: karmaWebpackConfig
- }))
-};
diff --git a/packages/opentelemetry-propagator-jaeger/package.json b/packages/opentelemetry-propagator-jaeger/package.json
deleted file mode 100644
index 0fae0cee77..0000000000
--- a/packages/opentelemetry-propagator-jaeger/package.json
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "name": "@opentelemetry/propagator-jaeger",
- "version": "0.6.1",
- "description": "OpenTelemetry Jaeger propagator provides HTTP header propagation for systems that are using Jaeger HTTP header format.",
- "main": "build/src/index.js",
- "types": "build/src/index.d.ts",
- "repository": "open-telemetry/opentelemetry-js",
- "scripts": {
- "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",
- "tdd:node": "npm run test -- --watch-extensions ts --watch",
- "tdd:browser": "karma start",
- "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
- "clean": "rimraf build/*",
- "lint": "gts check",
- "lint:fix": "gts 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"
- },
- "keywords": [
- "opentelemetry",
- "nodejs",
- "tracing",
- "profiling",
- "jaeger"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.8",
- "@types/sinon": "^7.0.13",
- "@types/webpack-env": "1.13.9",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "istanbul-instrumenter-loader": "^3.0.1",
- "karma": "^4.4.1",
- "karma-chrome-launcher": "^3.1.0",
- "karma-coverage-istanbul-reporter": "^2.1.0",
- "karma-mocha": "^1.3.0",
- "karma-spec-reporter": "^0.0.32",
- "karma-webpack": "^4.0.2",
- "mocha": "^6.1.0",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "sinon": "^7.5.0",
- "ts-loader": "^6.0.4",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "3.7.2",
- "webpack": "^4.35.2"
- },
- "dependencies": {
- "@opentelemetry/api": "^0.6.1",
- "@opentelemetry/core": "^0.6.1"
- }
-}
diff --git a/packages/opentelemetry-propagator-jaeger/src/JaegerHttpTracePropagator.ts b/packages/opentelemetry-propagator-jaeger/src/JaegerHttpTracePropagator.ts
deleted file mode 100644
index a5ab840dc7..0000000000
--- a/packages/opentelemetry-propagator-jaeger/src/JaegerHttpTracePropagator.ts
+++ /dev/null
@@ -1,101 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- Context,
- HttpTextPropagator,
- SpanContext,
- TraceFlags,
- SetterFunction,
- GetterFunction,
-} from '@opentelemetry/api';
-import {
- getParentSpanContext,
- setExtractedSpanContext,
-} from '@opentelemetry/core';
-
-export const UBER_TRACE_ID_HEADER = 'uber-trace-id';
-
-/**
- * Propagates {@link SpanContext} through Trace Context format propagation.
- * {trace-id}:{span-id}:{parent-span-id}:{flags}
- * {trace-id}
- * 64-bit or 128-bit random number in base16 format.
- * Can be variable length, shorter values are 0-padded on the left.
- * Value of 0 is invalid.
- * {span-id}
- * 64-bit random number in base16 format.
- * {parent-span-id}
- * Set to 0 because this field is deprecated.
- * {flags}
- * One byte bitmap, as two hex digits.
- * Inspired by jaeger-client-node project.
- */
-export class JaegerHttpTracePropagator implements HttpTextPropagator {
- private readonly _jaegerTraceHeader: string;
-
- /**
- * @param {string} [customTraceHeader="uber-trace-id"] - HTTP header to inject\extract trace from.
- **/
- constructor(customTraceHeader?: string) {
- this._jaegerTraceHeader = customTraceHeader || UBER_TRACE_ID_HEADER;
- }
-
- inject(context: Context, carrier: unknown, setter: SetterFunction) {
- const spanContext = getParentSpanContext(context);
- if (!spanContext) return;
-
- const traceFlags = `0${(spanContext.traceFlags || TraceFlags.NONE).toString(
- 16
- )}`;
-
- setter(
- carrier,
- this._jaegerTraceHeader,
- `${spanContext.traceId}:${spanContext.spanId}:0:${traceFlags}`
- );
- }
-
- extract(context: Context, carrier: unknown, getter: GetterFunction): Context {
- const uberTraceIdHeader = getter(carrier, this._jaegerTraceHeader);
- const uberTraceId = Array.isArray(uberTraceIdHeader)
- ? uberTraceIdHeader[0]
- : uberTraceIdHeader;
-
- if (typeof uberTraceId !== 'string') return context;
-
- const spanContext = deserializeSpanContext(uberTraceId);
- if (!spanContext) return context;
-
- return setExtractedSpanContext(context, spanContext);
- }
-}
-
-/**
- * @param {string} serializedString - a serialized span context.
- * @return {SpanContext} - returns a span context represented by the serializedString.
- **/
-function deserializeSpanContext(serializedString: string): SpanContext | null {
- const headers = decodeURIComponent(serializedString).split(':');
- if (headers.length !== 4) {
- return null;
- }
- const [traceId, spanId, , flags] = headers;
-
- const traceFlags = flags.match(/^[0-9a-f]{2}$/i) ? parseInt(flags) & 1 : 1;
-
- return { traceId, spanId, isRemote: true, traceFlags };
-}
diff --git a/packages/opentelemetry-propagator-jaeger/src/index.ts b/packages/opentelemetry-propagator-jaeger/src/index.ts
deleted file mode 100644
index 943458d837..0000000000
--- a/packages/opentelemetry-propagator-jaeger/src/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './JaegerHttpTracePropagator';
diff --git a/packages/opentelemetry-propagator-jaeger/src/version.ts b/packages/opentelemetry-propagator-jaeger/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-propagator-jaeger/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-propagator-jaeger/test/JaegerHttpTracePropagator.test.ts b/packages/opentelemetry-propagator-jaeger/test/JaegerHttpTracePropagator.test.ts
deleted file mode 100644
index 4013e4e8cd..0000000000
--- a/packages/opentelemetry-propagator-jaeger/test/JaegerHttpTracePropagator.test.ts
+++ /dev/null
@@ -1,210 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- Context,
- defaultGetter,
- defaultSetter,
- SpanContext,
- TraceFlags,
-} from '@opentelemetry/api';
-import {
- getExtractedSpanContext,
- setExtractedSpanContext,
-} from '@opentelemetry/core';
-import * as assert from 'assert';
-import {
- JaegerHttpTracePropagator,
- UBER_TRACE_ID_HEADER,
-} from '../src/JaegerHttpTracePropagator';
-
-describe('JaegerHttpTracePropagator', () => {
- const jaegerHttpTracePropagator = new JaegerHttpTracePropagator();
- const customHeader = 'new-header';
- const customJaegerHttpTracePropagator = new JaegerHttpTracePropagator(
- customHeader
- );
- let carrier: { [key: string]: unknown };
-
- beforeEach(() => {
- carrier = {};
- });
-
- describe('.inject()', () => {
- it('should set uber trace id header', () => {
- const spanContext: SpanContext = {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.SAMPLED,
- };
-
- jaegerHttpTracePropagator.inject(
- setExtractedSpanContext(Context.ROOT_CONTEXT, spanContext),
- carrier,
- defaultSetter
- );
- assert.deepStrictEqual(
- carrier[UBER_TRACE_ID_HEADER],
- 'd4cda95b652f4a1592b449d5929fda1b:6e0c63257de34c92:0:01'
- );
- });
-
- it('should use custom header if provided', () => {
- const spanContext: SpanContext = {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.SAMPLED,
- };
-
- customJaegerHttpTracePropagator.inject(
- setExtractedSpanContext(Context.ROOT_CONTEXT, spanContext),
- carrier,
- defaultSetter
- );
- assert.deepStrictEqual(
- carrier[customHeader],
- 'd4cda95b652f4a1592b449d5929fda1b:6e0c63257de34c92:0:01'
- );
- });
- });
-
- describe('.extract()', () => {
- it('should extract context of a sampled span from carrier', () => {
- carrier[UBER_TRACE_ID_HEADER] =
- 'd4cda95b652f4a1592b449d5929fda1b:6e0c63257de34c92:0:01';
- const extractedSpanContext = getExtractedSpanContext(
- jaegerHttpTracePropagator.extract(
- Context.ROOT_CONTEXT,
- carrier,
- defaultGetter
- )
- );
-
- assert.deepStrictEqual(extractedSpanContext, {
- spanId: '6e0c63257de34c92',
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- isRemote: true,
- traceFlags: TraceFlags.SAMPLED,
- });
- });
-
- it('should extract context of a sampled span from carrier with 1 bit flag', () => {
- carrier[UBER_TRACE_ID_HEADER] =
- '9c41e35aeb6d1272:45fd2a9709dadcf1:a13699e3fb724f40:1';
- const extractedSpanContext = getExtractedSpanContext(
- jaegerHttpTracePropagator.extract(
- Context.ROOT_CONTEXT,
- carrier,
- defaultGetter
- )
- );
-
- assert.deepStrictEqual(extractedSpanContext, {
- spanId: '45fd2a9709dadcf1',
- traceId: '9c41e35aeb6d1272',
- isRemote: true,
- traceFlags: TraceFlags.SAMPLED,
- });
- });
-
- it('should extract context of a sampled span from UTF-8 encoded carrier', () => {
- carrier[UBER_TRACE_ID_HEADER] =
- 'ac1f3dc3c2c0b06e%3A5ac292c4a11a163e%3Ac086aaa825821068%3A1';
- const extractedSpanContext = getExtractedSpanContext(
- jaegerHttpTracePropagator.extract(
- Context.ROOT_CONTEXT,
- carrier,
- defaultGetter
- )
- );
-
- assert.deepStrictEqual(extractedSpanContext, {
- spanId: '5ac292c4a11a163e',
- traceId: 'ac1f3dc3c2c0b06e',
- isRemote: true,
- traceFlags: TraceFlags.SAMPLED,
- });
- });
-
- it('should use custom header if provided', () => {
- carrier[customHeader] =
- 'd4cda95b652f4a1592b449d5929fda1b:6e0c63257de34c92:0:01';
- const extractedSpanContext = getExtractedSpanContext(
- customJaegerHttpTracePropagator.extract(
- Context.ROOT_CONTEXT,
- carrier,
- defaultGetter
- )
- );
-
- assert.deepStrictEqual(extractedSpanContext, {
- spanId: '6e0c63257de34c92',
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- isRemote: true,
- traceFlags: TraceFlags.SAMPLED,
- });
- });
-
- it('returns undefined if UBER_TRACE_ID_HEADER header is missing', () => {
- assert.deepStrictEqual(
- getExtractedSpanContext(
- jaegerHttpTracePropagator.extract(
- Context.ROOT_CONTEXT,
- carrier,
- defaultGetter
- )
- ),
- undefined
- );
- });
-
- it('returns undefined if UBER_TRACE_ID_HEADER header is invalid', () => {
- carrier[UBER_TRACE_ID_HEADER] = 'invalid!';
- assert.deepStrictEqual(
- getExtractedSpanContext(
- jaegerHttpTracePropagator.extract(
- Context.ROOT_CONTEXT,
- carrier,
- defaultGetter
- )
- ),
- undefined
- );
- });
- });
-
- it('should fail gracefully on bad responses from getter', () => {
- const ctx1 = jaegerHttpTracePropagator.extract(
- Context.ROOT_CONTEXT,
- carrier,
- (c, k) => 1 // not a number
- );
- const ctx2 = jaegerHttpTracePropagator.extract(
- Context.ROOT_CONTEXT,
- carrier,
- (c, k) => [] // empty array
- );
- const ctx3 = jaegerHttpTracePropagator.extract(
- Context.ROOT_CONTEXT,
- carrier,
- (c, k) => undefined // missing value
- );
-
- assert.ok(ctx1 === Context.ROOT_CONTEXT);
- assert.ok(ctx2 === Context.ROOT_CONTEXT);
- assert.ok(ctx3 === Context.ROOT_CONTEXT);
- });
-});
diff --git a/packages/opentelemetry-propagator-jaeger/test/index-webpack.ts b/packages/opentelemetry-propagator-jaeger/test/index-webpack.ts
deleted file mode 100644
index 2709346bf1..0000000000
--- a/packages/opentelemetry-propagator-jaeger/test/index-webpack.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// This file is the webpack entry point for the browser Karma tests. It requires
-// all modules ending in "test" from the current folder and all its subfolders.
-const testsContext = require.context('.', true, /test$/);
-testsContext.keys().forEach(testsContext);
-
-const srcContext = require.context('.', true, /src$/);
-srcContext.keys().forEach(srcContext);
diff --git a/packages/opentelemetry-propagator-jaeger/tsconfig.json b/packages/opentelemetry-propagator-jaeger/tsconfig.json
deleted file mode 100644
index a2042cd68b..0000000000
--- a/packages/opentelemetry-propagator-jaeger/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ]
-}
diff --git a/packages/opentelemetry-propagator-jaeger/tslint.json b/packages/opentelemetry-propagator-jaeger/tslint.json
deleted file mode 100644
index 0710b135d0..0000000000
--- a/packages/opentelemetry-propagator-jaeger/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-resources/.npmignore b/packages/opentelemetry-resources/.npmignore
deleted file mode 100644
index 9505ba9450..0000000000
--- a/packages/opentelemetry-resources/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/bin
-/coverage
-/doc
-/test
diff --git a/packages/opentelemetry-resources/LICENSE b/packages/opentelemetry-resources/LICENSE
deleted file mode 100644
index b0e74c7d15..0000000000
--- a/packages/opentelemetry-resources/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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 [2020] [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/opentelemetry-resources/package.json b/packages/opentelemetry-resources/package.json
deleted file mode 100644
index 532fd10150..0000000000
--- a/packages/opentelemetry-resources/package.json
+++ /dev/null
@@ -1,68 +0,0 @@
-{
- "name": "@opentelemetry/resources",
- "version": "0.6.1",
- "description": "OpenTelemetry SDK resources",
- "main": "build/src/index.js",
- "browser": {
- "./src/platform/index.ts": "./src/platform/browser/index.ts",
- "./build/src/platform/index.js": "./build/src/platform/browser/index.js"
- },
- "types": "build/src/index.d.ts",
- "repository": "open-telemetry/opentelemetry-js",
- "scripts": {
- "lint": "gts check",
- "lint:fix": "gts 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"
- },
- "keywords": [
- "opentelemetry",
- "nodejs",
- "resources",
- "stats",
- "profiling"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.9",
- "@types/sinon": "^7.0.13",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "mocha": "^6.2.0",
- "nock": "^12.0.2",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "sinon": "^7.5.0",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "3.7.2"
- },
- "dependencies": {
- "@opentelemetry/api": "^0.6.1",
- "@opentelemetry/base": "^0.6.1",
- "gcp-metadata": "^3.5.0"
- }
-}
diff --git a/packages/opentelemetry-resources/src/Resource.ts b/packages/opentelemetry-resources/src/Resource.ts
deleted file mode 100644
index 0a76dad968..0000000000
--- a/packages/opentelemetry-resources/src/Resource.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { SDK_INFO } from '@opentelemetry/base';
-import { TELEMETRY_SDK_RESOURCE } from './constants';
-import { ResourceLabels } from './types';
-
-/**
- * A Resource describes the entity for which a signals (metrics or trace) are
- * collected.
- */
-export class Resource {
- static readonly EMPTY = new Resource({});
-
- /**
- * Returns an empty Resource
- */
- static empty(): Resource {
- return Resource.EMPTY;
- }
-
- /**
- * Returns a Resource that indentifies the SDK in use.
- */
- static createTelemetrySDKResource(): Resource {
- return new Resource({
- [TELEMETRY_SDK_RESOURCE.LANGUAGE]: SDK_INFO.LANGUAGE,
- [TELEMETRY_SDK_RESOURCE.NAME]: SDK_INFO.NAME,
- [TELEMETRY_SDK_RESOURCE.VERSION]: SDK_INFO.VERSION,
- });
- }
-
- constructor(
- /**
- * A dictionary of labels with string keys and values that provide information
- * about the entity as numbers, strings or booleans
- * TODO: Consider to add check/validation on labels.
- */
- readonly labels: ResourceLabels
- ) {}
-
- /**
- * Returns a new, merged {@link Resource} by merging the current Resource
- * with the other Resource. In case of a collision, current Resource takes
- * precedence.
- *
- * @param other the Resource that will be merged with this.
- * @returns the newly merged Resource.
- */
- merge(other: Resource | null): Resource {
- if (!other || !Object.keys(other.labels).length) return this;
-
- // Labels from resource overwrite labels from other resource.
- const mergedLabels = Object.assign({}, other.labels, this.labels);
- return new Resource(mergedLabels);
- }
-}
diff --git a/packages/opentelemetry-resources/src/constants.ts b/packages/opentelemetry-resources/src/constants.ts
deleted file mode 100644
index c6423777b3..0000000000
--- a/packages/opentelemetry-resources/src/constants.ts
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Semantic conventions for Resources
- * https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-resource-semantic-conventions.md
- */
-
-/** Attributes defining a running environment (e.g. Cloud, Data Center). */
-export const CLOUD_RESOURCE = {
- /** Name of the cloud provider. Example values are aws, azure, gcp. */
- PROVIDER: 'cloud.provider',
-
- /** The cloud account id used to identify different entities. */
- ACCOUNT_ID: 'cloud.account.id',
-
- /** A specific geographical location where different entities can run. */
- REGION: 'cloud.region',
-
- /** Zones are a sub set of the region connected through low-latency links. */
- ZONE: 'cloud.zone',
-};
-
-/**
- * Attributes defining a compute unit (e.g. Container, Process, Lambda
- * Function).
- * */
-export const CONTAINER_RESOURCE = {
- /** The container name. */
- NAME: 'container.name',
-
- /** The name of the image the container was built on. */
- IMAGE_NAME: 'container.image.name',
-
- /** The container image tag. */
- IMAGE_TAG: 'container.image.tag',
-};
-
-/** Attributes defining a computing instance (e.g. host). */
-export const HOST_RESOURCE = {
- /**
- * Hostname of the host. It contains what the hostname command returns on the
- * host machine.
- */
- HOSTNAME: 'host.hostname',
-
- /**
- * Unique host id. For Cloud this must be the instance_id assigned by the
- * cloud provider
- */
- ID: 'host.id',
-
- /**
- * Name of the host. It may contain what hostname returns on Unix systems,
- * the fully qualified, or a name specified by the user.
- */
- NAME: 'host.name',
-
- /** Type of host. For Cloud this must be the machine type.*/
- TYPE: 'host.type',
-
- /** Name of the VM image or OS install the host was instantiated from. */
- IMAGE_NAME: 'host.image.name',
-
- /** VM image id. For Cloud, this value is from the provider. */
- IMAGE_ID: 'host.image.id',
-
- /** The version string of the VM image */
- IMAGE_VERSION: 'host.image.version',
-};
-
-/** Attributes defining a deployment service (e.g. Kubernetes). */
-export const K8S_RESOURCE = {
- /** The name of the cluster that the pod is running in. */
- CLUSTER_NAME: 'k8s.cluster.name',
-
- /** The name of the namespace that the pod is running in. */
- NAMESPACE_NAME: 'k8s.namespace.name',
-
- /** The name of the pod. */
- POD_NAME: 'k8s.pod.name',
-
- /** The name of the deployment. */
- DEPLOYMENT_NAME: 'k8s.deployment.name',
-};
-
-/** Attributes describing the telemetry library. */
-export const TELEMETRY_SDK_RESOURCE = {
- /** The name of the telemetry library. */
- NAME: 'telemetry.sdk.name',
-
- /** The language of telemetry library and of the code instrumented with it. */
- LANGUAGE: 'telemetry.sdk.language',
-
- /** The version string of the telemetry library */
- VERSION: 'telemetry.sdk.version',
-};
-
-/** Attributes describing a service instance. */
-export const SERVICE_RESOURCE = {
- /** Logical name of the service. */
- NAME: 'service.name',
-
- /** A namespace for `service.name`. */
- NAMESPACE: 'service.namespace',
-
- /** The string ID of the service instance. */
- INSTANCE_ID: 'service.instance.id',
-
- /** The version string of the service API or implementation. */
- VERSION: 'service.version',
-};
diff --git a/packages/opentelemetry-resources/src/index.ts b/packages/opentelemetry-resources/src/index.ts
deleted file mode 100644
index 13673409aa..0000000000
--- a/packages/opentelemetry-resources/src/index.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './Resource';
-export * from './platform';
-export * from './constants';
-export * from './types';
diff --git a/packages/opentelemetry-resources/src/platform/browser/detect-resources.ts b/packages/opentelemetry-resources/src/platform/browser/detect-resources.ts
deleted file mode 100644
index 43db76639a..0000000000
--- a/packages/opentelemetry-resources/src/platform/browser/detect-resources.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Resource } from '../../Resource';
-
-/**
- * Detects resources for the browser platform, which is currently only the
- * telemetry SDK resource. More could be added in the future. This method
- * is async to match the signature of corresponding method for node.
- */
-export const detectResources = async (): Promise => {
- return Resource.createTelemetrySDKResource();
-};
diff --git a/packages/opentelemetry-resources/src/platform/browser/index.ts b/packages/opentelemetry-resources/src/platform/browser/index.ts
deleted file mode 100644
index 560cdcf821..0000000000
--- a/packages/opentelemetry-resources/src/platform/browser/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './detect-resources';
diff --git a/packages/opentelemetry-resources/src/platform/index.ts b/packages/opentelemetry-resources/src/platform/index.ts
deleted file mode 100644
index 6c6d039c91..0000000000
--- a/packages/opentelemetry-resources/src/platform/index.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Use the node platform by default. The "browser" field of package.json is used
-// to override this file to use `./browser/index.ts` when packaged with
-// webpack, Rollup, etc.
-export * from './node';
diff --git a/packages/opentelemetry-resources/src/platform/node/detect-resources.ts b/packages/opentelemetry-resources/src/platform/node/detect-resources.ts
deleted file mode 100644
index 2351250582..0000000000
--- a/packages/opentelemetry-resources/src/platform/node/detect-resources.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Resource } from '../../Resource';
-import { envDetector, awsEc2Detector, gcpDetector } from './detectors';
-import { Detector } from '../../types';
-
-const DETECTORS: Array = [envDetector, awsEc2Detector, gcpDetector];
-
-/**
- * Runs all resource detectors and returns the results merged into a single
- * Resource.
- */
-export const detectResources = async (): Promise => {
- const resources: Array = await Promise.all(
- DETECTORS.map(d => {
- try {
- return d.detect();
- } catch {
- return Resource.empty();
- }
- })
- );
- return resources.reduce(
- (acc, resource) => acc.merge(resource),
- Resource.createTelemetrySDKResource()
- );
-};
diff --git a/packages/opentelemetry-resources/src/platform/node/detectors/AwsEc2Detector.ts b/packages/opentelemetry-resources/src/platform/node/detectors/AwsEc2Detector.ts
deleted file mode 100644
index d3317b9c09..0000000000
--- a/packages/opentelemetry-resources/src/platform/node/detectors/AwsEc2Detector.ts
+++ /dev/null
@@ -1,101 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as http from 'http';
-import { Resource } from '../../../Resource';
-import { CLOUD_RESOURCE, HOST_RESOURCE } from '../../../constants';
-import { Detector } from '../../../types';
-
-/**
- * The AwsEc2Detector can be used to detect if a process is running in AWS EC2
- * and return a {@link Resource} populated with metadata about the EC2
- * instance. Returns an empty Resource if detection fails.
- */
-class AwsEc2Detector implements Detector {
- /**
- * See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html
- * for documentation about the AWS instance identity document endpoint.
- */
- readonly AWS_INSTANCE_IDENTITY_DOCUMENT_URI =
- 'http://169.254.169.254/latest/dynamic/instance-identity/document';
-
- /**
- * Attempts to connect and obtain an AWS instance Identity document. If the
- * connection is succesful it returns a promise containing a {@link Resource}
- * populated with instance metadata as labels. Returns a promise containing an
- * empty {@link Resource} if the connection or parsing of the identity
- * document fails.
- */
- async detect(): Promise {
- try {
- const {
- accountId,
- instanceId,
- region,
- } = await this._awsMetadataAccessor();
- return new Resource({
- [CLOUD_RESOURCE.PROVIDER]: 'aws',
- [CLOUD_RESOURCE.ACCOUNT_ID]: accountId,
- [CLOUD_RESOURCE.REGION]: region,
- [HOST_RESOURCE.ID]: instanceId,
- });
- } catch {
- return Resource.empty();
- }
- }
-
- /**
- * Establishes an HTTP connection to AWS instance identity document url.
- * If the application is running on an EC2 instance, we should be able
- * to get back a valid JSON document. Parses that document and stores
- * the identity properties in a local map.
- */
- private async _awsMetadataAccessor(): Promise {
- return new Promise((resolve, reject) => {
- const timeoutId = setTimeout(() => {
- req.abort();
- reject(new Error('EC2 metadata api request timed out.'));
- }, 1000);
-
- const req = http.get(this.AWS_INSTANCE_IDENTITY_DOCUMENT_URI, res => {
- clearTimeout(timeoutId);
- const { statusCode } = res;
- res.setEncoding('utf8');
- let rawData = '';
- res.on('data', chunk => (rawData += chunk));
- res.on('end', () => {
- if (statusCode && statusCode >= 200 && statusCode < 300) {
- try {
- resolve(JSON.parse(rawData));
- } catch (e) {
- reject(e);
- }
- } else {
- reject(
- new Error('Failed to load page, status code: ' + statusCode)
- );
- }
- });
- });
- req.on('error', err => {
- clearTimeout(timeoutId);
- reject(err);
- });
- });
- }
-}
-
-export const awsEc2Detector = new AwsEc2Detector();
diff --git a/packages/opentelemetry-resources/src/platform/node/detectors/EnvDetector.ts b/packages/opentelemetry-resources/src/platform/node/detectors/EnvDetector.ts
deleted file mode 100644
index 52dd160778..0000000000
--- a/packages/opentelemetry-resources/src/platform/node/detectors/EnvDetector.ts
+++ /dev/null
@@ -1,138 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Resource } from '../../../Resource';
-import { Detector, ResourceLabels } from '../../../types';
-
-/**
- * EnvDetector can be used to detect the presence of and create a Resource
- * from the OTEL_RESOURCE_LABELS environment variable.
- */
-class EnvDetector implements Detector {
- // Type, label keys, and label values should not exceed 256 characters.
- private readonly _MAX_LENGTH = 255;
-
- // OTEL_RESOURCE_LABELS is a comma-separated list of labels.
- private readonly _COMMA_SEPARATOR = ',';
-
- // OTEL_RESOURCE_LABELS contains key value pair separated by '='.
- private readonly _LABEL_KEY_VALUE_SPLITTER = '=';
-
- private readonly _ERROR_MESSAGE_INVALID_CHARS =
- 'should be a ASCII string with a length greater than 0 and not exceed ' +
- this._MAX_LENGTH +
- ' characters.';
-
- private readonly _ERROR_MESSAGE_INVALID_VALUE =
- 'should be a ASCII string with a length not exceed ' +
- this._MAX_LENGTH +
- ' characters.';
-
- /**
- * Returns a {@link Resource} populated with labels from the
- * OTEL_RESOURCE_LABELS environment variable. Note this is an async function
- * to conform to the Detector interface.
- */
- async detect(): Promise {
- try {
- const labelString = process.env.OTEL_RESOURCE_LABELS;
- if (!labelString) return Resource.empty();
- const labels = this._parseResourceLabels(
- process.env.OTEL_RESOURCE_LABELS
- );
- return new Resource(labels);
- } catch {
- return Resource.empty();
- }
- }
-
- /**
- * Creates a label map from the OTEL_RESOURCE_LABELS environment variable.
- *
- * OTEL_RESOURCE_LABELS: A comma-separated list of labels describing the
- * source in more detail, e.g. “key1=val1,key2=val2”. Domain names and paths
- * are accepted as label keys. Values may be quoted or unquoted in general. If
- * a value contains whitespaces, =, or " characters, it must always be quoted.
- *
- * @param rawEnvLabels The resource labels as a comma-seperated list
- * of key/value pairs.
- * @returns The sanitized resource labels.
- */
- private _parseResourceLabels(rawEnvLabels?: string): ResourceLabels {
- if (!rawEnvLabels) return {};
-
- const labels: ResourceLabels = {};
- const rawLabels: string[] = rawEnvLabels.split(this._COMMA_SEPARATOR, -1);
- for (const rawLabel of rawLabels) {
- const keyValuePair: string[] = rawLabel.split(
- this._LABEL_KEY_VALUE_SPLITTER,
- -1
- );
- if (keyValuePair.length !== 2) {
- continue;
- }
- let [key, value] = keyValuePair;
- // Leading and trailing whitespaces are trimmed.
- key = key.trim();
- value = value
- .trim()
- .split('^"|"$')
- .join('');
- if (!this._isValidAndNotEmpty(key)) {
- throw new Error(`Label key ${this._ERROR_MESSAGE_INVALID_CHARS}`);
- }
- if (!this._isValid(value)) {
- throw new Error(`Label value ${this._ERROR_MESSAGE_INVALID_VALUE}`);
- }
- labels[key] = value;
- }
- return labels;
- }
-
- /**
- * Determines whether the given String is a valid printable ASCII string with
- * a length not exceed _MAX_LENGTH characters.
- *
- * @param str The String to be validated.
- * @returns Whether the String is valid.
- */
- private _isValid(name: string): boolean {
- return name.length <= this._MAX_LENGTH && this._isPrintableString(name);
- }
-
- private _isPrintableString(str: string): boolean {
- for (let i = 0; i < str.length; i++) {
- const ch: string = str.charAt(i);
- if (ch <= ' ' || ch >= '~') {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Determines whether the given String is a valid printable ASCII string with
- * a length greater than 0 and not exceed _MAX_LENGTH characters.
- *
- * @param str The String to be validated.
- * @returns Whether the String is valid and not empty.
- */
- private _isValidAndNotEmpty(str: string): boolean {
- return str.length > 0 && this._isValid(str);
- }
-}
-
-export const envDetector = new EnvDetector();
diff --git a/packages/opentelemetry-resources/src/platform/node/detectors/GcpDetector.ts b/packages/opentelemetry-resources/src/platform/node/detectors/GcpDetector.ts
deleted file mode 100644
index ab1136fe8b..0000000000
--- a/packages/opentelemetry-resources/src/platform/node/detectors/GcpDetector.ts
+++ /dev/null
@@ -1,106 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as os from 'os';
-import * as gcpMetadata from 'gcp-metadata';
-import { Resource } from '../../../Resource';
-import { Detector, ResourceLabels } from '../../../types';
-import {
- CLOUD_RESOURCE,
- HOST_RESOURCE,
- K8S_RESOURCE,
- CONTAINER_RESOURCE,
-} from '../../../constants';
-
-/**
- * The GcpDetector can be used to detect if a process is running in the Google
- * Cloud Platofrm and return a {@link Resource} populated with metadata about
- * the instance. Returns an empty Resource if detection fails.
- */
-class GcpDetector implements Detector {
- async detect(): Promise {
- if (!(await gcpMetadata.isAvailable())) return Resource.empty();
-
- const [projectId, instanceId, zoneId, clusterName] = await Promise.all([
- this._getProjectId(),
- this._getInstanceId(),
- this._getZone(),
- this._getClusterName(),
- ]);
-
- const labels: ResourceLabels = {};
- labels[CLOUD_RESOURCE.ACCOUNT_ID] = projectId;
- labels[HOST_RESOURCE.ID] = instanceId;
- labels[CLOUD_RESOURCE.ZONE] = zoneId;
- labels[CLOUD_RESOURCE.PROVIDER] = 'gcp';
-
- if (process.env.KUBERNETES_SERVICE_HOST)
- this._addK8sLabels(labels, clusterName);
-
- return new Resource(labels);
- }
-
- /** Add resource labels for K8s */
- private _addK8sLabels(labels: ResourceLabels, clusterName: string): void {
- labels[K8S_RESOURCE.CLUSTER_NAME] = clusterName;
- labels[K8S_RESOURCE.NAMESPACE_NAME] = process.env.NAMESPACE || '';
- labels[K8S_RESOURCE.POD_NAME] = process.env.HOSTNAME || os.hostname();
- labels[CONTAINER_RESOURCE.NAME] = process.env.CONTAINER_NAME || '';
- }
-
- /** Gets project id from GCP project metadata. */
- private async _getProjectId(): Promise {
- try {
- return await gcpMetadata.project('project-id');
- } catch {
- return '';
- }
- }
-
- /** Gets instance id from GCP instance metadata. */
- private async _getInstanceId(): Promise {
- try {
- const id = await gcpMetadata.instance('id');
- return id.toString();
- } catch {
- return '';
- }
- }
-
- /** Gets zone from GCP instance metadata. */
- private async _getZone(): Promise {
- try {
- const zoneId = await gcpMetadata.instance('zone');
- if (zoneId) {
- return zoneId.split('/').pop();
- }
- return '';
- } catch {
- return '';
- }
- }
-
- /** Gets cluster name from GCP instance metadata. */
- private async _getClusterName(): Promise {
- try {
- return await gcpMetadata.instance('attributes/cluster-name');
- } catch {
- return '';
- }
- }
-}
-
-export const gcpDetector = new GcpDetector();
diff --git a/packages/opentelemetry-resources/src/platform/node/detectors/index.ts b/packages/opentelemetry-resources/src/platform/node/detectors/index.ts
deleted file mode 100644
index 79597f3f1c..0000000000
--- a/packages/opentelemetry-resources/src/platform/node/detectors/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { awsEc2Detector } from './AwsEc2Detector';
-export { envDetector } from './EnvDetector';
-export { gcpDetector } from './GcpDetector';
diff --git a/packages/opentelemetry-resources/src/platform/node/index.ts b/packages/opentelemetry-resources/src/platform/node/index.ts
deleted file mode 100644
index 560cdcf821..0000000000
--- a/packages/opentelemetry-resources/src/platform/node/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './detect-resources';
diff --git a/packages/opentelemetry-resources/src/types.ts b/packages/opentelemetry-resources/src/types.ts
deleted file mode 100644
index a9705350a5..0000000000
--- a/packages/opentelemetry-resources/src/types.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Resource } from './Resource';
-
-/** Interface for Resource labels */
-export interface ResourceLabels {
- [key: string]: number | string | boolean;
-}
-
-/**
- * Interface for a Resource Detector. In order to detect resources in parallel
- * a detector returns a Promise containing a Resource.
- */
-export interface Detector {
- detect(): Promise;
-}
diff --git a/packages/opentelemetry-resources/src/version.ts b/packages/opentelemetry-resources/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-resources/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-resources/test/Resource.test.ts b/packages/opentelemetry-resources/test/Resource.test.ts
deleted file mode 100644
index 2623094817..0000000000
--- a/packages/opentelemetry-resources/test/Resource.test.ts
+++ /dev/null
@@ -1,113 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import { SDK_INFO } from '@opentelemetry/base';
-import { Resource } from '../src';
-import { assertTelemetrySDKResource } from './util/resource-assertions';
-
-describe('Resource', () => {
- const resource1 = new Resource({
- 'k8s.io/container/name': 'c1',
- 'k8s.io/namespace/name': 'default',
- 'k8s.io/pod/name': 'pod-xyz-123',
- });
- const resource2 = new Resource({
- 'k8s.io/zone': 'zone1',
- 'k8s.io/location': 'location',
- });
- const resource3 = new Resource({
- 'k8s.io/container/name': 'c2',
- 'k8s.io/location': 'location1',
- });
- const emptyResource = new Resource({});
-
- it('should return merged resource', () => {
- const expectedResource = new Resource({
- 'k8s.io/container/name': 'c1',
- 'k8s.io/namespace/name': 'default',
- 'k8s.io/pod/name': 'pod-xyz-123',
- 'k8s.io/zone': 'zone1',
- 'k8s.io/location': 'location',
- });
- const actualResource = resource1.merge(resource2);
- assert.strictEqual(Object.keys(actualResource.labels).length, 5);
- assert.deepStrictEqual(actualResource, expectedResource);
- });
-
- it('should return merged resource when collision in labels', () => {
- const expectedResource = new Resource({
- 'k8s.io/container/name': 'c1',
- 'k8s.io/namespace/name': 'default',
- 'k8s.io/pod/name': 'pod-xyz-123',
- 'k8s.io/location': 'location1',
- });
- const actualResource = resource1.merge(resource3);
- assert.strictEqual(Object.keys(actualResource.labels).length, 4);
- assert.deepStrictEqual(actualResource, expectedResource);
- });
-
- it('should return merged resource when first resource is empty', () => {
- const actualResource = emptyResource.merge(resource2);
- assert.strictEqual(Object.keys(actualResource.labels).length, 2);
- assert.deepStrictEqual(actualResource, resource2);
- });
-
- it('should return merged resource when other resource is empty', () => {
- const actualResource = resource1.merge(emptyResource);
- assert.strictEqual(Object.keys(actualResource.labels).length, 3);
- assert.deepStrictEqual(actualResource, resource1);
- });
-
- it('should return merged resource when other resource is null', () => {
- const actualResource = resource1.merge(null);
- assert.strictEqual(Object.keys(actualResource.labels).length, 3);
- assert.deepStrictEqual(actualResource, resource1);
- });
-
- it('should accept string, number, and boolean values', () => {
- const resource = new Resource({
- 'custom.string': 'strvalue',
- 'custom.number': 42,
- 'custom.boolean': true,
- });
- assert.equal(resource.labels['custom.string'], 'strvalue');
- assert.equal(resource.labels['custom.number'], 42);
- assert.equal(resource.labels['custom.boolean'], true);
- });
-
- describe('.empty()', () => {
- it('should return an empty resource', () => {
- const resource = Resource.empty();
- assert.equal(Object.entries(resource.labels), 0);
- });
-
- it('should return the same empty resource', () => {
- assert.strictEqual(Resource.empty(), Resource.empty());
- });
- });
-
- describe('.createTelemetrySDKResource()', () => {
- it('should return a telemetry SDK resource', () => {
- const resource = Resource.createTelemetrySDKResource();
- assertTelemetrySDKResource(resource, {
- language: SDK_INFO.LANGUAGE,
- name: SDK_INFO.NAME,
- version: SDK_INFO.VERSION,
- });
- });
- });
-});
diff --git a/packages/opentelemetry-resources/test/detect-resources.test.ts b/packages/opentelemetry-resources/test/detect-resources.test.ts
deleted file mode 100644
index 24efdf7638..0000000000
--- a/packages/opentelemetry-resources/test/detect-resources.test.ts
+++ /dev/null
@@ -1,161 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as nock from 'nock';
-import * as sinon from 'sinon';
-import { URL } from 'url';
-import { Resource, detectResources } from '../src';
-import { awsEc2Detector } from '../src/platform/node/detectors';
-import {
- assertServiceResource,
- assertCloudResource,
- assertHostResource,
-} from './util/resource-assertions';
-import {
- BASE_PATH,
- HEADER_NAME,
- HEADER_VALUE,
- HOST_ADDRESS,
- SECONDARY_HOST_ADDRESS,
- resetIsAvailableCache,
-} from 'gcp-metadata';
-
-const HEADERS = {
- [HEADER_NAME.toLowerCase()]: HEADER_VALUE,
-};
-const INSTANCE_PATH = BASE_PATH + '/instance';
-const INSTANCE_ID_PATH = BASE_PATH + '/instance/id';
-const PROJECT_ID_PATH = BASE_PATH + '/project/project-id';
-const ZONE_PATH = BASE_PATH + '/instance/zone';
-const CLUSTER_NAME_PATH = BASE_PATH + '/instance/attributes/cluster-name';
-
-const { origin: AWS_HOST, pathname: AWS_PATH } = new URL(
- awsEc2Detector.AWS_INSTANCE_IDENTITY_DOCUMENT_URI
-);
-
-const mockedAwsResponse = {
- instanceId: 'my-instance-id',
- accountId: 'my-account-id',
- region: 'my-region',
-};
-
-describe('detectResources', async () => {
- beforeEach(() => {
- nock.disableNetConnect();
- process.env.OTEL_RESOURCE_LABELS =
- 'service.instance.id=627cc493,service.name=my-service,service.namespace=default,service.version=0.0.1';
- });
-
- afterEach(() => {
- nock.cleanAll();
- nock.enableNetConnect();
- delete process.env.OTEL_RESOURCE_LABELS;
- });
-
- describe('in GCP environment', () => {
- after(() => {
- resetIsAvailableCache();
- });
-
- it('returns a merged resource', async () => {
- const gcpScope = nock(HOST_ADDRESS)
- .get(INSTANCE_PATH)
- .reply(200, {}, HEADERS)
- .get(INSTANCE_ID_PATH)
- .reply(200, () => 452003179927758, HEADERS)
- .get(PROJECT_ID_PATH)
- .reply(200, () => 'my-project-id', HEADERS)
- .get(ZONE_PATH)
- .reply(200, () => 'project/zone/my-zone', HEADERS)
- .get(CLUSTER_NAME_PATH)
- .reply(404);
- const gcpSecondaryScope = nock(SECONDARY_HOST_ADDRESS)
- .get(INSTANCE_PATH)
- .reply(200, {}, HEADERS);
- const awsScope = nock(AWS_HOST)
- .get(AWS_PATH)
- .replyWithError({ code: 'ENOTFOUND' });
- const resource: Resource = await detectResources();
- awsScope.done();
- gcpSecondaryScope.done();
- gcpScope.done();
-
- assertCloudResource(resource, {
- provider: 'gcp',
- accountId: 'my-project-id',
- zone: 'my-zone',
- });
- assertHostResource(resource, { id: '452003179927758' });
- assertServiceResource(resource, {
- instanceId: '627cc493',
- name: 'my-service',
- namespace: 'default',
- version: '0.0.1',
- });
- });
- });
-
- describe('in AWS environment', () => {
- it('returns a merged resource', async () => {
- const gcpScope = nock(HOST_ADDRESS)
- .get(INSTANCE_PATH)
- .replyWithError({
- code: 'ENOTFOUND',
- });
- const gcpSecondaryScope = nock(SECONDARY_HOST_ADDRESS)
- .get(INSTANCE_PATH)
- .replyWithError({
- code: 'ENOTFOUND',
- });
- const awsScope = nock(AWS_HOST)
- .get(AWS_PATH)
- .reply(200, () => mockedAwsResponse);
- const resource: Resource = await detectResources();
- gcpSecondaryScope.done();
- gcpScope.done();
- awsScope.done();
-
- assertCloudResource(resource, {
- provider: 'aws',
- accountId: 'my-account-id',
- region: 'my-region',
- });
- assertHostResource(resource, { id: 'my-instance-id' });
- assertServiceResource(resource, {
- instanceId: '627cc493',
- name: 'my-service',
- namespace: 'default',
- version: '0.0.1',
- });
- });
- });
-
- describe('with a buggy detector', () => {
- it('returns a merged resource', async () => {
- const stub = sinon.stub(awsEc2Detector, 'detect').throws();
- const resource: Resource = await detectResources();
-
- assertServiceResource(resource, {
- instanceId: '627cc493',
- name: 'my-service',
- namespace: 'default',
- version: '0.0.1',
- });
-
- stub.restore();
- });
- });
-});
diff --git a/packages/opentelemetry-resources/test/detectors/AwsEc2Detector.test.ts b/packages/opentelemetry-resources/test/detectors/AwsEc2Detector.test.ts
deleted file mode 100644
index 6777d472fe..0000000000
--- a/packages/opentelemetry-resources/test/detectors/AwsEc2Detector.test.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as nock from 'nock';
-import * as assert from 'assert';
-import { URL } from 'url';
-import { Resource } from '../../src';
-import { awsEc2Detector } from '../../src/platform/node/detectors/AwsEc2Detector';
-import {
- assertCloudResource,
- assertHostResource,
- assertEmptyResource,
-} from '../util/resource-assertions';
-
-const { origin: AWS_HOST, pathname: AWS_PATH } = new URL(
- awsEc2Detector.AWS_INSTANCE_IDENTITY_DOCUMENT_URI
-);
-
-const mockedAwsResponse = {
- instanceId: 'my-instance-id',
- accountId: 'my-account-id',
- region: 'my-region',
-};
-
-describe('awsEc2Detector', () => {
- before(() => {
- nock.disableNetConnect();
- nock.cleanAll();
- });
-
- after(() => {
- nock.enableNetConnect();
- });
-
- describe('with successful request', () => {
- it('should return aws_ec2_instance resource', async () => {
- const scope = nock(AWS_HOST)
- .get(AWS_PATH)
- .reply(200, () => mockedAwsResponse);
- const resource: Resource = await awsEc2Detector.detect();
- scope.done();
-
- assert.ok(resource);
- assertCloudResource(resource, {
- provider: 'aws',
- accountId: 'my-account-id',
- region: 'my-region',
- });
- assertHostResource(resource, {
- id: 'my-instance-id',
- });
- });
- });
-
- describe('with failing request', () => {
- it('should return empty resource', async () => {
- const scope = nock(AWS_HOST)
- .get(AWS_PATH)
- .replyWithError({
- code: 'ENOTFOUND',
- });
- const resource: Resource = await awsEc2Detector.detect();
- scope.done();
-
- assert.ok(resource);
- assertEmptyResource(resource);
- });
- });
-});
diff --git a/packages/opentelemetry-resources/test/detectors/EnvDetector.test.ts b/packages/opentelemetry-resources/test/detectors/EnvDetector.test.ts
deleted file mode 100644
index b8dfe508eb..0000000000
--- a/packages/opentelemetry-resources/test/detectors/EnvDetector.test.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Resource } from '../../src/Resource';
-import { envDetector } from '../../src/platform/node/detectors/EnvDetector';
-import {
- assertK8sResource,
- assertEmptyResource,
-} from '../util/resource-assertions';
-import { K8S_RESOURCE } from '../../src';
-
-describe('envDetector()', () => {
- describe('with valid env', () => {
- before(() => {
- process.env.OTEL_RESOURCE_LABELS =
- 'k8s.pod.name="pod-xyz-123",k8s.cluster.name="c1",k8s.namespace.name="default"';
- });
-
- after(() => {
- delete process.env.OTEL_RESOURCE_LABELS;
- });
-
- it('should return resource information from environment variable', async () => {
- const resource: Resource = await envDetector.detect();
- assertK8sResource(resource, {
- [K8S_RESOURCE.POD_NAME]: 'pod-xyz-123',
- [K8S_RESOURCE.CLUSTER_NAME]: 'c1',
- [K8S_RESOURCE.NAMESPACE_NAME]: 'default',
- });
- });
- });
-
- describe('with empty env', () => {
- it('should return empty resource', async () => {
- const resource: Resource = await envDetector.detect();
- assertEmptyResource(resource);
- });
- });
-});
diff --git a/packages/opentelemetry-resources/test/detectors/GcpDetector.test.ts b/packages/opentelemetry-resources/test/detectors/GcpDetector.test.ts
deleted file mode 100644
index 271f8f9c89..0000000000
--- a/packages/opentelemetry-resources/test/detectors/GcpDetector.test.ts
+++ /dev/null
@@ -1,162 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- BASE_PATH,
- HEADER_NAME,
- HEADER_VALUE,
- HOST_ADDRESS,
- SECONDARY_HOST_ADDRESS,
- resetIsAvailableCache,
-} from 'gcp-metadata';
-import * as nock from 'nock';
-import { Resource } from '../../src';
-import { gcpDetector } from '../../src/platform/node/detectors';
-import {
- assertCloudResource,
- assertHostResource,
- assertK8sResource,
- assertContainerResource,
- assertEmptyResource,
-} from '../util/resource-assertions';
-
-const HEADERS = {
- [HEADER_NAME.toLowerCase()]: HEADER_VALUE,
-};
-const INSTANCE_PATH = BASE_PATH + '/instance';
-const INSTANCE_ID_PATH = BASE_PATH + '/instance/id';
-const PROJECT_ID_PATH = BASE_PATH + '/project/project-id';
-const ZONE_PATH = BASE_PATH + '/instance/zone';
-const CLUSTER_NAME_PATH = BASE_PATH + '/instance/attributes/cluster-name';
-
-describe('gcpDetector', () => {
- describe('.detect', () => {
- before(() => {
- nock.disableNetConnect();
- });
-
- after(() => {
- nock.enableNetConnect();
- delete process.env.KUBERNETES_SERVICE_HOST;
- delete process.env.NAMESPACE;
- delete process.env.CONTAINER_NAME;
- delete process.env.HOSTNAME;
- });
-
- beforeEach(() => {
- resetIsAvailableCache();
- nock.cleanAll();
- delete process.env.KUBERNETES_SERVICE_HOST;
- delete process.env.NAMESPACE;
- delete process.env.CONTAINER_NAME;
- delete process.env.HOSTNAME;
- });
-
- it('should return resource with GCP metadata', async () => {
- const scope = nock(HOST_ADDRESS)
- .get(INSTANCE_PATH)
- .reply(200, {}, HEADERS)
- .get(INSTANCE_ID_PATH)
- .reply(200, () => 4520031799277581759, HEADERS)
- .get(PROJECT_ID_PATH)
- .reply(200, () => 'my-project-id', HEADERS)
- .get(ZONE_PATH)
- .reply(200, () => 'project/zone/my-zone', HEADERS)
- .get(CLUSTER_NAME_PATH)
- .reply(404);
- const secondaryScope = nock(SECONDARY_HOST_ADDRESS)
- .get(INSTANCE_PATH)
- .reply(200, {}, HEADERS);
- const resource: Resource = await gcpDetector.detect();
- secondaryScope.done();
- scope.done();
-
- assertCloudResource(resource, {
- provider: 'gcp',
- accountId: 'my-project-id',
- zone: 'my-zone',
- });
- assertHostResource(resource, { id: '4520031799277582000' });
- });
-
- it('should populate K8s labels resource when KUBERNETES_SERVICE_HOST is set', async () => {
- process.env.KUBERNETES_SERVICE_HOST = 'my-host';
- process.env.NAMESPACE = 'my-namespace';
- process.env.HOSTNAME = 'my-hostname';
- process.env.CONTAINER_NAME = 'my-container-name';
- const scope = nock(HOST_ADDRESS)
- .get(INSTANCE_PATH)
- .reply(200, {}, HEADERS)
- .get(INSTANCE_ID_PATH)
- .reply(200, () => 4520031799277581759, HEADERS)
- .get(CLUSTER_NAME_PATH)
- .reply(200, () => 'my-cluster', HEADERS)
- .get(PROJECT_ID_PATH)
- .reply(200, () => 'my-project-id', HEADERS)
- .get(ZONE_PATH)
- .reply(200, () => 'project/zone/my-zone', HEADERS);
- const secondaryScope = nock(SECONDARY_HOST_ADDRESS)
- .get(INSTANCE_PATH)
- .reply(200, {}, HEADERS);
- const resource = await gcpDetector.detect();
- secondaryScope.done();
- scope.done();
-
- assertCloudResource(resource, {
- provider: 'gcp',
- accountId: 'my-project-id',
- zone: 'my-zone',
- });
- assertK8sResource(resource, {
- clusterName: 'my-cluster',
- podName: 'my-hostname',
- namespaceName: 'my-namespace',
- });
- assertContainerResource(resource, { name: 'my-container-name' });
- });
-
- it('should return resource and empty data for non-available metadata attributes', async () => {
- const scope = nock(HOST_ADDRESS)
- .get(INSTANCE_PATH)
- .reply(200, {}, HEADERS)
- .get(PROJECT_ID_PATH)
- .reply(200, () => 'my-project-id', HEADERS)
- .get(ZONE_PATH)
- .reply(413)
- .get(INSTANCE_ID_PATH)
- .reply(400, undefined, HEADERS)
- .get(CLUSTER_NAME_PATH)
- .reply(413);
- const secondaryScope = nock(SECONDARY_HOST_ADDRESS)
- .get(INSTANCE_PATH)
- .reply(200, {}, HEADERS);
- const resource = await gcpDetector.detect();
- secondaryScope.done();
- scope.done();
-
- assertCloudResource(resource, {
- provider: 'gcp',
- accountId: 'my-project-id',
- zone: '',
- });
- });
-
- it('returns empty resource if not detected', async () => {
- const resource = await gcpDetector.detect();
- assertEmptyResource(resource);
- });
- });
-});
diff --git a/packages/opentelemetry-resources/test/resource-assertions.test.ts b/packages/opentelemetry-resources/test/resource-assertions.test.ts
deleted file mode 100644
index d3b0e17957..0000000000
--- a/packages/opentelemetry-resources/test/resource-assertions.test.ts
+++ /dev/null
@@ -1,185 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { SDK_INFO } from '@opentelemetry/base';
-import { Resource } from '../src/Resource';
-import {
- CLOUD_RESOURCE,
- CONTAINER_RESOURCE,
- HOST_RESOURCE,
- K8S_RESOURCE,
- TELEMETRY_SDK_RESOURCE,
- SERVICE_RESOURCE,
-} from '../src/constants';
-import {
- assertCloudResource,
- assertContainerResource,
- assertHostResource,
- assertK8sResource,
- assertTelemetrySDKResource,
- assertServiceResource,
-} from './util/resource-assertions';
-
-describe('assertCloudResource', () => {
- it('requires one cloud label', () => {
- const resource = new Resource({ [CLOUD_RESOURCE.PROVIDER]: 'gcp' });
- assertCloudResource(resource, {});
- });
-
- it('validates optional labels', () => {
- const resource = new Resource({
- [CLOUD_RESOURCE.PROVIDER]: 'gcp',
- [CLOUD_RESOURCE.ACCOUNT_ID]: 'opentelemetry',
- [CLOUD_RESOURCE.REGION]: 'us-central1',
- [CLOUD_RESOURCE.ZONE]: 'us-central1-a',
- });
- assertCloudResource(resource, {
- provider: 'gcp',
- accountId: 'opentelemetry',
- region: 'us-central1',
- zone: 'us-central1-a',
- });
- });
-});
-
-describe('assertContainerResource', () => {
- it('requires one container label', () => {
- const resource = new Resource({
- [CONTAINER_RESOURCE.NAME]: 'opentelemetry-autoconf',
- });
- assertContainerResource(resource, {});
- });
-
- it('validates optional labels', () => {
- const resource = new Resource({
- [CONTAINER_RESOURCE.NAME]: 'opentelemetry-autoconf',
- [CONTAINER_RESOURCE.IMAGE_NAME]: 'gcr.io/opentelemetry/operator',
- [CONTAINER_RESOURCE.IMAGE_TAG]: '0.1',
- });
- assertContainerResource(resource, {
- name: 'opentelemetry-autoconf',
- imageName: 'gcr.io/opentelemetry/operator',
- imageTag: '0.1',
- });
- });
-});
-
-describe('assertHostResource', () => {
- it('requires one host label', () => {
- const resource = new Resource({
- [HOST_RESOURCE.ID]: 'opentelemetry-test-id',
- });
- assertHostResource(resource, {});
- });
-
- it('validates optional labels', () => {
- const resource = new Resource({
- [HOST_RESOURCE.HOSTNAME]: 'opentelemetry-test-hostname',
- [HOST_RESOURCE.ID]: 'opentelemetry-test-id',
- [HOST_RESOURCE.NAME]: 'opentelemetry-test-name',
- [HOST_RESOURCE.TYPE]: 'n1-standard-1',
- [HOST_RESOURCE.IMAGE_NAME]:
- 'infra-ami-eks-worker-node-7d4ec78312, CentOS-8-x86_64-1905',
- [HOST_RESOURCE.IMAGE_ID]: 'ami-07b06b442921831e5',
- [HOST_RESOURCE.IMAGE_VERSION]: '0.1',
- });
- assertHostResource(resource, {
- hostName: 'opentelemetry-test-hostname',
- id: 'opentelemetry-test-id',
- name: 'opentelemetry-test-name',
- hostType: 'n1-standard-1',
- imageName: 'infra-ami-eks-worker-node-7d4ec78312, CentOS-8-x86_64-1905',
- imageId: 'ami-07b06b442921831e5',
- imageVersion: '0.1',
- });
- });
-});
-
-describe('assertK8sResource', () => {
- it('requires one k8s label', () => {
- const resource = new Resource({
- [K8S_RESOURCE.CLUSTER_NAME]: 'opentelemetry-cluster',
- });
- assertK8sResource(resource, {});
- });
-
- it('validates optional labels', () => {
- const resource = new Resource({
- [K8S_RESOURCE.CLUSTER_NAME]: 'opentelemetry-cluster',
- [K8S_RESOURCE.NAMESPACE_NAME]: 'default',
- [K8S_RESOURCE.POD_NAME]: 'opentelemetry-pod-autoconf',
- [K8S_RESOURCE.DEPLOYMENT_NAME]: 'opentelemetry',
- });
- assertK8sResource(resource, {
- clusterName: 'opentelemetry-cluster',
- namespaceName: 'default',
- podName: 'opentelemetry-pod-autoconf',
- deploymentName: 'opentelemetry',
- });
- });
-});
-
-describe('assertTelemetrySDKResource', () => {
- it('uses default validations', () => {
- const resource = new Resource({
- [TELEMETRY_SDK_RESOURCE.NAME]: SDK_INFO.NAME,
- [TELEMETRY_SDK_RESOURCE.LANGUAGE]: SDK_INFO.LANGUAGE,
- [TELEMETRY_SDK_RESOURCE.VERSION]: SDK_INFO.VERSION,
- });
- assertTelemetrySDKResource(resource, {});
- });
-
- it('validates optional labels', () => {
- const resource = new Resource({
- [TELEMETRY_SDK_RESOURCE.NAME]: 'opentelemetry',
- [TELEMETRY_SDK_RESOURCE.LANGUAGE]: 'nodejs',
- [TELEMETRY_SDK_RESOURCE.VERSION]: '0.1.0',
- });
- assertTelemetrySDKResource(resource, {
- name: 'opentelemetry',
- language: 'nodejs',
- version: '0.1.0',
- });
- });
-});
-
-describe('assertServiceResource', () => {
- it('validates required labels', () => {
- const resource = new Resource({
- [SERVICE_RESOURCE.NAME]: 'shoppingcart',
- [SERVICE_RESOURCE.INSTANCE_ID]: '627cc493-f310-47de-96bd-71410b7dec09',
- });
- assertServiceResource(resource, {
- name: 'shoppingcart',
- instanceId: '627cc493-f310-47de-96bd-71410b7dec09',
- });
- });
-
- it('validates optional labels', () => {
- const resource = new Resource({
- [SERVICE_RESOURCE.NAME]: 'shoppingcart',
- [SERVICE_RESOURCE.INSTANCE_ID]: '627cc493-f310-47de-96bd-71410b7dec09',
- [SERVICE_RESOURCE.NAMESPACE]: 'shop',
- [SERVICE_RESOURCE.VERSION]: '0.1.0',
- });
- assertServiceResource(resource, {
- name: 'shoppingcart',
- instanceId: '627cc493-f310-47de-96bd-71410b7dec09',
- namespace: 'shop',
- version: '0.1.0',
- });
- });
-});
diff --git a/packages/opentelemetry-resources/test/util/resource-assertions.ts b/packages/opentelemetry-resources/test/util/resource-assertions.ts
deleted file mode 100644
index 02332191a1..0000000000
--- a/packages/opentelemetry-resources/test/util/resource-assertions.ts
+++ /dev/null
@@ -1,276 +0,0 @@
-/**
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { SDK_INFO } from '@opentelemetry/base';
-import * as assert from 'assert';
-import { Resource } from '../../src/Resource';
-import {
- CLOUD_RESOURCE,
- CONTAINER_RESOURCE,
- HOST_RESOURCE,
- K8S_RESOURCE,
- TELEMETRY_SDK_RESOURCE,
- SERVICE_RESOURCE,
-} from '../../src/constants';
-
-/**
- * Test utility method to validate a cloud resource
- *
- * @param resource the Resource to validate
- * @param validations validations for the resource labels
- */
-export const assertCloudResource = (
- resource: Resource,
- validations: {
- provider?: string;
- accountId?: string;
- region?: string;
- zone?: string;
- }
-) => {
- assertHasOneLabel(CLOUD_RESOURCE, resource);
- if (validations.provider)
- assert.strictEqual(
- resource.labels[CLOUD_RESOURCE.PROVIDER],
- validations.provider
- );
- if (validations.accountId)
- assert.strictEqual(
- resource.labels[CLOUD_RESOURCE.ACCOUNT_ID],
- validations.accountId
- );
- if (validations.region)
- assert.strictEqual(
- resource.labels[CLOUD_RESOURCE.REGION],
- validations.region
- );
- if (validations.zone)
- assert.strictEqual(resource.labels[CLOUD_RESOURCE.ZONE], validations.zone);
-};
-
-/**
- * Test utility method to validate a container resource
- *
- * @param resource the Resource to validate
- * @param validations validations for the resource labels
- */
-export const assertContainerResource = (
- resource: Resource,
- validations: {
- name?: string;
- imageName?: string;
- imageTag?: string;
- }
-) => {
- assertHasOneLabel(CONTAINER_RESOURCE, resource);
- if (validations.name)
- assert.strictEqual(
- resource.labels[CONTAINER_RESOURCE.NAME],
- validations.name
- );
- if (validations.imageName)
- assert.strictEqual(
- resource.labels[CONTAINER_RESOURCE.IMAGE_NAME],
- validations.imageName
- );
- if (validations.imageTag)
- assert.strictEqual(
- resource.labels[CONTAINER_RESOURCE.IMAGE_TAG],
- validations.imageTag
- );
-};
-
-/**
- * Test utility method to validate a host resource
- *
- * @param resource the Resource to validate
- * @param validations validations for the resource labels
- */
-export const assertHostResource = (
- resource: Resource,
- validations: {
- hostName?: string;
- id?: string;
- name?: string;
- hostType?: string;
- imageName?: string;
- imageId?: string;
- imageVersion?: string;
- }
-) => {
- assertHasOneLabel(HOST_RESOURCE, resource);
- if (validations.hostName)
- assert.strictEqual(
- resource.labels[HOST_RESOURCE.HOSTNAME],
- validations.hostName
- );
- if (validations.id)
- assert.strictEqual(resource.labels[HOST_RESOURCE.ID], validations.id);
- if (validations.name)
- assert.strictEqual(resource.labels[HOST_RESOURCE.NAME], validations.name);
- if (validations.hostType)
- assert.strictEqual(
- resource.labels[HOST_RESOURCE.TYPE],
- validations.hostType
- );
- if (validations.imageName)
- assert.strictEqual(
- resource.labels[HOST_RESOURCE.IMAGE_NAME],
- validations.imageName
- );
- if (validations.imageId)
- assert.strictEqual(
- resource.labels[HOST_RESOURCE.IMAGE_ID],
- validations.imageId
- );
- if (validations.imageVersion)
- assert.strictEqual(
- resource.labels[HOST_RESOURCE.IMAGE_VERSION],
- validations.imageVersion
- );
-};
-
-/**
- * Test utility method to validate a K8s resource
- *
- * @param resource the Resource to validate
- * @param validations validations for the resource labels
- */
-export const assertK8sResource = (
- resource: Resource,
- validations: {
- clusterName?: string;
- namespaceName?: string;
- podName?: string;
- deploymentName?: string;
- }
-) => {
- assertHasOneLabel(K8S_RESOURCE, resource);
- if (validations.clusterName)
- assert.strictEqual(
- resource.labels[K8S_RESOURCE.CLUSTER_NAME],
- validations.clusterName
- );
- if (validations.namespaceName)
- assert.strictEqual(
- resource.labels[K8S_RESOURCE.NAMESPACE_NAME],
- validations.namespaceName
- );
- if (validations.podName)
- assert.strictEqual(
- resource.labels[K8S_RESOURCE.POD_NAME],
- validations.podName
- );
- if (validations.deploymentName)
- assert.strictEqual(
- resource.labels[K8S_RESOURCE.DEPLOYMENT_NAME],
- validations.deploymentName
- );
-};
-
-/**
- * Test utility method to validate a telemetry sdk resource
- *
- * @param resource the Resource to validate
- * @param validations validations for the resource labels
- */
-export const assertTelemetrySDKResource = (
- resource: Resource,
- validations: {
- name?: string;
- language?: string;
- version?: string;
- }
-) => {
- const defaults = {
- name: SDK_INFO.NAME,
- language: SDK_INFO.LANGUAGE,
- version: SDK_INFO.VERSION,
- };
- validations = { ...defaults, ...validations };
-
- if (validations.name)
- assert.strictEqual(
- resource.labels[TELEMETRY_SDK_RESOURCE.NAME],
- validations.name
- );
- if (validations.language)
- assert.strictEqual(
- resource.labels[TELEMETRY_SDK_RESOURCE.LANGUAGE],
- validations.language
- );
- if (validations.version)
- assert.strictEqual(
- resource.labels[TELEMETRY_SDK_RESOURCE.VERSION],
- validations.version
- );
-};
-
-/**
- * Test utility method to validate a service resource
- *
- * @param resource the Resource to validate
- * @param validations validations for the resource labels
- */
-export const assertServiceResource = (
- resource: Resource,
- validations: {
- name: string;
- instanceId: string;
- namespace?: string;
- version?: string;
- }
-) => {
- assert.strictEqual(resource.labels[SERVICE_RESOURCE.NAME], validations.name);
- assert.strictEqual(
- resource.labels[SERVICE_RESOURCE.INSTANCE_ID],
- validations.instanceId
- );
- if (validations.namespace)
- assert.strictEqual(
- resource.labels[SERVICE_RESOURCE.NAMESPACE],
- validations.namespace
- );
- if (validations.version)
- assert.strictEqual(
- resource.labels[SERVICE_RESOURCE.VERSION],
- validations.version
- );
-};
-
-/**
- * Test utility method to validate an empty resource
- *
- * @param resource the Resource to validate
- */
-export const assertEmptyResource = (resource: Resource) => {
- assert.strictEqual(Object.keys(resource.labels).length, 0);
-};
-
-const assertHasOneLabel = (
- constants: { [key: string]: string },
- resource: Resource
-): void => {
- const hasOne = Object.values(constants).reduce(
- (found, key) => found || resource.labels.hasOwnProperty(key),
- false
- );
- assert.ok(
- hasOne,
- 'Resource must have one of the following labels: ' +
- Object.values(constants).join(', ')
- );
-};
diff --git a/packages/opentelemetry-resources/tsconfig.json b/packages/opentelemetry-resources/tsconfig.json
deleted file mode 100644
index e4b3b29e6a..0000000000
--- a/packages/opentelemetry-resources/tsconfig.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "include": ["src/**/*.ts", "test/**/*.ts"]
-}
diff --git a/packages/opentelemetry-resources/tslint.json b/packages/opentelemetry-resources/tslint.json
deleted file mode 100644
index 69d07efd8b..0000000000
--- a/packages/opentelemetry-resources/tslint.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": [
- "../../tslint.base.js",
- "./node_modules/tslint-consistent-codestyle"
- ]
-}
diff --git a/packages/opentelemetry-shim-opentracing/.npmignore b/packages/opentelemetry-shim-opentracing/.npmignore
deleted file mode 100644
index 9505ba9450..0000000000
--- a/packages/opentelemetry-shim-opentracing/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/bin
-/coverage
-/doc
-/test
diff --git a/packages/opentelemetry-shim-opentracing/LICENSE b/packages/opentelemetry-shim-opentracing/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-shim-opentracing/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-shim-opentracing/README.md b/packages/opentelemetry-shim-opentracing/README.md
deleted file mode 100644
index c5a3bec21c..0000000000
--- a/packages/opentelemetry-shim-opentracing/README.md
+++ /dev/null
@@ -1,53 +0,0 @@
-# OpenTracing shim
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![devDependencies][devDependencies-image]][devDependencies-url]
-[![Apache License][license-image]][license-image]
-
-OpenTracing shim allows existing OpenTracing instrumentation to report to OpenTelemetry
-
-Note: Baggage is currently not propagated, see [issues/329](https://github.com/open-telemetry/opentelemetry-js/issues/329).
-
-## Installation
-
-```bash
-npm install --save @opentelemetry/shim-opentracing
-```
-
-## Usage
-
-Use the TracerShim wherever you initialize your OpenTracing tracers.
-
-```javascript
-const opentracing = require('opentracing');
-
-// Old tracer initialization.
-const tracer = myOpenTracingTracer(...);
-opentracing.initGlobalTracer(tracer);
-
-// New tracer initialization.
-import { TracerShim } from '@opentelemetry/shim-opentracing';
-
-const tracer = myOpenTelemetryTracer(...)
-opentracing.initGlobalTracer(new TracerShim(tracer));
-
-```
-
-See [examples/opentracing-shim](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/opentracing-shim) for a short example.
-
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-tracing
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-tracing
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-tracing
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-tracing&type=dev
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/shim-opentracing
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fshim-opentracing.svg
diff --git a/packages/opentelemetry-shim-opentracing/package.json b/packages/opentelemetry-shim-opentracing/package.json
deleted file mode 100644
index 05254b2562..0000000000
--- a/packages/opentelemetry-shim-opentracing/package.json
+++ /dev/null
@@ -1,61 +0,0 @@
-{
- "name": "@opentelemetry/shim-opentracing",
- "version": "0.6.1",
- "description": "OpenTracing to OpenTelemetry shim",
- "main": "build/src/index.js",
- "types": "build/src/index.d.ts",
- "repository": "open-telemetry/opentelemetry-js",
- "scripts": {
- "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": "gts check",
- "lint:fix": "gts fix",
- "precompile": "tsc --version",
- "version:update": "node ../../scripts/version-update.js",
- "compile": "npm run version:update && tsc -p .",
- "prepare": "npm run compile"
- },
- "keywords": [
- "opentelemetry",
- "nodejs",
- "tracing",
- "profiling"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@opentelemetry/tracing": "^0.6.1",
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.9",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "mocha": "^6.2.0",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "3.7.2"
- },
- "dependencies": {
- "@opentelemetry/api": "^0.6.1",
- "@opentelemetry/core": "^0.6.1",
- "opentracing": "^0.14.4"
- }
-}
diff --git a/packages/opentelemetry-shim-opentracing/src/index.ts b/packages/opentelemetry-shim-opentracing/src/index.ts
deleted file mode 100644
index 7f4e715ee0..0000000000
--- a/packages/opentelemetry-shim-opentracing/src/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { TracerShim } from './shim';
diff --git a/packages/opentelemetry-shim-opentracing/src/shim.ts b/packages/opentelemetry-shim-opentracing/src/shim.ts
deleted file mode 100644
index ecc4adf995..0000000000
--- a/packages/opentelemetry-shim-opentracing/src/shim.ts
+++ /dev/null
@@ -1,312 +0,0 @@
-/**
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as api from '@opentelemetry/api';
-import {
- getExtractedSpanContext,
- NoopLogger,
- setExtractedSpanContext,
- setActiveSpan,
-} from '@opentelemetry/core';
-import * as opentracing from 'opentracing';
-import { defaultSetter } from '@opentelemetry/api';
-
-function translateReferences(references: opentracing.Reference[]): api.Link[] {
- const links: api.Link[] = [];
- for (const reference of references) {
- const context = reference.referencedContext();
- if (context instanceof SpanContextShim) {
- links.push({
- context: (context as SpanContextShim).getSpanContext(),
- attributes: { 'span.kind': reference.type },
- });
- }
- }
- return links;
-}
-
-function translateSpanOptions(
- options: opentracing.SpanOptions
-): api.SpanOptions {
- const opts: api.SpanOptions = {
- startTime: options.startTime,
- };
-
- if (options.references) {
- opts.links = translateReferences(options.references);
- }
-
- return opts;
-}
-
-function getContextWithParent(options: opentracing.SpanOptions) {
- if (options.childOf) {
- if (options.childOf instanceof SpanShim) {
- return setActiveSpan(api.context.active(), options.childOf.getSpan());
- } else if (options.childOf instanceof SpanContextShim) {
- return setExtractedSpanContext(
- api.context.active(),
- options.childOf.getSpanContext()
- );
- }
- }
- return api.context.active();
-}
-
-/**
- * SpanContextShim wraps a {@link types.SpanContext} and implements the
- * OpenTracing span context API.
- */
-export class SpanContextShim extends opentracing.SpanContext {
- private readonly _spanContext: api.SpanContext;
-
- constructor(spanContext: api.SpanContext) {
- super();
- this._spanContext = spanContext;
- }
-
- /**
- * Returns the underlying {@link types.SpanContext}
- */
- getSpanContext(): api.SpanContext {
- return this._spanContext;
- }
-
- /**
- * Returns the trace ID as a string.
- */
- toTraceId(): string {
- return this._spanContext.traceId;
- }
-
- /**
- * Returns the span ID as a string.
- */
- toSpanId(): string {
- return this._spanContext.spanId;
- }
-}
-
-/**
- * TracerShim wraps a {@link types.Tracer} and implements the
- * OpenTracing tracer API.
- */
-export class TracerShim extends opentracing.Tracer {
- private readonly _tracer: api.Tracer;
- private readonly _logger: api.Logger;
-
- constructor(tracer: api.Tracer, logger?: api.Logger) {
- super();
-
- this._tracer = tracer;
- this._logger = logger || new NoopLogger();
- }
-
- startSpan(
- name: string,
- options: opentracing.SpanOptions = {}
- ): opentracing.Span {
- const span = this._tracer.startSpan(
- name,
- translateSpanOptions(options),
- getContextWithParent(options)
- );
-
- if (options.tags) {
- span.setAttributes(options.tags);
- }
-
- return new SpanShim(this, span);
- }
-
- _inject(
- spanContext: opentracing.SpanContext,
- format: string,
- carrier: unknown
- ): void {
- const opentelemSpanContext: api.SpanContext = (spanContext as SpanContextShim).getSpanContext();
- if (!carrier || typeof carrier !== 'object') return;
- switch (format) {
- // tslint:disable-next-line:no-switch-case-fall-through
- case opentracing.FORMAT_HTTP_HEADERS:
- case opentracing.FORMAT_TEXT_MAP:
- api.propagation.inject(
- carrier,
- defaultSetter,
- setExtractedSpanContext(
- api.Context.ROOT_CONTEXT,
- opentelemSpanContext
- )
- );
- return;
- case opentracing.FORMAT_BINARY:
- this._logger.warn(
- 'OpentracingShim.inject() does not support FORMAT_BINARY'
- );
- // @todo: Implement binary format
- return;
- default:
- }
- }
-
- _extract(format: string, carrier: unknown): opentracing.SpanContext | null {
- switch (format) {
- // tslint:disable-next-line:no-switch-case-fall-through
- case opentracing.FORMAT_HTTP_HEADERS:
- case opentracing.FORMAT_TEXT_MAP:
- const context = getExtractedSpanContext(
- api.propagation.extract(carrier)
- );
- if (!context) {
- return null;
- }
- return new SpanContextShim(context);
- case opentracing.FORMAT_BINARY:
- // @todo: Implement binary format
- this._logger.warn(
- 'OpentracingShim.extract() does not support FORMAT_BINARY'
- );
- return null;
- default:
- }
- return null;
- }
-}
-
-/**
- * SpanShim wraps an {@link types.Span} and implements the OpenTracing Span API
- * around it.
- * @todo: Out of band baggage propagation is not currently supported.
- */
-export class SpanShim extends opentracing.Span {
- // _span is the original OpenTelemetry span that we are wrapping with
- // an opentracing interface.
- private readonly _span: api.Span;
- private readonly _contextShim: SpanContextShim;
- private readonly _tracerShim: TracerShim;
-
- constructor(tracerShim: TracerShim, span: api.Span) {
- super();
- this._span = span;
- this._contextShim = new SpanContextShim(span.context());
- this._tracerShim = tracerShim;
- }
-
- /**
- * Returns a reference to the Span's context.
- *
- * @returns a {@link SpanContextShim} containing the underlying context.
- */
- context(): opentracing.SpanContext {
- return this._contextShim;
- }
-
- /**
- * Returns the {@link opentracing.Tracer} that created the span.
- */
- tracer(): opentracing.Tracer {
- return this._tracerShim;
- }
-
- /**
- * Updates the underlying span's name.
- *
- * @param name the Span name.
- */
- setOperationName(name: string): this {
- this._span.updateName(name);
- return this;
- }
-
- /**
- * Finishes the span. Once the span is finished, no new updates can be applied
- * to the span.
- *
- * @param finishTime An optional timestamp to explicitly set the span's end time.
- */
- finish(finishTime?: number): void {
- this._span.end(finishTime);
- }
-
- /**
- * Logs an event with an optional payload.
- * @param eventName name of the event.
- * @param payload an arbitrary object to be attached to the event.
- */
- logEvent(eventName: string, payload?: unknown): void {
- let attrs: api.Attributes = {};
- if (payload) {
- attrs = { payload };
- }
- this._span.addEvent(eventName, attrs);
- }
-
- /**
- * Logs a set of key value pairs. Since OpenTelemetry only supports events,
- * the KV pairs are used as attributes on an event named "log".
- */
- log(keyValuePairs: { [key: string]: unknown }, timestamp?: number): this {
- // @todo: Handle timestamp
- this._span.addEvent('log', keyValuePairs);
- return this;
- }
-
- /**
- * Adds a set of tags to the span.
- * @param keyValueMap set of KV pairs representing tags
- */
- addTags(keyValueMap: { [key: string]: unknown }): this {
- this._span.setAttributes(keyValueMap);
- return this;
- }
-
- /**
- * Sets a tag on the span, updating the value if the key is already present
- * on the span.
- * @param key key for the tag
- * @param value value for the tag
- */
- setTag(key: string, value: unknown): this {
- if (
- key === opentracing.Tags.ERROR &&
- (value === true || value === 'true')
- ) {
- this._span.setStatus({ code: api.CanonicalCode.UNKNOWN });
- return this;
- }
-
- this._span.setAttribute(key, value);
- return this;
- }
-
- getBaggageItem(key: string): string | undefined {
- // TODO: should this go into the context?
- return undefined;
- }
-
- setBaggageItem(key: string, value: string): this {
- // TODO: should this go into the context?
- return this;
- }
-
- /*
- * Returns the underlying {@link types.Span} that the shim
- * is wrapping.
- */
- getSpan(): api.Span {
- return this._span;
- }
-}
diff --git a/packages/opentelemetry-shim-opentracing/src/version.ts b/packages/opentelemetry-shim-opentracing/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-shim-opentracing/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-shim-opentracing/test/Shim.test.ts b/packages/opentelemetry-shim-opentracing/test/Shim.test.ts
deleted file mode 100644
index f7358c9421..0000000000
--- a/packages/opentelemetry-shim-opentracing/test/Shim.test.ts
+++ /dev/null
@@ -1,196 +0,0 @@
-/**
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import * as opentracing from 'opentracing';
-import { BasicTracerProvider, Span } from '@opentelemetry/tracing';
-import { TracerShim, SpanShim, SpanContextShim } from '../src/shim';
-import {
- INVALID_SPAN_CONTEXT,
- timeInputToHrTime,
- HttpTraceContext,
-} from '@opentelemetry/core';
-import { propagation } from '@opentelemetry/api';
-import { performance } from 'perf_hooks';
-
-describe('OpenTracing Shim', () => {
- const provider = new BasicTracerProvider();
- const shimTracer: opentracing.Tracer = new TracerShim(
- provider.getTracer('default')
- );
- opentracing.initGlobalTracer(shimTracer);
- propagation.setGlobalPropagator(new HttpTraceContext());
-
- describe('TracerShim', () => {
- let span: opentracing.Span;
- let context: opentracing.SpanContext;
-
- beforeEach(() => {
- span = shimTracer.startSpan('my-span');
- context = span.context();
- });
-
- describe('propagation', () => {
- it('injects/extracts a span object', () => {
- const carrier: { [key: string]: unknown } = {};
- shimTracer.inject(span, opentracing.FORMAT_HTTP_HEADERS, carrier);
- const extractedContext = shimTracer.extract(
- opentracing.FORMAT_HTTP_HEADERS,
- carrier
- );
- assert.ok(extractedContext !== null);
- assert.strictEqual(context.toTraceId(), extractedContext!.toTraceId());
- assert.strictEqual(context.toSpanId(), extractedContext!.toSpanId());
- });
-
- it('injects/extracts HTTP carriers', () => {
- const carrier: { [key: string]: unknown } = {};
- shimTracer.inject(context, opentracing.FORMAT_HTTP_HEADERS, carrier);
- const extractedContext = shimTracer.extract(
- opentracing.FORMAT_HTTP_HEADERS,
- carrier
- );
- assert.ok(extractedContext !== null);
- assert.strictEqual(context.toTraceId(), extractedContext!.toTraceId());
- assert.strictEqual(context.toSpanId(), extractedContext!.toSpanId());
- });
-
- it('injects/extracts TextMap carriers', () => {
- const carrier: { [key: string]: unknown } = {};
- shimTracer.inject(context, opentracing.FORMAT_TEXT_MAP, carrier);
- const extractedContext = shimTracer.extract(
- opentracing.FORMAT_TEXT_MAP,
- carrier
- );
- assert.ok(extractedContext !== null);
- assert.strictEqual(context.toTraceId(), extractedContext!.toTraceId());
- assert.strictEqual(context.toSpanId(), extractedContext!.toSpanId());
- });
-
- it('injects/extracts Binary carriers', () => {
- /* const carrier = new Array(); */
- /* shimTracer.inject(context, opentracing.FORMAT_BINARY, carrier); */
- /* const extractedContext = shimTracer.extract(opentracing.FORMAT_BINARY, { buffer: new Uint8Array(carrier)}); */
- /* assert.strictEqual(context.toSpanId(), extractedContext.toSpanId()) */
- });
- });
-
- it('creates parent/child relationship using a span object', () => {
- const childSpan = shimTracer.startSpan('other-span', {
- childOf: span,
- }) as SpanShim;
- assert.strictEqual(
- (childSpan.getSpan() as Span).parentSpanId,
- context.toSpanId()
- );
- assert.strictEqual(
- childSpan.context().toTraceId(),
- span.context().toTraceId()
- );
- });
-
- it('creates parent/child relationship using a context object', () => {
- const childSpan = shimTracer.startSpan('other-span', {
- childOf: context,
- }) as SpanShim;
- assert.strictEqual(
- (childSpan.getSpan() as Span).parentSpanId,
- context.toSpanId()
- );
- assert.strictEqual(
- childSpan.context().toTraceId(),
- span.context().toTraceId()
- );
- });
-
- it('translates span options correctly', () => {
- const now = performance.now();
- const opentracingOptions: opentracing.SpanOptions = {
- startTime: now,
- tags: { key: 'value', count: 1 },
- references: [opentracing.followsFrom(context)],
- };
- span = shimTracer.startSpan('my-span', opentracingOptions);
-
- const otSpan = (span as SpanShim).getSpan() as Span;
-
- assert.strictEqual(otSpan.links.length, 1);
- assert.deepStrictEqual(otSpan.startTime, timeInputToHrTime(now));
- assert.deepStrictEqual(otSpan.attributes, opentracingOptions.tags);
- });
- });
-
- describe('SpanContextShim', () => {
- it('returns the correct context', () => {
- const shim = new SpanContextShim(INVALID_SPAN_CONTEXT);
- assert.strictEqual(shim.getSpanContext(), INVALID_SPAN_CONTEXT);
- assert.strictEqual(shim.toTraceId(), INVALID_SPAN_CONTEXT.traceId);
- assert.strictEqual(shim.toSpanId(), INVALID_SPAN_CONTEXT.spanId);
- });
- });
-
- describe('span', () => {
- let span: SpanShim;
- let otSpan: Span;
-
- beforeEach(() => {
- span = shimTracer.startSpan('my-span', {
- startTime: performance.now(),
- }) as SpanShim;
- otSpan = (span as SpanShim).getSpan() as Span;
- });
-
- it('sets tags', () => {
- span.setTag('hello', 'world');
- assert.strictEqual(otSpan.attributes.hello, 'world');
-
- span.addTags({ hello: 'stars', from: 'earth' });
- assert.strictEqual(otSpan.attributes.hello, 'stars');
- assert.strictEqual(otSpan.attributes.from, 'earth');
- });
-
- it('logs KV pairs', () => {
- const kvLogs = { key: 'value', error: 'not a valid span' };
- span.log(kvLogs);
- assert.strictEqual(otSpan.events[0].name, 'log');
- assert.strictEqual(otSpan.events[0].attributes, kvLogs);
- });
-
- it('logs an event with a payload', () => {
- const payload = { user: 'payload', request: 1 };
- span.logEvent('some log', payload);
- assert.strictEqual(otSpan.events[0].name, 'some log');
- assert.deepStrictEqual(otSpan.events[0].attributes, { payload });
- });
-
- it('updates the name', () => {
- assert.strictEqual(otSpan.name, 'my-span');
- span.setOperationName('your-span');
- assert.strictEqual(otSpan.name, 'your-span');
- });
-
- it('sets explicit end timestamp', () => {
- const now = performance.now();
- span.finish(now);
- assert.deepStrictEqual(otSpan.endTime, timeInputToHrTime(now));
- });
-
- it('can set and retrieve baggage', () => {
- span.setBaggageItem('baggage', 'item');
- // TODO: baggage
- });
- });
-});
diff --git a/packages/opentelemetry-shim-opentracing/tsconfig.json b/packages/opentelemetry-shim-opentracing/tsconfig.json
deleted file mode 100644
index a2042cd68b..0000000000
--- a/packages/opentelemetry-shim-opentracing/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ]
-}
diff --git a/packages/opentelemetry-shim-opentracing/tslint.json b/packages/opentelemetry-shim-opentracing/tslint.json
deleted file mode 100644
index 0b1a202be7..0000000000
--- a/packages/opentelemetry-shim-opentracing/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-tracing/.npmignore b/packages/opentelemetry-tracing/.npmignore
deleted file mode 100644
index 9505ba9450..0000000000
--- a/packages/opentelemetry-tracing/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/bin
-/coverage
-/doc
-/test
diff --git a/packages/opentelemetry-tracing/LICENSE b/packages/opentelemetry-tracing/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-tracing/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-tracing/README.md b/packages/opentelemetry-tracing/README.md
deleted file mode 100644
index 272f97c8e9..0000000000
--- a/packages/opentelemetry-tracing/README.md
+++ /dev/null
@@ -1,66 +0,0 @@
-# OpenTelemetry Tracing SDK
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![devDependencies][devDependencies-image]][devDependencies-url]
-[![Apache License][license-image]][license-image]
-
-The `tracing` module contains the foundation for all tracing SDKs of [opentelemetry-js](https://github.com/open-telemetry/opentelemetry-js).
-
-Used standalone, this module provides methods for manual instrumentation of code, offering full control over span creation for client-side JavaScript (browser) and Node.js.
-
-It does **not** provide automated instrumentation of known libraries, context propagation for asynchronous invocations or distributed-context out-of-the-box.
-
-For automated instrumentation for Node.js, please see
-[@opentelemetry/node](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-node).
-
-## Installation
-
-```bash
-npm install --save @opentelemetry/api
-npm install --save @opentelemetry/tracing
-```
-
-## Usage
-
-```js
-const opentelemetry = require('@opentelemetry/api');
-const { BasicTracerProvider } = require('@opentelemetry/tracing');
-
-// To start a trace, you first need to initialize the Tracer provider.
-// NOTE: The default OpenTelemetry tracer provider does not record any tracing information.
-// Registering a working tracer provider allows the API methods to record traces.
-new BasicTracerProvider().register();
-
-// To create a span in a trace, we used the global singleton tracer to start a new span.
-const span = opentelemetry.trace.getTracer('default').startSpan('foo');
-
-// Set a span attribute
-span.setAttribute('key', 'value');
-
-// We must end the spans so they become available for exporting.
-span.end();
-```
-
-## Example
-See [examples/basic-tracer-node](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/basic-tracer-node) for an end-to-end example, including exporting created spans.
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more about OpenTelemetry JavaScript:
-- For help or feedback on this project, join us on [gitter][gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-tracing
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-tracing
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-tracing
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-tracing&type=dev
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/tracing
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Ftracing.svg
diff --git a/packages/opentelemetry-tracing/karma.conf.js b/packages/opentelemetry-tracing/karma.conf.js
deleted file mode 100644
index 7183aab033..0000000000
--- a/packages/opentelemetry-tracing/karma.conf.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-const karmaWebpackConfig = require('../../karma.webpack');
-const karmaBaseConfig = require('../../karma.base');
-
-module.exports = (config) => {
- config.set(Object.assign({}, karmaBaseConfig, {
- webpack: karmaWebpackConfig
- }))
-};
diff --git a/packages/opentelemetry-tracing/package.json b/packages/opentelemetry-tracing/package.json
deleted file mode 100644
index 5425c35f22..0000000000
--- a/packages/opentelemetry-tracing/package.json
+++ /dev/null
@@ -1,82 +0,0 @@
-{
- "name": "@opentelemetry/tracing",
- "version": "0.6.1",
- "description": "OpenTelemetry Tracing",
- "main": "build/src/index.js",
- "browser": {
- "./src/platform/index.ts": "./src/platform/browser/index.ts",
- "./build/src/platform/index.js": "./build/src/platform/browser/index.js"
- },
- "types": "build/src/index.d.ts",
- "repository": "open-telemetry/opentelemetry-js",
- "scripts": {
- "lint": "gts check",
- "lint:fix": "gts 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",
- "tdd": "npm run test -- --watch-extensions ts --watch",
- "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/index-webpack.ts'",
- "test:browser": "nyc karma start --single-run",
- "watch": "tsc -w"
- },
- "keywords": [
- "opentelemetry",
- "nodejs",
- "tracing",
- "profiling",
- "metrics",
- "stats"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.8",
- "@types/sinon": "^7.0.13",
- "@types/webpack-env": "1.13.9",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "istanbul-instrumenter-loader": "^3.0.1",
- "karma": "^4.4.1",
- "karma-chrome-launcher": "^3.1.0",
- "karma-coverage-istanbul-reporter": "^2.1.0",
- "karma-mocha": "^1.3.0",
- "karma-spec-reporter": "^0.0.32",
- "karma-webpack": "^4.0.2",
- "mocha": "^6.1.0",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "sinon": "^7.5.0",
- "ts-loader": "^6.0.4",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "3.7.2",
- "webpack": "^4.35.2"
- },
- "dependencies": {
- "@opentelemetry/api": "^0.6.1",
- "@opentelemetry/base": "^0.6.1",
- "@opentelemetry/context-base": "^0.6.1",
- "@opentelemetry/core": "^0.6.1",
- "@opentelemetry/resources": "^0.6.1"
- }
-}
diff --git a/packages/opentelemetry-tracing/src/BasicTracerProvider.ts b/packages/opentelemetry-tracing/src/BasicTracerProvider.ts
deleted file mode 100644
index fe44199e61..0000000000
--- a/packages/opentelemetry-tracing/src/BasicTracerProvider.ts
+++ /dev/null
@@ -1,87 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as api from '@opentelemetry/api';
-import { ConsoleLogger, HttpTraceContext } from '@opentelemetry/core';
-import { SpanProcessor, Tracer } from '.';
-import { DEFAULT_CONFIG } from './config';
-import { MultiSpanProcessor } from './MultiSpanProcessor';
-import { NoopSpanProcessor } from './NoopSpanProcessor';
-import { SDKRegistrationConfig, TracerConfig } from './types';
-import { Resource } from '@opentelemetry/resources';
-
-/**
- * This class represents a basic tracer provider which platform libraries can extend
- */
-export class BasicTracerProvider implements api.TracerProvider {
- private readonly _registeredSpanProcessors: SpanProcessor[] = [];
- private readonly _tracers: Map = new Map();
-
- activeSpanProcessor = new NoopSpanProcessor();
- readonly logger: api.Logger;
- readonly resource: Resource;
-
- constructor(private _config: TracerConfig = DEFAULT_CONFIG) {
- this.logger = _config.logger || new ConsoleLogger(_config.logLevel);
- this.resource = _config.resource || Resource.createTelemetrySDKResource();
- }
-
- getTracer(name: string, version = '*', config?: TracerConfig): Tracer {
- const key = `${name}@${version}`;
- if (!this._tracers.has(key)) {
- this._tracers.set(key, new Tracer(config || this._config, this));
- }
-
- return this._tracers.get(key)!;
- }
-
- /**
- * Adds a new {@link SpanProcessor} to this tracer.
- * @param spanProcessor the new SpanProcessor to be added.
- */
- addSpanProcessor(spanProcessor: SpanProcessor): void {
- this._registeredSpanProcessors.push(spanProcessor);
- this.activeSpanProcessor = new MultiSpanProcessor(
- this._registeredSpanProcessors
- );
- }
-
- getActiveSpanProcessor(): SpanProcessor {
- return this.activeSpanProcessor;
- }
-
- /**
- * Register this TracerProvider for use with the OpenTelemetry API.
- * Undefined values may be replaced with defaults, and
- * null values will be skipped.
- *
- * @param config Configuration object for SDK registration
- */
- register(config: SDKRegistrationConfig = {}) {
- api.trace.setGlobalTracerProvider(this);
- if (config.propagator === undefined) {
- config.propagator = new HttpTraceContext();
- }
-
- if (config.contextManager) {
- api.context.setGlobalContextManager(config.contextManager);
- }
-
- if (config.propagator) {
- api.propagation.setGlobalPropagator(config.propagator);
- }
- }
-}
diff --git a/packages/opentelemetry-tracing/src/MultiSpanProcessor.ts b/packages/opentelemetry-tracing/src/MultiSpanProcessor.ts
deleted file mode 100644
index b4d4c9d3fa..0000000000
--- a/packages/opentelemetry-tracing/src/MultiSpanProcessor.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Span } from '@opentelemetry/api';
-import { SpanProcessor } from './SpanProcessor';
-
-/**
- * Implementation of the {@link SpanProcessor} that simply forwards all
- * received events to a list of {@link SpanProcessor}s.
- */
-export class MultiSpanProcessor implements SpanProcessor {
- constructor(private readonly _spanProcessors: SpanProcessor[]) {}
-
- forceFlush(): void {
- // do nothing as all spans are being exported without waiting
- }
-
- onStart(span: Span): void {
- for (const spanProcessor of this._spanProcessors) {
- spanProcessor.onStart(span);
- }
- }
-
- onEnd(span: Span): void {
- for (const spanProcessor of this._spanProcessors) {
- spanProcessor.onEnd(span);
- }
- }
-
- shutdown(): void {
- for (const spanProcessor of this._spanProcessors) {
- spanProcessor.shutdown();
- }
- }
-}
diff --git a/packages/opentelemetry-tracing/src/NoopSpanProcessor.ts b/packages/opentelemetry-tracing/src/NoopSpanProcessor.ts
deleted file mode 100644
index 2898e77cfa..0000000000
--- a/packages/opentelemetry-tracing/src/NoopSpanProcessor.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Span } from '@opentelemetry/api';
-import { SpanProcessor } from './SpanProcessor';
-
-/** No-op implementation of SpanProcessor */
-export class NoopSpanProcessor implements SpanProcessor {
- onStart(span: Span): void {}
- onEnd(span: Span): void {}
- shutdown(): void {}
- forceFlush(): void {}
-}
diff --git a/packages/opentelemetry-tracing/src/Span.ts b/packages/opentelemetry-tracing/src/Span.ts
deleted file mode 100644
index 4028564a4d..0000000000
--- a/packages/opentelemetry-tracing/src/Span.ts
+++ /dev/null
@@ -1,200 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as types from '@opentelemetry/api';
-import {
- hrTime,
- hrTimeDuration,
- isTimeInput,
- timeInputToHrTime,
-} from '@opentelemetry/core';
-import { Resource } from '@opentelemetry/resources';
-import { ReadableSpan } from './export/ReadableSpan';
-import { Tracer } from './Tracer';
-import { SpanProcessor } from './SpanProcessor';
-import { TraceParams } from './types';
-
-/**
- * This class represents a span.
- */
-export class Span implements types.Span, ReadableSpan {
- // Below properties are included to implement ReadableSpan for export
- // purposes but are not intended to be written-to directly.
- readonly spanContext: types.SpanContext;
- readonly kind: types.SpanKind;
- readonly parentSpanId?: string;
- readonly attributes: types.Attributes = {};
- readonly links: types.Link[] = [];
- readonly events: types.TimedEvent[] = [];
- readonly startTime: types.HrTime;
- readonly resource: Resource;
- name: string;
- status: types.Status = {
- code: types.CanonicalCode.OK,
- };
- endTime: types.HrTime = [0, 0];
- private _ended = false;
- private _duration: types.HrTime = [-1, -1];
- private readonly _logger: types.Logger;
- private readonly _spanProcessor: SpanProcessor;
- private readonly _traceParams: TraceParams;
-
- /** Constructs a new Span instance. */
- constructor(
- parentTracer: Tracer,
- spanName: string,
- spanContext: types.SpanContext,
- kind: types.SpanKind,
- parentSpanId?: string,
- links: types.Link[] = [],
- startTime: types.TimeInput = hrTime()
- ) {
- this.name = spanName;
- this.spanContext = spanContext;
- this.parentSpanId = parentSpanId;
- this.kind = kind;
- this.links = links;
- this.startTime = timeInputToHrTime(startTime);
- this.resource = parentTracer.resource;
- this._logger = parentTracer.logger;
- this._traceParams = parentTracer.getActiveTraceParams();
- this._spanProcessor = parentTracer.getActiveSpanProcessor();
- this._spanProcessor.onStart(this);
- }
-
- context(): types.SpanContext {
- return this.spanContext;
- }
-
- setAttribute(key: string, value: unknown): this {
- if (this._isSpanEnded()) return this;
-
- if (
- Object.keys(this.attributes).length >=
- this._traceParams.numberOfAttributesPerSpan!
- ) {
- const attributeKeyToDelete = Object.keys(this.attributes).shift();
- if (attributeKeyToDelete) {
- this._logger.warn(
- `Dropping extra attributes : ${attributeKeyToDelete}`
- );
- delete this.attributes[attributeKeyToDelete];
- }
- }
- this.attributes[key] = value;
- return this;
- }
-
- setAttributes(attributes: types.Attributes): this {
- Object.keys(attributes).forEach(key => {
- this.setAttribute(key, attributes[key]);
- });
- return this;
- }
-
- /**
- *
- * @param name Span Name
- * @param [attributesOrStartTime] Span attributes or start time
- * if type is {@type TimeInput} and 3rd param is undefined
- * @param [startTime] Specified start time for the event
- */
- addEvent(
- name: string,
- attributesOrStartTime?: types.Attributes | types.TimeInput,
- startTime?: types.TimeInput
- ): this {
- if (this._isSpanEnded()) return this;
- if (this.events.length >= this._traceParams.numberOfEventsPerSpan!) {
- this._logger.warn('Dropping extra events.');
- this.events.shift();
- }
- if (isTimeInput(attributesOrStartTime)) {
- if (typeof startTime === 'undefined') {
- startTime = attributesOrStartTime as types.TimeInput;
- }
- attributesOrStartTime = undefined;
- }
- if (typeof startTime === 'undefined') {
- startTime = hrTime();
- }
- this.events.push({
- name,
- attributes: attributesOrStartTime as types.Attributes,
- time: timeInputToHrTime(startTime),
- });
- return this;
- }
-
- setStatus(status: types.Status): this {
- if (this._isSpanEnded()) return this;
- this.status = status;
- return this;
- }
-
- updateName(name: string): this {
- if (this._isSpanEnded()) return this;
- this.name = name;
- return this;
- }
-
- end(endTime: types.TimeInput = hrTime()): void {
- if (this._isSpanEnded()) {
- this._logger.error('You can only call end() on a span once.');
- return;
- }
- this._ended = true;
- this.endTime = timeInputToHrTime(endTime);
-
- this._duration = hrTimeDuration(this.startTime, this.endTime);
- if (this._duration[0] < 0) {
- this._logger.warn(
- 'Inconsistent start and end time, startTime > endTime',
- this.startTime,
- this.endTime
- );
- }
-
- this._spanProcessor.onEnd(this);
- }
-
- isRecording(): boolean {
- return true;
- }
-
- toReadableSpan(): ReadableSpan {
- return this;
- }
-
- get duration(): types.HrTime {
- return this._duration;
- }
-
- get ended(): boolean {
- return this._ended;
- }
-
- private _isSpanEnded(): boolean {
- if (this._ended) {
- this._logger.warn(
- 'Can not execute the operation on ended Span {traceId: %s, spanId: %s}',
- this.spanContext.traceId,
- this.spanContext.spanId
- );
- }
- return this._ended;
- }
-}
diff --git a/packages/opentelemetry-tracing/src/SpanProcessor.ts b/packages/opentelemetry-tracing/src/SpanProcessor.ts
deleted file mode 100644
index 0320455ae9..0000000000
--- a/packages/opentelemetry-tracing/src/SpanProcessor.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Span } from '@opentelemetry/api';
-
-/**
- * SpanProcessor is the interface Tracer SDK uses to allow synchronous hooks
- * for when a {@link Span} is started or when a {@link Span} is ended.
- */
-export interface SpanProcessor {
- /**
- * Forces to export all finished spans
- */
- forceFlush(): void;
-
- /**
- * Called when a {@link Span} is started, if the `span.isRecording()`
- * returns true.
- * @param span the Span that just started.
- */
- onStart(span: Span): void;
-
- /**
- * Called when a {@link Span} is ended, if the `span.isRecording()`
- * returns true.
- * @param span the Span that just ended.
- */
- onEnd(span: Span): void;
-
- /**
- * Shuts down the processor. Called when SDK is shut down. This is an
- * opportunity for processor to do any cleanup required.
- */
- shutdown(): void;
-}
diff --git a/packages/opentelemetry-tracing/src/Tracer.ts b/packages/opentelemetry-tracing/src/Tracer.ts
deleted file mode 100644
index 24408d80e4..0000000000
--- a/packages/opentelemetry-tracing/src/Tracer.ts
+++ /dev/null
@@ -1,171 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as api from '@opentelemetry/api';
-import {
- ConsoleLogger,
- getActiveSpan,
- getParentSpanContext,
- isValid,
- NoRecordingSpan,
- randomSpanId,
- randomTraceId,
- setActiveSpan,
-} from '@opentelemetry/core';
-import { Resource } from '@opentelemetry/resources';
-import { BasicTracerProvider } from './BasicTracerProvider';
-import { Span } from './Span';
-import { TraceParams, TracerConfig } from './types';
-import { mergeConfig } from './utility';
-
-/**
- * This class represents a basic tracer.
- */
-export class Tracer implements api.Tracer {
- private readonly _defaultAttributes: api.Attributes;
- private readonly _sampler: api.Sampler;
- private readonly _traceParams: TraceParams;
- readonly resource: Resource;
- readonly logger: api.Logger;
-
- /**
- * Constructs a new Tracer instance.
- */
- constructor(
- config: TracerConfig,
- private _tracerProvider: BasicTracerProvider
- ) {
- const localConfig = mergeConfig(config);
- this._defaultAttributes = localConfig.defaultAttributes;
- this._sampler = localConfig.sampler;
- this._traceParams = localConfig.traceParams;
- this.resource = _tracerProvider.resource;
- this.logger = config.logger || new ConsoleLogger(config.logLevel);
- }
-
- /**
- * Starts a new Span or returns the default NoopSpan based on the sampling
- * decision.
- */
- startSpan(
- name: string,
- options: api.SpanOptions = {},
- context = api.context.active()
- ): api.Span {
- const parentContext = getParent(options, context);
- // make sampling decision
- const samplingDecision = this._sampler.shouldSample(parentContext);
- const spanId = randomSpanId();
- let traceId;
- let traceState;
- if (!parentContext || !isValid(parentContext)) {
- // New root span.
- traceId = randomTraceId();
- } else {
- // New child span.
- traceId = parentContext.traceId;
- traceState = parentContext.traceState;
- }
- const traceFlags = samplingDecision
- ? api.TraceFlags.SAMPLED
- : api.TraceFlags.NONE;
- const spanContext = { traceId, spanId, traceFlags, traceState };
- if (!samplingDecision) {
- this.logger.debug('Sampling is off, starting no recording span');
- return new NoRecordingSpan(spanContext);
- }
-
- const span = new Span(
- this,
- name,
- spanContext,
- options.kind || api.SpanKind.INTERNAL,
- parentContext ? parentContext.spanId : undefined,
- options.links || [],
- options.startTime
- );
- // Set default attributes
- span.setAttributes(
- Object.assign({}, this._defaultAttributes, options.attributes)
- );
- 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 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(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 ? setActiveSpan(api.context.active(), span) : api.context.active()
- );
- }
-
- /** Returns the active {@link TraceParams}. */
- getActiveTraceParams(): TraceParams {
- return this._traceParams;
- }
-
- getActiveSpanProcessor() {
- return this._tracerProvider.getActiveSpanProcessor();
- }
-}
-
-/**
- * Get the parent to assign to a started span. If options.parent is null,
- * do not assign a parent.
- *
- * @param options span options
- * @param context context to check for parent
- */
-function getParent(
- options: api.SpanOptions,
- context: api.Context
-): api.SpanContext | undefined {
- if (options.parent === null) return undefined;
- if (options.parent) return getContext(options.parent);
- return getParentSpanContext(context);
-}
-
-function getContext(span: api.Span | api.SpanContext): api.SpanContext {
- return isSpan(span) ? span.context() : span;
-}
-
-function isSpan(span: api.Span | api.SpanContext): span is api.Span {
- return typeof (span as api.Span).context === 'function';
-}
diff --git a/packages/opentelemetry-tracing/src/config.ts b/packages/opentelemetry-tracing/src/config.ts
deleted file mode 100644
index 99eb0d22fd..0000000000
--- a/packages/opentelemetry-tracing/src/config.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { ALWAYS_SAMPLER, LogLevel } from '@opentelemetry/core';
-
-/** Default limit for Message events per span */
-export const DEFAULT_MAX_EVENTS_PER_SPAN = 128;
-/** Default limit for Attributes per span */
-export const DEFAULT_MAX_ATTRIBUTES_PER_SPAN = 32;
-/** Default limit for Links per span */
-export const DEFAULT_MAX_LINKS_PER_SPAN = 32;
-
-/**
- * Default configuration. For fields with primitive values, any user-provided
- * value will override the corresponding default value. For fields with
- * non-primitive values (like `traceParams`), the user-provided value will be
- * used to extend the default value.
- */
-export const DEFAULT_CONFIG = {
- defaultAttributes: {},
- logLevel: LogLevel.INFO,
- sampler: ALWAYS_SAMPLER,
- traceParams: {
- numberOfAttributesPerSpan: DEFAULT_MAX_ATTRIBUTES_PER_SPAN,
- numberOfLinksPerSpan: DEFAULT_MAX_LINKS_PER_SPAN,
- numberOfEventsPerSpan: DEFAULT_MAX_EVENTS_PER_SPAN,
- },
-};
diff --git a/packages/opentelemetry-tracing/src/export/BatchSpanProcessor.ts b/packages/opentelemetry-tracing/src/export/BatchSpanProcessor.ts
deleted file mode 100644
index 87fd79bded..0000000000
--- a/packages/opentelemetry-tracing/src/export/BatchSpanProcessor.ts
+++ /dev/null
@@ -1,106 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { unrefTimer } from '@opentelemetry/core';
-import { Span } from '../Span';
-import { SpanProcessor } from '../SpanProcessor';
-import { BufferConfig } from '../types';
-import { ReadableSpan } from './ReadableSpan';
-import { SpanExporter } from './SpanExporter';
-
-const DEFAULT_BUFFER_SIZE = 100;
-const DEFAULT_BUFFER_TIMEOUT_MS = 20_000;
-
-/**
- * Implementation of the {@link SpanProcessor} that batches spans exported by
- * the SDK then pushes them to the exporter pipeline.
- */
-export class BatchSpanProcessor implements SpanProcessor {
- private readonly _bufferSize: number;
- private readonly _bufferTimeout: number;
-
- private _finishedSpans: ReadableSpan[] = [];
- private _timer: NodeJS.Timeout | undefined;
- private _isShutdown = false;
-
- constructor(private readonly _exporter: SpanExporter, config?: BufferConfig) {
- this._bufferSize =
- config && config.bufferSize ? config.bufferSize : DEFAULT_BUFFER_SIZE;
- this._bufferTimeout =
- config && typeof config.bufferTimeout === 'number'
- ? config.bufferTimeout
- : DEFAULT_BUFFER_TIMEOUT_MS;
- }
-
- forceFlush(): void {
- if (this._isShutdown) {
- return;
- }
- this._flush();
- }
-
- // does nothing.
- onStart(span: Span): void {}
-
- onEnd(span: Span): void {
- if (this._isShutdown) {
- return;
- }
- this._addToBuffer(span.toReadableSpan());
- }
-
- shutdown(): void {
- if (this._isShutdown) {
- return;
- }
- this.forceFlush();
- this._isShutdown = true;
- this._exporter.shutdown();
- }
-
- /** Add a span in the buffer. */
- private _addToBuffer(span: ReadableSpan) {
- this._finishedSpans.push(span);
- this._maybeStartTimer();
- if (this._finishedSpans.length > this._bufferSize) {
- this._flush();
- }
- }
-
- /** Send the span data list to exporter */
- private _flush() {
- this._clearTimer();
- if (this._finishedSpans.length === 0) return;
- this._exporter.export(this._finishedSpans, () => {});
- this._finishedSpans = [];
- }
-
- private _maybeStartTimer() {
- if (this._timer !== undefined) return;
-
- this._timer = setTimeout(() => {
- this._flush();
- }, this._bufferTimeout);
- unrefTimer(this._timer);
- }
-
- private _clearTimer() {
- if (this._timer !== undefined) {
- clearTimeout(this._timer);
- this._timer = undefined;
- }
- }
-}
diff --git a/packages/opentelemetry-tracing/src/export/ConsoleSpanExporter.ts b/packages/opentelemetry-tracing/src/export/ConsoleSpanExporter.ts
deleted file mode 100644
index 7f5fc96804..0000000000
--- a/packages/opentelemetry-tracing/src/export/ConsoleSpanExporter.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { SpanExporter } from './SpanExporter';
-import { ReadableSpan } from './ReadableSpan';
-import { ExportResult } from '@opentelemetry/base';
-import { hrTimeToMicroseconds } from '@opentelemetry/core';
-
-/**
- * This is implementation of {@link SpanExporter} that prints spans to the
- * console. This class can be used for diagnostic purposes.
- */
-export class ConsoleSpanExporter implements SpanExporter {
- /**
- * Export spans.
- * @param spans
- * @param resultCallback
- */
- export(
- spans: ReadableSpan[],
- resultCallback: (result: ExportResult) => void
- ): void {
- return this._sendSpans(spans, resultCallback);
- }
-
- /**
- * Shutdown the exporter.
- */
- shutdown(): void {
- return this._sendSpans([]);
- }
-
- /**
- * converts span info into more readable format
- * @param span
- */
- private _exportInfo(span: ReadableSpan) {
- return {
- traceId: span.spanContext.traceId,
- parentId: span.parentSpanId,
- name: span.name,
- id: span.spanContext.spanId,
- kind: span.kind,
- timestamp: hrTimeToMicroseconds(span.startTime),
- duration: hrTimeToMicroseconds(span.duration),
- attributes: span.attributes,
- status: span.status,
- events: span.events,
- };
- }
-
- /**
- * Showing spans in console
- * @param spans
- * @param done
- */
- private _sendSpans(
- spans: ReadableSpan[],
- done?: (result: ExportResult) => void
- ): void {
- for (const span of spans) {
- console.log(this._exportInfo(span));
- }
- if (done) {
- return done(ExportResult.SUCCESS);
- }
- }
-}
diff --git a/packages/opentelemetry-tracing/src/export/InMemorySpanExporter.ts b/packages/opentelemetry-tracing/src/export/InMemorySpanExporter.ts
deleted file mode 100644
index 5415075ddb..0000000000
--- a/packages/opentelemetry-tracing/src/export/InMemorySpanExporter.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { SpanExporter } from './SpanExporter';
-import { ReadableSpan } from './ReadableSpan';
-import { ExportResult } from '@opentelemetry/base';
-
-/**
- * This class can be used for testing purposes. It stores the exported spans
- * in a list in memory that can be retrieve using the `getFinishedSpans()`
- * method.
- */
-export class InMemorySpanExporter implements SpanExporter {
- private _finishedSpans: ReadableSpan[] = [];
- private _stopped = false;
-
- export(
- spans: ReadableSpan[],
- resultCallback: (result: ExportResult) => void
- ): void {
- if (this._stopped) return resultCallback(ExportResult.FAILED_NOT_RETRYABLE);
- this._finishedSpans.push(...spans);
- return resultCallback(ExportResult.SUCCESS);
- }
-
- shutdown(): void {
- this._stopped = true;
- this._finishedSpans = [];
- }
-
- reset() {
- this._finishedSpans = [];
- }
-
- getFinishedSpans(): ReadableSpan[] {
- return this._finishedSpans;
- }
-}
diff --git a/packages/opentelemetry-tracing/src/export/ReadableSpan.ts b/packages/opentelemetry-tracing/src/export/ReadableSpan.ts
deleted file mode 100644
index 93bf90ea5d..0000000000
--- a/packages/opentelemetry-tracing/src/export/ReadableSpan.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- SpanKind,
- Status,
- Attributes,
- HrTime,
- Link,
- SpanContext,
- TimedEvent,
-} from '@opentelemetry/api';
-import { Resource } from '@opentelemetry/resources';
-
-export interface ReadableSpan {
- readonly name: string;
- readonly kind: SpanKind;
- readonly spanContext: SpanContext;
- readonly parentSpanId?: string;
- readonly startTime: HrTime;
- readonly endTime: HrTime;
- readonly status: Status;
- readonly attributes: Attributes;
- readonly links: Link[];
- readonly events: TimedEvent[];
- readonly duration: HrTime;
- readonly ended: boolean;
- readonly resource: Resource;
-}
diff --git a/packages/opentelemetry-tracing/src/export/SimpleSpanProcessor.ts b/packages/opentelemetry-tracing/src/export/SimpleSpanProcessor.ts
deleted file mode 100644
index e76797cfcf..0000000000
--- a/packages/opentelemetry-tracing/src/export/SimpleSpanProcessor.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Span } from '../Span';
-import { SpanProcessor } from '../SpanProcessor';
-import { SpanExporter } from './SpanExporter';
-
-/**
- * An implementation of the {@link SpanProcessor} that converts the {@link Span}
- * to {@link ReadableSpan} and passes it to the configured exporter.
- *
- * Only spans that are sampled are converted.
- */
-export class SimpleSpanProcessor implements SpanProcessor {
- constructor(private readonly _exporter: SpanExporter) {}
- private _isShutdown = false;
-
- forceFlush(): void {
- // do nothing as all spans are being exported without waiting
- }
-
- // does nothing.
- onStart(span: Span): void {}
-
- onEnd(span: Span): void {
- if (this._isShutdown) {
- return;
- }
- this._exporter.export([span.toReadableSpan()], () => {});
- }
-
- shutdown(): void {
- if (this._isShutdown) {
- return;
- }
- this._isShutdown = true;
-
- this._exporter.shutdown();
- }
-}
diff --git a/packages/opentelemetry-tracing/src/export/SpanExporter.ts b/packages/opentelemetry-tracing/src/export/SpanExporter.ts
deleted file mode 100644
index 88e191c1ff..0000000000
--- a/packages/opentelemetry-tracing/src/export/SpanExporter.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { ExportResult } from '@opentelemetry/base';
-import { ReadableSpan } from './ReadableSpan';
-
-/**
- * An interface that allows different tracing services to export recorded data
- * for sampled spans in their own format.
- *
- * To export data this MUST be register to the Tracer SDK using a optional
- * config.
- */
-export interface SpanExporter {
- /**
- * Called to export sampled {@link ReadableSpan}s.
- * @param spans the list of sampled Spans to be exported.
- */
- export(
- spans: ReadableSpan[],
- resultCallback: (result: ExportResult) => void
- ): void;
-
- /** Stops the exporter. */
- shutdown(): void;
-}
diff --git a/packages/opentelemetry-tracing/src/index.ts b/packages/opentelemetry-tracing/src/index.ts
deleted file mode 100644
index 6fdcfce454..0000000000
--- a/packages/opentelemetry-tracing/src/index.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './Tracer';
-export * from './BasicTracerProvider';
-export * from './export/ConsoleSpanExporter';
-export * from './export/BatchSpanProcessor';
-export * from './export/InMemorySpanExporter';
-export * from './export/ReadableSpan';
-export * from './export/SimpleSpanProcessor';
-export * from './export/SpanExporter';
-export * from './Span';
-export * from './SpanProcessor';
-export * from './types';
diff --git a/packages/opentelemetry-tracing/src/types.ts b/packages/opentelemetry-tracing/src/types.ts
deleted file mode 100644
index 008ac1523c..0000000000
--- a/packages/opentelemetry-tracing/src/types.ts
+++ /dev/null
@@ -1,86 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- Attributes,
- HttpTextPropagator,
- Logger,
- Sampler,
-} from '@opentelemetry/api';
-import { LogLevel } from '@opentelemetry/core';
-import { ContextManager } from '@opentelemetry/context-base';
-import { Resource } from '@opentelemetry/resources';
-
-/**
- * TracerConfig provides an interface for configuring a Basic Tracer.
- */
-export interface TracerConfig {
- /**
- * Attributed that will be applied on every span created by Tracer.
- * Useful to add infrastructure and environment information to your spans.
- */
- defaultAttributes?: Attributes;
-
- /**
- * User provided logger.
- */
- logger?: Logger;
-
- /** level of logger. */
- logLevel?: LogLevel;
-
- /**
- * Sampler determines if a span should be recorded or should be a NoopSpan.
- */
- sampler?: Sampler;
-
- /** Trace Parameters */
- traceParams?: TraceParams;
-
- /** Resource associated with trace telemetry */
- resource?: Resource;
-}
-
-/**
- * Configuration options for registering the API with the SDK.
- * Undefined values may be substituted for defaults, and null
- * values will not be registered.
- */
-export interface SDKRegistrationConfig {
- /** Propagator to register as the global propagator */
- propagator?: HttpTextPropagator | null;
-
- /** Context manager to register as the global context manager */
- contextManager?: ContextManager | null;
-}
-
-/** Global configuration of trace service */
-export interface TraceParams {
- /** numberOfAttributesPerSpan is number of attributes per span */
- numberOfAttributesPerSpan?: number;
- /** numberOfLinksPerSpan is number of links per span */
- numberOfLinksPerSpan?: number;
- /** numberOfEventsPerSpan is number of message events per span */
- numberOfEventsPerSpan?: number;
-}
-
-/** Interface configuration for a buffer. */
-export interface BufferConfig {
- /** Maximum size of a buffer. */
- bufferSize?: number;
- /** Max time for a buffer can wait before being sent */
- bufferTimeout?: number;
-}
diff --git a/packages/opentelemetry-tracing/src/utility.ts b/packages/opentelemetry-tracing/src/utility.ts
deleted file mode 100644
index a417c6e74b..0000000000
--- a/packages/opentelemetry-tracing/src/utility.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- DEFAULT_CONFIG,
- DEFAULT_MAX_ATTRIBUTES_PER_SPAN,
- DEFAULT_MAX_EVENTS_PER_SPAN,
- DEFAULT_MAX_LINKS_PER_SPAN,
-} from './config';
-import { TracerConfig } from './types';
-
-/**
- * Function to merge Default configuration (as specified in './config') with
- * user provided configurations.
- */
-export function mergeConfig(userConfig: TracerConfig) {
- const traceParams = userConfig.traceParams;
- const target = Object.assign({}, DEFAULT_CONFIG, userConfig);
-
- // the user-provided value will be used to extend the default value.
- if (traceParams) {
- target.traceParams.numberOfAttributesPerSpan =
- traceParams.numberOfAttributesPerSpan || DEFAULT_MAX_ATTRIBUTES_PER_SPAN;
- target.traceParams.numberOfEventsPerSpan =
- traceParams.numberOfEventsPerSpan || DEFAULT_MAX_EVENTS_PER_SPAN;
- target.traceParams.numberOfLinksPerSpan =
- traceParams.numberOfLinksPerSpan || DEFAULT_MAX_LINKS_PER_SPAN;
- }
- return target;
-}
diff --git a/packages/opentelemetry-tracing/src/version.ts b/packages/opentelemetry-tracing/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-tracing/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts b/packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts
deleted file mode 100644
index 832128e9c4..0000000000
--- a/packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts
+++ /dev/null
@@ -1,378 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Context, context, SpanContext, TraceFlags } from '@opentelemetry/api';
-import {
- ALWAYS_SAMPLER,
- NEVER_SAMPLER,
- NoopLogger,
- NoRecordingSpan,
- setActiveSpan,
- setExtractedSpanContext,
- TraceState,
-} from '@opentelemetry/core';
-import { Resource } from '@opentelemetry/resources';
-import {
- NoopContextManager,
- ContextManager,
-} from '@opentelemetry/context-base';
-import * as assert from 'assert';
-import { BasicTracerProvider, Span } from '../src';
-
-describe('BasicTracerProvider', () => {
- beforeEach(() => {
- context.setGlobalContextManager(new NoopContextManager());
- });
-
- describe('constructor', () => {
- it('should construct an instance without any options', () => {
- const provider = new BasicTracerProvider();
- assert.ok(provider instanceof BasicTracerProvider);
- });
-
- it('should construct an instance with logger', () => {
- const provider = new BasicTracerProvider({
- logger: new NoopLogger(),
- });
- assert.ok(provider instanceof BasicTracerProvider);
- });
-
- it('should construct an instance with sampler', () => {
- const provider = new BasicTracerProvider({
- sampler: ALWAYS_SAMPLER,
- });
- assert.ok(provider instanceof BasicTracerProvider);
- });
-
- it('should construct an instance with default trace params', () => {
- const tracer = new BasicTracerProvider({}).getTracer('default');
- assert.deepStrictEqual(tracer.getActiveTraceParams(), {
- numberOfAttributesPerSpan: 32,
- numberOfEventsPerSpan: 128,
- numberOfLinksPerSpan: 32,
- });
- });
-
- it('should construct an instance with customized numberOfAttributesPerSpan trace params', () => {
- const tracer = new BasicTracerProvider({
- traceParams: {
- numberOfAttributesPerSpan: 100,
- },
- }).getTracer('default');
- assert.deepStrictEqual(tracer.getActiveTraceParams(), {
- numberOfAttributesPerSpan: 100,
- numberOfEventsPerSpan: 128,
- numberOfLinksPerSpan: 32,
- });
- });
-
- it('should construct an instance with customized numberOfEventsPerSpan trace params', () => {
- const tracer = new BasicTracerProvider({
- traceParams: {
- numberOfEventsPerSpan: 300,
- },
- }).getTracer('default');
- assert.deepStrictEqual(tracer.getActiveTraceParams(), {
- numberOfAttributesPerSpan: 32,
- numberOfEventsPerSpan: 300,
- numberOfLinksPerSpan: 32,
- });
- });
-
- it('should construct an instance with customized numberOfLinksPerSpan trace params', () => {
- const tracer = new BasicTracerProvider({
- traceParams: {
- numberOfLinksPerSpan: 10,
- },
- }).getTracer('default');
- assert.deepStrictEqual(tracer.getActiveTraceParams(), {
- numberOfAttributesPerSpan: 32,
- numberOfEventsPerSpan: 128,
- numberOfLinksPerSpan: 10,
- });
- });
-
- it('should construct an instance with default attributes', () => {
- const tracer = new BasicTracerProvider({
- defaultAttributes: {
- region: 'eu-west',
- asg: 'my-asg',
- },
- });
- assert.ok(tracer instanceof BasicTracerProvider);
- });
- });
-
- describe('.startSpan()', () => {
- it('should start a span with name only', () => {
- const tracer = new BasicTracerProvider().getTracer('default');
- const span = tracer.startSpan('my-span');
- assert.ok(span);
- assert.ok(span instanceof Span);
- });
-
- it('should start a span with name and options', () => {
- const tracer = new BasicTracerProvider().getTracer('default');
- const span = tracer.startSpan('my-span', {});
- assert.ok(span);
- assert.ok(span instanceof Span);
- const context = span.context();
- assert.ok(context.traceId.match(/[a-f0-9]{32}/));
- assert.ok(context.spanId.match(/[a-f0-9]{16}/));
- assert.strictEqual(context.traceFlags, TraceFlags.SAMPLED);
- assert.deepStrictEqual(context.traceState, undefined);
- span.end();
- });
-
- it('should start a span with defaultAttributes and spanoptions->attributes', () => {
- const tracer = new BasicTracerProvider({
- defaultAttributes: { foo: 'bar' },
- }).getTracer('default');
- const span = tracer.startSpan('my-span', {
- attributes: { foo: 'foo', bar: 'bar' },
- }) as Span;
- assert.deepStrictEqual(span.attributes, { bar: 'bar', foo: 'foo' });
- span.end();
- });
-
- it('should start a span with defaultAttributes and undefined spanoptions->attributes', () => {
- const tracer = new BasicTracerProvider({
- defaultAttributes: { foo: 'bar' },
- }).getTracer('default');
- const span = tracer.startSpan('my-span', {}) as Span;
- assert.deepStrictEqual(span.attributes, { foo: 'bar' });
- span.end();
- });
-
- it('should start a span with spanoptions->attributes', () => {
- const tracer = new BasicTracerProvider().getTracer('default');
- const span = tracer.startSpan('my-span', {
- attributes: { foo: 'foo', bar: 'bar' },
- }) as Span;
- assert.deepStrictEqual(span.attributes, { foo: 'foo', bar: 'bar' });
- span.end();
- });
-
- it('should start a span with name and parent spancontext', () => {
- const tracer = new BasicTracerProvider().getTracer('default');
- const state = new TraceState('a=1,b=2');
-
- const span = tracer.startSpan(
- 'my-span',
- {},
- setExtractedSpanContext(Context.ROOT_CONTEXT, {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.SAMPLED,
- traceState: state,
- })
- );
- assert.ok(span instanceof Span);
- const context = span.context();
- assert.strictEqual(context.traceId, 'd4cda95b652f4a1592b449d5929fda1b');
- assert.strictEqual(context.traceFlags, TraceFlags.SAMPLED);
- assert.deepStrictEqual(context.traceState, state);
- span.end();
- });
-
- it('should start a span with name and parent span', () => {
- const tracer = new BasicTracerProvider().getTracer('default');
- const span = tracer.startSpan('my-span');
- const childSpan = tracer.startSpan(
- 'child-span',
- {},
- setActiveSpan(Context.ROOT_CONTEXT, span)
- );
- const context = childSpan.context();
- assert.strictEqual(context.traceId, span.context().traceId);
- assert.strictEqual(context.traceFlags, TraceFlags.SAMPLED);
- span.end();
- childSpan.end();
- });
-
- it('should override context parent with option parent', () => {
- const tracer = new BasicTracerProvider().getTracer('default');
- const span = tracer.startSpan('my-span');
- const overrideParent = tracer.startSpan('my-parent-override-span');
- const childSpan = tracer.startSpan(
- 'child-span',
- {
- parent: overrideParent,
- },
- setActiveSpan(Context.ROOT_CONTEXT, span)
- );
- const context = childSpan.context();
- assert.strictEqual(context.traceId, overrideParent.context().traceId);
- assert.strictEqual(context.traceFlags, TraceFlags.SAMPLED);
- span.end();
- childSpan.end();
- });
-
- it('should override context parent with option parent context', () => {
- const tracer = new BasicTracerProvider().getTracer('default');
- const span = tracer.startSpan('my-span');
- const overrideParent = tracer.startSpan('my-parent-override-span');
- const childSpan = tracer.startSpan(
- 'child-span',
- {
- parent: overrideParent.context(),
- },
- setActiveSpan(Context.ROOT_CONTEXT, span)
- );
- const context = childSpan.context();
- assert.strictEqual(context.traceId, overrideParent.context().traceId);
- assert.strictEqual(context.traceFlags, TraceFlags.SAMPLED);
- span.end();
- childSpan.end();
- });
-
- it('should create a root span when parent is null', () => {
- const tracer = new BasicTracerProvider().getTracer('default');
- const span = tracer.startSpan('my-span');
- const overrideParent = tracer.startSpan('my-parent-override-span');
- const rootSpan = tracer.startSpan(
- 'root-span',
- { parent: null },
- setActiveSpan(Context.ROOT_CONTEXT, span)
- );
- const context = rootSpan.context();
- assert.notStrictEqual(context.traceId, overrideParent.context().traceId);
- span.end();
- rootSpan.end();
- });
-
- it('should start a span with name and with invalid parent span', () => {
- const tracer = new BasicTracerProvider().getTracer('default');
- const span = tracer.startSpan(
- 'my-span',
- {},
- setExtractedSpanContext(
- Context.ROOT_CONTEXT,
- ('invalid-parent' as unknown) as SpanContext
- )
- );
- assert.ok(span instanceof Span);
- assert.deepStrictEqual((span as Span).parentSpanId, undefined);
- });
-
- it('should start a span with name and with invalid spancontext', () => {
- const tracer = new BasicTracerProvider().getTracer('default');
- const span = tracer.startSpan(
- 'my-span',
- {},
- setExtractedSpanContext(Context.ROOT_CONTEXT, {
- traceId: '0',
- spanId: '0',
- traceFlags: TraceFlags.SAMPLED,
- })
- );
- assert.ok(span instanceof Span);
- const context = span.context();
- assert.ok(context.traceId.match(/[a-f0-9]{32}/));
- assert.ok(context.spanId.match(/[a-f0-9]{16}/));
- assert.strictEqual(context.traceFlags, TraceFlags.SAMPLED);
- assert.deepStrictEqual(context.traceState, undefined);
- });
-
- it('should return a no recording span when never sampling', () => {
- const tracer = new BasicTracerProvider({
- sampler: NEVER_SAMPLER,
- logger: new NoopLogger(),
- }).getTracer('default');
- const span = tracer.startSpan('my-span');
- assert.ok(span instanceof NoRecordingSpan);
- const context = span.context();
- assert.ok(context.traceId.match(/[a-f0-9]{32}/));
- assert.ok(context.spanId.match(/[a-f0-9]{16}/));
- assert.strictEqual(context.traceFlags, TraceFlags.NONE);
- assert.deepStrictEqual(context.traceState, undefined);
- span.end();
- });
-
- it('should create real span when sampled', () => {
- const tracer = new BasicTracerProvider({
- sampler: ALWAYS_SAMPLER,
- }).getTracer('default');
- const span = tracer.startSpan('my-span');
- assert.ok(span instanceof Span);
- assert.strictEqual(span.context().traceFlags, TraceFlags.SAMPLED);
- assert.strictEqual(span.isRecording(), true);
- });
-
- it('should set default attributes on span', () => {
- const defaultAttributes = {
- foo: 'bar',
- };
- const tracer = new BasicTracerProvider({
- defaultAttributes,
- }).getTracer('default');
-
- const span = tracer.startSpan('my-span') as Span;
- assert.ok(span instanceof Span);
- assert.deepStrictEqual(span.attributes, defaultAttributes);
- });
-
- it('should assign a resource', () => {
- const tracer = new BasicTracerProvider().getTracer('default');
- const span = tracer.startSpan('my-span') as Span;
- assert.ok(span);
- assert.ok(span.resource instanceof Resource);
- });
- });
-
- describe('.getCurrentSpan()', () => {
- it('should return current span when it exists', () => {
- context.setGlobalContextManager({
- active: () =>
- setActiveSpan(Context.ROOT_CONTEXT, ('foo' as any) as Span),
- } 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);
- return done();
- });
- });
- });
-
- describe('.bind()', () => {
- it('should bind context with NoopContextManager context manager', done => {
- const tracer = new BasicTracerProvider().getTracer('default');
- const span = tracer.startSpan('my-span');
- const fn = () => {
- assert.deepStrictEqual(tracer.getCurrentSpan(), undefined);
- return done();
- };
- const patchedFn = tracer.bind(fn, span);
- return patchedFn();
- });
- });
-
- describe('.resource', () => {
- it('should return a Resource', () => {
- const tracerProvider = new BasicTracerProvider();
- assert.ok(tracerProvider.resource instanceof Resource);
- });
- });
-});
diff --git a/packages/opentelemetry-tracing/test/MultiSpanProcessor.test.ts b/packages/opentelemetry-tracing/test/MultiSpanProcessor.test.ts
deleted file mode 100644
index 62b33fe224..0000000000
--- a/packages/opentelemetry-tracing/test/MultiSpanProcessor.test.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import { MultiSpanProcessor } from '../src/MultiSpanProcessor';
-import { SpanProcessor, Span, BasicTracerProvider } from '../src';
-
-class TestProcessor implements SpanProcessor {
- spans: Span[] = [];
- onStart(span: Span): void {}
- onEnd(span: Span): void {
- this.spans.push(span);
- }
- shutdown(): void {
- this.spans = [];
- }
- forceFlush(): void {}
-}
-
-describe('MultiSpanProcessor', () => {
- const tracer = new BasicTracerProvider().getTracer('default');
- const span = tracer.startSpan('one');
-
- it('should handle empty span processor', () => {
- const multiSpanProcessor = new MultiSpanProcessor([]);
- multiSpanProcessor.onStart(span);
- multiSpanProcessor.onEnd(span);
- multiSpanProcessor.shutdown();
- });
-
- it('should handle one span processor', () => {
- const processor1 = new TestProcessor();
- const multiSpanProcessor = new MultiSpanProcessor([processor1]);
- multiSpanProcessor.onStart(span);
- assert.strictEqual(processor1.spans.length, 0);
- multiSpanProcessor.onEnd(span);
- assert.strictEqual(processor1.spans.length, 1);
- });
-
- it('should handle two span processor', () => {
- const processor1 = new TestProcessor();
- const processor2 = new TestProcessor();
- const multiSpanProcessor = new MultiSpanProcessor([processor1, processor2]);
- multiSpanProcessor.onStart(span);
- assert.strictEqual(processor1.spans.length, 0);
- assert.strictEqual(processor1.spans.length, processor2.spans.length);
- multiSpanProcessor.onEnd(span);
- assert.strictEqual(processor1.spans.length, 1);
- assert.strictEqual(processor1.spans.length, processor2.spans.length);
-
- multiSpanProcessor.shutdown();
- assert.strictEqual(processor1.spans.length, 0);
- assert.strictEqual(processor1.spans.length, processor2.spans.length);
- });
-});
diff --git a/packages/opentelemetry-tracing/test/Span.test.ts b/packages/opentelemetry-tracing/test/Span.test.ts
deleted file mode 100644
index 0eeeda7ab9..0000000000
--- a/packages/opentelemetry-tracing/test/Span.test.ts
+++ /dev/null
@@ -1,368 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import {
- SpanKind,
- CanonicalCode,
- TraceFlags,
- SpanContext,
- LinkContext,
-} from '@opentelemetry/api';
-import { BasicTracerProvider, Span } from '../src';
-import {
- hrTime,
- hrTimeToNanoseconds,
- hrTimeToMilliseconds,
- NoopLogger,
- hrTimeDuration,
-} from '@opentelemetry/core';
-
-const performanceTimeOrigin = hrTime();
-
-describe('Span', () => {
- const tracer = new BasicTracerProvider({
- logger: new NoopLogger(),
- }).getTracer('default');
- const name = 'span1';
- const spanContext: SpanContext = {
- traceId: 'd4cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- traceFlags: TraceFlags.SAMPLED,
- };
- const linkContext: LinkContext = {
- traceId: 'e4cda95b652f4a1592b449d5929fda1b',
- spanId: '7e0c63257de34c92',
- };
-
- it('should create a Span instance', () => {
- const span = new Span(tracer, name, spanContext, SpanKind.SERVER);
- assert.ok(span instanceof Span);
- span.end();
- });
-
- it('should have valid startTime', () => {
- const span = new Span(tracer, name, spanContext, SpanKind.SERVER);
- assert.ok(
- hrTimeToMilliseconds(span.startTime) >
- hrTimeToMilliseconds(performanceTimeOrigin)
- );
- });
-
- it('should have valid endTime', () => {
- const span = new Span(tracer, name, spanContext, SpanKind.SERVER);
- span.end();
- assert.ok(
- hrTimeToNanoseconds(span.endTime) >= hrTimeToNanoseconds(span.startTime),
- 'end time must be bigger or equal start time'
- );
-
- assert.ok(
- hrTimeToMilliseconds(span.endTime) >
- hrTimeToMilliseconds(performanceTimeOrigin),
- 'end time must be bigger than time origin'
- );
- });
-
- it('should have a duration', () => {
- const span = new Span(tracer, name, spanContext, SpanKind.SERVER);
- span.end();
- assert.ok(hrTimeToNanoseconds(span.duration) >= 0);
- });
-
- it('should have valid event.time', () => {
- const span = new Span(tracer, name, spanContext, SpanKind.SERVER);
- span.addEvent('my-event');
- assert.ok(
- hrTimeToMilliseconds(span.events[0].time) >
- hrTimeToMilliseconds(performanceTimeOrigin)
- );
- });
-
- it('should have an entered time for event', () => {
- const span = new Span(
- tracer,
- name,
- spanContext,
- SpanKind.SERVER,
- undefined,
- [],
- 0
- );
- const timeMS = 123;
- const spanStartTime = hrTimeToMilliseconds(span.startTime);
- const eventTime = spanStartTime + timeMS;
-
- span.addEvent('my-event', undefined, eventTime);
-
- const diff = hrTimeDuration(span.startTime, span.events[0].time);
- assert.strictEqual(hrTimeToMilliseconds(diff), 123);
- });
-
- describe('when 2nd param is "TimeInput" type', () => {
- it('should have an entered time for event - ', () => {
- const span = new Span(
- tracer,
- name,
- spanContext,
- SpanKind.SERVER,
- undefined,
- [],
- 0
- );
- const timeMS = 123;
- const spanStartTime = hrTimeToMilliseconds(span.startTime);
- const eventTime = spanStartTime + timeMS;
-
- span.addEvent('my-event', eventTime);
-
- const diff = hrTimeDuration(span.startTime, span.events[0].time);
- assert.strictEqual(hrTimeToMilliseconds(diff), 123);
- });
- });
-
- it('should get the span context of span', () => {
- const span = new Span(tracer, name, spanContext, SpanKind.CLIENT);
- const context = span.context();
- assert.strictEqual(context.traceId, spanContext.traceId);
- assert.strictEqual(context.traceFlags, TraceFlags.SAMPLED);
- assert.strictEqual(context.traceState, undefined);
- assert.ok(context.spanId.match(/[a-f0-9]{16}/));
- assert.ok(span.isRecording());
- span.end();
- });
-
- it('should return true when isRecording:true', () => {
- const span = new Span(tracer, name, spanContext, SpanKind.CLIENT);
- assert.ok(span.isRecording());
- span.end();
- });
-
- it('should set an attribute', () => {
- const span = new Span(tracer, name, spanContext, SpanKind.CLIENT);
-
- ['String', 'Number', 'Boolean'].forEach(attType => {
- span.setAttribute('testKey' + attType, 'testValue' + attType);
- });
- span.setAttribute('object', { foo: 'bar' });
- span.end();
- });
-
- it('should set an event', () => {
- const span = new Span(tracer, name, spanContext, SpanKind.CLIENT);
- span.addEvent('sent');
- span.addEvent('rev', { attr1: 'value', attr2: 123, attr3: true });
- span.end();
- });
-
- it('should set a link', () => {
- const spanContext: SpanContext = {
- traceId: 'a3cda95b652f4a1592b449d5929fda1b',
- spanId: '5e0c63257de34c92',
- traceFlags: TraceFlags.SAMPLED,
- };
- const linkContext: LinkContext = {
- traceId: 'b3cda95b652f4a1592b449d5929fda1b',
- spanId: '6e0c63257de34c92',
- };
- const attributes = { attr1: 'value', attr2: 123, attr3: true };
- const span = new Span(tracer, name, spanContext, SpanKind.CLIENT, '12345', [
- { context: linkContext },
- { context: linkContext, attributes },
- ]);
- span.end();
- });
-
- it('should drop extra links, attributes and events', () => {
- const span = new Span(tracer, name, spanContext, SpanKind.CLIENT);
- for (let i = 0; i < 150; i++) {
- span.setAttribute('foo' + i, 'bar' + i);
- span.addEvent('sent' + i);
- }
- span.end();
-
- assert.strictEqual(span.events.length, 128);
- assert.strictEqual(Object.keys(span.attributes).length, 32);
- assert.strictEqual(span.events[span.events.length - 1].name, 'sent149');
- assert.strictEqual(span.attributes['foo0'], undefined);
- assert.strictEqual(span.attributes['foo149'], 'bar149');
- });
-
- it('should set an error status', () => {
- const span = new Span(tracer, name, spanContext, SpanKind.CLIENT);
- span.setStatus({
- code: CanonicalCode.PERMISSION_DENIED,
- message: 'This is an error',
- });
- span.end();
- });
-
- it('should return ReadableSpan', () => {
- const parentId = '5c1c63257de34c67';
- const span = new Span(
- tracer,
- 'my-span',
- spanContext,
- SpanKind.INTERNAL,
- parentId
- );
-
- const readableSpan = span.toReadableSpan();
- assert.strictEqual(readableSpan.name, 'my-span');
- assert.strictEqual(readableSpan.kind, SpanKind.INTERNAL);
- assert.strictEqual(readableSpan.parentSpanId, parentId);
- assert.strictEqual(readableSpan.spanContext.traceId, spanContext.traceId);
- assert.deepStrictEqual(readableSpan.status, {
- code: CanonicalCode.OK,
- });
- assert.deepStrictEqual(readableSpan.attributes, {});
- assert.deepStrictEqual(readableSpan.links, []);
- assert.deepStrictEqual(readableSpan.events, []);
- });
-
- it('should return ReadableSpan with attributes', () => {
- const span = new Span(tracer, 'my-span', spanContext, SpanKind.CLIENT);
- span.setAttribute('attr1', 'value1');
- let readableSpan = span.toReadableSpan();
- assert.deepStrictEqual(readableSpan.attributes, { attr1: 'value1' });
-
- span.setAttributes({ attr2: 123, attr1: false });
- readableSpan = span.toReadableSpan();
- assert.deepStrictEqual(readableSpan.attributes, {
- attr1: false,
- attr2: 123,
- });
-
- span.end();
- // shouldn't add new attribute
- span.setAttribute('attr3', 'value3');
- readableSpan = span.toReadableSpan();
- assert.deepStrictEqual(readableSpan.attributes, {
- attr1: false,
- attr2: 123,
- });
- });
-
- it('should return ReadableSpan with links', () => {
- const span = new Span(
- tracer,
- 'my-span',
- spanContext,
- SpanKind.CLIENT,
- undefined,
- [
- { context: linkContext },
- {
- context: linkContext,
- attributes: { attr1: 'value', attr2: 123, attr3: true },
- },
- ]
- );
- const readableSpan = span.toReadableSpan();
- assert.strictEqual(readableSpan.links.length, 2);
- assert.deepStrictEqual(readableSpan.links, [
- {
- context: linkContext,
- },
- {
- attributes: { attr1: 'value', attr2: 123, attr3: true },
- context: linkContext,
- },
- ]);
-
- span.end();
- });
-
- it('should return ReadableSpan with events', () => {
- const span = new Span(tracer, 'my-span', spanContext, SpanKind.CLIENT);
- span.addEvent('sent');
- let readableSpan = span.toReadableSpan();
- assert.strictEqual(readableSpan.events.length, 1);
- const [event] = readableSpan.events;
- assert.deepStrictEqual(event.name, 'sent');
- assert.ok(!event.attributes);
- assert.ok(event.time[0] > 0);
-
- span.addEvent('rev', { attr1: 'value', attr2: 123, attr3: true });
- readableSpan = span.toReadableSpan();
- assert.strictEqual(readableSpan.events.length, 2);
- const [event1, event2] = readableSpan.events;
- assert.deepStrictEqual(event1.name, 'sent');
- assert.ok(!event1.attributes);
- assert.ok(event1.time[0] > 0);
- assert.deepStrictEqual(event2.name, 'rev');
- assert.deepStrictEqual(event2.attributes, {
- attr1: 'value',
- attr2: 123,
- attr3: true,
- });
- assert.ok(event2.time[0] > 0);
-
- span.end();
- // shouldn't add new event
- span.addEvent('sent');
- assert.strictEqual(readableSpan.events.length, 2);
- readableSpan = span.toReadableSpan();
- assert.strictEqual(readableSpan.events.length, 2);
- });
-
- it('should return ReadableSpan with new status', () => {
- const span = new Span(tracer, name, spanContext, SpanKind.CLIENT);
- span.setStatus({
- code: CanonicalCode.PERMISSION_DENIED,
- message: 'This is an error',
- });
- const readableSpan = span.toReadableSpan();
- assert.strictEqual(
- readableSpan.status.code,
- CanonicalCode.PERMISSION_DENIED
- );
- assert.strictEqual(readableSpan.status.message, 'This is an error');
- span.end();
-
- // shouldn't update status
- span.setStatus({
- code: CanonicalCode.OK,
- message: 'OK',
- });
- assert.strictEqual(span.status.code, CanonicalCode.PERMISSION_DENIED);
- });
-
- it('should only end a span once', () => {
- const span = new Span(tracer, name, spanContext, SpanKind.SERVER);
- const endTime = Date.now();
- span.end(endTime);
- span.end(endTime + 10);
- assert.deepStrictEqual(span.endTime[0], Math.trunc(endTime / 1000));
- });
-
- it('should update name', () => {
- const span = new Span(tracer, name, spanContext, SpanKind.SERVER);
- span.updateName('foo-span');
- span.end();
-
- // shouldn't update name
- span.updateName('bar-span');
- assert.strictEqual(span.name, 'foo-span');
- });
-
- it('should have ended', () => {
- const span = new Span(tracer, name, spanContext, SpanKind.SERVER);
- assert.strictEqual(span.ended, false);
- span.end();
- assert.strictEqual(span.ended, true);
- });
-});
diff --git a/packages/opentelemetry-tracing/test/export/BatchSpanProcessor.test.ts b/packages/opentelemetry-tracing/test/export/BatchSpanProcessor.test.ts
deleted file mode 100644
index c4452bb069..0000000000
--- a/packages/opentelemetry-tracing/test/export/BatchSpanProcessor.test.ts
+++ /dev/null
@@ -1,177 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { ALWAYS_SAMPLER } from '@opentelemetry/core';
-import * as assert from 'assert';
-import * as sinon from 'sinon';
-import {
- BasicTracerProvider,
- BatchSpanProcessor,
- InMemorySpanExporter,
- Span,
-} from '../../src';
-
-function createSampledSpan(spanName: string): Span {
- const tracer = new BasicTracerProvider({
- sampler: ALWAYS_SAMPLER,
- }).getTracer('default');
- const span = tracer.startSpan(spanName);
- span.end();
- return span as Span;
-}
-
-describe('BatchSpanProcessor', () => {
- const name = 'span-name';
- const defaultBufferConfig = {
- bufferSize: 5,
- bufferTimeout: 2000,
- };
- let exporter: InMemorySpanExporter;
- beforeEach(() => {
- exporter = new InMemorySpanExporter();
- });
- afterEach(() => {
- exporter.reset();
- sinon.restore();
- });
-
- describe('constructor', () => {
- it('should create a BatchSpanProcessor instance', () => {
- const processor = new BatchSpanProcessor(exporter);
- assert.ok(processor instanceof BatchSpanProcessor);
- processor.shutdown();
- });
-
- it('should create a BatchSpanProcessor instance with config', () => {
- const processor = new BatchSpanProcessor(exporter, defaultBufferConfig);
- assert.ok(processor instanceof BatchSpanProcessor);
- processor.shutdown();
- });
-
- it('should create a BatchSpanProcessor instance with empty config', () => {
- const processor = new BatchSpanProcessor(exporter, {});
- assert.ok(processor instanceof BatchSpanProcessor);
- processor.shutdown();
- });
- });
-
- describe('.onStart/.onEnd/.shutdown', () => {
- it('should do nothing after processor is shutdown', () => {
- const processor = new BatchSpanProcessor(exporter, defaultBufferConfig);
- const spy: sinon.SinonSpy = sinon.spy(exporter, 'export') as any;
-
- const span = createSampledSpan(`${name}_0`);
-
- processor.onEnd(span);
- assert.strictEqual(processor['_finishedSpans'].length, 1);
-
- processor.forceFlush();
- assert.strictEqual(exporter.getFinishedSpans().length, 1);
-
- processor.onEnd(span);
- assert.strictEqual(processor['_finishedSpans'].length, 1);
-
- assert.strictEqual(spy.args.length, 1);
- processor.shutdown();
- assert.strictEqual(spy.args.length, 2);
- assert.strictEqual(exporter.getFinishedSpans().length, 0);
-
- processor.onEnd(span);
- assert.strictEqual(spy.args.length, 2);
- assert.strictEqual(processor['_finishedSpans'].length, 0);
- assert.strictEqual(exporter.getFinishedSpans().length, 0);
- });
-
- it('should export the sampled spans with buffer size reached', () => {
- const processor = new BatchSpanProcessor(exporter, defaultBufferConfig);
- for (let i = 0; i < defaultBufferConfig.bufferSize; i++) {
- const span = createSampledSpan(`${name}_${i}`);
- processor.onStart(span);
- assert.strictEqual(exporter.getFinishedSpans().length, 0);
-
- processor.onEnd(span);
- assert.strictEqual(exporter.getFinishedSpans().length, 0);
- }
- // Now we should start seeing the spans in exporter
- const span = createSampledSpan(`${name}_6`);
- processor.onEnd(span);
- assert.strictEqual(exporter.getFinishedSpans().length, 6);
-
- processor.shutdown();
- assert.strictEqual(exporter.getFinishedSpans().length, 0);
- });
-
- it('should force flush when timeout exceeded', done => {
- const clock = sinon.useFakeTimers();
- const processor = new BatchSpanProcessor(exporter, defaultBufferConfig);
- for (let i = 0; i < defaultBufferConfig.bufferSize; i++) {
- const span = createSampledSpan(`${name}_${i}`);
- processor.onEnd(span);
- assert.strictEqual(exporter.getFinishedSpans().length, 0);
- }
-
- setTimeout(() => {
- assert.strictEqual(exporter.getFinishedSpans().length, 5);
- done();
- }, defaultBufferConfig.bufferTimeout + 1000);
-
- clock.tick(defaultBufferConfig.bufferTimeout + 1000);
-
- clock.restore();
- });
-
- it('should force flush on demand', () => {
- const processor = new BatchSpanProcessor(exporter, defaultBufferConfig);
- for (let i = 0; i < defaultBufferConfig.bufferSize; i++) {
- const span = createSampledSpan(`${name}_${i}`);
- processor.onEnd(span);
- }
- assert.strictEqual(exporter.getFinishedSpans().length, 0);
- processor.forceFlush();
- assert.strictEqual(exporter.getFinishedSpans().length, 5);
- });
-
- it('should not export empty span lists', done => {
- const spy = sinon.spy(exporter, 'export');
- const clock = sinon.useFakeTimers();
-
- const tracer = new BasicTracerProvider({
- sampler: ALWAYS_SAMPLER,
- }).getTracer('default');
- const processor = new BatchSpanProcessor(exporter, defaultBufferConfig);
-
- // start but do not end spans
- for (let i = 0; i < defaultBufferConfig.bufferSize; i++) {
- const span = tracer.startSpan('spanName');
- processor.onStart(span as Span);
- }
-
- setTimeout(() => {
- assert.strictEqual(exporter.getFinishedSpans().length, 0);
- // after the timeout, export should not have been called
- // because no spans are ended
- sinon.assert.notCalled(spy);
- done();
- }, defaultBufferConfig.bufferTimeout + 1000);
-
- // no spans have been finished
- assert.strictEqual(exporter.getFinishedSpans().length, 0);
- clock.tick(defaultBufferConfig.bufferTimeout + 1000);
-
- clock.restore();
- });
- });
-});
diff --git a/packages/opentelemetry-tracing/test/export/ConsoleSpanExporter.test.ts b/packages/opentelemetry-tracing/test/export/ConsoleSpanExporter.test.ts
deleted file mode 100644
index dde733b5a9..0000000000
--- a/packages/opentelemetry-tracing/test/export/ConsoleSpanExporter.test.ts
+++ /dev/null
@@ -1,87 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import * as sinon from 'sinon';
-import {
- BasicTracerProvider,
- ConsoleSpanExporter,
- SimpleSpanProcessor,
-} from '../../src';
-
-describe('ConsoleSpanExporter', () => {
- let consoleExporter: ConsoleSpanExporter;
- let previousConsoleLog: any;
-
- beforeEach(() => {
- previousConsoleLog = console.log;
- console.log = () => {};
- consoleExporter = new ConsoleSpanExporter();
- });
-
- afterEach(() => {
- console.log = previousConsoleLog;
- });
-
- describe('.export()', () => {
- it('should export information about span', () => {
- assert.doesNotThrow(() => {
- const basicTracerProvider = new BasicTracerProvider();
- consoleExporter = new ConsoleSpanExporter();
-
- const spyConsole = sinon.spy(console, 'log');
- const spyExport = sinon.spy(consoleExporter, 'export');
-
- basicTracerProvider.addSpanProcessor(
- new SimpleSpanProcessor(consoleExporter)
- );
-
- const span = basicTracerProvider.getTracer('default').startSpan('foo');
- span.addEvent('foobar');
- span.end();
-
- const spans = spyExport.args[0];
- const firstSpan = spans[0][0];
- const firstEvent = firstSpan.events[0];
- const consoleArgs = spyConsole.args[0];
- const consoleSpan = consoleArgs[0];
- const keys = Object.keys(consoleSpan)
- .sort()
- .join(',');
-
- const expectedKeys = [
- 'attributes',
- 'duration',
- 'events',
- 'id',
- 'kind',
- 'name',
- 'parentId',
- 'status',
- 'timestamp',
- 'traceId',
- ].join(',');
-
- assert.ok(firstSpan.name === 'foo');
- assert.ok(firstEvent.name === 'foobar');
- assert.ok(consoleSpan.id === firstSpan.spanContext.spanId);
- assert.ok(keys === expectedKeys);
-
- assert.ok(spyExport.calledOnce);
- });
- });
- });
-});
diff --git a/packages/opentelemetry-tracing/test/export/InMemorySpanExporter.test.ts b/packages/opentelemetry-tracing/test/export/InMemorySpanExporter.test.ts
deleted file mode 100644
index cfd215ff88..0000000000
--- a/packages/opentelemetry-tracing/test/export/InMemorySpanExporter.test.ts
+++ /dev/null
@@ -1,100 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import {
- InMemorySpanExporter,
- SimpleSpanProcessor,
- BasicTracerProvider,
-} from '../../src';
-import { ExportResult } from '@opentelemetry/base';
-import { context } from '@opentelemetry/api';
-import { setActiveSpan } from '@opentelemetry/core';
-
-describe('InMemorySpanExporter', () => {
- const memoryExporter = new InMemorySpanExporter();
- const provider = new BasicTracerProvider();
- provider.addSpanProcessor(new SimpleSpanProcessor(memoryExporter));
-
- afterEach(() => {
- // reset spans in memory.
- memoryExporter.reset();
- });
-
- it('should get finished spans', () => {
- const root = provider.getTracer('default').startSpan('root');
- const child = provider
- .getTracer('default')
- .startSpan('child', {}, setActiveSpan(context.active(), root));
- const grandChild = provider
- .getTracer('default')
- .startSpan('grand-child', {}, setActiveSpan(context.active(), child));
-
- assert.strictEqual(memoryExporter.getFinishedSpans().length, 0);
- grandChild.end();
- assert.strictEqual(memoryExporter.getFinishedSpans().length, 1);
- child.end();
- assert.strictEqual(memoryExporter.getFinishedSpans().length, 2);
- root.end();
- assert.strictEqual(memoryExporter.getFinishedSpans().length, 3);
-
- const [span1, span2, span3] = memoryExporter.getFinishedSpans();
- assert.strictEqual(span1.name, 'grand-child');
- assert.strictEqual(span2.name, 'child');
- assert.strictEqual(span3.name, 'root');
- assert.strictEqual(span1.spanContext.traceId, span2.spanContext.traceId);
- assert.strictEqual(span2.spanContext.traceId, span3.spanContext.traceId);
- assert.strictEqual(span1.parentSpanId, span2.spanContext.spanId);
- assert.strictEqual(span2.parentSpanId, span3.spanContext.spanId);
- });
-
- it('should shutdown the exporter', () => {
- const root = provider.getTracer('default').startSpan('root');
-
- provider
- .getTracer('default')
- .startSpan('child', {}, setActiveSpan(context.active(), root))
- .end();
- root.end();
- assert.strictEqual(memoryExporter.getFinishedSpans().length, 2);
- memoryExporter.shutdown();
- assert.strictEqual(memoryExporter.getFinishedSpans().length, 0);
-
- // after shutdown no new spans are accepted
- provider
- .getTracer('default')
- .startSpan('child1', {}, setActiveSpan(context.active(), root))
- .end();
- assert.strictEqual(memoryExporter.getFinishedSpans().length, 0);
- });
-
- it('should return the success result', () => {
- const exorter = new InMemorySpanExporter();
- exorter.export([], (result: ExportResult) => {
- assert.strictEqual(result, ExportResult.SUCCESS);
- });
- });
-
- it('should return the FailedNotRetryable result after shutdown', () => {
- const exorter = new InMemorySpanExporter();
- exorter.shutdown();
-
- // after shutdown export should fail
- exorter.export([], (result: ExportResult) => {
- assert.strictEqual(result, ExportResult.FAILED_NOT_RETRYABLE);
- });
- });
-});
diff --git a/packages/opentelemetry-tracing/test/export/SimpleSpanProcessor.test.ts b/packages/opentelemetry-tracing/test/export/SimpleSpanProcessor.test.ts
deleted file mode 100644
index 572883b115..0000000000
--- a/packages/opentelemetry-tracing/test/export/SimpleSpanProcessor.test.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import {
- Span,
- BasicTracerProvider,
- InMemorySpanExporter,
- SimpleSpanProcessor,
-} from '../../src';
-import { SpanContext, SpanKind, TraceFlags } from '@opentelemetry/api';
-
-describe('SimpleSpanProcessor', () => {
- const provider = new BasicTracerProvider();
- const exporter = new InMemorySpanExporter();
-
- describe('constructor', () => {
- it('should create a SimpleSpanProcessor instance', () => {
- const processor = new SimpleSpanProcessor(exporter);
- assert.ok(processor instanceof SimpleSpanProcessor);
- });
- });
-
- describe('.onStart/.onEnd/.shutdown', () => {
- it('should handle span started and ended when SAMPLED', () => {
- const processor = new SimpleSpanProcessor(exporter);
- const spanContext: SpanContext = {
- traceId: 'a3cda95b652f4a1592b449d5929fda1b',
- spanId: '5e0c63257de34c92',
- traceFlags: TraceFlags.SAMPLED,
- };
- const span = new Span(
- provider.getTracer('default'),
- 'span-name',
- spanContext,
- SpanKind.CLIENT
- );
- processor.onStart(span);
- assert.strictEqual(exporter.getFinishedSpans().length, 0);
-
- processor.onEnd(span);
- assert.strictEqual(exporter.getFinishedSpans().length, 1);
-
- processor.shutdown();
- assert.strictEqual(exporter.getFinishedSpans().length, 0);
- });
-
- it('should handle span started and ended when UNSAMPLED', () => {
- const processor = new SimpleSpanProcessor(exporter);
- const spanContext: SpanContext = {
- traceId: 'a3cda95b652f4a1592b449d5929fda1b',
- spanId: '5e0c63257de34c92',
- traceFlags: TraceFlags.NONE,
- };
- const span = new Span(
- provider.getTracer('default'),
- 'span-name',
- spanContext,
- SpanKind.CLIENT
- );
- processor.onStart(span);
- assert.strictEqual(exporter.getFinishedSpans().length, 0);
-
- processor.onEnd(span);
- assert.strictEqual(exporter.getFinishedSpans().length, 0);
-
- processor.shutdown();
- assert.strictEqual(exporter.getFinishedSpans().length, 0);
- });
- });
-});
diff --git a/packages/opentelemetry-tracing/test/index-webpack.ts b/packages/opentelemetry-tracing/test/index-webpack.ts
deleted file mode 100644
index 7731f09091..0000000000
--- a/packages/opentelemetry-tracing/test/index-webpack.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// This file is the webpack entry point for the browser Karma tests. It requires
-// all modules ending in "test" from the current folder and all its subfolders.
-const testsContext = require.context('.', true, /test$/);
-testsContext.keys().forEach(testsContext);
-
-const srcContext = require.context('.', true, /src$/);
-srcContext.keys().forEach(srcContext);
diff --git a/packages/opentelemetry-tracing/tsconfig.json b/packages/opentelemetry-tracing/tsconfig.json
deleted file mode 100644
index a2042cd68b..0000000000
--- a/packages/opentelemetry-tracing/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ]
-}
diff --git a/packages/opentelemetry-tracing/tslint.json b/packages/opentelemetry-tracing/tslint.json
deleted file mode 100644
index 0710b135d0..0000000000
--- a/packages/opentelemetry-tracing/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-web/.npmignore b/packages/opentelemetry-web/.npmignore
deleted file mode 100644
index 9505ba9450..0000000000
--- a/packages/opentelemetry-web/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/bin
-/coverage
-/doc
-/test
diff --git a/packages/opentelemetry-web/LICENSE b/packages/opentelemetry-web/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/packages/opentelemetry-web/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/opentelemetry-web/README.md b/packages/opentelemetry-web/README.md
deleted file mode 100644
index 2d8ceeac67..0000000000
--- a/packages/opentelemetry-web/README.md
+++ /dev/null
@@ -1,82 +0,0 @@
-# OpenTelemetry Web SDK
-[![Gitter chat][gitter-image]][gitter-url]
-[![NPM Published Version][npm-img]][npm-url]
-[![dependencies][dependencies-image]][dependencies-url]
-[![devDependencies][devDependencies-image]][devDependencies-url]
-[![Apache License][license-image]][license-image]
-
-This module provides *automated instrumentation and tracing* for Web applications.
-
-For manual instrumentation see the
-[@opentelemetry/tracing](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-tracing) package.
-
-## How does automatic tracing work?
-This package exposes a class `WebTracerProvider` that will be able to automatically trace things in Browser only.
-
-See the example how to use it.
-
-OpenTelemetry comes with a growing number of instrumentation plugins for well know modules (see [supported modules](https://github.com/open-telemetry/opentelemetry-js#plugins)) and an API to create custom plugins (see [the plugin developer guide](https://github.com/open-telemetry/opentelemetry-js/blob/master/doc/plugin-guide.md)).
-
-Web Tracer currently supports one plugin for document load.
-Unlike Node Tracer (`NodeTracerProvider`), the plugins needs to be initialised and passed in configuration.
-The reason is to give user full control over which plugin will be bundled into web page.
-
-You can choose to use the `ZoneContextManager` if you want to trace asynchronous operations.
-
-## Installation
-
-```bash
-npm install --save @opentelemetry/web
-```
-
-## Usage
-
-```js
-import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
-import { WebTracerProvider } from '@opentelemetry/web';
-import { DocumentLoad } from '@opentelemetry/plugin-document-load';
-import { ZoneContextManager } from '@opentelemetry/context-zone';
-
-// Minimum required setup - supports only synchronous operations
-const provider = new WebTracerProvider({
- plugins: [
- new DocumentLoad()
- ]
-});
-
-provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
-provider.register();
-
-const providerWithZone = new WebTracerProvider({
- plugins: [
- new DocumentLoad()
- ]
-});
-providerWithZone.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
-
-// Changing default contextManager to use ZoneContextManager - supports asynchronous operations
-providerWithZone.register({
- contextManager: new ZoneContextManager(),
-});
-
-```
-
-## Useful links
-- For more information on OpenTelemetry, visit:
-- For more about OpenTelemetry JavaScript:
-- For help or feedback on this project, join us on [gitter][gitter-url]
-
-## License
-
-Apache 2.0 - See [LICENSE][license-url] for more information.
-
-[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
-[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
-[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
-[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
-[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-web
-[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-web
-[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-web
-[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-web&type=dev
-[npm-url]: https://www.npmjs.com/package/@opentelemetry/web
-[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fweb.svg
diff --git a/packages/opentelemetry-web/karma.conf.js b/packages/opentelemetry-web/karma.conf.js
deleted file mode 100644
index 88c2849684..0000000000
--- a/packages/opentelemetry-web/karma.conf.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-const karmaWebpackConfig = require('../../karma.webpack');
-const karmaBaseConfig = require('../../karma.base');
-
-module.exports = (config) => {
- config.set(Object.assign({}, karmaBaseConfig, {
- frameworks: karmaBaseConfig.frameworks.concat(['jquery-1.8.3']),
- webpack: karmaWebpackConfig
- }))
-};
diff --git a/packages/opentelemetry-web/package.json b/packages/opentelemetry-web/package.json
deleted file mode 100644
index 6b296fcc93..0000000000
--- a/packages/opentelemetry-web/package.json
+++ /dev/null
@@ -1,84 +0,0 @@
-{
- "name": "@opentelemetry/web",
- "version": "0.6.1",
- "description": "OpenTelemetry Web Tracer",
- "main": "build/src/index.js",
- "types": "build/src/index.d.ts",
- "repository": "open-telemetry/opentelemetry-js",
- "scripts": {
- "lint": "gts check",
- "lint:fix": "gts 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",
- "tdd": "karma start",
- "test:browser": "nyc karma start --single-run",
- "watch": "tsc -w"
- },
- "keywords": [
- "opentelemetry",
- "web",
- "tracing",
- "profiling",
- "metrics",
- "stats"
- ],
- "author": "OpenTelemetry Authors",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "files": [
- "build/src/**/*.js",
- "build/src/**/*.d.ts",
- "doc",
- "LICENSE",
- "README.md"
- ],
- "publishConfig": {
- "access": "public"
- },
- "devDependencies": {
- "@babel/core": "^7.6.0",
- "@opentelemetry/context-zone": "^0.6.1",
- "@opentelemetry/resources": "^0.6.1",
- "@types/jquery": "^3.3.31",
- "@types/mocha": "^7.0.0",
- "@types/node": "^12.6.8",
- "@types/sinon": "^7.0.13",
- "@types/webpack-env": "1.13.9",
- "babel-loader": "^8.0.6",
- "codecov": "^3.6.1",
- "gts": "^1.1.0",
- "istanbul-instrumenter-loader": "^3.0.1",
- "karma": "^4.4.1",
- "karma-chrome-launcher": "^3.1.0",
- "karma-coverage-istanbul-reporter": "^2.1.0",
- "karma-jquery": "^0.2.4",
- "karma-mocha": "^1.3.0",
- "karma-spec-reporter": "^0.0.32",
- "karma-webpack": "^4.0.2",
- "mocha": "^6.1.0",
- "nyc": "^15.0.0",
- "rimraf": "^3.0.0",
- "sinon": "^7.5.0",
- "ts-loader": "^6.0.4",
- "ts-mocha": "^6.0.0",
- "ts-node": "^8.6.2",
- "tslint-consistent-codestyle": "^1.16.0",
- "tslint-microsoft-contrib": "^6.2.0",
- "typescript": "3.7.2",
- "webpack": "^4.35.2",
- "webpack-cli": "^3.3.9",
- "webpack-merge": "^4.2.2"
- },
- "dependencies": {
- "@opentelemetry/api": "^0.6.1",
- "@opentelemetry/context-base": "^0.6.1",
- "@opentelemetry/core": "^0.6.1",
- "@opentelemetry/tracing": "^0.6.1"
- }
-}
diff --git a/packages/opentelemetry-web/src/StackContextManager.ts b/packages/opentelemetry-web/src/StackContextManager.ts
deleted file mode 100644
index b1ec44b284..0000000000
--- a/packages/opentelemetry-web/src/StackContextManager.ts
+++ /dev/null
@@ -1,122 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Context } from '@opentelemetry/api';
-import { ContextManager } from '@opentelemetry/context-base';
-
-/**
- * Stack Context Manager for managing the state in web
- * it doesn't fully support the async calls though
- */
-export class StackContextManager implements ContextManager {
- /**
- * whether the context manager is enabled or not
- */
- private _enabled = false;
-
- /**
- * Keeps the reference to current context
- */
- public _currentContext = Context.ROOT_CONTEXT;
-
- /**
- *
- * @param target Function to be executed within the context
- * @param context
- */
- private _bindFunction(
- target: T,
- context = Context.ROOT_CONTEXT
- ): T {
- const manager = this;
- const contextWrapper = function(this: any, ...args: any[]) {
- return manager.with(context, () => target.apply(this, args));
- };
- Object.defineProperty(contextWrapper, 'length', {
- enumerable: false,
- configurable: true,
- writable: false,
- value: target.length,
- });
- return (contextWrapper as unknown) as T;
- }
-
- /**
- * Returns the active context
- */
- active(): Context {
- return this._currentContext;
- }
-
- /**
- * Binds a the certain context or the active one to the target function and then returns the target
- * @param target
- * @param context
- */
- bind(target: T, context = Context.ROOT_CONTEXT): T {
- // if no specific context to propagate is given, we use the current one
- if (context === undefined) {
- context = this.active();
- }
- if (typeof target === 'function') {
- return this._bindFunction(target, context);
- }
- return target;
- }
-
- /**
- * Disable the context manager (clears the current context)
- */
- disable(): this {
- this._currentContext = Context.ROOT_CONTEXT;
- this._enabled = false;
- return this;
- }
-
- /**
- * Enables the context manager and creates a default(root) context
- */
- enable(): this {
- if (this._enabled) {
- return this;
- }
- this._enabled = true;
- this._currentContext = Context.ROOT_CONTEXT;
- return this;
- }
-
- /**
- * Calls the callback function [fn] with the provided [context]. If [context] is undefined then it will use the window.
- * The context will be set as active
- * @param context
- * @param fn Callback function
- */
- with ReturnType>(
- context: Context | null,
- fn: () => ReturnType
- ): ReturnType {
- const previousContext = this._currentContext;
- this._currentContext = context || Context.ROOT_CONTEXT;
-
- try {
- return fn();
- } catch (err) {
- throw err;
- } finally {
- this._currentContext = previousContext;
- }
- }
-}
diff --git a/packages/opentelemetry-web/src/WebTracerProvider.ts b/packages/opentelemetry-web/src/WebTracerProvider.ts
deleted file mode 100644
index 0dd8c1eb18..0000000000
--- a/packages/opentelemetry-web/src/WebTracerProvider.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { BasePlugin } from '@opentelemetry/core';
-import {
- BasicTracerProvider,
- SDKRegistrationConfig,
- TracerConfig,
-} from '@opentelemetry/tracing';
-import { StackContextManager } from './StackContextManager';
-
-/**
- * WebTracerConfig provides an interface for configuring a Web Tracer.
- */
-export interface WebTracerConfig extends TracerConfig {
- /**
- * plugins to be used with tracer, they will be enabled automatically
- */
- plugins?: BasePlugin[];
-}
-
-/**
- * This class represents a web tracer with {@link StackContextManager}
- */
-export class WebTracerProvider extends BasicTracerProvider {
- /**
- * Constructs a new Tracer instance.
- * @param config Web Tracer config
- */
- constructor(config: WebTracerConfig = {}) {
- if (typeof config.plugins === 'undefined') {
- config.plugins = [];
- }
- super(config);
-
- for (const plugin of config.plugins) {
- plugin.enable([], this, this.logger);
- }
-
- if ((config as SDKRegistrationConfig).contextManager) {
- throw 'contextManager should be defined in register method not in' +
- ' constructor';
- }
- if ((config as SDKRegistrationConfig).propagator) {
- throw 'propagator should be defined in register method not in constructor';
- }
- }
-
- /**
- * Register this TracerProvider for use with the OpenTelemetry API.
- * Undefined values may be replaced with defaults, and
- * null values will be skipped.
- *
- * @param config Configuration object for SDK registration
- */
- register(config: SDKRegistrationConfig = {}) {
- if (config.contextManager === undefined) {
- config.contextManager = new StackContextManager();
- }
- if (config.contextManager) {
- config.contextManager.enable();
- }
-
- super.register(config);
- }
-}
diff --git a/packages/opentelemetry-web/src/enums/PerformanceTimingNames.ts b/packages/opentelemetry-web/src/enums/PerformanceTimingNames.ts
deleted file mode 100644
index 12d5a44fa8..0000000000
--- a/packages/opentelemetry-web/src/enums/PerformanceTimingNames.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export enum PerformanceTimingNames {
- CONNECT_END = 'connectEnd',
- CONNECT_START = 'connectStart',
- DOM_COMPLETE = 'domComplete',
- DOM_CONTENT_LOADED_EVENT_END = 'domContentLoadedEventEnd',
- DOM_CONTENT_LOADED_EVENT_START = 'domContentLoadedEventStart',
- DOM_INTERACTIVE = 'domInteractive',
- DOMAIN_LOOKUP_END = 'domainLookupEnd',
- DOMAIN_LOOKUP_START = 'domainLookupStart',
- FETCH_START = 'fetchStart',
- LOAD_EVENT_END = 'loadEventEnd',
- LOAD_EVENT_START = 'loadEventStart',
- REDIRECT_END = 'redirectEnd',
- REDIRECT_START = 'redirectStart',
- REQUEST_START = 'requestStart',
- RESPONSE_END = 'responseEnd',
- RESPONSE_START = 'responseStart',
- SECURE_CONNECTION_START = 'secureConnectionStart',
- UNLOAD_EVENT_END = 'unloadEventEnd',
- UNLOAD_EVENT_START = 'unloadEventStart',
-}
diff --git a/packages/opentelemetry-web/src/index.ts b/packages/opentelemetry-web/src/index.ts
deleted file mode 100644
index aafef2114c..0000000000
--- a/packages/opentelemetry-web/src/index.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export * from './WebTracerProvider';
-export * from './StackContextManager';
-export * from './enums/PerformanceTimingNames';
-export * from './types';
-export * from './utils';
diff --git a/packages/opentelemetry-web/src/types.ts b/packages/opentelemetry-web/src/types.ts
deleted file mode 100644
index be51c8ad62..0000000000
--- a/packages/opentelemetry-web/src/types.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Performance metrics
- */
-import { PerformanceTimingNames } from './enums/PerformanceTimingNames';
-
-export type PerformanceEntries = {
- [PerformanceTimingNames.CONNECT_END]?: number;
- [PerformanceTimingNames.CONNECT_START]?: number;
- [PerformanceTimingNames.DOM_COMPLETE]?: number;
- [PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_END]?: number;
- [PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_START]?: number;
- [PerformanceTimingNames.DOM_INTERACTIVE]?: number;
- [PerformanceTimingNames.DOMAIN_LOOKUP_END]?: number;
- [PerformanceTimingNames.DOMAIN_LOOKUP_START]?: number;
- [PerformanceTimingNames.FETCH_START]?: number;
- [PerformanceTimingNames.LOAD_EVENT_END]?: number;
- [PerformanceTimingNames.LOAD_EVENT_START]?: number;
- [PerformanceTimingNames.REDIRECT_END]?: number;
- [PerformanceTimingNames.REDIRECT_START]?: number;
- [PerformanceTimingNames.REQUEST_START]?: number;
- [PerformanceTimingNames.RESPONSE_END]?: number;
- [PerformanceTimingNames.RESPONSE_START]?: number;
- [PerformanceTimingNames.SECURE_CONNECTION_START]?: number;
- [PerformanceTimingNames.UNLOAD_EVENT_END]?: number;
- [PerformanceTimingNames.UNLOAD_EVENT_START]?: number;
-};
-
-/**
- * This interface defines a fallback to read performance metrics,
- * this happens for example on Safari Mac
- */
-export interface PerformanceLegacy {
- timing?: PerformanceEntries;
-}
-
-/**
- * This interface is used in {@link getResource} function to return
- * main request and it's corresponding PreFlight request
- */
-export interface PerformanceResourceTimingInfo {
- corsPreFlightRequest?: PerformanceResourceTiming;
- mainRequest?: PerformanceResourceTiming;
-}
diff --git a/packages/opentelemetry-web/src/utils.ts b/packages/opentelemetry-web/src/utils.ts
deleted file mode 100644
index 0beec8d9f0..0000000000
--- a/packages/opentelemetry-web/src/utils.ts
+++ /dev/null
@@ -1,314 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { PerformanceEntries, PerformanceResourceTimingInfo } from './types';
-import { PerformanceTimingNames as PTN } from './enums/PerformanceTimingNames';
-import * as types from '@opentelemetry/api';
-import { hrTimeToNanoseconds, timeInputToHrTime } from '@opentelemetry/core';
-
-/**
- * Helper function to be able to use enum as typed key in type and in interface when using forEach
- * @param obj
- * @param key
- */
-export function hasKey(obj: O, key: keyof any): key is keyof O {
- return key in obj;
-}
-
-/**
- * Helper function for starting an event on span based on {@link PerformanceEntries}
- * @param span
- * @param performanceName name of performance entry for time start
- * @param entries
- */
-export function addSpanNetworkEvent(
- span: types.Span,
- performanceName: string,
- entries: PerformanceEntries
-): types.Span | undefined {
- if (
- hasKey(entries, performanceName) &&
- typeof entries[performanceName] === 'number'
- ) {
- // some metrics are available but have value 0 which means they are invalid
- // for example "secureConnectionStart" is 0 which makes the events to be wrongly interpreted
- if (entries[performanceName] === 0) {
- return undefined;
- }
- span.addEvent(performanceName, entries[performanceName]);
- return span;
- }
- return undefined;
-}
-
-/**
- * sort resources by startTime
- * @param filteredResources
- */
-export function sortResources(filteredResources: PerformanceResourceTiming[]) {
- return filteredResources.slice().sort((a, b) => {
- const valueA = a[PTN.FETCH_START];
- const valueB = b[PTN.FETCH_START];
- if (valueA > valueB) {
- return 1;
- } else if (valueA < valueB) {
- return -1;
- }
- return 0;
- });
-}
-
-/**
- * Get closest performance resource ignoring the resources that have been
- * already used.
- * @param spanUrl
- * @param startTimeHR
- * @param endTimeHR
- * @param resources
- * @param ignoredResources
- */
-export function getResource(
- spanUrl: string,
- startTimeHR: types.HrTime,
- endTimeHR: types.HrTime,
- resources: PerformanceResourceTiming[],
- ignoredResources: WeakSet = new WeakSet<
- PerformanceResourceTiming
- >()
-): PerformanceResourceTimingInfo {
- const filteredResources = filterResourcesForSpan(
- spanUrl,
- startTimeHR,
- endTimeHR,
- resources,
- ignoredResources
- );
-
- if (filteredResources.length === 0) {
- return {
- mainRequest: undefined,
- };
- }
- if (filteredResources.length === 1) {
- return {
- mainRequest: filteredResources[0],
- };
- }
- const sorted = sortResources(filteredResources.slice());
-
- const parsedSpanUrl = parseUrl(spanUrl);
- if (parsedSpanUrl.origin !== window.location.origin && sorted.length > 1) {
- let corsPreFlightRequest: PerformanceResourceTiming | undefined = sorted[0];
- let mainRequest: PerformanceResourceTiming = findMainRequest(
- sorted,
- corsPreFlightRequest[PTN.RESPONSE_END],
- endTimeHR
- );
-
- const responseEnd = corsPreFlightRequest[PTN.RESPONSE_END];
- const fetchStart = mainRequest[PTN.FETCH_START];
-
- // no corsPreFlightRequest
- if (fetchStart < responseEnd) {
- mainRequest = corsPreFlightRequest;
- corsPreFlightRequest = undefined;
- }
-
- return {
- corsPreFlightRequest,
- mainRequest,
- };
- } else {
- return {
- mainRequest: filteredResources[0],
- };
- }
-}
-
-/**
- * Will find the main request skipping the cors pre flight requests
- * @param resources
- * @param corsPreFlightRequestEndTime
- * @param spanEndTimeHR
- */
-function findMainRequest(
- resources: PerformanceResourceTiming[],
- corsPreFlightRequestEndTime: number,
- spanEndTimeHR: types.HrTime
-): PerformanceResourceTiming {
- const spanEndTime = hrTimeToNanoseconds(spanEndTimeHR);
- const minTime = hrTimeToNanoseconds(
- timeInputToHrTime(corsPreFlightRequestEndTime)
- );
-
- let mainRequest: PerformanceResourceTiming = resources[1];
- let bestGap;
-
- const length = resources.length;
- for (let i = 1; i < length; i++) {
- const resource = resources[i];
- const resourceStartTime = hrTimeToNanoseconds(
- timeInputToHrTime(resource[PTN.FETCH_START])
- );
-
- const resourceEndTime = hrTimeToNanoseconds(
- timeInputToHrTime(resource[PTN.RESPONSE_END])
- );
-
- const currentGap = spanEndTime - resourceEndTime;
-
- if (resourceStartTime >= minTime && (!bestGap || currentGap < bestGap)) {
- bestGap = currentGap;
- mainRequest = resource;
- }
- }
- return mainRequest;
-}
-
-/**
- * Filter all resources that has started and finished according to span start time and end time.
- * It will return the closest resource to a start time
- * @param spanUrl
- * @param startTimeHR
- * @param endTimeHR
- * @param resources
- * @param ignoredResources
- */
-function filterResourcesForSpan(
- spanUrl: string,
- startTimeHR: types.HrTime,
- endTimeHR: types.HrTime,
- resources: PerformanceResourceTiming[],
- ignoredResources: WeakSet
-) {
- const startTime = hrTimeToNanoseconds(startTimeHR);
- const endTime = hrTimeToNanoseconds(endTimeHR);
- let filteredResources = resources.filter(resource => {
- const resourceStartTime = hrTimeToNanoseconds(
- timeInputToHrTime(resource[PTN.FETCH_START])
- );
- const resourceEndTime = hrTimeToNanoseconds(
- timeInputToHrTime(resource[PTN.RESPONSE_END])
- );
-
- return (
- resource.initiatorType.toLowerCase() === 'xmlhttprequest' &&
- resource.name === spanUrl &&
- resourceStartTime >= startTime &&
- resourceEndTime <= endTime
- );
- });
-
- if (filteredResources.length > 0) {
- filteredResources = filteredResources.filter(resource => {
- return !ignoredResources.has(resource);
- });
- }
-
- return filteredResources;
-}
-
-/**
- * Parses url using anchor element
- * @param url
- */
-export function parseUrl(url: string): HTMLAnchorElement {
- const a = document.createElement('a');
- a.href = url;
- return a;
-}
-
-/**
- * Get element XPath
- * @param target - target element
- * @param optimised - when id attribute of element is present the xpath can be
- * simplified to contain id
- */
-export function getElementXPath(target: any, optimised?: boolean) {
- if (target.nodeType === Node.DOCUMENT_NODE) {
- return '/';
- }
- const targetValue = getNodeValue(target, optimised);
- if (optimised && targetValue.indexOf('@id') > 0) {
- return targetValue;
- }
- let xpath = '';
- if (target.parentNode) {
- xpath += getElementXPath(target.parentNode, false);
- }
- xpath += targetValue;
-
- return xpath;
-}
-
-/**
- * get node index within the siblings
- * @param target
- */
-function getNodeIndex(target: HTMLElement): number {
- if (!target.parentNode) {
- return 0;
- }
- const allowedTypes = [target.nodeType];
- if (target.nodeType === Node.CDATA_SECTION_NODE) {
- allowedTypes.push(Node.TEXT_NODE);
- }
- let elements = Array.from(target.parentNode.childNodes);
- elements = elements.filter((element: Node) => {
- const localName = (element as HTMLElement).localName;
- return (
- allowedTypes.indexOf(element.nodeType) >= 0 &&
- localName === target.localName
- );
- });
- if (elements.length >= 1) {
- return elements.indexOf(target) + 1; // xpath starts from 1
- }
- // if there are no other similar child xpath doesn't need index
- return 0;
-}
-
-/**
- * get node value for xpath
- * @param target
- * @param optimised
- */
-function getNodeValue(target: HTMLElement, optimised?: boolean): string {
- const nodeType = target.nodeType;
- const index = getNodeIndex(target);
- let nodeValue = '';
- if (nodeType === Node.ELEMENT_NODE) {
- const id = target.getAttribute('id');
- if (optimised && id) {
- return `//*[@id="${id}"]`;
- }
- nodeValue = target.localName;
- } else if (
- nodeType === Node.TEXT_NODE ||
- nodeType === Node.CDATA_SECTION_NODE
- ) {
- nodeValue = 'text()';
- } else if (nodeType === Node.COMMENT_NODE) {
- nodeValue = 'comment()';
- } else {
- return '';
- }
- // if index is 1 it can be omitted in xpath
- if (nodeValue && index > 1) {
- return `/${nodeValue}[${index}]`;
- }
- return `/${nodeValue}`;
-}
diff --git a/packages/opentelemetry-web/src/version.ts b/packages/opentelemetry-web/src/version.ts
deleted file mode 100644
index 74e9e92337..0000000000
--- a/packages/opentelemetry-web/src/version.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// this is autogenerated file, see scripts/version-update.js
-export const VERSION = '0.6.1';
diff --git a/packages/opentelemetry-web/test/StackContextManager.test.ts b/packages/opentelemetry-web/test/StackContextManager.test.ts
deleted file mode 100644
index 5c0fe26b22..0000000000
--- a/packages/opentelemetry-web/test/StackContextManager.test.ts
+++ /dev/null
@@ -1,198 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import * as assert from 'assert';
-import { StackContextManager } from '../src';
-import { Context } from '@opentelemetry/api';
-
-describe('StackContextManager', () => {
- let contextManager: StackContextManager;
- const key1 = Context.createKey('test key 1');
-
- beforeEach(() => {
- contextManager = new StackContextManager();
- contextManager.enable();
- });
-
- afterEach(() => {
- contextManager.disable();
- });
-
- describe('.enable()', () => {
- it('should work', () => {
- assert.doesNotThrow(() => {
- assert(
- contextManager.enable() === contextManager,
- 'should return this'
- );
- assert(
- contextManager.active() === Context.ROOT_CONTEXT,
- 'should have root context'
- );
- });
- });
- });
-
- describe('.disable()', () => {
- it('should work', () => {
- assert.doesNotThrow(() => {
- assert(
- contextManager.disable() === contextManager,
- 'should return this'
- );
- assert(
- contextManager.active() === Context.ROOT_CONTEXT,
- 'should have no context'
- );
- });
- });
- });
-
- describe('.with()', () => {
- it('should run the callback (null as target)', done => {
- contextManager.with(null, done);
- });
-
- it('should run the callback (object as target)', done => {
- const test = Context.ROOT_CONTEXT.setValue(key1, 1);
- contextManager.with(test, () => {
- assert.strictEqual(
- contextManager.active(),
- test,
- 'should have context'
- );
- return done();
- });
- });
-
- it('should run the callback (when disabled)', done => {
- contextManager.disable();
- contextManager.with(null, () => {
- contextManager.enable();
- return done();
- });
- });
-
- it('should rethrow errors', done => {
- assert.throws(() => {
- contextManager.with(null, () => {
- throw new Error('This should be rethrown');
- });
- });
- return done();
- });
-
- it('should finally restore an old context', done => {
- const ctx1 = Context.ROOT_CONTEXT.setValue(key1, 'ctx1');
- const ctx2 = Context.ROOT_CONTEXT.setValue(key1, 'ctx2');
- const ctx3 = Context.ROOT_CONTEXT.setValue(key1, 'ctx3');
- contextManager.with(ctx1, () => {
- assert.strictEqual(contextManager.active(), ctx1);
- contextManager.with(ctx2, () => {
- assert.strictEqual(contextManager.active(), ctx2);
- contextManager.with(ctx3, () => {
- assert.strictEqual(contextManager.active(), ctx3);
- });
- assert.strictEqual(contextManager.active(), ctx2);
- });
- assert.strictEqual(contextManager.active(), ctx1);
- return done();
- });
- assert.strictEqual(contextManager.active(), window);
- });
-
- it('should finally restore an old context when context is an object', done => {
- const ctx1 = Context.ROOT_CONTEXT.setValue(key1, 1);
- const ctx2 = Context.ROOT_CONTEXT.setValue(key1, 2);
- const ctx3 = Context.ROOT_CONTEXT.setValue(key1, 3);
- contextManager.with(ctx1, () => {
- assert.strictEqual(contextManager.active(), ctx1);
- contextManager.with(ctx2, () => {
- assert.strictEqual(contextManager.active(), ctx2);
- contextManager.with(ctx3, () => {
- assert.strictEqual(contextManager.active(), ctx3);
- });
- assert.strictEqual(contextManager.active(), ctx2);
- });
- assert.strictEqual(contextManager.active(), ctx1);
- return done();
- });
- assert.strictEqual(contextManager.active(), window);
- });
- });
-
- describe('.bind(function)', () => {
- it('should call the function with previously assigned context', () => {
- class Obj {
- title: string;
-
- constructor(title: string) {
- this.title = title;
- }
-
- getTitle() {
- return (contextManager.active().getValue(key1) as Obj).title;
- }
- }
-
- const obj1 = new Obj('a1');
- const ctx = Context.ROOT_CONTEXT.setValue(key1, obj1);
- obj1.title = 'a2';
- const obj2 = new Obj('b1');
- const wrapper: any = contextManager.bind(obj2.getTitle, ctx);
- assert.ok(wrapper(), 'a2');
- });
-
- it('should return the same target (when enabled)', () => {
- const test = Context.ROOT_CONTEXT.setValue(key1, 1);
- assert.deepStrictEqual(contextManager.bind(test), test);
- });
-
- it('should return the same target (when disabled)', () => {
- contextManager.disable();
- const test = Context.ROOT_CONTEXT.setValue(key1, 1);
- assert.deepStrictEqual(contextManager.bind(test), test);
- contextManager.enable();
- });
-
- it('should return current context (when enabled)', done => {
- const context = Context.ROOT_CONTEXT.setValue(key1, 1);
- const fn: any = contextManager.bind(() => {
- assert.strictEqual(
- contextManager.active(),
- context,
- 'should have context'
- );
- return done();
- }, context);
- fn();
- });
-
- it('should return current context (when disabled)', done => {
- contextManager.disable();
- const context = Context.ROOT_CONTEXT.setValue(key1, 1);
- const fn: any = contextManager.bind(() => {
- assert.strictEqual(
- contextManager.active(),
- context,
- 'should have context'
- );
- return done();
- }, context);
- fn();
- });
- });
-});
diff --git a/packages/opentelemetry-web/test/WebTracerProvider.test.ts b/packages/opentelemetry-web/test/WebTracerProvider.test.ts
deleted file mode 100644
index e22d4cef86..0000000000
--- a/packages/opentelemetry-web/test/WebTracerProvider.test.ts
+++ /dev/null
@@ -1,169 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { context } from '@opentelemetry/api';
-import { B3Propagator, BasePlugin, NoopLogger } from '@opentelemetry/core';
-import { ContextManager } from '@opentelemetry/context-base';
-import { ZoneContextManager } from '@opentelemetry/context-zone';
-import { Tracer, Span } from '@opentelemetry/tracing';
-import { Resource, TELEMETRY_SDK_RESOURCE } from '@opentelemetry/resources';
-import * as assert from 'assert';
-import * as sinon from 'sinon';
-import { WebTracerConfig } from '../src';
-import { WebTracerProvider } from '../src/WebTracerProvider';
-
-class DummyPlugin extends BasePlugin {
- constructor() {
- super('dummy');
- }
- moduleName = 'dummy';
-
- patch() {}
- unpatch() {}
-}
-
-describe('WebTracerProvider', () => {
- describe('constructor', () => {
- let defaultOptions: WebTracerConfig;
- let contextManager: ContextManager;
-
- beforeEach(() => {
- defaultOptions = {};
- contextManager = new ZoneContextManager().enable();
- context.setGlobalContextManager(contextManager);
- });
-
- afterEach(() => {
- contextManager.disable();
- });
-
- it('should construct an instance with required only options', () => {
- const tracer = new WebTracerProvider(
- Object.assign({}, defaultOptions)
- ).getTracer('default');
- assert.ok(tracer instanceof Tracer);
- });
-
- it('should enable all plugins', () => {
- let options: WebTracerConfig;
- const dummyPlugin1 = new DummyPlugin();
- const dummyPlugin2 = new DummyPlugin();
- const spyEnable1 = sinon.spy(dummyPlugin1, 'enable');
- const spyEnable2 = sinon.spy(dummyPlugin2, 'enable');
-
- const plugins = [dummyPlugin1, dummyPlugin2];
-
- options = { plugins };
- new WebTracerProvider(options);
-
- assert.ok(spyEnable1.calledOnce === true);
- assert.ok(spyEnable2.calledOnce === true);
- });
-
- it('should work without default context manager', () => {
- assert.doesNotThrow(() => {
- new WebTracerProvider({});
- });
- });
-
- it('should throw error when context manager is passed in constructor', () => {
- let error = '';
- try {
- new WebTracerProvider({
- contextManager: new ZoneContextManager(),
- } as any);
- } catch (e) {
- error = e;
- }
- assert.strictEqual(
- error,
- 'contextManager should be defined in' +
- ' register method not in constructor'
- );
- });
-
- it('should throw error when propagator is passed in constructor', () => {
- let error = '';
- try {
- new WebTracerProvider({
- propagator: new B3Propagator(),
- } as any);
- } catch (e) {
- error = e;
- }
- assert.strictEqual(
- error,
- 'propagator should be defined in register' +
- ' method not in constructor'
- );
- });
-
- describe('when contextManager is "ZoneContextManager"', () => {
- it('should correctly return the contexts for 2 parallel actions', done => {
- const webTracerWithZone = new WebTracerProvider().getTracer('default');
-
- const rootSpan = webTracerWithZone.startSpan('rootSpan');
-
- webTracerWithZone.withSpan(rootSpan, () => {
- assert.ok(
- webTracerWithZone.getCurrentSpan() === rootSpan,
- 'Current span is rootSpan'
- );
- const concurrentSpan1 = webTracerWithZone.startSpan(
- 'concurrentSpan1'
- );
- const concurrentSpan2 = webTracerWithZone.startSpan(
- 'concurrentSpan2'
- );
-
- webTracerWithZone.withSpan(concurrentSpan1, () => {
- setTimeout(() => {
- assert.ok(
- webTracerWithZone.getCurrentSpan() === concurrentSpan1,
- 'Current span is concurrentSpan1'
- );
- }, 10);
- });
-
- webTracerWithZone.withSpan(concurrentSpan2, () => {
- setTimeout(() => {
- assert.ok(
- webTracerWithZone.getCurrentSpan() === concurrentSpan2,
- 'Current span is concurrentSpan2'
- );
- done();
- }, 20);
- });
- });
- });
- });
-
- describe('.startSpan()', () => {
- it('should assign resource to span', () => {
- const provider = new WebTracerProvider({
- logger: new NoopLogger(),
- });
- const span = provider.getTracer('default').startSpan('my-span') as Span;
- assert.ok(span);
- assert.ok(span.resource instanceof Resource);
- assert.equal(
- span.resource.labels[TELEMETRY_SDK_RESOURCE.LANGUAGE],
- 'webjs'
- );
- });
- });
- });
-});
diff --git a/packages/opentelemetry-web/test/index-webpack.ts b/packages/opentelemetry-web/test/index-webpack.ts
deleted file mode 100644
index 7731f09091..0000000000
--- a/packages/opentelemetry-web/test/index-webpack.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// This file is the webpack entry point for the browser Karma tests. It requires
-// all modules ending in "test" from the current folder and all its subfolders.
-const testsContext = require.context('.', true, /test$/);
-testsContext.keys().forEach(testsContext);
-
-const srcContext = require.context('.', true, /src$/);
-srcContext.keys().forEach(srcContext);
diff --git a/packages/opentelemetry-web/test/registration.test.ts b/packages/opentelemetry-web/test/registration.test.ts
deleted file mode 100644
index 497bc868d0..0000000000
--- a/packages/opentelemetry-web/test/registration.test.ts
+++ /dev/null
@@ -1,85 +0,0 @@
-/*!
- * Copyright 2020, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- context,
- NoopHttpTextPropagator,
- NoopTracerProvider,
- propagation,
- trace,
-} from '@opentelemetry/api';
-import { HttpTraceContext } from '@opentelemetry/core';
-import { NoopContextManager } from '@opentelemetry/context-base';
-import * as assert from 'assert';
-import { WebTracerProvider, StackContextManager } from '../src';
-
-describe('API registration', () => {
- beforeEach(() => {
- context.setGlobalContextManager(new NoopContextManager());
- propagation.setGlobalPropagator(new NoopHttpTextPropagator());
- trace.setGlobalTracerProvider(new NoopTracerProvider());
- });
-
- it('should register default implementations', () => {
- const tracerProvider = new WebTracerProvider();
- tracerProvider.register();
-
- assert.ok(context['_contextManager'] instanceof StackContextManager);
- assert.ok(propagation['_propagator'] instanceof HttpTraceContext);
- assert.ok(trace['_tracerProvider'] === tracerProvider);
- });
-
- it('should register configured implementations', () => {
- const tracerProvider = new WebTracerProvider();
-
- const contextManager = new NoopContextManager();
- const propagator = new NoopHttpTextPropagator();
-
- tracerProvider.register({
- contextManager,
- propagator,
- });
-
- assert.ok(context['_contextManager'] === contextManager);
- assert.ok(propagation['_propagator'] === propagator);
-
- assert.ok(trace['_tracerProvider'] === tracerProvider);
- });
-
- it('should skip null context manager', () => {
- const tracerProvider = new WebTracerProvider();
- tracerProvider.register({
- contextManager: null,
- });
-
- assert.ok(context['_contextManager'] instanceof NoopContextManager);
-
- assert.ok(propagation['_propagator'] instanceof HttpTraceContext);
- assert.ok(trace['_tracerProvider'] === tracerProvider);
- });
-
- it('should skip null propagator', () => {
- const tracerProvider = new WebTracerProvider();
- tracerProvider.register({
- propagator: null,
- });
-
- assert.ok(propagation['_propagator'] instanceof NoopHttpTextPropagator);
-
- assert.ok(context['_contextManager'] instanceof StackContextManager);
- assert.ok(trace['_tracerProvider'] === tracerProvider);
- });
-});
diff --git a/packages/opentelemetry-web/test/utils.test.ts b/packages/opentelemetry-web/test/utils.test.ts
deleted file mode 100644
index 96745f5514..0000000000
--- a/packages/opentelemetry-web/test/utils.test.ts
+++ /dev/null
@@ -1,521 +0,0 @@
-/*!
- * Copyright 2019, OpenTelemetry Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- hrTimeToNanoseconds,
- otperformance as performance,
-} from '@opentelemetry/core';
-import * as core from '@opentelemetry/core';
-import * as tracing from '@opentelemetry/tracing';
-import { HrTime } from '@opentelemetry/api';
-
-import * as assert from 'assert';
-import * as sinon from 'sinon';
-import {
- addSpanNetworkEvent,
- getElementXPath,
- getResource,
- PerformanceEntries,
-} from '../src';
-import { PerformanceTimingNames as PTN } from '../src/enums/PerformanceTimingNames';
-
-const SECOND_TO_NANOSECONDS = 1e9;
-
-function createHrTime(startTime: HrTime, addToStart: number): HrTime {
- let seconds = startTime[0];
- let nanos = startTime[1] + addToStart;
- if (nanos >= SECOND_TO_NANOSECONDS) {
- nanos = SECOND_TO_NANOSECONDS - nanos;
- seconds++;
- }
- return [seconds, nanos];
-}
-const fixture = `
-
-
-
-
-
-
-
-
-
lorep ipsum
-
-
- foo
-
-
-
-
- bar
-
-
- aaaaaaaaa
-
-
- bbb
-
-
-
-
-
-
-
-
- bar
-
-
-
-
-
-`;
-
-function createResource(
- resource = {},
- startTime: HrTime,
- addToStart: number
-): PerformanceResourceTiming {
- const fetchStart = core.hrTimeToNanoseconds(startTime) + 1;
- const responseEnd = fetchStart + addToStart;
- const million = 1000 * 1000; // used to convert nano to milli
- const defaultResource = {
- connectEnd: 0,
- connectStart: 0,
- decodedBodySize: 0,
- domainLookupEnd: 0,
- domainLookupStart: 0,
- encodedBodySize: 0,
- fetchStart: fetchStart / million,
- initiatorType: 'xmlhttprequest',
- nextHopProtocol: '',
- redirectEnd: 0,
- redirectStart: 0,
- requestStart: 0,
- responseEnd: responseEnd / million,
- responseStart: 0,
- secureConnectionStart: 0,
- transferSize: 0,
- workerStart: 0,
- duration: 0,
- entryType: '',
- name: '',
- startTime: 0,
- };
- return Object.assign(
- {},
- defaultResource,
- resource
- ) as PerformanceResourceTiming;
-}
-
-describe('utils', () => {
- let sandbox: sinon.SinonSandbox;
-
- beforeEach(() => {
- sandbox = sinon.createSandbox();
- });
-
- afterEach(() => {
- sandbox.restore();
- });
-
- describe('addSpanNetworkEvent', () => {
- describe('when entries contain the performance', () => {
- it('should add event to span', () => {
- const addEventSpy = sinon.spy();
- const span = ({
- addEvent: addEventSpy,
- } as unknown) as tracing.Span;
- const entries = {
- [PTN.FETCH_START]: 123,
- } as PerformanceEntries;
-
- assert.strictEqual(addEventSpy.callCount, 0);
-
- addSpanNetworkEvent(span, PTN.FETCH_START, entries);
-
- assert.strictEqual(addEventSpy.callCount, 1);
- const args = addEventSpy.args[0];
-
- assert.strictEqual(args[0], 'fetchStart');
- assert.strictEqual(args[1], 123);
- });
- });
- describe('when entry has time equal to 0', () => {
- it('should NOT add event to span', () => {
- const addEventSpy = sinon.spy();
- const span = ({
- addEvent: addEventSpy,
- } as unknown) as tracing.Span;
- const entries = {
- [PTN.FETCH_START]: 0,
- } as PerformanceEntries;
-
- assert.strictEqual(addEventSpy.callCount, 0);
-
- addSpanNetworkEvent(span, PTN.FETCH_START, entries);
-
- assert.strictEqual(addEventSpy.callCount, 0);
- });
- });
- describe('when entries does NOT contain the performance', () => {
- it('should NOT add event to span', () => {
- const addEventSpy = sinon.spy();
- const span = ({
- addEvent: addEventSpy,
- } as unknown) as tracing.Span;
- const entries = {
- [PTN.FETCH_START]: 123,
- } as PerformanceEntries;
-
- assert.strictEqual(addEventSpy.callCount, 0);
-
- addSpanNetworkEvent(span, 'foo', entries);
-
- assert.strictEqual(
- addEventSpy.callCount,
- 0,
- 'should not call addEvent'
- );
- });
- });
- });
- describe('getResource', () => {
- const startTime = [0, 123123123] as HrTime;
- let spyHrTime: any;
- beforeEach(() => {
- const time = createHrTime(startTime, 500);
- sandbox.stub(performance, 'timeOrigin').value(0);
- sandbox
- .stub(performance, 'now')
- .callsFake(() => hrTimeToNanoseconds(time));
-
- spyHrTime = sinon.stub(core, 'hrTime').returns(time);
- });
- afterEach(() => {
- spyHrTime.restore();
- });
-
- describe('when resources are empty', () => {
- it('should return undefined', () => {
- const spanStartTime = createHrTime(startTime, 1);
- const spanEndTime = createHrTime(startTime, 100);
- const spanUrl = 'http://foo.com/bar.json';
- const resources: PerformanceResourceTiming[] = [];
-
- const resource = getResource(
- spanUrl,
- spanStartTime,
- spanEndTime,
- resources
- );
-
- assert.deepStrictEqual(
- resource.mainRequest,
- undefined,
- 'main request should be undefined'
- );
- });
- });
-
- describe('when resources has correct entry', () => {
- it('should return the closest one', () => {
- const spanStartTime = createHrTime(startTime, 1);
- const spanEndTime = createHrTime(startTime, 402);
- const spanUrl = 'http://foo.com/bar.json';
- const resources: PerformanceResourceTiming[] = [];
-
- // this one started earlier
- resources.push(
- createResource(
- {
- name: 'http://foo.com/bar.json',
- },
- createHrTime(startTime, -1),
- 100
- )
- );
-
- // this one is correct
- resources.push(
- createResource(
- {
- name: 'http://foo.com/bar.json',
- },
- createHrTime(startTime, 1),
- 400
- )
- );
-
- // this one finished after span
- resources.push(
- createResource(
- {
- name: 'http://foo.com/bar.json',
- },
- createHrTime(startTime, 1),
- 1000
- )
- );
-
- const resource = getResource(
- spanUrl,
- spanStartTime,
- spanEndTime,
- resources
- );
-
- assert.deepStrictEqual(
- resource.mainRequest,
- resources[1],
- 'main request should be defined'
- );
- });
- describe('But one resource has been already used', () => {
- it('should return the next closest', () => {
- const spanStartTime = createHrTime(startTime, 1);
- const spanEndTime = createHrTime(startTime, 402);
- const spanUrl = 'http://foo.com/bar.json';
- const resources: PerformanceResourceTiming[] = [];
-
- // this one started earlier
- resources.push(
- createResource(
- {
- name: 'http://foo.com/bar.json',
- },
- createHrTime(startTime, -1),
- 100
- )
- );
-
- // this one is correct but ignored
- resources.push(
- createResource(
- {
- name: 'http://foo.com/bar.json',
- },
- createHrTime(startTime, 1),
- 400
- )
- );
-
- // this one is also correct
- resources.push(
- createResource(
- {
- name: 'http://foo.com/bar.json',
- },
- createHrTime(startTime, 1),
- 300
- )
- );
-
- // this one finished after span
- resources.push(
- createResource(
- {
- name: 'http://foo.com/bar.json',
- },
- createHrTime(startTime, 1),
- 1000
- )
- );
-
- const ignoredResources = new WeakSet();
- ignoredResources.add(resources[1]);
- const resource = getResource(
- spanUrl,
- spanStartTime,
- spanEndTime,
- resources,
- ignoredResources
- );
-
- assert.deepStrictEqual(
- resource.mainRequest,
- resources[2],
- 'main request should be defined'
- );
- });
- });
- });
-
- describe('when there are multiple resources from CorsPreflight requests', () => {
- it('should return main request and cors preflight request', () => {
- const spanStartTime = createHrTime(startTime, 1);
- const spanEndTime = createHrTime(startTime, 182);
- const spanUrl = 'http://foo.com/bar.json';
- const resources: PerformanceResourceTiming[] = [];
-
- // this one started earlier
- resources.push(
- createResource(
- {
- name: 'http://foo.com/bar.json',
- },
- createHrTime(startTime, 1),
- 10
- )
- );
-
- // this one is correct
- resources.push(
- createResource(
- {
- name: 'http://foo.com/bar.json',
- },
- createHrTime(startTime, 1),
- 11
- )
- );
-
- // this one finished after span
- resources.push(
- createResource(
- {
- name: 'http://foo.com/bar.json',
- },
- createHrTime(startTime, 50),
- 100
- )
- );
-
- // this one finished after span
- resources.push(
- createResource(
- {
- name: 'http://foo.com/bar.json',
- },
- createHrTime(startTime, 50),
- 130
- )
- );
-
- const resource = getResource(
- spanUrl,
- spanStartTime,
- spanEndTime,
- resources,
- undefined
- );
-
- assert.deepStrictEqual(
- resource.corsPreFlightRequest,
- resources[0],
- 'cors preflight request should be defined'
- );
-
- assert.deepStrictEqual(
- resource.mainRequest,
- resources[3],
- 'main request should be defined'
- );
- });
- });
- });
- describe('getElementXPath', () => {
- let $fixture: any;
- let child: any;
- before(() => {
- $fixture = $(fixture);
- const body = document.querySelector('body');
- if (body) {
- body.appendChild($fixture[0]);
- child = body.lastChild;
- }
- });
- after(() => {
- child.parentNode.removeChild(child);
- });
-
- it('should return correct path for element with id and optimise = true', () => {
- const element = getElementXPath($fixture.find('#btn22')[0], true);
- assert.strictEqual(element, '//*[@id="btn22"]');
- assert.strictEqual(
- $fixture.find('#btn22')[0],
- getElementByXpath(element)
- );
- });
-
- it(
- 'should return correct path for element with id and surrounded by the' +
- ' same type',
- () => {
- const element = getElementXPath($fixture.find('#btn22')[0]);
- assert.strictEqual(element, '//html/body/div/div[4]/div[5]/button[3]');
- assert.strictEqual(
- $fixture.find('#btn22')[0],
- getElementByXpath(element)
- );
- }
- );
-
- it(
- 'should return correct path for element with id and and surrounded by' +
- ' text nodes mixed with cnode',
- () => {
- const element = getElementXPath($fixture.find('#btn23')[0]);
- assert.strictEqual(element, '//html/body/div/div[4]/div[6]/button');
- assert.strictEqual(
- $fixture.find('#btn23')[0],
- getElementByXpath(element)
- );
- }
- );
-
- it(
- 'should return correct path for text node element surrounded by cdata' +
- ' nodes',
- () => {
- const text = $fixture.find('#cdata')[0];
- const textNode = document.createTextNode('foobar');
- text.appendChild(textNode);
- const element = getElementXPath(textNode);
- assert.strictEqual(element, '//html/body/div/div[4]/div[10]/text()[5]');
- assert.strictEqual(textNode, getElementByXpath(element));
- }
- );
-
- it('should return correct path when element is text node', () => {
- const text = $fixture.find('#text')[0];
- const textNode = document.createTextNode('foobar');
- text.appendChild(textNode);
- const element = getElementXPath(textNode);
- assert.strictEqual(element, '//html/body/div/div[4]/div[3]/text()[2]');
- assert.strictEqual(textNode, getElementByXpath(element));
- });
-
- it('should return correct path when element is comment node', () => {
- const comment = $fixture.find('#comment')[0];
- const node = document.createComment('foobar');
- comment.appendChild(node);
- const element = getElementXPath(node);
- assert.strictEqual(element, '//html/body/div/div[4]/div[8]/comment()');
- assert.strictEqual(node, getElementByXpath(element));
- });
- });
-});
-
-function getElementByXpath(path: string) {
- return document.evaluate(
- path,
- document,
- null,
- XPathResult.FIRST_ORDERED_NODE_TYPE,
- null
- ).singleNodeValue;
-}
diff --git a/packages/opentelemetry-web/tsconfig.json b/packages/opentelemetry-web/tsconfig.json
deleted file mode 100644
index a2042cd68b..0000000000
--- a/packages/opentelemetry-web/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "extends": "../tsconfig.base",
- "compilerOptions": {
- "rootDir": ".",
- "outDir": "build"
- },
- "include": [
- "src/**/*.ts",
- "test/**/*.ts"
- ]
-}
diff --git a/packages/opentelemetry-web/tslint.json b/packages/opentelemetry-web/tslint.json
deleted file mode 100644
index 0710b135d0..0000000000
--- a/packages/opentelemetry-web/tslint.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
- "extends": ["../../tslint.base.js", "./node_modules/tslint-consistent-codestyle"]
-}
diff --git a/packages/opentelemetry-context-async-hooks/.npmignore b/plugins/opentelemetry-plugin-dns/.npmignore
similarity index 100%
rename from packages/opentelemetry-context-async-hooks/.npmignore
rename to plugins/opentelemetry-plugin-dns/.npmignore
diff --git a/packages/opentelemetry-api/LICENSE b/plugins/opentelemetry-plugin-dns/LICENSE
similarity index 100%
rename from packages/opentelemetry-api/LICENSE
rename to plugins/opentelemetry-plugin-dns/LICENSE
diff --git a/packages/opentelemetry-plugin-dns/README.md b/plugins/opentelemetry-plugin-dns/README.md
similarity index 100%
rename from packages/opentelemetry-plugin-dns/README.md
rename to plugins/opentelemetry-plugin-dns/README.md
diff --git a/packages/opentelemetry-plugin-dns/package.json b/plugins/opentelemetry-plugin-dns/package.json
similarity index 100%
rename from packages/opentelemetry-plugin-dns/package.json
rename to plugins/opentelemetry-plugin-dns/package.json
diff --git a/packages/opentelemetry-plugin-dns/src/dns.ts b/plugins/opentelemetry-plugin-dns/src/dns.ts
similarity index 100%
rename from packages/opentelemetry-plugin-dns/src/dns.ts
rename to plugins/opentelemetry-plugin-dns/src/dns.ts
diff --git a/packages/opentelemetry-plugin-dns/src/enums/AddressFamily.ts b/plugins/opentelemetry-plugin-dns/src/enums/AddressFamily.ts
similarity index 100%
rename from packages/opentelemetry-plugin-dns/src/enums/AddressFamily.ts
rename to plugins/opentelemetry-plugin-dns/src/enums/AddressFamily.ts
diff --git a/packages/opentelemetry-plugin-dns/src/enums/AttributeNames.ts b/plugins/opentelemetry-plugin-dns/src/enums/AttributeNames.ts
similarity index 100%
rename from packages/opentelemetry-plugin-dns/src/enums/AttributeNames.ts
rename to plugins/opentelemetry-plugin-dns/src/enums/AttributeNames.ts
diff --git a/packages/opentelemetry-plugin-dns/src/index.ts b/plugins/opentelemetry-plugin-dns/src/index.ts
similarity index 100%
rename from packages/opentelemetry-plugin-dns/src/index.ts
rename to plugins/opentelemetry-plugin-dns/src/index.ts
diff --git a/packages/opentelemetry-plugin-dns/src/types.ts b/plugins/opentelemetry-plugin-dns/src/types.ts
similarity index 100%
rename from packages/opentelemetry-plugin-dns/src/types.ts
rename to plugins/opentelemetry-plugin-dns/src/types.ts
diff --git a/packages/opentelemetry-plugin-dns/src/utils.ts b/plugins/opentelemetry-plugin-dns/src/utils.ts
similarity index 100%
rename from packages/opentelemetry-plugin-dns/src/utils.ts
rename to plugins/opentelemetry-plugin-dns/src/utils.ts
diff --git a/packages/opentelemetry-api/src/version.ts b/plugins/opentelemetry-plugin-dns/src/version.ts
similarity index 100%
rename from packages/opentelemetry-api/src/version.ts
rename to plugins/opentelemetry-plugin-dns/src/version.ts
diff --git a/packages/opentelemetry-plugin-dns/test/functionals/dns-disable.test.ts b/plugins/opentelemetry-plugin-dns/test/functionals/dns-disable.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-dns/test/functionals/dns-disable.test.ts
rename to plugins/opentelemetry-plugin-dns/test/functionals/dns-disable.test.ts
diff --git a/packages/opentelemetry-plugin-dns/test/functionals/dns-enable.test.ts b/plugins/opentelemetry-plugin-dns/test/functionals/dns-enable.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-dns/test/functionals/dns-enable.test.ts
rename to plugins/opentelemetry-plugin-dns/test/functionals/dns-enable.test.ts
diff --git a/packages/opentelemetry-plugin-dns/test/functionals/utils.test.ts b/plugins/opentelemetry-plugin-dns/test/functionals/utils.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-dns/test/functionals/utils.test.ts
rename to plugins/opentelemetry-plugin-dns/test/functionals/utils.test.ts
diff --git a/packages/opentelemetry-plugin-dns/test/integrations/dns-lookup.test.ts b/plugins/opentelemetry-plugin-dns/test/integrations/dns-lookup.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-dns/test/integrations/dns-lookup.test.ts
rename to plugins/opentelemetry-plugin-dns/test/integrations/dns-lookup.test.ts
diff --git a/packages/opentelemetry-plugin-dns/test/integrations/dnspromise-lookup.test.ts b/plugins/opentelemetry-plugin-dns/test/integrations/dnspromise-lookup.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-dns/test/integrations/dnspromise-lookup.test.ts
rename to plugins/opentelemetry-plugin-dns/test/integrations/dnspromise-lookup.test.ts
diff --git a/packages/opentelemetry-plugin-dns/test/utils/assertSpan.ts b/plugins/opentelemetry-plugin-dns/test/utils/assertSpan.ts
similarity index 100%
rename from packages/opentelemetry-plugin-dns/test/utils/assertSpan.ts
rename to plugins/opentelemetry-plugin-dns/test/utils/assertSpan.ts
diff --git a/packages/opentelemetry-plugin-dns/test/utils/utils.ts b/plugins/opentelemetry-plugin-dns/test/utils/utils.ts
similarity index 100%
rename from packages/opentelemetry-plugin-dns/test/utils/utils.ts
rename to plugins/opentelemetry-plugin-dns/test/utils/utils.ts
diff --git a/packages/opentelemetry-base/tsconfig.json b/plugins/opentelemetry-plugin-dns/tsconfig.json
similarity index 100%
rename from packages/opentelemetry-base/tsconfig.json
rename to plugins/opentelemetry-plugin-dns/tsconfig.json
diff --git a/packages/opentelemetry-api/tslint.json b/plugins/opentelemetry-plugin-dns/tslint.json
similarity index 100%
rename from packages/opentelemetry-api/tslint.json
rename to plugins/opentelemetry-plugin-dns/tslint.json
diff --git a/packages/opentelemetry-base/LICENSE b/plugins/opentelemetry-plugin-document-load/LICENSE
similarity index 100%
rename from packages/opentelemetry-base/LICENSE
rename to plugins/opentelemetry-plugin-document-load/LICENSE
diff --git a/packages/opentelemetry-plugin-document-load/README.md b/plugins/opentelemetry-plugin-document-load/README.md
similarity index 100%
rename from packages/opentelemetry-plugin-document-load/README.md
rename to plugins/opentelemetry-plugin-document-load/README.md
diff --git a/packages/opentelemetry-api/karma.conf.js b/plugins/opentelemetry-plugin-document-load/karma.conf.js
similarity index 100%
rename from packages/opentelemetry-api/karma.conf.js
rename to plugins/opentelemetry-plugin-document-load/karma.conf.js
diff --git a/packages/opentelemetry-plugin-document-load/package.json b/plugins/opentelemetry-plugin-document-load/package.json
similarity index 98%
rename from packages/opentelemetry-plugin-document-load/package.json
rename to plugins/opentelemetry-plugin-document-load/package.json
index b776b7aa54..592d905b21 100644
--- a/packages/opentelemetry-plugin-document-load/package.json
+++ b/plugins/opentelemetry-plugin-document-load/package.json
@@ -43,6 +43,7 @@
},
"devDependencies": {
"@babel/core": "^7.6.0",
+ "@opentelemetry/base": "^0.6.1",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"@types/sinon": "^7.0.13",
diff --git a/packages/opentelemetry-plugin-document-load/src/documentLoad.ts b/plugins/opentelemetry-plugin-document-load/src/documentLoad.ts
similarity index 100%
rename from packages/opentelemetry-plugin-document-load/src/documentLoad.ts
rename to plugins/opentelemetry-plugin-document-load/src/documentLoad.ts
diff --git a/packages/opentelemetry-plugin-document-load/src/enums/AttributeNames.ts b/plugins/opentelemetry-plugin-document-load/src/enums/AttributeNames.ts
similarity index 100%
rename from packages/opentelemetry-plugin-document-load/src/enums/AttributeNames.ts
rename to plugins/opentelemetry-plugin-document-load/src/enums/AttributeNames.ts
diff --git a/packages/opentelemetry-plugin-document-load/src/index.ts b/plugins/opentelemetry-plugin-document-load/src/index.ts
similarity index 100%
rename from packages/opentelemetry-plugin-document-load/src/index.ts
rename to plugins/opentelemetry-plugin-document-load/src/index.ts
diff --git a/packages/opentelemetry-base/src/version.ts b/plugins/opentelemetry-plugin-document-load/src/version.ts
similarity index 100%
rename from packages/opentelemetry-base/src/version.ts
rename to plugins/opentelemetry-plugin-document-load/src/version.ts
diff --git a/packages/opentelemetry-plugin-document-load/test/documentLoad.test.ts b/plugins/opentelemetry-plugin-document-load/test/documentLoad.test.ts
similarity index 99%
rename from packages/opentelemetry-plugin-document-load/test/documentLoad.test.ts
rename to plugins/opentelemetry-plugin-document-load/test/documentLoad.test.ts
index 2ec83f7654..623e6cbfcf 100644
--- a/packages/opentelemetry-plugin-document-load/test/documentLoad.test.ts
+++ b/plugins/opentelemetry-plugin-document-load/test/documentLoad.test.ts
@@ -42,7 +42,7 @@ import {
} from '@opentelemetry/web';
import * as assert from 'assert';
import * as sinon from 'sinon';
-import { ExportResult } from '../../opentelemetry-base/build/src';
+import { ExportResult } from '@opentelemetry/base';
import { DocumentLoad } from '../src';
export class DummyExporter implements SpanExporter {
diff --git a/packages/opentelemetry-api/test/index-webpack.ts b/plugins/opentelemetry-plugin-document-load/test/index-webpack.ts
similarity index 100%
rename from packages/opentelemetry-api/test/index-webpack.ts
rename to plugins/opentelemetry-plugin-document-load/test/index-webpack.ts
diff --git a/packages/opentelemetry-context-async-hooks/tsconfig.json b/plugins/opentelemetry-plugin-document-load/tsconfig.json
similarity index 100%
rename from packages/opentelemetry-context-async-hooks/tsconfig.json
rename to plugins/opentelemetry-plugin-document-load/tsconfig.json
diff --git a/packages/opentelemetry-base/tslint.json b/plugins/opentelemetry-plugin-document-load/tslint.json
similarity index 100%
rename from packages/opentelemetry-base/tslint.json
rename to plugins/opentelemetry-plugin-document-load/tslint.json
diff --git a/packages/opentelemetry-context-base/.npmignore b/plugins/opentelemetry-plugin-express/.npmignore
similarity index 100%
rename from packages/opentelemetry-context-base/.npmignore
rename to plugins/opentelemetry-plugin-express/.npmignore
diff --git a/packages/opentelemetry-context-async-hooks/LICENSE b/plugins/opentelemetry-plugin-express/LICENSE
similarity index 100%
rename from packages/opentelemetry-context-async-hooks/LICENSE
rename to plugins/opentelemetry-plugin-express/LICENSE
diff --git a/packages/opentelemetry-plugin-express/README.md b/plugins/opentelemetry-plugin-express/README.md
similarity index 100%
rename from packages/opentelemetry-plugin-express/README.md
rename to plugins/opentelemetry-plugin-express/README.md
diff --git a/packages/opentelemetry-plugin-express/package.json b/plugins/opentelemetry-plugin-express/package.json
similarity index 100%
rename from packages/opentelemetry-plugin-express/package.json
rename to plugins/opentelemetry-plugin-express/package.json
diff --git a/packages/opentelemetry-plugin-express/src/express.ts b/plugins/opentelemetry-plugin-express/src/express.ts
similarity index 100%
rename from packages/opentelemetry-plugin-express/src/express.ts
rename to plugins/opentelemetry-plugin-express/src/express.ts
diff --git a/packages/opentelemetry-plugin-express/src/index.ts b/plugins/opentelemetry-plugin-express/src/index.ts
similarity index 100%
rename from packages/opentelemetry-plugin-express/src/index.ts
rename to plugins/opentelemetry-plugin-express/src/index.ts
diff --git a/packages/opentelemetry-plugin-express/src/types.ts b/plugins/opentelemetry-plugin-express/src/types.ts
similarity index 100%
rename from packages/opentelemetry-plugin-express/src/types.ts
rename to plugins/opentelemetry-plugin-express/src/types.ts
diff --git a/packages/opentelemetry-plugin-express/src/utils.ts b/plugins/opentelemetry-plugin-express/src/utils.ts
similarity index 100%
rename from packages/opentelemetry-plugin-express/src/utils.ts
rename to plugins/opentelemetry-plugin-express/src/utils.ts
diff --git a/packages/opentelemetry-context-async-hooks/src/version.ts b/plugins/opentelemetry-plugin-express/src/version.ts
similarity index 100%
rename from packages/opentelemetry-context-async-hooks/src/version.ts
rename to plugins/opentelemetry-plugin-express/src/version.ts
diff --git a/packages/opentelemetry-plugin-express/test/express.test.ts b/plugins/opentelemetry-plugin-express/test/express.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-express/test/express.test.ts
rename to plugins/opentelemetry-plugin-express/test/express.test.ts
diff --git a/packages/opentelemetry-plugin-express/test/utils.test.ts b/plugins/opentelemetry-plugin-express/test/utils.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-express/test/utils.test.ts
rename to plugins/opentelemetry-plugin-express/test/utils.test.ts
diff --git a/packages/opentelemetry-context-base/tsconfig.json b/plugins/opentelemetry-plugin-express/tsconfig.json
similarity index 100%
rename from packages/opentelemetry-context-base/tsconfig.json
rename to plugins/opentelemetry-plugin-express/tsconfig.json
diff --git a/packages/opentelemetry-context-async-hooks/tslint.json b/plugins/opentelemetry-plugin-express/tslint.json
similarity index 100%
rename from packages/opentelemetry-context-async-hooks/tslint.json
rename to plugins/opentelemetry-plugin-express/tslint.json
diff --git a/packages/opentelemetry-core/.npmignore b/plugins/opentelemetry-plugin-grpc/.npmignore
similarity index 100%
rename from packages/opentelemetry-core/.npmignore
rename to plugins/opentelemetry-plugin-grpc/.npmignore
diff --git a/packages/opentelemetry-context-base/LICENSE b/plugins/opentelemetry-plugin-grpc/LICENSE
similarity index 100%
rename from packages/opentelemetry-context-base/LICENSE
rename to plugins/opentelemetry-plugin-grpc/LICENSE
diff --git a/packages/opentelemetry-plugin-grpc/README.md b/plugins/opentelemetry-plugin-grpc/README.md
similarity index 100%
rename from packages/opentelemetry-plugin-grpc/README.md
rename to plugins/opentelemetry-plugin-grpc/README.md
diff --git a/packages/opentelemetry-plugin-grpc/package.json b/plugins/opentelemetry-plugin-grpc/package.json
similarity index 100%
rename from packages/opentelemetry-plugin-grpc/package.json
rename to plugins/opentelemetry-plugin-grpc/package.json
diff --git a/packages/opentelemetry-plugin-grpc/src/enums/AttributeNames.ts b/plugins/opentelemetry-plugin-grpc/src/enums/AttributeNames.ts
similarity index 100%
rename from packages/opentelemetry-plugin-grpc/src/enums/AttributeNames.ts
rename to plugins/opentelemetry-plugin-grpc/src/enums/AttributeNames.ts
diff --git a/packages/opentelemetry-plugin-grpc/src/grpc.ts b/plugins/opentelemetry-plugin-grpc/src/grpc.ts
similarity index 100%
rename from packages/opentelemetry-plugin-grpc/src/grpc.ts
rename to plugins/opentelemetry-plugin-grpc/src/grpc.ts
diff --git a/packages/opentelemetry-plugin-grpc/src/index.ts b/plugins/opentelemetry-plugin-grpc/src/index.ts
similarity index 100%
rename from packages/opentelemetry-plugin-grpc/src/index.ts
rename to plugins/opentelemetry-plugin-grpc/src/index.ts
diff --git a/packages/opentelemetry-plugin-grpc/src/types.ts b/plugins/opentelemetry-plugin-grpc/src/types.ts
similarity index 100%
rename from packages/opentelemetry-plugin-grpc/src/types.ts
rename to plugins/opentelemetry-plugin-grpc/src/types.ts
diff --git a/packages/opentelemetry-plugin-grpc/src/utils.ts b/plugins/opentelemetry-plugin-grpc/src/utils.ts
similarity index 100%
rename from packages/opentelemetry-plugin-grpc/src/utils.ts
rename to plugins/opentelemetry-plugin-grpc/src/utils.ts
diff --git a/packages/opentelemetry-context-base/src/version.ts b/plugins/opentelemetry-plugin-grpc/src/version.ts
similarity index 100%
rename from packages/opentelemetry-context-base/src/version.ts
rename to plugins/opentelemetry-plugin-grpc/src/version.ts
diff --git a/packages/opentelemetry-plugin-grpc/test/fixtures/grpc-test.proto b/plugins/opentelemetry-plugin-grpc/test/fixtures/grpc-test.proto
similarity index 100%
rename from packages/opentelemetry-plugin-grpc/test/fixtures/grpc-test.proto
rename to plugins/opentelemetry-plugin-grpc/test/fixtures/grpc-test.proto
diff --git a/packages/opentelemetry-plugin-grpc/test/grpc.test.ts b/plugins/opentelemetry-plugin-grpc/test/grpc.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-grpc/test/grpc.test.ts
rename to plugins/opentelemetry-plugin-grpc/test/grpc.test.ts
diff --git a/packages/opentelemetry-plugin-grpc/test/utils/assertionUtils.ts b/plugins/opentelemetry-plugin-grpc/test/utils/assertionUtils.ts
similarity index 100%
rename from packages/opentelemetry-plugin-grpc/test/utils/assertionUtils.ts
rename to plugins/opentelemetry-plugin-grpc/test/utils/assertionUtils.ts
diff --git a/packages/opentelemetry-core/tsconfig.json b/plugins/opentelemetry-plugin-grpc/tsconfig.json
similarity index 100%
rename from packages/opentelemetry-core/tsconfig.json
rename to plugins/opentelemetry-plugin-grpc/tsconfig.json
diff --git a/packages/opentelemetry-context-base/tslint.json b/plugins/opentelemetry-plugin-grpc/tslint.json
similarity index 100%
rename from packages/opentelemetry-context-base/tslint.json
rename to plugins/opentelemetry-plugin-grpc/tslint.json
diff --git a/packages/opentelemetry-exporter-collector/.npmignore b/plugins/opentelemetry-plugin-http/.npmignore
similarity index 100%
rename from packages/opentelemetry-exporter-collector/.npmignore
rename to plugins/opentelemetry-plugin-http/.npmignore
diff --git a/packages/opentelemetry-context-zone-peer-dep/LICENSE b/plugins/opentelemetry-plugin-http/LICENSE
similarity index 100%
rename from packages/opentelemetry-context-zone-peer-dep/LICENSE
rename to plugins/opentelemetry-plugin-http/LICENSE
diff --git a/packages/opentelemetry-plugin-http/README.md b/plugins/opentelemetry-plugin-http/README.md
similarity index 100%
rename from packages/opentelemetry-plugin-http/README.md
rename to plugins/opentelemetry-plugin-http/README.md
diff --git a/packages/opentelemetry-plugin-http/package.json b/plugins/opentelemetry-plugin-http/package.json
similarity index 100%
rename from packages/opentelemetry-plugin-http/package.json
rename to plugins/opentelemetry-plugin-http/package.json
diff --git a/packages/opentelemetry-plugin-http/src/enums/AttributeNames.ts b/plugins/opentelemetry-plugin-http/src/enums/AttributeNames.ts
similarity index 100%
rename from packages/opentelemetry-plugin-http/src/enums/AttributeNames.ts
rename to plugins/opentelemetry-plugin-http/src/enums/AttributeNames.ts
diff --git a/packages/opentelemetry-plugin-http/src/http.ts b/plugins/opentelemetry-plugin-http/src/http.ts
similarity index 100%
rename from packages/opentelemetry-plugin-http/src/http.ts
rename to plugins/opentelemetry-plugin-http/src/http.ts
diff --git a/packages/opentelemetry-plugin-http/src/index.ts b/plugins/opentelemetry-plugin-http/src/index.ts
similarity index 100%
rename from packages/opentelemetry-plugin-http/src/index.ts
rename to plugins/opentelemetry-plugin-http/src/index.ts
diff --git a/packages/opentelemetry-plugin-http/src/types.ts b/plugins/opentelemetry-plugin-http/src/types.ts
similarity index 100%
rename from packages/opentelemetry-plugin-http/src/types.ts
rename to plugins/opentelemetry-plugin-http/src/types.ts
diff --git a/packages/opentelemetry-plugin-http/src/utils.ts b/plugins/opentelemetry-plugin-http/src/utils.ts
similarity index 100%
rename from packages/opentelemetry-plugin-http/src/utils.ts
rename to plugins/opentelemetry-plugin-http/src/utils.ts
diff --git a/packages/opentelemetry-context-zone-peer-dep/src/version.ts b/plugins/opentelemetry-plugin-http/src/version.ts
similarity index 100%
rename from packages/opentelemetry-context-zone-peer-dep/src/version.ts
rename to plugins/opentelemetry-plugin-http/src/version.ts
diff --git a/packages/opentelemetry-plugin-http/test/fixtures/google.json b/plugins/opentelemetry-plugin-http/test/fixtures/google.json
similarity index 100%
rename from packages/opentelemetry-plugin-http/test/fixtures/google.json
rename to plugins/opentelemetry-plugin-http/test/fixtures/google.json
diff --git a/packages/opentelemetry-plugin-http/test/functionals/http-disable.test.ts b/plugins/opentelemetry-plugin-http/test/functionals/http-disable.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-http/test/functionals/http-disable.test.ts
rename to plugins/opentelemetry-plugin-http/test/functionals/http-disable.test.ts
diff --git a/packages/opentelemetry-plugin-http/test/functionals/http-enable.test.ts b/plugins/opentelemetry-plugin-http/test/functionals/http-enable.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-http/test/functionals/http-enable.test.ts
rename to plugins/opentelemetry-plugin-http/test/functionals/http-enable.test.ts
diff --git a/packages/opentelemetry-plugin-http/test/functionals/http-package.test.ts b/plugins/opentelemetry-plugin-http/test/functionals/http-package.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-http/test/functionals/http-package.test.ts
rename to plugins/opentelemetry-plugin-http/test/functionals/http-package.test.ts
diff --git a/packages/opentelemetry-plugin-http/test/functionals/utils.test.ts b/plugins/opentelemetry-plugin-http/test/functionals/utils.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-http/test/functionals/utils.test.ts
rename to plugins/opentelemetry-plugin-http/test/functionals/utils.test.ts
diff --git a/packages/opentelemetry-plugin-http/test/integrations/http-enable.test.ts b/plugins/opentelemetry-plugin-http/test/integrations/http-enable.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-http/test/integrations/http-enable.test.ts
rename to plugins/opentelemetry-plugin-http/test/integrations/http-enable.test.ts
diff --git a/packages/opentelemetry-plugin-http/test/utils/DummyPropagation.ts b/plugins/opentelemetry-plugin-http/test/utils/DummyPropagation.ts
similarity index 100%
rename from packages/opentelemetry-plugin-http/test/utils/DummyPropagation.ts
rename to plugins/opentelemetry-plugin-http/test/utils/DummyPropagation.ts
diff --git a/packages/opentelemetry-plugin-http/test/utils/assertSpan.ts b/plugins/opentelemetry-plugin-http/test/utils/assertSpan.ts
similarity index 100%
rename from packages/opentelemetry-plugin-http/test/utils/assertSpan.ts
rename to plugins/opentelemetry-plugin-http/test/utils/assertSpan.ts
diff --git a/packages/opentelemetry-plugin-http/test/utils/httpRequest.ts b/plugins/opentelemetry-plugin-http/test/utils/httpRequest.ts
similarity index 100%
rename from packages/opentelemetry-plugin-http/test/utils/httpRequest.ts
rename to plugins/opentelemetry-plugin-http/test/utils/httpRequest.ts
diff --git a/packages/opentelemetry-plugin-http/test/utils/utils.ts b/plugins/opentelemetry-plugin-http/test/utils/utils.ts
similarity index 100%
rename from packages/opentelemetry-plugin-http/test/utils/utils.ts
rename to plugins/opentelemetry-plugin-http/test/utils/utils.ts
diff --git a/packages/opentelemetry-exporter-collector/tsconfig.json b/plugins/opentelemetry-plugin-http/tsconfig.json
similarity index 100%
rename from packages/opentelemetry-exporter-collector/tsconfig.json
rename to plugins/opentelemetry-plugin-http/tsconfig.json
diff --git a/packages/opentelemetry-context-zone-peer-dep/tslint.json b/plugins/opentelemetry-plugin-http/tslint.json
similarity index 100%
rename from packages/opentelemetry-context-zone-peer-dep/tslint.json
rename to plugins/opentelemetry-plugin-http/tslint.json
diff --git a/packages/opentelemetry-exporter-jaeger/.npmignore b/plugins/opentelemetry-plugin-https/.npmignore
similarity index 100%
rename from packages/opentelemetry-exporter-jaeger/.npmignore
rename to plugins/opentelemetry-plugin-https/.npmignore
diff --git a/packages/opentelemetry-context-zone/LICENSE b/plugins/opentelemetry-plugin-https/LICENSE
similarity index 100%
rename from packages/opentelemetry-context-zone/LICENSE
rename to plugins/opentelemetry-plugin-https/LICENSE
diff --git a/packages/opentelemetry-plugin-https/README.md b/plugins/opentelemetry-plugin-https/README.md
similarity index 100%
rename from packages/opentelemetry-plugin-https/README.md
rename to plugins/opentelemetry-plugin-https/README.md
diff --git a/packages/opentelemetry-plugin-https/package.json b/plugins/opentelemetry-plugin-https/package.json
similarity index 100%
rename from packages/opentelemetry-plugin-https/package.json
rename to plugins/opentelemetry-plugin-https/package.json
diff --git a/packages/opentelemetry-plugin-https/src/https.ts b/plugins/opentelemetry-plugin-https/src/https.ts
similarity index 100%
rename from packages/opentelemetry-plugin-https/src/https.ts
rename to plugins/opentelemetry-plugin-https/src/https.ts
diff --git a/packages/opentelemetry-plugin-https/src/index.ts b/plugins/opentelemetry-plugin-https/src/index.ts
similarity index 100%
rename from packages/opentelemetry-plugin-https/src/index.ts
rename to plugins/opentelemetry-plugin-https/src/index.ts
diff --git a/packages/opentelemetry-plugin-https/src/utils.ts b/plugins/opentelemetry-plugin-https/src/utils.ts
similarity index 100%
rename from packages/opentelemetry-plugin-https/src/utils.ts
rename to plugins/opentelemetry-plugin-https/src/utils.ts
diff --git a/packages/opentelemetry-context-zone/src/version.ts b/plugins/opentelemetry-plugin-https/src/version.ts
similarity index 100%
rename from packages/opentelemetry-context-zone/src/version.ts
rename to plugins/opentelemetry-plugin-https/src/version.ts
diff --git a/packages/opentelemetry-plugin-https/test/fixtures/google.json b/plugins/opentelemetry-plugin-https/test/fixtures/google.json
similarity index 100%
rename from packages/opentelemetry-plugin-https/test/fixtures/google.json
rename to plugins/opentelemetry-plugin-https/test/fixtures/google.json
diff --git a/packages/opentelemetry-plugin-https/test/fixtures/server-cert.pem b/plugins/opentelemetry-plugin-https/test/fixtures/server-cert.pem
similarity index 100%
rename from packages/opentelemetry-plugin-https/test/fixtures/server-cert.pem
rename to plugins/opentelemetry-plugin-https/test/fixtures/server-cert.pem
diff --git a/packages/opentelemetry-plugin-https/test/fixtures/server-key.pem b/plugins/opentelemetry-plugin-https/test/fixtures/server-key.pem
similarity index 100%
rename from packages/opentelemetry-plugin-https/test/fixtures/server-key.pem
rename to plugins/opentelemetry-plugin-https/test/fixtures/server-key.pem
diff --git a/packages/opentelemetry-plugin-https/test/functionals/https-disable.test.ts b/plugins/opentelemetry-plugin-https/test/functionals/https-disable.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-https/test/functionals/https-disable.test.ts
rename to plugins/opentelemetry-plugin-https/test/functionals/https-disable.test.ts
diff --git a/packages/opentelemetry-plugin-https/test/functionals/https-enable.test.ts b/plugins/opentelemetry-plugin-https/test/functionals/https-enable.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-https/test/functionals/https-enable.test.ts
rename to plugins/opentelemetry-plugin-https/test/functionals/https-enable.test.ts
diff --git a/packages/opentelemetry-plugin-https/test/functionals/https-package.test.ts b/plugins/opentelemetry-plugin-https/test/functionals/https-package.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-https/test/functionals/https-package.test.ts
rename to plugins/opentelemetry-plugin-https/test/functionals/https-package.test.ts
diff --git a/packages/opentelemetry-plugin-https/test/integrations/https-enable.test.ts b/plugins/opentelemetry-plugin-https/test/integrations/https-enable.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-https/test/integrations/https-enable.test.ts
rename to plugins/opentelemetry-plugin-https/test/integrations/https-enable.test.ts
diff --git a/packages/opentelemetry-plugin-https/test/utils/DummyPropagation.ts b/plugins/opentelemetry-plugin-https/test/utils/DummyPropagation.ts
similarity index 100%
rename from packages/opentelemetry-plugin-https/test/utils/DummyPropagation.ts
rename to plugins/opentelemetry-plugin-https/test/utils/DummyPropagation.ts
diff --git a/packages/opentelemetry-plugin-https/test/utils/assertSpan.ts b/plugins/opentelemetry-plugin-https/test/utils/assertSpan.ts
similarity index 100%
rename from packages/opentelemetry-plugin-https/test/utils/assertSpan.ts
rename to plugins/opentelemetry-plugin-https/test/utils/assertSpan.ts
diff --git a/packages/opentelemetry-plugin-https/test/utils/httpsRequest.ts b/plugins/opentelemetry-plugin-https/test/utils/httpsRequest.ts
similarity index 100%
rename from packages/opentelemetry-plugin-https/test/utils/httpsRequest.ts
rename to plugins/opentelemetry-plugin-https/test/utils/httpsRequest.ts
diff --git a/packages/opentelemetry-plugin-https/test/utils/utils.ts b/plugins/opentelemetry-plugin-https/test/utils/utils.ts
similarity index 100%
rename from packages/opentelemetry-plugin-https/test/utils/utils.ts
rename to plugins/opentelemetry-plugin-https/test/utils/utils.ts
diff --git a/packages/opentelemetry-exporter-jaeger/tsconfig.json b/plugins/opentelemetry-plugin-https/tsconfig.json
similarity index 100%
rename from packages/opentelemetry-exporter-jaeger/tsconfig.json
rename to plugins/opentelemetry-plugin-https/tsconfig.json
diff --git a/packages/opentelemetry-context-zone/tslint.json b/plugins/opentelemetry-plugin-https/tslint.json
similarity index 100%
rename from packages/opentelemetry-context-zone/tslint.json
rename to plugins/opentelemetry-plugin-https/tslint.json
diff --git a/packages/opentelemetry-exporter-prometheus/.npmignore b/plugins/opentelemetry-plugin-ioredis/.npmignore
similarity index 100%
rename from packages/opentelemetry-exporter-prometheus/.npmignore
rename to plugins/opentelemetry-plugin-ioredis/.npmignore
diff --git a/packages/opentelemetry-core/LICENSE b/plugins/opentelemetry-plugin-ioredis/LICENSE
similarity index 100%
rename from packages/opentelemetry-core/LICENSE
rename to plugins/opentelemetry-plugin-ioredis/LICENSE
diff --git a/packages/opentelemetry-plugin-ioredis/README.md b/plugins/opentelemetry-plugin-ioredis/README.md
similarity index 100%
rename from packages/opentelemetry-plugin-ioredis/README.md
rename to plugins/opentelemetry-plugin-ioredis/README.md
diff --git a/packages/opentelemetry-plugin-ioredis/package.json b/plugins/opentelemetry-plugin-ioredis/package.json
similarity index 100%
rename from packages/opentelemetry-plugin-ioredis/package.json
rename to plugins/opentelemetry-plugin-ioredis/package.json
diff --git a/packages/opentelemetry-plugin-ioredis/src/enums.ts b/plugins/opentelemetry-plugin-ioredis/src/enums.ts
similarity index 100%
rename from packages/opentelemetry-plugin-ioredis/src/enums.ts
rename to plugins/opentelemetry-plugin-ioredis/src/enums.ts
diff --git a/packages/opentelemetry-plugin-ioredis/src/index.ts b/plugins/opentelemetry-plugin-ioredis/src/index.ts
similarity index 100%
rename from packages/opentelemetry-plugin-ioredis/src/index.ts
rename to plugins/opentelemetry-plugin-ioredis/src/index.ts
diff --git a/packages/opentelemetry-plugin-ioredis/src/ioredis.ts b/plugins/opentelemetry-plugin-ioredis/src/ioredis.ts
similarity index 100%
rename from packages/opentelemetry-plugin-ioredis/src/ioredis.ts
rename to plugins/opentelemetry-plugin-ioredis/src/ioredis.ts
diff --git a/packages/opentelemetry-plugin-ioredis/src/types.ts b/plugins/opentelemetry-plugin-ioredis/src/types.ts
similarity index 100%
rename from packages/opentelemetry-plugin-ioredis/src/types.ts
rename to plugins/opentelemetry-plugin-ioredis/src/types.ts
diff --git a/packages/opentelemetry-plugin-ioredis/src/utils.ts b/plugins/opentelemetry-plugin-ioredis/src/utils.ts
similarity index 100%
rename from packages/opentelemetry-plugin-ioredis/src/utils.ts
rename to plugins/opentelemetry-plugin-ioredis/src/utils.ts
diff --git a/packages/opentelemetry-core/src/version.ts b/plugins/opentelemetry-plugin-ioredis/src/version.ts
similarity index 100%
rename from packages/opentelemetry-core/src/version.ts
rename to plugins/opentelemetry-plugin-ioredis/src/version.ts
diff --git a/packages/opentelemetry-plugin-ioredis/test/ioredis.test.ts b/plugins/opentelemetry-plugin-ioredis/test/ioredis.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-ioredis/test/ioredis.test.ts
rename to plugins/opentelemetry-plugin-ioredis/test/ioredis.test.ts
diff --git a/packages/opentelemetry-exporter-prometheus/tsconfig.json b/plugins/opentelemetry-plugin-ioredis/tsconfig.json
similarity index 100%
rename from packages/opentelemetry-exporter-prometheus/tsconfig.json
rename to plugins/opentelemetry-plugin-ioredis/tsconfig.json
diff --git a/packages/opentelemetry-core/tslint.json b/plugins/opentelemetry-plugin-ioredis/tslint.json
similarity index 100%
rename from packages/opentelemetry-core/tslint.json
rename to plugins/opentelemetry-plugin-ioredis/tslint.json
diff --git a/packages/opentelemetry-exporter-zipkin/.npmignore b/plugins/opentelemetry-plugin-mongodb/.npmignore
similarity index 100%
rename from packages/opentelemetry-exporter-zipkin/.npmignore
rename to plugins/opentelemetry-plugin-mongodb/.npmignore
diff --git a/packages/opentelemetry-exporter-collector/LICENSE b/plugins/opentelemetry-plugin-mongodb/LICENSE
similarity index 100%
rename from packages/opentelemetry-exporter-collector/LICENSE
rename to plugins/opentelemetry-plugin-mongodb/LICENSE
diff --git a/packages/opentelemetry-plugin-mongodb/README.md b/plugins/opentelemetry-plugin-mongodb/README.md
similarity index 100%
rename from packages/opentelemetry-plugin-mongodb/README.md
rename to plugins/opentelemetry-plugin-mongodb/README.md
diff --git a/packages/opentelemetry-plugin-mongodb/package.json b/plugins/opentelemetry-plugin-mongodb/package.json
similarity index 100%
rename from packages/opentelemetry-plugin-mongodb/package.json
rename to plugins/opentelemetry-plugin-mongodb/package.json
diff --git a/packages/opentelemetry-plugin-mongodb/src/index.ts b/plugins/opentelemetry-plugin-mongodb/src/index.ts
similarity index 100%
rename from packages/opentelemetry-plugin-mongodb/src/index.ts
rename to plugins/opentelemetry-plugin-mongodb/src/index.ts
diff --git a/packages/opentelemetry-plugin-mongodb/src/mongodb.ts b/plugins/opentelemetry-plugin-mongodb/src/mongodb.ts
similarity index 100%
rename from packages/opentelemetry-plugin-mongodb/src/mongodb.ts
rename to plugins/opentelemetry-plugin-mongodb/src/mongodb.ts
diff --git a/packages/opentelemetry-plugin-mongodb/src/types.ts b/plugins/opentelemetry-plugin-mongodb/src/types.ts
similarity index 100%
rename from packages/opentelemetry-plugin-mongodb/src/types.ts
rename to plugins/opentelemetry-plugin-mongodb/src/types.ts
diff --git a/packages/opentelemetry-exporter-collector/src/version.ts b/plugins/opentelemetry-plugin-mongodb/src/version.ts
similarity index 100%
rename from packages/opentelemetry-exporter-collector/src/version.ts
rename to plugins/opentelemetry-plugin-mongodb/src/version.ts
diff --git a/packages/opentelemetry-plugin-mongodb/test/mongodb.test.ts b/plugins/opentelemetry-plugin-mongodb/test/mongodb.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-mongodb/test/mongodb.test.ts
rename to plugins/opentelemetry-plugin-mongodb/test/mongodb.test.ts
diff --git a/packages/opentelemetry-exporter-zipkin/tsconfig.json b/plugins/opentelemetry-plugin-mongodb/tsconfig.json
similarity index 100%
rename from packages/opentelemetry-exporter-zipkin/tsconfig.json
rename to plugins/opentelemetry-plugin-mongodb/tsconfig.json
diff --git a/packages/opentelemetry-exporter-collector/tslint.json b/plugins/opentelemetry-plugin-mongodb/tslint.json
similarity index 100%
rename from packages/opentelemetry-exporter-collector/tslint.json
rename to plugins/opentelemetry-plugin-mongodb/tslint.json
diff --git a/packages/opentelemetry-metrics/.npmignore b/plugins/opentelemetry-plugin-mysql/.npmignore
similarity index 100%
rename from packages/opentelemetry-metrics/.npmignore
rename to plugins/opentelemetry-plugin-mysql/.npmignore
diff --git a/packages/opentelemetry-exporter-jaeger/LICENSE b/plugins/opentelemetry-plugin-mysql/LICENSE
similarity index 100%
rename from packages/opentelemetry-exporter-jaeger/LICENSE
rename to plugins/opentelemetry-plugin-mysql/LICENSE
diff --git a/packages/opentelemetry-plugin-mysql/README.md b/plugins/opentelemetry-plugin-mysql/README.md
similarity index 100%
rename from packages/opentelemetry-plugin-mysql/README.md
rename to plugins/opentelemetry-plugin-mysql/README.md
diff --git a/packages/opentelemetry-plugin-mysql/package.json b/plugins/opentelemetry-plugin-mysql/package.json
similarity index 100%
rename from packages/opentelemetry-plugin-mysql/package.json
rename to plugins/opentelemetry-plugin-mysql/package.json
diff --git a/packages/opentelemetry-plugin-mysql/src/enums.ts b/plugins/opentelemetry-plugin-mysql/src/enums.ts
similarity index 100%
rename from packages/opentelemetry-plugin-mysql/src/enums.ts
rename to plugins/opentelemetry-plugin-mysql/src/enums.ts
diff --git a/packages/opentelemetry-plugin-mysql/src/index.ts b/plugins/opentelemetry-plugin-mysql/src/index.ts
similarity index 100%
rename from packages/opentelemetry-plugin-mysql/src/index.ts
rename to plugins/opentelemetry-plugin-mysql/src/index.ts
diff --git a/packages/opentelemetry-plugin-mysql/src/mysql.ts b/plugins/opentelemetry-plugin-mysql/src/mysql.ts
similarity index 100%
rename from packages/opentelemetry-plugin-mysql/src/mysql.ts
rename to plugins/opentelemetry-plugin-mysql/src/mysql.ts
diff --git a/packages/opentelemetry-plugin-mysql/src/types.ts b/plugins/opentelemetry-plugin-mysql/src/types.ts
similarity index 100%
rename from packages/opentelemetry-plugin-mysql/src/types.ts
rename to plugins/opentelemetry-plugin-mysql/src/types.ts
diff --git a/packages/opentelemetry-plugin-mysql/src/utils.ts b/plugins/opentelemetry-plugin-mysql/src/utils.ts
similarity index 100%
rename from packages/opentelemetry-plugin-mysql/src/utils.ts
rename to plugins/opentelemetry-plugin-mysql/src/utils.ts
diff --git a/packages/opentelemetry-exporter-jaeger/src/version.ts b/plugins/opentelemetry-plugin-mysql/src/version.ts
similarity index 100%
rename from packages/opentelemetry-exporter-jaeger/src/version.ts
rename to plugins/opentelemetry-plugin-mysql/src/version.ts
diff --git a/packages/opentelemetry-plugin-mysql/test/mysql.test.ts b/plugins/opentelemetry-plugin-mysql/test/mysql.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-mysql/test/mysql.test.ts
rename to plugins/opentelemetry-plugin-mysql/test/mysql.test.ts
diff --git a/packages/opentelemetry-metrics/tsconfig.json b/plugins/opentelemetry-plugin-mysql/tsconfig.json
similarity index 100%
rename from packages/opentelemetry-metrics/tsconfig.json
rename to plugins/opentelemetry-plugin-mysql/tsconfig.json
diff --git a/packages/opentelemetry-exporter-jaeger/tslint.json b/plugins/opentelemetry-plugin-mysql/tslint.json
similarity index 100%
rename from packages/opentelemetry-exporter-jaeger/tslint.json
rename to plugins/opentelemetry-plugin-mysql/tslint.json
diff --git a/packages/opentelemetry-node/.npmignore b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/.npmignore
similarity index 100%
rename from packages/opentelemetry-node/.npmignore
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/.npmignore
diff --git a/packages/opentelemetry-exporter-prometheus/LICENSE b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/LICENSE
similarity index 100%
rename from packages/opentelemetry-exporter-prometheus/LICENSE
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/LICENSE
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/README.md b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/README.md
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/README.md
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/README.md
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/package.json b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/package.json
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/package.json
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/package.json
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/enums.ts b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/enums.ts
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/enums.ts
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/enums.ts
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/index.ts b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/index.ts
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/index.ts
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/index.ts
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/pg-pool.ts b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/pg-pool.ts
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/pg-pool.ts
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/pg-pool.ts
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/types.ts b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/types.ts
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/types.ts
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/types.ts
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/utils.ts b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/utils.ts
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/utils.ts
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/utils.ts
diff --git a/packages/opentelemetry-exporter-prometheus/src/version.ts b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/version.ts
similarity index 100%
rename from packages/opentelemetry-exporter-prometheus/src/version.ts
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/src/version.ts
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/test/pg-pool.test.ts b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/test/pg-pool.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/test/pg-pool.test.ts
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/test/pg-pool.test.ts
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/tsconfig.json b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/tsconfig.json
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/tsconfig.json
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/tsconfig.json
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/tslint.json b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/tslint.json
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/tslint.json
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/tslint.json
diff --git a/packages/opentelemetry-plugin-dns/.npmignore b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/.npmignore
similarity index 100%
rename from packages/opentelemetry-plugin-dns/.npmignore
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/.npmignore
diff --git a/packages/opentelemetry-exporter-zipkin/LICENSE b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/LICENSE
similarity index 100%
rename from packages/opentelemetry-exporter-zipkin/LICENSE
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/LICENSE
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/README.md b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/README.md
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/README.md
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/README.md
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/package.json b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/package.json
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/package.json
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/package.json
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/enums.ts b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/enums.ts
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/enums.ts
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/enums.ts
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/index.ts b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/index.ts
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/index.ts
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/index.ts
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/pg.ts b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/pg.ts
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/pg.ts
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/pg.ts
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/types.ts b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/types.ts
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/types.ts
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/types.ts
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/utils.ts b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/utils.ts
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/utils.ts
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/utils.ts
diff --git a/packages/opentelemetry-exporter-zipkin/src/version.ts b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/version.ts
similarity index 100%
rename from packages/opentelemetry-exporter-zipkin/src/version.ts
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/src/version.ts
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/test/pg.test.ts b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/test/pg.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/test/pg.test.ts
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/test/pg.test.ts
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/tsconfig.json b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/tsconfig.json
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/tsconfig.json
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/tsconfig.json
diff --git a/packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/tslint.json b/plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/tslint.json
similarity index 100%
rename from packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/tslint.json
rename to plugins/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/tslint.json
diff --git a/packages/opentelemetry-plugin-express/.npmignore b/plugins/opentelemetry-plugin-redis/.npmignore
similarity index 100%
rename from packages/opentelemetry-plugin-express/.npmignore
rename to plugins/opentelemetry-plugin-redis/.npmignore
diff --git a/packages/opentelemetry-metrics/LICENSE b/plugins/opentelemetry-plugin-redis/LICENSE
similarity index 100%
rename from packages/opentelemetry-metrics/LICENSE
rename to plugins/opentelemetry-plugin-redis/LICENSE
diff --git a/packages/opentelemetry-plugin-redis/README.md b/plugins/opentelemetry-plugin-redis/README.md
similarity index 100%
rename from packages/opentelemetry-plugin-redis/README.md
rename to plugins/opentelemetry-plugin-redis/README.md
diff --git a/packages/opentelemetry-plugin-redis/package.json b/plugins/opentelemetry-plugin-redis/package.json
similarity index 100%
rename from packages/opentelemetry-plugin-redis/package.json
rename to plugins/opentelemetry-plugin-redis/package.json
diff --git a/packages/opentelemetry-plugin-redis/src/enums.ts b/plugins/opentelemetry-plugin-redis/src/enums.ts
similarity index 100%
rename from packages/opentelemetry-plugin-redis/src/enums.ts
rename to plugins/opentelemetry-plugin-redis/src/enums.ts
diff --git a/packages/opentelemetry-plugin-redis/src/index.ts b/plugins/opentelemetry-plugin-redis/src/index.ts
similarity index 100%
rename from packages/opentelemetry-plugin-redis/src/index.ts
rename to plugins/opentelemetry-plugin-redis/src/index.ts
diff --git a/packages/opentelemetry-plugin-redis/src/redis.ts b/plugins/opentelemetry-plugin-redis/src/redis.ts
similarity index 100%
rename from packages/opentelemetry-plugin-redis/src/redis.ts
rename to plugins/opentelemetry-plugin-redis/src/redis.ts
diff --git a/packages/opentelemetry-plugin-redis/src/types.ts b/plugins/opentelemetry-plugin-redis/src/types.ts
similarity index 100%
rename from packages/opentelemetry-plugin-redis/src/types.ts
rename to plugins/opentelemetry-plugin-redis/src/types.ts
diff --git a/packages/opentelemetry-plugin-redis/src/utils.ts b/plugins/opentelemetry-plugin-redis/src/utils.ts
similarity index 100%
rename from packages/opentelemetry-plugin-redis/src/utils.ts
rename to plugins/opentelemetry-plugin-redis/src/utils.ts
diff --git a/packages/opentelemetry-metrics/src/version.ts b/plugins/opentelemetry-plugin-redis/src/version.ts
similarity index 100%
rename from packages/opentelemetry-metrics/src/version.ts
rename to plugins/opentelemetry-plugin-redis/src/version.ts
diff --git a/packages/opentelemetry-plugin-redis/test/redis.test.ts b/plugins/opentelemetry-plugin-redis/test/redis.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-redis/test/redis.test.ts
rename to plugins/opentelemetry-plugin-redis/test/redis.test.ts
diff --git a/packages/opentelemetry-node/tsconfig.json b/plugins/opentelemetry-plugin-redis/tsconfig.json
similarity index 100%
rename from packages/opentelemetry-node/tsconfig.json
rename to plugins/opentelemetry-plugin-redis/tsconfig.json
diff --git a/packages/opentelemetry-exporter-prometheus/tslint.json b/plugins/opentelemetry-plugin-redis/tslint.json
similarity index 100%
rename from packages/opentelemetry-exporter-prometheus/tslint.json
rename to plugins/opentelemetry-plugin-redis/tslint.json
diff --git a/packages/opentelemetry-node/LICENSE b/plugins/opentelemetry-plugin-user-interaction/LICENSE
similarity index 100%
rename from packages/opentelemetry-node/LICENSE
rename to plugins/opentelemetry-plugin-user-interaction/LICENSE
diff --git a/packages/opentelemetry-plugin-user-interaction/README.md b/plugins/opentelemetry-plugin-user-interaction/README.md
similarity index 100%
rename from packages/opentelemetry-plugin-user-interaction/README.md
rename to plugins/opentelemetry-plugin-user-interaction/README.md
diff --git a/packages/opentelemetry-plugin-user-interaction/images/click-sync.jpg b/plugins/opentelemetry-plugin-user-interaction/images/click-sync.jpg
similarity index 100%
rename from packages/opentelemetry-plugin-user-interaction/images/click-sync.jpg
rename to plugins/opentelemetry-plugin-user-interaction/images/click-sync.jpg
diff --git a/packages/opentelemetry-plugin-user-interaction/images/click.jpg b/plugins/opentelemetry-plugin-user-interaction/images/click.jpg
similarity index 100%
rename from packages/opentelemetry-plugin-user-interaction/images/click.jpg
rename to plugins/opentelemetry-plugin-user-interaction/images/click.jpg
diff --git a/packages/opentelemetry-plugin-user-interaction/images/main-sync.jpg b/plugins/opentelemetry-plugin-user-interaction/images/main-sync.jpg
similarity index 100%
rename from packages/opentelemetry-plugin-user-interaction/images/main-sync.jpg
rename to plugins/opentelemetry-plugin-user-interaction/images/main-sync.jpg
diff --git a/packages/opentelemetry-plugin-user-interaction/images/main.jpg b/plugins/opentelemetry-plugin-user-interaction/images/main.jpg
similarity index 100%
rename from packages/opentelemetry-plugin-user-interaction/images/main.jpg
rename to plugins/opentelemetry-plugin-user-interaction/images/main.jpg
diff --git a/packages/opentelemetry-plugin-user-interaction/karma.conf.js b/plugins/opentelemetry-plugin-user-interaction/karma.conf.js
similarity index 100%
rename from packages/opentelemetry-plugin-user-interaction/karma.conf.js
rename to plugins/opentelemetry-plugin-user-interaction/karma.conf.js
diff --git a/packages/opentelemetry-plugin-user-interaction/package.json b/plugins/opentelemetry-plugin-user-interaction/package.json
similarity index 100%
rename from packages/opentelemetry-plugin-user-interaction/package.json
rename to plugins/opentelemetry-plugin-user-interaction/package.json
diff --git a/packages/opentelemetry-plugin-user-interaction/src/enums/AttributeNames.ts b/plugins/opentelemetry-plugin-user-interaction/src/enums/AttributeNames.ts
similarity index 100%
rename from packages/opentelemetry-plugin-user-interaction/src/enums/AttributeNames.ts
rename to plugins/opentelemetry-plugin-user-interaction/src/enums/AttributeNames.ts
diff --git a/packages/opentelemetry-plugin-user-interaction/src/index.ts b/plugins/opentelemetry-plugin-user-interaction/src/index.ts
similarity index 100%
rename from packages/opentelemetry-plugin-user-interaction/src/index.ts
rename to plugins/opentelemetry-plugin-user-interaction/src/index.ts
diff --git a/packages/opentelemetry-plugin-user-interaction/src/types.ts b/plugins/opentelemetry-plugin-user-interaction/src/types.ts
similarity index 100%
rename from packages/opentelemetry-plugin-user-interaction/src/types.ts
rename to plugins/opentelemetry-plugin-user-interaction/src/types.ts
diff --git a/packages/opentelemetry-plugin-user-interaction/src/userInteraction.ts b/plugins/opentelemetry-plugin-user-interaction/src/userInteraction.ts
similarity index 100%
rename from packages/opentelemetry-plugin-user-interaction/src/userInteraction.ts
rename to plugins/opentelemetry-plugin-user-interaction/src/userInteraction.ts
diff --git a/packages/opentelemetry-node/src/version.ts b/plugins/opentelemetry-plugin-user-interaction/src/version.ts
similarity index 100%
rename from packages/opentelemetry-node/src/version.ts
rename to plugins/opentelemetry-plugin-user-interaction/src/version.ts
diff --git a/packages/opentelemetry-plugin-user-interaction/test/helper.test.ts b/plugins/opentelemetry-plugin-user-interaction/test/helper.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-user-interaction/test/helper.test.ts
rename to plugins/opentelemetry-plugin-user-interaction/test/helper.test.ts
diff --git a/packages/opentelemetry-context-zone-peer-dep/test/index-webpack.ts b/plugins/opentelemetry-plugin-user-interaction/test/index-webpack.ts
similarity index 100%
rename from packages/opentelemetry-context-zone-peer-dep/test/index-webpack.ts
rename to plugins/opentelemetry-plugin-user-interaction/test/index-webpack.ts
diff --git a/packages/opentelemetry-plugin-user-interaction/test/userInteraction.nozone.test.ts b/plugins/opentelemetry-plugin-user-interaction/test/userInteraction.nozone.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-user-interaction/test/userInteraction.nozone.test.ts
rename to plugins/opentelemetry-plugin-user-interaction/test/userInteraction.nozone.test.ts
diff --git a/packages/opentelemetry-plugin-user-interaction/test/userInteraction.test.ts b/plugins/opentelemetry-plugin-user-interaction/test/userInteraction.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-user-interaction/test/userInteraction.test.ts
rename to plugins/opentelemetry-plugin-user-interaction/test/userInteraction.test.ts
diff --git a/packages/opentelemetry-context-zone-peer-dep/tsconfig.json b/plugins/opentelemetry-plugin-user-interaction/tsconfig.json
similarity index 100%
rename from packages/opentelemetry-context-zone-peer-dep/tsconfig.json
rename to plugins/opentelemetry-plugin-user-interaction/tsconfig.json
diff --git a/packages/opentelemetry-exporter-zipkin/tslint.json b/plugins/opentelemetry-plugin-user-interaction/tslint.json
similarity index 100%
rename from packages/opentelemetry-exporter-zipkin/tslint.json
rename to plugins/opentelemetry-plugin-user-interaction/tslint.json
diff --git a/packages/opentelemetry-plugin-grpc/.npmignore b/plugins/opentelemetry-plugin-xml-http-request/.npmignore
similarity index 100%
rename from packages/opentelemetry-plugin-grpc/.npmignore
rename to plugins/opentelemetry-plugin-xml-http-request/.npmignore
diff --git a/packages/opentelemetry-plugin-dns/LICENSE b/plugins/opentelemetry-plugin-xml-http-request/LICENSE
similarity index 100%
rename from packages/opentelemetry-plugin-dns/LICENSE
rename to plugins/opentelemetry-plugin-xml-http-request/LICENSE
diff --git a/packages/opentelemetry-plugin-xml-http-request/README.md b/plugins/opentelemetry-plugin-xml-http-request/README.md
similarity index 100%
rename from packages/opentelemetry-plugin-xml-http-request/README.md
rename to plugins/opentelemetry-plugin-xml-http-request/README.md
diff --git a/packages/opentelemetry-plugin-xml-http-request/images/cors.jpg b/plugins/opentelemetry-plugin-xml-http-request/images/cors.jpg
similarity index 100%
rename from packages/opentelemetry-plugin-xml-http-request/images/cors.jpg
rename to plugins/opentelemetry-plugin-xml-http-request/images/cors.jpg
diff --git a/packages/opentelemetry-plugin-xml-http-request/images/main.jpg b/plugins/opentelemetry-plugin-xml-http-request/images/main.jpg
similarity index 100%
rename from packages/opentelemetry-plugin-xml-http-request/images/main.jpg
rename to plugins/opentelemetry-plugin-xml-http-request/images/main.jpg
diff --git a/packages/opentelemetry-plugin-xml-http-request/images/request.jpg b/plugins/opentelemetry-plugin-xml-http-request/images/request.jpg
similarity index 100%
rename from packages/opentelemetry-plugin-xml-http-request/images/request.jpg
rename to plugins/opentelemetry-plugin-xml-http-request/images/request.jpg
diff --git a/packages/opentelemetry-context-zone-peer-dep/karma.conf.js b/plugins/opentelemetry-plugin-xml-http-request/karma.conf.js
similarity index 100%
rename from packages/opentelemetry-context-zone-peer-dep/karma.conf.js
rename to plugins/opentelemetry-plugin-xml-http-request/karma.conf.js
diff --git a/packages/opentelemetry-plugin-xml-http-request/package.json b/plugins/opentelemetry-plugin-xml-http-request/package.json
similarity index 100%
rename from packages/opentelemetry-plugin-xml-http-request/package.json
rename to plugins/opentelemetry-plugin-xml-http-request/package.json
diff --git a/packages/opentelemetry-plugin-xml-http-request/src/enums/AttributeNames.ts b/plugins/opentelemetry-plugin-xml-http-request/src/enums/AttributeNames.ts
similarity index 100%
rename from packages/opentelemetry-plugin-xml-http-request/src/enums/AttributeNames.ts
rename to plugins/opentelemetry-plugin-xml-http-request/src/enums/AttributeNames.ts
diff --git a/packages/opentelemetry-plugin-xml-http-request/src/enums/EventNames.ts b/plugins/opentelemetry-plugin-xml-http-request/src/enums/EventNames.ts
similarity index 100%
rename from packages/opentelemetry-plugin-xml-http-request/src/enums/EventNames.ts
rename to plugins/opentelemetry-plugin-xml-http-request/src/enums/EventNames.ts
diff --git a/packages/opentelemetry-plugin-xml-http-request/src/index.ts b/plugins/opentelemetry-plugin-xml-http-request/src/index.ts
similarity index 100%
rename from packages/opentelemetry-plugin-xml-http-request/src/index.ts
rename to plugins/opentelemetry-plugin-xml-http-request/src/index.ts
diff --git a/packages/opentelemetry-plugin-xml-http-request/src/types.ts b/plugins/opentelemetry-plugin-xml-http-request/src/types.ts
similarity index 100%
rename from packages/opentelemetry-plugin-xml-http-request/src/types.ts
rename to plugins/opentelemetry-plugin-xml-http-request/src/types.ts
diff --git a/packages/opentelemetry-plugin-dns/src/version.ts b/plugins/opentelemetry-plugin-xml-http-request/src/version.ts
similarity index 100%
rename from packages/opentelemetry-plugin-dns/src/version.ts
rename to plugins/opentelemetry-plugin-xml-http-request/src/version.ts
diff --git a/packages/opentelemetry-plugin-xml-http-request/src/xhr.ts b/plugins/opentelemetry-plugin-xml-http-request/src/xhr.ts
similarity index 100%
rename from packages/opentelemetry-plugin-xml-http-request/src/xhr.ts
rename to plugins/opentelemetry-plugin-xml-http-request/src/xhr.ts
diff --git a/packages/opentelemetry-core/test/index-webpack.ts b/plugins/opentelemetry-plugin-xml-http-request/test/index-webpack.ts
similarity index 100%
rename from packages/opentelemetry-core/test/index-webpack.ts
rename to plugins/opentelemetry-plugin-xml-http-request/test/index-webpack.ts
diff --git a/packages/opentelemetry-plugin-xml-http-request/test/xhr.test.ts b/plugins/opentelemetry-plugin-xml-http-request/test/xhr.test.ts
similarity index 100%
rename from packages/opentelemetry-plugin-xml-http-request/test/xhr.test.ts
rename to plugins/opentelemetry-plugin-xml-http-request/test/xhr.test.ts
diff --git a/packages/opentelemetry-plugin-dns/tsconfig.json b/plugins/opentelemetry-plugin-xml-http-request/tsconfig.json
similarity index 100%
rename from packages/opentelemetry-plugin-dns/tsconfig.json
rename to plugins/opentelemetry-plugin-xml-http-request/tsconfig.json
diff --git a/packages/opentelemetry-metrics/tslint.json b/plugins/opentelemetry-plugin-xml-http-request/tslint.json
similarity index 100%
rename from packages/opentelemetry-metrics/tslint.json
rename to plugins/opentelemetry-plugin-xml-http-request/tslint.json
diff --git a/plugins/tsconfig.base.json b/plugins/tsconfig.base.json
new file mode 100644
index 0000000000..116c12d66d
--- /dev/null
+++ b/plugins/tsconfig.base.json
@@ -0,0 +1,22 @@
+{
+ "compilerOptions": {
+ "allowUnreachableCode": false,
+ "allowUnusedLabels": false,
+ "declaration": true,
+ "forceConsistentCasingInFileNames": true,
+ "module": "commonjs",
+ "noEmitOnError": true,
+ "noFallthroughCasesInSwitch": true,
+ "noImplicitReturns": true,
+ "noUnusedLocals": true,
+ "pretty": true,
+ "sourceMap": true,
+ "strict": true,
+ "strictNullChecks": true,
+ "target": "es2017",
+ "incremental": true
+ },
+ "exclude": [
+ "node_modules"
+ ]
+}