diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 746bcc7fbf..17ec720284 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -12,4 +12,4 @@ # https://help.github.com/en/articles/about-code-owners # -* @dyladan @mayurkale22 @OlivierAlbertini @vmarchaud @markwolff @obecny @mwear @naseemkullah @legendecas @Flarna @johnbley +* @dyladan @mayurkale22 @OlivierAlbertini @vmarchaud @markwolff @obecny @mwear @naseemkullah @legendecas @Flarna @johnbley @MSNev diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 130e33111b..6514f81e81 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -41,7 +41,8 @@ jobs: metapackages/*/package-lock.json packages/*/package-lock.json integration-tests/*/package-lock.json - key: ${{ runner.os }}-lint-${{ hashFiles('**/package.json') }} + # increment the trailing number to break the cache manually + key: ${{ runner.os }}-lint-${{ hashFiles('**/package.json') }}-0 # On a cache hit, use ci to speed up the install process - name: Bootstrap (cache hit) diff --git a/.github/workflows/peer-api.yaml b/.github/workflows/peer-api.yaml index 6631d8562c..d1995d86e5 100644 --- a/.github/workflows/peer-api.yaml +++ b/.github/workflows/peer-api.yaml @@ -14,7 +14,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - + - name: Install lerna run: npm install -g lerna diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index c03257d5d8..5c9b3f0faa 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - container: ["node:8", "node:10", "node:12", "node:14"] + container: ["node:8", "node:10", "node:12", "node:14", "node:16"] runs-on: ubuntu-latest container: image: ${{ matrix.container }} @@ -34,11 +34,11 @@ jobs: packages/*/package-lock.json integration-tests/*/package-lock.json key: ${{ runner.os }}-unit_test-${{ matrix.container }}-${{ hashFiles('**/package.json') }} - - name: Install and Build (cache miss) 🔧 if: steps.cache.outputs.cache-hit != 'true' run: | npm install --ignore-scripts + chown -R 1001:121 "/github/home/.npm" # fix npm cache permissions for npm v7 npx lerna bootstrap --no-ci npm run compile @@ -53,11 +53,11 @@ jobs: run: npm run test - name: Report Coverage run: npm run codecov - if: ${{ matrix.container }} == 'node:12' + if: ${{ matrix.container == 'node:14' }} browser-tests: runs-on: ubuntu-latest container: - image: circleci/node:12-browsers + image: circleci/node:14-browsers env: NPM_CONFIG_UNSAFE_PERM: true steps: @@ -65,7 +65,6 @@ jobs: uses: actions/checkout@v1 - name: Permission Setup run: sudo chmod -R 777 /github /__w - - name: restore lock files uses: actions/cache@master # must use unreleased master to cache multiple paths id: cache diff --git a/.github/workflows/w3c-integration-test.yml b/.github/workflows/w3c-integration-test.yml index 14dea976cd..38afe21624 100644 --- a/.github/workflows/w3c-integration-test.yml +++ b/.github/workflows/w3c-integration-test.yml @@ -39,9 +39,9 @@ jobs: run: | npm ci --ignore-scripts npx lerna bootstrap --scope=propagation-validation-server --include-dependencies - + - name: Build 🔧 - run: npm run compile + run: npm run compile working-directory: ./integration-tests/propagation-validation-server - name: Run W3C Test harness diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d97f8cead..0a13a3c6e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,137 @@ All notable changes to this project will be documented in this file. ## Unreleased +## 0.21.0 + +### :rocket: (Enhancement) + +* `opentelemetry-instrumentation-fetch`, `opentelemetry-instrumentation-grpc`, `opentelemetry-instrumentation-http`, `opentelemetry-instrumentation-xml-http-request`, `opentelemetry-instrumentation` + * [#2261](https://github.com/open-telemetry/opentelemetry-js/pull/2261) Adding ComponentLogger into instrumentations ([@obecny](https://github.com/obecny)) +* `opentelemetry-api-metrics`, `opentelemetry-context-async-hooks`, `opentelemetry-context-zone-peer-dep`, `opentelemetry-core`, `opentelemetry-exporter-collector-grpc`, `opentelemetry-exporter-collector-proto`, `opentelemetry-exporter-collector`, `opentelemetry-exporter-jaeger`, `opentelemetry-exporter-prometheus`, `opentelemetry-exporter-zipkin`, `opentelemetry-instrumentation-fetch`, `opentelemetry-instrumentation-grpc`, `opentelemetry-instrumentation-http`, `opentelemetry-instrumentation-xml-http-request`, `opentelemetry-instrumentation`, `opentelemetry-metrics`, `opentelemetry-node`, `opentelemetry-propagator-b3`, `opentelemetry-propagator-jaeger`, `opentelemetry-resource-detector-aws`, `opentelemetry-resource-detector-gcp`, `opentelemetry-resources`, `opentelemetry-sdk-node`, `opentelemetry-shim-opentracing`, `opentelemetry-tracing`, `opentelemetry-web` + * [#2255](https://github.com/open-telemetry/opentelemetry-js/pull/2255) chore: update API to 0.21.0 ([@dyladan](https://github.com/dyladan)) + +### :books: (Refine Doc) + +* [#2263](https://github.com/open-telemetry/opentelemetry-js/pull/2263) docs(README): update link to @opentelemetry/api package ([@nvenegas](https://github.com/nvenegas)) +* [#2254](https://github.com/open-telemetry/opentelemetry-js/pull/2254) chore: update compatibility matrix ([@dyladan](https://github.com/dyladan)) +* [#2253](https://github.com/open-telemetry/opentelemetry-js/pull/2253) chore: add missing changelog entry ([@dyladan](https://github.com/dyladan)) + +### :house: (Internal) + +* `opentelemetry-api-metrics`, `opentelemetry-context-async-hooks`, `opentelemetry-context-zone-peer-dep`, `opentelemetry-context-zone`, `opentelemetry-core`, `opentelemetry-exporter-collector-grpc`, `opentelemetry-exporter-collector-proto`, `opentelemetry-exporter-collector`, `opentelemetry-exporter-jaeger`, `opentelemetry-exporter-prometheus`, `opentelemetry-exporter-zipkin`, `opentelemetry-instrumentation-fetch`, `opentelemetry-instrumentation-grpc`, `opentelemetry-instrumentation-http`, `opentelemetry-instrumentation-xml-http-request`, `opentelemetry-instrumentation`, `opentelemetry-metrics`, `opentelemetry-node`, `opentelemetry-propagator-b3`, `opentelemetry-propagator-jaeger`, `opentelemetry-resource-detector-aws`, `opentelemetry-resource-detector-gcp`, `opentelemetry-resources`, `opentelemetry-sdk-node`, `opentelemetry-semantic-conventions`, `opentelemetry-shim-opentracing`, `opentelemetry-tracing`, `opentelemetry-web`, `template` + * [#2244](https://github.com/open-telemetry/opentelemetry-js/pull/2244) chore: add node:16 to the test matrix ([@Rauno56](https://github.com/Rauno56)) + +### Committers: 4 + +* Bartlomiej Obecny ([@obecny](https://github.com/obecny)) +* Daniel Dyla ([@dyladan](https://github.com/dyladan)) +* Nicolas Venegas ([@nvenegas](https://github.com/nvenegas)) +* Rauno Viskus ([@Rauno56](https://github.com/Rauno56)) + +## 0.20.0 + +### :boom: Breaking Change + +* `opentelemetry-sdk-node`, `opentelemetry-tracing` + * [#2190](https://github.com/open-telemetry/opentelemetry-js/pull/2190) feat: apply spec changes for `TraceParams` ([@weyert](https://github.com/weyert)) +* `opentelemetry-node`, `opentelemetry-propagator-jaeger`, `opentelemetry-shim-opentracing` + * [#2148](https://github.com/open-telemetry/opentelemetry-js/pull/2148) chore: renaming jaeger http trace propagator to jaeger propagator ([@obecny](https://github.com/obecny)) +* `opentelemetry-core`, `opentelemetry-instrumentation-grpc`, `opentelemetry-shim-opentracing`, `opentelemetry-tracing` + * [#2149](https://github.com/open-telemetry/opentelemetry-js/pull/2149) chore: adding sufix propagator to http baggage and http trace context ([@obecny](https://github.com/obecny)) + +### :rocket: (Enhancement) + +* `opentelemetry-shim-opentracing` + * [#2194](https://github.com/open-telemetry/opentelemetry-js/pull/2194) feat(shim-opentracing): update setTag based on new spec ([@vreynolds](https://github.com/vreynolds)) +* `opentelemetry-tracing` + * [#2221](https://github.com/open-telemetry/opentelemetry-js/pull/2221) feat: add startActiveSpan method to Tracer ([@naseemkullah](https://github.com/naseemkullah)) +* `opentelemetry-core`, `opentelemetry-exporter-collector-grpc`, `opentelemetry-exporter-collector-proto`, `opentelemetry-exporter-collector`, `opentelemetry-exporter-jaeger`, `opentelemetry-exporter-zipkin`, `opentelemetry-metrics`, `opentelemetry-resources`, `opentelemetry-sdk-node`, `opentelemetry-tracing` + * [#2227](https://github.com/open-telemetry/opentelemetry-js/pull/2227) chore: set default service name ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-api-metrics`, `opentelemetry-context-async-hooks`, `opentelemetry-context-zone-peer-dep`, `opentelemetry-context-zone`, `opentelemetry-core`, `opentelemetry-exporter-collector-grpc`, `opentelemetry-exporter-collector-proto`, `opentelemetry-exporter-collector`, `opentelemetry-exporter-jaeger`, `opentelemetry-exporter-prometheus`, `opentelemetry-exporter-zipkin`, `opentelemetry-instrumentation-fetch`, `opentelemetry-instrumentation-grpc`, `opentelemetry-instrumentation-http`, `opentelemetry-instrumentation-xml-http-request`, `opentelemetry-instrumentation`, `opentelemetry-metrics`, `opentelemetry-node`, `opentelemetry-propagator-b3`, `opentelemetry-propagator-jaeger`, `opentelemetry-resource-detector-aws`, `opentelemetry-resource-detector-gcp`, `opentelemetry-resources`, `opentelemetry-sdk-node`, `opentelemetry-shim-opentracing`, `opentelemetry-tracing`, `opentelemetry-web` + * [#2225](https://github.com/open-telemetry/opentelemetry-js/pull/2225) chore: upgrading to api ver. 0.20.0 ([@obecny](https://github.com/obecny)) +* `opentelemetry-instrumentation` + * [#2224](https://github.com/open-telemetry/opentelemetry-js/pull/2224) feat(opentelemetry-instrumentation): getConfig and setConfig ([@mottibec](https://github.com/mottibec)) +* `opentelemetry-core`, `opentelemetry-instrumentation-http`, `opentelemetry-propagator-b3`, `opentelemetry-propagator-jaeger`, `opentelemetry-tracing` + * [#2202](https://github.com/open-telemetry/opentelemetry-js/pull/2202) Move suppress tracing context key to SDK ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-core`, `opentelemetry-tracing` + * [#2100](https://github.com/open-telemetry/opentelemetry-js/pull/2100) feat(tracing): allow to configure exporter by environment #1676 ([@vmarchaud](https://github.com/vmarchaud)) +* `opentelemetry-core`, `opentelemetry-exporter-collector-grpc`, `opentelemetry-exporter-collector-proto`, `opentelemetry-exporter-collector` + * [#2117](https://github.com/open-telemetry/opentelemetry-js/pull/2117) feat(exporter-collector): support config from env #2099 ([@vmarchaud](https://github.com/vmarchaud)) +* `opentelemetry-exporter-collector`, `opentelemetry-exporter-zipkin`, `opentelemetry-tracing` + * [#2183](https://github.com/open-telemetry/opentelemetry-js/pull/2183) chore: removing usage of timed event from api ([@obecny](https://github.com/obecny)) +* Other + * [#2195](https://github.com/open-telemetry/opentelemetry-js/pull/2195) fix: remove redundant try-catch from http/https server examples ([@legendecas](https://github.com/legendecas)) +* `opentelemetry-exporter-collector-grpc` + * [#2130](https://github.com/open-telemetry/opentelemetry-js/pull/2130) chore: url validation & README to prevent gRPC footguns. ([@lizthegrey](https://github.com/lizthegrey)) +* `opentelemetry-semantic-conventions` + * [#2167](https://github.com/open-telemetry/opentelemetry-js/pull/2167) semantic-conventions: include built esm files in package ([@t2t2](https://github.com/t2t2)) +* `opentelemetry-instrumentation-xml-http-request` + * [#2134](https://github.com/open-telemetry/opentelemetry-js/pull/2134) feat(instrumentation-xhr): add applyCustomAttributesOnSpan hook ([@mhennoch](https://github.com/mhennoch)) +* `opentelemetry-exporter-prometheus` + * [#2122](https://github.com/open-telemetry/opentelemetry-js/pull/2122) feat: add diag warning when metric name is invalid ([@weyert](https://github.com/weyert)) +* `opentelemetry-api-metrics`, `opentelemetry-exporter-collector-grpc`, `opentelemetry-exporter-collector-proto`, `opentelemetry-exporter-collector`, `opentelemetry-metrics` + * [#2118](https://github.com/open-telemetry/opentelemetry-js/pull/2118) chore(deps): support cumulative, delta, and pass-through exporters ([@sergeylanzman](https://github.com/sergeylanzman)) + +### :bug: (Bug Fix) + +* `opentelemetry-exporter-collector-grpc` + * [#2214](https://github.com/open-telemetry/opentelemetry-js/pull/2214) chore: fixes after last changes to url ([@obecny](https://github.com/obecny)) +* `opentelemetry-tracing` + * [#2185](https://github.com/open-telemetry/opentelemetry-js/pull/2185) fix: use invalid parent for sampler when options.root ([@dyladan](https://github.com/dyladan)) + * [#2171](https://github.com/open-telemetry/opentelemetry-js/pull/2171) fix: move initialization of const above first use #2170 ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-instrumentation-grpc` + * [#2179](https://github.com/open-telemetry/opentelemetry-js/pull/2179) chore(grpc-instrumentation): fix grpc example #2160 ([@vmarchaud](https://github.com/vmarchaud)) +* `opentelemetry-core` + * [#2165](https://github.com/open-telemetry/opentelemetry-js/pull/2165) [sampler] treat invalid SpanContext as no SpanContext ([@thisthat](https://github.com/thisthat)) + +### :books: (Refine Doc) + +* `opentelemetry-node` + * [#2180](https://github.com/open-telemetry/opentelemetry-js/pull/2180) fix docs typo ([@sbrichardson](https://github.com/sbrichardson)) +* Other + * [#2168](https://github.com/open-telemetry/opentelemetry-js/pull/2168) chore: update feature status in readme ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-instrumentation-fetch`, `opentelemetry-instrumentation-grpc`, `opentelemetry-instrumentation-http`, `opentelemetry-instrumentation-xml-http-request`, `opentelemetry-instrumentation`, `opentelemetry-node`, `opentelemetry-sdk-node`, `opentelemetry-web` + * [#2127](https://github.com/open-telemetry/opentelemetry-js/pull/2127) chore: prefer use of global TracerProvider/MeterProvider ([@Flarna](https://github.com/Flarna)) + +### :house: (Internal) + +* `opentelemetry-api-metrics`, `opentelemetry-context-async-hooks`, `opentelemetry-context-zone-peer-dep`, `opentelemetry-context-zone`, `opentelemetry-core`, `opentelemetry-exporter-collector-grpc`, `opentelemetry-exporter-collector-proto`, `opentelemetry-exporter-collector`, `opentelemetry-exporter-jaeger`, `opentelemetry-exporter-prometheus`, `opentelemetry-exporter-zipkin`, `opentelemetry-instrumentation-fetch`, `opentelemetry-instrumentation-grpc`, `opentelemetry-instrumentation-http`, `opentelemetry-instrumentation-xml-http-request`, `opentelemetry-instrumentation`, `opentelemetry-metrics`, `opentelemetry-node`, `opentelemetry-propagator-b3`, `opentelemetry-propagator-jaeger`, `opentelemetry-resource-detector-aws`, `opentelemetry-resource-detector-gcp`, `opentelemetry-resources`, `opentelemetry-sdk-node`, `opentelemetry-semantic-conventions`, `opentelemetry-shim-opentracing`, `opentelemetry-tracing`, `opentelemetry-web`, `template` + * [#2241](https://github.com/open-telemetry/opentelemetry-js/pull/2241) chore: update typescript to 4.3 and enable noImplicitOverride ([@Flarna](https://github.com/Flarna)) + * [#2204](https://github.com/open-telemetry/opentelemetry-js/pull/2204) Remove GTS and prettier ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-instrumentation-http`, `opentelemetry-instrumentation`, `opentelemetry-tracing` + * [#2229](https://github.com/open-telemetry/opentelemetry-js/pull/2229) chore: remove references to NOOP singletons ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-node`, `opentelemetry-sdk-node`, `opentelemetry-web` + * [#2230](https://github.com/open-telemetry/opentelemetry-js/pull/2230) chore: remove references to Noop classes from API ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-api-metrics`, `opentelemetry-context-zone-peer-dep`, `opentelemetry-context-zone`, `opentelemetry-core`, `opentelemetry-exporter-collector`, `opentelemetry-exporter-zipkin`, `opentelemetry-instrumentation-fetch`, `opentelemetry-instrumentation-xml-http-request`, `opentelemetry-instrumentation`, `opentelemetry-propagator-jaeger`, `opentelemetry-tracing`, `opentelemetry-web` + * [#2234](https://github.com/open-telemetry/opentelemetry-js/pull/2234) chore: downgrade karma-webpack ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-sdk-node` + * [#2219](https://github.com/open-telemetry/opentelemetry-js/pull/2219) fix(opentelemetry-sdk-node): move nock to dev dependencies ([@nflaig](https://github.com/nflaig)) +* `opentelemetry-core` + * [#2155](https://github.com/open-telemetry/opentelemetry-js/pull/2155) chore: move tracecontext propagator into trace ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-api-metrics`, `opentelemetry-context-zone-peer-dep`, `opentelemetry-context-zone`, `opentelemetry-core`, `opentelemetry-exporter-collector`, `opentelemetry-exporter-zipkin`, `opentelemetry-instrumentation-fetch`, `opentelemetry-instrumentation-xml-http-request`, `opentelemetry-instrumentation`, `opentelemetry-metrics`, `opentelemetry-propagator-b3`, `opentelemetry-propagator-jaeger`, `opentelemetry-resources`, `opentelemetry-semantic-conventions`, `opentelemetry-tracing`, `opentelemetry-web`, `template` + * [#2112](https://github.com/open-telemetry/opentelemetry-js/pull/2112) feat: add ESM builds for packages used in browser ([@t2t2](https://github.com/t2t2)) + +### Committers: 18 + +* Bartlomiej Obecny ([@obecny](https://github.com/obecny)) +* Daniel Dyla ([@dyladan](https://github.com/dyladan)) +* Gerhard Stöbich ([@Flarna](https://github.com/Flarna)) +* Giovanni Liva ([@thisthat](https://github.com/thisthat)) +* Liz Fong-Jones ([@lizthegrey](https://github.com/lizthegrey)) +* MartenH ([@mhennoch](https://github.com/mhennoch)) +* Motti Bechhofer ([@mottibec](https://github.com/mottibec)) +* Naseem ([@naseemkullah](https://github.com/naseemkullah)) +* Nico Flaig ([@nflaig](https://github.com/nflaig)) +* Sergey Lanzman ([@sergeylanzman](https://github.com/sergeylanzman)) +* Severin Neumann ([@svrnm](https://github.com/svrnm)) +* Stephen Richardson ([@sbrichardson](https://github.com/sbrichardson)) +* Valentin Marchaud ([@vmarchaud](https://github.com/vmarchaud)) +* Vera Reynolds ([@vreynolds](https://github.com/vreynolds)) +* Weyert de Boer ([@weyert](https://github.com/weyert)) +* andrew quartey ([@drexler](https://github.com/drexler)) +* legendecas ([@legendecas](https://github.com/legendecas)) +* t2t2 ([@t2t2](https://github.com/t2t2)) + ## 0.19.0 ### :boom: Breaking Change diff --git a/README.md b/README.md index 8164207055..912813294e 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,10 @@ This is the JavaScript version of [OpenTelemetry](https://opentelemetry.io/), a | API Version | Core version | Contrib Version | | ----------- |--------------|-------------------------| -| v1.0.0-rc.0 | 0.19.x | ------ | +| 1.0.0 | ------ | ------ | +| 0.21.x | 0.21.x | 0.21.x | +| 0.20.x | 0.20.x | 0.20.x | +| v1.0.0-rc.3 | 0.19.x | 0.16.x | | 0.18.x | 0.18.x | 0.14.x | | | 0.17.x | ------ | | | 0.16.x | ------ | @@ -58,6 +61,10 @@ This is the JavaScript version of [OpenTelemetry](https://opentelemetry.io/), a | | 0.12.x | 0.11.x | | | 0.11.x | 0.10.x | +## Versioning + +The current version for each package can be found in the respective `package.json` file for that module. For additional details see the [versioning and stability][spec-versioning] document in the specification. + ## Quick start ### Application Owner @@ -126,6 +133,7 @@ Approvers ([@open-telemetry/js-approvers](https://github.com/orgs/open-telemetry - [Mark Wolff](https://github.com/markwolff), Microsoft - [Matthew Wear](https://github.com/mwear), LightStep - [Naseem K. Ullah](https://github.com/naseemkullah), Transit +- [Neville Wylie](https://github.com/MSNev), Microsoft - [Olivier Albertini](https://github.com/OlivierAlbertini), Ville de Montréal *Find more about the approver role in [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver).* @@ -224,7 +232,9 @@ To request automatic tracing support for a module not on this list, please [file ## Upgrade guidelines -### 0.19.x to x +### 0.20.x to x + +### 0.19.x to 0.20.0 - `HttpBaggage` renamed to `HttpBaggagePropagator` @@ -232,6 +242,8 @@ To request automatic tracing support for a module not on this list, please [file - `JaegerHttpTracePropagator` renamed to `JaegerPropagator` +- `serviceName` configuration removed from Collector exporters. Use `service.name` Resource attribute instead. + ### 0.18.x to 0.19.0 - API is now a peer dependency. This means that users will need to include `@opentelemetry/api` as a dependency of their project in order to use the SDK. NPM version 7+ (Node 15+) should do this automatically. @@ -416,7 +428,7 @@ Apache 2.0 - See [LICENSE][license-url] for more information. [otel-shim-opentracing]: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-shim-opentracing [otel-tracing]: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-tracing [otel-web]: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-web -[otel-api]: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-api +[otel-api]: https://github.com/open-telemetry/opentelemetry-js-api [otel-core]: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-core [generate-api-documentation]: https://github.com/open-telemetry/opentelemetry-js/blob/main/CONTRIBUTING.md#generating-api-documentation @@ -431,3 +443,5 @@ Apache 2.0 - See [LICENSE][license-url] for more information. [otel-contrib-instrumentation-document-load]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/web/opentelemetry-instrumentation-document-load [otel-contrib-instrumentation-hapi]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/node/opentelemetry-instrumentation-hapi [otel-contrib-instrumentation-koa]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/node/opentelemetry-instrumentation-koa + +[spec-versioning]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md diff --git a/RELEASING.md b/RELEASING.md index cfb49f3fe6..6f7a8cddf1 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -1,10 +1,10 @@ -# Releasing OpenTelemetry Packages (for Maintainers Only) +# Releasing OpenTelemetry Packages This document explains how to publish all OT modules at version x.y.z. Ensure that you’re following semver when choosing a version number. Release Process: -- [Releasing OpenTelemetry Packages (for Maintainers Only)](#releasing-opentelemetry-packages-for-maintainers-only) +- [Release Process (Maintainers only)](#release-process) - [Update to latest locally](#update-to-latest-locally) - [Create a new branch](#create-a-new-branch) - [Prepare each package for release](#prepare-each-package-for-release) @@ -19,15 +19,17 @@ Release Process: - [Update CHANGELOG](#update-changelog) - [Known Issues](#known-issues) -## Update to latest locally +## Release Process + +### Update to latest locally Use `git fetch` and `git checkout origin/main` to ensure you’re on the latest commit. Make sure you have no unstaged changes. Ideally, also use `git clean -dfx` to remove all ignored and untracked files. -## Create a new branch +### Create a new branch Create a new branch called `x.y.z-proposal` from the current commit. -## Prepare each package for release +### Prepare each package for release Decide on the next `major.minor.patch` release number based on [semver](http://semver.org/) guidelines. @@ -35,13 +37,13 @@ Decide on the next `major.minor.patch` release number based on [semver](http://s - Use `lerna publish --skip-npm --no-git-tag-version --no-push` to bump the version in all `package.json` - Use `npm run bootstrap` to generate latest `version.ts` files -## Use the Changelog to create a GitHub Release +### Use the Changelog to create a GitHub Release -### Generate the changelog with lerna +#### Generate the changelog with lerna Since we use `lerna`, we can use [lerna-changelog](https://github.com/lerna/lerna-changelog#lerna-changelog) -#### How to use +##### How to use Pass your [github token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) to generate the changelog automatically. For security reasons, when you create a Github token, select the permissions: under **repo**, select **Access public repositories**, **Access commit status**. @@ -55,15 +57,15 @@ GITHUB_AUTH= lerna-changelog It will print something like: ```md -## Unreleased (2018-05-24) +### Unreleased (2018-05-24) -#### :bug: Bug Fix +##### :bug: Bug Fix * [#198](https://github.com/my-org/my-repo/pull/198) Avoid an infinite loop ([@helpful-hacker](https://github.com/helpful-hacker)) -#### :house: Internal +##### :house: Internal * [#183](https://github.com/my-org/my-repo/pull/183) Standardize error messages ([@careful-coder](https://github.com/careful-coder)) -#### Commiters: 2 +##### Commiters: 2 - Helpful Hacker ([@helpful-hacker](https://github.com/helpful-hacker)) - [@careful-coder](https://github.com/careful-coder) ``` @@ -76,21 +78,21 @@ You can also use the `--from` and `--to` options to view a different range of pu GITHUB_AUTH=xxxxx lerna-changelog --from=v1.0.0 --to=v2.0.0 ``` -#### Update Changelog file +##### Update Changelog file From what `lerna-changelog` has generated, starts new Unreleased label. Follow the example set by recent Released label. On [GitHub Releases](https://github.com/open-telemetry/opentelemetry-js/releases), follow the example set by recent releases to populate a summary of changes, as well as a list of commits that were applied since the last release. Save it as a draft, don’t publish it. Don’t forget the tag -- call it `vx.y.z` and leave it pointing at `main` for now (this can be changed as long as the GitHub release isn’t published). -## Create a new PR +### Create a new PR Create a pull request titled `chore: x.y.z release proposal`. The commit body should just be a link to the draft notes. Someone who can access draft notes should approve it, looking in particular for test passing, and whether the draft notes are satisfactory. -## Merge and pull +### Merge and pull Merge the PR, and pull the changes locally (using the commands in the first step). Ensure that `chore: x.y.z release proposal` is the most recent commit. -## Publish all packages +### Publish all packages Go into each directory and use `npm publish` (requires permissions) to publish the package. You can use the following script to automate this. @@ -106,16 +108,16 @@ done Check your e-mail and make sure the number of “you’ve published this module” emails matches the number you expect. -## Publish the GitHub Release +### Publish the GitHub Release Publish the GitHub release, ensuring that the tag points to the newly landed commit corresponding to release proposal `x.y.z`. -## Update CHANGELOG +### Update CHANGELOG - After releasing is done, update the [CHANGELOG.md](https://github.com/open-telemetry/opentelemetry-js/blob/main/CHANGELOG.md) and start new Unreleased label. - Create a new commit with the exact title: `Post Release: update CHANGELOG.md`. - Go through PR review and merge it to GitHub main branch. -## Known Issues +### Known Issues - The `examples/` and `getting-started/` folders are not part of lerna packages, we need to manually bump the version in `package.json`. diff --git a/backwards-compatability/node10/package.json b/backwards-compatability/node10/package.json index e16056a20e..795fa052f2 100644 --- a/backwards-compatability/node10/package.json +++ b/backwards-compatability/node10/package.json @@ -1,6 +1,6 @@ { "name": "backcompat-node10", - "version": "0.19.0", + "version": "0.21.0", "private": true, "description": "Backwards compatability app for node8 types and the OpenTelemetry Node.js SDK", "main": "index.js", @@ -8,12 +8,12 @@ "test:backcompat": "tsc --noEmit index.ts" }, "dependencies": { - "@opentelemetry/sdk-node": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/sdk-node": "0.21.0", + "@opentelemetry/tracing": "0.21.0" }, "devDependencies": { "@types/node": "10.17.59", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "author": "OpenTelemetry Authors", "license": "Apache-2.0" diff --git a/backwards-compatability/node12/package.json b/backwards-compatability/node12/package.json index 38dab3f3e0..9db0f09b41 100644 --- a/backwards-compatability/node12/package.json +++ b/backwards-compatability/node12/package.json @@ -1,6 +1,6 @@ { "name": "backcompat-node12", - "version": "0.19.0", + "version": "0.21.0", "private": true, "description": "Backwards compatability app for node8 types and the OpenTelemetry Node.js SDK", "main": "index.js", @@ -8,12 +8,12 @@ "test:backcompat": "tsc --noEmit index.ts" }, "dependencies": { - "@opentelemetry/sdk-node": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/sdk-node": "0.21.0", + "@opentelemetry/tracing": "0.21.0" }, "devDependencies": { "@types/node": "12.20.11", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "author": "OpenTelemetry Authors", "license": "Apache-2.0" diff --git a/backwards-compatability/node8/package.json b/backwards-compatability/node8/package.json index 870628238f..6494ea175a 100644 --- a/backwards-compatability/node8/package.json +++ b/backwards-compatability/node8/package.json @@ -1,6 +1,6 @@ { "name": "backcompat-node8", - "version": "0.19.0", + "version": "0.21.0", "private": true, "description": "Backwards compatability app for node8 types and the OpenTelemetry Node.js SDK", "main": "index.js", @@ -8,12 +8,12 @@ "test:backcompat": "tsc --noEmit index.ts" }, "dependencies": { - "@opentelemetry/sdk-node": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/sdk-node": "0.21.0", + "@opentelemetry/tracing": "0.21.0" }, "devDependencies": { "@types/node": "8.10.66", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "author": "OpenTelemetry Authors", "license": "Apache-2.0" diff --git a/eslint.config.js b/eslint.config.js index 938de96c05..a1514132f9 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,11 +1,10 @@ module.exports = { plugins: [ "@typescript-eslint", - "header" - ], - extends: [ - "./node_modules/gts", + "header", + "node" ], + extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"], parser: "@typescript-eslint/parser", parserOptions: { "project": "./tsconfig.json" @@ -13,6 +12,7 @@ module.exports = { rules: { "@typescript-eslint/no-floating-promises": 2, "@typescript-eslint/no-this-alias": "off", + "brace-style": ["error", "1tbs"], "eqeqeq": [ "error", "smart" @@ -32,8 +32,14 @@ module.exports = { "@typescript-eslint/no-shadow": ["warn"], "@typescript-eslint/no-unused-vars": ["error", {"argsIgnorePattern": "^_", "args": "after-used"}], "@typescript-eslint/no-inferrable-types": ["error", { ignoreProperties: true }], + "@typescript-eslint/no-empty-function": ["off"], + "@typescript-eslint/ban-types": ["warn", { + "types": { + "Function": null, + } + }], + "@typescript-eslint/no-shadow": ["warn"], "arrow-parens": ["error", "as-needed"], - "prettier/prettier": ["error", { "singleQuote": true, "arrowParens": "avoid" }], "node/no-deprecated-api": ["warn"], "header/header": [2, "block", [{ pattern: / \* Copyright The OpenTelemetry Authors[\r\n]+ \*[\r\n]+ \* Licensed under the Apache License, Version 2\.0 \(the \"License\"\);[\r\n]+ \* you may not use this file except in compliance with the License\.[\r\n]+ \* You may obtain a copy of the License at[\r\n]+ \*[\r\n]+ \* https:\/\/www\.apache\.org\/licenses\/LICENSE-2\.0[\r\n]+ \*[\r\n]+ \* Unless required by applicable law or agreed to in writing, software[\r\n]+ \* distributed under the License is distributed on an \"AS IS\" BASIS,[\r\n]+ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.[\r\n]+ \* See the License for the specific language governing permissions and[\r\n]+ \* limitations under the License\./gm, @@ -53,6 +59,9 @@ module.exports = { "@typescript-eslint/no-unused-vars": "off", "@typescript-eslint/no-var-requires": "off", "@typescript-eslint/no-shadow": ["off"], + "@typescript-eslint/no-floating-promises": ["off"], + "@typescript-eslint/no-non-null-assertion": ["off"], + "@typescript-eslint/explicit-module-boundary-types": ["off"] } } ] diff --git a/examples/basic-tracer-node/docker/ot/collector-config.yaml b/examples/basic-tracer-node/docker/ot/collector-config.yaml index b4bc9cb9fc..b550ca4fa6 100644 --- a/examples/basic-tracer-node/docker/ot/collector-config.yaml +++ b/examples/basic-tracer-node/docker/ot/collector-config.yaml @@ -1,18 +1,23 @@ receivers: - opencensus: - endpoint: 0.0.0.0:55678 + otlp: + protocols: + grpc: + http: + cors_allowed_origins: + - http://* + - https://* exporters: - zipkin: - url: "http://zipkin-all-in-one:9411/api/v2/spans" + jaeger: + endpoint: jaeger-all-in-one:14250 + insecure: true processors: batch: - queued_retry: service: pipelines: traces: - receivers: [opencensus] - exporters: [zipkin] - processors: [batch, queued_retry] + receivers: [otlp] + exporters: [jaeger] + processors: [batch] diff --git a/examples/basic-tracer-node/docker/ot/docker-compose.yaml b/examples/basic-tracer-node/docker/ot/docker-compose.yaml index 3e486bfb05..a2068c155b 100644 --- a/examples/basic-tracer-node/docker/ot/docker-compose.yaml +++ b/examples/basic-tracer-node/docker/ot/docker-compose.yaml @@ -1,19 +1,25 @@ -version: "2" +version: "3.8" services: # Collector - collector: - image: otelcol:latest + otel-collector: + image: otel/opentelemetry-collector:0.27.0 command: ["--config=/conf/collector-config.yaml", "--log-level=DEBUG"] volumes: - ./collector-config.yaml:/conf/collector-config.yaml ports: - - "55678:55678" + - "9464:9464" + - "4317:4317" + - "55681:55681" depends_on: - - zipkin-all-in-one + - jaeger-all-in-one - # Zipkin - zipkin-all-in-one: - image: openzipkin/zipkin:latest + # Jaeger + jaeger-all-in-one: + image: jaegertracing/all-in-one:1.22.0 ports: - - "9411:9411" + - "16686:16686" + - "14268:14268" + - "14250" + + diff --git a/examples/basic-tracer-node/index.js b/examples/basic-tracer-node/index.js index fd046c0d45..c43657e96e 100644 --- a/examples/basic-tracer-node/index.js +++ b/examples/basic-tracer-node/index.js @@ -7,7 +7,10 @@ const { JaegerExporter } = require('@opentelemetry/exporter-jaeger'); const provider = new BasicTracerProvider(); // Configure span processor to send spans to the exporter -const exporter = new JaegerExporter({ serviceName: 'basic-service' }); +const exporter = new JaegerExporter({ + serviceName: 'basic-service', + endpoint: 'http://localhost:14268/api/traces', +}); provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter())); @@ -37,7 +40,7 @@ exporter.shutdown(); function doWork(parent) { // Start another span. In this example, the main method already started a // span, so that'll be the parent span, and this will be a child span. - const ctx = opentelemetry.setSpan(opentelemetry.context.active(), parent); + const ctx = opentelemetry.trace.setSpan(opentelemetry.context.active(), parent); const span = tracer.startSpan('doWork', undefined, ctx); // simulate some random work. diff --git a/examples/basic-tracer-node/package.json b/examples/basic-tracer-node/package.json index 908b7a3cfa..90d479060e 100644 --- a/examples/basic-tracer-node/package.json +++ b/examples/basic-tracer-node/package.json @@ -1,7 +1,7 @@ { "name": "example-basic-tracer-node", "private": true, - "version": "0.19.0", + "version": "0.21.0", "description": "Example of using @opentelemetry/tracing in Node.js", "main": "index.js", "scripts": { @@ -24,9 +24,9 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/exporter-jaeger": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/api": "^0.21.0", + "@opentelemetry/exporter-jaeger": "0.21.0", + "@opentelemetry/tracing": "0.21.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme" } diff --git a/examples/collector-exporter-node/package.json b/examples/collector-exporter-node/package.json index f5b670a9fd..5f879b76a7 100644 --- a/examples/collector-exporter-node/package.json +++ b/examples/collector-exporter-node/package.json @@ -1,7 +1,7 @@ { "name": "example-collector-exporter-node", "private": true, - "version": "0.19.0", + "version": "0.21.0", "description": "Example of using @opentelemetry/collector-exporter in Node.js", "main": "index.js", "scripts": { @@ -28,13 +28,13 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/exporter-collector": "0.19.0", - "@opentelemetry/exporter-collector-grpc": "0.19.0", - "@opentelemetry/exporter-collector-proto": "0.19.0", - "@opentelemetry/metrics": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/api": "^0.21.0", + "@opentelemetry/core": "0.21.0", + "@opentelemetry/exporter-collector": "0.21.0", + "@opentelemetry/exporter-collector-grpc": "0.21.0", + "@opentelemetry/exporter-collector-proto": "0.21.0", + "@opentelemetry/metrics": "0.21.0", + "@opentelemetry/tracing": "0.21.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme" } diff --git a/examples/collector-exporter-node/tracing.js b/examples/collector-exporter-node/tracing.js index 96c03db64d..5f0bd39e17 100644 --- a/examples/collector-exporter-node/tracing.js +++ b/examples/collector-exporter-node/tracing.js @@ -42,7 +42,7 @@ setTimeout(() => { function doWork(parent) { // Start another span. In this example, the main method already started a // span, so that'll be the parent span, and this will be a child span. - const ctx = opentelemetry.setSpan(opentelemetry.context.active(), parent); + const ctx = opentelemetry.trace.setSpan(opentelemetry.context.active(), parent); const span = tracer.startSpan('doWork', undefined, ctx); // simulate some random work. diff --git a/examples/grpc-js/client.js b/examples/grpc-js/client.js index 48820ee136..471f6ff94d 100644 --- a/examples/grpc-js/client.js +++ b/examples/grpc-js/client.js @@ -15,8 +15,8 @@ function main() { // the span, which is created to track work that happens outside of the // request lifecycle entirely. const span = tracer.startSpan('client.js:main()'); - api.context.with(api.setSpan(api.context.active(), span), () => { - console.log('Client traceId ', span.context().traceId); + api.context.with(api.trace.setSpan(api.context.active(), span), () => { + console.log('Client traceId ', span.spanContext().traceId); const client = new services.GreeterClient( `localhost:${PORT}`, grpc.credentials.createInsecure(), diff --git a/examples/grpc-js/package.json b/examples/grpc-js/package.json index 7574d16972..ceef0bbf9a 100644 --- a/examples/grpc-js/package.json +++ b/examples/grpc-js/package.json @@ -1,7 +1,7 @@ { "name": "grpc-js-example", "private": true, - "version": "0.19.0", + "version": "0.21.0", "description": "Example of @grpc/grpc-js integration with OpenTelemetry", "main": "index.js", "scripts": { @@ -29,13 +29,13 @@ }, "dependencies": { "@grpc/grpc-js": "^1.2.12", - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/exporter-jaeger": "0.19.0", - "@opentelemetry/exporter-zipkin": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/instrumentation-grpc": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/api": "^0.21.0", + "@opentelemetry/exporter-jaeger": "0.21.0", + "@opentelemetry/exporter-zipkin": "0.21.0", + "@opentelemetry/instrumentation": "0.21.0", + "@opentelemetry/instrumentation-grpc": "0.21.0", + "@opentelemetry/node": "0.21.0", + "@opentelemetry/tracing": "0.21.0", "google-protobuf": "^3.9.2" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme", diff --git a/examples/grpc-js/server.js b/examples/grpc-js/server.js index 90b023815a..e76a112288 100644 --- a/examples/grpc-js/server.js +++ b/examples/grpc-js/server.js @@ -22,9 +22,9 @@ function startServer() { } function sayHello(call, callback) { - const currentSpan = api.getSpan(api.context.active()); + const currentSpan = api.trace.getSpan(api.context.active()); // display traceid in the terminal - console.log(`traceid: ${currentSpan.context().traceId}`); + console.log(`traceid: ${currentSpan.spanContext().traceId}`); const span = tracer.startSpan('server.js:sayHello()', { kind: 1, // server attributes: { key: 'value' }, diff --git a/examples/grpc/client.js b/examples/grpc/client.js index 5bb4b630aa..56825a906b 100644 --- a/examples/grpc/client.js +++ b/examples/grpc/client.js @@ -15,8 +15,8 @@ function main() { // the span, which is created to track work that happens outside of the // request lifecycle entirely. const span = tracer.startSpan('client.js:main()'); - api.context.with(api.setSpan(api.context.active(), span), () => { - console.log('Client traceId ', span.context().traceId); + api.context.with(api.trace.setSpan(api.context.active(), span), () => { + console.log('Client traceId ', span.spanContext().traceId); const client = new services.GreeterClient( `localhost:${PORT}`, grpc.credentials.createInsecure(), diff --git a/examples/grpc/package.json b/examples/grpc/package.json index b2379391f4..5e9de0afa9 100644 --- a/examples/grpc/package.json +++ b/examples/grpc/package.json @@ -1,7 +1,7 @@ { "name": "grpc-example", "private": true, - "version": "0.19.0", + "version": "0.21.0", "description": "Example of gRPC integration with OpenTelemetry", "main": "index.js", "scripts": { @@ -28,13 +28,13 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/exporter-jaeger": "0.19.0", - "@opentelemetry/exporter-zipkin": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/instrumentation-grpc": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/api": "^0.21.0", + "@opentelemetry/exporter-jaeger": "0.21.0", + "@opentelemetry/exporter-zipkin": "0.21.0", + "@opentelemetry/instrumentation": "0.21.0", + "@opentelemetry/instrumentation-grpc": "0.21.0", + "@opentelemetry/node": "0.21.0", + "@opentelemetry/tracing": "0.21.0", "google-protobuf": "^3.9.2", "grpc": "^1.23.3", "node-pre-gyp": "0.14.0" diff --git a/examples/grpc/server.js b/examples/grpc/server.js index 40db771365..7422f63edb 100644 --- a/examples/grpc/server.js +++ b/examples/grpc/server.js @@ -21,9 +21,9 @@ function startServer() { } function sayHello(call, callback) { - const currentSpan = api.getSpan(api.context.active()); + const currentSpan = api.trace.getSpan(api.context.active()); // display traceid in the terminal - console.log(`traceid: ${currentSpan.context().traceId}`); + console.log(`traceid: ${currentSpan.spanContext().traceId}`); const span = tracer.startSpan('server.js:sayHello()', { parent: currentSpan, kind: 1, // server diff --git a/examples/http/client.js b/examples/http/client.js index a27ba0355e..79dcc99a5a 100644 --- a/examples/http/client.js +++ b/examples/http/client.js @@ -11,7 +11,7 @@ function makeRequest() { // the span, which is created to track work that happens outside of the // request lifecycle entirely. const span = tracer.startSpan('makeRequest'); - api.context.with(api.setSpan(api.context.active(), span), () => { + api.context.with(api.trace.setSpan(api.context.active(), span), () => { http.get({ host: 'localhost', port: 8080, diff --git a/examples/http/package.json b/examples/http/package.json index 0527162a8c..f65a70d91f 100644 --- a/examples/http/package.json +++ b/examples/http/package.json @@ -1,7 +1,7 @@ { "name": "http-example", "private": true, - "version": "0.19.0", + "version": "0.21.0", "description": "Example of HTTP integration with OpenTelemetry", "main": "index.js", "scripts": { @@ -28,13 +28,13 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/exporter-jaeger": "0.19.0", - "@opentelemetry/exporter-zipkin": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/instrumentation-http": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/api": "^0.21.0", + "@opentelemetry/exporter-jaeger": "0.21.0", + "@opentelemetry/exporter-zipkin": "0.21.0", + "@opentelemetry/instrumentation": "0.21.0", + "@opentelemetry/instrumentation-http": "0.21.0", + "@opentelemetry/node": "0.21.0", + "@opentelemetry/tracing": "0.21.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme", "devDependencies": { diff --git a/examples/http/server.js b/examples/http/server.js index 604f688f84..b8d4f1e003 100644 --- a/examples/http/server.js +++ b/examples/http/server.js @@ -20,9 +20,9 @@ function startServer(port) { /** A function which handles requests and send response. */ function handleRequest(request, response) { - const currentSpan = api.getSpan(api.context.active()); + const currentSpan = api.trace.getSpan(api.context.active()); // display traceid in the terminal - console.log(`traceid: ${currentSpan.context().traceId}`); + console.log(`traceid: ${currentSpan.spanContext().traceId}`); const span = tracer.startSpan('handleRequest', { kind: 1, // server attributes: { key: 'value' }, diff --git a/examples/https/client.js b/examples/https/client.js index d842becef3..4befda7955 100644 --- a/examples/https/client.js +++ b/examples/https/client.js @@ -11,7 +11,7 @@ function makeRequest() { // the span, which is created to track work that happens outside of the // request lifecycle entirely. const span = tracer.startSpan('makeRequest'); - api.context.with(api.setSpan(api.context.active(), span), () => { + api.context.with(api.trace.setSpan(api.context.active(), span), () => { https.get({ host: 'localhost', port: 443, diff --git a/examples/https/package.json b/examples/https/package.json index 8826242b54..f8852199c8 100644 --- a/examples/https/package.json +++ b/examples/https/package.json @@ -1,7 +1,7 @@ { "name": "https-example", "private": true, - "version": "0.19.0", + "version": "0.21.0", "description": "Example of HTTPs integration with OpenTelemetry", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -29,13 +29,13 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/exporter-jaeger": "0.19.0", - "@opentelemetry/exporter-zipkin": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/instrumentation-http": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/api": "^0.21.0", + "@opentelemetry/exporter-jaeger": "0.21.0", + "@opentelemetry/exporter-zipkin": "0.21.0", + "@opentelemetry/instrumentation": "0.21.0", + "@opentelemetry/instrumentation-http": "0.21.0", + "@opentelemetry/node": "0.21.0", + "@opentelemetry/tracing": "0.21.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme", "devDependencies": { diff --git a/examples/https/server-cert.pem b/examples/https/server-cert.pem index e2b79024da..4dd904f088 100644 --- a/examples/https/server-cert.pem +++ b/examples/https/server-cert.pem @@ -1,11 +1,22 @@ -----BEGIN CERTIFICATE----- -MIIBqzCCARQCCQDLcUeJsLDL5jANBgkqhkiG9w0BAQUFADAaMQswCQYDVQQGEwJD -QTELMAkGA1UECAwCUUMwHhcNMTkwOTI5MjIwMDI2WhcNMTkxMDI5MjIwMDI2WjAa -MQswCQYDVQQGEwJDQTELMAkGA1UECAwCUUMwgZ8wDQYJKoZIhvcNAQEBBQADgY0A -MIGJAoGBALhfi1dwIyC1Jha4N/j/VtlPPi+j+SZQGZqLNVVgzzGY7+cc3VkCySZD -yXh3Z+/ftp9DDKdHRutJQE0R4peSDussC/IQDJKzuKN/O9S6tnNlgUr5YZLRENxL -FSJIY5cIkty50IrEhlN5QeDJP8p4yrYq9J6M0yzyfdqIWI3CBqbzAgMBAAEwDQYJ -KoZIhvcNAQEFBQADgYEArnOeXmXXJTK39Ma25elHxlYUZiYOBu/truy5zmx4umyS -GyehAv+jRIanoCRWtOBnrjS5CY/6cC64aIVLMoqXEFIL7q/GD0wEM/DS8rN7KTcp -w+nIX98srYaAFeQZScPioS6WpXz5AjbTVhvAwkIm2/s6dOlX31+1zu6Zu6ASSuQ= +MIIDozCCAougAwIBAgIUZdBdHwmbcYbMUvOesYRyYlg11JMwDQYJKoZIhvcNAQEL +BQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQHDBFPcGVuVGVs +ZW1ldHJ5VGVzdDENMAsGA1UECgwE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fZYu4m +iMhztKH3PWjDB+jSzcOv9FXeYWgprWk= -----END CERTIFICATE----- diff --git a/examples/https/server-key.pem b/examples/https/server-key.pem index 405c5fa0d7..267ed0464e 100644 --- a/examples/https/server-key.pem +++ b/examples/https/server-key.pem @@ -1,15 +1,28 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQC4X4tXcCMgtSYWuDf4/1bZTz4vo/kmUBmaizVVYM8xmO/nHN1Z -AskmQ8l4d2fv37afQwynR0brSUBNEeKXkg7rLAvyEAySs7ijfzvUurZzZYFK+WGS -0RDcSxUiSGOXCJLcudCKxIZTeUHgyT/KeMq2KvSejNMs8n3aiFiNwgam8wIDAQAB -AoGBAKBztcYQduGeBFm9VCjDvgc8KTg4kTlAeCfAglec+nOFTzJoMlGmVPuR/qFx -+OgOXtXW+goRw6w7gVQQ/os9tvCCp7awSC5UCfPejHh6bW2B0BF2lZJ6B9y+u5Fa -/p8oKoJGcC4eagVnDojuoYJHSqWBf7d7V/U54NpxwgBTsHAhAkEA8PJROgWzjMl2 -Gs5j8oBldEqzrC/d4K1uMEvCTb4RJ+t6jWq+Ug/vqvCfIcLfxHbOmTbOHTfhpv/d -NUf9eDyBGwJBAMPkZaHP5vPDd900MqypLVasollzxgPnMUg35EEQJLAbb/5xG3X9 -ZbaVDTRtLQYNFvDZLlTpRpCPxZCgrn9hJwkCQQDPEVChLrkpqxFm5CydAZ8vG+vh -dJmYNzPVKaZorYmM5yBBXJUHbU6pd3UqzJEGBJx0q9bi4V156bYvzhiVNlo1AkBu -1hbvFCwPtoRmg3c8nEhL50fApzHd2XzX6M/cRF8Nyah3ZdXsz6AyS2l6RV+ZMeTO -B4QghRDpEH/vUgsJhZXJAkB5GQZPJh6/kozc5+Ffc60ThN/58SX0KEFeKnWRlzfr -vfBXwcmaz1oNXN+kcWdLnKbr/tx+3UQ6weRRmeYX/hOi ------END RSA PRIVATE KEY----- +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0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J237FB +gcPyGNeY2wKBgQDOD4038zInolk75YYHxzFm78X55ZETtipBTLzyGjXLD4SvUM4U +uXEbjQsL9q2ztJbbsPTujU8u3DYeS9GY81hD8kjRnc0LeDt05JJtNu/vfYs+uXKb +h39nyEfzhHlapi/U5lmyTtDbCm5emTvxxvvsxmBcaH3UOhXYk7amEJ3/xQKBgA+s +svj3agqv0krYmD1ZH2zgE6rdWMCFQ3cwEKYT2PP7n3Jl0YQjcjDuqBHhEXzxSqmf +tjH8LLFvE947R0Y/N9v7D0zA/v/6v0gGnld/B5gpqBM8dd/szfGEpzA9t600g90q +s904Qh5k2osXhOoDN2pjwFRQ9Ikhez4bIkZPKJavAoGAV2YPXyw5rrAZtCtybqsO +B+15Lh+KC+vs0rBBhb0MUpXQPgQ6SX8ozpLHtqlsUpNfHwOk5K958jMrM9Rx4dhS +Z6WuTa+9QpmXzYTnCDBbEU06+YB1QR2QfU4BlAAu1RtUbbt84/7OAoNh2IqOO4XJ +THlhj8odimsk4R1B0RipBis= +-----END PRIVATE KEY----- diff --git a/examples/https/server.js b/examples/https/server.js index d4a2357368..73fc6d3535 100644 --- a/examples/https/server.js +++ b/examples/https/server.js @@ -25,9 +25,9 @@ function startServer(port) { /** A function which handles requests and send response. */ function handleRequest(request, response) { - const currentSpan = api.getSpan(api.context.active()); + const currentSpan = api.trace.getSpan(api.context.active()); // display traceid in the terminal - console.log(`traceid: ${currentSpan.context().traceId}`); + console.log(`traceid: ${currentSpan.spanContext().traceId}`); const span = tracer.startSpan('handleRequest', { kind: 1, // server attributes: { key: 'value' }, diff --git a/examples/metrics/package.json b/examples/metrics/package.json index fd58c20554..38034ae5f5 100644 --- a/examples/metrics/package.json +++ b/examples/metrics/package.json @@ -1,7 +1,7 @@ { "name": "example-metrics", "private": true, - "version": "0.19.0", + "version": "0.21.0", "description": "Example of using @opentelemetry/metrics", "main": "index.js", "scripts": { @@ -26,9 +26,9 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/exporter-prometheus": "0.19.0", - "@opentelemetry/metrics": "0.19.0" + "@opentelemetry/core": "0.21.0", + "@opentelemetry/exporter-prometheus": "0.21.0", + "@opentelemetry/metrics": "0.21.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme" } diff --git a/examples/opentracing-shim/package.json b/examples/opentracing-shim/package.json index 834ce7caa3..4eac185b91 100644 --- a/examples/opentracing-shim/package.json +++ b/examples/opentracing-shim/package.json @@ -1,7 +1,7 @@ { "name": "opentracing-shim", "private": true, - "version": "0.19.0", + "version": "0.21.0", "description": "Example of using @opentelemetry/shim-opentracing in Node.js", "main": "index.js", "scripts": { @@ -29,12 +29,12 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/exporter-jaeger": "0.19.0", - "@opentelemetry/exporter-zipkin": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/shim-opentracing": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/exporter-jaeger": "0.21.0", + "@opentelemetry/exporter-zipkin": "0.21.0", + "@opentelemetry/instrumentation": "0.21.0", + "@opentelemetry/node": "0.21.0", + "@opentelemetry/shim-opentracing": "0.21.0", + "@opentelemetry/tracing": "0.21.0", "opentracing": "^0.14.4" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme", diff --git a/examples/opentracing-shim/server.js b/examples/opentracing-shim/server.js index a21f93a149..cf54c646fb 100644 --- a/examples/opentracing-shim/server.js +++ b/examples/opentracing-shim/server.js @@ -37,7 +37,7 @@ async function handleRequest(req, res) { res.writeHead(200, { 'Content-Type': 'application/json' }); res.write( - JSON.stringify({ status: 'OK', traceId: span.context().toTraceId() }), + JSON.stringify({ status: 'OK', traceId: span.spanContext().toTraceId() }), ); res.end(); diff --git a/examples/prometheus/package.json b/examples/prometheus/package.json index e63c1f8a48..90097742a7 100644 --- a/examples/prometheus/package.json +++ b/examples/prometheus/package.json @@ -1,6 +1,6 @@ { "name": "prometheus-example", - "version": "0.19.0", + "version": "0.21.0", "description": "Example of using @opentelemetry/metrics and @opentelemetry/exporter-prometheus", "main": "index.js", "scripts": { @@ -9,7 +9,7 @@ "author": "OpenTelemetry Authors", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/exporter-prometheus": "0.19.0", - "@opentelemetry/metrics": "0.19.0" + "@opentelemetry/exporter-prometheus": "0.21.0", + "@opentelemetry/metrics": "0.21.0" } } diff --git a/examples/tracer-web/examples/fetch/index.js b/examples/tracer-web/examples/fetch/index.js index 97f9910d2d..10a7c5f2a5 100644 --- a/examples/tracer-web/examples/fetch/index.js +++ b/examples/tracer-web/examples/fetch/index.js @@ -1,7 +1,5 @@ 'use strict'; -// for debugging -// import { context, getSpan, setSpan } from '../../../../packages/opentelemetry-api/src'; -import { context, getSpan, setSpan } from '@opentelemetry/api'; +import { context, trace } from '@opentelemetry/api'; import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing'; import { CollectorTraceExporter } from '@opentelemetry/exporter-collector'; import { WebTracerProvider } from '@opentelemetry/web'; @@ -49,17 +47,17 @@ const prepareClickEvent = () => { const onClick = () => { const singleSpan = webTracerWithZone.startSpan(`files-series-info`); - context.with(setSpan(context.active(), singleSpan), () => { + context.with(trace.setSpan(context.active(), singleSpan), () => { getData(url).then((_data) => { - getSpan(context.active()).addEvent('fetching-single-span-completed'); + trace.getSpan(context.active()).addEvent('fetching-single-span-completed'); singleSpan.end(); }); }); for (let i = 0, j = 5; i < j; i += 1) { const span = webTracerWithZone.startSpan(`files-series-info-${i}`); - context.with(setSpan(context.active(), span), () => { + context.with(trace.setSpan(context.active(), span), () => { getData(url).then((_data) => { - getSpan(context.active()).addEvent(`fetching-span-${i}-completed`); + trace.getSpan(context.active()).addEvent(`fetching-span-${i}-completed`); span.end(); }); }); diff --git a/examples/tracer-web/examples/xml-http-request/index.js b/examples/tracer-web/examples/xml-http-request/index.js index c3990efe7a..0c2b0d8a5e 100644 --- a/examples/tracer-web/examples/xml-http-request/index.js +++ b/examples/tracer-web/examples/xml-http-request/index.js @@ -1,4 +1,4 @@ -import { context, getSpan, setSpan } from '@opentelemetry/api'; +import { context, trace } from '@opentelemetry/api'; import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing'; import { WebTracerProvider } from '@opentelemetry/web'; import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request'; @@ -53,12 +53,12 @@ const prepareClickEvent = () => { const onClick = () => { for (let i = 0, j = 5; i < j; i += 1) { const span1 = webTracerWithZone.startSpan(`files-series-info-${i}`); - context.with(setSpan(context.active(), span1), () => { + context.with(trace.setSpan(context.active(), span1), () => { getData(url1).then((_data) => { - getSpan(context.active()).addEvent('fetching-span1-completed'); + trace.getSpan(context.active()).addEvent('fetching-span1-completed'); span1.end(); }, ()=> { - getSpan(context.active()).addEvent('fetching-error'); + trace.getSpan(context.active()).addEvent('fetching-error'); span1.end(); }); }); diff --git a/examples/tracer-web/package.json b/examples/tracer-web/package.json index dd06ea5474..b76ac6a2e4 100644 --- a/examples/tracer-web/package.json +++ b/examples/tracer-web/package.json @@ -1,7 +1,7 @@ { "name": "web-tracer-example", "private": true, - "version": "0.19.0", + "version": "0.21.0", "description": "Example of using @opentelemetry/web in browser", "main": "index.js", "scripts": { @@ -34,18 +34,18 @@ "webpack-merge": "^4.2.2" }, "dependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/context-zone": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/exporter-collector": "0.19.0", - "@opentelemetry/exporter-zipkin": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/instrumentation-fetch": "0.19.0", - "@opentelemetry/instrumentation-xml-http-request": "0.19.0", - "@opentelemetry/metrics": "0.19.0", - "@opentelemetry/propagator-b3": "0.19.0", - "@opentelemetry/tracing": "0.19.0", - "@opentelemetry/web": "0.19.0" + "@opentelemetry/api": "^0.21.0", + "@opentelemetry/context-zone": "0.21.0", + "@opentelemetry/core": "0.21.0", + "@opentelemetry/exporter-collector": "0.21.0", + "@opentelemetry/exporter-zipkin": "0.21.0", + "@opentelemetry/instrumentation": "0.21.0", + "@opentelemetry/instrumentation-fetch": "0.21.0", + "@opentelemetry/instrumentation-xml-http-request": "0.21.0", + "@opentelemetry/metrics": "0.21.0", + "@opentelemetry/propagator-b3": "0.21.0", + "@opentelemetry/tracing": "0.21.0", + "@opentelemetry/web": "0.21.0" }, "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 index e47148709e..f316e959a0 100644 --- a/examples/tracer-web/webpack.config.js +++ b/examples/tracer-web/webpack.config.js @@ -8,6 +8,7 @@ const common = { mode: 'development', entry: { metrics: 'examples/metrics/index.js', + test: 'examples/test/test.ts', fetch: 'examples/fetch/index.js', 'xml-http-request': 'examples/xml-http-request/index.js', zipkin: 'examples/zipkin/index.js', diff --git a/getting-started/example/package.json b/getting-started/example/package.json index 77109298ba..ee9276f39d 100644 --- a/getting-started/example/package.json +++ b/getting-started/example/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/getting-started-example", - "version": "0.19.0", + "version": "0.21.0", "description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide", "main": "app.js", "scripts": { diff --git a/getting-started/monitored-example/package.json b/getting-started/monitored-example/package.json index 5d1699c948..ee9519294f 100644 --- a/getting-started/monitored-example/package.json +++ b/getting-started/monitored-example/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/getting-started-monitored-example", - "version": "0.19.0", + "version": "0.21.0", "description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide", "main": "app.js", "scripts": { @@ -9,8 +9,8 @@ "author": "OpenTelemetry Authors", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/exporter-prometheus": "0.19.0", - "@opentelemetry/metrics": "0.19.0", + "@opentelemetry/exporter-prometheus": "0.21.0", + "@opentelemetry/metrics": "0.21.0", "axios": "^0.21.0", "express": "^4.17.1" } diff --git a/getting-started/traced-example/package.json b/getting-started/traced-example/package.json index 5596a60e35..99303989e9 100644 --- a/getting-started/traced-example/package.json +++ b/getting-started/traced-example/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/getting-started-traced-example", - "version": "0.19.0", + "version": "0.21.0", "description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide", "main": "app.js", "scripts": { @@ -9,13 +9,13 @@ "author": "OpenTelemetry Authors", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/exporter-zipkin": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", + "@opentelemetry/core": "0.21.0", + "@opentelemetry/exporter-zipkin": "0.21.0", + "@opentelemetry/node": "0.21.0", + "@opentelemetry/instrumentation": "0.21.0", "@opentelemetry/instrumentation-express": "^0.16.0", - "@opentelemetry/instrumentation-http": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/instrumentation-http": "0.21.0", + "@opentelemetry/tracing": "0.21.0", "axios": "^0.21.0", "express": "^4.17.1" } diff --git a/getting-started/ts-example/example/package.json b/getting-started/ts-example/example/package.json index 4aae845d15..3fc98bcca9 100644 --- a/getting-started/ts-example/example/package.json +++ b/getting-started/ts-example/example/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/getting-started-ts-example", - "version": "0.15.0", + "version": "0.21.0", "description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide", "main": "app.ts", "scripts": { diff --git a/getting-started/ts-example/monitored-example/package.json b/getting-started/ts-example/monitored-example/package.json index afa9f62e5b..395a238714 100644 --- a/getting-started/ts-example/monitored-example/package.json +++ b/getting-started/ts-example/monitored-example/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/getting-started-monitored-ts-example", - "version": "0.19.0", + "version": "0.21.0", "description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide", "main": "app.ts", "scripts": { @@ -14,8 +14,8 @@ "ts-node": "8.10.2" }, "dependencies": { - "@opentelemetry/exporter-prometheus": "0.19.0", - "@opentelemetry/metrics": "0.19.0", + "@opentelemetry/exporter-prometheus": "0.21.0", + "@opentelemetry/metrics": "0.21.0", "axios": "^0.21.0", "express": "^4.17.1" } diff --git a/getting-started/ts-example/traced-example/package.json b/getting-started/ts-example/traced-example/package.json index c2b56f1f98..c3ad1adf04 100644 --- a/getting-started/ts-example/traced-example/package.json +++ b/getting-started/ts-example/traced-example/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/getting-started-traced-ts-example", - "version": "0.19.0", + "version": "0.21.0", "description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide", "main": "app.ts", "scripts": { @@ -14,13 +14,13 @@ "ts-node": "9.1.1" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/exporter-zipkin": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/node": "0.19.0", + "@opentelemetry/core": "0.21.0", + "@opentelemetry/exporter-zipkin": "0.21.0", + "@opentelemetry/instrumentation": "0.21.0", + "@opentelemetry/node": "0.21.0", "@opentelemetry/instrumentation-express": "^0.16.0", - "@opentelemetry/instrumentation-http": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/instrumentation-http": "0.21.0", + "@opentelemetry/tracing": "0.21.0", "axios": "^0.21.0", "express": "^4.17.1" } diff --git a/integration-tests/propagation-validation-server/package.json b/integration-tests/propagation-validation-server/package.json index 003b8afc23..fc569649fc 100644 --- a/integration-tests/propagation-validation-server/package.json +++ b/integration-tests/propagation-validation-server/package.json @@ -1,6 +1,6 @@ { "name": "propagation-validation-server", - "version": "0.19.0", + "version": "0.21.0", "description": "server for w3c tests", "main": "validation_server.js", "private": true, @@ -11,18 +11,18 @@ "compile": "tsc --build" }, "dependencies": { - "@opentelemetry/context-async-hooks": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/context-async-hooks": "0.21.0", + "@opentelemetry/core": "0.21.0", + "@opentelemetry/tracing": "0.21.0", "axios": "0.21.1", "body-parser": "1.19.0", "express": "4.17.1" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", - "typescript": "4.2.4" + "@opentelemetry/api": "^1.0.0", + "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" } } diff --git a/integration-tests/propagation-validation-server/validation-server.js b/integration-tests/propagation-validation-server/validation-server.js index 2c327cacb8..3587669cc5 100644 --- a/integration-tests/propagation-validation-server/validation-server.js +++ b/integration-tests/propagation-validation-server/validation-server.js @@ -1,7 +1,7 @@ const axios = require("axios"); const { HttpTraceContextPropagator } = require("@opentelemetry/core"); const { BasicTracerProvider } = require("@opentelemetry/tracing"); -const { context, propagation, setSpan, trace, ROOT_CONTEXT } = require("@opentelemetry/api"); +const { context, propagation, trace, ROOT_CONTEXT } = require("@opentelemetry/api"); const { AsyncHooksContextManager, } = require("@opentelemetry/context-async-hooks"); @@ -36,7 +36,7 @@ app.post("/verify-tracecontext", (req, res) => { req.body.map((action) => { const span = tracer.startSpan("propagate-w3c"); let promise; - context.with(setSpan(context.active(), span), () => { + context.with(trace.setSpan(context.active(), span), () => { const headers = {}; propagation.inject(context.active(), headers); promise = axios diff --git a/lerna.json b/lerna.json index de33e068a2..de7ba1c204 100644 --- a/lerna.json +++ b/lerna.json @@ -8,7 +8,7 @@ "packages/*", "integration-tests/*" ], - "version": "0.19.0", + "version": "0.21.0", "changelog": { "repo": "open-telemetry/opentelemetry-js", "labels": { diff --git a/package.json b/package.json index b71d1f0fd2..43ce135244 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "opentelemetry-base", - "version": "0.18.2", + "name": "opentelemetry", + "version": "0.21.0", "description": "OpenTelemetry is a distributed tracing and stats collection framework.", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -32,7 +32,8 @@ "lint:examples": "eslint ./examples/**/*.js", "lint:examples:fix": "eslint ./examples/**/*.js --fix", "lint:markdown": "./node_modules/.bin/markdownlint $(git ls-files '*.md') -i ./CHANGELOG.md", - "lint:markdown:fix": "./node_modules/.bin/markdownlint $(git ls-files '*.md') -i ./CHANGELOG.md --fix" + "lint:markdown:fix": "./node_modules/.bin/markdownlint $(git ls-files '*.md') -i ./CHANGELOG.md --fix", + "reset": "lerna clean -y && rm -rf node_modules && npm i && npm run compile && npm run lint:fix" }, "repository": "open-telemetry/opentelemetry-js", "keywords": [ @@ -47,21 +48,21 @@ "devDependencies": { "@commitlint/cli": "12.1.1", "@commitlint/config-conventional": "12.1.1", - "@typescript-eslint/eslint-plugin": "4.22.0", - "@typescript-eslint/parser": "4.22.0", + "@typescript-eslint/eslint-plugin": "4.25.0", + "@typescript-eslint/parser": "4.25.0", "beautify-benchmark": "0.2.4", "benchmark": "2.1.4", - "eslint": "7.25.0", + "eslint": "7.27.0", "eslint-config-airbnb-base": "14.2.1", "eslint-plugin-header": "3.1.1", - "eslint-plugin-import": "2.22.1", + "eslint-plugin-import": "2.23.3", + "eslint-plugin-node": "11.1.0", "gh-pages": "3.1.0", - "gts": "3.1.0", "husky": "4.3.8", "lerna": "3.22.1", "lerna-changelog": "1.0.1", "markdownlint-cli": "0.27.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "update-ts-references": "2.3.0" }, "husky": { diff --git a/packages/opentelemetry-api-metrics/package.json b/packages/opentelemetry-api-metrics/package.json index 19dd39a057..3930460861 100644 --- a/packages/opentelemetry-api-metrics/package.json +++ b/packages/opentelemetry-api-metrics/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/api-metrics", - "version": "0.19.0", + "version": "0.21.0", "description": "Public metrics API for OpenTelemetry", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -53,27 +53,26 @@ "access": "public" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/webpack-env": "1.16.0", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", "karma-spec-reporter": "0.0.32", - "karma-webpack": "5.0.0", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", "ts-loader": "8.2.0", "ts-mocha": "8.0.0", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0" } } diff --git a/packages/opentelemetry-api-metrics/src/version.ts b/packages/opentelemetry-api-metrics/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-api-metrics/src/version.ts +++ b/packages/opentelemetry-api-metrics/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-api-metrics/test/api/api.test.ts b/packages/opentelemetry-api-metrics/test/api/api.test.ts index 674e9aebd4..e9a837230e 100644 --- a/packages/opentelemetry-api-metrics/test/api/api.test.ts +++ b/packages/opentelemetry-api-metrics/test/api/api.test.ts @@ -38,7 +38,7 @@ describe('API', () => { }); class TestMeterProvider extends NoopMeterProvider { - getMeter() { + override getMeter() { return dummyMeter; } } diff --git a/packages/opentelemetry-context-async-hooks/package.json b/packages/opentelemetry-context-async-hooks/package.json index 790af59ff8..c774f6f6ec 100644 --- a/packages/opentelemetry-context-async-hooks/package.json +++ b/packages/opentelemetry-context-async-hooks/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/context-async-hooks", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry AsyncHooks-based Context Manager", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -40,20 +40,19 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/shimmer": "1.0.1", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "^3.8.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" } } diff --git a/packages/opentelemetry-context-async-hooks/src/AbstractAsyncHooksContextManager.ts b/packages/opentelemetry-context-async-hooks/src/AbstractAsyncHooksContextManager.ts index 0f540b62bb..0e9600b2c9 100644 --- a/packages/opentelemetry-context-async-hooks/src/AbstractAsyncHooksContextManager.ts +++ b/packages/opentelemetry-context-async-hooks/src/AbstractAsyncHooksContextManager.ts @@ -51,7 +51,13 @@ export abstract class AbstractAsyncHooksContextManager abstract disable(): this; - bind(target: T, context: Context = this.active()): T { + /** + * Binds a the certain context or the active one to the target function and then returns the target + * @param context A context (span) to be bind to target + * @param target a function or event emitter. When target or one of its callbacks is called, + * the provided context will be used as the active context for the duration of the call. + */ + bind(context: Context, target: T): T { if (target instanceof EventEmitter) { return this._bindEventEmitter(target, context); } @@ -180,7 +186,7 @@ export abstract class AbstractAsyncHooksContextManager listeners = new WeakMap(); map[event] = listeners; } - const patchedListener = contextManager.bind(listener, context); + const patchedListener = contextManager.bind(context, listener); // store a weak reference of the user listener to ours listeners.set(listener, patchedListener); return original.call(this, event, patchedListener); diff --git a/packages/opentelemetry-context-async-hooks/src/version.ts b/packages/opentelemetry-context-async-hooks/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-context-async-hooks/src/version.ts +++ b/packages/opentelemetry-context-async-hooks/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-context-async-hooks/test/AsyncHooksContextManager.test.ts b/packages/opentelemetry-context-async-hooks/test/AsyncHooksContextManager.test.ts index ba0a169e91..762096c800 100644 --- a/packages/opentelemetry-context-async-hooks/test/AsyncHooksContextManager.test.ts +++ b/packages/opentelemetry-context-async-hooks/test/AsyncHooksContextManager.test.ts @@ -299,26 +299,26 @@ for (const contextManagerClass of [ describe('.bind(function)', () => { it('should return the same target (when enabled)', () => { const test = { a: 1 }; - assert.deepStrictEqual(contextManager.bind(test, ROOT_CONTEXT), test); + assert.deepStrictEqual(contextManager.bind(ROOT_CONTEXT, test), test); }); it('should return the same target (when disabled)', () => { contextManager.disable(); const test = { a: 1 }; - assert.deepStrictEqual(contextManager.bind(test, ROOT_CONTEXT), test); + assert.deepStrictEqual(contextManager.bind(ROOT_CONTEXT, test), test); contextManager.enable(); }); it('should return current context (when enabled)', done => { const context = ROOT_CONTEXT.setValue(key1, 1); - const fn = contextManager.bind(() => { + const fn = contextManager.bind(context, () => { assert.strictEqual( contextManager.active(), context, 'should have context' ); return done(); - }, context); + }); fn(); }); @@ -329,20 +329,20 @@ for (const contextManagerClass of [ it('should return current context (when disabled)', done => { contextManager.disable(); const context = ROOT_CONTEXT.setValue(key1, 1); - const fn = contextManager.bind(() => { + const fn = contextManager.bind(context, () => { assert.strictEqual( contextManager.active(), context, 'should have context' ); return done(); - }, context); + }); fn(); }); it('should fail to return current context with async op', done => { const context = ROOT_CONTEXT.setValue(key1, 1); - const fn = contextManager.bind(() => { + const fn = contextManager.bind(context, () => { assert.strictEqual(contextManager.active(), context); setTimeout(() => { assert.strictEqual( @@ -352,7 +352,7 @@ for (const contextManagerClass of [ ); return done(); }, 100); - }, context); + }); fn(); }); @@ -363,12 +363,11 @@ for (const contextManagerClass of [ const context = ROOT_CONTEXT.setValue(key1, 2); const otherContext = ROOT_CONTEXT.setValue(key1, 3); const fn = otherContextManager.bind( - contextManager.bind(() => { + otherContext, + contextManager.bind(context, () => { assert.strictEqual(contextManager.active(), context); assert.strictEqual(otherContextManager.active(), otherContext); - }, context), - otherContext - ); + })); fn(); }); }); @@ -376,19 +375,19 @@ for (const contextManagerClass of [ describe('.bind(event-emitter)', () => { it('should return the same target (when enabled)', () => { const ee = new EventEmitter(); - assert.deepStrictEqual(contextManager.bind(ee, ROOT_CONTEXT), ee); + assert.deepStrictEqual(contextManager.bind(ROOT_CONTEXT, ee), ee); }); it('should return the same target (when disabled)', () => { const ee = new EventEmitter(); contextManager.disable(); - assert.deepStrictEqual(contextManager.bind(ee, ROOT_CONTEXT), ee); + assert.deepStrictEqual(contextManager.bind(ROOT_CONTEXT, ee), ee); }); it('should return current context and removeListener (when enabled)', done => { const ee = new EventEmitter(); const context = ROOT_CONTEXT.setValue(key1, 1); - const patchedEE = contextManager.bind(ee, context); + const patchedEE = contextManager.bind(context, ee); const handler = () => { assert.deepStrictEqual(contextManager.active(), context); patchedEE.removeListener('test', handler); @@ -403,7 +402,7 @@ for (const contextManagerClass of [ it('should return current context and removeAllListener (when enabled)', done => { const ee = new EventEmitter(); const context = ROOT_CONTEXT.setValue(key1, 1); - const patchedEE = contextManager.bind(ee, context); + const patchedEE = contextManager.bind(context, ee); const handler = () => { assert.deepStrictEqual(contextManager.active(), context); patchedEE.removeAllListeners('test'); @@ -418,7 +417,7 @@ for (const contextManagerClass of [ it('should return current context and removeAllListeners (when enabled)', done => { const ee = new EventEmitter(); const context = ROOT_CONTEXT.setValue(key1, 1); - const patchedEE = contextManager.bind(ee, context); + const patchedEE = contextManager.bind(context, ee); const handler = () => { assert.deepStrictEqual(contextManager.active(), context); patchedEE.removeAllListeners(); @@ -441,7 +440,7 @@ for (const contextManagerClass of [ contextManager.disable(); const ee = new EventEmitter(); const context = ROOT_CONTEXT.setValue(key1, 1); - const patchedEE = contextManager.bind(ee, context); + const patchedEE = contextManager.bind(context, ee); const handler = () => { assert.deepStrictEqual(contextManager.active(), context); patchedEE.removeListener('test', handler); @@ -456,7 +455,7 @@ for (const contextManagerClass of [ it('should not return current context with async op', done => { const ee = new EventEmitter(); const context = ROOT_CONTEXT.setValue(key1, 1); - const patchedEE = contextManager.bind(ee, context); + const patchedEE = contextManager.bind(context, ee); const handler = () => { assert.deepStrictEqual(contextManager.active(), context); setImmediate(() => { @@ -479,8 +478,8 @@ for (const contextManagerClass of [ const context = ROOT_CONTEXT.setValue(key1, 2); const otherContext = ROOT_CONTEXT.setValue(key1, 3); const patchedEE = otherContextManager.bind( - contextManager.bind(ee, context), - otherContext + otherContext, + contextManager.bind(context, ee), ); const handler = () => { assert.strictEqual(contextManager.active(), context); diff --git a/packages/opentelemetry-context-zone-peer-dep/README.md b/packages/opentelemetry-context-zone-peer-dep/README.md index e7c0294ea7..b167b31a0a 100644 --- a/packages/opentelemetry-context-zone-peer-dep/README.md +++ b/packages/opentelemetry-context-zone-peer-dep/README.md @@ -21,7 +21,7 @@ npm install --save @opentelemetry/context-zone-peer-dep ## Usage ```js -import { context, getSpan, setSpan } from '@opentelemetry/api'; +import { context, trace } from '@opentelemetry/api'; import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing'; import { WebTracerProvider } from '@opentelemetry/web'; import { ZoneContextManager } from '@opentelemetry/context-zone-peer-dep'; @@ -35,21 +35,21 @@ providerWithZone.register({ // Example how the ZoneContextManager keeps the reference to the correct context during async operations const webTracerWithZone = providerWithZone.getTracer('default'); const span1 = webTracerWithZone.startSpan('foo1'); -context.with(setSpan(context.active(), span1, () => { - console.log('Current span is span1', getSpan(context.active()) === span1); +context.with(trace.setSpan(context.active(), span1, () => { + console.log('Current span is span1', trace.getSpan(context.active()) === span1); setTimeout(() => { const span2 = webTracerWithZone.startSpan('foo2'); - console.log('Current span is span1', getSpan(context.active()) === span1); - context.with(setSpan(context.active(), span2, () => { - console.log('Current span is span2', getSpan(context.active()) === span2); + console.log('Current span is span1', trace.getSpan(context.active()) === span1); + context.with(trace.setSpan(context.active(), span2, () => { + console.log('Current span is span2', trace.getSpan(context.active()) === span2); setTimeout(() => { - console.log('Current span is span2', getSpan(context.active()) === span2); + console.log('Current span is span2', trace.getSpan(context.active()) === span2); }, 500); }); // there is a timeout which still keeps span2 active - console.log('Current span is span2', getSpan(context.active()) === span2); + console.log('Current span is span2', trace.getSpan(context.active()) === span2); }, 500); - console.log('Current span is span1', getSpan(context.active()) === span1); + console.log('Current span is span1', trace.getSpan(context.active()) === span1); }); ``` diff --git a/packages/opentelemetry-context-zone-peer-dep/package.json b/packages/opentelemetry-context-zone-peer-dep/package.json index c5c0e6f68d..066b7b0769 100644 --- a/packages/opentelemetry-context-zone-peer-dep/package.json +++ b/packages/opentelemetry-context-zone-peer-dep/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/context-zone-peer-dep", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry Context Zone with peer dependency for zone.js", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -46,22 +46,21 @@ }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^1.0.0-rc.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", "@types/webpack-env": "1.16.0", "@types/zone.js": "0.5.12", "babel-loader": "8.2.2", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", "karma-spec-reporter": "0.0.32", - "karma-webpack": "5.0.0", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", @@ -69,13 +68,13 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0", "webpack-cli": "4.6.0", "zone.js": "0.11.4" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", + "@opentelemetry/api": "^1.0.0", "zone.js": "^0.10.2 || ^0.11.0" }, "sideEffects": false diff --git a/packages/opentelemetry-context-zone-peer-dep/src/ZoneContextManager.ts b/packages/opentelemetry-context-zone-peer-dep/src/ZoneContextManager.ts index edd5a0719e..4ff0a9b30b 100644 --- a/packages/opentelemetry-context-zone-peer-dep/src/ZoneContextManager.ts +++ b/packages/opentelemetry-context-zone-peer-dep/src/ZoneContextManager.ts @@ -153,7 +153,7 @@ export class ZoneContextManager implements ContextManager { listeners = new WeakMap(); target.__ot_listeners[event] = listeners; } - const patchedListener = contextManager.bind(listener, context); + const patchedListener = contextManager.bind(context, listener); // store a weak reference of the user listener to ours listeners.set(listener, patchedListener); return original.call(this, event, patchedListener, opts); @@ -202,10 +202,11 @@ export class ZoneContextManager implements ContextManager { /** * 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 + * @param target a function or event emitter. When target or one of its callbacks is called, + * the provided context will be used as the active context for the duration of the call. */ - bind(target: T | TargetWithEvents, context: Context): T { + bind(context: Context, target: T | TargetWithEvents): T { // if no specific context to propagate is given, we use the current one if (context === undefined) { context = this.active(); diff --git a/packages/opentelemetry-context-zone-peer-dep/src/version.ts b/packages/opentelemetry-context-zone-peer-dep/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-context-zone-peer-dep/src/version.ts +++ b/packages/opentelemetry-context-zone-peer-dep/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-context-zone-peer-dep/test/ZoneContextManager.test.ts b/packages/opentelemetry-context-zone-peer-dep/test/ZoneContextManager.test.ts index 43aba94e17..d612d4ca6b 100644 --- a/packages/opentelemetry-context-zone-peer-dep/test/ZoneContextManager.test.ts +++ b/packages/opentelemetry-context-zone-peer-dep/test/ZoneContextManager.test.ts @@ -251,46 +251,48 @@ describe('ZoneContextManager', () => { const ctx = ROOT_CONTEXT.setValue(key1, obj1); obj1.title = 'a2'; const obj2 = new Obj('b1'); - const wrapper: any = contextManager.bind(obj2.getTitle, ctx); + const wrapper: any = contextManager.bind(ctx, obj2.getTitle); assert.ok(wrapper(), 'a2'); }); it('should return the same target (when enabled)', () => { const test = { a: 1 }; - assert.deepStrictEqual(contextManager.bind(test, ROOT_CONTEXT), test); + assert.deepStrictEqual(contextManager.bind(ROOT_CONTEXT, test), test); }); it('should return the same target (when disabled)', () => { contextManager.disable(); const test = { a: 1 }; - assert.deepStrictEqual(contextManager.bind(test, ROOT_CONTEXT), test); + assert.deepStrictEqual(contextManager.bind(ROOT_CONTEXT, test), test); contextManager.enable(); }); it('should return current context (when enabled)', done => { const context = ROOT_CONTEXT.setValue(key1, { a: 1 }); - const fn: any = contextManager.bind(() => { + const fn: any = contextManager.bind( + context, + () => { assert.strictEqual( contextManager.active(), context, 'should have context' ); return done(); - }, context); + }); fn(); }); it('should return root context (when disabled)', done => { contextManager.disable(); const context = ROOT_CONTEXT.setValue(key1, { a: 1 }); - const fn: any = contextManager.bind(() => { + const fn: any = contextManager.bind(context, () => { assert.strictEqual( contextManager.active(), ROOT_CONTEXT, 'should have context' ); return done(); - }, context); + }); fn(); }); @@ -298,7 +300,7 @@ describe('ZoneContextManager', () => { const ctx1 = ROOT_CONTEXT.setValue(key1, 1); const element = document.createElement('div'); - contextManager.bind(element, ctx1); + contextManager.bind(ctx1, element); element.addEventListener('click', () => { assert.strictEqual(contextManager.active(), ctx1); @@ -322,7 +324,7 @@ describe('ZoneContextManager', () => { const ctx1 = ROOT_CONTEXT.setValue(key1, 1); const element = document.createElement('div'); - contextManager.bind(element, ctx1); + contextManager.bind(ctx1, element); element.addEventListener('click', () => { assert.strictEqual(contextManager.active(), ctx1); diff --git a/packages/opentelemetry-context-zone/README.md b/packages/opentelemetry-context-zone/README.md index 09f30edf68..8668fafe28 100644 --- a/packages/opentelemetry-context-zone/README.md +++ b/packages/opentelemetry-context-zone/README.md @@ -18,7 +18,7 @@ npm install --save @opentelemetry/context-zone ## Usage ```js -import { context, getSpan, setSpan } from '@opentelemetry/api'; +import { context, trace } from '@opentelemetry/api'; import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing'; import { WebTracerProvider } from '@opentelemetry/web'; import { ZoneContextManager } from '@opentelemetry/context-zone'; @@ -33,21 +33,21 @@ provider.register({ const webTracerWithZone = providerWithZone.getTracer('default'); const span1 = webTracerWithZone.startSpan('foo1'); -context.with(setSpan(context.active(), span1), () => { - console.log('Current span is span1', getSpan(context.active()) === span1); +context.with(trace.setSpan(context.active(), span1), () => { + console.log('Current span is span1', trace.getSpan(context.active()) === span1); setTimeout(() => { const span2 = webTracerWithZone.startSpan('foo2'); - console.log('Current span is span1', getSpan(context.active()) === span1); - context.with(setSpan(context.active(), span2), () => { - console.log('Current span is span2', getSpan(context.active()) === span2); + console.log('Current span is span1', trace.getSpan(context.active()) === span1); + context.with(trace.setSpan(context.active(), span2), () => { + console.log('Current span is span2', trace.getSpan(context.active()) === span2); setTimeout(() => { - console.log('Current span is span2', getSpan(context.active()) === span2); + console.log('Current span is span2', trace.getSpan(context.active()) === span2); }, 500); }); // there is a timeout which still keeps span2 active - console.log('Current span is span2', getSpan(context.active()) === span2); + console.log('Current span is span2', trace.getSpan(context.active()) === span2); }, 500); - console.log('Current span is span1', getSpan(context.active()) === span1); + console.log('Current span is span1', trace.getSpan(context.active()) === span1); }); ``` diff --git a/packages/opentelemetry-context-zone/package.json b/packages/opentelemetry-context-zone/package.json index b1f19d0ded..55d8ac7e1f 100644 --- a/packages/opentelemetry-context-zone/package.json +++ b/packages/opentelemetry-context-zone/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/context-zone", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry Context Zone", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -48,13 +48,12 @@ "@types/sinon": "9.0.11", "@types/webpack-env": "1.16.0", "babel-loader": "8.2.2", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", "karma-mocha": "2.0.1", "karma-spec-reporter": "0.0.32", - "karma-webpack": "5.0.0", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", @@ -62,13 +61,13 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0", "webpack-cli": "4.6.0", "webpack-merge": "5.7.3" }, "dependencies": { - "@opentelemetry/context-zone-peer-dep": "0.19.0", + "@opentelemetry/context-zone-peer-dep": "0.21.0", "zone.js": "^0.11.0" }, "sideEffects": true diff --git a/packages/opentelemetry-context-zone/src/version.ts b/packages/opentelemetry-context-zone/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-context-zone/src/version.ts +++ b/packages/opentelemetry-context-zone/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json index 3ce816418e..1f8370710c 100644 --- a/packages/opentelemetry-core/package.json +++ b/packages/opentelemetry-core/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/core", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry Core provides default and no-op implementations of the OpenTelemetry types for trace and metrics", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -55,22 +55,20 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/propagator-b3": "0.19.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/semver": "7.3.5", "@types/sinon": "9.0.11", "@types/webpack-env": "1.16.0", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", "karma-spec-reporter": "0.0.32", - "karma-webpack": "5.0.0", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", @@ -78,14 +76,14 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "semver": "^7.1.3", - "@opentelemetry/semantic-conventions": "0.19.0" + "@opentelemetry/semantic-conventions": "0.21.0", + "semver": "^7.1.3" } } diff --git a/packages/opentelemetry-core/src/baggage/propagation/HttpBaggagePropagator.ts b/packages/opentelemetry-core/src/baggage/propagation/HttpBaggagePropagator.ts index fb678a5e05..3cd023c719 100644 --- a/packages/opentelemetry-core/src/baggage/propagation/HttpBaggagePropagator.ts +++ b/packages/opentelemetry-core/src/baggage/propagation/HttpBaggagePropagator.ts @@ -15,23 +15,26 @@ */ import { - Context, BaggageEntry, - getBaggage, - setBaggage, + Context, + propagation, TextMapGetter, TextMapPropagator, TextMapSetter, - createBaggage, - isInstrumentationSuppressed, } from '@opentelemetry/api'; -import { getKeyPairs, serializeKeyPairs, parsePairKeyValue } from '../utils'; + +import { isTracingSuppressed } from '../../trace/suppress-tracing'; import { - BAGGAGE_MAX_NAME_VALUE_PAIRS, - BAGGAGE_ITEMS_SEPARATOR, BAGGAGE_HEADER, - BAGGAGE_MAX_PER_NAME_VALUE_PAIRS, + BAGGAGE_ITEMS_SEPARATOR, + BAGGAGE_MAX_NAME_VALUE_PAIRS, + BAGGAGE_MAX_PER_NAME_VALUE_PAIRS } from '../constants'; +import { + getKeyPairs, + parsePairKeyValue, + serializeKeyPairs +} from '../utils'; /** * Propagates {@link Baggage} through Context format propagation. @@ -41,8 +44,8 @@ import { */ export class HttpBaggagePropagator implements TextMapPropagator { inject(context: Context, carrier: unknown, setter: TextMapSetter) { - const baggage = getBaggage(context); - if (!baggage || isInstrumentationSuppressed(context)) return; + const baggage = propagation.getBaggage(context); + if (!baggage || isTracingSuppressed(context)) return; const keyPairs = getKeyPairs(baggage) .filter((pair: string) => { return pair.length <= BAGGAGE_MAX_PER_NAME_VALUE_PAIRS; @@ -75,7 +78,7 @@ export class HttpBaggagePropagator implements TextMapPropagator { if (Object.entries(baggage).length === 0) { return context; } - return setBaggage(context, createBaggage(baggage)); + return propagation.setBaggage(context, propagation.createBaggage(baggage)); } fields(): string[] { diff --git a/packages/opentelemetry-core/src/index.ts b/packages/opentelemetry-core/src/index.ts index 139263bc2f..a204b15707 100644 --- a/packages/opentelemetry-core/src/index.ts +++ b/packages/opentelemetry-core/src/index.ts @@ -27,10 +27,12 @@ export * from './platform'; export * from './propagation/composite'; export * from './trace/HttpTraceContextPropagator'; export * from './trace/IdGenerator'; +export * from './trace/rpc-metadata'; export * from './trace/sampler/AlwaysOffSampler'; export * from './trace/sampler/AlwaysOnSampler'; export * from './trace/sampler/ParentBasedSampler'; export * from './trace/sampler/TraceIdRatioBasedSampler'; +export * from './trace/suppress-tracing'; export * from './trace/TraceState'; export * from './utils/environment'; export * from './utils/sampling'; diff --git a/packages/opentelemetry-core/src/trace/HttpTraceContextPropagator.ts b/packages/opentelemetry-core/src/trace/HttpTraceContextPropagator.ts index 29888aa1f1..53d3bf11fb 100644 --- a/packages/opentelemetry-core/src/trace/HttpTraceContextPropagator.ts +++ b/packages/opentelemetry-core/src/trace/HttpTraceContextPropagator.ts @@ -16,16 +16,14 @@ import { Context, - getSpanContext, - isInstrumentationSuppressed, isSpanContextValid, - setSpanContext, SpanContext, TextMapGetter, TextMapPropagator, - TextMapSetter, + TextMapSetter, trace, TraceFlags, } from '@opentelemetry/api'; +import { isTracingSuppressed } from './suppress-tracing'; import { TraceState } from './TraceState'; export const TRACE_PARENT_HEADER = 'traceparent'; @@ -74,10 +72,10 @@ export function parseTraceParent(traceParent: string): SpanContext | null { */ export class HttpTraceContextPropagator implements TextMapPropagator { inject(context: Context, carrier: unknown, setter: TextMapSetter) { - const spanContext = getSpanContext(context); + const spanContext = trace.getSpanContext(context); if ( !spanContext || - isInstrumentationSuppressed(context) || + isTracingSuppressed(context) || !isSpanContextValid(spanContext) ) return; @@ -119,7 +117,7 @@ export class HttpTraceContextPropagator implements TextMapPropagator { typeof state === 'string' ? state : undefined ); } - return setSpanContext(context, spanContext); + return trace.setSpanContext(context, spanContext); } fields(): string[] { diff --git a/packages/opentelemetry-core/src/trace/rpc-metadata.ts b/packages/opentelemetry-core/src/trace/rpc-metadata.ts new file mode 100644 index 0000000000..8e3cbf7bef --- /dev/null +++ b/packages/opentelemetry-core/src/trace/rpc-metadata.ts @@ -0,0 +1,48 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Context, createContextKey, Span } from '@opentelemetry/api'; + +const RPC_METADATA_KEY = createContextKey( + 'OpenTelemetry SDK Context Key RPC_METADATA' +); + +export enum RPCType { + HTTP = 'http', +} + +type HTTPMetadata = { + type: RPCType.HTTP; + route?: string; + span: Span; +}; + +/** + * Allows for future rpc metadata to be used with this mechanism + */ +export type RPCMetadata = HTTPMetadata; + +export function setRPCMetadata(context: Context, meta: RPCMetadata): Context { + return context.setValue(RPC_METADATA_KEY, meta); +} + +export function deleteRPCMetadata(context: Context): Context { + return context.deleteValue(RPC_METADATA_KEY); +} + +export function getRPCMetadata(context: Context): RPCMetadata | undefined { + return context.getValue(RPC_METADATA_KEY) as RPCMetadata | undefined; +} diff --git a/packages/opentelemetry-core/src/trace/sampler/ParentBasedSampler.ts b/packages/opentelemetry-core/src/trace/sampler/ParentBasedSampler.ts index a20f9ba181..6cd10b1484 100644 --- a/packages/opentelemetry-core/src/trace/sampler/ParentBasedSampler.ts +++ b/packages/opentelemetry-core/src/trace/sampler/ParentBasedSampler.ts @@ -17,13 +17,12 @@ import { SpanAttributes, Context, - getSpanContext, isSpanContextValid, Link, Sampler, SamplingResult, SpanKind, - TraceFlags, + TraceFlags, trace, } from '@opentelemetry/api'; import { globalErrorHandler } from '../../common/global-error-handler'; import { AlwaysOffSampler } from './AlwaysOffSampler'; @@ -68,7 +67,7 @@ export class ParentBasedSampler implements Sampler { attributes: SpanAttributes, links: Link[] ): SamplingResult { - const parentContext = getSpanContext(context); + const parentContext = trace.getSpanContext(context); if (!parentContext || !isSpanContextValid(parentContext)) { return this._root.shouldSample( diff --git a/packages/opentelemetry-core/src/trace/suppress-tracing.ts b/packages/opentelemetry-core/src/trace/suppress-tracing.ts new file mode 100644 index 0000000000..a48c01dcdb --- /dev/null +++ b/packages/opentelemetry-core/src/trace/suppress-tracing.ts @@ -0,0 +1,33 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Context, createContextKey } from '@opentelemetry/api'; + +const SUPPRESS_TRACING_KEY = createContextKey( + 'OpenTelemetry SDK Context Key SUPPRESS_TRACING' +); + +export function suppressTracing(context: Context): Context { + return context.setValue(SUPPRESS_TRACING_KEY, true); +} + +export function unsuppressTracing(context: Context): Context { + return context.deleteValue(SUPPRESS_TRACING_KEY); +} + +export function isTracingSuppressed(context: Context): boolean { + return context.getValue(SUPPRESS_TRACING_KEY) === true; +} diff --git a/packages/opentelemetry-core/src/utils/environment.ts b/packages/opentelemetry-core/src/utils/environment.ts index 8e621a0d86..78b7f1f248 100644 --- a/packages/opentelemetry-core/src/utils/environment.ts +++ b/packages/opentelemetry-core/src/utils/environment.ts @@ -76,6 +76,7 @@ export type ENVIRONMENT = { OTEL_EXPORTER_ZIPKIN_ENDPOINT?: string; OTEL_LOG_LEVEL?: DiagLogLevel; OTEL_RESOURCE_ATTRIBUTES?: string; + OTEL_SERVICE_NAME?: string; OTEL_TRACES_EXPORTER?: string; OTEL_TRACES_SAMPLER_ARG?: string; OTEL_TRACES_SAMPLER?: string; @@ -115,6 +116,7 @@ export const DEFAULT_ENVIRONMENT: Required = { OTEL_NO_PATCH_MODULES: [], OTEL_PROPAGATORS: ['tracecontext', 'baggage'], OTEL_RESOURCE_ATTRIBUTES: '', + OTEL_SERVICE_NAME: '', OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT: 128, OTEL_SPAN_EVENT_COUNT_LIMIT: 128, OTEL_SPAN_LINK_COUNT_LIMIT: 128, diff --git a/packages/opentelemetry-core/src/version.ts b/packages/opentelemetry-core/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-core/src/version.ts +++ b/packages/opentelemetry-core/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-core/test/baggage/HttpBaggagePropagator.test.ts b/packages/opentelemetry-core/test/baggage/HttpBaggagePropagator.test.ts index 04aace011a..679d6f48d2 100644 --- a/packages/opentelemetry-core/test/baggage/HttpBaggagePropagator.test.ts +++ b/packages/opentelemetry-core/test/baggage/HttpBaggagePropagator.test.ts @@ -17,11 +17,9 @@ import { Baggage, BaggageEntry, - createBaggage, defaultTextMapGetter, defaultTextMapSetter, - getBaggage, - setBaggage, + propagation, } from '@opentelemetry/api'; import { ROOT_CONTEXT } from '@opentelemetry/api'; import * as assert from 'assert'; @@ -39,14 +37,14 @@ describe('HttpBaggagePropagator', () => { describe('.inject()', () => { it('should set baggage header', () => { - const baggage = createBaggage({ + const baggage = propagation.createBaggage({ key1: { value: 'd4cda95b652f4a1592b449d5929fda1b' }, key3: { value: 'c88815a7-0fa9-4d95-a1f1-cdccce3c5c2a' }, 'with/slash': { value: 'with spaces' }, }); httpBaggagePropagator.inject( - setBaggage(ROOT_CONTEXT, baggage), + propagation.setBaggage(ROOT_CONTEXT, baggage), carrier, defaultTextMapSetter ); @@ -57,13 +55,13 @@ describe('HttpBaggagePropagator', () => { }); it('should skip long key-value pairs', () => { - const baggage = createBaggage({ + const baggage = propagation.createBaggage({ key1: { value: 'd4cda95b' }, key3: { value: 'c88815a7' }, }); httpBaggagePropagator.inject( - setBaggage(ROOT_CONTEXT, baggage), + propagation.setBaggage(ROOT_CONTEXT, baggage), carrier, defaultTextMapSetter ); @@ -78,13 +76,13 @@ describe('HttpBaggagePropagator', () => { const shortKey = Array(95).fill('k').join(''); const value = Array(4000).fill('v').join(''); - let baggage = createBaggage({ + let baggage = propagation.createBaggage({ aa: { value: 'shortvalue' }, [shortKey]: { value: value }, }); httpBaggagePropagator.inject( - setBaggage(ROOT_CONTEXT, baggage), + propagation.setBaggage(ROOT_CONTEXT, baggage), carrier, defaultTextMapSetter ); @@ -93,14 +91,14 @@ describe('HttpBaggagePropagator', () => { assert.ok(typeof header === 'string'); assert.deepStrictEqual(header, `aa=shortvalue,${shortKey}=${value}`); - baggage = createBaggage({ + baggage = propagation.createBaggage({ aa: { value: 'shortvalue' }, [longKey]: { value: value }, }); carrier = {}; httpBaggagePropagator.inject( - setBaggage(ROOT_CONTEXT, baggage), + propagation.setBaggage(ROOT_CONTEXT, baggage), carrier, defaultTextMapSetter ); @@ -115,14 +113,14 @@ describe('HttpBaggagePropagator', () => { const longKey1 = Array(49).fill('1').join(''); const longValue = Array(4000).fill('v').join(''); - let baggage = createBaggage({ + let baggage = propagation.createBaggage({ [longKey0]: { value: longValue }, [longKey1]: { value: longValue }, aa: { value: Array(88).fill('v').join('') }, }); httpBaggagePropagator.inject( - setBaggage(ROOT_CONTEXT, baggage), + propagation.setBaggage(ROOT_CONTEXT, baggage), carrier, defaultTextMapSetter ); @@ -132,7 +130,7 @@ describe('HttpBaggagePropagator', () => { assert.deepStrictEqual(header.length, 8192); assert.deepStrictEqual(header.split(',').length, 3); - baggage = createBaggage({ + baggage = propagation.createBaggage({ [longKey0]: { value: longValue }, [longKey1]: { value: longValue }, aa: { value: Array(89).fill('v').join('') }, @@ -140,7 +138,7 @@ describe('HttpBaggagePropagator', () => { carrier = {}; httpBaggagePropagator.inject( - setBaggage(ROOT_CONTEXT, baggage), + propagation.setBaggage(ROOT_CONTEXT, baggage), carrier, defaultTextMapSetter ); @@ -160,10 +158,10 @@ describe('HttpBaggagePropagator', () => { entries[`${i}`] = { value: 'v' }; }); - const baggage = createBaggage(entries); + const baggage = propagation.createBaggage(entries); httpBaggagePropagator.inject( - setBaggage(ROOT_CONTEXT, baggage), + propagation.setBaggage(ROOT_CONTEXT, baggage), carrier, defaultTextMapSetter ); @@ -178,7 +176,7 @@ describe('HttpBaggagePropagator', () => { it('should extract context of a sampled span from carrier', () => { carrier[BAGGAGE_HEADER] = 'key1=d4cda95b,key3=c88815a7, keyn = valn, keym =valm'; - const extractedBaggage = getBaggage( + const extractedBaggage = propagation.getBaggage( httpBaggagePropagator.extract( ROOT_CONTEXT, carrier, @@ -186,7 +184,7 @@ describe('HttpBaggagePropagator', () => { ) ); - const expected = createBaggage({ + const expected = propagation.createBaggage({ key1: { value: 'd4cda95b' }, key3: { value: 'c88815a7' }, keyn: { value: 'valn' }, @@ -205,7 +203,7 @@ describe('HttpBaggagePropagator', () => { it('returns undefined if header is missing', () => { assert.deepStrictEqual( - getBaggage( + propagation.getBaggage( httpBaggagePropagator.extract( ROOT_CONTEXT, carrier, @@ -218,7 +216,7 @@ describe('HttpBaggagePropagator', () => { it('returns keys with their properties', () => { carrier[BAGGAGE_HEADER] = 'key1=d4cda95b,key3=c88815a7;prop1=value1'; - const bag = getBaggage( + const bag = propagation.getBaggage( httpBaggagePropagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); @@ -260,7 +258,7 @@ describe('HttpBaggagePropagator', () => { }, mixInvalidAndValidKeys: { header: 'key1==value,key2=value2', - baggage: createBaggage({ + baggage: propagation.createBaggage({ key2: { value: 'value2', }, @@ -270,7 +268,7 @@ describe('HttpBaggagePropagator', () => { Object.getOwnPropertyNames(testCases).forEach(testCase => { carrier[BAGGAGE_HEADER] = testCases[testCase].header; - const extractedSpanContext = getBaggage( + const extractedSpanContext = propagation.getBaggage( httpBaggagePropagator.extract( ROOT_CONTEXT, carrier, diff --git a/packages/opentelemetry-core/test/propagation/composite.test.ts b/packages/opentelemetry-core/test/propagation/composite.test.ts index f0a7532030..1e5b6d989a 100644 --- a/packages/opentelemetry-core/test/propagation/composite.test.ts +++ b/packages/opentelemetry-core/test/propagation/composite.test.ts @@ -19,8 +19,8 @@ import { defaultTextMapSetter, TextMapPropagator, SpanContext, - getSpanContext, - setSpanContext, + TextMapGetter, + TextMapSetter, trace, } from '@opentelemetry/api'; import { Context, ROOT_CONTEXT } from '@opentelemetry/api'; import * as assert from 'assert'; @@ -29,19 +29,27 @@ import { HttpTraceContextPropagator, RandomIdGenerator, } from '../../src'; -import { - B3Propagator, - B3InjectEncoding, - X_B3_SAMPLED, - X_B3_SPAN_ID, - X_B3_TRACE_ID, -} from '@opentelemetry/propagator-b3'; import { TRACE_PARENT_HEADER, TRACE_STATE_HEADER, } from '../../src/trace/HttpTraceContextPropagator'; import { TraceState } from '../../src/trace/TraceState'; +class DummyPropagator implements TextMapPropagator { + inject(context: Context, carrier: any, setter: TextMapSetter): void { + carrier['dummy'] = trace.getSpanContext(context); + } + extract(context: Context, carrier: any, getter: TextMapGetter): Context { + if (carrier['dummy']) { + return trace.setSpanContext(context, carrier['dummy']); + } + return context; + } + fields(): string[] { + return ['dummy']; + } +} + describe('Composite Propagator', () => { let traceId: string; let spanId: string; @@ -65,21 +73,16 @@ describe('Composite Propagator', () => { traceFlags: 1, traceState: new TraceState('foo=bar'), }; - ctxWithSpanContext = setSpanContext(ROOT_CONTEXT, spanContext); + ctxWithSpanContext = trace.setSpanContext(ROOT_CONTEXT, spanContext); }); it('should inject context using all configured propagators', () => { const composite = new CompositePropagator({ - propagators: [ - new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER }), - new HttpTraceContextPropagator(), - ], + propagators: [new DummyPropagator(), new HttpTraceContextPropagator()], }); composite.inject(ctxWithSpanContext, carrier, defaultTextMapSetter); - 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['dummy'], spanContext); assert.strictEqual( carrier[TRACE_PARENT_HEADER], `00-${traceId}-${spanId}-01` @@ -108,9 +111,7 @@ describe('Composite Propagator', () => { beforeEach(() => { carrier = { - [X_B3_TRACE_ID]: traceId, - [X_B3_SPAN_ID]: spanId, - [X_B3_SAMPLED]: 1, + ['dummy']: { traceId, spanId }, [TRACE_PARENT_HEADER]: `00-${traceId}-${spanId}-01`, [TRACE_STATE_HEADER]: 'foo=bar', }; @@ -118,12 +119,9 @@ describe('Composite Propagator', () => { it('should extract context using all configured propagators', () => { const composite = new CompositePropagator({ - propagators: [ - new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER }), - new HttpTraceContextPropagator(), - ], + propagators: [new DummyPropagator(), new HttpTraceContextPropagator()], }); - const spanContext = getSpanContext( + const spanContext = trace.getSpanContext( composite.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); @@ -145,7 +143,7 @@ describe('Composite Propagator', () => { new HttpTraceContextPropagator(), ], }); - const spanContext = getSpanContext( + const spanContext = trace.getSpanContext( composite.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); diff --git a/packages/opentelemetry-core/test/trace/HttpTraceContextPropagator.test.ts b/packages/opentelemetry-core/test/trace/HttpTraceContextPropagator.test.ts index 115dfd87c3..0ccd526e6f 100644 --- a/packages/opentelemetry-core/test/trace/HttpTraceContextPropagator.test.ts +++ b/packages/opentelemetry-core/test/trace/HttpTraceContextPropagator.test.ts @@ -17,13 +17,10 @@ import { defaultTextMapGetter, defaultTextMapSetter, - getSpanContext, INVALID_SPANID, INVALID_TRACEID, ROOT_CONTEXT, - setSpanContext, - SpanContext, - suppressInstrumentation, + SpanContext, trace, TraceFlags, } from '@opentelemetry/api'; import * as assert from 'assert'; @@ -32,6 +29,7 @@ import { TRACE_PARENT_HEADER, TRACE_STATE_HEADER, } from '../../src/trace/HttpTraceContextPropagator'; +import { suppressTracing } from '../../src/trace/suppress-tracing'; import { TraceState } from '../../src/trace/TraceState'; describe('HttpTraceContextPropagator', () => { @@ -51,7 +49,7 @@ describe('HttpTraceContextPropagator', () => { }; httpTraceContext.inject( - setSpanContext(ROOT_CONTEXT, spanContext), + trace.setSpanContext(ROOT_CONTEXT, spanContext), carrier, defaultTextMapSetter ); @@ -71,7 +69,7 @@ describe('HttpTraceContextPropagator', () => { }; httpTraceContext.inject( - setSpanContext(ROOT_CONTEXT, spanContext), + trace.setSpanContext(ROOT_CONTEXT, spanContext), carrier, defaultTextMapSetter ); @@ -90,7 +88,7 @@ describe('HttpTraceContextPropagator', () => { }; httpTraceContext.inject( - suppressInstrumentation(setSpanContext(ROOT_CONTEXT, spanContext)), + suppressTracing(trace.setSpanContext(ROOT_CONTEXT, spanContext)), carrier, defaultTextMapSetter ); @@ -107,7 +105,7 @@ describe('HttpTraceContextPropagator', () => { }; httpTraceContext.inject( - suppressInstrumentation(setSpanContext(ROOT_CONTEXT, spanContext)), + suppressTracing(trace.setSpanContext(ROOT_CONTEXT, spanContext)), carrier, defaultTextMapSetter ); @@ -120,7 +118,7 @@ describe('HttpTraceContextPropagator', () => { it('should extract context of a sampled span from carrier', () => { carrier[TRACE_PARENT_HEADER] = '00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01'; - const extractedSpanContext = getSpanContext( + const extractedSpanContext = trace.getSpanContext( httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); @@ -135,7 +133,7 @@ describe('HttpTraceContextPropagator', () => { it('should extract context of a sampled span from carrier using a future version', () => { carrier[TRACE_PARENT_HEADER] = 'cc-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01'; - const extractedSpanContext = getSpanContext( + const extractedSpanContext = trace.getSpanContext( httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); @@ -150,7 +148,7 @@ describe('HttpTraceContextPropagator', () => { it('should extract context of a sampled span from carrier using a future version and future fields', () => { carrier[TRACE_PARENT_HEADER] = 'cc-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01-what-the-future-will-be-like'; - const extractedSpanContext = getSpanContext( + const extractedSpanContext = trace.getSpanContext( httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); @@ -164,7 +162,7 @@ describe('HttpTraceContextPropagator', () => { it('returns null if traceparent header is missing', () => { assert.deepStrictEqual( - getSpanContext( + trace.getSpanContext( httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ), undefined @@ -174,7 +172,7 @@ describe('HttpTraceContextPropagator', () => { it('returns null if traceparent header is invalid', () => { carrier[TRACE_PARENT_HEADER] = 'invalid!'; assert.deepStrictEqual( - getSpanContext( + trace.getSpanContext( httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ), undefined @@ -187,7 +185,7 @@ describe('HttpTraceContextPropagator', () => { '00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01-extra'; assert.deepStrictEqual( - getSpanContext( + trace.getSpanContext( httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ), undefined @@ -198,7 +196,7 @@ describe('HttpTraceContextPropagator', () => { carrier[TRACE_PARENT_HEADER] = [ '00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01', ]; - const extractedSpanContext = getSpanContext( + const extractedSpanContext = trace.getSpanContext( httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); assert.deepStrictEqual(extractedSpanContext, { @@ -213,7 +211,7 @@ describe('HttpTraceContextPropagator', () => { carrier[TRACE_PARENT_HEADER] = '00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01'; carrier[TRACE_STATE_HEADER] = 'foo=bar,baz=qux'; - const extractedSpanContext = getSpanContext( + const extractedSpanContext = trace.getSpanContext( httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); @@ -231,7 +229,7 @@ describe('HttpTraceContextPropagator', () => { carrier[TRACE_PARENT_HEADER] = '00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01'; carrier[TRACE_STATE_HEADER] = ['foo=bar,baz=qux', 'quux=quuz']; - const extractedSpanContext = getSpanContext( + const extractedSpanContext = trace.getSpanContext( httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); assert.deepStrictEqual(extractedSpanContext, { @@ -285,7 +283,7 @@ describe('HttpTraceContextPropagator', () => { Object.getOwnPropertyNames(testCases).forEach(testCase => { carrier[TRACE_PARENT_HEADER] = testCases[testCase]; - const extractedSpanContext = getSpanContext( + const extractedSpanContext = trace.getSpanContext( httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); assert.deepStrictEqual(extractedSpanContext, undefined, testCase); @@ -296,7 +294,7 @@ describe('HttpTraceContextPropagator', () => { carrier[TRACE_PARENT_HEADER] = '00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01'; carrier[TRACE_STATE_HEADER] = 'foo=1 \t , \t bar=2, \t baz=3 '; - const extractedSpanContext = getSpanContext( + const extractedSpanContext = trace.getSpanContext( httpTraceContext.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); diff --git a/packages/opentelemetry-core/test/trace/ParentBasedSampler.test.ts b/packages/opentelemetry-core/test/trace/ParentBasedSampler.test.ts index 4394227de4..828a32fa3e 100644 --- a/packages/opentelemetry-core/test/trace/ParentBasedSampler.test.ts +++ b/packages/opentelemetry-core/test/trace/ParentBasedSampler.test.ts @@ -17,7 +17,7 @@ import * as assert from 'assert'; import * as api from '@opentelemetry/api'; import { AlwaysOnSampler } from '../../src/trace/sampler/AlwaysOnSampler'; import { ParentBasedSampler } from '../../src/trace/sampler/ParentBasedSampler'; -import { TraceFlags, SpanKind, setSpanContext } from '@opentelemetry/api'; +import { TraceFlags, SpanKind, trace } from '@opentelemetry/api'; import { AlwaysOffSampler } from '../../src/trace/sampler/AlwaysOffSampler'; import { TraceIdRatioBasedSampler } from '../../src'; @@ -58,7 +58,7 @@ describe('ParentBasedSampler', () => { }; assert.deepStrictEqual( sampler.shouldSample( - setSpanContext(api.ROOT_CONTEXT, spanContext), + trace.setSpanContext(api.ROOT_CONTEXT, spanContext), traceId, spanName, SpanKind.CLIENT, @@ -76,7 +76,7 @@ describe('ParentBasedSampler', () => { assert.deepStrictEqual( sampler.shouldSample( - setSpanContext(api.ROOT_CONTEXT, api.INVALID_SPAN_CONTEXT), + trace.setSpanContext(api.ROOT_CONTEXT, api.INVALID_SPAN_CONTEXT), traceId, spanName, SpanKind.CLIENT, @@ -117,7 +117,7 @@ describe('ParentBasedSampler', () => { }; assert.deepStrictEqual( sampler.shouldSample( - setSpanContext(api.ROOT_CONTEXT, spanContext), + trace.setSpanContext(api.ROOT_CONTEXT, spanContext), traceId, spanName, SpanKind.CLIENT, @@ -135,7 +135,7 @@ describe('ParentBasedSampler', () => { assert.deepStrictEqual( sampler.shouldSample( - setSpanContext(api.ROOT_CONTEXT, api.INVALID_SPAN_CONTEXT), + trace.setSpanContext(api.ROOT_CONTEXT, api.INVALID_SPAN_CONTEXT), traceId, spanName, SpanKind.CLIENT, diff --git a/packages/opentelemetry-core/tsconfig.json b/packages/opentelemetry-core/tsconfig.json index 73b0dd709c..0717beecbf 100644 --- a/packages/opentelemetry-core/tsconfig.json +++ b/packages/opentelemetry-core/tsconfig.json @@ -9,9 +9,6 @@ "test/**/*.ts" ], "references": [ - { - "path": "../opentelemetry-propagator-b3" - }, { "path": "../opentelemetry-semantic-conventions" } diff --git a/packages/opentelemetry-exporter-collector-grpc/README.md b/packages/opentelemetry-exporter-collector-grpc/README.md index 840afb7104..03a1bd41c4 100644 --- a/packages/opentelemetry-exporter-collector-grpc/README.md +++ b/packages/opentelemetry-exporter-collector-grpc/README.md @@ -13,6 +13,11 @@ This module provides exporter for web and node to be used with [opentelemetry-co npm install --save @opentelemetry/exporter-collector-grpc ``` +## Service Name + +The OpenTelemetry Collector Exporter does not have a service name configuration. +In order to set the service name, use the `service.name` resource attribute as prescribed in the [OpenTelemetry Resource Semantic Conventions][semconv-resource-service-name]. + ## Traces in Node - GRPC The CollectorTraceExporter in Node expects the URL to only be the hostname. It will not work with `/v1/traces`. @@ -22,7 +27,6 @@ const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tra const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-grpc'); const collectorOptions = { - serviceName: 'basic-service', // url is optional and can be omitted - default is localhost:4317 url: ':', }; @@ -47,7 +51,6 @@ const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tra const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-grpc'); const collectorOptions = { - serviceName: 'basic-service', // url is optional and can be omitted - default is localhost:4317 url: ':', credentials: grpc.credentials.createSsl(), @@ -88,7 +91,6 @@ const metadata = new grpc.Metadata(); metadata.set('k', 'v'); const collectorOptions = { - serviceName: 'basic-service', // url is optional and can be omitted - default is localhost:4317 url: ':', metadata, // // an optional grpc.Metadata object to be sent with each request @@ -114,7 +116,6 @@ The CollectorTraceExporter in Node expects the URL to only be the hostname. It w const { MeterProvider } = require('@opentelemetry/metrics'); const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector-grpc'); const collectorOptions = { - serviceName: 'basic-service', // url is optional and can be omitted - default is localhost:4317 url: ':', }; @@ -161,3 +162,4 @@ Apache 2.0 - See [LICENSE][license-url] for more information. [npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-collector-grpc [npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-collector-grpc.svg [opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-collector +[semconv-resource-service-name]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service diff --git a/packages/opentelemetry-exporter-collector-grpc/package.json b/packages/opentelemetry-exporter-collector-grpc/package.json index 88713dc2a9..01ab47d219 100644 --- a/packages/opentelemetry-exporter-collector-grpc/package.json +++ b/packages/opentelemetry-exporter-collector-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-collector-grpc", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -46,14 +46,13 @@ }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/api-metrics": "0.19.0", + "@opentelemetry/api": "^1.0.0", + "@opentelemetry/api-metrics": "0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", - "codecov": "3.8.1", + "codecov": "3.8.2", "cpx": "1.5.0", - "gts": "3.1.0", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", @@ -61,18 +60,18 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { "@grpc/grpc-js": "^1.2.12", "@grpc/proto-loader": "^0.6.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/exporter-collector": "0.19.0", - "@opentelemetry/metrics": "0.19.0", - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/core": "0.21.0", + "@opentelemetry/exporter-collector": "0.21.0", + "@opentelemetry/metrics": "0.21.0", + "@opentelemetry/resources": "0.21.0", + "@opentelemetry/tracing": "0.21.0" } } diff --git a/packages/opentelemetry-exporter-collector-grpc/src/CollectorExporterNodeBase.ts b/packages/opentelemetry-exporter-collector-grpc/src/CollectorExporterNodeBase.ts index ab751cd6ab..5368e1f882 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/CollectorExporterNodeBase.ts +++ b/packages/opentelemetry-exporter-collector-grpc/src/CollectorExporterNodeBase.ts @@ -26,7 +26,6 @@ import { ServiceClientType, } from './types'; import { ServiceClient } from './types'; -import { validateAndNormalizeUrl } from './util'; /** * Collector Metric Exporter abstract base class @@ -42,7 +41,6 @@ export abstract class CollectorExporterNodeBase< grpcQueue: GRPCQueueItem[] = []; metadata?: Metadata; serviceClient?: ServiceClient = undefined; - serverAddress: string; private _send!: Function; constructor(config: CollectorExporterConfigNode = {}) { @@ -50,8 +48,6 @@ export abstract class CollectorExporterNodeBase< if (config.headers) { diag.warn('Headers cannot be set when using grpc'); } - - this.serverAddress = validateAndNormalizeUrl(this.url); this.metadata = config.metadata; } private _sendPromise( diff --git a/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts b/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts index 8f5b79f45b..84a880c16d 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts +++ b/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts @@ -22,8 +22,8 @@ import { MetricRecord, MetricExporter } from '@opentelemetry/metrics'; import { CollectorExporterConfigNode, ServiceClientType } from './types'; import { CollectorExporterNodeBase } from './CollectorExporterNodeBase'; import { getEnv } from '@opentelemetry/core'; +import { validateAndNormalizeUrl } from './util'; -const DEFAULT_SERVICE_NAME = 'collector-metric-exporter'; const DEFAULT_COLLECTOR_URL = 'localhost:4317'; /** @@ -50,18 +50,14 @@ export class CollectorMetricExporter getDefaultUrl(config: CollectorExporterConfigNode) { return typeof config.url === 'string' - ? config.url + ? validateAndNormalizeUrl(config.url) : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0 - ? getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT + ? validateAndNormalizeUrl(getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT) : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 - ? getEnv().OTEL_EXPORTER_OTLP_ENDPOINT + ? validateAndNormalizeUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT) : DEFAULT_COLLECTOR_URL; } - getDefaultServiceName(config: CollectorExporterConfigNode): string { - return config.serviceName || DEFAULT_SERVICE_NAME; - } - getServiceClientType() { return ServiceClientType.METRICS; } diff --git a/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts b/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts index 5166cccb92..aae731d10c 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts +++ b/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts @@ -22,8 +22,8 @@ import { } from '@opentelemetry/exporter-collector'; import { CollectorExporterConfigNode, ServiceClientType } from './types'; import { getEnv } from '@opentelemetry/core'; +import { validateAndNormalizeUrl } from './util'; -const DEFAULT_SERVICE_NAME = 'collector-trace-exporter'; const DEFAULT_COLLECTOR_URL = 'localhost:4317'; /** @@ -43,18 +43,14 @@ export class CollectorTraceExporter getDefaultUrl(config: CollectorExporterConfigNode) { return typeof config.url === 'string' - ? config.url + ? validateAndNormalizeUrl(config.url) : getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT.length > 0 - ? getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT + ? validateAndNormalizeUrl(getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT) : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 - ? getEnv().OTEL_EXPORTER_OTLP_ENDPOINT + ? validateAndNormalizeUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT) : DEFAULT_COLLECTOR_URL; } - getDefaultServiceName(config: CollectorExporterConfigNode): string { - return config.serviceName || DEFAULT_SERVICE_NAME; - } - getServiceClientType() { return ServiceClientType.SPANS; } diff --git a/packages/opentelemetry-exporter-collector-grpc/src/types.ts b/packages/opentelemetry-exporter-collector-grpc/src/types.ts index 3d8dda8dca..184901727b 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/types.ts +++ b/packages/opentelemetry-exporter-collector-grpc/src/types.ts @@ -33,7 +33,7 @@ export interface GRPCQueueItem { export interface ServiceClient extends grpc.Client { export: ( request: any, - metadata: grpc.Metadata | undefined, + metadata: grpc.Metadata, callback: Function ) => {}; } diff --git a/packages/opentelemetry-exporter-collector-grpc/src/util.ts b/packages/opentelemetry-exporter-collector-grpc/src/util.ts index 16a2b62dfa..39330afc3b 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/util.ts +++ b/packages/opentelemetry-exporter-collector-grpc/src/util.ts @@ -51,15 +51,17 @@ export function onInit( const packageObject: any = grpc.loadPackageDefinition(packageDefinition); if (collector.getServiceClientType() === ServiceClientType.SPANS) { - collector.serviceClient = new packageObject.opentelemetry.proto.collector.trace.v1.TraceService( - collector.serverAddress, - credentials - ); + collector.serviceClient = + new packageObject.opentelemetry.proto.collector.trace.v1.TraceService( + collector.url, + credentials, + ); } else { - collector.serviceClient = new packageObject.opentelemetry.proto.collector.metrics.v1.MetricsService( - collector.serverAddress, - credentials - ); + collector.serviceClient = + new packageObject.opentelemetry.proto.collector.metrics.v1.MetricsService( + collector.url, + credentials, + ); } if (collector.grpcQueue.length > 0) { diff --git a/packages/opentelemetry-exporter-collector-grpc/src/version.ts b/packages/opentelemetry-exporter-collector-grpc/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/version.ts +++ b/packages/opentelemetry-exporter-collector-grpc/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-exporter-collector-grpc/test/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-collector-grpc/test/CollectorMetricExporter.test.ts index c7b807d77e..a0cb218a7e 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/CollectorMetricExporter.test.ts +++ b/packages/opentelemetry-exporter-collector-grpc/test/CollectorMetricExporter.test.ts @@ -131,7 +131,6 @@ const testCollectorMetricExporter = (params: TestParams) => collectorExporter = new CollectorMetricExporter({ url: 'grpcs://' + address, credentials, - serviceName: 'basic-service', metadata: params.metadata, }); // Overwrites the start time to make tests consistent @@ -169,8 +168,7 @@ const testCollectorMetricExporter = (params: TestParams) => // Need to stub/spy on the underlying logger as the 'diag' instance is global const spyLoggerWarn = sinon.stub(diag, 'warn'); collectorExporter = new CollectorMetricExporter({ - serviceName: 'basic-service', - url: address, + url: `http://${address}`, headers: { foo: 'bar', }, @@ -181,8 +179,7 @@ const testCollectorMetricExporter = (params: TestParams) => it('should warn about path in url', () => { const spyLoggerWarn = sinon.stub(diag, 'warn'); collectorExporter = new CollectorMetricExporter({ - serviceName: 'basic-service', - url: address + '/v1/metrics', + url: `http://${address}/v1/metrics` }); const args = spyLoggerWarn.args[0]; assert.strictEqual( @@ -253,7 +250,7 @@ describe('CollectorMetricExporter - node (getDefaultUrl)', () => { const url = 'http://foo.bar.com'; const collectorExporter = new CollectorMetricExporter({ url }); setTimeout(() => { - assert.strictEqual(collectorExporter['url'], url); + assert.strictEqual(collectorExporter['url'], 'foo.bar.com'); done(); }); }); @@ -266,7 +263,7 @@ describe('when configuring via environment', () => { const collectorExporter = new CollectorMetricExporter(); assert.strictEqual( collectorExporter.url, - envSource.OTEL_EXPORTER_OTLP_ENDPOINT + 'foo.bar' ); envSource.OTEL_EXPORTER_OTLP_ENDPOINT = ''; }); @@ -276,7 +273,7 @@ describe('when configuring via environment', () => { const collectorExporter = new CollectorMetricExporter(); assert.strictEqual( collectorExporter.url, - envSource.OTEL_EXPORTER_OTLP_METRICS_ENDPOINT + 'foo.metrics' ); envSource.OTEL_EXPORTER_OTLP_ENDPOINT = ''; envSource.OTEL_EXPORTER_OTLP_METRICS_ENDPOINT = ''; diff --git a/packages/opentelemetry-exporter-collector-grpc/test/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-collector-grpc/test/CollectorTraceExporter.test.ts index e090c05471..1c91cae6a7 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/CollectorTraceExporter.test.ts +++ b/packages/opentelemetry-exporter-collector-grpc/test/CollectorTraceExporter.test.ts @@ -124,7 +124,6 @@ const testCollectorExporter = (params: TestParams) => ) : undefined; collectorExporter = new CollectorTraceExporter({ - serviceName: 'basic-service', url: 'grpcs://' + address, credentials, metadata: params.metadata, @@ -146,8 +145,7 @@ const testCollectorExporter = (params: TestParams) => // Need to stub/spy on the underlying logger as the 'diag' instance is global const spyLoggerWarn = sinon.stub(diag, 'warn'); collectorExporter = new CollectorTraceExporter({ - serviceName: 'basic-service', - url: address, + url: `http://${address}`, headers: { foo: 'bar', }, @@ -158,8 +156,7 @@ const testCollectorExporter = (params: TestParams) => it('should warn about path in url', () => { const spyLoggerWarn = sinon.stub(diag, 'warn'); collectorExporter = new CollectorTraceExporter({ - serviceName: 'basic-service', - url: address + '/v1/trace', + url: `http://${address}/v1/trace`, }); const args = spyLoggerWarn.args[0]; assert.strictEqual( @@ -215,7 +212,7 @@ describe('CollectorTraceExporter - node (getDefaultUrl)', () => { const url = 'http://foo.bar.com'; const collectorExporter = new CollectorTraceExporter({ url }); setTimeout(() => { - assert.strictEqual(collectorExporter['url'], url); + assert.strictEqual(collectorExporter['url'], 'foo.bar.com'); done(); }); }); @@ -228,7 +225,7 @@ describe('when configuring via environment', () => { const collectorExporter = new CollectorTraceExporter(); assert.strictEqual( collectorExporter.url, - envSource.OTEL_EXPORTER_OTLP_ENDPOINT + 'foo.bar' ); envSource.OTEL_EXPORTER_OTLP_ENDPOINT = ''; }); @@ -238,7 +235,7 @@ describe('when configuring via environment', () => { const collectorExporter = new CollectorTraceExporter(); assert.strictEqual( collectorExporter.url, - envSource.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT + 'foo.traces' ); envSource.OTEL_EXPORTER_OTLP_ENDPOINT = ''; envSource.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT = ''; diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/ca.crt b/packages/opentelemetry-exporter-collector-grpc/test/certs/ca.crt index 455c498aa2..b6db7d0dd2 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/certs/ca.crt +++ b/packages/opentelemetry-exporter-collector-grpc/test/certs/ca.crt @@ -1,31 +1,33 @@ -----BEGIN CERTIFICATE----- -MIIFPjCCAyYCCQDSzsM0Ou9GwDANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJD -TDELMAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYD -VQQKDARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTAeFw0yMDA1MTUx -NTQ0MzVaFw0yMTA1MTUxNTQ0MzVaMGExCzAJBgNVBAYTAkNMMQswCQYDVQQIDAJS -TTEaMBgGA1UEBwwRT3BlblRlbGVtZXRyeVRlc3QxDTALBgNVBAoMBFJvb3QxDTAL -BgNVBAsMBFRlc3QxCzAJBgNVBAMMAmNhMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A -MIICCgKCAgEAs1AVbpZ642HATrkqW0WpzsOAne677zDftkvIhWcto3x+nwP6kSOE -vHtPR7xem9Yl5LUy1aDpd0WnBSke1JIYdJCAmmlitFVShrpolGRb9MqYJPXp5FfH -O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bEWMxFvEQJdOK1vjmPHAMDSFXiixeklVUD5Th/9so4kRTu97j8fq/ +T0JDHso8+A== -----END CERTIFICATE----- diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/ca.key b/packages/opentelemetry-exporter-collector-grpc/test/certs/ca.key index e8b01e04ea..3a12f603d4 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/certs/ca.key +++ b/packages/opentelemetry-exporter-collector-grpc/test/certs/ca.key @@ -1,54 +1,54 @@ -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,C088BF4BACFE1D5E +DEK-Info: DES-EDE3-CBC,723F7ADBF5E86DF0 -TKzb0xd1SS8So+VGtAOqj7XhYJNaTSl7HrF5UXoL835lzU6qIdgJWp8REOATdYTP -wqL5x3OlRy/X9GUtXApQx4OoCy1hOMXB10/T1nD+EuxBf4ChEtRow1synEfOVlX8 -JZvRHuvN1AGnOzn8YpCnZ19ufw9ASX1cOFjefJKiR8vi32/LEO5No2jqODTWK3V2 -ijiV01hDkbiWvIoxcLQRXm+F2TAZ7MYz/DEjtbAr+4vCDMobJicWHim6yHpor/B0 -7bBVEsR0/R7kb+fLtv9cBDUqu40m7LfuMFtJDD5deRce2hSs+rm9nO01qvo5KvR5 -XA9WdKdFjk3WKjE0uAhRCzXXvRO1S9i6Ym0E3zoW6zcXItQUo30BhBgn4DALMMw/ -aLAsq0trmXqTiJCq8QDYgQOj59jwVxMuAsvinhqBI8koy92hBiXAhZd0r2+2jm/b -yqELuX+0b+FW0hSRL/BsXaTXrzW9cSpSM+EsCtoZloNecGGKNUIhVF6+LmALQ5xD -5dwIIooQTpNzLpc55rK6C01VWQLRWClJdbASdYD5hmY/0KNq/LB7F4TY9DjnJnWx -Lrkalyl8lv1oZHjPUqA8NAY+Rf+Ps6BxxP2ShAfVwybVFh0ACh5stWpAbmWId86p -vnf4gW2y5g4p9HNK/+XuFJ4PQj4/SJNRrc7HvwlCnAg1lXRYtt2C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49+vjwXM7fkYLZOFfAZmVRQ +84JRgL8HG4gXmVo2YcbviRdNuw4y2LCyfhJ9NwuWW6Ly0uKiGRaVKP1JAEmIJmcX +SnG3rM0bJsRnDtBBURioN0whl64LS3BwsPWL3OOsjesBIBNkoDA10OukTzjnLc6A +RYAfgPrG1eSsjitMFYdSBX8wvrQDCpxyItIamMf8IlsgBMt/WlFeGOJ9wxxa26lb +PxLNlhSpj3PU6rA4NDKvxkr2IEJ0MEcDnFnQkyBPlWY6a6jSQ+WSQkzBLU9soZ/2 -----END RSA PRIVATE KEY----- diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/client.crt b/packages/opentelemetry-exporter-collector-grpc/test/certs/client.crt index 9534695d80..cbd324625f 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/certs/client.crt +++ b/packages/opentelemetry-exporter-collector-grpc/test/certs/client.crt @@ -1,31 +1,31 @@ -----BEGIN CERTIFICATE----- -MIIFPzCCAycCAQEwDQYJKoZIhvcNAQEFBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV +MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjAwNTE1MTU0NDM3WhcN -MjEwNTE1MTU0NDM3WjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjEwNjA3MjAyNzMzWhcN +MjIwNjA3MjAyNzMzWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZD bGllbnQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCAiIwDQ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XNAgMBAAEw +DQYJKoZIhvcNAQELBQADggIBAA2nZTbaa9z/LTNJijf0clu4ULPG4RrqHgQ1q/Wh +NbrNemrxTJ+ZAwCR1gTv4oZe9NBd+V1pDXDQBid8mBTbttVrQCHdjgHFpQKNeyiK +nd2OI4awYiTvGbgDCMHAW/yf+XKCocuSkyNRnmfe8PihFD9wx6+kl6XCJuIkF3Vw +MGKEIrW2WLAARtBZeKV2yhtuVhkNm2TNFPfNrNtk2gdGO8TkX0orOllAENopR+GV +uffuLiIi9KWj9XP9T+6bdZbG2eMJX8wUNIIma54/3XN3RMi2iV9ZxW+F0j6d9ryo +j8pJJfpiW4qh6Eqi6HyvrzgdndKhkVYiIwbX5S60mqL+KcaPghX2goWexMW94QlQ +Re3/IvOAzGpu5fLn//y2tAaO9hDUsyoIJtXcFJKLbfM+mK/Bac2niEyBpr9Rzqur +N43Ga2pOsM4P/4YcAO6tvs5htvh2ala6UDXeEZV9Z1Bc5bOHAWNp13BfWE01iLNC +5rIu0XuVo1aa0FeVdJL6IpVeEwnkzDDt/9LKgp2K8w71VAtUSOg23AEYJu+GFr4D +y+0bahUiNETrFaiCsXQYa9HHFrqhA/PGOGpyq6GrBkJxWpzuL3rQQicpHzVIQEmb +3aCcIBdA2RQwQk7Z3YI2EuFMkHAElCXXZBulvxY6kl1n+2UwWRlocDMYZdkzI3+X +Tw8x -----END CERTIFICATE----- diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/client.csr b/packages/opentelemetry-exporter-collector-grpc/test/certs/client.csr index 2c7d0f9c04..e5de7b1912 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/certs/client.csr +++ b/packages/opentelemetry-exporter-collector-grpc/test/certs/client.csr @@ -2,27 +2,27 @@ MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGQ2xp ZW50MRIwE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LWuUhyo/ +668hUFeaqfZgX4muQ1p4x4oxWU6PnPyi64JJs34G0+KlaZ7sSmoVzQIDAQABoAAw +DQYJKoZIhvcNAQELBQADggIBAAtbvw2rrtnO5EeOF1Z+mJc9o3036liNbmCQTaC7 +Pf2yqo3Zk44L80R99sX5rDoq79MKEr//ED5C410EiCvzX42w330p7dasuoYRAwLw +YB0UwWnrKhm4SU20SC8zpnCUBL6K9lmXF2PJtkoMgFAnB8tIEc+DAr4hBIqh45vD +VgZ06GHH94/G6tIW3qNvi1mmvUYV0i6D3xBhcNAu6R/zopEYM3png24ZE2IlzZCX +x8hbYuMAqeQXSHQM9sKhXeb60GT8ns7d3P17S/TfpkTI7zRMkPhzsHC/Vp97xN/n +ojEEBY3MZJBPZj/q/buDfbp5x6H7/YxYdOKQKaGVWECGabISBcsg8NxaY++GKc+u +10C8O9KILRCJKGh8ze7chXx5n5+BPEoVVwhLn58eV7sOODvb4kZySUJHvFBb0ZM/ +7626K3443e5ZRkGXydvDIwPZgoiJ3L1L9+olL1cJ5rsRE6L5k6vPuJOeZITm4au2 +pE0THMHx/RjCMA1Lb/0BiDqbBHSh8hh+mHU7YXTq1Fxi2dSas0wAxcTBRs8TULsV +o57TmJqF+byiqwQvugyN7tndvWg9c+LDJHqitA5QC1GDXEi/bdjd7YeHRiL+ciVM +ZXXU9GT1O78O+84wbIDebahn8cifdGa7Kft7GftS3pCIyAjU9+eMXyT1JG3nssLr +4/ht -----END CERTIFICATE REQUEST----- diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/client.key b/packages/opentelemetry-exporter-collector-grpc/test/certs/client.key index e0fea66664..9219944ca4 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/certs/client.key +++ b/packages/opentelemetry-exporter-collector-grpc/test/certs/client.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKQIBAAKCAgEAybi3RqJmqi4Gxb9WKUf8xyCswQLPpFgycDEBlUbQDC+XNk8x -zjpWluCCmyf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yI0yKVecN8IGnd0Gef8XmrEtBSJJfu+ufDf0DfUGU/MQUBwArTgYQ998T +a2N76B3HewEXBOIbAVv5nTYPe0njuRD0yd0wUpVB5FNVjK2Xep6maIjGrff+yCJJ +mYFLRC7NjhpN4fVinPAVMFHZHmRLYzY2ZyKy6BlCr9VIE896TL1w7JxUUtmI3X14 +EWDBAoIBAQCn9TphKcLwse+72oSNTmzm3QjHngS42iAVTmXFENaAAitXYhS8gy+I +FF+Mj0NFnzmH9/2RQIAG1g/jZ7O0JwEWDaiKvrfLvDTb6ZXMy/Eb1OqmadZDxhFI +ysTRl/xCV6WQkoYdq6Ny6v6YNp9mjeRnLMwCLeBQWrYOMv/x6MkXh4ASKxPQB5ay +IWdIleElT0nbdgcusEi7eO+vtH+mt1eo6SeUfDYE6iDygVP+ZFzxSpmT3LEXRfru +nLkWxJIkZs0jXFy+Nd2WevEdESN0Nebz2o98wNX6NQqrFoeY8e1NW0SKrfaYf6vA +KhJCXwegFsO+kl9pAbXVs3QnD1Ndj3L1AoIBADUYFjD5y071ayhiunkwVekq4+wj +nbmqyaV5lWPU5XPBga6E3Tiah4Kt6C/LMSx3Q46jeEHTZOnCOr0KSk4BKf+WQaXN +4ueRdCWRIjdwxa37qCsg+MDf0iyHmnWp2y6IShhAwMC6konSqUkcez1ssqsChKt6 +dCxLeZEHuiFT6305E/xHZm/tWu9wbhhZecUElP+CyJ62GYtePzHKO+ZsdXywaiD4 +mZkq8ko6GIWkI7clasfdhjFqZ5GYA9Cv0OVQ6+MbFJnRPhCvz+iuAhAqXVE+nPhb +fSQOenyBtwtA3vRYYQR/2Z3xpydKzUiw1JcWf/etRwdtwpRfjEBTlzcQaHs= -----END RSA PRIVATE KEY----- diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/regenerate.sh b/packages/opentelemetry-exporter-collector-grpc/test/certs/regenerate.sh index bb6ec4a9b5..e1f1af5b54 100755 --- a/packages/opentelemetry-exporter-collector-grpc/test/certs/regenerate.sh +++ b/packages/opentelemetry-exporter-collector-grpc/test/certs/regenerate.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#!/usr/bin/env sh # # Usage: regenerate.sh # @@ -7,13 +7,16 @@ # It also serves as a documentation on how existing certificates were generated. rm ca.crt ca.key client.crt client.csr client.key server.crt server.csr server.key -openssl genrsa -passout pass:1111 -des3 -out ca.key 4096 -openssl req -passin pass:1111 -new -x509 -days 365 -key ca.key -out ca.crt -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Root/OU=Test/CN=ca" -openssl genrsa -passout pass:1111 -des3 -out server.key 4096 -openssl req -passin pass:1111 -new -key server.key -out server.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Server/CN=localhost" -openssl x509 -req -passin pass:1111 -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt -openssl rsa -passin pass:1111 -in server.key -out server.key -openssl genrsa -passout pass:1111 -des3 -out client.key 4096 -openssl req -passin pass:1111 -new -key client.key -out client.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Client/CN=localhost" -openssl x509 -passin pass:1111 -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt -openssl rsa -passin pass:1111 -in client.key -out client.key + +openssl genrsa -nodes -des3 -out ca.key 4096 +openssl req -nodes -new -x509 -days 365 -key ca.key -out ca.crt -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Root/OU=Test/CN=ca" + +openssl genrsa -nodes -des3 -out server.key 4096 +openssl req -nodes -new -key server.key -out server.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Server/CN=localhost" +openssl x509 -req -nodes -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt +openssl rsa -nodes -in server.key -out server.key + +openssl genrsa -nodes -des3 -out client.key 4096 +openssl req -nodes -new -key client.key -out client.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Client/CN=localhost" +openssl x509 -nodes -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt +openssl rsa -nodes -in client.key -out client.key diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/server.crt b/packages/opentelemetry-exporter-collector-grpc/test/certs/server.crt index 62f91722a9..09094e4526 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/certs/server.crt +++ b/packages/opentelemetry-exporter-collector-grpc/test/certs/server.crt @@ -1,31 +1,31 @@ -----BEGIN CERTIFICATE----- -MIIFPzCCAycCAQEwDQYJKoZIhvcNAQEFBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV +MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjAwNTE1MTU0NDM2WhcN -MjEwNTE1MTU0NDM2WjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjEwNjA3MjAyNzMyWhcN +MjIwNjA3MjAyNzMyWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZT ZXJ2ZXIxEjAQBgNVBAMMCWxvY2FsaG9zdDCCAiIwDQYJKoZIhvcNAQEBBQADggIP -ADCCAgoCggIBANQwHRfyj/d8Hh0qgDlxdtSxloRs8ZvBIwt6Accd1hUqs8dC0c9V -5XXOcfmusb3Fo8NKXn6IIPCEy1spFCe4EBW4obSgkJEVdPwsMsXUPLek/6K5S6uE -FhnGLUJJ57gAjh9LGdMTDp5szLO7dTYrHzdGZYhmTAyiA9JDN6iYlpWkK4p2IBcN -diu26KWp9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SvSxAm +mUOKZ/en7ZBepRex/s/rfCWYYTw2Ah02HZc8+H/J/aF3tvChI7Gx0anaSQxS48Ru +3eCaiaBEfoSGQvN9Jc+k1QJgJ4vZ8yi7ndl8pwW97YXo8Sg305ritqpnon+vemsV +rYoqHN+WV2/D0nqNu1AX8PldDvUYTfBtLfS7T5goN7abEIJCaTNmzU2ji0SqI9vJ +j4t9E9KcCKMshbciDrD7RPEPk3vogEDD3uygFwcPwUQfpCUFbRJOnTSH1oB/aUC4 +x9DnYSHBdDvaBmu0pBpoddJ+0pbw02P7YL9kPz5OnOAN06JP4McIYz5ytKoSt/m8 +Z7cUnvn7TRVNLuiapwpB0gtRmb9JY1q3pd63+X0SCaBEtUH+PWcRcS7eDsgMwEym +0CyANhCQYJjcKugIWLYtN/0/p2bIKcRmcH3iJiN2zZtP1AF6G7a4mp+21OynvFOc +3+ojTDGJxxD3uPtKEhJXRgYMOmfAEn3rgtoln1kkNYcd7f2EIulckwB2yeM1IMud +0le7 -----END CERTIFICATE----- diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/server.csr b/packages/opentelemetry-exporter-collector-grpc/test/certs/server.csr index 967316e171..bb61322340 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/certs/server.csr +++ b/packages/opentelemetry-exporter-collector-grpc/test/certs/server.csr @@ -2,27 +2,27 @@ MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGU2Vy dmVyMRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQDUMB0X8o/3fB4dKoA5cXbUsZaEbPGbwSMLegHHHdYVKrPHQtHPVeV1 -znH5rrG9xaPDSl5+iCDwhMtbKRQnuBAVuKG0oJCRFXT8LDLF1Dy3pP+iuUurhBYZ -xi1CSee4AI4fSxnTE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N4QfXs9qjI2UK80CBr6kPEt+bMfR +wUIax5HT1XLECoLph1rNza0h3WNk5ndEJMAt51U0JNAi6PwDF04ZfnX5E2RtiEjV ++3DPW1HYlX2hepkXVJPB568bbpmWLrmJsHjVZy4vmDoQi2bzS/QPsepgQ3aXxNel +vTxh0Or5SdIRRfNnP/Ov/aYjBxzkcKY83ADh7h1aqMOlUyFenHoMfTWnMYkeNY+1 +dOoLUS/ZNA6IH54UO7uY0uOcwCfRPYZzDxZI0IkjogX0aizixSs5duQx0ux3sUOo +a4zxMNPd89ppbCMZDS7biC7cOAsdDYXKcE5ijpc5CQXVo4/dA2xyfisRT7WUq9ay +vmQoYfMCAkGv47BVYhzASyPIXuFP2/HDbtnBvZ2aeSuMAwhHzj3vX9js2HGy7t2V +kj36LymQv+YBp9mV9/crSqy0DNFAYOWOuig0mQX/SPedGa4jf9v4OhANi+kzgxtQ +hBTcA0OtJyrVxesVGGK0YwaQIIZ8jwhsK3ljlZpOfVUflHl2/etME1DXtU37U9xA +fuw0 -----END CERTIFICATE REQUEST----- diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/server.key b/packages/opentelemetry-exporter-collector-grpc/test/certs/server.key index 4831771d2b..ddac188c23 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/certs/server.key +++ b/packages/opentelemetry-exporter-collector-grpc/test/certs/server.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKgIBAAKCAgEA1DAdF/KP93weHSqAOXF21LGWhGzxm8EjC3oBxx3WFSqzx0LR -z1Xldc5x+a6xvcWjw0pefogg8ITLWykUJ7gQFbihtKCQkRV0/CwyxdQ8t6T/orlL -q4QWGcYtQknnuACOH0sZ0xMOnmzMs7t1NisfN0ZliGZMDKID0kM3qJiWlaQrinYg -Fw12K7bopan36wkrDwvL/ujlAPjDJzqEaiTS/SfCKZdmjvwQlgG7oEMa4vICC+rz -MtWyBeLhphE6yZWuDYglt7z4+08E3CSgC5HhALeFFNXdtfJl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NBWgCKzoqErYqIZsu34mF0DJyK6CqPLMf +Uh20PZrnS87vzJVFneFJ0aFxUaaHSJW5za9vdthFIjZQFcods7xbv85a0h2EBhEX +f7Z7dhrTsh1i3BLTjm+NyfNAJr5VwgXf9Bk5X1K0hTVl1mHsVUKNFP3cfKehsuVr +HY/eM1823wwHJsw7apbpQtrOC7F1iA+6yQboLAhUFt+FIzdZg7cvbgyTntaXFJvJ +CbefZouYQrK/pMGoH15IgNkCcXXhE6Vhay6DqVN/r9RT0emrSEq2wy2adsSg0M4+ +lj/RbbRObwyBXLVyRyqEt3fJOBhZsaMCggEBAIxcTLc4JPH/TxlFKTusALlR4CRG +XHDlTdMR4kWfsmWxWxocwcyGIshNpylox+MLzHw1JI4o5AyVrP8GD9Lzea2l649Y +vBLZjSan+ucJGkWnZPUG8sqo/Wg1mm2ZotQGfXmTaoOg9nN37YZvyDr3qgpQghZ2 +LhFNCaccJcoUZfW+snM9Q3Isiz6DmKfc92eq3goHfhmTInYq+b30Z9nO7nDV9oll +eeurRN0aCnfvRTAMoy17gt5/h9jg7w9kcbP6wyxixlBvTKQqxkBA1wfa2kBQ6TOK +JSldpu7eAHZ8IHEraQ70Drd/Qr77Witm59F5TX0Vxut7/A1dEjWuP9SY4do= -----END RSA PRIVATE KEY----- diff --git a/packages/opentelemetry-exporter-collector-grpc/test/helper.ts b/packages/opentelemetry-exporter-collector-grpc/test/helper.ts index 147fb1c236..6e66e5a866 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/helper.ts +++ b/packages/opentelemetry-exporter-collector-grpc/test/helper.ts @@ -28,6 +28,7 @@ import { Resource } from '@opentelemetry/resources'; import { ReadableSpan } from '@opentelemetry/tracing'; import * as assert from 'assert'; import * as grpc from '@grpc/grpc-js'; +import { VERSION } from '@opentelemetry/core'; const meterProvider = new metrics.MeterProvider({ interval: 30000, @@ -111,10 +112,12 @@ export function mockValueRecorder(): metrics.Metric export const mockedReadableSpan: ReadableSpan = { name: 'documentFetch', kind: 0, - spanContext: { - traceId: '1f1008dc8e270e85c40a0d7c3939b278', - spanId: '5e107261f64fa53e', - traceFlags: TraceFlags.SAMPLED, + spanContext: () => { + return { + traceId: '1f1008dc8e270e85c40a0d7c3939b278', + spanId: '5e107261f64fa53e', + traceFlags: TraceFlags.SAMPLED, + }; }, parentSpanId: '78a8915098864388', startTime: [1574120165, 429803070], @@ -127,6 +130,7 @@ export const mockedReadableSpan: ReadableSpan = { context: { traceId: '1f1008dc8e270e85c40a0d7c3939b278', spanId: '78a8915098864388', + traceFlags: TraceFlags.SAMPLED, }, attributes: { component: 'document-load' }, }, @@ -154,11 +158,11 @@ export const mockedReadableSpan: ReadableSpan = { }, ], duration: [0, 8885000], - resource: new Resource({ + resource: Resource.default().merge(new Resource({ service: 'ui', version: 1, cost: 112.12, - }), + })), instrumentationLibrary: { name: 'default', version: '0.0.1' }, }; @@ -406,11 +410,32 @@ export function ensureResourceIsCorrect( assert.deepStrictEqual(resource, { attributes: [ { - key: 'service.name', - value: { - stringValue: 'basic-service', - value: 'stringValue', - }, + "key": "service.name", + "value": { + "stringValue": `unknown_service:${process.argv0}`, + "value": "stringValue" + } + }, + { + "key": "telemetry.sdk.language", + "value": { + "stringValue": "nodejs", + "value": "stringValue" + } + }, + { + "key": "telemetry.sdk.name", + "value": { + "stringValue": "opentelemetry", + "value": "stringValue" + } + }, + { + "key": "telemetry.sdk.version", + "value": { + "stringValue": VERSION, + "value": "stringValue" + } }, { key: 'service', diff --git a/packages/opentelemetry-exporter-collector-proto/README.md b/packages/opentelemetry-exporter-collector-proto/README.md index 4d8bee9f08..cd22a8769b 100644 --- a/packages/opentelemetry-exporter-collector-proto/README.md +++ b/packages/opentelemetry-exporter-collector-proto/README.md @@ -13,6 +13,11 @@ This module provides exporter for node to be used with [opentelemetry-collector] npm install --save @opentelemetry/exporter-collector-proto ``` +## Service Name + +The OpenTelemetry Collector Exporter does not have a service name configuration. +In order to set the service name, use the `service.name` resource attribute as prescribed in the [OpenTelemetry Resource Semantic Conventions][semconv-resource-service-name]. + ## Traces in Node - PROTO over http ```js @@ -20,7 +25,6 @@ const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tra const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-proto'); const collectorOptions = { - serviceName: 'basic-service', url: '', // url is optional and can be omitted - default is http://localhost:55681/v1/traces headers: { foo: 'bar' @@ -41,7 +45,6 @@ provider.register(); const { MeterProvider } = require('@opentelemetry/metrics'); const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector-proto'); const collectorOptions = { - serviceName: 'basic-service', url: '', // url is optional and can be omitted - default is http://localhost:55681/v1/metrics }; const exporter = new CollectorMetricExporter(collectorOptions); @@ -84,3 +87,4 @@ Apache 2.0 - See [LICENSE][license-url] for more information. [npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-collector-proto [npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-collector-proto.svg [opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-collector +[semconv-resource-service-name]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service diff --git a/packages/opentelemetry-exporter-collector-proto/package.json b/packages/opentelemetry-exporter-collector-proto/package.json index ba9637f6e1..f6dcb6229d 100644 --- a/packages/opentelemetry-exporter-collector-proto/package.json +++ b/packages/opentelemetry-exporter-collector-proto/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-collector-proto", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -46,14 +46,13 @@ }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/api-metrics": "0.19.0", + "@opentelemetry/api": "^1.0.0", + "@opentelemetry/api-metrics": "0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", - "codecov": "3.8.1", + "codecov": "3.8.2", "cpx": "1.5.0", - "gts": "3.1.0", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", @@ -61,18 +60,18 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { "@grpc/proto-loader": "^0.6.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/exporter-collector": "0.19.0", - "@opentelemetry/metrics": "0.19.0", - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/core": "0.21.0", + "@opentelemetry/exporter-collector": "0.21.0", + "@opentelemetry/metrics": "0.21.0", + "@opentelemetry/resources": "0.21.0", + "@opentelemetry/tracing": "0.21.0", "protobufjs": "^6.9.0" } } diff --git a/packages/opentelemetry-exporter-collector-proto/src/CollectorExporterNodeBase.ts b/packages/opentelemetry-exporter-collector-proto/src/CollectorExporterNodeBase.ts index d316c928d9..30e85b588c 100644 --- a/packages/opentelemetry-exporter-collector-proto/src/CollectorExporterNodeBase.ts +++ b/packages/opentelemetry-exporter-collector-proto/src/CollectorExporterNodeBase.ts @@ -49,7 +49,7 @@ export abstract class CollectorExporterNodeBase< }); } - onInit(config: CollectorExporterNodeConfigBase): void { + override onInit(config: CollectorExporterNodeConfigBase): void { this._isShutdown = false; // defer to next tick and lazy load to avoid loading protobufjs too early // and making this impossible to be instrumented @@ -60,7 +60,7 @@ export abstract class CollectorExporterNodeBase< }); } - send( + override send( objects: ExportItem[], onSuccess: () => void, onError: (error: collectorTypes.CollectorExporterError) => void diff --git a/packages/opentelemetry-exporter-collector-proto/src/CollectorMetricExporter.ts b/packages/opentelemetry-exporter-collector-proto/src/CollectorMetricExporter.ts index 73c4156d3b..76a93d98fe 100644 --- a/packages/opentelemetry-exporter-collector-proto/src/CollectorMetricExporter.ts +++ b/packages/opentelemetry-exporter-collector-proto/src/CollectorMetricExporter.ts @@ -24,7 +24,6 @@ import { ServiceClientType } from './types'; import { CollectorExporterNodeBase } from './CollectorExporterNodeBase'; import { getEnv, baggageUtils } from '@opentelemetry/core'; -const DEFAULT_SERVICE_NAME = 'collector-metric-exporter'; const DEFAULT_COLLECTOR_URL = 'http://localhost:4317/v1/metrics'; /** @@ -69,10 +68,6 @@ export class CollectorMetricExporter : DEFAULT_COLLECTOR_URL; } - getDefaultServiceName(config: CollectorExporterNodeConfigBase): string { - return config.serviceName || DEFAULT_SERVICE_NAME; - } - getServiceClientType() { return ServiceClientType.METRICS; } diff --git a/packages/opentelemetry-exporter-collector-proto/src/CollectorTraceExporter.ts b/packages/opentelemetry-exporter-collector-proto/src/CollectorTraceExporter.ts index 4c08ddb668..124eee5a2d 100644 --- a/packages/opentelemetry-exporter-collector-proto/src/CollectorTraceExporter.ts +++ b/packages/opentelemetry-exporter-collector-proto/src/CollectorTraceExporter.ts @@ -24,7 +24,6 @@ import { import { ServiceClientType } from './types'; import { getEnv, baggageUtils } from '@opentelemetry/core'; -const DEFAULT_SERVICE_NAME = 'collector-trace-exporter'; const DEFAULT_COLLECTOR_URL = 'http://localhost:4317/v1/traces'; /** @@ -62,10 +61,6 @@ export class CollectorTraceExporter : DEFAULT_COLLECTOR_URL; } - getDefaultServiceName(config: CollectorExporterNodeConfigBase): string { - return config.serviceName || DEFAULT_SERVICE_NAME; - } - getServiceClientType() { return ServiceClientType.SPANS; } diff --git a/packages/opentelemetry-exporter-collector-proto/src/version.ts b/packages/opentelemetry-exporter-collector-proto/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-exporter-collector-proto/src/version.ts +++ b/packages/opentelemetry-exporter-collector-proto/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-exporter-collector-proto/test/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-collector-proto/test/CollectorMetricExporter.test.ts index 5f4c4447a5..71f52a265b 100644 --- a/packages/opentelemetry-exporter-collector-proto/test/CollectorMetricExporter.test.ts +++ b/packages/opentelemetry-exporter-collector-proto/test/CollectorMetricExporter.test.ts @@ -99,7 +99,6 @@ describe('CollectorMetricExporter - node with proto over http', () => { foo: 'bar', }, hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', keepAlive: true, diff --git a/packages/opentelemetry-exporter-collector-proto/test/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-collector-proto/test/CollectorTraceExporter.test.ts index fd812f7a4a..d33e8563b1 100644 --- a/packages/opentelemetry-exporter-collector-proto/test/CollectorTraceExporter.test.ts +++ b/packages/opentelemetry-exporter-collector-proto/test/CollectorTraceExporter.test.ts @@ -90,7 +90,6 @@ describe('CollectorTraceExporter - node with proto over http', () => { foo: 'bar', }, hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', keepAlive: true, diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/ca.crt b/packages/opentelemetry-exporter-collector-proto/test/certs/ca.crt index 455c498aa2..d54d3fc5d3 100644 --- a/packages/opentelemetry-exporter-collector-proto/test/certs/ca.crt +++ b/packages/opentelemetry-exporter-collector-proto/test/certs/ca.crt @@ -1,31 +1,33 @@ -----BEGIN CERTIFICATE----- -MIIFPjCCAyYCCQDSzsM0Ou9GwDANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJD -TDELMAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYD -VQQKDARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTAeFw0yMDA1MTUx -NTQ0MzVaFw0yMTA1MTUxNTQ0MzVaMGExCzAJBgNVBAYTAkNMMQswCQYDVQQIDAJS -TTEaMBgGA1UEBwwRT3BlblRlbGVtZXRyeVRlc3QxDTALBgNVBAoMBFJvb3QxD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PtSiG6tpA20hokrnMY5cmYbeUNUWQcnQXdwUgpfdvss5r6PRhHUz2UgZmRm +/Jpq4/TE54HCt6j+OWeZyFOHWXwgJDPdco3CgXol3la0wNT7bbNBO8M7ZY3J80Fe +7PkceQyyjcHIym2fSiJECUA0IdrovykMg3LXENDUcX/TuMzLqM7DMHzAnG4i4lot +hzh4MdC8MzLbiyNl/GKiJTsnhn8nzjAqFV0qSdwp6iSo6GdYbMoVewa3x/BPFLQD +gYCn3pHgIg== -----END CERTIFICATE----- diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/ca.key b/packages/opentelemetry-exporter-collector-proto/test/certs/ca.key index e8b01e04ea..1a770f08f8 100644 --- a/packages/opentelemetry-exporter-collector-proto/test/certs/ca.key +++ b/packages/opentelemetry-exporter-collector-proto/test/certs/ca.key @@ -1,54 +1,54 @@ -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,C088BF4BACFE1D5E +DEK-Info: DES-EDE3-CBC,356304F34E38896B -TKzb0xd1SS8So+VGtAOqj7XhYJNaTSl7HrF5UXoL835lzU6qIdgJWp8REOATdYTP -wqL5x3OlRy/X9GUtXApQx4OoCy1hOMXB10/T1nD+EuxBf4ChEtRow1synEfOVlX8 -JZvRHuvN1AGnOzn8YpCnZ19ufw9ASX1cOFjefJKiR8vi32/LEO5No2jqODTWK3V2 -ijiV01hDkbiWvIoxcLQRXm+F2TAZ7MYz/DEjtbAr+4vCDMobJicWHim6yHpor/B0 -7bBVEsR0/R7kb+fLtv9cBDUqu40m7LfuMFtJDD5deRce2hSs+rm9nO01qvo5KvR5 -XA9WdKdFjk3WKjE0uAhRCzXXvRO1S9i6Ym0E3zoW6zcXItQUo30BhBgn4DALMMw/ -aLAsq0trmXqTiJCq8QDYgQOj59jwVxMuAsvinhqBI8koy92hBiXAhZd0r2+2jm/b -yqELuX+0b+FW0hSRL/BsXaTXrzW9cSpSM+EsCtoZloNecGGKNUIhVF6+LmAL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fOdWe9kMKpaFYkhXCTIFaeYAdyopEjl+JvX54Uwc+GRFO/sFKtfb +8gu1oEhFfq0VwWfRzfZ94c4aAt9lqFSy4twtdDVUjwuF49Gpif83Spn/kBDMAOdg +kxrWAytEr81wvecwmZRXxXMLmFQuEHhly1xp721yU+S6tu9ba2xjHYd4EbUhW47b +eaAba9/ZY0qRHVdCG6RSiE5fo42lFzsQW+nSe73wL69N50BfTcVBlgrKaJoUfnP0 +vmfJMW7fskj2MgsslxRFCD5+cmWVe70zwCcNlscaUSfjStFeex8itpO3swIvLiZQ +8aBw9PRG1m7iX1VJUSNcDS+I+C1Aj4zEV12SKSAfPoIZr3sPEVgds3s/1lEeKnbR +eR3sy9TyoeG3iAFInOEO6JJqj0qx46NrAs1lzCvhm7ea0358m02BmdTdeVNq+tyV +Ov1ZAk4cNOmgevLVWvGdXD6DLD5bh8KUWWP8bdP0GlzWqnZl4teyOIKLTodSJlpj -----END RSA PRIVATE KEY----- diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/client.crt b/packages/opentelemetry-exporter-collector-proto/test/certs/client.crt index 9534695d80..f02b0ec199 100644 --- a/packages/opentelemetry-exporter-collector-proto/test/certs/client.crt +++ b/packages/opentelemetry-exporter-collector-proto/test/certs/client.crt @@ -1,31 +1,31 @@ -----BEGIN CERTIFICATE----- -MIIFPzCCAycCAQEwDQYJKoZIhvcNAQEFBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV +MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjAwNTE1MTU0NDM3WhcN -MjEwNTE1MTU0NDM3WjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +dDENMAsGA1UECwwEVGVzdDELMAkGA1UE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utLMG2zSrrZxt2xW8f3H0ifsnICxNHbxi+fe +vAqCek23+iWH+i2tgflHbe7hPwAIByVaNylk/FLV4D4YQbG1hVZ+svex0APXWxLn +T1Z75vYmGhpBQLctyqtq0Ytj0gczEfwaaEXZBcuh7PMepQmBxEj2J71vfp2edowc +LWTWZ0+aBOUh6xTcVeWdyrmEsqrSetTgZxKYt6PNyXP8S93nVuJMCNupAgMBAAEw +DQYJKoZIhvcNAQELBQADggIBADZwq3V+Wm0PNFy02rJmo/fNpcjSmtVYA3BabQCo +KvayqBvm1QfwVzLpji0caZBnztVWf35nAQ0q51jZ/WjNrFg3/g6j8yzwPp7rX5Nv +88VKD2eekjj1wft93K40in2onxzaCchsLo2Jk6wSAt9AkGWM6yTnyvMSSjM3llu1 +m/5OGrUrEGFvjyBUSewBVJalSlMhXMb2PvnT3dzArYDWku+e1rkVSHff6sWrG3AC +D0xDN8JyeLTCfKoPeTsFgVqIz8GyGwenVERj2XrDMncM3o/o1fjT9clHovUVIBVP +SLM7nRB0oqVsau7Syq4xQJ0BZcCXCMD91w+DAHUi85X75C4fpRkaJcPB0oVqEog2 +ZtcyTE/aAsHJGwC7PEpgsQYOpApb2pnfZnhABb8pTBeK/dldrqIW3OJeRCzthh6w +N0p/pxfPXS2Xg5lDlSUoZNWmNObBOpBVevUlMJ+WhK6oFwfkfTbH7z0+o3k70XMZ +mb0R2nXIjZrbU/baGKOUVw9iqQNoRr5DBoInSFuuriTwyHU+O2MVL/UZCZ7TeY4o +5FyGh5+51eWqjt+uyHbJPBeYMoECj4S1PXbMvZSSqI+MR8RdUrEX0F25r60QjLe/ +ETKhZTeqM6GO8DG9WdlaWPDtZ08ZYrKgx4iIN1mu0ytYi0z8QRRvyJ9jBeLa7Lii +/0ud -----END CERTIFICATE----- diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/client.csr b/packages/opentelemetry-exporter-collector-proto/test/certs/client.csr index 2c7d0f9c04..234045e9ea 100644 --- a/packages/opentelemetry-exporter-collector-proto/test/certs/client.csr +++ b/packages/opentelemetry-exporter-collector-proto/test/certs/client.csr @@ -2,27 +2,27 @@ MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGQ2xp ZW50MRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQDJuLdGomaqLgbFv1YpR/zHIKzBAs+kWDJwMQGVRtAML5c2TzHOOlaW -4IKbJ+Y/zf7Xq2oKYqiMCCDftWqRlxpgIOCA4Mq7MKt+zo+Ca75s11itTxhhbGKV -iEpjUdQypBC/LbONSgxGXo7CLRWHLZ7yHLUWD6GAfujaNonXY+YIqB8qv8gyzcw9 -HNAt6/bV5vhHfQTuKYLukZes7j397LbROXjWvzuqldXQ958Z6T0t3yG16ir4g/sY -YF63yzON19EAULerDxbrp6XL4Vg7ILVjEOhEoUFIW9A16+j4Bl4/9VZd51bMT+IJ -wjhOcdd488P7aoo2yop9vnaRBnYvnNEHlXw1qDGQPZpYrWYi7HpynQfLGGqAsEGR -7t883167jKgOseg8iz2ujxBc8OL+TwL7HeEXtHC0wQ7MNRXcf3hswYO5NSghWRwN -0XczagjL8XLph+4VINZ9HBLR1/21UnaZ3Su4llT2w2L/fGxTTqvH2c7KKmYDpCZe -Eycopf6Dw5M6MHPBfPqeL1nYB3r45KpOa7cjCwW+ip1JiYGD3n+xbmfe6Eovq06w -FLOfefkWXnw0XbuTBlf9jTG6TffdmHsIOy04j/oMDbmAQ0JhGMkH9LMTDXMF3GVa -1sPkXSPLnUhaMJjnf4NDTc9wmgF1/J+gSzCQQcUcdM3rf/PFRbSzawIDAQABoAAw -DQYJKoZIhvcNAQELBQADggIBAFjedQr52vLv7YxeLxIvyHrMhbx7Iz4ztj3NlnOJ -EMGm7pcum/rGol1z8m7Y3mFbfJJp8IY/jn1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cqW4 +WwE67X/elBHg0C3QOMoGn1F1rLrSzBts0q62cbdsVvH9x9In7JyAsTR28Yvn3rwK +gnpNt/olh/otrYH5R23u4T8ACAclWjcpZPxS1eA+GEGxtYVWfrL3sdAD11sS509W +e+b2JhoaQUC3LcqratGLY9IHMxH8GmhF2QXLoezzHqUJgcRI9ie9b36dnnaMHC1k +1mdPmgTlIesU3FXlncq5hLKq0nrU4GcSmLejzclz/Evd51biTAjbqQIDAQABoAAw +DQYJKoZIhvcNAQELBQADggIBAKZZVROndJS2TZj/oyaEXjg3+vsVxve7JnlGFiQR +4de+ISUnRTJrTmdN3ocaRRjTp/I7VyIfvQf9chDyyjNz90HSvWI9PntzWkFY/Hk6 +eblj5dPftZHSWhpkNVdjI9tZEl6IOi0uyIzskPDQqm3VX36RApbpO1KglGIANpYx +/DKzt3k4go82u51pKA+KnCaUzI6CqNAsHW1nMBc2zunzBf6hfnlBJ+FEKkz/4Hje +5hR0+QLQr1I8jkvUxN3Qjd7mZJfCLuZiinYejStUs3r8KRA3ZIyPV+4tHqcSTC7J +aE20KCQT8iMYBfMZ3BvMZQYbfheTVeMlQSiOqP5iO9IOoAmgAfX+LNsf0tZ6pBgS +03b+tXZ6GL1qDuAZSRMbb8DmUbBoQI2b1LnP0v2fxe8Cuqm2UJLXBZXY6tOytE8j +ReTSX7Y37AVh17zwNPOOCoJtzUWzEmx6nvizlsB7DBTlbQ/tAKcBubCjTSn2A6yL +ibb0Q9Szjuz3q+zugaYDGEFkK8vjiTzpzpj0wH8VH18q16DcJykBGC1OTTgM66FK +8/toW3ocgAjHPJvd8TxWFaT+hM4VxlFST1Y7/oBnQmSVLtv/6pUGRZsV1ByfPBnD +Bvn7Dqcs8mtZOnw6XX7gQ/qmfMzzE5VQnHh4iPvZ7ULvEgVcz6DbXjjGgEhQQcMq +s7bV -----END CERTIFICATE REQUEST----- diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/client.key b/packages/opentelemetry-exporter-collector-proto/test/certs/client.key index e0fea66664..f5ebbdc625 100644 --- a/packages/opentelemetry-exporter-collector-proto/test/certs/client.key +++ b/packages/opentelemetry-exporter-collector-proto/test/certs/client.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKQIBAAKCAgEAybi3RqJmqi4Gxb9WKUf8xyCswQLPpFgycDEBlUbQDC+XNk8x -zjpWluCCmyfmP83+16tqCmKojAgg37VqkZcaYCDggODKuzCrfs6Pgmu+bNdYrU8Y -YWxilYhKY1HUMqQQvy2zjUoMRl6Owi0Vhy2e8hy1Fg+hgH7o2jaJ12PmCKgfKr/I -Ms3MPRzQLev21eb4R30E7imC7pGXrO49/ey20Tl41r87qpXV0PefGek9Ld8hteoq -+IP7GGBet8szjdfRAFC3qw8W66ely+FYOyC1YxDoRKFBSFvQNevo+AZeP/VWXedW -zE/iCcI4TnHXePPD+2qKNsqKfb52kQZ2L5zRB5V8NagxkD2aWK1mIux6cp0Hyxhq -gLBBke7fPN9eu4yoDrHoPIs9ro8QXPDi/k8C+x3hF7RwtMEOzDUV3H94bMGDuTUo -IVkcDdF3M2oIy/Fy6YfuFSDWfRwS0df9tVJ2md0ruJZU9sNi/3xsU06rx9nOyipm -A6QmXhMnKKX+g8OTOjBzwXz6ni9Z2Ad6+OSqTmu3IwsFvoqdSYmBg95/sW5n3uhK -L6tOsBSzn3n5Fl58NF27kwZX/Y0xuk333Zh7CDstOI/6DA25gENCYRjJB/SzEw1z -BdxlWtbD5F0jy51IWjCY53+DQ03PcJoBdfyfoEswkEHFHHTN63/zxUW0s2sCAwEA -AQKCAgEAjZvNlZl2RuuOt41teAdgLY4DmG9XwwBjUB0nBlsyvAtAtNB9n0+W783m -AfPNkGcVCuP7yhSeS8d9BG6/xDr2Oht6Xx7vUt+E1L0/Q4hNouy+BNQswl+rCVwn -FHgiZfaFByCXFo2v9kp1H1006rOdDEwY18bbUnBFGMMGmx03JEaZspH1gay1PwWW -I1at7lV5X/4k0uhzUPUGLFEHVdWyNUiKSv7ubP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ZUNmOPqezlM4cd/9WIpOuGx9gdmpf8Ammw1VRsEizRU1efg== -----END RSA PRIVATE KEY----- diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/regenerate.sh b/packages/opentelemetry-exporter-collector-proto/test/certs/regenerate.sh index bb6ec4a9b5..728c0cbfb3 100755 --- a/packages/opentelemetry-exporter-collector-proto/test/certs/regenerate.sh +++ b/packages/opentelemetry-exporter-collector-proto/test/certs/regenerate.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#!/usr/bin/env sh # # Usage: regenerate.sh # @@ -7,13 +7,16 @@ # It also serves as a documentation on how existing certificates were generated. rm ca.crt ca.key client.crt client.csr client.key server.crt server.csr server.key -openssl genrsa -passout pass:1111 -des3 -out ca.key 4096 -openssl req -passin pass:1111 -new -x509 -days 365 -key ca.key -out ca.crt -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Root/OU=Test/CN=ca" -openssl genrsa -passout pass:1111 -des3 -out server.key 4096 -openssl req -passin pass:1111 -new -key server.key -out server.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Server/CN=localhost" -openssl x509 -req -passin pass:1111 -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt -openssl rsa -passin pass:1111 -in server.key -out server.key -openssl genrsa -passout pass:1111 -des3 -out client.key 4096 -openssl req -passin pass:1111 -new -key client.key -out client.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Client/CN=localhost" -openssl x509 -passin pass:1111 -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt -openssl rsa -passin pass:1111 -in client.key -out client.key + +openssl genrsa -des3 -out ca.key 4096 +openssl req -new -x509 -days 365 -key ca.key -out ca.crt -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Root/OU=Test/CN=ca" + +openssl genrsa -des3 -out server.key 4096 +openssl req -new -key server.key -out server.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Server/CN=localhost" +openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt +openssl rsa -in server.key -out server.key + +openssl genrsa -des3 -out client.key 4096 +openssl req -new -key client.key -out client.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Client/CN=localhost" +openssl x509 -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt +openssl rsa -in client.key -out client.key diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/server.crt b/packages/opentelemetry-exporter-collector-proto/test/certs/server.crt index 62f91722a9..8e76b7b4a6 100644 --- a/packages/opentelemetry-exporter-collector-proto/test/certs/server.crt +++ b/packages/opentelemetry-exporter-collector-proto/test/certs/server.crt @@ -1,31 +1,31 @@ -----BEGIN CERTIFICATE----- -MIIFPzCCAycCAQEwDQYJKoZIhvcNAQEFBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV +MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjAwNTE1MTU0NDM2WhcN -MjEwNTE1MTU0NDM2WjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjEwNjA3MjAyNzUyWhcN +MjIwNjA3MjAyNzUyWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZT ZXJ2ZXIxEjAQBgNVBAMMCWxvY2FsaG9zdDCCAiIwDQYJKoZIhvcNAQEBBQADggIP -ADCCAgoCggIBANQwHRfyj/d8Hh0qgDlxdtSxlo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FmiQCJLSCLoH/sUbjdcZo5R96jGaaqodv4Prktv +aJ0ruWxLi3NJumfKlHoQZ2oZHU3Ujw0U3G8jHtU3V9v5ThIOMsUl/MY6qQJCaO0V +4QvEWvFJ3GwyZvnd/xDFMVGcRCmwehQZqyFpqCTJ2KTTRKIoxkj7O0oboWlwNpVQ +7/pyIWRvdB7AE/ldY1KuHn5Oj+nXMacB23zPcJ++IHAcL8AlHjrKmskYlqpswWON +xuwG5ilWpLYeoZ3WP1fxG/2Xoe+036eKEXhRHECb3fofGDXZ0ElPAqpMSH/hS2/l +1Eif+p6vy8np9zqSsFmEq74uRPZo7TrBKa8FYufCkB5VxOV31SaP8yj1G+nHCVa1 +O1h7uI7IQpSLsrEldf1FFkJSy6F6qx17uremRUpEPkfyi1/t3vjWPB7wZHetAho4 +uVDBbo85CsM9eKPr7ynWJzEEbefLKRxdpKp/cUvxMxDxZeEStGrIENc4qNYQN6aR +fc3WrczAoOsLMicSye21n7j0OApz+TnbSgt5+ane+oSschiBmx1LaJLFkDTiKA5w +h+3sws4I8dL0YTdtdacPZgtuLWSjN0xTdhD7idfqatrQA5bTJjoTnEBmdIUVp8X4 +wOo03t3lf+LQDjIHps41Mo/BVSqZbWuXA53rfxQ49JsGfoUfm3L1domYB4tlTWRq +s2Wb -----END CERTIFICATE----- diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/server.csr b/packages/opentelemetry-exporter-collector-proto/test/certs/server.csr index 967316e171..45c77ba43f 100644 --- a/packages/opentelemetry-exporter-collector-proto/test/certs/server.csr +++ b/packages/opentelemetry-exporter-collector-proto/test/certs/server.csr @@ -2,27 +2,27 @@ MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGU2Vy dmVyMRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4IC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QABoAAw +DQYJKoZIhvcNAQELBQADggIBAI6upPY4cjckMgAGj5NvhP9vWykUUzQZyWHDK052 +ruSo9PAtqCJiYQwXu//8uOjfrDFcOYiET1cpZVPdyjRpfoGMtNje+ap4969UQsj6 +UXvFYgNTSnjBr7nKySH6SamfBABeu5+TjID/jyqFMpepk++GuWRcYPnM1GHObfGm +hRd+3gYbF3m+KA0qrBIoFbHstLkFaLs84Lf8gzDt48ZoN+9QjQKZZtKZvpZXlsag +6FsYcp9o+h/bFIluUINLs8oTfElml3y1G8IMCyNskEdF4Zi65Ml+QaXIk7SLN29Z +NlSZEwtDNJQJB+hOBtIC31cs53l0s7UtdaX6UjyfwswxWsUkvpPJDRs5beC2IUgM +W+PWwszK0BNFvmzGQ4KKWGDLe4YEf5Ss4grIqM4Kf6tpgicuZVyc6wHkB8secJR9 +JftUHBaHazaJFzd+oaQ677cd+Oj74Ht1qGKFmKykPS5GmQfC1CMMj1AkBmh4BnQg +oEdT8xpvhzEBaygJr7v01LViRAAFtM46vW4VkpCMxNSzIymlX8/sszlVChjWpWdE +lMOtlUQxtigbVqYldDx5AmFgGZyKTSi5GaoB9qVLr0tU8c/FodvgUuuzgAZfr3BD +P12EezgueK1oF2z7RCwfgKeEpjGq8wfNzG6AF/AdJGUiHk/yrlcTTLGORH9beBZh +CH0X -----END CERTIFICATE REQUEST----- diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/server.key b/packages/opentelemetry-exporter-collector-proto/test/certs/server.key index 4831771d2b..b00ffb89bf 100644 --- a/packages/opentelemetry-exporter-collector-proto/test/certs/server.key +++ b/packages/opentelemetry-exporter-collector-proto/test/certs/server.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKgIBAAKCAgEA1DAdF/KP93weHSqAOXF21LGWhGzxm8EjC3oBxx3WFSqzx0LR -z1Xldc5x+a6xvcWjw0pefogg8ITLWykUJ7gQFbihtKCQkRV0/CwyxdQ8t6T/orlL -q4QWGcYtQknnuACOH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qJMguUxLLcQhD15KKKvVksdvOJQbqTiF9KU1pnBGdp4KGj7xHw9t5bX8hvsjj +k11LFGDmluOFAW8SeGPAFPMsY20lp3yG4Mu1CTCS5X558PEXVZ3C/tiq5P/5NY4U +D3GNAoIBAQCVCfRQC1SkfXJaFpQKDoLNT1R2UGtuq4D9sYADq5aRagzTGG9O2Sib +8B3nuqdMqyiG005F4vmbt8M2gMhsfKDYKvS6CdZOuvkNXqBoythlBFOaSEXI+mWp +bhbqIjwA9DzXFW4AiLlS2pAhkhaLiLZeMNjO+J+iLcLFBmTh6ZvvfE0AyQ3c2yGO +WF6kOCA8wxb3BSUgU+UenBp54igcpJQusjgjUmmYh7Se1R7Ba1ewbU/cqpmpXu+h +AYR+ZnIUuFAgo5n3A0uVkvwU9PqBQHP6XAYGDPHArKojuRdhSY1hAxcnQ0jNRkzZ +ux4/4B/C6Vioxz7edgsKzgFEegLcAIdJAoIBAQCMShLYONulWyLVWA9TiCRiKgG5 +2Di6wXg6gNHYVH6RtsjEsY+G/uXE8VcU7jvLbcrP70Zwdss9aelpLN5dMz+wzoy3 +2pc1lRNhFi5JaHpY7xaXudhyI3b8CCrWbxXpfWgalcZATG2AfkF87MbVLr9iQZyn ++zA5/En00woNy2MiAGlMoDkIbnRLv5CSuukWdr9jUruuyCP9RUPvLQYxuNyFip1w +Go9TzY1T2u3qmrCwOynKY9ya5JARZ1CD1U8Fj45c+HBvw53tpFT+r8oRDgGoJbLZ +fJUXHbtbjlCNcGPUVe9HtuBdaHrPZBap8BHH2f/HFsJT4f7yihzo8rIzxr54 -----END RSA PRIVATE KEY----- diff --git a/packages/opentelemetry-exporter-collector-proto/test/helper.ts b/packages/opentelemetry-exporter-collector-proto/test/helper.ts index 83a98ca10d..7c35bb8b53 100644 --- a/packages/opentelemetry-exporter-collector-proto/test/helper.ts +++ b/packages/opentelemetry-exporter-collector-proto/test/helper.ts @@ -95,10 +95,12 @@ const parentIdHex = '78a8915098864388'; export const mockedReadableSpan: ReadableSpan = { name: 'documentFetch', kind: 0, - spanContext: { - traceId: traceIdHex, - spanId: spanIdHex, - traceFlags: TraceFlags.SAMPLED, + spanContext: () => { + return { + traceId: traceIdHex, + spanId: spanIdHex, + traceFlags: TraceFlags.SAMPLED, + }; }, parentSpanId: parentIdHex, startTime: [1574120165, 429803070], @@ -111,6 +113,7 @@ export const mockedReadableSpan: ReadableSpan = { context: { traceId: traceIdHex, spanId: parentIdHex, + traceFlags: TraceFlags.SAMPLED, }, attributes: { component: 'document-load' }, }, diff --git a/packages/opentelemetry-exporter-collector/README.md b/packages/opentelemetry-exporter-collector/README.md index 33934ed95e..93902d9326 100644 --- a/packages/opentelemetry-exporter-collector/README.md +++ b/packages/opentelemetry-exporter-collector/README.md @@ -13,6 +13,11 @@ This module provides exporter for web and node to be used with [opentelemetry-co npm install --save @opentelemetry/exporter-collector ``` +## Service Name + +The OpenTelemetry Collector Exporter does not have a service name configuration. +In order to set the service name, use the `service.name` resource attribute as prescribed in the [OpenTelemetry Resource Semantic Conventions][semconv-resource-service-name]. + ## Traces in Web The CollectorTraceExporter in Web expects the endpoint to end in `/v1/traces`. @@ -78,7 +83,6 @@ const { BasicTracerProvider, BatchSpanProcessor } = require('@opentelemetry/trac const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector'); const collectorOptions = { - serviceName: 'basic-service', url: '', // url is optional and can be omitted - default is http://localhost:55681/v1/trace headers: { foo: 'bar' @@ -105,7 +109,6 @@ provider.register(); const { MeterProvider } = require('@opentelemetry/metrics'); const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector'); const collectorOptions = { - serviceName: 'basic-service', url: '', // url is optional and can be omitted - default is http://localhost:55681/v1/metrics concurrencyLimit: 1, // an optional limit on pending requests }; @@ -159,3 +162,4 @@ Apache 2.0 - See [LICENSE][license-url] for more information. [npm-url-proto]: https://www.npmjs.com/package/@opentelemetry/exporter-collector-proto [npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-collector.svg [opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-collector +[semconv-resource-service-name]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service diff --git a/packages/opentelemetry-exporter-collector/package.json b/packages/opentelemetry-exporter-collector/package.json index c35b3374d4..ce1a949597 100644 --- a/packages/opentelemetry-exporter-collector/package.json +++ b/packages/opentelemetry-exporter-collector/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-collector", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -54,22 +54,21 @@ }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^1.0.0-rc.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", "@types/webpack-env": "1.16.0", "babel-loader": "8.2.2", - "codecov": "3.8.1", + "codecov": "3.8.2", "cpx": "1.5.0", - "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", "karma-spec-reporter": "0.0.32", - "karma-webpack": "5.0.0", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", @@ -77,19 +76,19 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0", "webpack-cli": "4.6.0", "webpack-merge": "5.7.3" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/api-metrics": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/metrics": "0.19.0", - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/api-metrics": "0.21.0", + "@opentelemetry/core": "0.21.0", + "@opentelemetry/metrics": "0.21.0", + "@opentelemetry/resources": "0.21.0", + "@opentelemetry/tracing": "0.21.0" } } diff --git a/packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts b/packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts index c8a4d47637..f4705d9031 100644 --- a/packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts +++ b/packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts @@ -30,7 +30,6 @@ export abstract class CollectorExporterBase< ExportItem, ServiceRequest > { - public readonly serviceName: string; public readonly url: string; public readonly hostname: string | undefined; public readonly attributes?: SpanAttributes; @@ -43,7 +42,6 @@ export abstract class CollectorExporterBase< * @param config */ constructor(config: T = {} as T) { - this.serviceName = this.getDefaultServiceName(config); this.url = this.getDefaultUrl(config); if (typeof config.hostname === 'string') { this.hostname = config.hostname; @@ -140,6 +138,5 @@ export abstract class CollectorExporterBase< onError: (error: CollectorExporterError) => void ): void; abstract getDefaultUrl(config: T): string; - abstract getDefaultServiceName(config: T): string; abstract convert(objects: ExportItem[]): ServiceRequest; } diff --git a/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorMetricExporter.ts b/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorMetricExporter.ts index 4b8ce05b41..8d281e8c32 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorMetricExporter.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorMetricExporter.ts @@ -22,7 +22,6 @@ import { toCollectorExportMetricServiceRequest } from '../../transformMetrics'; import { getEnv, baggageUtils } from '@opentelemetry/core'; const DEFAULT_COLLECTOR_URL = 'http://localhost:55681/v1/metrics'; -const DEFAULT_SERVICE_NAME = 'collector-metric-exporter'; /** * Collector Metric Exporter for Web @@ -65,8 +64,4 @@ export class CollectorMetricExporter ? getEnv().OTEL_EXPORTER_OTLP_ENDPOINT : DEFAULT_COLLECTOR_URL; } - - getDefaultServiceName(config: CollectorExporterConfigBase): string { - return config.serviceName || DEFAULT_SERVICE_NAME; - } } diff --git a/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorTraceExporter.ts b/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorTraceExporter.ts index 8115e3a546..305875a088 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorTraceExporter.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorTraceExporter.ts @@ -21,7 +21,6 @@ import { toCollectorExportTraceServiceRequest } from '../../transform'; import * as collectorTypes from '../../types'; import { getEnv, baggageUtils } from '@opentelemetry/core'; -const DEFAULT_SERVICE_NAME = 'collector-trace-exporter'; const DEFAULT_COLLECTOR_URL = 'http://localhost:55681/v1/traces'; /** @@ -57,8 +56,4 @@ export class CollectorTraceExporter ? getEnv().OTEL_EXPORTER_OTLP_ENDPOINT : DEFAULT_COLLECTOR_URL; } - - getDefaultServiceName(config: CollectorExporterConfigBase): string { - return config.serviceName ?? DEFAULT_SERVICE_NAME; - } } diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/CollectorMetricExporter.ts b/packages/opentelemetry-exporter-collector/src/platform/node/CollectorMetricExporter.ts index 90800cc250..dcffc1ac95 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/CollectorMetricExporter.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/node/CollectorMetricExporter.ts @@ -21,7 +21,6 @@ import { CollectorExporterNodeBase } from './CollectorExporterNodeBase'; import { toCollectorExportMetricServiceRequest } from '../../transformMetrics'; import { getEnv, baggageUtils } from '@opentelemetry/core'; -const DEFAULT_SERVICE_NAME = 'collector-metric-exporter'; const DEFAULT_COLLECTOR_URL = 'http://localhost:55681/v1/metrics'; /** @@ -65,8 +64,4 @@ export class CollectorMetricExporter ? getEnv().OTEL_EXPORTER_OTLP_ENDPOINT : DEFAULT_COLLECTOR_URL; } - - getDefaultServiceName(config: CollectorExporterNodeConfigBase): string { - return config.serviceName || DEFAULT_SERVICE_NAME; - } } diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/CollectorTraceExporter.ts b/packages/opentelemetry-exporter-collector/src/platform/node/CollectorTraceExporter.ts index f33d90400d..7354491208 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/CollectorTraceExporter.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/node/CollectorTraceExporter.ts @@ -21,7 +21,6 @@ import * as collectorTypes from '../../types'; import { toCollectorExportTraceServiceRequest } from '../../transform'; import { getEnv, baggageUtils } from '@opentelemetry/core'; -const DEFAULT_SERVICE_NAME = 'collector-trace-exporter'; const DEFAULT_COLLECTOR_URL = 'http://localhost:55681/v1/traces'; /** @@ -58,8 +57,4 @@ export class CollectorTraceExporter ? getEnv().OTEL_EXPORTER_OTLP_ENDPOINT : DEFAULT_COLLECTOR_URL; } - - getDefaultServiceName(config: CollectorExporterNodeConfigBase): string { - return config.serviceName || DEFAULT_SERVICE_NAME; - } } diff --git a/packages/opentelemetry-exporter-collector/src/transform.ts b/packages/opentelemetry-exporter-collector/src/transform.ts index ee62762159..0554f055f9 100644 --- a/packages/opentelemetry-exporter-collector/src/transform.ts +++ b/packages/opentelemetry-exporter-collector/src/transform.ts @@ -174,17 +174,17 @@ export function toCollectorSpan( ): opentelemetryProto.trace.v1.Span { return { traceId: useHex - ? span.spanContext.traceId - : core.hexToBase64(span.spanContext.traceId), + ? span.spanContext().traceId + : core.hexToBase64(span.spanContext().traceId), spanId: useHex - ? span.spanContext.spanId - : core.hexToBase64(span.spanContext.spanId), + ? span.spanContext().spanId + : core.hexToBase64(span.spanContext().spanId), parentSpanId: span.parentSpanId ? useHex ? span.parentSpanId : core.hexToBase64(span.parentSpanId) : undefined, - traceState: toCollectorTraceState(span.spanContext.traceState), + traceState: toCollectorTraceState(span.spanContext().traceState), name: span.name, kind: toCollectorKind(span.kind), startTimeUnixNano: core.hrTimeToNanoseconds(span.startTime), @@ -285,10 +285,7 @@ export function toCollectorExportTraceServiceRequest< const additionalAttributes = Object.assign( {}, - collectorTraceExporterBase.attributes, - { - 'service.name': collectorTraceExporterBase.serviceName, - } + collectorTraceExporterBase.attributes ); return { diff --git a/packages/opentelemetry-exporter-collector/src/transformMetrics.ts b/packages/opentelemetry-exporter-collector/src/transformMetrics.ts index b992a3b5ee..424bb77a43 100644 --- a/packages/opentelemetry-exporter-collector/src/transformMetrics.ts +++ b/packages/opentelemetry-exporter-collector/src/transformMetrics.ts @@ -177,10 +177,7 @@ export function toCollectorExportMetricServiceRequest< > = groupMetricsByResourceAndLibrary(metrics); const additionalAttributes = Object.assign( {}, - collectorExporterBase.attributes, - { - 'service.name': collectorExporterBase.serviceName, - } + collectorExporterBase.attributes ); return { resourceMetrics: toCollectorResourceMetrics( diff --git a/packages/opentelemetry-exporter-collector/src/types.ts b/packages/opentelemetry-exporter-collector/src/types.ts index f0b02825f3..e8ae3ff65e 100644 --- a/packages/opentelemetry-exporter-collector/src/types.ts +++ b/packages/opentelemetry-exporter-collector/src/types.ts @@ -315,7 +315,7 @@ export namespace opentelemetryProto { */ export class CollectorExporterError extends Error { readonly code?: number; - readonly name: string = 'CollectorExporterError'; + override readonly name: string = 'CollectorExporterError'; readonly data?: string; constructor(message?: string, code?: number, data?: string) { @@ -343,7 +343,6 @@ export interface ExportServiceError { export interface CollectorExporterConfigBase { headers?: Partial>; hostname?: string; - serviceName?: string; attributes?: SpanAttributes; url?: string; concurrencyLimit?: number; diff --git a/packages/opentelemetry-exporter-collector/src/version.ts b/packages/opentelemetry-exporter-collector/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-exporter-collector/src/version.ts +++ b/packages/opentelemetry-exporter-collector/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-exporter-collector/test/browser/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-collector/test/browser/CollectorMetricExporter.test.ts index 5f40d55c2e..d5208d20a0 100644 --- a/packages/opentelemetry-exporter-collector/test/browser/CollectorMetricExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/browser/CollectorMetricExporter.test.ts @@ -84,7 +84,6 @@ describe('CollectorMetricExporter - web', () => { beforeEach(() => { collectorExporter = new CollectorMetricExporter({ url: 'http://foo.bar.com', - serviceName: 'bar', }); // Overwrites the start time to make tests consistent Object.defineProperty(collectorExporter, '_startTime', { @@ -193,7 +192,6 @@ describe('CollectorMetricExporter - web', () => { (window.navigator as any).sendBeacon = false; collectorExporter = new CollectorMetricExporter({ url: 'http://foo.bar.com', - serviceName: 'bar', }); // Overwrites the start time to make tests consistent Object.defineProperty(collectorExporter, '_startTime', { diff --git a/packages/opentelemetry-exporter-collector/test/browser/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-collector/test/browser/CollectorTraceExporter.test.ts index f0950cb3f2..f0b8e6a1d2 100644 --- a/packages/opentelemetry-exporter-collector/test/browser/CollectorTraceExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/browser/CollectorTraceExporter.test.ts @@ -54,7 +54,6 @@ describe('CollectorTraceExporter - web', () => { beforeEach(() => { collectorExporterConfig = { hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', }; diff --git a/packages/opentelemetry-exporter-collector/test/certs/ca.crt b/packages/opentelemetry-exporter-collector/test/certs/ca.crt index 455c498aa2..529ce2f7b8 100644 --- a/packages/opentelemetry-exporter-collector/test/certs/ca.crt +++ b/packages/opentelemetry-exporter-collector/test/certs/ca.crt @@ -1,31 +1,33 @@ -----BEGIN CERTIFICATE----- -MIIFPjCCAyYCCQDSzsM0Ou9GwDANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJD -TDELMAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYD -VQQKDARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTAeFw0yMDA1MTUx -NTQ0MzVaFw0yMTA1MT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BT88174S2MQaqwhF +jQiS3YfElLXkr37E9gxMKLDanbFsxPPiXO96s0RSjNK2mzSbz/gfmsjGqxKNq3t1 +IwAfjePmmx4FJ1O/FwOA5RWE+KRhzNucktjxz39oZrnqtPeTqHnAivNOyK3XB68v +5HRjP79TrzIbLCauyJD/qM5UtCRXW2La1rsH8lIBtcxUcZOkvDnE6Po44D5hH2kQ +swRqF9Vy7PL9MWJPTgn4+WFLNoBe+nMY82y7xstRv7c2ctXpAxSWxIXgBN+B9nXo +3Lqpgg0UkjTiCp13Mejq/7DYAw+/Ou8bxWs3BuCQvFcG2+FBMWh0dL1FxVq3BPyq +oveTgr1sfQ== -----END CERTIFICATE----- diff --git a/packages/opentelemetry-exporter-collector/test/certs/ca.key b/packages/opentelemetry-exporter-collector/test/certs/ca.key index e8b01e04ea..df94d44c38 100644 --- a/packages/opentelemetry-exporter-collector/test/certs/ca.key +++ b/packages/opentelemetry-exporter-collector/test/certs/ca.key @@ -1,54 +1,54 @@ -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,C088BF4BACFE1D5E +DEK-Info: DES-EDE3-CBC,7EE0C188F59416E9 -TKzb0xd1SS8So+VGtAOqj7XhYJNaTSl7HrF5UXoL835lzU6qIdgJWp8REOATdYTP -wqL5x3OlRy/X9GUtXApQx4OoCy1hOMXB10/T1nD+EuxBf4ChEtRow1synEfOVlX8 -JZvRHuvN1AGnOzn8YpCnZ19ufw9ASX1cOFjefJKiR8vi32/LEO5No2jqODTWK3V2 -ijiV01hDkbiWvIoxcLQRXm+F2TAZ7MYz/DEjtbAr+4vCDMobJicWHim6yHpor/B0 -7bBVEsR0/R7kb+fLtv9cBDUqu40m7LfuMFtJDD5deRce2hSs+rm9nO01qvo5KvR5 -XA9WdKdFjk3WKjE0uAhRCzXXvRO1S9i6Ym0E3zoW6zcXItQUo30BhBgn4DALMMw/ -aLAsq0trmXqTiJCq8QDYgQOj59jwVxMuAsvinhqBI8ko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Y7QNKYAPf1ZLjZOrutiXny8nPWeMggaalCRIucP/rK2icae +McSOb8Jzp01OSRfft1MN8qQHZENE3GheKSnU4upC+anjpsF4yWoFE7wVSLom76AO +N2OqwPQFEgzn5BZRuPXiOsfhoafr+GtiC8mY87GE9cIFPtoVTVUbDgspAzxszy4d +VGunmfyRPaedUAlqy510ygdUzWTfZsKPC6XJEM9gSTOblERvIGOOquUk4F1vC/Wu +ihjhHr4usrXV/FinfYbCIrU+9WPNp8fKoNajHEkge5gWwBE75xkouSK20JRdfE90 +2d2g87EdcE7BTlcQGqCAe4N6RwK6V+kEZrHrBCQoXGtSM96opTM878krkcRap7ci +nwnP/EvD5CfNgT7uGn/dleNs5f4325PYA2uGPgBfJIpTkgGR7DyUjR8AU4mP8hwc +j0GydgSuYF0AOUNQRZuiNlHT3Buio7lKJMmwuuLFSACcnp9LVBhRgbypDRIxGSFw +GST/70V5OaDibFC7bl37pbKh1qzBqVB1qlylqxvS/ZID3iMEqjuuumYBO11Pkm1f -----END RSA PRIVATE KEY----- diff --git a/packages/opentelemetry-exporter-collector/test/certs/client.crt b/packages/opentelemetry-exporter-collector/test/certs/client.crt index 9534695d80..b1519dede6 100644 --- a/packages/opentelemetry-exporter-collector/test/certs/client.crt +++ b/packages/opentelemetry-exporter-collector/test/certs/client.crt @@ -1,31 +1,31 @@ -----BEGIN CERTIFICATE----- -MIIFPzCCAycCAQEwDQYJKoZIhvcNAQEFBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV +MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjAwNTE1MTU0NDM3WhcN -MjEwNTE1MTU0NDM3WjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +dDENMA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1DC1s1owOrgwBXzHRRNXuUFjZPPrMC8TkBexNjsapLjr +nE/xa5cB80DIntkM8ysfLU6p39NihM2hmeyI2YS8osheElXEL3dz5vM8Wzv28qgF +PvGpdYz6cAibE9qJ+oT416dVc+9G6i1fcBl7X8w+KUGVFsRnftovwjoSToGlckqg +dv1Tsf6FBDpSMro3BbGogpDhkSxy//eWvzejjHBemz06Kh2DGkKhnT9rAgMBAAEw +DQYJKoZIhvcNAQELBQADggIBAIGWBdgWOoqGIy0fuSbqQgjgrhDrPGBV15TfvB4T +84xfk9YZxdRKkG3J65uLffTnnotZs6gqLx6MfosR6zQYhSK27fTXpJJdRaI55kgT +2e/xNCe867Bz/3nW+vwWIGTuFn6hFq9f8HNLZMpHu3DClj7AB7ga6qp1uFWIn5oq +xC4da8/JTR6FY2srIktyH5Vr64FnhtX9cLSa/U7df7asZjRUm6ndPS49X01G6BJQ +vH0RO1caCCbpDVqPwJnAf3BXD1MkKsNe4hULt25XCxSsyM7v0Ru4KcSSGxiYHowQ ++VzRdJVYe8ytpcg1eVlWutOlDXGLaeGNQ0/u5OEQ8iqZvp1/qiq/LQIRZlxa+ZlL +vsVAgOxolRpm6W01cYCCWX8utsrMq8lKjMIal0SZhj6oP/rwtH8UVRhqhrQyAn6y +K6IYGLGvXGacJYuHpcAFQ0f8LUCCs0kxN/zZOZ98atF0MvgUWKZFNgrvcX5se8iV +kS/7UHH4Ie9ZO6Hv9IvnElOfZY9dnFPNxcbWnA7U0kLa5CWh8CD55ScAGHrvcz3O +JXPW0SHb2xZmXDTfgmS4vMI5PYDyipSCoUDClA3BPr/dkAVssj8SMikJZWhVvDrK +IcKRHpkmrzLJbatxeDNlCtLRSAXeuTheLqqSA2HACReNYkQLPd5V7mY6uRw3d3o6 +3rKe -----END CERTIFICATE----- diff --git a/packages/opentelemetry-exporter-collector/test/certs/client.csr b/packages/opentelemetry-exporter-collector/test/certs/client.csr index 2c7d0f9c04..2d99fab566 100644 --- a/packages/opentelemetry-exporter-collector/test/certs/client.csr +++ b/packages/opentelemetry-exporter-collector/test/certs/client.csr @@ -2,27 +2,27 @@ MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGQ2xp ZW50MRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQDJuLdGomaqLgbFv1YpR/zHIKzBAs+kWDJwMQGVRtAML5c2TzHOOlaW -4IKbJ+Y/zf7Xq2oKYqiMCCDftWqRlxpgIOCA4Mq7MKt+zo+Ca75s11itTxhhbGKV -iEpjUdQypBC/LbONSgxGXo7CLRWHLZ7yHLUWD6GAfujaNonXY+YIqB8qv8gyzcw9 -HNAt6/bV5vhHfQTuKYLukZes7j397LbROXjWvzuqldXQ958Z6T0t3yG16ir4g/sY -YF63yzON19EAULerDxbrp6XL4Vg7ILVjEOhEoUFIW9A16+j4Bl4/9VZd51bMT+IJ -wjhOcdd488P7aoo2yop9vnaRBnYvnNEHlXw1qDGQPZpYrWYi7HpynQfLGGqAsEGR -7t883167jKgOseg8iz2ujxBc8OL+TwL7HeEXtHC0wQ7MNRXcf3hswYO5NSghWRwN -0XczagjL8XLph+4VINZ9HBLR1/21UnaZ3Su4llT2w2L/fGxTTqvH2c7KKmYDpCZe -Eycopf6Dw5M6MHPBfPqeL1nYB3r45KpOa7cjCwW+ip1JiYGD3n+xbmfe6Eovq06w -FLOfefkWXnw0XbuTBlf9jTG6TffdmHsIOy04j/oMDbmAQ0JhGMkH9LMTDXMF3GVa -1sPkXSPLnUhaMJjnf4NDTc9wmgF1/J+gSzCQQcUcdM3rf/PFRbSzawIDAQABoAAw -DQYJKoZIhvcNAQELBQADggIBAFjedQr52vLv7YxeLxIvyHrMhbx7Iz4ztj3NlnOJ -EMGm7pcum/rGol1z8m7Y3mFbfJJp8IY/jn1w92x+M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KiRxmVp5yFT +oHnfvwxCFvRJsi0jzNQwtbNaMDq4MAV8x0UTV7lBY2Tz6zAvE5AXsTY7GqS465xP +8WuXAfNAyJ7ZDPMrHy1Oqd/TYoTNoZnsiNmEvKLIXhJVxC93c+bzPFs79vKoBT7x +qXWM+nAImxPaifqE+NenVXPvRuotX3AZe1/MPilBlRbEZ37aL8I6Ek6BpXJKoHb9 +U7H+hQQ6UjK6NwWxqIKQ4ZEscv/3lr83o4xwXps9OiodgxpCoZ0/awIDAQABoAAw +DQYJKoZIhvcNAQELBQADggIBAE8wUkuBEsxe96X3U2vjWCfD/hB30cF69UZ2NlR6 +2UIZbjvewIy43ozr2uaCk1+US21NaaXKinNrZ0VElWKLVXWkZidfuoGEz0gY+XDF +qyjlfaYlCTexPUSh14nbpLsT0DXvHa5KI3Kq2ly/sciVB78SlH3sRzmJt/qkoaIN +f6PI2Unoqf8vJ1xvQr9z/ODc06MoX5g+ezM2vShZ+P7773bSVL6bIEVl/9yFFAyu +OHL+uwUdBYBk3NS4xKyXWXhG58AyNvGYWIO0tWTYmIVVuL2JDrNGY4QdIDQBoj+4 +hppmh0mYbvDCXolKjUVFC0wHRACaRCN1WLIKP8heE0vZsvXq/7ssuP3DtCDHRadk +pHn+6CpEwbT4bCNsW4bsci9v82npoY6YJKW8mokR+1dhcari6g1W2R80VCuWmB6E +ntJFZpILjPrCf8QCjs9Act0l87xx3+5K0LpFHQiKHygTbOrzE8++Lds+6yC/uzp/ +QtdLC20/iQMJ5GaOxSCwzBe1dUhC+ABF1/ZN1p9wgKFTFQMR+B/bR5q9l/d2AyMY +1pTorKIX7yg14OHehzL0s1tVq3QEtNl14c84hLh0m4Rf7nmRRcKDP8l6EwDujJVD +nR8cHM8ajiyC9tjjdyiQ32NLgzo+6OGiugctUxfw/ZLp7Qr0mT07IvPLcqBiRAC6 +E+9O -----END CERTIFICATE REQUEST----- diff --git a/packages/opentelemetry-exporter-collector/test/certs/client.key b/packages/opentelemetry-exporter-collector/test/certs/client.key index e0fea66664..00f82cfeeb 100644 --- a/packages/opentelemetry-exporter-collector/test/certs/client.key +++ b/packages/opentelemetry-exporter-collector/test/certs/client.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKQIBAAKCAgEAybi3RqJmqi4Gxb9WKUf8xyCswQLPpFgycDEBlUbQDC+XNk8x -zjpWluCCmyfmP83+16tqCmKojAgg37VqkZcaYCDggODKuzCrfs6Pgmu+bNdYrU8Y -YWxilYhKY1HUMqQQvy2zjUoMRl6Owi0Vhy2e8hy1Fg+hgH7o2jaJ12PmCKgfKr/I -Ms3MPRzQLev21eb4R30E7imC7pGXrO49/ey20Tl41r87qpXV0PefGek9Ld8hteoq -+IP7GGBet8szjdfRAFC3qw8W66ely+FYOyC1YxDoRKFBSFvQNevo+AZeP/VWXedW -zE/iCcI4TnHXePPD+2qKNsqKfb52kQZ2L5zRB5V8NagxkD2aWK1mIux6cp0Hyxhq -gLBBke7fPN9eu4yoDrHoPIs9ro8QXPDi/k8C+x3hF7RwtMEOzDUV3H94bMGDuTUo -IVkcDdF3M2oIy/Fy6YfuFSDWfRwS0df9tVJ2md0ruJZU9sNi/3xsU06rx9nOyipm -A6QmXhMnKKX+g8OTOjBzwXz6ni9Z2Ad6+OSqTmu3IwsFvoqdSYmBg95/sW5n3uhK -L6tOsBSzn3n5Fl58NF27kwZX/Y0xuk333Zh7CDstOI/6DA25gENCYRjJB/SzEw1z -BdxlWtbD5F0jy51IWjCY53+DQ03PcJoBdfyfoEswkEHFHHTN63/zxUW0s2sCAwEA -AQKCAgEAjZvNlZl2RuuOt41teAdgLY4DmG9XwwBjUB0nBlsyvAtAtNB9n0+W783m -AfPNkGcVCuP7yhSeS8d9BG6/xDr2Oht6Xx7vUt+E1L0/Q4hNouy+BNQswl+rCVwn -FHgiZfaFByCXFo2v9kp1H1006rOdDEwY18bbUnBFGMMGmx03JEaZspH1gay1PwWW -I1at7lV5X/4k0uhzUPUGLFEHVdWyNUiKSv7ubP9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gwcQYtZ3oFo+qO4fXFB1X54+IoyZFC1saA== -----END RSA PRIVATE KEY----- diff --git a/packages/opentelemetry-exporter-collector/test/certs/regenerate.sh b/packages/opentelemetry-exporter-collector/test/certs/regenerate.sh index bb6ec4a9b5..9e2e972c99 100755 --- a/packages/opentelemetry-exporter-collector/test/certs/regenerate.sh +++ b/packages/opentelemetry-exporter-collector/test/certs/regenerate.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#!/usr/bin/env sh # # Usage: regenerate.sh # @@ -7,13 +7,16 @@ # It also serves as a documentation on how existing certificates were generated. rm ca.crt ca.key client.crt client.csr client.key server.crt server.csr server.key -openssl genrsa -passout pass:1111 -des3 -out ca.key 4096 -openssl req -passin pass:1111 -new -x509 -days 365 -key ca.key -out ca.crt -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Root/OU=Test/CN=ca" -openssl genrsa -passout pass:1111 -des3 -out server.key 4096 -openssl req -passin pass:1111 -new -key server.key -out server.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Server/CN=localhost" -openssl x509 -req -passin pass:1111 -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt -openssl rsa -passin pass:1111 -in server.key -out server.key -openssl genrsa -passout pass:1111 -des3 -out client.key 4096 -openssl req -passin pass:1111 -new -key client.key -out client.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Client/CN=localhost" -openssl x509 -passin pass:1111 -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt -openssl rsa -passin pass:1111 -in client.key -out client.key + +openssl genrsa -des3 -out ca.key 4096 +openssl req -new -x509 -days 365 -sha256 -key ca.key -out ca.crt -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Root/OU=Test/CN=ca" + +openssl genrsa -des3 -out server.key 4096 +openssl req -new -sha256 -key server.key -out server.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Server/CN=localhost" +openssl x509 -req -days 365 -sha256 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt +openssl rsa -in server.key -out server.key + +openssl genrsa -des3 -out client.key 4096 +openssl req -new -sha256 -key client.key -out client.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Client/CN=localhost" +openssl x509 -req -days 365 -sha256 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt +openssl rsa -in client.key -out client.key diff --git a/packages/opentelemetry-exporter-collector/test/certs/server.crt b/packages/opentelemetry-exporter-collector/test/certs/server.crt index 62f91722a9..55f0c3dbb9 100644 --- a/packages/opentelemetry-exporter-collector/test/certs/server.crt +++ b/packages/opentelemetry-exporter-collector/test/certs/server.crt @@ -1,31 +1,31 @@ -----BEGIN CERTIFICATE----- -MIIFPzCCAycCAQEwDQYJKoZIhvcNAQEFBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV +MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjAwNTE1MTU0NDM2WhcN -MjEwNTE1MTU0NDM2WjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjEwNjA3MjAxMDExWhcN +MjIwNjA3MjAxMDExWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZT ZXJ2ZXIxEjAQBgNVBAMMCWxvY2FsaG9zdDCCAiIwDQYJKoZIhvcNAQEBBQADggIP -ADCCAgoCggIBANQwHRfyj/d8Hh0qgDlxdtSxloRs8ZvBIwt6Acc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Szyc6jFBLORHUcxkP8DheyTl8m2sWIb+x732 +DkM2qp8oEAKwhJ/AWLFGCqsjyW5ep8fgpTHQgT7braEEUKKnGUbIqUPy1IBz+lSf +LoT7qD92eiMGXOrzcHWnV02PRM3mF5cmLMNu5aMUoIArG5dO1LTSxl5/ybx2l4Zy +qXcT7wJtrA6F0EmuXRzwFBIVZdxlLbI+S4SsvfKXernGatB3Mjotivvqi2SeOd8p +1tuqEyQaaIJ1s6u7vyTcAHDd0OIxSqpTu3SwaHAXhkzMi7+TRGgfQUuljkNKkKfj +N02siSNjIuKzE/DSW6yV0OFL/FCNPyvzs8CKTMwfyrrvA0UAspkFCWZFXFlA+uLs +0at4SmPecOsc+O8ATon9nUyXh06anBwtp03aXX6Mr/7UIRRPHF70BY7MDV4OvvQt +PD0osFo0uEHubflCnPBUdMrQN9KbELVJeV7G0Xj2fHTAVoEnCmSpow+LB1ehWGbR +M3U8q9wlpXi4Awhr19kRcSdE/JzI7eu9MqjsazfUdAtCcgg4dHixOre8oXgauhZ5 +jMOv9lUI6Glf61xt8mamicohSf9CFyH5PgZqRM0aSacdJ7jH6EitABOx21ZqwiBp +o4W37lV55oy+N0r7yxaNy/mSUUcjsQo6kGw/4cMpYTSEzRMtfwYPOS1DeTl9zArE +7TBI -----END CERTIFICATE----- diff --git a/packages/opentelemetry-exporter-collector/test/certs/server.csr b/packages/opentelemetry-exporter-collector/test/certs/server.csr index 967316e171..0c5e9291bf 100644 --- a/packages/opentelemetry-exporter-collector/test/certs/server.csr +++ b/packages/opentelemetry-exporter-collector/test/certs/server.csr @@ -2,27 +2,27 @@ MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGU2Vy dmVyMRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQDUM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MLIZbomgrup1rrizG3aU4bREy6HfHZ9Ylcr +Lo1vdL5/UZH3AHVhoccb0ua3qXDtsc8pDQAXIMzBu8BjfpbwCvrgz7YXsNsBU9zV +el8p394QB20WoPHebYDBUXPiq3JhLfjzOXBS9Ke3MBl1jDamOFmZW8dg8EpowIXv +ODFP8sErFb7Bmq7x2d0EJyX7+HydBiRWRa376oXcZ/VLl/CnNzpJeACFWPI4d0lg +P5nsadtdLyAwXF6cRQx3pOdN0sS5b3llXX3jVwGzm+kNjVTDWJiJmqWfwIF15pPr +bypoUmPpeQ4I9F+oFm9+Ff776PemqBD7NSJdG0iHRndm3oa6o2bTpn9ZypCO1Skv +UWr3ATduFylA3/YeoN6dQwP4Ol+3WJ2UbXzTbmEfoSEzmwMI5MTidOuA62A0afyN +VM0SjHaLvfD1mK4w+3BKdUivYh4TWbcLU7s1SeDwYiEP6DFZHLBPHDcNLz77d6nQ +zgvOgXqeNfk9uI5NdYBMbtdHW/mwGgEfPlDkKbY2KveOJjLlTM1EduGFsYHAXyhI +SiYozrbFeS5ts4f1EZ5tVT73KBv97MiQkKhBoVXtF1CHPUP1LTkGxtH2uoDiVfDi +r1OkRzoO05pHAh2o+4gujThsc0d3T5mmoeSySs56lgqDmC4blXNOS0kBZ4+I2u7A +C2YH -----END CERTIFICATE REQUEST----- diff --git a/packages/opentelemetry-exporter-collector/test/certs/server.key b/packages/opentelemetry-exporter-collector/test/certs/server.key index 4831771d2b..9fa740554a 100644 --- a/packages/opentelemetry-exporter-collector/test/certs/server.key +++ b/packages/opentelemetry-exporter-collector/test/certs/server.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKgIBAAKCAgEA1DAdF/KP93weHSqAOXF21LGWhGzxm8EjC3oBxx3WFSqzx0LR -z1Xldc5x+a6xvcWjw0pefogg8ITLWykUJ7gQFbihtKCQkRV0/CwyxdQ8t6T/orlL -q4QWGcYtQknnuACOH0sZ0xMOnmzMs7t1NisfN0ZliGZMDKID0kM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IUdw4y0ibaJpaMGlj++oTS +b3KDTFG6V8HbeOiHOmpYQw73feXk26w70r+GHtIYQ6pg/SKKGw+RAGeDxHoHQCs1 +VGB/AoIBAQDSzRQx5lLjYGoAv06GaXW2P8PxLoljdNEhRpxLFjQ/zRdcV2mikC0U +4HccEow4J+m1fD3BizflWHc4aV1HEa+A2yCkQIWgXjngGIXmzCaYWA4qOCvsK5d7 +VmngnII63CgEQTTAfbN9VwmnqEIy/OOqsdgF+oCWAMRIf6OJbwivsAgKBagGCUCg +xY42aMyVQ9YOrDZbkrYkXaiM4LZIEGdxKZiUDDFuMYfD98ctJfJ2oe22hxBjeIzM +/soPdy6M2HgNpCbUw/mBhoXWeA348V2SuWSpLVp2IqDHLPXwI7mTAqmPz/YqPfab +r49uSDTYI/XoMAQOlaHnj9nsNXbSEgQBAoIBAQC6RnqNrsHki+CGdddEtRdxYVtf +ZEP3rc5xIEe3zG4L0FfjYxWk/aOW5Xl4akm6ddudEgndpJxa6T6ut4geMDIfSrvL +r2t/7WZ31fpAtwnI7exV6D230dWnSWf0u0sQc23TJhTSKd4R+Mm8WLzJQHY0rm3y +jOL0bWrEm5BXOcewXeSzQkcYbrViniHUv1OQDmNdTGw+bLCyM3fY3Ud2oBJGTfTw +wDoyG6D6zdLztGxTQQ2C39DXdRelGhYwrz2MlKJK5K2EVNLJ8O91c+VjvxKKJmJ1 +fkxF7omyNBh5dBnvFC/jFuxVL+PRqnvO0SH1YH1Y9eiqNhXrds0B4U+/YBDZ -----END RSA PRIVATE KEY----- diff --git a/packages/opentelemetry-exporter-collector/test/common/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-collector/test/common/CollectorMetricExporter.test.ts index c455c0d1ad..63aea69a14 100644 --- a/packages/opentelemetry-exporter-collector/test/common/CollectorMetricExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/common/CollectorMetricExporter.test.ts @@ -41,9 +41,6 @@ class CollectorMetricExporter extends CollectorExporterBase< getDefaultUrl(config: CollectorExporterConfig) { return config.url || ''; } - getDefaultServiceName(config: CollectorExporterConfig): string { - return config.serviceName || 'collector-metric-exporter'; - } convert( metrics: MetricRecord[] ): collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest { @@ -67,7 +64,6 @@ describe('CollectorMetricExporter - common', () => { onInitSpy = sinon.stub(CollectorMetricExporter.prototype, 'onInit'); collectorExporterConfig = { hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', }; @@ -100,10 +96,6 @@ describe('CollectorMetricExporter - common', () => { 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'); }); @@ -113,13 +105,6 @@ describe('CollectorMetricExporter - common', () => { beforeEach(() => { collectorExporter = new CollectorMetricExporter(); }); - - it('should set default serviceName', () => { - assert.strictEqual( - collectorExporter.serviceName, - 'collector-metric-exporter' - ); - }); }); }); @@ -201,7 +186,6 @@ describe('CollectorMetricExporter - common', () => { ); collectorExporterConfig = { hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', }; diff --git a/packages/opentelemetry-exporter-collector/test/common/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-collector/test/common/CollectorTraceExporter.test.ts index d104fd26c1..4d025ad191 100644 --- a/packages/opentelemetry-exporter-collector/test/common/CollectorTraceExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/common/CollectorTraceExporter.test.ts @@ -46,9 +46,6 @@ class CollectorTraceExporter extends CollectorExporterBase< getDefaultUrl(config: CollectorExporterConfig): string { return config.url || ''; } - getDefaultServiceName(config: CollectorExporterConfig): string { - return config.serviceName || 'collector-exporter'; - } convert( spans: ReadableSpan[] @@ -72,7 +69,6 @@ describe('CollectorTraceExporter - common', () => { onInitSpy = sinon.stub(CollectorTraceExporter.prototype, 'onInit'); collectorExporterConfig = { hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', }; @@ -92,24 +88,10 @@ describe('CollectorTraceExporter - common', () => { 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'); }); }); - - describe('when config is missing certain params', () => { - beforeEach(() => { - collectorExporter = new CollectorTraceExporter(); - }); - - it('should set default serviceName', () => { - assert.strictEqual(collectorExporter.serviceName, 'collector-exporter'); - }); - }); }); describe('export', () => { @@ -221,7 +203,6 @@ describe('CollectorTraceExporter - common', () => { ); collectorExporterConfig = { hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', }; diff --git a/packages/opentelemetry-exporter-collector/test/common/transform.test.ts b/packages/opentelemetry-exporter-collector/test/common/transform.test.ts index f212a7774a..b67eae84ea 100644 --- a/packages/opentelemetry-exporter-collector/test/common/transform.test.ts +++ b/packages/opentelemetry-exporter-collector/test/common/transform.test.ts @@ -14,7 +14,8 @@ * limitations under the License. */ -import { SpanAttributes, TimedEvent } from '@opentelemetry/api'; +import { SpanAttributes } from '@opentelemetry/api'; +import { TimedEvent } from '@opentelemetry/tracing'; import * as assert from 'assert'; import * as transform from '../../src/transform'; import { diff --git a/packages/opentelemetry-exporter-collector/test/helper.ts b/packages/opentelemetry-exporter-collector/test/helper.ts index f4d28a035a..66a4a9ed5d 100644 --- a/packages/opentelemetry-exporter-collector/test/helper.ts +++ b/packages/opentelemetry-exporter-collector/test/helper.ts @@ -24,7 +24,7 @@ import { ValueRecorder, ValueType, } from '@opentelemetry/api-metrics'; -import { hexToBase64, InstrumentationLibrary } from '@opentelemetry/core'; +import { hexToBase64, InstrumentationLibrary, VERSION } from '@opentelemetry/core'; import * as metrics from '@opentelemetry/metrics'; import { Resource } from '@opentelemetry/resources'; import { ReadableSpan } from '@opentelemetry/tracing'; @@ -157,10 +157,12 @@ const parentIdHex = '78a8915098864388'; export const mockedReadableSpan: ReadableSpan = { name: 'documentFetch', kind: 0, - spanContext: { - traceId: '1f1008dc8e270e85c40a0d7c3939b278', - spanId: '5e107261f64fa53e', - traceFlags: TraceFlags.SAMPLED, + spanContext: ()=> { + return { + traceId: '1f1008dc8e270e85c40a0d7c3939b278', + spanId: '5e107261f64fa53e', + traceFlags: TraceFlags.SAMPLED, + } }, parentSpanId: '78a8915098864388', startTime: [1574120165, 429803070], @@ -173,6 +175,7 @@ export const mockedReadableSpan: ReadableSpan = { context: { traceId: '1f1008dc8e270e85c40a0d7c3939b278', spanId: '78a8915098864388', + traceFlags: TraceFlags.SAMPLED, }, attributes: { component: 'document-load' }, }, @@ -200,11 +203,12 @@ export const mockedReadableSpan: ReadableSpan = { }, ], duration: [0, 8885000], - resource: new Resource({ - service: 'ui', - version: 1, - cost: 112.12, - }), + resource: Resource.default() + .merge(new Resource({ + service: 'ui', + version: 1, + cost: 112.12, + })), instrumentationLibrary: { name: 'default', version: '0.0.1' }, }; @@ -228,10 +232,12 @@ export const basicTrace: ReadableSpan[] = [ { name: 'span1', kind: 0, - spanContext: { - traceId: '1f1008dc8e270e85c40a0d7c3939b278', - spanId: '5e107261f64fa53e', - traceFlags: TraceFlags.SAMPLED, + spanContext: () => { + return { + traceId: '1f1008dc8e270e85c40a0d7c3939b278', + spanId: '5e107261f64fa53e', + traceFlags: TraceFlags.SAMPLED, + }; }, parentSpanId: '78a8915098864388', startTime: [1574120165, 429803070], @@ -248,10 +254,12 @@ export const basicTrace: ReadableSpan[] = [ { name: 'span2', kind: 0, - spanContext: { - traceId: '1f1008dc8e270e85c40a0d7c3939b278', - spanId: 'f64fa53e5e107261', - traceFlags: TraceFlags.SAMPLED, + spanContext: () => { + return { + traceId: '1f1008dc8e270e85c40a0d7c3939b278', + spanId: 'f64fa53e5e107261', + traceFlags: TraceFlags.SAMPLED, + }; }, parentSpanId: '78a8915098864388', startTime: [1575120165, 439803070], @@ -268,10 +276,12 @@ export const basicTrace: ReadableSpan[] = [ { name: 'span3', kind: 0, - spanContext: { - traceId: '1f1008dc8e270e85c40a0d7c3939b278', - spanId: '07261f64fa53e5e1', - traceFlags: TraceFlags.SAMPLED, + spanContext: () => { + return { + traceId: '1f1008dc8e270e85c40a0d7c3939b278', + spanId: '07261f64fa53e5e1', + traceFlags: TraceFlags.SAMPLED, + }; }, parentSpanId: 'a891578098864388', startTime: [1575120165, 439803070], @@ -523,35 +533,22 @@ export function ensureSpanIsCorrect( export function ensureWebResourceIsCorrect( resource: collectorTypes.opentelemetryProto.resource.v1.Resource ) { - assert.deepStrictEqual(resource, { - attributes: [ - { - key: 'service.name', - value: { - stringValue: 'bar', - }, - }, - { - key: 'service', - value: { - stringValue: 'ui', - }, - }, - { - key: 'version', - value: { - intValue: 1, - }, - }, - { - key: 'cost', - value: { - doubleValue: 112.12, - }, - }, - ], - droppedAttributesCount: 0, - }); + assert.strictEqual(resource.attributes.length, 7); + assert.strictEqual(resource.attributes[0].key, 'service.name'); + assert.strictEqual(resource.attributes[0].value.stringValue, 'unknown_service'); + assert.strictEqual(resource.attributes[1].key, 'telemetry.sdk.language'); + assert.strictEqual(resource.attributes[1].value.stringValue, 'webjs'); + assert.strictEqual(resource.attributes[2].key, 'telemetry.sdk.name'); + assert.strictEqual(resource.attributes[2].value.stringValue, 'opentelemetry'); + assert.strictEqual(resource.attributes[3].key, 'telemetry.sdk.version'); + assert.strictEqual(resource.attributes[3].value.stringValue, VERSION); + assert.strictEqual(resource.attributes[4].key, 'service'); + assert.strictEqual(resource.attributes[4].value.stringValue, 'ui'); + assert.strictEqual(resource.attributes[5].key, 'version'); + assert.strictEqual(resource.attributes[5].value.intValue, 1); + assert.strictEqual(resource.attributes[6].key, 'cost'); + assert.strictEqual(resource.attributes[6].value.doubleValue, 112.12); + assert.strictEqual(resource.droppedAttributesCount, 0); } export function ensureCounterIsCorrect( diff --git a/packages/opentelemetry-exporter-collector/test/node/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-collector/test/node/CollectorMetricExporter.test.ts index dc3c0a98ff..750b196a2c 100644 --- a/packages/opentelemetry-exporter-collector/test/node/CollectorMetricExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/node/CollectorMetricExporter.test.ts @@ -129,7 +129,6 @@ describe('CollectorMetricExporter - node with json over http', () => { foo: 'bar', }, hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', keepAlive: true, diff --git a/packages/opentelemetry-exporter-collector/test/node/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-collector/test/node/CollectorTraceExporter.test.ts index ec9fac3653..d64ef15db1 100644 --- a/packages/opentelemetry-exporter-collector/test/node/CollectorTraceExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/node/CollectorTraceExporter.test.ts @@ -115,7 +115,6 @@ describe('CollectorTraceExporter - node with json over http', () => { foo: 'bar', }, hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', keepAlive: true, diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json index 139dbe447d..908121de45 100644 --- a/packages/opentelemetry-exporter-jaeger/package.json +++ b/packages/opentelemetry-exporter-jaeger/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-jaeger", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry Exporter Jaeger allows user to send collected traces to Jaeger", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -40,13 +40,12 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/resources": "0.19.0", + "@opentelemetry/api": "^1.0.0", + "@opentelemetry/resources": "0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "mocha": "7.2.0", "nock": "12.0.3", "nyc": "15.1.0", @@ -54,14 +53,15 @@ "sinon": "10.0.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/core": "0.21.0", + "@opentelemetry/semantic-conventions": "0.21.0", + "@opentelemetry/tracing": "0.21.0", "jaeger-client": "^3.15.0" } } diff --git a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts index 7de46984e9..335767366d 100644 --- a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts +++ b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts @@ -18,6 +18,7 @@ import { diag } from '@opentelemetry/api'; import { ExportResult, ExportResultCode, getEnv } from '@opentelemetry/core'; import { ReadableSpan, SpanExporter } from '@opentelemetry/tracing'; import { Socket } from 'dgram'; +import { ResourceAttributes } from '@opentelemetry/semantic-conventions'; import { spanToThrift } from './transform'; import * as jaegerTypes from './types'; @@ -25,16 +26,16 @@ import * as jaegerTypes from './types'; * Format and sends span information to Jaeger Exporter. */ export class JaegerExporter implements SpanExporter { - private readonly _process: jaegerTypes.ThriftProcess; - private readonly _sender: typeof jaegerTypes.UDPSender; private readonly _onShutdownFlushTimeout: number; + private readonly _localConfig: jaegerTypes.ExporterConfig; private _isShutdown = false; private _shutdownFlushTimeout: NodeJS.Timeout | undefined; private _shuttingDownPromise: Promise = Promise.resolve(); - constructor(config: jaegerTypes.ExporterConfig) { + private _sender?: typeof jaegerTypes.UDPSender; + + constructor(config?: jaegerTypes.ExporterConfig) { const localConfig = Object.assign({}, config); - const tags: jaegerTypes.Tag[] = localConfig.tags || []; this._onShutdownFlushTimeout = typeof localConfig.flushTimeout === 'number' ? localConfig.flushTimeout @@ -54,24 +55,8 @@ export class JaegerExporter implements SpanExporter { localConfig.password = localConfig.password || env.OTEL_EXPORTER_JAEGER_PASSWORD; localConfig.host = localConfig.host || env.OTEL_EXPORTER_JAEGER_AGENT_HOST; - if (localConfig.endpoint) { - this._sender = new jaegerTypes.HTTPSender(localConfig); - } else { - this._sender = localConfig.endpoint = new jaegerTypes.UDPSender( - localConfig - ); - } - - if (this._sender._client instanceof Socket) { - // unref socket to prevent it from keeping the process running - this._sender._client.unref(); - } - this._process = { - serviceName: localConfig.serviceName, - tags: jaegerTypes.ThriftUtils.getThriftTags(tags), - }; - this._sender.setProcess(this._process); + this._localConfig = localConfig; } /** Exports a list of spans to Jaeger. */ @@ -144,12 +129,12 @@ export class JaegerExporter implements SpanExporter { // Flush all spans on each export. No-op if span buffer is empty await this._flush(); - if (done) return done({ code: ExportResultCode.SUCCESS }); + if (done) return process.nextTick(done, { code: ExportResultCode.SUCCESS }); } private async _append(span: jaegerTypes.ThriftSpan): Promise { return new Promise((resolve, reject) => { - this._sender.append(span, (count: number, err?: string) => { + this._getSender(span).append(span, (count: number, err?: string) => { if (err) { return reject(new Error(err)); } @@ -158,8 +143,36 @@ export class JaegerExporter implements SpanExporter { }); } + private _getSender(span: jaegerTypes.ThriftSpan): typeof jaegerTypes.UDPSender { + if (this._sender) { + return this._sender; + } + + const sender = this._localConfig.endpoint ? new jaegerTypes.HTTPSender(this._localConfig) : new jaegerTypes.UDPSender(this._localConfig); + + if (sender._client instanceof Socket) { + // unref socket to prevent it from keeping the process running + sender._client.unref(); + } + + const serviceNameTag = span.tags.find(t => t.key === ResourceAttributes.SERVICE_NAME) + const serviceName = serviceNameTag?.vStr || "unknown_service"; + + sender.setProcess({ + serviceName, + tags: jaegerTypes.ThriftUtils.getThriftTags(this._localConfig.tags || []), + }); + + this._sender = sender; + return sender; + } + private async _flush(): Promise { await new Promise((resolve, reject) => { + if (!this._sender) { + return resolve(); + } + this._sender.flush((_count: number, err?: string) => { if (err) { return reject(new Error(err)); diff --git a/packages/opentelemetry-exporter-jaeger/src/transform.ts b/packages/opentelemetry-exporter-jaeger/src/transform.ts index bb3ea5e5f1..0d7a83062e 100644 --- a/packages/opentelemetry-exporter-jaeger/src/transform.ts +++ b/packages/opentelemetry-exporter-jaeger/src/transform.ts @@ -40,7 +40,7 @@ const DEFAULT_FLAGS = 0x1; * @param span Span to be translated */ export function spanToThrift(span: ReadableSpan): ThriftSpan { - const traceId = span.spanContext.traceId.padStart(32, '0'); + const traceId = span.spanContext().traceId.padStart(32, '0'); const traceIdHigh = traceId.slice(0, 16); const traceIdLow = traceId.slice(16); const parentSpan = span.parentSpanId @@ -105,11 +105,11 @@ export function spanToThrift(span: ReadableSpan): ThriftSpan { return { traceIdLow: Utils.encodeInt64(traceIdLow), traceIdHigh: Utils.encodeInt64(traceIdHigh), - spanId: Utils.encodeInt64(span.spanContext.spanId), + spanId: Utils.encodeInt64(span.spanContext().spanId), parentSpanId: parentSpan, operationName: span.name, references: spanLinksToThriftRefs(span.links, span.parentSpanId), - flags: span.spanContext.traceFlags || DEFAULT_FLAGS, + flags: span.spanContext().traceFlags || DEFAULT_FLAGS, startTime: Utils.encodeInt64(hrTimeToMicroseconds(span.startTime)), duration: Utils.encodeInt64(hrTimeToMicroseconds(span.duration)), tags: spanTags, diff --git a/packages/opentelemetry-exporter-jaeger/src/types.ts b/packages/opentelemetry-exporter-jaeger/src/types.ts index 67a9dc4363..4a6ec67f12 100644 --- a/packages/opentelemetry-exporter-jaeger/src/types.ts +++ b/packages/opentelemetry-exporter-jaeger/src/types.ts @@ -18,7 +18,6 @@ * Options for Jaeger configuration */ export interface ExporterConfig { - serviceName: string; tags?: Tag[]; host?: string; // default: 'localhost' port?: number; // default: 6832 @@ -37,6 +36,7 @@ export interface ExporterConfig { // Below require is needed as jaeger-client types does not expose the thrift, // udp_sender, util etc. modules. +/* eslint-disable @typescript-eslint/no-var-requires */ export const UDPSender = require('jaeger-client/dist/src/reporters/udp_sender') .default; export const Utils = require('jaeger-client/dist/src/util').default; @@ -44,6 +44,7 @@ export const ThriftUtils = require('jaeger-client/dist/src/thrift').default; export const HTTPSender = require('jaeger-client/dist/src/reporters/http_sender') .default; +/* eslint-enable @typescript-eslint/no-var-requires */ export type TagValue = string | number | boolean; diff --git a/packages/opentelemetry-exporter-jaeger/src/version.ts b/packages/opentelemetry-exporter-jaeger/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-exporter-jaeger/src/version.ts +++ b/packages/opentelemetry-exporter-jaeger/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts index a58a41b628..0766e5a72a 100644 --- a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts +++ b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts @@ -23,25 +23,67 @@ import { ReadableSpan } from '@opentelemetry/tracing'; import { TraceFlags } from '@opentelemetry/api'; import { Resource } from '@opentelemetry/resources'; import * as nock from 'nock'; +import { ResourceAttributes } from '@opentelemetry/semantic-conventions'; describe('JaegerExporter', () => { + const readableSpan: ReadableSpan = { + name: 'my-span1', + kind: api.SpanKind.CLIENT, + spanContext: () => { + return { + traceId: 'd4cda95b652f4a1592b449d5929fda1b', + spanId: '6e0c63257de34c92', + traceFlags: TraceFlags.NONE, + }; + }, + startTime: [1566156729, 709], + endTime: [1566156731, 709], + ended: true, + status: { + code: api.SpanStatusCode.ERROR, + }, + attributes: {}, + links: [], + events: [], + duration: [32, 800000000], + resource: new Resource({ + [ResourceAttributes.SERVICE_NAME]: 'opentelemetry' + }), + instrumentationLibrary: { + name: 'default', + version: '0.0.1', + }, + }; describe('constructor', () => { afterEach(() => { delete process.env.OTEL_EXPORTER_JAEGER_AGENT_HOST; }); it('should construct an exporter', () => { - const exporter = new JaegerExporter({ serviceName: 'opentelemetry' }); + const exporter = new JaegerExporter(); 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 get service name from the the service name resource attribute of the first exported span', done => { + const mockedEndpoint = 'http://testendpoint'; + const scope =nock(mockedEndpoint) + .post('/') + .reply(202) + + const exporter = new JaegerExporter({ + endpoint: mockedEndpoint, + }); + exporter.export([readableSpan], result => { + assert.strictEqual(result.code, ExportResultCode.SUCCESS); + assert.strictEqual(exporter['_sender']._batch.process.serviceName, 'opentelemetry'); + scope.done(); + done(); + }); }); it('should construct an exporter with host, port, logger and tags', () => { const exporter = new JaegerExporter({ - serviceName: 'opentelemetry', host: 'remotehost', port: 8080, tags: [{ key: 'opentelemetry-exporter-jaeger', value: '0.1.0' }], @@ -49,7 +91,12 @@ describe('JaegerExporter', () => { assert.ok(typeof exporter.export === 'function'); assert.ok(typeof exporter.shutdown === 'function'); - const process: ThriftProcess = exporter['_sender']._process; + const process: ThriftProcess = exporter['_getSender']({ + tags: [{ + key: "service.name", + vStr: "opentelemetry" + }] + } as any)._process; assert.strictEqual(exporter['_sender']._host, 'remotehost'); assert.strictEqual(process.serviceName, 'opentelemetry'); assert.strictEqual(process.tags.length, 1); @@ -59,32 +106,44 @@ describe('JaegerExporter', () => { }); it('should default to localhost if no host is configured', () => { - const exporter = new JaegerExporter({ - serviceName: 'opentelemetry', - }); - assert.strictEqual(exporter['_sender']._host, 'localhost'); + const exporter = new JaegerExporter(); + const sender = exporter['_getSender']({ + tags: [{ + key: "service.name", + vStr: "opentelemetry" + }] + } as any); + assert.strictEqual(sender._host, 'localhost'); }); it('should respect jaeger host env variable', () => { process.env.OTEL_EXPORTER_JAEGER_AGENT_HOST = 'env-set-host'; - const exporter = new JaegerExporter({ - serviceName: 'test-service', - }); - assert.strictEqual(exporter['_sender']._host, 'env-set-host'); + const exporter = new JaegerExporter(); + const sender = exporter['_getSender']({ + tags: [{ + key: "service.name", + vStr: "opentelemetry" + }] + } as any); + assert.strictEqual(sender._host, 'env-set-host'); }); it('should prioritize host option over env variable', () => { process.env.OTEL_EXPORTER_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'); + const sender = exporter['_getSender']({ + tags: [{ + key: "service.name", + vStr: "opentelemetry" + }] + } as any); + assert.strictEqual(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'); @@ -94,9 +153,7 @@ describe('JaegerExporter', () => { }); it('should construct an exporter without flushTimeout', () => { - const exporter = new JaegerExporter({ - serviceName: 'opentelemetry', - }); + const exporter = new JaegerExporter(); assert.ok(typeof exporter.export === 'function'); assert.ok(typeof exporter.shutdown === 'function'); @@ -105,37 +162,10 @@ describe('JaegerExporter', () => { }); describe('export', () => { - const readableSpan: ReadableSpan = { - name: 'my-span1', - kind: api.SpanKind.CLIENT, - spanContext: { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, - }, - startTime: [1566156729, 709], - endTime: [1566156731, 709], - ended: true, - status: { - code: api.SpanStatusCode.ERROR, - }, - attributes: {}, - links: [], - events: [], - duration: [32, 800000000], - resource: Resource.empty(), - instrumentationLibrary: { - name: 'default', - version: '0.0.1', - }, - }; - let exporter: JaegerExporter; beforeEach(() => { - exporter = new JaegerExporter({ - serviceName: 'opentelemetry', - }); + exporter = new JaegerExporter(); }); afterEach(() => { @@ -154,7 +184,7 @@ describe('JaegerExporter', () => { }); }); - it('should use httpSender if config.endpoint is setten', done => { + it('should use httpSender if config.endpoint is set', done => { const mockedEndpoint = 'http://testendpoint'; nock(mockedEndpoint) .post('/') @@ -164,14 +194,14 @@ describe('JaegerExporter', () => { 'application/x-thrift' ); assert.strictEqual(this.req.headers.host, 'testendpoint'); - done(); }); const exporter = new JaegerExporter({ - serviceName: 'opentelemetry', endpoint: mockedEndpoint, }); - assert.strictEqual(exporter['_sender'].constructor.name, 'HTTPSender'); - exporter.export([readableSpan], () => {}); + exporter.export([readableSpan], () => { + assert.strictEqual(exporter['_sender'].constructor.name, 'HTTPSender'); + done(); + }); }); it('should return failed export result on error', () => { @@ -182,7 +212,6 @@ describe('JaegerExporter', () => { .post('/') .replyWithError(expectedError); const exporter = new JaegerExporter({ - serviceName: 'opentelemetry', endpoint: mockedEndpoint, }); diff --git a/packages/opentelemetry-exporter-jaeger/test/transform.test.ts b/packages/opentelemetry-exporter-jaeger/test/transform.test.ts index da4fc5473d..209b37c9b3 100644 --- a/packages/opentelemetry-exporter-jaeger/test/transform.test.ts +++ b/packages/opentelemetry-exporter-jaeger/test/transform.test.ts @@ -24,10 +24,12 @@ import { hrTimeToMicroseconds } from '@opentelemetry/core'; import { SpanStatusCode, TraceFlags } from '@opentelemetry/api'; describe('transform', () => { - const spanContext = { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, + const spanContext = () => { + return { + traceId: 'd4cda95b652f4a1592b449d5929fda1b', + spanId: '6e0c63257de34c92', + traceFlags: TraceFlags.NONE, + }; }; describe('spanToThrift', () => { @@ -52,6 +54,7 @@ describe('transform', () => { context: { traceId: 'a4cda95b652f4a1592b449d5929fda1b', spanId: '3e0c63257de34c92', + traceFlags: TraceFlags.SAMPLED, }, attributes: { testBool: true, @@ -217,6 +220,7 @@ describe('transform', () => { context: { traceId: 'a4cda95b652f4a1592b449d5929fda1b', spanId: '3e0c63257de34c92', + traceFlags: TraceFlags.SAMPLED, }, }, ], @@ -249,10 +253,12 @@ describe('transform', () => { const readableSpan: ReadableSpan = { name: 'my-span1', kind: api.SpanKind.CLIENT, - spanContext: { - traceId: '92b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, + spanContext: () => { + return { + traceId: '92b449d5929fda1b', + spanId: '6e0c63257de34c92', + traceFlags: TraceFlags.NONE, + }; }, startTime: [1566156729, 709], endTime: [1566156731, 709], @@ -304,6 +310,7 @@ describe('transform', () => { context: { traceId: 'a4cda95b652f4a1592b449d5929fda1b', spanId: '3e0c63257de34c92', + traceFlags: TraceFlags.SAMPLED, }, attributes: { testBool: true, diff --git a/packages/opentelemetry-exporter-jaeger/tsconfig.json b/packages/opentelemetry-exporter-jaeger/tsconfig.json index 77140114c8..a5d1c2f05c 100644 --- a/packages/opentelemetry-exporter-jaeger/tsconfig.json +++ b/packages/opentelemetry-exporter-jaeger/tsconfig.json @@ -15,6 +15,9 @@ { "path": "../opentelemetry-resources" }, + { + "path": "../opentelemetry-semantic-conventions" + }, { "path": "../opentelemetry-tracing" } diff --git a/packages/opentelemetry-exporter-prometheus/package.json b/packages/opentelemetry-exporter-prometheus/package.json index 27e7d6a2d1..9d2908b000 100644 --- a/packages/opentelemetry-exporter-prometheus/package.json +++ b/packages/opentelemetry-exporter-prometheus/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-prometheus", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry Exporter Prometheus provides a metrics endpoint for Prometheus", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -39,26 +39,25 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", "sinon": "10.0.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/api-metrics": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/metrics": "0.19.0" + "@opentelemetry/api-metrics": "0.21.0", + "@opentelemetry/core": "0.21.0", + "@opentelemetry/metrics": "0.21.0" } } diff --git a/packages/opentelemetry-exporter-prometheus/src/version.ts b/packages/opentelemetry-exporter-prometheus/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-exporter-prometheus/src/version.ts +++ b/packages/opentelemetry-exporter-prometheus/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts b/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts index 07d240ff42..289631da39 100644 --- a/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts +++ b/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts @@ -403,6 +403,7 @@ describe('PrometheusSerializer', () => { error: () => {}, }; diag.setLogger(dummyLogger, DiagLogLevel.ALL); + calledArgs = []; const serializer = new PrometheusSerializer(); const meter = new MeterProvider({ @@ -416,7 +417,7 @@ describe('PrometheusSerializer', () => { const result = serializer.serializeRecord(record.descriptor.name, record); assert.strictEqual(result, `test_total 1 ${mockedHrTimeMs}\n`); - assert.ok(calledArgs.length === 0); + assert.deepStrictEqual(calledArgs, []); }); }); diff --git a/packages/opentelemetry-exporter-zipkin/package.json b/packages/opentelemetry-exporter-zipkin/package.json index 748b18216d..3125dc00aa 100644 --- a/packages/opentelemetry-exporter-zipkin/package.json +++ b/packages/opentelemetry-exporter-zipkin/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-zipkin", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry Zipkin Exporter allows the user to send collected traces to Zipkin.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -52,21 +52,20 @@ }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^1.0.0-rc.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", "@types/webpack-env": "1.16.0", "babel-loader": "8.2.2", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", "karma-spec-reporter": "0.0.32", - "karma-webpack": "5.0.0", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nock": "12.0.3", "nyc": "15.1.0", @@ -75,18 +74,18 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0", "webpack-cli": "4.6.0", "webpack-merge": "5.7.3" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/tracing": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0" + "@opentelemetry/core": "0.21.0", + "@opentelemetry/resources": "0.21.0", + "@opentelemetry/semantic-conventions": "0.21.0", + "@opentelemetry/tracing": "0.21.0" } } diff --git a/packages/opentelemetry-exporter-zipkin/src/transform.ts b/packages/opentelemetry-exporter-zipkin/src/transform.ts index 4f8e3145c6..3e34301f85 100644 --- a/packages/opentelemetry-exporter-zipkin/src/transform.ts +++ b/packages/opentelemetry-exporter-zipkin/src/transform.ts @@ -43,10 +43,10 @@ export function toZipkinSpan( statusDescriptionTagName: string ): zipkinTypes.Span { const zipkinSpan: zipkinTypes.Span = { - traceId: span.spanContext.traceId, + traceId: span.spanContext().traceId, parentId: span.parentSpanId, name: span.name, - id: span.spanContext.spanId, + id: span.spanContext().spanId, kind: ZIPKIN_SPAN_KIND_MAPPING[span.kind], timestamp: hrTimeToMicroseconds(span.startTime), duration: hrTimeToMicroseconds(span.duration), diff --git a/packages/opentelemetry-exporter-zipkin/src/version.ts b/packages/opentelemetry-exporter-zipkin/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-exporter-zipkin/src/version.ts +++ b/packages/opentelemetry-exporter-zipkin/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-exporter-zipkin/src/zipkin.ts b/packages/opentelemetry-exporter-zipkin/src/zipkin.ts index 71521bd570..e3cc04c01d 100644 --- a/packages/opentelemetry-exporter-zipkin/src/zipkin.ts +++ b/packages/opentelemetry-exporter-zipkin/src/zipkin.ts @@ -64,12 +64,12 @@ export class ZipkinExporter implements SpanExporter { spans: ReadableSpan[], resultCallback: (result: ExportResult) => void ) { - if (typeof this._serviceName !== 'string') { - this._serviceName = String( + const serviceName = String( + this._serviceName || spans[0].resource.attributes[ResourceAttributes.SERVICE_NAME] || - this.DEFAULT_SERVICE_NAME - ); - } + this.DEFAULT_SERVICE_NAME + ); + diag.debug('Zipkin exporter export'); if (this._isShutdown) { setTimeout(() => @@ -81,7 +81,7 @@ export class ZipkinExporter implements SpanExporter { return; } const promise = new Promise(resolve => { - this._sendSpans(spans, this._serviceName!, result => { + this._sendSpans(spans, serviceName, result => { resolve(); resultCallback(result); }); diff --git a/packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts b/packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts index 4e47d0c095..46f3be7ca1 100644 --- a/packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts +++ b/packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts @@ -21,9 +21,9 @@ import { VERSION, } from '@opentelemetry/core'; import { Resource } from '@opentelemetry/resources'; -import { ResourceAttributes } from '@opentelemetry/semantic-conventions'; import { BasicTracerProvider, Span } from '@opentelemetry/tracing'; import * as assert from 'assert'; +import { ResourceAttributes } from '@opentelemetry/semantic-conventions'; import { statusCodeTagName, statusDescriptionTagName, @@ -32,7 +32,13 @@ import { _toZipkinTags, } from '../../src/transform'; import * as zipkinTypes from '../../src/types'; -const tracer = new BasicTracerProvider().getTracer('default'); +const tracer = new BasicTracerProvider({ + resource: Resource.default().merge( + new Resource({ + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', + }) + ), +}).getTracer('default'); const language = tracer.resource.attributes[ResourceAttributes.TELEMETRY_SDK_LANGUAGE]; @@ -48,6 +54,7 @@ const DUMMY_RESOURCE = new Resource({ service: 'ui', version: 1, cost: 112.12, + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', }); describe('transform', () => { @@ -85,7 +92,7 @@ describe('transform', () => { duration: hrTimeToMicroseconds( hrTimeDuration(span.startTime, span.endTime) ), - id: span.spanContext.spanId, + id: span.spanContext().spanId, localEndpoint: { serviceName: 'my-service', }, @@ -95,12 +102,13 @@ describe('transform', () => { key1: 'value1', key2: 'value2', [statusCodeTagName]: 'UNSET', + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', 'telemetry.sdk.language': language, 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': VERSION, }, timestamp: hrTimeToMicroseconds(span.startTime), - traceId: span.spanContext.traceId, + traceId: span.spanContext().traceId, }); }); it("should skip parentSpanId if doesn't exist", () => { @@ -125,7 +133,7 @@ describe('transform', () => { duration: hrTimeToMicroseconds( hrTimeDuration(span.startTime, span.endTime) ), - id: span.spanContext.spanId, + id: span.spanContext().spanId, localEndpoint: { serviceName: 'my-service', }, @@ -133,12 +141,13 @@ describe('transform', () => { parentId: undefined, tags: { [statusCodeTagName]: 'UNSET', + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', 'telemetry.sdk.language': language, 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': VERSION, }, timestamp: hrTimeToMicroseconds(span.startTime), - traceId: span.spanContext.traceId, + traceId: span.spanContext().traceId, }); }); // SpanKind mapping tests @@ -173,7 +182,7 @@ describe('transform', () => { duration: hrTimeToMicroseconds( hrTimeDuration(span.startTime, span.endTime) ), - id: span.spanContext.spanId, + id: span.spanContext().spanId, localEndpoint: { serviceName: 'my-service', }, @@ -181,12 +190,13 @@ describe('transform', () => { parentId: undefined, tags: { [statusCodeTagName]: 'UNSET', + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', 'telemetry.sdk.language': language, 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': VERSION, }, timestamp: hrTimeToMicroseconds(span.startTime), - traceId: span.spanContext.traceId, + traceId: span.spanContext().traceId, }); }) ); @@ -221,6 +231,7 @@ describe('transform', () => { cost: '112.12', service: 'ui', version: '1', + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', }); }); it('should map OpenTelemetry SpanStatus.code to a Zipkin tag', () => { @@ -245,13 +256,18 @@ describe('transform', () => { span.status, statusCodeTagName, statusDescriptionTagName, - Resource.empty() + Resource.empty().merge( + new Resource({ + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', + }) + ) ); assert.deepStrictEqual(tags, { key1: 'value1', key2: 'value2', [statusCodeTagName]: 'ERROR', + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', }); }); it('should map OpenTelemetry SpanStatus.message to a Zipkin tag', () => { @@ -277,7 +293,11 @@ describe('transform', () => { span.status, statusCodeTagName, statusDescriptionTagName, - Resource.empty() + Resource.empty().merge( + new Resource({ + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', + }) + ) ); assert.deepStrictEqual(tags, { @@ -285,6 +305,7 @@ describe('transform', () => { key2: 'value2', [statusCodeTagName]: 'ERROR', [statusDescriptionTagName]: status.message, + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', }); }); }); diff --git a/packages/opentelemetry-exporter-zipkin/test/helper.ts b/packages/opentelemetry-exporter-zipkin/test/helper.ts index 837ca39118..2ab7c4a3c3 100644 --- a/packages/opentelemetry-exporter-zipkin/test/helper.ts +++ b/packages/opentelemetry-exporter-zipkin/test/helper.ts @@ -23,10 +23,12 @@ import { Span } from '../src/types'; export const mockedReadableSpan: ReadableSpan = { name: 'documentFetch', kind: 0, - spanContext: { - traceId: '1f1008dc8e270e85c40a0d7c3939b278', - spanId: '5e107261f64fa53e', - traceFlags: TraceFlags.SAMPLED, + spanContext: () => { + return { + traceId: '1f1008dc8e270e85c40a0d7c3939b278', + spanId: '5e107261f64fa53e', + traceFlags: TraceFlags.SAMPLED, + }; }, parentSpanId: '78a8915098864388', startTime: [1574120165, 429803070], @@ -53,7 +55,7 @@ export function ensureHeadersContain( assert.strictEqual( v, actual[k], - `Expected ${actual} to contain ${k}: ${v}` + `Expected ${ actual } to contain ${ k }: ${ v }` ); }); } diff --git a/packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts b/packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts index 0dbe5908aa..31192fbd31 100644 --- a/packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts +++ b/packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts @@ -37,10 +37,12 @@ function getReadableSpan() { const readableSpan: ReadableSpan = { name: 'my-span', kind: api.SpanKind.INTERNAL, - spanContext: { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, + spanContext: () => { + return { + traceId: 'd4cda95b652f4a1592b449d5929fda1b', + spanId: '6e0c63257de34c92', + traceFlags: TraceFlags.NONE, + }; }, startTime: [startTime, 0], endTime: [startTime + duration, 0], @@ -134,10 +136,12 @@ describe('Zipkin Exporter - node', () => { name: 'my-span', kind: api.SpanKind.INTERNAL, parentSpanId, - spanContext: { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, + spanContext: () => { + return { + traceId: 'd4cda95b652f4a1592b449d5929fda1b', + spanId: '6e0c63257de34c92', + traceFlags: TraceFlags.NONE, + }; }, startTime: [startTime, 0], endTime: [startTime + duration, 0], @@ -164,10 +168,12 @@ describe('Zipkin Exporter - node', () => { const span2: ReadableSpan = { name: 'my-span', kind: api.SpanKind.SERVER, - spanContext: { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, + spanContext: () => { + return { + traceId: 'd4cda95b652f4a1592b449d5929fda1b', + spanId: '6e0c63257de34c92', + traceFlags: TraceFlags.NONE, + }; }, startTime: [startTime, 0], endTime: [startTime + duration, 0], @@ -200,7 +206,7 @@ describe('Zipkin Exporter - node', () => { }, ], duration: duration * MICROS_PER_SECS, - id: span1.spanContext.spanId, + id: span1.spanContext().spanId, localEndpoint: { serviceName: 'my-service', }, @@ -212,12 +218,12 @@ describe('Zipkin Exporter - node', () => { 'ot.status_code': 'OK', }, timestamp: startTime * MICROS_PER_SECS, - traceId: span1.spanContext.traceId, + traceId: span1.spanContext().traceId, }, // Span 2 { duration: duration * MICROS_PER_SECS, - id: span2.spanContext.spanId, + id: span2.spanContext().spanId, kind: 'SERVER', localEndpoint: { serviceName: 'my-service', @@ -227,7 +233,7 @@ describe('Zipkin Exporter - node', () => { 'ot.status_code': 'OK', }, timestamp: hrTimeToMicroseconds([startTime, 0]), - traceId: span2.spanContext.traceId, + traceId: span2.spanContext().traceId, }, ]); }); @@ -307,372 +313,220 @@ describe('Zipkin Exporter - node', () => { }); }); - it('should set serviceName to "Opentelemetry Service" by default', () => { - const scope = nock('http://localhost:9411') - .post('/api/v2/spans') - .replyWithError(new Error('My Socket Error')); - - const parentSpanId = '5c1c63257de34c67'; - const startTime = 1566156729709; - const duration = 2000; - - const span1: ReadableSpan = { - name: 'my-span', - kind: api.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: api.SpanStatusCode.OK, - }, - attributes: { - key1: 'value1', - key2: 'value2', - }, - links: [], - events: [ - { - name: 'my-event', - time: [startTime + 10, 0], - attributes: { key3: 'value3' }, - }, - ], - resource: Resource.empty(), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - }; - const span2: ReadableSpan = { - name: 'my-span', - kind: api.SpanKind.SERVER, - spanContext: { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, - }, - startTime: [startTime, 0], - endTime: [startTime + duration, 0], - ended: true, - duration: [duration, 0], - status: { - code: api.SpanStatusCode.OK, - }, - attributes: {}, - links: [], - events: [], - resource: Resource.empty(), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - }; - - const exporter = new ZipkinExporter({}); - - exporter.export([span1, span2], (result: ExportResult) => { - scope.done(); - assert.equal(exporter['_serviceName'], 'OpenTelemetry Service'); - }); - }); - - it('should set serviceName if resource has one', () => { - const resource_service_name = 'resource_service_name'; + it('should call globalErrorHandler on error', () => { + const expectedError = new Error('Whoops'); const scope = nock('http://localhost:9411') .post('/api/v2/spans') - .replyWithError(new Error('My Socket Error')); + .replyWithError(expectedError); - const parentSpanId = '5c1c63257de34c67'; - const startTime = 1566156729709; - const duration = 2000; - - const span1: ReadableSpan = { - name: 'my-span', - kind: api.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: api.SpanStatusCode.OK, - }, - attributes: { - key1: 'value1', - key2: 'value2', - }, - links: [], - events: [ - { - name: 'my-event', - time: [startTime + 10, 0], - attributes: { key3: 'value3' }, - }, - ], - resource: new Resource({ - [ResourceAttributes.SERVICE_NAME]: resource_service_name, - }), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - }; - const span2: ReadableSpan = { - name: 'my-span', - kind: api.SpanKind.SERVER, - spanContext: { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, - }, - startTime: [startTime, 0], - endTime: [startTime + duration, 0], - ended: true, - duration: [duration, 0], - status: { - code: api.SpanStatusCode.OK, - }, - attributes: {}, - links: [], - events: [], - resource: Resource.empty(), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - }; - - const exporter = new ZipkinExporter({}); - - exporter.export([span1, span2], (result: ExportResult) => { - scope.done(); - assert.equal(exporter['_serviceName'], resource_service_name); - - // checking if service name remains consistent in further exports - exporter.export([span2], (result: ExportResult) => { - scope.done(); - assert.equal(exporter['_serviceName'], resource_service_name); - }); + const exporter = new ZipkinExporter({ + serviceName: 'my-service', }); - it('should call globalErrorHandler on error', () => { - const expectedError = new Error('Whoops'); - const scope = nock('http://localhost:9411') - .post('/api/v2/spans') - .replyWithError(expectedError); - - const exporter = new ZipkinExporter({ - serviceName: 'my-service', - }); - - exporter.export([getReadableSpan()], (result: ExportResult) => { - assert.deepStrictEqual(result.code, ExportResultCode.FAILED); - assert.deepStrictEqual(result.error, expectedError); - scope.done(); - }); + exporter.export([getReadableSpan()], (result: ExportResult) => { + assert.deepStrictEqual(result.code, ExportResultCode.FAILED); + assert.deepStrictEqual(result.error, expectedError); + scope.done(); }); }); + }); - it('should set serviceName per-span if resource has one', () => { - const resource_service_name = 'resource_service_name'; - const resource_service_name_prime = 'resource_service_name_prime'; - - let requestBody: zipkinTypes.Span[]; - const scope = nock('http://localhost:9411') - .post('/api/v2/spans', body => { - requestBody = body; - return true; - }) - .replyWithError(new Error('My Socket Error')); - - const parentSpanId = '5c1c63257de34c67'; - const startTime = 1566156729709; - const duration = 2000; - - const span1: ReadableSpan = { - name: 'my-span', - kind: api.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: api.SpanStatusCode.OK, - }, - attributes: { - key1: 'value1', - key2: 'value2', + it('should set serviceName per-span if resource has one', () => { + const resource_service_name = 'resource_service_name'; + const resource_service_name_prime = 'resource_service_name_prime'; + + let requestBody: zipkinTypes.Span[]; + const scope = nock('http://localhost:9411') + .post('/api/v2/spans', body => { + requestBody = body; + return true; + }) + .replyWithError(new Error('My Socket Error')); + + const parentSpanId = '5c1c63257de34c67'; + const startTime = 1566156729709; + const duration = 2000; + + const span1: ReadableSpan = { + name: 'my-span', + kind: api.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: api.SpanStatusCode.OK, + }, + attributes: { + key1: 'value1', + key2: 'value2', + }, + links: [], + events: [ + { + name: 'my-event', + time: [startTime + 10, 0], + attributes: { key3: 'value3' }, }, - links: [], - events: [ - { - name: 'my-event', - time: [startTime + 10, 0], - attributes: { key3: 'value3' }, - }, - ], - resource: new Resource({ - [ResourceAttributes.SERVICE_NAME]: resource_service_name, - }), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - }; - const span2: ReadableSpan = { - name: 'my-span', - kind: api.SpanKind.SERVER, - spanContext: { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, - }, - startTime: [startTime, 0], - endTime: [startTime + duration, 0], - ended: true, - duration: [duration, 0], - status: { - code: api.SpanStatusCode.OK, - }, - attributes: {}, - links: [], - events: [], - resource: new Resource({ - [ResourceAttributes.SERVICE_NAME]: resource_service_name_prime, - }), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - }; - - const exporter = new ZipkinExporter({}); - - exporter.export([span1, span2], (result: ExportResult) => { - requestBody; - scope.done(); - assert.equal( - requestBody[0].localEndpoint.serviceName, - resource_service_name - ); - assert.equal( - requestBody[1].localEndpoint.serviceName, - resource_service_name_prime - ); - }); + ], + resource: new Resource({ + [ResourceAttributes.SERVICE_NAME]: resource_service_name, + }), + instrumentationLibrary: { name: 'default', version: '0.0.1' }, + }; + const span2: ReadableSpan = { + name: 'my-span', + kind: api.SpanKind.SERVER, + spanContext: () => ({ + traceId: 'd4cda95b652f4a1592b449d5929fda1b', + spanId: '6e0c63257de34c92', + traceFlags: TraceFlags.NONE, + }), + startTime: [startTime, 0], + endTime: [startTime + duration, 0], + ended: true, + duration: [duration, 0], + status: { + code: api.SpanStatusCode.OK, + }, + attributes: {}, + links: [], + events: [], + resource: new Resource({ + [ResourceAttributes.SERVICE_NAME]: resource_service_name_prime, + }), + instrumentationLibrary: { name: 'default', version: '0.0.1' }, + }; + + const exporter = new ZipkinExporter({}); + + exporter.export([span1, span2], (result: ExportResult) => { + requestBody; + scope.done(); + assert.equal( + requestBody[0].localEndpoint.serviceName, + resource_service_name + ); + assert.equal( + requestBody[1].localEndpoint.serviceName, + resource_service_name_prime + ); }); + }); - it('should set serviceName per-span if span has attribute', () => { - const span_service_name = 'span_service_name'; - const span_service_name_prime = 'span_service_name_prime'; - - let requestBody: any; - const scope = nock('http://localhost:9411') - .post('/api/v2/spans', body => { - requestBody = body; - return true; - }) - .replyWithError(new Error('My Socket Error')); - - const parentSpanId = '5c1c63257de34c67'; - const startTime = 1566156729709; - const duration = 2000; - - const span1: ReadableSpan = { - name: 'my-span', - kind: api.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: api.SpanStatusCode.OK, - }, - attributes: { - key1: 'value1', - key2: 'value2', - [ResourceAttributes.SERVICE_NAME]: span_service_name, - }, - links: [], - events: [ - { - name: 'my-event', - time: [startTime + 10, 0], - attributes: { key3: 'value3' }, - }, - ], - resource: Resource.empty(), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - }; - const span2: ReadableSpan = { - name: 'my-span', - kind: api.SpanKind.SERVER, - spanContext: { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, - }, - startTime: [startTime, 0], - endTime: [startTime + duration, 0], - ended: true, - duration: [duration, 0], - status: { - code: api.SpanStatusCode.OK, - }, - attributes: { - [ResourceAttributes.SERVICE_NAME]: span_service_name_prime, + it('should set serviceName per-span if span has attribute', () => { + const span_service_name = 'span_service_name'; + const span_service_name_prime = 'span_service_name_prime'; + + let requestBody: any; + const scope = nock('http://localhost:9411') + .post('/api/v2/spans', body => { + requestBody = body; + return true; + }) + .replyWithError(new Error('My Socket Error')); + + const parentSpanId = '5c1c63257de34c67'; + const startTime = 1566156729709; + const duration = 2000; + + const span1: ReadableSpan = { + name: 'my-span', + kind: api.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: api.SpanStatusCode.OK, + }, + attributes: { + key1: 'value1', + key2: 'value2', + [ResourceAttributes.SERVICE_NAME]: span_service_name, + }, + links: [], + events: [ + { + name: 'my-event', + time: [startTime + 10, 0], + attributes: { key3: 'value3' }, }, - links: [], - events: [], - resource: Resource.empty(), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - }; - - const exporter = new ZipkinExporter({}); - - exporter.export([span1, span2], (result: ExportResult) => { - requestBody; - scope.done(); - assert.equal( - requestBody[0].localEndpoint.serviceName, - span_service_name - ); - assert.equal( - requestBody[1].localEndpoint.serviceName, - span_service_name_prime - ); - }); + ], + resource: Resource.empty(), + instrumentationLibrary: { name: 'default', version: '0.0.1' }, + }; + const span2: ReadableSpan = { + name: 'my-span', + kind: api.SpanKind.SERVER, + spanContext: () => ({ + traceId: 'd4cda95b652f4a1592b449d5929fda1b', + spanId: '6e0c63257de34c92', + traceFlags: TraceFlags.NONE, + }), + startTime: [startTime, 0], + endTime: [startTime + duration, 0], + ended: true, + duration: [duration, 0], + status: { + code: api.SpanStatusCode.OK, + }, + attributes: { + [ResourceAttributes.SERVICE_NAME]: span_service_name_prime, + }, + links: [], + events: [], + resource: Resource.empty(), + instrumentationLibrary: { name: 'default', version: '0.0.1' }, + }; + + const exporter = new ZipkinExporter({}); + + exporter.export([span1, span2], (result: ExportResult) => { + requestBody; + scope.done(); + assert.equal( + requestBody[0].localEndpoint.serviceName, + span_service_name + ); + assert.equal( + requestBody[1].localEndpoint.serviceName, + span_service_name_prime + ); }); + }); - it('should support setting url via env', () => { + describe('when env.OTEL_EXPORTER_ZIPKIN_ENDPOINT is set', () => { + before(() => { process.env.OTEL_EXPORTER_ZIPKIN_ENDPOINT = 'http://localhost:9412'; + }) + after(() => { + delete process.env.OTEL_EXPORTER_ZIPKIN_ENDPOINT + }) + it('should use url from env', () => { const scope = nock('http://localhost:9412').post('/').reply(200); - + const exporter = new ZipkinExporter({ serviceName: 'my-service', }); - + exporter.export([getReadableSpan()], (result: ExportResult) => { scope.done(); assert.strictEqual(result.code, ExportResultCode.SUCCESS); }); }); }); - - describe('shutdown', () => { - before(() => { - nock.disableNetConnect(); - }); - - after(() => { - nock.enableNetConnect(); - }); - }); }); diff --git a/packages/opentelemetry-instrumentation-fetch/package.json b/packages/opentelemetry-instrumentation-fetch/package.json index f45017bba8..d070b117d5 100644 --- a/packages/opentelemetry-instrumentation-fetch/package.json +++ b/packages/opentelemetry-instrumentation-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-fetch", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry fetch automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -47,25 +47,24 @@ }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/context-zone": "0.19.0", - "@opentelemetry/propagator-b3": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/api": "^1.0.0", + "@opentelemetry/context-zone": "0.21.0", + "@opentelemetry/propagator-b3": "0.21.0", + "@opentelemetry/tracing": "0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/shimmer": "1.0.1", "@types/sinon": "9.0.11", "@types/webpack-env": "1.16.0", "babel-loader": "8.2.2", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", "karma-spec-reporter": "0.0.32", - "karma-webpack": "5.0.0", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", @@ -73,18 +72,18 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0", "webpack-cli": "4.6.0", "webpack-merge": "5.7.3" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0", - "@opentelemetry/web": "0.19.0" + "@opentelemetry/core": "0.21.0", + "@opentelemetry/instrumentation": "0.21.0", + "@opentelemetry/semantic-conventions": "0.21.0", + "@opentelemetry/web": "0.21.0" } } diff --git a/packages/opentelemetry-instrumentation-fetch/src/fetch.ts b/packages/opentelemetry-instrumentation-fetch/src/fetch.ts index 8d28649794..a8860947ba 100644 --- a/packages/opentelemetry-instrumentation-fetch/src/fetch.ts +++ b/packages/opentelemetry-instrumentation-fetch/src/fetch.ts @@ -114,7 +114,7 @@ export class FetchInstrumentation extends InstrumentationBase< { startTime: corsPreFlightRequest[web.PerformanceTimingNames.FETCH_START], }, - api.setSpan(api.context.active(), span) + api.trace.setSpan(api.context.active(), span) ); web.addSpanNetworkEvents(childSpan, corsPreFlightRequest); childSpan.end( @@ -159,7 +159,7 @@ export class FetchInstrumentation extends InstrumentationBase< const headers: Partial> = {}; api.propagation.inject(api.context.active(), headers); if (Object.keys(headers).length > 0) { - api.diag.debug('headers inject skipped due to CORS policy'); + this._diag.debug('headers inject skipped due to CORS policy'); } return; } @@ -198,7 +198,7 @@ export class FetchInstrumentation extends InstrumentationBase< options: Partial = {} ): api.Span | undefined { if (core.isUrlIgnored(url, this._getConfig().ignoreUrls)) { - api.diag.debug('ignoring span as url matches ignored url'); + this._diag.debug('ignoring span as url matches ignored url'); return; } const method = (options.method || 'GET').toUpperCase(); @@ -314,6 +314,27 @@ export class FetchInstrumentation extends InstrumentationBase< } const spanData = plugin._prepareSpanData(url); + function endSpanOnError(span: api.Span, error: FetchError) { + plugin._applyAttributesAfterFetch(span, options, error); + plugin._endSpan(span, spanData, { + status: error.status || 0, + statusText: error.message, + url, + }); + } + + function endSpanOnSuccess(span: api.Span, response: Response) { + plugin._applyAttributesAfterFetch(span, options, response); + if (response.status >= 200 && response.status < 400) { + plugin._endSpan(span, spanData, response); + } else { + plugin._endSpan(span, spanData, { + status: response.status, + statusText: response.statusText, + url, + }); + } + } function onSuccess( span: api.Span, resolve: ( @@ -322,15 +343,28 @@ export class FetchInstrumentation extends InstrumentationBase< response: Response ) { try { - plugin._applyAttributesAfterFetch(span, options, response); - if (response.status >= 200 && response.status < 400) { - plugin._endSpan(span, spanData, response); + const resClone = response.clone(); + const body = resClone.body; + if (body) { + const reader = body.getReader(); + const read = (): void => { + reader.read().then( + ({ done }) => { + if (done) { + endSpanOnSuccess(span, response); + } else { + read(); + } + }, + error => { + endSpanOnError(span, error); + } + ); + }; + read(); } else { - plugin._endSpan(span, spanData, { - status: response.status, - statusText: response.statusText, - url, - }); + // some older browsers don't have .body implemented + endSpanOnSuccess(span, response); } } finally { resolve(response); @@ -343,12 +377,7 @@ export class FetchInstrumentation extends InstrumentationBase< error: FetchError ) { try { - plugin._applyAttributesAfterFetch(span, options, error); - plugin._endSpan(span, spanData, { - status: error.status || 0, - statusText: error.message, - url, - }); + endSpanOnError(span, error); } finally { reject(error); } @@ -356,7 +385,7 @@ export class FetchInstrumentation extends InstrumentationBase< return new Promise((resolve, reject) => { return api.context.with( - api.setSpan(api.context.active(), createdSpan), + api.trace.setSpan(api.context.active(), createdSpan), () => { plugin._addHeaders(options, url); plugin._tasksCount++; @@ -388,7 +417,7 @@ export class FetchInstrumentation extends InstrumentationBase< return; } - api.diag.error('applyCustomAttributesOnSpan', error); + this._diag.error('applyCustomAttributesOnSpan', error); }, true ); @@ -429,10 +458,10 @@ export class FetchInstrumentation extends InstrumentationBase< /** * implements enable function */ - enable() { + override enable() { if (isWrapped(window.fetch)) { this._unwrap(window, 'fetch'); - api.diag.debug('removing previous patch for constructor'); + this._diag.debug('removing previous patch for constructor'); } this._wrap(window, 'fetch', this._patchConstructor()); } @@ -440,7 +469,7 @@ export class FetchInstrumentation extends InstrumentationBase< /** * implements unpatch function */ - disable() { + override disable() { this._unwrap(window, 'fetch'); this._usedResources = new WeakSet(); } diff --git a/packages/opentelemetry-instrumentation-fetch/src/version.ts b/packages/opentelemetry-instrumentation-fetch/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-instrumentation-fetch/src/version.ts +++ b/packages/opentelemetry-instrumentation-fetch/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-instrumentation-fetch/test/fetch.test.ts b/packages/opentelemetry-instrumentation-fetch/test/fetch.test.ts index a9568f71cc..4c6de800c6 100644 --- a/packages/opentelemetry-instrumentation-fetch/test/fetch.test.ts +++ b/packages/opentelemetry-instrumentation-fetch/test/fetch.test.ts @@ -51,8 +51,8 @@ class DummySpanExporter implements tracing.SpanExporter { } } -const getData = (url: string, method?: string) => - fetch(url, { +const getData = (url: string, method?: string) => { + return fetch(url, { method: method || 'GET', headers: { foo: 'bar', @@ -60,6 +60,7 @@ const getData = (url: string, method?: string) => 'Content-Type': 'application/json', }, }); +}; const CUSTOM_ATTRIBUTE_KEY = 'span kind'; const defaultResource = { @@ -233,39 +234,35 @@ describe('fetch', () => { ); rootSpan = webTracerWithZone.startSpan('root'); - api.context.with(api.setSpan(api.context.active(), rootSpan), () => { + api.context.with(api.trace.setSpan(api.context.active(), rootSpan), () => { fakeNow = 0; - getData(fileUrl, method).then( - response => { - // this is a bit tricky as the only way to get all request headers from - // fetch is to use json() - response.json().then( - json => { - lastResponse = json; - const headers: { [key: string]: string } = {}; - Object.keys(lastResponse.headers).forEach(key => { - headers[key.toLowerCase()] = lastResponse.headers[key]; - }); - lastResponse.headers = headers; - // OBSERVER_WAIT_TIME_MS - sinon.clock.tick(300); - done(); - }, - () => { - lastResponse = undefined; - // OBSERVER_WAIT_TIME_MS - sinon.clock.tick(300); - done(); - } - ); - }, - () => { - lastResponse = undefined; - // OBSERVER_WAIT_TIME_MS - sinon.clock.tick(300); + void getData(fileUrl, method) + .then( + response => { + // this is a bit tricky as the only way to get all request headers from + // fetch is to use json() + return response.json().then( + json => { + lastResponse = json; + const headers: { [key: string]: string } = {}; + Object.keys(lastResponse.headers).forEach(key => { + headers[key.toLowerCase()] = lastResponse.headers[key]; + }); + lastResponse.headers = headers; + }, + () => { + lastResponse = undefined; + } + ); + }, + () => { + lastResponse = undefined; + } + ) + .then(sinon.clock.runAllAsync) + .then(() => { done(); - } - ); + }); fakeNow = 300; }); }; @@ -313,7 +310,7 @@ describe('fetch', () => { const span: tracing.ReadableSpan = exportSpy.args[1][0][0]; assert.strictEqual( span.parentSpanId, - rootSpan.context().spanId, + rootSpan.spanContext().spanId, 'parent span is not root span' ); }); @@ -433,7 +430,7 @@ describe('fetch', () => { const parentSpan: tracing.ReadableSpan = exportSpy.args[1][0][0]; assert.strictEqual( span.parentSpanId, - parentSpan.spanContext.spanId, + parentSpan.spanContext().spanId, 'parent span is not root span' ); }); @@ -512,24 +509,24 @@ describe('fetch', () => { const span: api.Span = exportSpy.args[1][0][0]; assert.strictEqual( lastResponse.headers[X_B3_TRACE_ID], - span.context().traceId, + span.spanContext().traceId, `trace header '${X_B3_TRACE_ID}' not set` ); assert.strictEqual( lastResponse.headers[X_B3_SPAN_ID], - span.context().spanId, + span.spanContext().spanId, `trace header '${X_B3_SPAN_ID}' not set` ); assert.strictEqual( lastResponse.headers[X_B3_SAMPLED], - String(span.context().traceFlags), + String(span.spanContext().traceFlags), `trace header '${X_B3_SAMPLED}' not set` ); }); it('should set trace headers with a request object', () => { const r = new Request('url'); - window.fetch(r); + window.fetch(r).catch(() => {}); assert.ok(typeof r.headers.get(X_B3_TRACE_ID) === 'string'); }); @@ -574,7 +571,7 @@ describe('fetch', () => { }); it('should debug info that injecting headers was skipped', () => { assert.strictEqual( - spyDebug.lastCall.args[0], + spyDebug.lastCall.args[1], 'headers inject skipped due to CORS policy' ); }); @@ -696,7 +693,7 @@ describe('fetch', () => { const span: tracing.ReadableSpan = exportSpy.args[1][0][0]; assert.strictEqual( span.parentSpanId, - rootSpan.context().spanId, + rootSpan.spanContext().spanId, 'parent span is not root span' ); }); @@ -715,7 +712,7 @@ describe('fetch', () => { const span: tracing.ReadableSpan = exportSpy.args[1][0][0]; assert.strictEqual( span.parentSpanId, - rootSpan.context().spanId, + rootSpan.spanContext().spanId, 'parent span is not root span' ); }); diff --git a/packages/opentelemetry-instrumentation-grpc/package.json b/packages/opentelemetry-instrumentation-grpc/package.json index f4aefe3ca3..54734aaadb 100644 --- a/packages/opentelemetry-instrumentation-grpc/package.json +++ b/packages/opentelemetry-instrumentation-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-grpc", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry grpc automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -43,19 +43,18 @@ "devDependencies": { "@grpc/grpc-js": "1.3.0", "@grpc/proto-loader": "0.6.1", - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/context-async-hooks": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/api": "^1.0.0", + "@opentelemetry/context-async-hooks": "0.21.0", + "@opentelemetry/core": "0.21.0", + "@opentelemetry/node": "0.21.0", + "@opentelemetry/tracing": "0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/semver": "7.3.5", "@types/shimmer": "1.0.1", "@types/sinon": "9.0.11", - "codecov": "3.8.1", + "codecov": "3.8.2", "grpc": "1.24.7", - "gts": "3.1.0", "mocha": "7.2.0", "node-pre-gyp": "0.17.0", "nyc": "15.1.0", @@ -64,14 +63,14 @@ "sinon": "10.0.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/api-metrics": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0" + "@opentelemetry/api-metrics": "0.21.0", + "@opentelemetry/instrumentation": "0.21.0", + "@opentelemetry/semantic-conventions": "0.21.0" } } diff --git a/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts b/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts index 26906ad5b9..b2810cd104 100644 --- a/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts +++ b/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts @@ -110,7 +110,7 @@ export function makeGrpcClientRemoteCall( span.end(); callback(err, res); }; - return context.bind(wrappedFn); + return context.bind(context.active(), wrappedFn); } return (span: Span) => { @@ -146,7 +146,7 @@ export function makeGrpcClientRemoteCall( spanEnded = true; } }; - context.bind(call); + context.bind(context.active(), call); call.on('error', (err: grpcJs.ServiceError) => { if (call[CALL_SPAN_ENDED]) { return; diff --git a/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts b/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts index 1b098c17cc..0cf2114891 100644 --- a/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts +++ b/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts @@ -35,12 +35,11 @@ import { } from './types'; import { context, - SpanOptions, - SpanKind, propagation, ROOT_CONTEXT, - setSpan, - diag, + SpanOptions, + SpanKind, + trace, } from '@opentelemetry/api'; import { shouldNotTraceServerCall, @@ -57,14 +56,14 @@ import { AttributeNames } from '../enums/AttributeNames'; export class GrpcJsInstrumentation extends InstrumentationBase { constructor( - protected _config: GrpcInstrumentationConfig & InstrumentationConfig = {}, + protected override _config: GrpcInstrumentationConfig & InstrumentationConfig = {}, name: string, version: string ) { super(name, version, _config); } - public setConfig( + public override setConfig( config: GrpcInstrumentationConfig & InstrumentationConfig = {} ) { this._config = Object.assign({}, config); @@ -76,7 +75,7 @@ export class GrpcJsInstrumentation extends InstrumentationBase { '@grpc/grpc-js', ['1.*'], (moduleExports, version) => { - diag.debug(`Applying patch for @grpc/grpc-js@${version}`); + this._diag.debug(`Applying patch for @grpc/grpc-js@${version}`); if (isWrapped(moduleExports.Server.prototype.register)) { this._unwrap(moduleExports.Server.prototype, 'register'); } @@ -115,7 +114,7 @@ export class GrpcJsInstrumentation extends InstrumentationBase { }, (moduleExports, version) => { if (moduleExports === undefined) return; - diag.debug(`Removing patch for @grpc/grpc-js@${version}`); + this._diag.debug(`Removing patch for @grpc/grpc-js@${version}`); this._unwrap(moduleExports.Server.prototype, 'register'); this._unwrap(moduleExports, 'makeClientConstructor'); @@ -136,7 +135,7 @@ export class GrpcJsInstrumentation extends InstrumentationBase { const instrumentation = this; return (originalRegister: ServerRegisterFunction) => { const config = this._config; - diag.debug('patched gRPC server'); + instrumentation._diag.debug('patched gRPC server'); return function register( this: grpcJs.Server, name: string, @@ -186,7 +185,7 @@ export class GrpcJsInstrumentation extends InstrumentationBase { kind: SpanKind.SERVER, }; - diag.debug('patch func: %s', JSON.stringify(spanOptions)); + instrumentation._diag.debug('patch func: %s', JSON.stringify(spanOptions)); context.with( propagation.extract(ROOT_CONTEXT, call.metadata, { @@ -200,7 +199,7 @@ export class GrpcJsInstrumentation extends InstrumentationBase { [AttributeNames.GRPC_KIND]: spanOptions.kind, }); - context.with(setSpan(context.active(), span), () => { + context.with(trace.setSpan(context.active(), span), () => { handleServerFunction.call( self, span, @@ -231,7 +230,7 @@ export class GrpcJsInstrumentation extends InstrumentationBase { ) => MakeClientConstructorFunction { const instrumentation = this; return (original: MakeClientConstructorFunction) => { - diag.debug('patching client'); + instrumentation._diag.debug('patching client'); return function makeClientConstructor( this: typeof grpcJs.Client, methods: grpcJs.ServiceDefinition, @@ -255,7 +254,7 @@ export class GrpcJsInstrumentation extends InstrumentationBase { */ private _patchLoadPackageDefinition(grpcClient: typeof grpcJs) { const instrumentation = this; - diag.debug('patching loadPackageDefinition'); + instrumentation._diag.debug('patching loadPackageDefinition'); return (original: typeof grpcJs.loadPackageDefinition) => { return function patchedLoadPackageDefinition( this: null, @@ -279,7 +278,7 @@ export class GrpcJsInstrumentation extends InstrumentationBase { ): (original: GrpcClientFunc) => () => EventEmitter { const instrumentation = this; return (original: GrpcClientFunc) => { - diag.debug('patch all client methods'); + instrumentation._diag.debug('patch all client methods'); return function clientMethodTrace(this: grpcJs.Client) { const name = `grpc.${original.path.replace('/', '')}`; const args = [...arguments]; @@ -292,7 +291,7 @@ export class GrpcJsInstrumentation extends InstrumentationBase { const span = instrumentation.tracer.startSpan(name, { kind: SpanKind.CLIENT, }); - return context.with(setSpan(context.active(), span), () => + return context.with(trace.setSpan(context.active(), span), () => makeGrpcClientRemoteCall(original, args, metadata, this)(span) ); }; diff --git a/packages/opentelemetry-instrumentation-grpc/src/grpc-js/serverUtils.ts b/packages/opentelemetry-instrumentation-grpc/src/grpc-js/serverUtils.ts index 8fad49fd1b..f30c892a98 100644 --- a/packages/opentelemetry-instrumentation-grpc/src/grpc-js/serverUtils.ts +++ b/packages/opentelemetry-instrumentation-grpc/src/grpc-js/serverUtils.ts @@ -56,7 +56,7 @@ function serverStreamAndBidiHandler( } }; - context.bind(call); + context.bind(context.active(), call); call.on('finish', () => { // @grpc/js does not expose a way to check if this call also emitted an error, // e.g. call.status.code !== 0 @@ -143,7 +143,7 @@ function clientStreamAndUnaryHandler( return callback(err, value); }; - context.bind(call); + context.bind(context.active(), call); return (original as Function).call({}, call, patchedCallback); } diff --git a/packages/opentelemetry-instrumentation-grpc/src/grpc/clientUtils.ts b/packages/opentelemetry-instrumentation-grpc/src/grpc/clientUtils.ts index 938533024c..331e744344 100644 --- a/packages/opentelemetry-instrumentation-grpc/src/grpc/clientUtils.ts +++ b/packages/opentelemetry-instrumentation-grpc/src/grpc/clientUtils.ts @@ -76,7 +76,7 @@ export const makeGrpcClientRemoteCall = function ( span.end(); callback(err, res); }; - return context.bind(wrappedFn); + return context.bind(context.active(), wrappedFn); } return (span: Span) => { @@ -118,7 +118,7 @@ export const makeGrpcClientRemoteCall = function ( spanEnded = true; } }; - context.bind(call); + context.bind(context.active(), call); ((call as unknown) as events.EventEmitter).on( 'error', (err: grpcTypes.ServiceError) => { diff --git a/packages/opentelemetry-instrumentation-grpc/src/grpc/index.ts b/packages/opentelemetry-instrumentation-grpc/src/grpc/index.ts index 89ce5db3de..87486ef157 100644 --- a/packages/opentelemetry-instrumentation-grpc/src/grpc/index.ts +++ b/packages/opentelemetry-instrumentation-grpc/src/grpc/index.ts @@ -34,8 +34,7 @@ import { propagation, SpanOptions, SpanKind, - setSpan, - diag, + trace, } from '@opentelemetry/api'; import { clientStreamAndUnaryHandler, @@ -56,14 +55,14 @@ export class GrpcNativeInstrumentation extends InstrumentationBase< typeof grpcTypes > { constructor( - protected _config: GrpcInstrumentationConfig & InstrumentationConfig = {}, + protected override _config: GrpcInstrumentationConfig & InstrumentationConfig = {}, name: string, version: string ) { super(name, version, _config); } - public setConfig( + public override setConfig( config: GrpcInstrumentationConfig & InstrumentationConfig = {} ) { this._config = Object.assign({}, config); @@ -75,7 +74,7 @@ export class GrpcNativeInstrumentation extends InstrumentationBase< 'grpc', ['1.*'], (moduleExports, version) => { - diag.debug(`Applying patch for grpc@${version}`); + this._diag.debug(`Applying patch for grpc@${version}`); grpcClient = moduleExports; if (isWrapped(moduleExports.Server.prototype.register)) { @@ -99,7 +98,7 @@ export class GrpcNativeInstrumentation extends InstrumentationBase< }, (moduleExports, version) => { if (moduleExports === undefined) return; - diag.debug(`Removing patch for grpc@${version}`); + this._diag.debug(`Removing patch for grpc@${version}`); this._unwrap(moduleExports.Server.prototype, 'register'); }, @@ -113,7 +112,7 @@ export class GrpcNativeInstrumentation extends InstrumentationBase< moduleExports: GrpcInternalClientTypes, version?: string ) => { - diag.debug(`Applying internal patch for grpc@${version}`); + this._diag.debug(`Applying internal patch for grpc@${version}`); if (isWrapped(moduleExports.makeClientConstructor)) { this._unwrap(moduleExports, 'makeClientConstructor'); } @@ -125,7 +124,7 @@ export class GrpcNativeInstrumentation extends InstrumentationBase< version?: string ) => { if (moduleExports === undefined) return; - diag.debug(`Removing internal patch for grpc@${version}`); + this._diag.debug(`Removing internal patch for grpc@${version}`); this._unwrap(moduleExports, 'makeClientConstructor'); }; return [ @@ -147,7 +146,7 @@ export class GrpcNativeInstrumentation extends InstrumentationBase< private _patchServer(grpcModule: typeof grpcTypes) { const instrumentation = this; return (originalRegister: typeof grpcTypes.Server.prototype.register) => { - diag.debug('patched gRPC server'); + instrumentation._diag.debug('patched gRPC server'); return function register( this: grpcTypes.Server & { handlers: any }, @@ -191,7 +190,7 @@ export class GrpcNativeInstrumentation extends InstrumentationBase< kind: SpanKind.SERVER, }; - diag.debug('patch func: %s', JSON.stringify(spanOptions)); + instrumentation._diag.debug('patch func: %s', JSON.stringify(spanOptions)); context.with( propagation.extract(context.active(), call.metadata, { @@ -205,7 +204,7 @@ export class GrpcNativeInstrumentation extends InstrumentationBase< [AttributeNames.GRPC_KIND]: spanOptions.kind, }); - context.with(setSpan(context.active(), span), () => { + context.with(trace.setSpan(context.active(), span), () => { switch (type) { case 'unary': case 'client_stream': @@ -243,7 +242,7 @@ export class GrpcNativeInstrumentation extends InstrumentationBase< private _patchClient() { const instrumentation = this; return (original: typeof grpcTypes.makeGenericClientConstructor): never => { - diag.debug('patching client'); + instrumentation._diag.debug('patching client'); return function makeClientConstructor( this: typeof grpcTypes.Client, methods: { [key: string]: { originalName?: string } }, @@ -288,7 +287,7 @@ export class GrpcNativeInstrumentation extends InstrumentationBase< private _getPatchedClientMethods() { const instrumentation = this; return (original: GrpcClientFunc) => { - diag.debug('patch all client methods'); + instrumentation._diag.debug('patch all client methods'); return function clientMethodTrace(this: grpcTypes.Client) { const name = `grpc.${(original.path as string | undefined)?.replace( '/', @@ -299,7 +298,7 @@ export class GrpcNativeInstrumentation extends InstrumentationBase< const span = instrumentation.tracer.startSpan(name, { kind: SpanKind.CLIENT, }); - return context.with(setSpan(context.active(), span), () => + return context.with(trace.setSpan(context.active(), span), () => makeGrpcClientRemoteCall( grpcClient, original, diff --git a/packages/opentelemetry-instrumentation-grpc/src/grpc/serverUtils.ts b/packages/opentelemetry-instrumentation-grpc/src/grpc/serverUtils.ts index 36e26a1530..5d88eeabcc 100644 --- a/packages/opentelemetry-instrumentation-grpc/src/grpc/serverUtils.ts +++ b/packages/opentelemetry-instrumentation-grpc/src/grpc/serverUtils.ts @@ -71,7 +71,7 @@ export const clientStreamAndUnaryHandler = function ( return callback(err, value, trailer, flags); } - context.bind(call); + context.bind(context.active(), call); return (original as Function).call(self, call, patchedCallback); }; @@ -89,7 +89,7 @@ export const serverStreamAndBidiHandler = function ( } }; - context.bind(call); + context.bind(context.active(), call); call.on('finish', () => { span.setStatus(_grpcStatusCodeToSpanStatus(call.status.code)); span.setAttribute( diff --git a/packages/opentelemetry-instrumentation-grpc/src/version.ts b/packages/opentelemetry-instrumentation-grpc/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-instrumentation-grpc/src/version.ts +++ b/packages/opentelemetry-instrumentation-grpc/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-instrumentation-grpc/test/helper.ts b/packages/opentelemetry-instrumentation-grpc/test/helper.ts index 1c71e49430..62cab27167 100644 --- a/packages/opentelemetry-instrumentation-grpc/test/helper.ts +++ b/packages/opentelemetry-instrumentation-grpc/test/helper.ts @@ -17,9 +17,7 @@ import { context, SpanKind, - propagation, - setSpan, - getSpan, + propagation, trace, } from '@opentelemetry/api'; import { HttpTraceContextPropagator } from '@opentelemetry/core'; import { NodeTracerProvider } from '@opentelemetry/node'; @@ -512,8 +510,8 @@ export const runTests = ( const span = provider .getTracer('default') .startSpan('TestSpan', { kind: SpanKind.PRODUCER }); - return context.with(setSpan(context.active(), span), async () => { - const rootSpan = getSpan(context.active()); + return context.with(trace.setSpan(context.active(), span), async () => { + const rootSpan = trace.getSpan(context.active()); if (!rootSpan) { return assert.ok(false); } @@ -547,11 +545,11 @@ export const runTests = ( ); assertPropagation(serverSpan, clientSpan); assert.strictEqual( - rootSpan.context().traceId, - serverSpan.spanContext.traceId + rootSpan.spanContext().traceId, + serverSpan.spanContext().traceId ); assert.strictEqual( - rootSpan.context().spanId, + rootSpan.spanContext().spanId, clientSpan.parentSpanId ); } @@ -608,8 +606,8 @@ export const runTests = ( const span = provider .getTracer('default') .startSpan('TestSpan', { kind: SpanKind.PRODUCER }); - return context.with(setSpan(context.active(), span), async () => { - const rootSpan = getSpan(context.active()); + return context.with(trace.setSpan(context.active(), span), async () => { + const rootSpan = trace.getSpan(context.active()); if (!rootSpan) { return assert.ok(false); } @@ -636,11 +634,11 @@ export const runTests = ( assertSpan(moduleName, clientSpan, SpanKind.CLIENT, validations); assertPropagation(serverSpan, clientSpan); assert.strictEqual( - rootSpan.context().traceId, - serverSpan.spanContext.traceId + rootSpan.spanContext().traceId, + serverSpan.spanContext().traceId ); assert.strictEqual( - rootSpan.context().spanId, + rootSpan.spanContext().spanId, clientSpan.parentSpanId ); }); diff --git a/packages/opentelemetry-instrumentation-grpc/test/utils/assertionUtils.ts b/packages/opentelemetry-instrumentation-grpc/test/utils/assertionUtils.ts index 90a05ec97f..a0b863b03e 100644 --- a/packages/opentelemetry-instrumentation-grpc/test/utils/assertionUtils.ts +++ b/packages/opentelemetry-instrumentation-grpc/test/utils/assertionUtils.ts @@ -39,8 +39,8 @@ export const assertSpan = ( kind: SpanKind, validations: { name: string; status: grpc.status | grpcJs.status } ) => { - assert.strictEqual(span.spanContext.traceId.length, 32); - assert.strictEqual(span.spanContext.spanId.length, 16); + assert.strictEqual(span.spanContext().traceId.length, 32); + assert.strictEqual(span.spanContext().spanId.length, 16); assert.strictEqual(span.kind, kind); assert.ok(span.endTime); @@ -52,7 +52,7 @@ export const assertSpan = ( assert.ok(hrTimeToMilliseconds(span.endTime) > 0); if (span.kind === SpanKind.SERVER) { - assert.ok(span.spanContext); + assert.ok(span.spanContext()); } // validations @@ -68,8 +68,8 @@ export const assertPropagation = ( incomingSpan: ReadableSpan, outgoingSpan: ReadableSpan ) => { - const targetSpanContext = incomingSpan.spanContext; - const sourceSpanContext = outgoingSpan.spanContext; + const targetSpanContext = incomingSpan.spanContext(); + const sourceSpanContext = outgoingSpan.spanContext(); assert.strictEqual(targetSpanContext.traceId, sourceSpanContext.traceId); assert.strictEqual(incomingSpan.parentSpanId, sourceSpanContext.spanId); assert.strictEqual( diff --git a/packages/opentelemetry-instrumentation-http/package.json b/packages/opentelemetry-instrumentation-http/package.json index d0bf47045c..e7095bf793 100644 --- a/packages/opentelemetry-instrumentation-http/package.json +++ b/packages/opentelemetry-instrumentation-http/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-http", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry http/https automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -41,11 +41,10 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/context-async-hooks": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/api": "^1.0.0", + "@opentelemetry/context-async-hooks": "0.21.0", + "@opentelemetry/node": "0.21.0", + "@opentelemetry/tracing": "0.21.0", "@types/got": "9.6.11", "@types/mocha": "8.2.2", "@types/node": "14.14.43", @@ -54,9 +53,8 @@ "@types/sinon": "9.0.11", "@types/superagent": "4.1.10", "axios": "0.21.1", - "codecov": "3.8.1", + "codecov": "3.8.2", "got": "9.6.0", - "gts": "3.1.0", "mocha": "7.2.0", "nock": "12.0.3", "nyc": "15.1.0", @@ -67,14 +65,15 @@ "superagent": "6.1.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0", + "@opentelemetry/core": "0.21.0", + "@opentelemetry/instrumentation": "0.21.0", + "@opentelemetry/semantic-conventions": "0.21.0", "semver": "^7.1.3" } } diff --git a/packages/opentelemetry-instrumentation-http/src/http.ts b/packages/opentelemetry-instrumentation-http/src/http.ts index 59d9539c33..4b52635eef 100644 --- a/packages/opentelemetry-instrumentation-http/src/http.ts +++ b/packages/opentelemetry-instrumentation-http/src/http.ts @@ -14,20 +14,18 @@ * limitations under the License. */ import { - SpanStatusCode, context, + INVALID_SPAN_CONTEXT, propagation, + ROOT_CONTEXT, Span, SpanKind, SpanOptions, SpanStatus, - setSpan, - ROOT_CONTEXT, - getSpan, - suppressInstrumentation, - NOOP_TRACER, - diag, + SpanStatusCode, + trace, } from '@opentelemetry/api'; +import { suppressTracing } from '@opentelemetry/core'; import type * as http from 'http'; import type * as https from 'https'; import { Socket } from 'net'; @@ -52,6 +50,7 @@ import { isWrapped, safeExecuteInTheMiddle, } from '@opentelemetry/instrumentation'; +import { RPCMetadata, RPCType, setRPCMetadata } from '@opentelemetry/core'; /** * Http instrumentation instrumentation for Opentelemetry @@ -73,7 +72,7 @@ export class HttpInstrumentation extends InstrumentationBase { return this._config; } - setConfig(config: HttpInstrumentationConfig & InstrumentationConfig = {}) { + override setConfig(config: HttpInstrumentationConfig & InstrumentationConfig = {}) { this._config = Object.assign({}, config); } @@ -86,7 +85,7 @@ export class HttpInstrumentation extends InstrumentationBase { 'http', ['*'], moduleExports => { - diag.debug(`Applying patch for http@${this._version}`); + this._diag.debug(`Applying patch for http@${this._version}`); if (isWrapped(moduleExports.request)) { this._unwrap(moduleExports, 'request'); } @@ -115,7 +114,7 @@ export class HttpInstrumentation extends InstrumentationBase { }, moduleExports => { if (moduleExports === undefined) return; - diag.debug(`Removing patch for http@${this._version}`); + this._diag.debug(`Removing patch for http@${this._version}`); this._unwrap(moduleExports, 'request'); this._unwrap(moduleExports, 'get'); @@ -129,7 +128,7 @@ export class HttpInstrumentation extends InstrumentationBase { 'https', ['*'], moduleExports => { - diag.debug(`Applying patch for https@${this._version}`); + this._diag.debug(`Applying patch for https@${this._version}`); if (isWrapped(moduleExports.request)) { this._unwrap(moduleExports, 'request'); } @@ -158,7 +157,7 @@ export class HttpInstrumentation extends InstrumentationBase { }, moduleExports => { if (moduleExports === undefined) return; - diag.debug(`Removing patch for https@${this._version}`); + this._diag.debug(`Removing patch for https@${this._version}`); this._unwrap(moduleExports, 'request'); this._unwrap(moduleExports, 'get'); @@ -308,10 +307,10 @@ export class HttpInstrumentation extends InstrumentationBase { this._callResponseHook(span, response); } - context.bind(response); - diag.debug('outgoingRequest on response()'); + context.bind(context.active(), response); + this._diag.debug('outgoingRequest on response()'); response.on('end', () => { - diag.debug('outgoingRequest on end()'); + this._diag.debug('outgoingRequest on end()'); let status: SpanStatus; if (response.aborted && !response.complete) { @@ -353,7 +352,7 @@ export class HttpInstrumentation extends InstrumentationBase { this._closeHttpSpan(span); }); - diag.debug('http.ClientRequest return request'); + this._diag.debug('http.ClientRequest return request'); return request; } @@ -379,18 +378,18 @@ export class HttpInstrumentation extends InstrumentationBase { : '/'; const method = request.method || 'GET'; - diag.debug('%s instrumentation incomingRequest', component); + instrumentation._diag.debug('%s instrumentation incomingRequest', component); if ( utils.isIgnored( pathname, instrumentation._getConfig().ignoreIncomingPaths, - (e: Error) => diag.error('caught ignoreIncomingPaths error: ', e) + (e: Error) => instrumentation._diag.error('caught ignoreIncomingPaths error: ', e) ) ) { - return context.with(suppressInstrumentation(context.active()), () => { - context.bind(request); - context.bind(response); + return context.with(suppressTracing(context.active()), () => { + context.bind(context.active(), request); + context.bind(context.active(), response); return original.apply(this, [event, ...args]); }); } @@ -411,29 +410,72 @@ export class HttpInstrumentation extends InstrumentationBase { spanOptions, ctx ); + const rpcMetadata: RPCMetadata = { + type: RPCType.HTTP, + span, + }; - return context.with(setSpan(ctx, span), () => { - context.bind(request); - context.bind(response); + return context.with( + setRPCMetadata(trace.setSpan(ctx, span), rpcMetadata), + () => { + context.bind(context.active(), request); + context.bind(context.active(), response); - if (instrumentation._getConfig().requestHook) { - instrumentation._callRequestHook(span, request); - } - if (instrumentation._getConfig().responseHook) { - instrumentation._callResponseHook(span, response); - } + if (instrumentation._getConfig().requestHook) { + instrumentation._callRequestHook(span, request); + } + if (instrumentation._getConfig().responseHook) { + instrumentation._callResponseHook(span, response); + } - // Wraps end (inspired by: - // https://github.com/GoogleCloudPlatform/cloud-trace-nodejs/blob/master/src/instrumentations/instrumentation-connect.ts#L75) - const originalEnd = response.end; - response.end = function ( - this: http.ServerResponse, - ..._args: ResponseEndArgs - ) { - response.end = originalEnd; - // Cannot pass args of type ResponseEndArgs, - const returned = safeExecuteInTheMiddle( - () => response.end.apply(this, arguments as never), + // Wraps end (inspired by: + // https://github.com/GoogleCloudPlatform/cloud-trace-nodejs/blob/master/src/instrumentations/instrumentation-connect.ts#L75) + const originalEnd = response.end; + response.end = function ( + this: http.ServerResponse, + ..._args: ResponseEndArgs + ) { + response.end = originalEnd; + // Cannot pass args of type ResponseEndArgs, + const returned = safeExecuteInTheMiddle( + () => response.end.apply(this, arguments as never), + error => { + if (error) { + utils.setSpanWithError(span, error); + instrumentation._closeHttpSpan(span); + throw error; + } + } + ); + + const attributes = utils.getIncomingRequestAttributesOnResponse( + request, + response + ); + + span + .setAttributes(attributes) + .setStatus(utils.parseResponseStatus(response.statusCode)); + + if (instrumentation._getConfig().applyCustomAttributesOnSpan) { + safeExecuteInTheMiddle( + () => + instrumentation._getConfig().applyCustomAttributesOnSpan!( + span, + request, + response + ), + () => {}, + true + ); + } + + instrumentation._closeHttpSpan(span); + return returned; + }; + + return safeExecuteInTheMiddle( + () => original.apply(this, [event, ...args]), error => { if (error) { utils.setSpanWithError(span, error); @@ -442,44 +484,8 @@ export class HttpInstrumentation extends InstrumentationBase { } } ); - - const attributes = utils.getIncomingRequestAttributesOnResponse( - request, - response - ); - - span - .setAttributes(attributes) - .setStatus(utils.parseResponseStatus(response.statusCode)); - - if (instrumentation._getConfig().applyCustomAttributesOnSpan) { - safeExecuteInTheMiddle( - () => - instrumentation._getConfig().applyCustomAttributesOnSpan!( - span, - request, - response - ), - () => {}, - true - ); - } - - instrumentation._closeHttpSpan(span); - return returned; - }; - - return safeExecuteInTheMiddle( - () => original.apply(this, [event, ...args]), - error => { - if (error) { - utils.setSpanWithError(span, error); - instrumentation._closeHttpSpan(span); - throw error; - } - } - ); - }); + } + ); }; } @@ -522,7 +528,7 @@ export class HttpInstrumentation extends InstrumentationBase { utils.isIgnored( origin + pathname, instrumentation._getConfig().ignoreOutgoingUrls, - (e: Error) => diag.error('caught ignoreOutgoingUrls error: ', e) + (e: Error) => instrumentation._diag.error('caught ignoreOutgoingUrls error: ', e) ) ) { return original.apply(this, [optionsParsed, ...args]); @@ -535,7 +541,7 @@ export class HttpInstrumentation extends InstrumentationBase { const span = instrumentation._startHttpSpan(operationName, spanOptions); const parentContext = context.active(); - const requestContext = setSpan(parentContext, span); + const requestContext = trace.setSpan(parentContext, span); if (!optionsParsed.headers) { optionsParsed.headers = {}; @@ -549,7 +555,7 @@ export class HttpInstrumentation extends InstrumentationBase { */ const cb = args[args.length - 1]; if (typeof cb === 'function') { - args[args.length - 1] = context.bind(cb, parentContext); + args[args.length - 1] = context.bind(parentContext, cb); } const request: http.ClientRequest = safeExecuteInTheMiddle( @@ -563,8 +569,8 @@ export class HttpInstrumentation extends InstrumentationBase { } ); - diag.debug('%s instrumentation outgoingRequest', component); - context.bind(request, parentContext); + instrumentation._diag.debug('%s instrumentation outgoingRequest', component); + context.bind(parentContext, request); return instrumentation._traceClientRequest( component, request, @@ -590,13 +596,11 @@ export class HttpInstrumentation extends InstrumentationBase { : this._getConfig().requireParentforIncomingSpans; let span: Span; - const currentSpan = getSpan(ctx); + const currentSpan = trace.getSpan(ctx); if (requireParent === true && currentSpan === undefined) { - // TODO: Refactor this when a solution is found in - // https://github.com/open-telemetry/opentelemetry-specification/issues/530 - span = NOOP_TRACER.startSpan(name, options, ctx); - } else if (requireParent === true && currentSpan?.context().isRemote) { + span = trace.wrapSpanContext(INVALID_SPAN_CONTEXT); + } else if (requireParent === true && currentSpan?.spanContext().isRemote) { span = currentSpan; } else { span = this.tracer.startSpan(name, options, ctx); diff --git a/packages/opentelemetry-instrumentation-http/src/utils.ts b/packages/opentelemetry-instrumentation-http/src/utils.ts index 769bdac29f..fa1c55362a 100644 --- a/packages/opentelemetry-instrumentation-http/src/utils.ts +++ b/packages/opentelemetry-instrumentation-http/src/utils.ts @@ -18,6 +18,7 @@ import { SpanStatusCode, Span, SpanStatus, + context, } from '@opentelemetry/api'; import { NetTransportValues, @@ -31,7 +32,7 @@ import { RequestOptions, ServerResponse, } from 'http'; -import { Socket } from 'net'; +import { getRPCMetadata, RPCType } from '@opentelemetry/core'; import * as url from 'url'; import { AttributeNames } from './enums/AttributeNames'; import { Err, IgnoreMatcher, ParsedRequestOptions } from './types'; @@ -465,25 +466,15 @@ export const getIncomingRequestAttributes = ( * @param {(ServerResponse & { socket: Socket; })} response the response object */ export const getIncomingRequestAttributesOnResponse = ( - request: IncomingMessage & { __ot_middlewares?: string[] }, - response: ServerResponse & { socket: Socket } + request: IncomingMessage, + response: ServerResponse ): SpanAttributes => { // take socket from the request, // since it may be detached from the response object in keep-alive mode const { socket } = request; const { statusCode, statusMessage } = response; const { localAddress, localPort, remoteAddress, remotePort } = socket; - const { __ot_middlewares } = (request as unknown) as { - [key: string]: unknown; - }; - const route = Array.isArray(__ot_middlewares) - ? __ot_middlewares - .filter(path => path !== '/') - .map(path => { - return path[0] === '/' ? path : '/' + path; - }) - .join('') - : undefined; + const rpcMetadata = getRPCMetadata(context.active()); const attributes: SpanAttributes = { [SemanticAttributes.NET_HOST_IP]: localAddress, @@ -494,8 +485,8 @@ export const getIncomingRequestAttributesOnResponse = ( [AttributeNames.HTTP_STATUS_TEXT]: (statusMessage || '').toUpperCase(), }; - if (route !== undefined) { - attributes[SemanticAttributes.HTTP_ROUTE] = route; + if (rpcMetadata?.type === RPCType.HTTP && rpcMetadata.route !== undefined) { + attributes[SemanticAttributes.HTTP_ROUTE] = rpcMetadata.route; } return attributes; }; diff --git a/packages/opentelemetry-instrumentation-http/src/version.ts b/packages/opentelemetry-instrumentation-http/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-instrumentation-http/src/version.ts +++ b/packages/opentelemetry-instrumentation-http/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-instrumentation-http/test/fixtures/regenerate.sh b/packages/opentelemetry-instrumentation-http/test/fixtures/regenerate.sh new file mode 100755 index 0000000000..af9c63e310 --- /dev/null +++ b/packages/opentelemetry-instrumentation-http/test/fixtures/regenerate.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env sh +# +# Usage: regenerate.sh +# +# regenerate.sh regenerates private key and certificate used in https tests and example +# + +EXAMPLE_DIR="../../../../examples/https" +openssl req -x509 -nodes -newkey rsa -keyout server-key.pem -out server-cert.pem -days 3650 -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Root/OU=Test/CN=ca" +cp ./server-*.pem "$EXAMPLE_DIR/" diff --git a/packages/opentelemetry-instrumentation-http/test/fixtures/server-cert.pem b/packages/opentelemetry-instrumentation-http/test/fixtures/server-cert.pem index e2b79024da..4dd904f088 100644 --- a/packages/opentelemetry-instrumentation-http/test/fixtures/server-cert.pem +++ b/packages/opentelemetry-instrumentation-http/test/fixtures/server-cert.pem @@ -1,11 +1,22 @@ -----BEGIN CERTIFICATE----- -MIIBqzCCARQCCQDLcUeJsLDL5jANBgkqhkiG9w0BAQUFADAaMQswCQYDVQQGEwJD -QTELMAkGA1UECAwCUUMwHhcNMTkwOTI5MjIwMDI2WhcNMTkxMDI5MjIwMDI2WjAa -MQswCQYDVQQGEwJDQTELMAkGA1UECAwCUUMwgZ8wDQYJKoZIhvcNAQEBBQADgY0A -MIGJAoGBALhfi1dwIyC1Jha4N/j/VtlPPi+j+SZQGZqLNVVgzzGY7+cc3VkCySZD -yXh3Z+/ftp9DDKdHRutJQE0R4peSDussC/IQDJKzuKN/O9S6tnNlgUr5YZLRENxL -FSJIY5cIkty50IrEhlN5QeDJP8p4yrYq9J6M0yzyfdqIWI3CBqbzAgMBAAEwDQYJ -KoZIhvcNAQEFBQADgYEArnOeXmXXJTK39Ma25elHxlYUZiYOBu/truy5zmx4umyS -GyehAv+jRIanoCRWtOBnrjS5CY/6cC64aIVLMoqXEFIL7q/GD0wEM/DS8rN7KTcp -w+nIX98srYaAFeQZScPioS6WpXz5Ajb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MpB +Bh0QajFT6gdQiuURqTmxAhNj4VrUqtrNapP8vFKerR7nTrORG0ELEcvzVYCLNvDm +OYWvLEMZifNWKY6hRdhZXho5hfu7/YPUhZUpcSxkTUsDnG3gzkTyX1TzeWe7wlJr +dtNIk50lUCR6TlSpTaVB+6uhVjaLZpZwBAT5H0dWQXm0Ww5AYsEAT9Uzh9fZYu4m +iMhztKH3PWjDB+jSzcOv9FXeYWgprWk= -----END CERTIFICATE----- diff --git a/packages/opentelemetry-instrumentation-http/test/fixtures/server-key.pem b/packages/opentelemetry-instrumentation-http/test/fixtures/server-key.pem index 405c5fa0d7..267ed0464e 100644 --- a/packages/opentelemetry-instrumentation-http/test/fixtures/server-key.pem +++ b/packages/opentelemetry-instrumentation-http/test/fixtures/server-key.pem @@ -1,15 +1,28 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQC4X4tXcCMgtSYWuDf4/1bZTz4vo/kmUBmaizVVYM8xmO/nHN1Z -AskmQ8l4d2fv37afQwynR0brSUBNEeKXkg7rLAvyEAySs7ijfzvUurZzZYFK+WGS -0RDcSxUiSGOXCJLcudCKxIZTeUHgyT/KeMq2KvSejNMs8n3aiFiNwgam8wIDAQAB -AoGBAKBztcYQduGeBFm9VCjDvgc8KTg4kTlAeCfAglec+nOFTzJoMlGmVPuR/qFx -+OgOXtXW+goRw6w7gVQQ/os9tvCCp7awSC5UCfPejHh6bW2B0BF2lZJ6B9y+u5Fa -/p8oKoJGcC4eagVnDojuoYJHSqWBf7d7V/U54NpxwgBTsHAhAkEA8PJROgWzjMl2 -Gs5j8oBldEqzrC/d4K1uMEvCTb4RJ+t6jWq+Ug/vqvCfIcLfxHbOmTbOHTfhpv/d -NUf9eDyBGwJBAMPkZaHP5vPDd900MqypLVasollzxgPnMUg35EEQJLAbb/5xG3X9 -ZbaVDTRtLQYNFvDZLlTpRpCPxZCgrn9hJwkCQQDPEVChLrkpqxFm5CydAZ8vG+vh -dJmYNzPVKaZorYmM5yBBXJUHb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Nbgfgh12dC6OX7NzJx +3Ds4NW8DvcZ3mVq8iEiOZnX5ydeeYMetlDWhXx2/0be5vqmrUkkWdfXsFUCyS8Lw +vGRc9BiNqFePg2HsoVd2tezrwwKBgQDFb/eef/nOM1Eq5h+u+0Pyyg07iRuxxNup +YXY9hwNJyF+NUoIWx2Jfyh+dQfMC18g/4hN4Hwfm/nC85SkPheKJnXYgMWMXp2Y7 +PBgdZGCX/546xiS5VGAoRuLd8oO2AlDfgU4tw6U0WZguJ6hMXlePlKz/uAJ237FB +gcPyGNeY2wKBgQDOD4038zInolk75YYHxzFm78X55ZETtipBTLzyGjXLD4SvUM4U +uXEbjQsL9q2ztJbbsPTujU8u3DYeS9GY81hD8kjRnc0LeDt05JJtNu/vfYs+uXKb +h39nyEfzhHlapi/U5lmyTtDbCm5emTvxxvvsxmBcaH3UOhXYk7amEJ3/xQKBgA+s +svj3agqv0krYmD1ZH2zgE6rdWMCFQ3cwEKYT2PP7n3Jl0YQjcjDuqBHhEXzxSqmf +tjH8LLFvE947R0Y/N9v7D0zA/v/6v0gGnld/B5gpqBM8dd/szfGEpzA9t600g90q +s904Qh5k2osXhOoDN2pjwFRQ9Ikhez4bIkZPKJavAoGAV2YPXyw5rrAZtCtybqsO +B+15Lh+KC+vs0rBBhb0MUpXQPgQ6SX8ozpLHtqlsUpNfHwOk5K958jMrM9Rx4dhS +Z6WuTa+9QpmXzYTnCDBbEU06+YB1QR2QfU4BlAAu1RtUbbt84/7OAoNh2IqOO4XJ +THlhj8odimsk4R1B0RipBis= +-----END PRIVATE KEY----- diff --git a/packages/opentelemetry-instrumentation-http/test/functionals/http-disable.test.ts b/packages/opentelemetry-instrumentation-http/test/functionals/http-disable.test.ts index 9e29f54255..b52b045109 100644 --- a/packages/opentelemetry-instrumentation-http/test/functionals/http-disable.test.ts +++ b/packages/opentelemetry-instrumentation-http/test/functionals/http-disable.test.ts @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { NoopTracerProvider, NOOP_TRACER } from '@opentelemetry/api'; import * as assert from 'assert'; import { HttpInstrumentation } from '../../src/http'; import { AddressInfo } from 'net'; @@ -27,14 +26,24 @@ instrumentation.enable(); instrumentation.disable(); import * as http from 'http'; +import { trace, TracerProvider, INVALID_SPAN_CONTEXT } from '@opentelemetry/api'; + describe('HttpInstrumentation', () => { let server: http.Server; let serverPort = 0; describe('disable()', () => { - const provider = new NoopTracerProvider(); + let provider: TracerProvider; + let startSpanStub: sinon.SinonStub; + before(() => { + provider = { + getTracer: () => { + startSpanStub = sinon.stub().returns(trace.wrapSpanContext(INVALID_SPAN_CONTEXT)); + return { startSpan: startSpanStub } as any; + } + }; nock.cleanAll(); nock.enableNetConnect(); instrumentation.enable(); @@ -51,10 +60,6 @@ describe('HttpInstrumentation', () => { }); }); - beforeEach(() => { - sinon.spy(NOOP_TRACER, 'startSpan'); - }); - afterEach(() => { sinon.restore(); }); @@ -71,11 +76,8 @@ describe('HttpInstrumentation', () => { const options = { host: 'localhost', path: testPath, port: serverPort }; - await httpRequest.get(options).then(result => { - assert.strictEqual( - (NOOP_TRACER.startSpan as sinon.SinonSpy).called, - false - ); + await httpRequest.get(options).then(() => { + sinon.assert.notCalled(startSpanStub); }); }); }); diff --git a/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts b/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts index 2361b26756..218dbf2f4d 100644 --- a/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts +++ b/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts @@ -18,9 +18,7 @@ import { context, propagation, Span as ISpan, - SpanKind, - getSpan, - setSpan, + SpanKind, trace, } from '@opentelemetry/api'; import { NodeTracerProvider } from '@opentelemetry/node'; import { @@ -43,6 +41,7 @@ import { ContextManager } from '@opentelemetry/api'; import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks'; import type { ClientRequest, IncomingMessage, ServerResponse } from 'http'; import { isWrapped } from '@opentelemetry/instrumentation'; +import { getRPCMetadata, RPCType } from '@opentelemetry/core'; const instrumentation = new HttpInstrumentation(); instrumentation.enable(); @@ -332,7 +331,7 @@ describe('HttpInstrumentation', () => { doNock(hostname, testPath, 200, 'Ok'); const name = 'TestRootSpan'; const span = provider.getTracer('default').startSpan(name); - return context.with(setSpan(context.active(), span), async () => { + return context.with(trace.setSpan(context.active(), span), async () => { const result = await httpRequest.get( `${protocol}://${hostname}${testPath}` ); @@ -353,13 +352,13 @@ describe('HttpInstrumentation', () => { assert.strictEqual(spans.length, 2); assert.strictEqual(reqSpan.name, 'HTTP GET'); assert.strictEqual( - localSpan.spanContext.traceId, - reqSpan.spanContext.traceId + localSpan.spanContext().traceId, + reqSpan.spanContext().traceId ); assertSpan(reqSpan, SpanKind.CLIENT, validations); assert.notStrictEqual( - localSpan.spanContext.spanId, - reqSpan.spanContext.spanId + localSpan.spanContext().spanId, + reqSpan.spanContext().spanId ); }); }); @@ -375,7 +374,7 @@ describe('HttpInstrumentation', () => { ); const name = 'TestRootSpan'; const span = provider.getTracer('default').startSpan(name); - return context.with(setSpan(context.active(), span), async () => { + return context.with(trace.setSpan(context.active(), span), async () => { const result = await httpRequest.get( `${protocol}://${hostname}${testPath}` ); @@ -396,13 +395,13 @@ describe('HttpInstrumentation', () => { assert.strictEqual(spans.length, 2); assert.strictEqual(reqSpan.name, 'HTTP GET'); assert.strictEqual( - localSpan.spanContext.traceId, - reqSpan.spanContext.traceId + localSpan.spanContext().traceId, + reqSpan.spanContext().traceId ); assertSpan(reqSpan, SpanKind.CLIENT, validations); assert.notStrictEqual( - localSpan.spanContext.spanId, - reqSpan.spanContext.spanId + localSpan.spanContext().spanId, + reqSpan.spanContext().spanId ); }); }); @@ -414,14 +413,14 @@ describe('HttpInstrumentation', () => { doNock(hostname, testPath, 200, 'Ok', num); const name = 'TestRootSpan'; const span = provider.getTracer('default').startSpan(name); - await context.with(setSpan(context.active(), span), async () => { + await context.with(trace.setSpan(context.active(), span), async () => { for (let i = 0; i < num; i++) { await httpRequest.get(`${protocol}://${hostname}${testPath}`); const spans = memoryExporter.getFinishedSpans(); assert.strictEqual(spans[i].name, 'HTTP GET'); assert.strictEqual( - span.context().traceId, - spans[i].spanContext.traceId + span.spanContext().traceId, + spans[i].spanContext().traceId ); } span.end(); @@ -706,16 +705,16 @@ describe('HttpInstrumentation', () => { }); it('should not set span as active in context for outgoing request', done => { - assert.deepStrictEqual(getSpan(context.active()), undefined); + assert.deepStrictEqual(trace.getSpan(context.active()), undefined); http.get(`${protocol}://${hostname}:${serverPort}/test`, res => { - assert.deepStrictEqual(getSpan(context.active()), undefined); + assert.deepStrictEqual(trace.getSpan(context.active()), undefined); res.on('data', () => { - assert.deepStrictEqual(getSpan(context.active()), undefined); + assert.deepStrictEqual(trace.getSpan(context.active()), undefined); }); res.on('end', () => { - assert.deepStrictEqual(getSpan(context.active()), undefined); + assert.deepStrictEqual(trace.getSpan(context.active()), undefined); done(); }); }); @@ -813,7 +812,7 @@ describe('HttpInstrumentation', () => { const span = tracer.startSpan('parentSpan', { kind: SpanKind.INTERNAL, }); - context.with(setSpan(context.active(), span), () => { + context.with(trace.setSpan(context.active(), span), () => { httpRequest .get(`${protocol}://${hostname}:${serverPort}${testPath}`) .then(result => { @@ -842,5 +841,32 @@ describe('HttpInstrumentation', () => { }); }); }); + describe('rpc metadata', () => { + beforeEach(() => { + memoryExporter.reset(); + instrumentation.setConfig({ requireParentforOutgoingSpans: true }); + instrumentation.enable(); + }); + + afterEach(() => { + server.close(); + instrumentation.disable(); + }); + + it('should set rpc metadata for incoming http request', async () => { + server = http.createServer((request, response) => { + const rpcMemadata = getRPCMetadata(context.active()); + assert(typeof rpcMemadata !== 'undefined'); + assert(rpcMemadata.type === RPCType.HTTP); + assert(rpcMemadata.span.setAttribute('key', 'value')); + response.end('Test Server Response'); + }); + await new Promise(resolve => server.listen(serverPort, resolve)); + await httpRequest.get(`${protocol}://${hostname}:${serverPort}`); + const spans = memoryExporter.getFinishedSpans(); + assert.strictEqual(spans.length, 1); + assert.strictEqual(spans[0].attributes.key, 'value'); + }); + }); }); }); diff --git a/packages/opentelemetry-instrumentation-http/test/functionals/https-disable.test.ts b/packages/opentelemetry-instrumentation-http/test/functionals/https-disable.test.ts index f7ce5e1dcc..c09b1742d2 100644 --- a/packages/opentelemetry-instrumentation-http/test/functionals/https-disable.test.ts +++ b/packages/opentelemetry-instrumentation-http/test/functionals/https-disable.test.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import { NoopTracerProvider, NOOP_TRACER } from '@opentelemetry/api'; import * as assert from 'assert'; import * as fs from 'fs'; import type { AddressInfo } from 'net'; @@ -29,14 +28,23 @@ instrumentation.disable(); import * as https from 'https'; import { httpsRequest } from '../utils/httpsRequest'; +import { INVALID_SPAN_CONTEXT, trace, TracerProvider } from '@opentelemetry/api'; describe('HttpsInstrumentation', () => { let server: https.Server; let serverPort = 0; describe('disable()', () => { - const provider = new NoopTracerProvider(); + let provider: TracerProvider; + let startSpanStub: sinon.SinonStub; + before(() => { + provider = { + getTracer: () => { + startSpanStub = sinon.stub().returns(trace.wrapSpanContext(INVALID_SPAN_CONTEXT)); + return { startSpan: startSpanStub } as any; + } + }; nock.cleanAll(); nock.enableNetConnect(); @@ -60,10 +68,6 @@ describe('HttpsInstrumentation', () => { }); }); - beforeEach(() => { - sinon.spy(NOOP_TRACER, 'startSpan'); - }); - afterEach(() => { sinon.restore(); }); @@ -78,12 +82,8 @@ describe('HttpsInstrumentation', () => { const options = { host: 'localhost', path: testPath, port: serverPort }; - await httpsRequest.get(options).then(result => { - assert.strictEqual( - (NOOP_TRACER.startSpan as sinon.SinonSpy).called, - false - ); - + await httpsRequest.get(options).then(() => { + sinon.assert.notCalled(startSpanStub); assert.strictEqual(isWrapped(https.Server.prototype.emit), false); }); }); diff --git a/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts b/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts index fe473f408f..3b9fa505d1 100644 --- a/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts +++ b/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts @@ -20,7 +20,7 @@ import { propagation, Span as ISpan, SpanKind, - setSpan, + trace, } from '@opentelemetry/api'; import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks'; import { ContextManager } from '@opentelemetry/api'; @@ -312,7 +312,7 @@ describe('HttpsInstrumentation', () => { doNock(hostname, testPath, 200, 'Ok'); const name = 'TestRootSpan'; const span = tracer.startSpan(name); - return context.with(setSpan(context.active(), span), async () => { + return context.with(trace.setSpan(context.active(), span), async () => { const result = await httpsRequest.get( `${protocol}://${hostname}${testPath}` ); @@ -333,13 +333,13 @@ describe('HttpsInstrumentation', () => { assert.strictEqual(spans.length, 2); assert.strictEqual(reqSpan.name, 'HTTPS GET'); assert.strictEqual( - localSpan.spanContext.traceId, - reqSpan.spanContext.traceId + localSpan.spanContext().traceId, + reqSpan.spanContext().traceId ); assertSpan(reqSpan, SpanKind.CLIENT, validations); assert.notStrictEqual( - localSpan.spanContext.spanId, - reqSpan.spanContext.spanId + localSpan.spanContext().spanId, + reqSpan.spanContext().spanId ); }); }); @@ -355,7 +355,7 @@ describe('HttpsInstrumentation', () => { ); const name = 'TestRootSpan'; const span = tracer.startSpan(name); - return context.with(setSpan(context.active(), span), async () => { + return context.with(trace.setSpan(context.active(), span), async () => { const result = await httpsRequest.get( `${protocol}://${hostname}${testPath}` ); @@ -376,13 +376,13 @@ describe('HttpsInstrumentation', () => { assert.strictEqual(spans.length, 2); assert.strictEqual(reqSpan.name, 'HTTPS GET'); assert.strictEqual( - localSpan.spanContext.traceId, - reqSpan.spanContext.traceId + localSpan.spanContext().traceId, + reqSpan.spanContext().traceId ); assertSpan(reqSpan, SpanKind.CLIENT, validations); assert.notStrictEqual( - localSpan.spanContext.spanId, - reqSpan.spanContext.spanId + localSpan.spanContext().spanId, + reqSpan.spanContext().spanId ); }); }); @@ -394,14 +394,14 @@ describe('HttpsInstrumentation', () => { doNock(hostname, testPath, 200, 'Ok', num); const name = 'TestRootSpan'; const span = tracer.startSpan(name); - await context.with(setSpan(context.active(), span), async () => { + await context.with(trace.setSpan(context.active(), span), async () => { for (let i = 0; i < num; i++) { await httpsRequest.get(`${protocol}://${hostname}${testPath}`); const spans = memoryExporter.getFinishedSpans(); assert.strictEqual(spans[i].name, 'HTTPS GET'); assert.strictEqual( - span.context().traceId, - spans[i].spanContext.traceId + span.spanContext().traceId, + spans[i].spanContext().traceId ); } span.end(); diff --git a/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts b/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts index 570b9b2a47..b0a659950e 100644 --- a/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts +++ b/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts @@ -19,6 +19,7 @@ import { ROOT_CONTEXT, SpanKind, TraceFlags, + context, } from '@opentelemetry/api'; import { BasicTracerProvider, Span } from '@opentelemetry/tracing'; import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; @@ -31,6 +32,8 @@ import * as url from 'url'; import { IgnoreMatcher } from '../../src/types'; import * as utils from '../../src/utils'; import { AttributeNames } from '../../src/enums/AttributeNames'; +import { RPCType, setRPCMetadata } from '@opentelemetry/core'; +import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks'; describe('Utility', () => { describe('parseResponseStatus()', () => { @@ -285,16 +288,30 @@ describe('Utility', () => { }); describe('getIncomingRequestAttributesOnResponse()', () => { - it('should correctly parse the middleware stack if present', () => { + it('should correctly parse the middleware stack if present', done => { + context.setGlobalContextManager(new AsyncHooksContextManager().enable()); const request = { - __ot_middlewares: ['/test', '/toto', '/'], socket: {}, - } as IncomingMessage & { __ot_middlewares?: string[] }; - - const attributes = utils.getIncomingRequestAttributesOnResponse(request, { - socket: {}, - } as ServerResponse & { socket: Socket }); - assert.deepEqual(attributes[SemanticAttributes.HTTP_ROUTE], '/test/toto'); + } as IncomingMessage; + context.with( + setRPCMetadata(context.active(), { + type: RPCType.HTTP, + route: '/user/:id', + span: (null as unknown) as Span, + }), + () => { + const attributes = utils.getIncomingRequestAttributesOnResponse( + request, + {} as ServerResponse + ); + assert.deepStrictEqual( + attributes[SemanticAttributes.HTTP_ROUTE], + '/user/:id' + ); + context.disable(); + return done(); + } + ); }); it('should succesfully process without middleware stack', () => { diff --git a/packages/opentelemetry-instrumentation-http/test/utils/DummyPropagation.ts b/packages/opentelemetry-instrumentation-http/test/utils/DummyPropagation.ts index 7ce15eaf7f..4dbda67c16 100644 --- a/packages/opentelemetry-instrumentation-http/test/utils/DummyPropagation.ts +++ b/packages/opentelemetry-instrumentation-http/test/utils/DummyPropagation.ts @@ -15,10 +15,8 @@ */ import { Context, - TextMapPropagator, + TextMapPropagator, trace, TraceFlags, - getSpanContext, - setSpanContext, } from '@opentelemetry/api'; import type * as http from 'http'; @@ -33,12 +31,12 @@ export class DummyPropagation implements TextMapPropagator { isRemote: true, }; if (extractedSpanContext.traceId && extractedSpanContext.spanId) { - return setSpanContext(context, extractedSpanContext); + return trace.setSpanContext(context, extractedSpanContext); } return context; } inject(context: Context, headers: { [custom: string]: string }): void { - const spanContext = getSpanContext(context); + const spanContext = trace.getSpanContext(context); if (!spanContext) return; headers[DummyPropagation.TRACE_CONTEXT_KEY] = spanContext.traceId; headers[DummyPropagation.SPAN_CONTEXT_KEY] = spanContext.spanId; diff --git a/packages/opentelemetry-instrumentation-http/test/utils/assertSpan.ts b/packages/opentelemetry-instrumentation-http/test/utils/assertSpan.ts index 97af42abee..91263eb945 100644 --- a/packages/opentelemetry-instrumentation-http/test/utils/assertSpan.ts +++ b/packages/opentelemetry-instrumentation-http/test/utils/assertSpan.ts @@ -39,8 +39,8 @@ export const assertSpan = ( component: string; } ) => { - assert.strictEqual(span.spanContext.traceId.length, 32); - assert.strictEqual(span.spanContext.spanId.length, 16); + assert.strictEqual(span.spanContext().traceId.length, 32); + assert.strictEqual(span.spanContext().spanId.length, 16); assert.strictEqual(span.kind, kind); assert.strictEqual( span.name, diff --git a/packages/opentelemetry-instrumentation-xml-http-request/package.json b/packages/opentelemetry-instrumentation-xml-http-request/package.json index af7cf75d35..1e781f8fc6 100644 --- a/packages/opentelemetry-instrumentation-xml-http-request/package.json +++ b/packages/opentelemetry-instrumentation-xml-http-request/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-xml-http-request", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry XMLHttpRequest automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -47,24 +47,23 @@ }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/context-zone": "0.19.0", - "@opentelemetry/propagator-b3": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/api": "^1.0.0", + "@opentelemetry/context-zone": "0.21.0", + "@opentelemetry/propagator-b3": "0.21.0", + "@opentelemetry/tracing": "0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", "@types/webpack-env": "1.16.0", "babel-loader": "8.2.2", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", "karma-spec-reporter": "0.0.32", - "karma-webpack": "5.0.0", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", @@ -72,18 +71,18 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0", "webpack-cli": "4.6.0", "webpack-merge": "5.7.3" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0", - "@opentelemetry/web": "0.19.0" + "@opentelemetry/core": "0.21.0", + "@opentelemetry/instrumentation": "0.21.0", + "@opentelemetry/semantic-conventions": "0.21.0", + "@opentelemetry/web": "0.21.0" } } diff --git a/packages/opentelemetry-instrumentation-xml-http-request/src/version.ts b/packages/opentelemetry-instrumentation-xml-http-request/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-instrumentation-xml-http-request/src/version.ts +++ b/packages/opentelemetry-instrumentation-xml-http-request/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-instrumentation-xml-http-request/src/xhr.ts b/packages/opentelemetry-instrumentation-xml-http-request/src/xhr.ts index fb7274cdce..1b5ade2660 100644 --- a/packages/opentelemetry-instrumentation-xml-http-request/src/xhr.ts +++ b/packages/opentelemetry-instrumentation-xml-http-request/src/xhr.ts @@ -118,7 +118,7 @@ export class XMLHttpRequestInstrumentation extends InstrumentationBase> = {}; api.propagation.inject(api.context.active(), headers); if (Object.keys(headers).length > 0) { - api.diag.debug('headers inject skipped due to CORS policy'); + this._diag.debug('headers inject skipped due to CORS policy'); } return; } @@ -139,7 +139,7 @@ export class XMLHttpRequestInstrumentation extends InstrumentationBase { + api.context.with(api.trace.setSpan(api.context.active(), span), () => { const childSpan = this.tracer.startSpan('CORS Preflight', { startTime: corsPreFlightRequest[PTN.FETCH_START], }); @@ -190,7 +190,7 @@ export class XMLHttpRequestInstrumentation extends InstrumentationBase { plugin._tasksCount++; xhrMem.sendStartTime = hrTime(); @@ -510,17 +510,17 @@ export class XMLHttpRequestInstrumentation extends InstrumentationBase { ); rootSpan = webTracerWithZone.startSpan('root'); - api.context.with(api.setSpan(api.context.active(), rootSpan), () => { + api.context.with(api.trace.setSpan(api.context.active(), rootSpan), () => { getData( new XMLHttpRequest(), fileUrl, @@ -270,7 +270,7 @@ describe('xhr', () => { const span: tracing.ReadableSpan = exportSpy.args[1][0][0]; assert.strictEqual( span.parentSpanId, - rootSpan.context().spanId, + rootSpan.spanContext().spanId, 'parent span is not root span' ); }); @@ -408,7 +408,7 @@ describe('xhr', () => { const parentSpan: tracing.ReadableSpan = exportSpy.args[1][0][0]; assert.strictEqual( span.parentSpanId, - parentSpan.spanContext.spanId, + parentSpan.spanContext().spanId, 'parent span is not root span' ); }); @@ -504,17 +504,17 @@ describe('xhr', () => { const span: api.Span = exportSpy.args[0][0][0]; assert.strictEqual( requests[0].requestHeaders[X_B3_TRACE_ID], - span.context().traceId, + span.spanContext().traceId, `trace header '${X_B3_TRACE_ID}' not set` ); assert.strictEqual( requests[0].requestHeaders[X_B3_SPAN_ID], - span.context().spanId, + span.spanContext().spanId, `trace header '${X_B3_SPAN_ID}' not set` ); assert.strictEqual( requests[0].requestHeaders[X_B3_SAMPLED], - String(span.context().traceFlags), + String(span.spanContext().traceFlags), `trace header '${X_B3_SAMPLED}' not set` ); }); @@ -537,17 +537,17 @@ describe('xhr', () => { const span: api.Span = exportSpy.args[1][0][0]; assert.strictEqual( requests[0].requestHeaders[X_B3_TRACE_ID], - span.context().traceId, + span.spanContext().traceId, `trace header '${X_B3_TRACE_ID}' not set` ); assert.strictEqual( requests[0].requestHeaders[X_B3_SPAN_ID], - span.context().spanId, + span.spanContext().spanId, `trace header '${X_B3_SPAN_ID}' not set` ); assert.strictEqual( requests[0].requestHeaders[X_B3_SAMPLED], - String(span.context().traceFlags), + String(span.spanContext().traceFlags), `trace header '${X_B3_SAMPLED}' not set` ); }); @@ -589,7 +589,7 @@ describe('xhr', () => { it('should debug info that injecting headers was skipped', () => { assert.strictEqual( - spyDebug.lastCall.args[0], + spyDebug.lastCall.args[1], 'headers inject skipped due to CORS policy' ); }); @@ -646,7 +646,7 @@ describe('xhr', () => { ); const reusableReq = new XMLHttpRequest(); api.context.with( - api.setSpan(api.context.active(), rootSpan), + api.trace.setSpan(api.context.active(), rootSpan), () => { getData( reusableReq, @@ -663,7 +663,7 @@ describe('xhr', () => { ); api.context.with( - api.setSpan(api.context.active(), rootSpan), + api.trace.setSpan(api.context.active(), rootSpan), () => { getData( reusableReq, @@ -793,7 +793,7 @@ describe('xhr', () => { }); function timedOutRequest(done: any) { - api.context.with(api.setSpan(api.context.active(), rootSpan), () => { + api.context.with(api.trace.setSpan(api.context.active(), rootSpan), () => { void getData( new XMLHttpRequest(), url, @@ -810,7 +810,7 @@ describe('xhr', () => { } function abortedRequest(done: any) { - api.context.with(api.setSpan(api.context.active(), rootSpan), () => { + api.context.with(api.trace.setSpan(api.context.active(), rootSpan), () => { void getData(new XMLHttpRequest(), url, () => {}, testAsync).then( () => { fakeNow = 0; @@ -825,7 +825,7 @@ describe('xhr', () => { } function erroredRequest(done: any) { - api.context.with(api.setSpan(api.context.active(), rootSpan), () => { + api.context.with(api.trace.setSpan(api.context.active(), rootSpan), () => { void getData( new XMLHttpRequest(), url, @@ -848,7 +848,7 @@ describe('xhr', () => { } function networkErrorRequest(done: any) { - api.context.with(api.setSpan(api.context.active(), rootSpan), () => { + api.context.with(api.trace.setSpan(api.context.active(), rootSpan), () => { void getData(new XMLHttpRequest(), url, () => {}, testAsync).then( () => { fakeNow = 0; diff --git a/packages/opentelemetry-instrumentation/package.json b/packages/opentelemetry-instrumentation/package.json index 409397964b..a918bacfd4 100644 --- a/packages/opentelemetry-instrumentation/package.json +++ b/packages/opentelemetry-instrumentation/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation", - "version": "0.19.0", + "version": "0.21.0", "description": "Base class for node which OpenTelemetry instrumentation modules extend", "author": "OpenTelemetry Authors", "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme", @@ -59,17 +59,17 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/api-metrics": "0.19.0", + "@opentelemetry/api-metrics": "0.21.0", "require-in-the-middle": "^5.0.3", "semver": "^7.3.2", "shimmer": "^1.2.1" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^1.0.0-rc.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/semver": "7.3.5", @@ -77,16 +77,15 @@ "@types/sinon": "9.0.11", "@types/webpack-env": "1.16.0", "babel-loader": "8.2.2", - "codecov": "3.8.1", + "codecov": "3.8.2", "cpx": "1.5.0", - "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", "karma-spec-reporter": "0.0.32", - "karma-webpack": "5.0.0", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", @@ -94,7 +93,7 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0", "webpack-cli": "4.6.0", "webpack-merge": "5.7.3" diff --git a/packages/opentelemetry-instrumentation/src/instrumentation.ts b/packages/opentelemetry-instrumentation/src/instrumentation.ts index 091271d952..56779a5e64 100644 --- a/packages/opentelemetry-instrumentation/src/instrumentation.ts +++ b/packages/opentelemetry-instrumentation/src/instrumentation.ts @@ -14,7 +14,13 @@ * limitations under the License. */ -import { TracerProvider, Tracer, trace } from '@opentelemetry/api'; +import { + diag, + DiagLogger, + trace, + Tracer, + TracerProvider, +} from '@opentelemetry/api'; import { Meter, MeterProvider, metrics } from '@opentelemetry/api-metrics'; import * as shimmer from 'shimmer'; import { InstrumentationModuleDefinition } from './platform/node'; @@ -29,6 +35,7 @@ export abstract class InstrumentationAbstract private _tracer: Tracer; private _meter: Meter; + protected _diag: DiagLogger; constructor( public readonly instrumentationName: string, @@ -40,6 +47,10 @@ export abstract class InstrumentationAbstract ...config, }; + this._diag = diag.createComponentLogger({ + namespace: instrumentationName, + }); + this._tracer = trace.getTracer(instrumentationName, instrumentationVersion); this._meter = metrics.getMeter(instrumentationName, instrumentationVersion); @@ -70,6 +81,19 @@ export abstract class InstrumentationAbstract ); } + /* Returns InstrumentationConfig */ + public getConfig() { + return this._config; + } + + /** + * Sets InstrumentationConfig to this plugin + * @param InstrumentationConfig + */ + public setConfig(config: types.InstrumentationConfig = {}) { + this._config = Object.assign({}, config); + } + /** * Sets TraceProvider to this plugin * @param tracerProvider diff --git a/packages/opentelemetry-instrumentation/src/platform/browser/instrumentation.ts b/packages/opentelemetry-instrumentation/src/platform/browser/instrumentation.ts index aec1ae3010..3f19df8ac5 100644 --- a/packages/opentelemetry-instrumentation/src/platform/browser/instrumentation.ts +++ b/packages/opentelemetry-instrumentation/src/platform/browser/instrumentation.ts @@ -24,8 +24,8 @@ export abstract class InstrumentationBase extends InstrumentationAbstract implements types.Instrumentation { constructor( - readonly instrumentationName: string, - readonly instrumentationVersion: string, + instrumentationName: string, + instrumentationVersion: string, config: types.InstrumentationConfig = {} ) { super(instrumentationName, instrumentationVersion, config); diff --git a/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts b/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts index 98900383ff..f50cff4252 100644 --- a/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts +++ b/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts @@ -73,6 +73,7 @@ export abstract class InstrumentationBase return exports; } + // eslint-disable-next-line @typescript-eslint/no-var-requires const version = require(path.join(baseDir, 'package.json')).version; module.moduleVersion = version; if (module.name === name) { diff --git a/packages/opentelemetry-instrumentation/src/types.ts b/packages/opentelemetry-instrumentation/src/types.ts index 4d54f7d02e..4ed6febf10 100644 --- a/packages/opentelemetry-instrumentation/src/types.ts +++ b/packages/opentelemetry-instrumentation/src/types.ts @@ -44,6 +44,12 @@ export interface Instrumentation { /** Method to set meter provider */ setMeterProvider(meterProvider: MeterProvider): void; + /** Method to set instrumentation config */ + setConfig(config: InstrumentationConfig): void; + + /** Method to get instrumentation config */ + getConfig(): InstrumentationConfig; + /** * Contains all supported versions. * All versions must be compatible with [semver](https://semver.org/spec/v2.0.0.html) format. diff --git a/packages/opentelemetry-instrumentation/src/version.ts b/packages/opentelemetry-instrumentation/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-instrumentation/src/version.ts +++ b/packages/opentelemetry-instrumentation/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-instrumentation/test/common/Instrumentation.test.ts b/packages/opentelemetry-instrumentation/test/common/Instrumentation.test.ts index 8324c01cd0..ac0c5b0a90 100644 --- a/packages/opentelemetry-instrumentation/test/common/Instrumentation.test.ts +++ b/packages/opentelemetry-instrumentation/test/common/Instrumentation.test.ts @@ -15,14 +15,22 @@ */ import * as assert from 'assert'; -import { Instrumentation, InstrumentationBase } from '../../src'; +import { + Instrumentation, + InstrumentationBase, + InstrumentationConfig, +} from '../../src'; + +interface TestInstrumentationConfig extends InstrumentationConfig { + isActive?: boolean; +} class TestInstrumentation extends InstrumentationBase { - constructor() { - super('test', '1.0.0'); + constructor(config: TestInstrumentationConfig & InstrumentationConfig = {}) { + super('test', '1.0.0', Object.assign({}, config)); } - enable() {} - disable() {} + override enable() {} + override disable() {} init() {} } @@ -48,7 +56,7 @@ describe('BaseInstrumentation', () => { it('should enable instrumentation by default', () => { let called = false; class TestInstrumentation2 extends TestInstrumentation { - enable() { + override enable() { called = true; } } @@ -56,4 +64,29 @@ describe('BaseInstrumentation', () => { assert.strictEqual(called, true); }); }); + + describe('getConfig', () => { + it('should return instrumentation config', () => { + const instrumentation: Instrumentation = new TestInstrumentation({ + isActive: false, + }); + const configuration = + instrumentation.getConfig() as TestInstrumentationConfig; + assert.notStrictEqual(configuration, null); + assert.strictEqual(configuration.isActive, false); + }); + }); + + describe('setConfig', () => { + it('should set a new config for instrumentation', () => { + const instrumentation: Instrumentation = new TestInstrumentation(); + const config: TestInstrumentationConfig = { + isActive: true, + }; + instrumentation.setConfig(config); + const configuration = + instrumentation.getConfig() as TestInstrumentationConfig; + assert.strictEqual(configuration.isActive, true); + }); + }); }); diff --git a/packages/opentelemetry-instrumentation/test/common/autoLoader.test.ts b/packages/opentelemetry-instrumentation/test/common/autoLoader.test.ts index 4177a347f6..181eb12c0e 100644 --- a/packages/opentelemetry-instrumentation/test/common/autoLoader.test.ts +++ b/packages/opentelemetry-instrumentation/test/common/autoLoader.test.ts @@ -14,18 +14,23 @@ * limitations under the License. */ -import { NOOP_TRACER_PROVIDER } from '@opentelemetry/api'; +import { Tracer, TracerProvider } from '@opentelemetry/api'; import { NOOP_METER_PROVIDER } from '@opentelemetry/api-metrics'; import * as assert from 'assert'; import * as sinon from 'sinon'; import { InstrumentationBase, registerInstrumentations } from '../../src'; +class DummyTracerProvider implements TracerProvider { + getTracer(name: string, version?: string): Tracer { + throw new Error("not implemented"); + } +} class FooInstrumentation extends InstrumentationBase { init() { return []; } - enable() {} - disable() {} + override enable() {} + override disable() {} } describe('autoLoader', () => { @@ -45,7 +50,7 @@ describe('autoLoader', () => { let enableSpy: sinon.SinonSpy; let setTracerProviderSpy: sinon.SinonSpy; let setsetMeterProvider: sinon.SinonSpy; - const tracerProvider = NOOP_TRACER_PROVIDER; + const tracerProvider = new DummyTracerProvider(); const meterProvider = NOOP_METER_PROVIDER; beforeEach(() => { instrumentation = new FooInstrumentation('foo', '1', {}); diff --git a/packages/opentelemetry-instrumentation/test/common/autoLoaderUtils.test.ts b/packages/opentelemetry-instrumentation/test/common/autoLoaderUtils.test.ts index ae2de44502..2477225004 100644 --- a/packages/opentelemetry-instrumentation/test/common/autoLoaderUtils.test.ts +++ b/packages/opentelemetry-instrumentation/test/common/autoLoaderUtils.test.ts @@ -27,9 +27,9 @@ class FooInstrumentation extends InstrumentationBase { return []; } - enable() {} + override enable() {} - disable() {} + override disable() {} } // const fooInstrumentation = new FooInstrumentation(); diff --git a/packages/opentelemetry-metrics/package.json b/packages/opentelemetry-metrics/package.json index d00bcba7dd..9aecff5d7b 100644 --- a/packages/opentelemetry-metrics/package.json +++ b/packages/opentelemetry-metrics/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/metrics", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry metrics SDK", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -44,28 +44,27 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", + "@opentelemetry/api": "^1.0.0", "@types/lodash.merge": "4.6.6", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", "sinon": "10.0.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/api-metrics": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/resources": "0.19.0", + "@opentelemetry/api-metrics": "0.21.0", + "@opentelemetry/core": "0.21.0", + "@opentelemetry/resources": "0.21.0", "lodash.merge": "^4.6.2" } } diff --git a/packages/opentelemetry-metrics/src/BaseObserverMetric.ts b/packages/opentelemetry-metrics/src/BaseObserverMetric.ts index 30ae3af1e8..a3098f119c 100644 --- a/packages/opentelemetry-metrics/src/BaseObserverMetric.ts +++ b/packages/opentelemetry-metrics/src/BaseObserverMetric.ts @@ -55,7 +55,7 @@ export abstract class BaseObserverMetric ); } - async getMetricRecord(): Promise { + override async getMetricRecord(): Promise { const observerResult = new ObserverResult(); await this._callback(observerResult); diff --git a/packages/opentelemetry-metrics/src/Meter.ts b/packages/opentelemetry-metrics/src/Meter.ts index d42c9f15c6..32f295694c 100644 --- a/packages/opentelemetry-metrics/src/Meter.ts +++ b/packages/opentelemetry-metrics/src/Meter.ts @@ -31,6 +31,7 @@ import { UpDownCounterMetric } from './UpDownCounterMetric'; import { UpDownSumObserverMetric } from './UpDownSumObserverMetric'; import { ValueObserverMetric } from './ValueObserverMetric'; import { ValueRecorderMetric } from './ValueRecorderMetric'; +// eslint-disable-next-line @typescript-eslint/no-var-requires const merge = require('lodash.merge'); /** @@ -56,7 +57,7 @@ export class Meter implements api.Meter { const mergedConfig = merge({}, DEFAULT_CONFIG, config); this._processor = mergedConfig.processor ?? new UngroupedProcessor(); this._resource = - mergedConfig.resource || Resource.createTelemetrySDKResource(); + mergedConfig.resource || Resource.empty(); this._instrumentationLibrary = instrumentationLibrary; // start the push controller const exporter = mergedConfig.exporter || new NoopExporter(); diff --git a/packages/opentelemetry-metrics/src/MeterProvider.ts b/packages/opentelemetry-metrics/src/MeterProvider.ts index b305456a9e..1d0cf1f098 100644 --- a/packages/opentelemetry-metrics/src/MeterProvider.ts +++ b/packages/opentelemetry-metrics/src/MeterProvider.ts @@ -18,6 +18,7 @@ import * as api from '@opentelemetry/api-metrics'; import { Resource } from '@opentelemetry/resources'; import { Meter } from '.'; import { DEFAULT_CONFIG, MeterConfig } from './types'; +// eslint-disable-next-line @typescript-eslint/no-var-requires const merge = require('lodash.merge'); /** @@ -32,8 +33,8 @@ export class MeterProvider implements api.MeterProvider { constructor(config: MeterConfig = {}) { const mergedConfig = merge({}, DEFAULT_CONFIG, config); - this.resource = - mergedConfig.resource ?? Resource.createTelemetrySDKResource(); + this.resource = mergedConfig.resource || Resource.empty(); + this.resource = Resource.default().merge(this.resource); this._config = Object.assign({}, mergedConfig, { resource: this.resource, }); diff --git a/packages/opentelemetry-metrics/src/SumObserverMetric.ts b/packages/opentelemetry-metrics/src/SumObserverMetric.ts index 2f4c723ec9..7244bc88d4 100644 --- a/packages/opentelemetry-metrics/src/SumObserverMetric.ts +++ b/packages/opentelemetry-metrics/src/SumObserverMetric.ts @@ -45,7 +45,7 @@ export class SumObserverMetric ); } - protected _processResults(observerResult: ObserverResult) { + protected override _processResults(observerResult: ObserverResult) { observerResult.values.forEach((value, labels) => { const instrument = this.bind(labels); // SumObserver is monotonic which means it should only accept values diff --git a/packages/opentelemetry-metrics/src/version.ts b/packages/opentelemetry-metrics/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-metrics/src/version.ts +++ b/packages/opentelemetry-metrics/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-node/package.json b/packages/opentelemetry-node/package.json index 34da33956e..d858132fe5 100644 --- a/packages/opentelemetry-node/package.json +++ b/packages/opentelemetry-node/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/node", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry Node SDK provides automatic telemetry (tracing, metrics, etc) for Node.js applications", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -41,16 +41,15 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0", + "@opentelemetry/api": "^1.0.0", + "@opentelemetry/resources": "0.21.0", + "@opentelemetry/semantic-conventions": "0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/semver": "7.3.5", "@types/shimmer": "1.0.1", "@types/sinon": "9.0.11", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", @@ -58,17 +57,17 @@ "sinon": "10.0.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/context-async-hooks": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/propagator-b3": "0.19.0", - "@opentelemetry/propagator-jaeger": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/context-async-hooks": "0.21.0", + "@opentelemetry/core": "0.21.0", + "@opentelemetry/propagator-b3": "0.21.0", + "@opentelemetry/propagator-jaeger": "0.21.0", + "@opentelemetry/tracing": "0.21.0", "semver": "^7.1.3" } } diff --git a/packages/opentelemetry-node/src/NodeTracerProvider.ts b/packages/opentelemetry-node/src/NodeTracerProvider.ts index e2f5f5fba0..326200a296 100644 --- a/packages/opentelemetry-node/src/NodeTracerProvider.ts +++ b/packages/opentelemetry-node/src/NodeTracerProvider.ts @@ -36,7 +36,7 @@ import { JaegerPropagator } from '@opentelemetry/propagator-jaeger'; * @param config Configuration object for SDK registration */ export class NodeTracerProvider extends BasicTracerProvider { - protected static readonly _registeredPropagators = new Map< + protected static override readonly _registeredPropagators = new Map< string, PROPAGATOR_FACTORY >([ @@ -56,7 +56,7 @@ export class NodeTracerProvider extends BasicTracerProvider { super(config); } - register(config: SDKRegistrationConfig = {}) { + override register(config: SDKRegistrationConfig = {}) { if (config.contextManager === undefined) { const ContextManager = semver.gte(process.version, '14.8.0') ? AsyncLocalStorageContextManager @@ -68,7 +68,7 @@ export class NodeTracerProvider extends BasicTracerProvider { super.register(config); } - protected _getPropagator(name: string): TextMapPropagator | undefined { + protected override _getPropagator(name: string): TextMapPropagator | undefined { return ( super._getPropagator(name) || NodeTracerProvider._registeredPropagators.get(name)?.() diff --git a/packages/opentelemetry-node/src/version.ts b/packages/opentelemetry-node/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-node/src/version.ts +++ b/packages/opentelemetry-node/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-node/test/NodeTracerProvider.test.ts b/packages/opentelemetry-node/test/NodeTracerProvider.test.ts index 24d1d0e82c..7057965ab8 100644 --- a/packages/opentelemetry-node/test/NodeTracerProvider.test.ts +++ b/packages/opentelemetry-node/test/NodeTracerProvider.test.ts @@ -17,10 +17,7 @@ import { context, TraceFlags, - setSpan, - setSpanContext, - getSpan, - propagation, + propagation, trace, } from '@opentelemetry/api'; import { AlwaysOnSampler, AlwaysOffSampler } from '@opentelemetry/core'; import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks'; @@ -99,7 +96,7 @@ describe('NodeTracerProvider', () => { sampler: new AlwaysOffSampler(), }); const span = provider.getTracer('default').startSpan('my-span'); - assert.strictEqual(span.context().traceFlags, TraceFlags.NONE); + assert.strictEqual(span.spanContext().traceFlags, TraceFlags.NONE); assert.strictEqual(span.isRecording(), false); }); @@ -109,7 +106,7 @@ describe('NodeTracerProvider', () => { }); const span = provider.getTracer('default').startSpan('my-span'); assert.ok(span instanceof Span); - assert.strictEqual(span.context().traceFlags, TraceFlags.SAMPLED); + assert.strictEqual(span.spanContext().traceFlags, TraceFlags.SAMPLED); assert.strictEqual(span.isRecording(), true); }); @@ -121,7 +118,7 @@ describe('NodeTracerProvider', () => { const sampledParent = provider.getTracer('default').startSpan( 'not-sampled-span', {}, - setSpanContext(ROOT_CONTEXT, { + trace.setSpanContext(ROOT_CONTEXT, { traceId: 'd4cda95b652f4a1592b449d5929fda1b', spanId: '6e0c63257de34c92', traceFlags: TraceFlags.NONE, @@ -129,16 +126,16 @@ describe('NodeTracerProvider', () => { ); assert.ok(sampledParent instanceof Span); assert.strictEqual( - sampledParent.context().traceFlags, + sampledParent.spanContext().traceFlags, TraceFlags.SAMPLED ); assert.strictEqual(sampledParent.isRecording(), true); const span = provider .getTracer('default') - .startSpan('child-span', {}, setSpan(ROOT_CONTEXT, sampledParent)); + .startSpan('child-span', {}, trace.setSpan(ROOT_CONTEXT, sampledParent)); assert.ok(span instanceof Span); - assert.strictEqual(span.context().traceFlags, TraceFlags.SAMPLED); + assert.strictEqual(span.spanContext().traceFlags, TraceFlags.SAMPLED); assert.strictEqual(span.isRecording(), true); }); @@ -158,46 +155,46 @@ describe('NodeTracerProvider', () => { it('should run context with AsyncHooksContextManager context manager', done => { provider = new NodeTracerProvider({}); const span = provider.getTracer('default').startSpan('my-span'); - context.with(setSpan(context.active(), span), () => { - assert.deepStrictEqual(getSpan(context.active()), span); + context.with(trace.setSpan(context.active(), span), () => { + assert.deepStrictEqual(trace.getSpan(context.active()), span); return done(); }); - assert.deepStrictEqual(getSpan(context.active()), undefined); + assert.deepStrictEqual(trace.getSpan(context.active()), undefined); }); it('should run context with AsyncHooksContextManager context manager with multiple spans', done => { provider = new NodeTracerProvider({}); const span = provider.getTracer('default').startSpan('my-span'); - context.with(setSpan(context.active(), span), () => { - assert.deepStrictEqual(getSpan(context.active()), span); + context.with(trace.setSpan(context.active(), span), () => { + assert.deepStrictEqual(trace.getSpan(context.active()), span); const span1 = provider.getTracer('default').startSpan('my-span1'); - context.with(setSpan(context.active(), span1), () => { - assert.deepStrictEqual(getSpan(context.active()), span1); + context.with(trace.setSpan(context.active(), span1), () => { + assert.deepStrictEqual(trace.getSpan(context.active()), span1); assert.deepStrictEqual( - span1.context().traceId, - span.context().traceId + span1.spanContext().traceId, + span.spanContext().traceId ); return done(); }); }); // when span ended. // @todo: below check is not running. - assert.deepStrictEqual(getSpan(context.active()), undefined); + assert.deepStrictEqual(trace.getSpan(context.active()), undefined); }); it('should find correct context with promises', async () => { provider = new NodeTracerProvider(); const span = provider.getTracer('default').startSpan('my-span'); - await context.with(setSpan(context.active(), span), async () => { + await context.with(trace.setSpan(context.active(), span), async () => { for (let i = 0; i < 3; i++) { await sleep(5).then(() => { - assert.deepStrictEqual(getSpan(context.active()), span); + assert.deepStrictEqual(trace.getSpan(context.active()), span); }); } }); - assert.deepStrictEqual(getSpan(context.active()), undefined); + assert.deepStrictEqual(trace.getSpan(context.active()), undefined); }); }); @@ -206,10 +203,10 @@ describe('NodeTracerProvider', () => { const provider = new NodeTracerProvider({}); const span = provider.getTracer('default').startSpan('my-span'); const fn = () => { - assert.deepStrictEqual(getSpan(context.active()), span); + assert.deepStrictEqual(trace.getSpan(context.active()), span); return done(); }; - const patchedFn = context.bind(fn, setSpan(context.active(), span)); + const patchedFn = context.bind(trace.setSpan(context.active(), span), fn); return patchedFn(); }); }); diff --git a/packages/opentelemetry-node/test/registration.test.ts b/packages/opentelemetry-node/test/registration.test.ts index 392568f1c1..e199898a13 100644 --- a/packages/opentelemetry-node/test/registration.test.ts +++ b/packages/opentelemetry-node/test/registration.test.ts @@ -16,7 +16,6 @@ import { context, - NoopTextMapPropagator, propagation, trace, ProxyTracerProvider, @@ -25,7 +24,6 @@ import { AsyncHooksContextManager, AsyncLocalStorageContextManager, } from '@opentelemetry/context-async-hooks'; -import { NoopContextManager } from '@opentelemetry/api'; import { CompositePropagator } from '@opentelemetry/core'; import * as assert from 'assert'; import { NodeTracerProvider } from '../src'; @@ -58,28 +56,29 @@ describe('API registration', () => { it('should register configured implementations', () => { const tracerProvider = new NodeTracerProvider(); - const contextManager = new NoopContextManager(); - const propagator = new NoopTextMapPropagator(); + const mockContextManager = { disable() {} } as any; + const mockPropagator = {} as any; tracerProvider.register({ - contextManager, - propagator, + contextManager: mockContextManager, + propagator: mockPropagator, }); - assert.ok(context['_getContextManager']() === contextManager); - assert.ok(propagation['_getGlobalPropagator']() === propagator); + assert.strictEqual(context['_getContextManager'](), mockContextManager); + assert.strictEqual(propagation['_getGlobalPropagator'](), mockPropagator); const apiTracerProvider = trace.getTracerProvider() as ProxyTracerProvider; - assert.ok(apiTracerProvider.getDelegate() === tracerProvider); + assert.strictEqual(apiTracerProvider.getDelegate(), tracerProvider); }); it('should skip null context manager', () => { const tracerProvider = new NodeTracerProvider(); + const ctxManager = context['_getContextManager'](); tracerProvider.register({ contextManager: null, }); - assert.ok(context['_getContextManager']() instanceof NoopContextManager); + assert.strictEqual(context['_getContextManager'](), ctxManager, "context manager should not change"); assert.ok( propagation['_getGlobalPropagator']() instanceof CompositePropagator @@ -90,14 +89,14 @@ describe('API registration', () => { }); it('should skip null propagator', () => { + const propagator = propagation['_getGlobalPropagator'](); + const tracerProvider = new NodeTracerProvider(); tracerProvider.register({ propagator: null, }); - assert.ok( - propagation['_getGlobalPropagator']() instanceof NoopTextMapPropagator - ); + assert.strictEqual(propagation['_getGlobalPropagator'](), propagator); assert.ok(context['_getContextManager']() instanceof DefaultContextManager); diff --git a/packages/opentelemetry-propagator-b3/package.json b/packages/opentelemetry-propagator-b3/package.json index 1c2535d32b..959ce5d1f0 100644 --- a/packages/opentelemetry-propagator-b3/package.json +++ b/packages/opentelemetry-propagator-b3/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/propagator-b3", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry B3 propagator provides context propagation for systems that are using the B3 header format", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -42,21 +42,23 @@ "publishConfig": { "access": "public" }, + "dependencies": { + "@opentelemetry/core": "0.21.0" + }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "istanbul-instrumenter-loader": "3.0.1", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", "ts-loader": "8.2.0", "ts-mocha": "8.0.0", - "typescript": "4.2.4" + "typescript": "4.3.2" } } diff --git a/packages/opentelemetry-propagator-b3/src/B3MultiPropagator.ts b/packages/opentelemetry-propagator-b3/src/B3MultiPropagator.ts index dba3a70de3..17b2a3859d 100644 --- a/packages/opentelemetry-propagator-b3/src/B3MultiPropagator.ts +++ b/packages/opentelemetry-propagator-b3/src/B3MultiPropagator.ts @@ -16,25 +16,24 @@ import { Context, - getSpanContext, - isInstrumentationSuppressed, isSpanContextValid, isValidSpanId, isValidTraceId, - setSpanContext, + trace, TextMapGetter, TextMapPropagator, TextMapSetter, TraceFlags, } from '@opentelemetry/api'; +import { isTracingSuppressed } from '@opentelemetry/core'; +import { B3_DEBUG_FLAG_KEY } from './common'; import { - X_B3_TRACE_ID, - X_B3_SPAN_ID, - X_B3_SAMPLED, - X_B3_PARENT_SPAN_ID, X_B3_FLAGS, + X_B3_PARENT_SPAN_ID, + X_B3_SAMPLED, + X_B3_SPAN_ID, + X_B3_TRACE_ID, } from './constants'; -import { B3_DEBUG_FLAG_KEY } from './common'; const VALID_SAMPLED_VALUES = new Set([true, 'true', 'True', '1', 1]); const VALID_UNSAMPLED_VALUES = new Set([false, 'false', 'False', '0', 0]); @@ -95,11 +94,11 @@ function getTraceFlags( */ export class B3MultiPropagator implements TextMapPropagator { inject(context: Context, carrier: unknown, setter: TextMapSetter) { - const spanContext = getSpanContext(context); + const spanContext = trace.getSpanContext(context); if ( !spanContext || !isSpanContextValid(spanContext) || - isInstrumentationSuppressed(context) + isTracingSuppressed(context) ) return; @@ -135,7 +134,7 @@ export class B3MultiPropagator implements TextMapPropagator { isValidSampledValue(traceFlags) ) { context = context.setValue(B3_DEBUG_FLAG_KEY, debug); - return setSpanContext(context, { + return trace.setSpanContext(context, { traceId, spanId, isRemote: true, diff --git a/packages/opentelemetry-propagator-b3/src/B3Propagator.ts b/packages/opentelemetry-propagator-b3/src/B3Propagator.ts index 7b40ef0527..597873e36d 100644 --- a/packages/opentelemetry-propagator-b3/src/B3Propagator.ts +++ b/packages/opentelemetry-propagator-b3/src/B3Propagator.ts @@ -16,11 +16,11 @@ import { Context, - isInstrumentationSuppressed, TextMapGetter, TextMapPropagator, TextMapSetter, } from '@opentelemetry/api'; +import { isTracingSuppressed } from '@opentelemetry/core'; import { B3MultiPropagator } from './B3MultiPropagator'; import { B3SinglePropagator } from './B3SinglePropagator'; import { B3_CONTEXT_HEADER } from './constants'; @@ -54,7 +54,7 @@ export class B3Propagator implements TextMapPropagator { } inject(context: Context, carrier: unknown, setter: TextMapSetter) { - if (isInstrumentationSuppressed(context)) { + if (isTracingSuppressed(context)) { return; } this._inject(context, carrier, setter); diff --git a/packages/opentelemetry-propagator-b3/src/B3SinglePropagator.ts b/packages/opentelemetry-propagator-b3/src/B3SinglePropagator.ts index acd36820e8..6a26a93265 100644 --- a/packages/opentelemetry-propagator-b3/src/B3SinglePropagator.ts +++ b/packages/opentelemetry-propagator-b3/src/B3SinglePropagator.ts @@ -16,19 +16,17 @@ import { Context, - getSpanContext, - isInstrumentationSuppressed, isSpanContextValid, isValidSpanId, isValidTraceId, - setSpanContext, TextMapGetter, TextMapPropagator, - TextMapSetter, + TextMapSetter, trace, TraceFlags, } from '@opentelemetry/api'; -import { B3_CONTEXT_HEADER } from './constants'; +import { isTracingSuppressed } from '@opentelemetry/core'; import { B3_DEBUG_FLAG_KEY } from './common'; +import { B3_CONTEXT_HEADER } from './constants'; const B3_CONTEXT_REGEX = /((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/; const PADDING = '0'.repeat(16); @@ -52,11 +50,11 @@ function convertToTraceFlags(samplingState: string | undefined): TraceFlags { */ export class B3SinglePropagator implements TextMapPropagator { inject(context: Context, carrier: unknown, setter: TextMapSetter) { - const spanContext = getSpanContext(context); + const spanContext = trace.getSpanContext(context); if ( !spanContext || !isSpanContextValid(spanContext) || - isInstrumentationSuppressed(context) + isTracingSuppressed(context) ) return; @@ -85,7 +83,7 @@ export class B3SinglePropagator implements TextMapPropagator { context = context.setValue(B3_DEBUG_FLAG_KEY, samplingState); } - return setSpanContext(context, { + return trace.setSpanContext(context, { traceId, spanId, isRemote: true, diff --git a/packages/opentelemetry-propagator-b3/src/version.ts b/packages/opentelemetry-propagator-b3/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-propagator-b3/src/version.ts +++ b/packages/opentelemetry-propagator-b3/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-propagator-b3/test/B3MultiPropagator.test.ts b/packages/opentelemetry-propagator-b3/test/B3MultiPropagator.test.ts index a415c22603..a314385b57 100644 --- a/packages/opentelemetry-propagator-b3/test/B3MultiPropagator.test.ts +++ b/packages/opentelemetry-propagator-b3/test/B3MultiPropagator.test.ts @@ -17,13 +17,12 @@ import { defaultTextMapGetter, defaultTextMapSetter, - getSpanContext, - setSpanContext, SpanContext, - suppressInstrumentation, + trace, TraceFlags, } from '@opentelemetry/api'; import { ROOT_CONTEXT } from '@opentelemetry/api'; +import { suppressTracing } from '@opentelemetry/core'; import * as assert from 'assert'; import { B3MultiPropagator } from '../src/B3MultiPropagator'; import { @@ -52,7 +51,7 @@ describe('B3MultiPropagator', () => { }; b3Propagator.inject( - setSpanContext(ROOT_CONTEXT, spanContext), + trace.setSpanContext(ROOT_CONTEXT, spanContext), carrier, defaultTextMapSetter ); @@ -88,7 +87,7 @@ describe('B3MultiPropagator', () => { }; b3Propagator.inject( - setSpanContext(ROOT_CONTEXT, spanContext), + trace.setSpanContext(ROOT_CONTEXT, spanContext), carrier, defaultTextMapSetter ); @@ -110,7 +109,7 @@ describe('B3MultiPropagator', () => { const contextWithDebug = ROOT_CONTEXT.setValue(B3_DEBUG_FLAG_KEY, '1'); b3Propagator.inject( - setSpanContext(contextWithDebug, spanContext), + trace.setSpanContext(contextWithDebug, spanContext), carrier, defaultTextMapSetter ); @@ -130,7 +129,7 @@ describe('B3MultiPropagator', () => { traceFlags: TraceFlags.NONE, }; b3Propagator.inject( - setSpanContext(ROOT_CONTEXT, emptySpanContext), + trace.setSpanContext(ROOT_CONTEXT, emptySpanContext), carrier, defaultTextMapSetter ); @@ -147,7 +146,7 @@ describe('B3MultiPropagator', () => { traceFlags: TraceFlags.SAMPLED, }; b3Propagator.inject( - suppressInstrumentation(setSpanContext(ROOT_CONTEXT, spanContext)), + suppressTracing(trace.setSpanContext(ROOT_CONTEXT, spanContext)), carrier, defaultTextMapSetter ); @@ -167,7 +166,7 @@ describe('B3MultiPropagator', () => { carrier, defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'b7ad6b7169203331', traceId: '0af7651916cd43dd8448eb211c80319c', @@ -188,7 +187,7 @@ describe('B3MultiPropagator', () => { carrier, defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'b7ad6b7169203331', @@ -210,7 +209,7 @@ describe('B3MultiPropagator', () => { carrier, defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'b7ad6b7169203331', @@ -232,7 +231,7 @@ describe('B3MultiPropagator', () => { carrier, defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'b7ad6b7169203331', @@ -256,7 +255,7 @@ describe('B3MultiPropagator', () => { carrier, defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'b7ad6b7169203331', @@ -281,7 +280,7 @@ describe('B3MultiPropagator', () => { carrier, defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'b7ad6b7169203331', @@ -304,7 +303,7 @@ describe('B3MultiPropagator', () => { carrier, defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'b7ad6b7169203331', @@ -327,7 +326,7 @@ describe('B3MultiPropagator', () => { carrier, defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'b7ad6b7169203331', @@ -350,7 +349,7 @@ describe('B3MultiPropagator', () => { carrier, defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'b7ad6b7169203331', @@ -368,7 +367,7 @@ describe('B3MultiPropagator', () => { it('should return undefined', () => { carrier[X_B3_TRACE_ID] = undefined; carrier[X_B3_SPAN_ID] = 'b7ad6b7169203331'; - const context = getSpanContext( + const context = trace.getSpanContext( b3Propagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); assert.deepStrictEqual(context, undefined); @@ -379,7 +378,7 @@ describe('B3MultiPropagator', () => { it('should return undefined', () => { carrier[X_B3_TRACE_ID] = '0af7651916cd43dd8448eb211c80319c'; carrier[X_B3_SPAN_ID] = undefined; - const context = getSpanContext( + const context = trace.getSpanContext( b3Propagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); assert.deepStrictEqual(context, undefined); @@ -391,7 +390,7 @@ describe('B3MultiPropagator', () => { carrier[X_B3_TRACE_ID] = '0af7651916cd43dd8448eb211c80319c'; carrier[X_B3_SPAN_ID] = 'b7ad6b7169203331'; carrier[X_B3_SAMPLED] = '2'; - const context = getSpanContext( + const context = trace.getSpanContext( b3Propagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); assert.deepStrictEqual(context, undefined); @@ -400,7 +399,7 @@ describe('B3MultiPropagator', () => { describe('AND b3 header is missing', () => { it('should return undefined', () => { - const context = getSpanContext( + const context = trace.getSpanContext( b3Propagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); assert.deepStrictEqual(context, undefined); @@ -411,7 +410,7 @@ describe('B3MultiPropagator', () => { it('should return undefined', () => { carrier[X_B3_TRACE_ID] = 'invalid!'; carrier[X_B3_SPAN_ID] = 'b7ad6b7169203331'; - const context = getSpanContext( + const context = trace.getSpanContext( b3Propagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); assert.deepStrictEqual(context, undefined); @@ -428,7 +427,7 @@ describe('B3MultiPropagator', () => { carrier, defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'b7ad6b7169203331', traceId: '0af7651916cd43dd8448eb211c80319c', @@ -477,7 +476,7 @@ describe('B3MultiPropagator', () => { Object.getOwnPropertyNames(testCases).forEach(testCase => { carrier[X_B3_TRACE_ID] = testCases[testCase]; - const extractedSpanContext = getSpanContext( + const extractedSpanContext = trace.getSpanContext( b3Propagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); assert.deepStrictEqual(extractedSpanContext, undefined, testCase); @@ -513,7 +512,7 @@ describe('B3MultiPropagator', () => { carrier, defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'b7ad6b7169203331', diff --git a/packages/opentelemetry-propagator-b3/test/B3Propagator.test.ts b/packages/opentelemetry-propagator-b3/test/B3Propagator.test.ts index bf0f89ff38..6efec8336a 100644 --- a/packages/opentelemetry-propagator-b3/test/B3Propagator.test.ts +++ b/packages/opentelemetry-propagator-b3/test/B3Propagator.test.ts @@ -14,19 +14,17 @@ * limitations under the License. */ -import * as assert from 'assert'; import { defaultTextMapGetter, defaultTextMapSetter, SpanContext, TraceFlags, - getSpanContext, - setSpanContext, ROOT_CONTEXT, - suppressInstrumentation, + trace, } from '@opentelemetry/api'; +import { suppressTracing } from '@opentelemetry/core'; +import * as assert from 'assert'; import { B3Propagator } from '../src/B3Propagator'; -import { B3InjectEncoding } from '../src/types'; import { B3_CONTEXT_HEADER, X_B3_FLAGS, @@ -35,6 +33,7 @@ import { X_B3_SPAN_ID, X_B3_TRACE_ID, } from '../src/constants'; +import { B3InjectEncoding } from '../src/types'; describe('B3Propagator', () => { let propagator: B3Propagator; @@ -56,7 +55,7 @@ describe('B3Propagator', () => { }; propagator.inject( - setSpanContext(ROOT_CONTEXT, spanContext), + trace.setSpanContext(ROOT_CONTEXT, spanContext), carrier, defaultTextMapSetter ); @@ -77,7 +76,7 @@ describe('B3Propagator', () => { }; propagator.inject( - setSpanContext(ROOT_CONTEXT, spanContext), + trace.setSpanContext(ROOT_CONTEXT, spanContext), carrier, defaultTextMapSetter ); @@ -100,7 +99,7 @@ describe('B3Propagator', () => { }; propagator.inject( - suppressInstrumentation(setSpanContext(ROOT_CONTEXT, spanContext)), + suppressTracing(trace.setSpanContext(ROOT_CONTEXT, spanContext)), carrier, defaultTextMapSetter ); @@ -128,7 +127,7 @@ describe('B3Propagator', () => { defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'e457b5a2e4d86bd1', traceId: '80f198ee56343ba864fe8b2a57d3eff7', @@ -144,7 +143,7 @@ describe('B3Propagator', () => { defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: '6e0c63257de34c92', traceId: 'd4cda95b652f4a1592b449d5929fda1b', @@ -160,7 +159,7 @@ describe('B3Propagator', () => { defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'e457b5a2e4d86bd1', traceId: '80f198ee56343ba864fe8b2a57d3eff7', diff --git a/packages/opentelemetry-propagator-b3/test/B3SinglePropagator.test.ts b/packages/opentelemetry-propagator-b3/test/B3SinglePropagator.test.ts index 4a6a65b8ac..231a111ff4 100644 --- a/packages/opentelemetry-propagator-b3/test/B3SinglePropagator.test.ts +++ b/packages/opentelemetry-propagator-b3/test/B3SinglePropagator.test.ts @@ -19,17 +19,16 @@ import { defaultTextMapSetter, INVALID_SPANID, INVALID_TRACEID, - getSpanContext, - setSpanContext, + ROOT_CONTEXT, SpanContext, TraceFlags, - suppressInstrumentation, + trace, } from '@opentelemetry/api'; -import { ROOT_CONTEXT } from '@opentelemetry/api'; +import { suppressTracing } from '@opentelemetry/core'; import * as assert from 'assert'; import { B3SinglePropagator } from '../src/B3SinglePropagator'; -import { B3_CONTEXT_HEADER } from '../src/constants'; import { B3_DEBUG_FLAG_KEY } from '../src/common'; +import { B3_CONTEXT_HEADER } from '../src/constants'; describe('B3SinglePropagator', () => { const propagator = new B3SinglePropagator(); @@ -48,7 +47,7 @@ describe('B3SinglePropagator', () => { }; propagator.inject( - setSpanContext(ROOT_CONTEXT, spanContext), + trace.setSpanContext(ROOT_CONTEXT, spanContext), carrier, defaultTextMapSetter ); @@ -65,7 +64,7 @@ describe('B3SinglePropagator', () => { }; propagator.inject( - setSpanContext(ROOT_CONTEXT, spanContext), + trace.setSpanContext(ROOT_CONTEXT, spanContext), carrier, defaultTextMapSetter ); @@ -84,7 +83,7 @@ describe('B3SinglePropagator', () => { const context = ROOT_CONTEXT.setValue(B3_DEBUG_FLAG_KEY, 'd'); propagator.inject( - setSpanContext(context, spanContext), + trace.setSpanContext(context, spanContext), carrier, defaultTextMapSetter ); @@ -101,7 +100,7 @@ describe('B3SinglePropagator', () => { }; propagator.inject( - setSpanContext(ROOT_CONTEXT, spanContext), + trace.setSpanContext(ROOT_CONTEXT, spanContext), carrier, defaultTextMapSetter ); @@ -117,7 +116,7 @@ describe('B3SinglePropagator', () => { }; propagator.inject( - setSpanContext(ROOT_CONTEXT, spanContext), + trace.setSpanContext(ROOT_CONTEXT, spanContext), carrier, defaultTextMapSetter ); @@ -133,7 +132,7 @@ describe('B3SinglePropagator', () => { }; propagator.inject( - suppressInstrumentation(setSpanContext(ROOT_CONTEXT, spanContext)), + suppressTracing(trace.setSpanContext(ROOT_CONTEXT, spanContext)), carrier, defaultTextMapSetter ); @@ -155,7 +154,7 @@ describe('B3SinglePropagator', () => { defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'e457b5a2e4d86bd1', traceId: '80f198ee56343ba864fe8b2a57d3eff7', @@ -176,7 +175,7 @@ describe('B3SinglePropagator', () => { defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'e457b5a2e4d86bd1', traceId: '80f198ee56343ba864fe8b2a57d3eff7', @@ -197,7 +196,7 @@ describe('B3SinglePropagator', () => { defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'e457b5a2e4d86bd1', traceId: '80f198ee56343ba864fe8b2a57d3eff7', @@ -217,7 +216,7 @@ describe('B3SinglePropagator', () => { defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'e457b5a2e4d86bd1', traceId: '00000000000000004aaba1a52cf8ee09', @@ -238,7 +237,7 @@ describe('B3SinglePropagator', () => { defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(extractedSpanContext, { spanId: 'e457b5a2e4d86bd1', traceId: '80f198ee56343ba864fe8b2a57d3eff7', @@ -259,7 +258,7 @@ describe('B3SinglePropagator', () => { defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(undefined, extractedSpanContext); }); @@ -274,7 +273,7 @@ describe('B3SinglePropagator', () => { defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(undefined, extractedSpanContext); }); @@ -289,7 +288,7 @@ describe('B3SinglePropagator', () => { defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(undefined, extractedSpanContext); }); @@ -304,7 +303,7 @@ describe('B3SinglePropagator', () => { defaultTextMapGetter ); - const extractedSpanContext = getSpanContext(context); + const extractedSpanContext = trace.getSpanContext(context); assert.deepStrictEqual(undefined, extractedSpanContext); }); }); diff --git a/packages/opentelemetry-propagator-b3/tsconfig.json b/packages/opentelemetry-propagator-b3/tsconfig.json index bdc94d2213..789e61fc86 100644 --- a/packages/opentelemetry-propagator-b3/tsconfig.json +++ b/packages/opentelemetry-propagator-b3/tsconfig.json @@ -7,5 +7,10 @@ "include": [ "src/**/*.ts", "test/**/*.ts" + ], + "references": [ + { + "path": "../opentelemetry-core" + } ] } diff --git a/packages/opentelemetry-propagator-jaeger/package.json b/packages/opentelemetry-propagator-jaeger/package.json index 353765fef6..2df616b418 100644 --- a/packages/opentelemetry-propagator-jaeger/package.json +++ b/packages/opentelemetry-propagator-jaeger/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/propagator-jaeger", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry Jaeger propagator provides HTTP header propagation for systems that are using Jaeger HTTP header format.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -47,20 +47,19 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", "@types/webpack-env": "1.16.0", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", "karma-spec-reporter": "0.0.32", - "karma-webpack": "5.0.0", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", @@ -68,13 +67,13 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0" + "@opentelemetry/core": "0.21.0" } } diff --git a/packages/opentelemetry-propagator-jaeger/src/JaegerPropagator.ts b/packages/opentelemetry-propagator-jaeger/src/JaegerPropagator.ts index 7f9daf1fff..252dc39fb5 100644 --- a/packages/opentelemetry-propagator-jaeger/src/JaegerPropagator.ts +++ b/packages/opentelemetry-propagator-jaeger/src/JaegerPropagator.ts @@ -16,18 +16,15 @@ import { Context, - getBaggage, - getSpanContext, - setBaggage, - setSpanContext, SpanContext, - TraceFlags, TextMapGetter, TextMapPropagator, TextMapSetter, - isInstrumentationSuppressed, - createBaggage, + propagation, + trace, + TraceFlags, } from '@opentelemetry/api'; +import { isTracingSuppressed } from '@opentelemetry/core'; export const UBER_TRACE_ID_HEADER = 'uber-trace-id'; export const UBER_BAGGAGE_HEADER_PREFIX = 'uberctx'; @@ -59,9 +56,9 @@ export class JaegerPropagator implements TextMapPropagator { } inject(context: Context, carrier: unknown, setter: TextMapSetter) { - const spanContext = getSpanContext(context); - const baggage = getBaggage(context); - if (spanContext && isInstrumentationSuppressed(context) === false) { + const spanContext = trace.getSpanContext(context); + const baggage = propagation.getBaggage(context); + if (spanContext && isTracingSuppressed(context) === false) { const traceFlags = `0${( spanContext.traceFlags || TraceFlags.NONE ).toString(16)}`; @@ -105,20 +102,20 @@ export class JaegerPropagator implements TextMapPropagator { if (typeof uberTraceId === 'string') { const spanContext = deserializeSpanContext(uberTraceId); if (spanContext) { - newContext = setSpanContext(newContext, spanContext); + newContext = trace.setSpanContext(newContext, spanContext); } } if (baggageValues.length === 0) return newContext; // if baggage values are present, inject it into the current baggage - let currentBaggage = getBaggage(context) ?? createBaggage(); + let currentBaggage = propagation.getBaggage(context) ?? propagation.createBaggage(); for (const baggageEntry of baggageValues) { if (baggageEntry.value === undefined) continue; currentBaggage = currentBaggage.setEntry(baggageEntry.key, { value: decodeURIComponent(baggageEntry.value), }); } - newContext = setBaggage(newContext, currentBaggage); + newContext = propagation.setBaggage(newContext, currentBaggage); return newContext; } diff --git a/packages/opentelemetry-propagator-jaeger/src/version.ts b/packages/opentelemetry-propagator-jaeger/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-propagator-jaeger/src/version.ts +++ b/packages/opentelemetry-propagator-jaeger/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-propagator-jaeger/test/JaegerPropagator.test.ts b/packages/opentelemetry-propagator-jaeger/test/JaegerPropagator.test.ts index e12e6bfc62..93836c84c9 100644 --- a/packages/opentelemetry-propagator-jaeger/test/JaegerPropagator.test.ts +++ b/packages/opentelemetry-propagator-jaeger/test/JaegerPropagator.test.ts @@ -15,19 +15,15 @@ */ import { - createBaggage, defaultTextMapGetter, - defaultTextMapSetter, - getBaggage, - getSpanContext, + defaultTextMapSetter, propagation, ROOT_CONTEXT, - setBaggage, - setSpanContext, SpanContext, - suppressInstrumentation, TextMapGetter, + trace, TraceFlags, } from '@opentelemetry/api'; +import { suppressTracing } from '@opentelemetry/core'; import * as assert from 'assert'; import { JaegerPropagator, @@ -54,7 +50,7 @@ describe('JaegerPropagator', () => { }; jaegerPropagator.inject( - setSpanContext(ROOT_CONTEXT, spanContext), + trace.setSpanContext(ROOT_CONTEXT, spanContext), carrier, defaultTextMapSetter ); @@ -72,7 +68,7 @@ describe('JaegerPropagator', () => { }; customJaegerPropagator.inject( - setSpanContext(ROOT_CONTEXT, spanContext), + trace.setSpanContext(ROOT_CONTEXT, spanContext), carrier, defaultTextMapSetter ); @@ -90,7 +86,7 @@ describe('JaegerPropagator', () => { }; jaegerPropagator.inject( - suppressInstrumentation(setSpanContext(ROOT_CONTEXT, spanContext)), + suppressTracing(trace.setSpanContext(ROOT_CONTEXT, spanContext)), carrier, defaultTextMapSetter ); @@ -98,7 +94,7 @@ describe('JaegerPropagator', () => { }); it('should propagate baggage with url encoded values', () => { - const baggage = createBaggage({ + const baggage = propagation.createBaggage({ test: { value: '1', }, @@ -108,7 +104,7 @@ describe('JaegerPropagator', () => { }); jaegerPropagator.inject( - setBaggage(ROOT_CONTEXT, baggage), + propagation.setBaggage(ROOT_CONTEXT, baggage), carrier, defaultTextMapSetter ); @@ -124,7 +120,7 @@ describe('JaegerPropagator', () => { it('should extract context of a sampled span from carrier', () => { carrier[UBER_TRACE_ID_HEADER] = 'd4cda95b652f4a1592b449d5929fda1b:6e0c63257de34c92:0:01'; - const extractedSpanContext = getSpanContext( + const extractedSpanContext = trace.getSpanContext( jaegerPropagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); @@ -139,7 +135,7 @@ describe('JaegerPropagator', () => { 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 = getSpanContext( + const extractedSpanContext = trace.getSpanContext( jaegerPropagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); @@ -154,7 +150,7 @@ describe('JaegerPropagator', () => { it('should extract context of a sampled span from UTF-8 encoded carrier', () => { carrier[UBER_TRACE_ID_HEADER] = 'ac1f3dc3c2c0b06e%3A5ac292c4a11a163e%3Ac086aaa825821068%3A1'; - const extractedSpanContext = getSpanContext( + const extractedSpanContext = trace.getSpanContext( jaegerPropagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); @@ -169,7 +165,7 @@ describe('JaegerPropagator', () => { it('should use custom header if provided', () => { carrier[customHeader] = 'd4cda95b652f4a1592b449d5929fda1b:6e0c63257de34c92:0:01'; - const extractedSpanContext = getSpanContext( + const extractedSpanContext = trace.getSpanContext( customJaegerPropagator.extract( ROOT_CONTEXT, carrier, @@ -187,7 +183,7 @@ describe('JaegerPropagator', () => { it('returns undefined if UBER_TRACE_ID_HEADER header is missing', () => { assert.deepStrictEqual( - getSpanContext( + trace.getSpanContext( jaegerPropagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ), undefined @@ -197,7 +193,7 @@ describe('JaegerPropagator', () => { it('returns undefined if UBER_TRACE_ID_HEADER header is invalid', () => { carrier[UBER_TRACE_ID_HEADER] = 'invalid!'; assert.deepStrictEqual( - getSpanContext( + trace.getSpanContext( jaegerPropagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ), undefined @@ -207,7 +203,7 @@ describe('JaegerPropagator', () => { it('should extract baggage from carrier', () => { carrier[`${UBER_BAGGAGE_HEADER_PREFIX}-test`] = 'value'; carrier[`${UBER_BAGGAGE_HEADER_PREFIX}-myuser`] = '%25id%25'; - const extractedBaggage = getBaggage( + const extractedBaggage = propagation.getBaggage( jaegerPropagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); @@ -222,9 +218,9 @@ describe('JaegerPropagator', () => { it('should extract baggage from carrier and not override current one', () => { carrier[`${UBER_BAGGAGE_HEADER_PREFIX}-test`] = 'value'; carrier[`${UBER_BAGGAGE_HEADER_PREFIX}-myuser`] = '%25id%25'; - const extractedBaggage = getBaggage( + const extractedBaggage = propagation.getBaggage( jaegerPropagator.extract( - setBaggage(ROOT_CONTEXT, createBaggage({ one: { value: 'two' } })), + propagation.setBaggage(ROOT_CONTEXT, propagation.createBaggage({ one: { value: 'two' } })), carrier, defaultTextMapGetter ) @@ -243,7 +239,7 @@ describe('JaegerPropagator', () => { it('should handle invalid baggage from carrier (undefined)', () => { carrier[`${UBER_BAGGAGE_HEADER_PREFIX}-test`] = undefined; - const extractedBaggage = getBaggage( + const extractedBaggage = propagation.getBaggage( jaegerPropagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); @@ -253,7 +249,7 @@ describe('JaegerPropagator', () => { it('should handle invalid baggage from carrier (array)', () => { carrier[`${UBER_BAGGAGE_HEADER_PREFIX}-test`] = ['one', 'two']; - const extractedBaggage = getBaggage( + const extractedBaggage = propagation.getBaggage( jaegerPropagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); diff --git a/packages/opentelemetry-resource-detector-aws/package.json b/packages/opentelemetry-resource-detector-aws/package.json index d469dc43d5..4f0f2bc6f7 100644 --- a/packages/opentelemetry-resource-detector-aws/package.json +++ b/packages/opentelemetry-resource-detector-aws/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resource-detector-aws", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry SDK resource detector for AWS", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -39,12 +39,11 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "mocha": "7.2.0", "nock": "12.0.3", "nyc": "15.1.0", @@ -52,14 +51,14 @@ "sinon": "10.0.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0" + "@opentelemetry/core": "0.21.0", + "@opentelemetry/resources": "0.21.0", + "@opentelemetry/semantic-conventions": "0.21.0" } } diff --git a/packages/opentelemetry-resource-detector-aws/src/detectors/AwsBeanstalkDetector.ts b/packages/opentelemetry-resource-detector-aws/src/detectors/AwsBeanstalkDetector.ts index 2d54d9dde2..694f55764a 100644 --- a/packages/opentelemetry-resource-detector-aws/src/detectors/AwsBeanstalkDetector.ts +++ b/packages/opentelemetry-resource-detector-aws/src/detectors/AwsBeanstalkDetector.ts @@ -71,9 +71,9 @@ export class AwsBeanstalkDetector implements Detector { return new Resource({ [ResourceAttributes.CLOUD_PROVIDER]: CloudProviderValues.AWS, [ResourceAttributes.CLOUD_PLATFORM]: - CloudPlatformValues.AWS_ELASTICBEANSTALK, + CloudPlatformValues.AWS_ELASTIC_BEANSTALK, [ResourceAttributes.SERVICE_NAME]: - CloudPlatformValues.AWS_ELASTICBEANSTALK, + CloudPlatformValues.AWS_ELASTIC_BEANSTALK, [ResourceAttributes.SERVICE_NAMESPACE]: parsedData.environment_name, [ResourceAttributes.SERVICE_VERSION]: parsedData.version_label, [ResourceAttributes.SERVICE_INSTANCE_ID]: parsedData.deployment_id, diff --git a/packages/opentelemetry-resource-detector-aws/src/version.ts b/packages/opentelemetry-resource-detector-aws/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-resource-detector-aws/src/version.ts +++ b/packages/opentelemetry-resource-detector-aws/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-resource-detector-aws/test/detectors/AwsBeanstalkDetector.test.ts b/packages/opentelemetry-resource-detector-aws/test/detectors/AwsBeanstalkDetector.test.ts index b0403f4627..08ccc7269a 100644 --- a/packages/opentelemetry-resource-detector-aws/test/detectors/AwsBeanstalkDetector.test.ts +++ b/packages/opentelemetry-resource-detector-aws/test/detectors/AwsBeanstalkDetector.test.ts @@ -58,7 +58,7 @@ describe('BeanstalkResourceDetector', () => { sinon.assert.calledOnce(readStub); assert.ok(resource); assertServiceResource(resource, { - name: CloudPlatformValues.AWS_ELASTICBEANSTALK, + name: CloudPlatformValues.AWS_ELASTIC_BEANSTALK, namespace: 'scorekeep', version: 'app-5a56-170119_190650-stage-170119_190650', instanceId: '32', @@ -80,7 +80,7 @@ describe('BeanstalkResourceDetector', () => { sinon.assert.calledOnce(readStub); assert.ok(resource); assertServiceResource(resource, { - name: CloudPlatformValues.AWS_ELASTICBEANSTALK, + name: CloudPlatformValues.AWS_ELASTIC_BEANSTALK, namespace: 'scorekeep', version: 'app-5a56-170119_190650-stage-170119_190650', instanceId: '32', diff --git a/packages/opentelemetry-resource-detector-gcp/package.json b/packages/opentelemetry-resource-detector-gcp/package.json index a2a283c9dd..31a18c1993 100644 --- a/packages/opentelemetry-resource-detector-gcp/package.json +++ b/packages/opentelemetry-resource-detector-gcp/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resource-detector-gcp", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry SDK resource detector for GCP", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -39,27 +39,26 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/core": "0.19.0", + "@opentelemetry/api": "^1.0.0", + "@opentelemetry/core": "0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/semver": "7.3.5", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "mocha": "7.2.0", "nock": "12.0.3", "nyc": "15.1.0", "rimraf": "3.0.2", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0", + "@opentelemetry/resources": "0.21.0", + "@opentelemetry/semantic-conventions": "0.21.0", "gcp-metadata": "^4.1.4", "semver": "7.3.5" } diff --git a/packages/opentelemetry-resource-detector-gcp/src/version.ts b/packages/opentelemetry-resource-detector-gcp/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-resource-detector-gcp/src/version.ts +++ b/packages/opentelemetry-resource-detector-gcp/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-resources/package.json b/packages/opentelemetry-resources/package.json index 5c3c178771..d851c0c57b 100644 --- a/packages/opentelemetry-resources/package.json +++ b/packages/opentelemetry-resources/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resources", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry SDK resources", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -48,12 +48,11 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "mocha": "7.2.0", "nock": "12.0.3", "nyc": "15.1.0", @@ -61,13 +60,13 @@ "sinon": "10.0.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0" + "@opentelemetry/core": "0.21.0", + "@opentelemetry/semantic-conventions": "0.21.0" } } diff --git a/packages/opentelemetry-resources/src/Resource.ts b/packages/opentelemetry-resources/src/Resource.ts index ea5ed0ab37..161995ac0f 100644 --- a/packages/opentelemetry-resources/src/Resource.ts +++ b/packages/opentelemetry-resources/src/Resource.ts @@ -17,6 +17,7 @@ import { ResourceAttributes as SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'; import { SDK_INFO } from '@opentelemetry/core'; import { ResourceAttributes } from './types'; +import { defaultServiceName } from './platform'; /** * A Resource describes the entity for which a signals (metrics or trace) are @@ -35,15 +36,16 @@ export class Resource { /** * Returns a Resource that indentifies the SDK in use. */ - static createTelemetrySDKResource(): Resource { + static default(): Resource { return new Resource({ + [SemanticResourceAttributes.SERVICE_NAME]: defaultServiceName(), [SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE]: SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE], [SemanticResourceAttributes.TELEMETRY_SDK_NAME]: SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_NAME], [SemanticResourceAttributes.TELEMETRY_SDK_VERSION]: SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_VERSION], - }); + }) } constructor( diff --git a/packages/opentelemetry-resources/src/platform/browser/default-service-name.ts b/packages/opentelemetry-resources/src/platform/browser/default-service-name.ts new file mode 100644 index 0000000000..c31f3bedd9 --- /dev/null +++ b/packages/opentelemetry-resources/src/platform/browser/default-service-name.ts @@ -0,0 +1,19 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export function defaultServiceName() { + return 'unknown_service'; +} \ No newline at end of file diff --git a/packages/opentelemetry-resources/src/platform/browser/detect-resources.ts b/packages/opentelemetry-resources/src/platform/browser/detect-resources.ts index 7ea78b8d39..3a815e8825 100644 --- a/packages/opentelemetry-resources/src/platform/browser/detect-resources.ts +++ b/packages/opentelemetry-resources/src/platform/browser/detect-resources.ts @@ -22,5 +22,5 @@ import { Resource } from '../../Resource'; * is async to match the signature of corresponding method for node. */ export const detectResources = async (): Promise => { - return Resource.createTelemetrySDKResource(); + return Resource.empty(); }; diff --git a/packages/opentelemetry-resources/src/platform/browser/index.ts b/packages/opentelemetry-resources/src/platform/browser/index.ts index f90eb34a5f..742d36add7 100644 --- a/packages/opentelemetry-resources/src/platform/browser/index.ts +++ b/packages/opentelemetry-resources/src/platform/browser/index.ts @@ -14,4 +14,5 @@ * limitations under the License. */ +export * from './default-service-name'; export * from './detect-resources'; diff --git a/packages/opentelemetry-resources/src/platform/node/default-service-name.ts b/packages/opentelemetry-resources/src/platform/node/default-service-name.ts new file mode 100644 index 0000000000..0f5b870a63 --- /dev/null +++ b/packages/opentelemetry-resources/src/platform/node/default-service-name.ts @@ -0,0 +1,19 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export function defaultServiceName() { + return `unknown_service:${process.argv0}`; +} \ No newline at end of file diff --git a/packages/opentelemetry-resources/src/platform/node/detect-resources.ts b/packages/opentelemetry-resources/src/platform/node/detect-resources.ts index a8e07ba42c..74a4d337b2 100644 --- a/packages/opentelemetry-resources/src/platform/node/detect-resources.ts +++ b/packages/opentelemetry-resources/src/platform/node/detect-resources.ts @@ -48,7 +48,7 @@ export const detectResources = async ( return resources.reduce( (acc, resource) => acc.merge(resource), - Resource.createTelemetrySDKResource() + Resource.empty() ); }; diff --git a/packages/opentelemetry-resources/src/platform/node/detectors/EnvDetector.ts b/packages/opentelemetry-resources/src/platform/node/detectors/EnvDetector.ts index bd2449921b..b496433b4d 100644 --- a/packages/opentelemetry-resources/src/platform/node/detectors/EnvDetector.ts +++ b/packages/opentelemetry-resources/src/platform/node/detectors/EnvDetector.ts @@ -16,6 +16,7 @@ import { diag } from '@opentelemetry/api'; import { getEnv } from '@opentelemetry/core'; +import { ResourceAttributes as SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'; import { Detector, Resource, @@ -55,20 +56,26 @@ class EnvDetector implements Detector { * @param config The resource detection config */ async detect(_config?: ResourceDetectionConfig): Promise { - try { - const rawAttributes = getEnv().OTEL_RESOURCE_ATTRIBUTES; - if (!rawAttributes) { - diag.debug( - 'EnvDetector failed: Environment variable "OTEL_RESOURCE_ATTRIBUTES" is missing.' - ); - return Resource.empty(); + const attributes: ResourceAttributes = {}; + const env = getEnv(); + + const rawAttributes = env.OTEL_RESOURCE_ATTRIBUTES; + const serviceName = env.OTEL_SERVICE_NAME; + + if (rawAttributes) { + try { + const parsedAttributes = this._parseResourceAttributes(rawAttributes); + Object.assign(attributes, parsedAttributes); + } catch (e) { + diag.debug(`EnvDetector failed: ${e.message}`); } - const attributes = this._parseResourceAttributes(rawAttributes); - return new Resource(attributes); - } catch (e) { - diag.debug(`EnvDetector failed: ${e.message}`); - return Resource.empty(); } + + if (serviceName) { + attributes[SemanticResourceAttributes.SERVICE_NAME] = serviceName; + } + + return new Resource(attributes); } /** diff --git a/packages/opentelemetry-resources/src/platform/node/index.ts b/packages/opentelemetry-resources/src/platform/node/index.ts index 7e82a09dd5..00426f781c 100644 --- a/packages/opentelemetry-resources/src/platform/node/index.ts +++ b/packages/opentelemetry-resources/src/platform/node/index.ts @@ -14,5 +14,6 @@ * limitations under the License. */ +export * from './default-service-name'; export * from './detect-resources'; export * from './detectors'; diff --git a/packages/opentelemetry-resources/src/version.ts b/packages/opentelemetry-resources/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-resources/src/version.ts +++ b/packages/opentelemetry-resources/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-resources/test/Resource.test.ts b/packages/opentelemetry-resources/test/Resource.test.ts index 4e5962895c..d321a4422c 100644 --- a/packages/opentelemetry-resources/test/Resource.test.ts +++ b/packages/opentelemetry-resources/test/Resource.test.ts @@ -17,7 +17,7 @@ import * as assert from 'assert'; import { SDK_INFO } from '@opentelemetry/core'; import { Resource } from '../src'; -import { assertTelemetrySDKResource } from './util/resource-assertions'; +import { ResourceAttributes } from '@opentelemetry/semantic-conventions'; describe('Resource', () => { const resource1 = new Resource({ @@ -84,15 +84,15 @@ describe('Resource', () => { 'custom.number': 42, 'custom.boolean': true, }); - assert.equal(resource.attributes['custom.string'], 'strvalue'); - assert.equal(resource.attributes['custom.number'], 42); - assert.equal(resource.attributes['custom.boolean'], true); + assert.strictEqual(resource.attributes['custom.string'], 'strvalue'); + assert.strictEqual(resource.attributes['custom.number'], 42); + assert.strictEqual(resource.attributes['custom.boolean'], true); }); describe('.empty()', () => { - it('should return an empty resource', () => { + it('should return an empty resource (except required service name)', () => { const resource = Resource.empty(); - assert.equal(Object.entries(resource.attributes), 0); + assert.deepStrictEqual(Object.keys(resource.attributes), []); }); it('should return the same empty resource', () => { @@ -100,14 +100,13 @@ describe('Resource', () => { }); }); - 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, - }); + describe('.default()', () => { + it('should return a default resource', () => { + const resource = Resource.default(); + assert.strictEqual(resource.attributes[ResourceAttributes.TELEMETRY_SDK_NAME], SDK_INFO[ResourceAttributes.TELEMETRY_SDK_NAME]); + assert.strictEqual(resource.attributes[ResourceAttributes.TELEMETRY_SDK_LANGUAGE], SDK_INFO[ResourceAttributes.TELEMETRY_SDK_LANGUAGE]); + assert.strictEqual(resource.attributes[ResourceAttributes.TELEMETRY_SDK_VERSION], SDK_INFO[ResourceAttributes.TELEMETRY_SDK_VERSION]); + assert.strictEqual(resource.attributes[ResourceAttributes.SERVICE_NAME], `unknown_service:${process.argv0}`); }); }); }); diff --git a/packages/opentelemetry-sdk-node/package.json b/packages/opentelemetry-sdk-node/package.json index 6de91cb1f3..f16070598d 100644 --- a/packages/opentelemetry-sdk-node/package.json +++ b/packages/opentelemetry-sdk-node/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-node", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry SDK for Node.js", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -40,37 +40,36 @@ "access": "public" }, "dependencies": { - "@opentelemetry/api-metrics": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/metrics": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/resource-detector-aws": "0.19.0", - "@opentelemetry/resource-detector-gcp": "0.19.0", - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/tracing": "0.19.0", - "nock": "12.0.3" + "@opentelemetry/api-metrics": "0.21.0", + "@opentelemetry/core": "0.21.0", + "@opentelemetry/instrumentation": "0.21.0", + "@opentelemetry/metrics": "0.21.0", + "@opentelemetry/node": "0.21.0", + "@opentelemetry/resource-detector-aws": "0.21.0", + "@opentelemetry/resource-detector-gcp": "0.21.0", + "@opentelemetry/resources": "0.21.0", + "@opentelemetry/tracing": "0.21.0" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/context-async-hooks": "0.19.0", + "@opentelemetry/api": "^1.0.0", + "@opentelemetry/context-async-hooks": "0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/semver": "7.3.5", "@types/sinon": "9.0.11", - "codecov": "3.8.1", + "codecov": "3.8.2", "gcp-metadata": "^4.1.4", - "gts": "3.1.0", "istanbul-instrumenter-loader": "3.0.1", "mocha": "7.2.0", + "nock": "12.0.3", "nyc": "15.1.0", "semver": "7.3.5", "sinon": "10.0.0", "ts-loader": "8.2.0", "ts-mocha": "8.0.0", - "typescript": "4.2.4" + "typescript": "4.3.2" } } diff --git a/packages/opentelemetry-sdk-node/src/version.ts b/packages/opentelemetry-sdk-node/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-sdk-node/src/version.ts +++ b/packages/opentelemetry-sdk-node/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-sdk-node/test/sdk.test.ts b/packages/opentelemetry-sdk-node/test/sdk.test.ts index f9274caad3..3f80f61678 100644 --- a/packages/opentelemetry-sdk-node/test/sdk.test.ts +++ b/packages/opentelemetry-sdk-node/test/sdk.test.ts @@ -16,8 +16,6 @@ import { context, - NoopTextMapPropagator, - NoopTracerProvider, propagation, ProxyTracerProvider, trace, @@ -29,7 +27,6 @@ import { AsyncHooksContextManager, AsyncLocalStorageContextManager, } from '@opentelemetry/context-async-hooks'; -import { NoopContextManager } from '@opentelemetry/api'; import { CompositePropagator } from '@opentelemetry/core'; import { ConsoleMetricExporter, MeterProvider } from '@opentelemetry/metrics'; import { NodeTracerProvider } from '@opentelemetry/node'; @@ -89,6 +86,10 @@ const DefaultContextManager = semver.gte(process.version, '14.8.0') : AsyncHooksContextManager; describe('Node SDK', () => { + let ctxManager: any; + let propagator: any; + let delegate: any; + before(() => { nock.disableNetConnect(); }); @@ -98,6 +99,10 @@ describe('Node SDK', () => { trace.disable(); propagation.disable(); metrics.disable(); + + ctxManager = context['_getContextManager'](); + propagator = propagation['_getGlobalPropagator'](); + delegate = (trace.getTracerProvider() as ProxyTracerProvider).getDelegate(); }); describe('Basic Registration', () => { @@ -108,13 +113,9 @@ describe('Node SDK', () => { await sdk.start(); - assert.ok(context['_getContextManager']() instanceof NoopContextManager); - assert.ok( - propagation['_getGlobalPropagator']() instanceof NoopTextMapPropagator - ); - - const apiTracerProvider = trace.getTracerProvider() as ProxyTracerProvider; - assert.ok(apiTracerProvider.getDelegate() instanceof NoopTracerProvider); + assert.strictEqual(context['_getContextManager'](), ctxManager, "context manager should not change"); + assert.strictEqual(propagation['_getGlobalPropagator'](), propagator, "propagator should not change"); + assert.strictEqual((trace.getTracerProvider() as ProxyTracerProvider).getDelegate(), delegate, "tracer provider should not have changed"); assert.ok(metrics.getMeterProvider() instanceof NoopMeterProvider); }); @@ -172,13 +173,9 @@ describe('Node SDK', () => { await sdk.start(); - assert.ok(context['_getContextManager']() instanceof NoopContextManager); - assert.ok( - propagation['_getGlobalPropagator']() instanceof NoopTextMapPropagator - ); - - const apiTracerProvider = trace.getTracerProvider() as ProxyTracerProvider; - assert.ok(apiTracerProvider.getDelegate() instanceof NoopTracerProvider); + assert.strictEqual(context['_getContextManager'](), ctxManager, "context manager should not change"); + assert.strictEqual(propagation['_getGlobalPropagator'](), propagator, "propagator should not change"); + assert.strictEqual((trace.getTracerProvider() as ProxyTracerProvider).getDelegate(), delegate, "tracer provider should not have changed"); assert.ok(metrics.getMeterProvider() instanceof MeterProvider); }); @@ -305,7 +302,7 @@ describe('Node SDK', () => { }); const resource: Resource = sdk['_resource']; assert.ok(resource); - assert.deepStrictEqual(resource, Resource.createTelemetrySDKResource()); + assert.deepStrictEqual(resource, Resource.empty()); scope.done(); }); @@ -395,34 +392,6 @@ describe('Node SDK', () => { ); }); - describe('with missing environment variable', () => { - beforeEach(() => { - delete process.env.OTEL_RESOURCE_ATTRIBUTES; - }); - - it('prints correct error messages when EnvDetector has no env variable', async () => { - const sdk = new NodeSDK({ - autoDetectResources: true, - }); - const mockedLoggerMethod = Sinon.fake(); - diag.setLogger( - { - debug: mockedLoggerMethod, - } as any, - DiagLogLevel.DEBUG - ); - - await sdk.detectResources(); - - assert.ok( - callArgsContains( - mockedLoggerMethod, - 'EnvDetector failed: Environment variable "OTEL_RESOURCE_ATTRIBUTES" is missing.' - ) - ); - }); - }); - describe('with a faulty environment variable', () => { beforeEach(() => { process.env.OTEL_RESOURCE_ATTRIBUTES = 'bad=~attribute'; diff --git a/packages/opentelemetry-semantic-conventions/package.json b/packages/opentelemetry-semantic-conventions/package.json index a2e90a7450..196fccb651 100644 --- a/packages/opentelemetry-semantic-conventions/package.json +++ b/packages/opentelemetry-semantic-conventions/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/semantic-conventions", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry semantic conventions", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -46,8 +46,7 @@ "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "mocha": "7.2.0", "nock": "12.0.3", "nyc": "15.1.0", @@ -55,6 +54,6 @@ "sinon": "10.0.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" } } diff --git a/packages/opentelemetry-semantic-conventions/src/resource/ResourceAttributes.ts b/packages/opentelemetry-semantic-conventions/src/resource/ResourceAttributes.ts index 4157bafeff..06d7a872d3 100644 --- a/packages/opentelemetry-semantic-conventions/src/resource/ResourceAttributes.ts +++ b/packages/opentelemetry-semantic-conventions/src/resource/ResourceAttributes.ts @@ -16,409 +16,442 @@ // DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates//templates/SemanticAttributes.ts.j2 export const ResourceAttributes = { + /** - * Name of the cloud provider. - */ + * Name of the cloud provider. + */ CLOUD_PROVIDER: 'cloud.provider', /** - * The cloud account ID the resource is assigned to. - */ + * The cloud account ID the resource is assigned to. + */ CLOUD_ACCOUNT_ID: 'cloud.account.id', /** - * The geographical region the resource is running. Refer to your provider's docs to see the available regions, for example [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), or [Google Cloud regions](https://cloud.google.com/about/locations). - */ + * The geographical region the resource is running. Refer to your provider's docs to see the available regions, for example [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), or [Google Cloud regions](https://cloud.google.com/about/locations). + */ CLOUD_REGION: 'cloud.region', /** - * Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running. - * - * Note: Availability zones are called "zones" on Google Cloud. - */ + * Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running. + * + * Note: Availability zones are called "zones" on Google Cloud. + */ CLOUD_AVAILABILITY_ZONE: 'cloud.availability_zone', /** - * The cloud platform in use. - * - * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. - */ + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + */ CLOUD_PLATFORM: 'cloud.platform', /** - * The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). - */ + * The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + */ AWS_ECS_CONTAINER_ARN: 'aws.ecs.container.arn', /** - * The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). - */ + * The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + */ AWS_ECS_CLUSTER_ARN: 'aws.ecs.cluster.arn', /** - * The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS task. - */ + * The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS task. + */ AWS_ECS_LAUNCHTYPE: 'aws.ecs.launchtype', /** - * The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). - */ + * The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). + */ AWS_ECS_TASK_ARN: 'aws.ecs.task.arn', /** - * The task definition family this task definition is a member of. - */ + * The task definition family this task definition is a member of. + */ AWS_ECS_TASK_FAMILY: 'aws.ecs.task.family', /** - * The revision for this task definition. - */ + * The revision for this task definition. + */ AWS_ECS_TASK_REVISION: 'aws.ecs.task.revision', /** - * The ARN of an EKS cluster. - */ + * The ARN of an EKS cluster. + */ AWS_EKS_CLUSTER_ARN: 'aws.eks.cluster.arn', /** - * The name(s) of the AWS log group(s) an application is writing to. - * - * Note: Multiple log groups must be supported for cases like multi-container applications, where a single application has sidecar containers, and each write to their own log group. - */ + * The name(s) of the AWS log group(s) an application is writing to. + * + * Note: Multiple log groups must be supported for cases like multi-container applications, where a single application has sidecar containers, and each write to their own log group. + */ AWS_LOG_GROUP_NAMES: 'aws.log.group.names', /** - * The Amazon Resource Name(s) (ARN) of the AWS log group(s). - * - * Note: See the [log group ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). - */ + * The Amazon Resource Name(s) (ARN) of the AWS log group(s). + * + * Note: See the [log group ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + */ AWS_LOG_GROUP_ARNS: 'aws.log.group.arns', /** - * The name(s) of the AWS log stream(s) an application is writing to. - */ + * The name(s) of the AWS log stream(s) an application is writing to. + */ AWS_LOG_STREAM_NAMES: 'aws.log.stream.names', /** - * The ARN(s) of the AWS log stream(s). - * - * Note: See the [log stream ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain several log streams, so these ARNs necessarily identify both a log group and a log stream. - */ + * The ARN(s) of the AWS log stream(s). + * + * Note: See the [log stream ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain several log streams, so these ARNs necessarily identify both a log group and a log stream. + */ AWS_LOG_STREAM_ARNS: 'aws.log.stream.arns', /** - * Container name. - */ + * Container name. + */ CONTAINER_NAME: 'container.name', /** - * Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/reference/run/#container-identification). The UUID might be abbreviated. - */ + * Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/reference/run/#container-identification). The UUID might be abbreviated. + */ CONTAINER_ID: 'container.id', /** - * The container runtime managing this container. - */ + * The container runtime managing this container. + */ CONTAINER_RUNTIME: 'container.runtime', /** - * Name of the image the container was built on. - */ + * Name of the image the container was built on. + */ CONTAINER_IMAGE_NAME: 'container.image.name', /** - * Container image tag. - */ + * Container image tag. + */ CONTAINER_IMAGE_TAG: 'container.image.tag', /** - * Name of the [deployment environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka deployment tier). - */ + * Name of the [deployment environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka deployment tier). + */ DEPLOYMENT_ENVIRONMENT: 'deployment.environment', /** - * The name of the function being executed. - */ + * A unique identifier representing the device. + * + * Note: The device identifier MUST only be defined using the values outlined below. This value is not an advertising identifier and MUST NOT be used as such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the Firebase Installation ID or a globally unique UUID which is persisted across sessions in your application. More information can be found [here](https://developer.android.com/training/articles/user-data-ids) on best practices and exact implementation details. Caution should be taken when storing personal data or anything which can identify a user. GDPR and data protection laws may apply, ensure you do your own due diligence. + */ + DEVICE_ID: 'device.id', + + /** + * The model identifier for the device. + * + * Note: It's recommended this value represents a machine readable version of the model identifier rather than the market or consumer-friendly name of the device. + */ + DEVICE_MODEL_IDENTIFIER: 'device.model.identifier', + + /** + * The marketing name for the device model. + * + * Note: It's recommended this value represents a human readable version of the device model rather than a machine readable alternative. + */ + DEVICE_MODEL_NAME: 'device.model.name', + + /** + * The name of the function being executed. + */ FAAS_NAME: 'faas.name', /** - * The unique ID of the function being executed. - * - * Note: For example, in AWS Lambda this field corresponds to the [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) value, in GCP to the URI of the resource, and in Azure to the [FunctionDirectory](https://github.com/Azure/azure-functions-host/wiki/Retrieving-information-about-the-currently-running-function) field. - */ + * The unique ID of the function being executed. + * + * Note: For example, in AWS Lambda this field corresponds to the [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) value, in GCP to the URI of the resource, and in Azure to the [FunctionDirectory](https://github.com/Azure/azure-functions-host/wiki/Retrieving-information-about-the-currently-running-function) field. + */ FAAS_ID: 'faas.id', /** - * The version string of the function being executed as defined in [Version Attributes](../../resource/semantic_conventions/README.md#version-attributes). - */ + * The version string of the function being executed as defined in [Version Attributes](../../resource/semantic_conventions/README.md#version-attributes). + */ FAAS_VERSION: 'faas.version', /** - * The execution environment ID as a string. - */ + * The execution environment ID as a string. + */ FAAS_INSTANCE: 'faas.instance', /** - * The amount of memory available to the serverless function in MiB. - * - * Note: It's recommended to set this attribute since e.g. too little memory can easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information. - */ + * The amount of memory available to the serverless function in MiB. + * + * Note: It's recommended to set this attribute since e.g. too little memory can easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information. + */ FAAS_MAX_MEMORY: 'faas.max_memory', /** - * Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. - */ + * Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. + */ HOST_ID: 'host.id', /** - * Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user. - */ + * Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user. + */ HOST_NAME: 'host.name', /** - * Type of host. For Cloud, this must be the machine type. - */ + * Type of host. For Cloud, this must be the machine type. + */ HOST_TYPE: 'host.type', /** - * The CPU architecture the host system is running on. - */ + * The CPU architecture the host system is running on. + */ HOST_ARCH: 'host.arch', /** - * Name of the VM image or OS install the host was instantiated from. - */ + * Name of the VM image or OS install the host was instantiated from. + */ HOST_IMAGE_NAME: 'host.image.name', /** - * VM image ID. For Cloud, this value is from the provider. - */ + * VM image ID. For Cloud, this value is from the provider. + */ HOST_IMAGE_ID: 'host.image.id', /** - * The version string of the VM image as defined in [Version Attributes](README.md#version-attributes). - */ + * The version string of the VM image as defined in [Version Attributes](README.md#version-attributes). + */ HOST_IMAGE_VERSION: 'host.image.version', /** - * The name of the cluster. - */ + * The name of the cluster. + */ K8S_CLUSTER_NAME: 'k8s.cluster.name', /** - * The name of the Node. - */ + * The name of the Node. + */ K8S_NODE_NAME: 'k8s.node.name', /** - * The UID of the Node. - */ + * The UID of the Node. + */ K8S_NODE_UID: 'k8s.node.uid', /** - * The name of the namespace that the pod is running in. - */ + * The name of the namespace that the pod is running in. + */ K8S_NAMESPACE_NAME: 'k8s.namespace.name', /** - * The UID of the Pod. - */ + * The UID of the Pod. + */ K8S_POD_UID: 'k8s.pod.uid', /** - * The name of the Pod. - */ + * The name of the Pod. + */ K8S_POD_NAME: 'k8s.pod.name', /** - * The name of the Container in a Pod template. - */ + * The name of the Container in a Pod template. + */ K8S_CONTAINER_NAME: 'k8s.container.name', /** - * The UID of the ReplicaSet. - */ + * The UID of the ReplicaSet. + */ K8S_REPLICASET_UID: 'k8s.replicaset.uid', /** - * The name of the ReplicaSet. - */ + * The name of the ReplicaSet. + */ K8S_REPLICASET_NAME: 'k8s.replicaset.name', /** - * The UID of the Deployment. - */ + * The UID of the Deployment. + */ K8S_DEPLOYMENT_UID: 'k8s.deployment.uid', /** - * The name of the Deployment. - */ + * The name of the Deployment. + */ K8S_DEPLOYMENT_NAME: 'k8s.deployment.name', /** - * The UID of the StatefulSet. - */ + * The UID of the StatefulSet. + */ K8S_STATEFULSET_UID: 'k8s.statefulset.uid', /** - * The name of the StatefulSet. - */ + * The name of the StatefulSet. + */ K8S_STATEFULSET_NAME: 'k8s.statefulset.name', /** - * The UID of the DaemonSet. - */ + * The UID of the DaemonSet. + */ K8S_DAEMONSET_UID: 'k8s.daemonset.uid', /** - * The name of the DaemonSet. - */ + * The name of the DaemonSet. + */ K8S_DAEMONSET_NAME: 'k8s.daemonset.name', /** - * The UID of the Job. - */ + * The UID of the Job. + */ K8S_JOB_UID: 'k8s.job.uid', /** - * The name of the Job. - */ + * The name of the Job. + */ K8S_JOB_NAME: 'k8s.job.name', /** - * The UID of the CronJob. - */ + * The UID of the CronJob. + */ K8S_CRONJOB_UID: 'k8s.cronjob.uid', /** - * The name of the CronJob. - */ + * The name of the CronJob. + */ K8S_CRONJOB_NAME: 'k8s.cronjob.name', /** - * The operating system type. - */ + * The operating system type. + */ OS_TYPE: 'os.type', /** - * Human readable (not intended to be parsed) OS version information, like e.g. reported by `ver` or `lsb_release -a` commands. - */ + * Human readable (not intended to be parsed) OS version information, like e.g. reported by `ver` or `lsb_release -a` commands. + */ OS_DESCRIPTION: 'os.description', /** - * Process identifier (PID). - */ + * Human readable operating system name. + */ + OS_NAME: 'os.name', + + /** + * The version string of the operating system as defined in [Version Attributes](../../resource/semantic_conventions/README.md#version-attributes). + */ + OS_VERSION: 'os.version', + + /** + * Process identifier (PID). + */ PROCESS_PID: 'process.pid', /** - * The name of the process executable. On Linux based systems, can be set to the `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of `GetProcessImageFileNameW`. - */ + * The name of the process executable. On Linux based systems, can be set to the `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of `GetProcessImageFileNameW`. + */ PROCESS_EXECUTABLE_NAME: 'process.executable.name', /** - * The full path to the process executable. On Linux based systems, can be set to the target of `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`. - */ + * The full path to the process executable. On Linux based systems, can be set to the target of `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`. + */ PROCESS_EXECUTABLE_PATH: 'process.executable.path', /** - * The command used to launch the process (i.e. the command name). On Linux based systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter extracted from `GetCommandLineW`. - */ + * The command used to launch the process (i.e. the command name). On Linux based systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter extracted from `GetCommandLineW`. + */ PROCESS_COMMAND: 'process.command', /** - * The full command used to launch the process as a single string representing the full command. On Windows, can be set to the result of `GetCommandLineW`. Do not set this if you have to assemble it just for monitoring; use `process.command_args` instead. - */ + * The full command used to launch the process as a single string representing the full command. On Windows, can be set to the result of `GetCommandLineW`. Do not set this if you have to assemble it just for monitoring; use `process.command_args` instead. + */ PROCESS_COMMAND_LINE: 'process.command_line', /** - * All the command arguments (including the command/executable itself) as received by the process. On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according to the list of null-delimited strings extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be the full argv vector passed to `main`. - */ + * All the command arguments (including the command/executable itself) as received by the process. On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according to the list of null-delimited strings extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be the full argv vector passed to `main`. + */ PROCESS_COMMAND_ARGS: 'process.command_args', /** - * The username of the user that owns the process. - */ + * The username of the user that owns the process. + */ PROCESS_OWNER: 'process.owner', /** - * The name of the runtime of this process. For compiled native binaries, this SHOULD be the name of the compiler. - */ + * The name of the runtime of this process. For compiled native binaries, this SHOULD be the name of the compiler. + */ PROCESS_RUNTIME_NAME: 'process.runtime.name', /** - * The version of the runtime of this process, as returned by the runtime without modification. - */ + * The version of the runtime of this process, as returned by the runtime without modification. + */ PROCESS_RUNTIME_VERSION: 'process.runtime.version', /** - * An additional description about the runtime of the process, for example a specific vendor customization of the runtime environment. - */ + * An additional description about the runtime of the process, for example a specific vendor customization of the runtime environment. + */ PROCESS_RUNTIME_DESCRIPTION: 'process.runtime.description', /** - * Logical name of the service. - * - * Note: MUST be the same for all instances of horizontally scaled services. If the value was not specified, SDKs MUST fallback to `unknown_service:` concatenated with [`process.executable.name`](process.md#process), e.g. `unknown_service:bash`. If `process.executable.name` is not available, the value MUST be set to `unknown_service`. - */ + * Logical name of the service. + * + * Note: MUST be the same for all instances of horizontally scaled services. If the value was not specified, SDKs MUST fallback to `unknown_service:` concatenated with [`process.executable.name`](process.md#process), e.g. `unknown_service:bash`. If `process.executable.name` is not available, the value MUST be set to `unknown_service`. + */ SERVICE_NAME: 'service.name', /** - * A namespace for `service.name`. - * - * Note: A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. `service.name` is expected to be unique within the same namespace. If `service.namespace` is not specified in the Resource then `service.name` is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace. - */ + * A namespace for `service.name`. + * + * Note: A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. `service.name` is expected to be unique within the same namespace. If `service.namespace` is not specified in the Resource then `service.name` is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace. + */ SERVICE_NAMESPACE: 'service.namespace', /** - * The string ID of the service instance. - * - * Note: MUST be unique for each instance of the same `service.namespace,service.name` pair (in other words `service.namespace,service.name,service.instance.id` triplet MUST be globally unique). The ID helps to distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled service). It is preferable for the ID to be persistent and stay the same for the lifetime of the service instance, however it is acceptable that the ID is ephemeral and changes during important lifetime events for the service (e.g. service restarts). If the service has no inherent unique ID that can be used as the value of this attribute it is recommended to generate a random Version 1 or Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use Version 5, see RFC 4122 for more recommendations). - */ + * The string ID of the service instance. + * + * Note: MUST be unique for each instance of the same `service.namespace,service.name` pair (in other words `service.namespace,service.name,service.instance.id` triplet MUST be globally unique). The ID helps to distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled service). It is preferable for the ID to be persistent and stay the same for the lifetime of the service instance, however it is acceptable that the ID is ephemeral and changes during important lifetime events for the service (e.g. service restarts). If the service has no inherent unique ID that can be used as the value of this attribute it is recommended to generate a random Version 1 or Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use Version 5, see RFC 4122 for more recommendations). + */ SERVICE_INSTANCE_ID: 'service.instance.id', /** - * The version string of the service API or implementation. - */ + * The version string of the service API or implementation. + */ SERVICE_VERSION: 'service.version', /** - * The name of the telemetry SDK as defined above. - */ + * The name of the telemetry SDK as defined above. + */ TELEMETRY_SDK_NAME: 'telemetry.sdk.name', /** - * The language of the telemetry SDK. - */ + * The language of the telemetry SDK. + */ TELEMETRY_SDK_LANGUAGE: 'telemetry.sdk.language', /** - * The version string of the telemetry SDK. - */ + * The version string of the telemetry SDK. + */ TELEMETRY_SDK_VERSION: 'telemetry.sdk.version', /** - * The version string of the auto instrumentation agent, if used. - */ + * The version string of the auto instrumentation agent, if used. + */ TELEMETRY_AUTO_VERSION: 'telemetry.auto.version', /** - * The name of the web engine. - */ + * The name of the web engine. + */ WEBENGINE_NAME: 'webengine.name', /** - * The version of the web engine. - */ + * The version of the web engine. + */ WEBENGINE_VERSION: 'webengine.version', /** - * Additional description of the web engine (e.g. detailed version and edition information). - */ + * Additional description of the web engine (e.g. detailed version and edition information). + */ WEBENGINE_DESCRIPTION: 'webengine.description', -}; +} // Enum definitions + export enum CloudProviderValues { /** Amazon Web Services. */ AWS = 'aws', @@ -428,6 +461,9 @@ export enum CloudProviderValues { GCP = 'gcp', } + + + export enum CloudPlatformValues { /** AWS Elastic Compute Cloud. */ AWS_EC2 = 'aws_ec2', @@ -438,29 +474,32 @@ export enum CloudPlatformValues { /** AWS Lambda. */ AWS_LAMBDA = 'aws_lambda', /** AWS Elastic Beanstalk. */ - AWS_ELASTICBEANSTALK = 'aws_elastic_beanstalk', + AWS_ELASTIC_BEANSTALK = 'aws_elastic_beanstalk', /** Azure Virtual Machines. */ AZURE_VM = 'azure_vm', /** Azure Container Instances. */ - AZURE_CONTAINERINSTANCES = 'azure_container_instances', + AZURE_CONTAINER_INSTANCES = 'azure_container_instances', /** Azure Kubernetes Service. */ AZURE_AKS = 'azure_aks', /** Azure Functions. */ AZURE_FUNCTIONS = 'azure_functions', /** Azure App Service. */ - AZURE_APPSERVICE = 'azure_app_service', + AZURE_APP_SERVICE = 'azure_app_service', /** Google Cloud Compute Engine (GCE). */ - GCP_COMPUTEENGINE = 'gcp_compute_engine', + GCP_COMPUTE_ENGINE = 'gcp_compute_engine', /** Google Cloud Run. */ - GCP_CLOUDRUN = 'gcp_cloud_run', + GCP_CLOUD_RUN = 'gcp_cloud_run', /** Google Cloud Kubernetes Engine (GKE). */ - GCP_KUBERNETESENGINE = 'gcp_kubernetes_engine', + GCP_KUBERNETES_ENGINE = 'gcp_kubernetes_engine', /** Google Cloud Functions (GCF). */ - GCP_CLOUDFUNCTIONS = 'gcp_cloud_functions', + GCP_CLOUD_FUNCTIONS = 'gcp_cloud_functions', /** Google Cloud App Engine (GAE). */ - GCP_APPENGINE = 'gcp_app_engine', + GCP_APP_ENGINE = 'gcp_app_engine', } + + + export enum AwsEcsLaunchtypeValues { /** ec2. */ EC2 = 'ec2', @@ -468,6 +507,9 @@ export enum AwsEcsLaunchtypeValues { FARGATE = 'fargate', } + + + export enum HostArchValues { /** AMD64. */ AMD64 = 'amd64', @@ -485,31 +527,37 @@ export enum HostArchValues { X86 = 'x86', } + + + export enum OsTypeValues { /** Microsoft Windows. */ - WINDOWS = 'WINDOWS', + WINDOWS = 'windows', /** Linux. */ - LINUX = 'LINUX', + LINUX = 'linux', /** Apple Darwin. */ - DARWIN = 'DARWIN', + DARWIN = 'darwin', /** FreeBSD. */ - FREEBSD = 'FREEBSD', + FREEBSD = 'freebsd', /** NetBSD. */ - NETBSD = 'NETBSD', + NETBSD = 'netbsd', /** OpenBSD. */ - OPENBSD = 'OPENBSD', + OPENBSD = 'openbsd', /** DragonFly BSD. */ - DRAGONFLYBSD = 'DRAGONFLYBSD', + DRAGONFLYBSD = 'dragonflybsd', /** HP-UX (Hewlett Packard Unix). */ - HPUX = 'HPUX', + HPUX = 'hpux', /** AIX (Advanced Interactive eXecutive). */ - AIX = 'AIX', + AIX = 'aix', /** Oracle Solaris. */ - SOLARIS = 'SOLARIS', + SOLARIS = 'solaris', /** IBM z/OS. */ - ZOS = 'ZOS', + Z_OS = 'z_os', } + + + export enum TelemetrySdkLanguageValues { /** cpp. */ CPP = 'cpp', @@ -532,3 +580,4 @@ export enum TelemetrySdkLanguageValues { /** webjs. */ WEBJS = 'webjs', } + diff --git a/packages/opentelemetry-semantic-conventions/src/trace/SemanticAttributes.ts b/packages/opentelemetry-semantic-conventions/src/trace/SemanticAttributes.ts index 6dbda53b4b..30f20a7b2e 100644 --- a/packages/opentelemetry-semantic-conventions/src/trace/SemanticAttributes.ts +++ b/packages/opentelemetry-semantic-conventions/src/trace/SemanticAttributes.ts @@ -16,132 +16,132 @@ // DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates//templates/SemanticAttributes.ts.j2 export const SemanticAttributes = { + /** - * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. - */ + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + */ DB_SYSTEM: 'db.system', /** - * The connection string used to connect to the database. It is recommended to remove embedded credentials. - */ + * The connection string used to connect to the database. It is recommended to remove embedded credentials. + */ DB_CONNECTION_STRING: 'db.connection_string', /** - * Username for accessing the database. - */ + * Username for accessing the database. + */ DB_USER: 'db.user', /** - * The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect. - */ + * The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect. + */ DB_JDBC_DRIVER_CLASSNAME: 'db.jdbc.driver_classname', /** - * If no [tech-specific attribute](#call-level-attributes-for-specific-technologies) is defined, this attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails). - * - * Note: In some SQL databases, the database name to be used is called "schema name". - */ + * If no [tech-specific attribute](#call-level-attributes-for-specific-technologies) is defined, this attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails). + * + * Note: In some SQL databases, the database name to be used is called "schema name". + */ DB_NAME: 'db.name', /** - * The database statement being executed. - * - * Note: The value may be sanitized to exclude sensitive information. - */ + * The database statement being executed. + * + * Note: The value may be sanitized to exclude sensitive information. + */ DB_STATEMENT: 'db.statement', /** - * The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword. - * - * Note: When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted. - */ + * The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword. + * + * Note: When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted. + */ DB_OPERATION: 'db.operation', /** - * The Microsoft SQL Server [instance name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) connecting to. This name is used to determine the port of a named instance. - * - * Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer required (but still recommended if non-standard). - */ + * The Microsoft SQL Server [instance name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) connecting to. This name is used to determine the port of a named instance. + * + * Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer required (but still recommended if non-standard). + */ DB_MSSQL_INSTANCE_NAME: 'db.mssql.instance_name', /** - * The name of the keyspace being accessed. To be used instead of the generic `db.name` attribute. - */ + * The name of the keyspace being accessed. To be used instead of the generic `db.name` attribute. + */ DB_CASSANDRA_KEYSPACE: 'db.cassandra.keyspace', /** - * The fetch size used for paging, i.e. how many rows will be returned at once. - */ + * The fetch size used for paging, i.e. how many rows will be returned at once. + */ DB_CASSANDRA_PAGE_SIZE: 'db.cassandra.page_size', /** - * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). - */ + * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + */ DB_CASSANDRA_CONSISTENCY_LEVEL: 'db.cassandra.consistency_level', /** - * The name of the primary table that the operation is acting upon, including the schema name (if applicable). - * - * Note: This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set. - */ + * The name of the primary table that the operation is acting upon, including the schema name (if applicable). + * + * Note: This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set. + */ DB_CASSANDRA_TABLE: 'db.cassandra.table', /** - * Whether or not the query is idempotent. - */ + * Whether or not the query is idempotent. + */ DB_CASSANDRA_IDEMPOTENCE: 'db.cassandra.idempotence', /** - * The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. - */ - DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT: - 'db.cassandra.speculative_execution_count', + * The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. + */ + DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT: 'db.cassandra.speculative_execution_count', /** - * The ID of the coordinating node for a query. - */ + * The ID of the coordinating node for a query. + */ DB_CASSANDRA_COORDINATOR_ID: 'db.cassandra.coordinator.id', /** - * The data center of the coordinating node for a query. - */ + * The data center of the coordinating node for a query. + */ DB_CASSANDRA_COORDINATOR_DC: 'db.cassandra.coordinator.dc', /** - * The [HBase namespace](https://hbase.apache.org/book.html#_namespace) being accessed. To be used instead of the generic `db.name` attribute. - */ + * The [HBase namespace](https://hbase.apache.org/book.html#_namespace) being accessed. To be used instead of the generic `db.name` attribute. + */ DB_HBASE_NAMESPACE: 'db.hbase.namespace', /** - * The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute. - */ + * The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute. + */ DB_REDIS_DATABASE_INDEX: 'db.redis.database_index', /** - * The collection being accessed within the database stated in `db.name`. - */ + * The collection being accessed within the database stated in `db.name`. + */ DB_MONGODB_COLLECTION: 'db.mongodb.collection', /** - * The name of the primary table that the operation is acting upon, including the schema name (if applicable). - * - * Note: It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set. - */ + * The name of the primary table that the operation is acting upon, including the schema name (if applicable). + * + * Note: It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set. + */ DB_SQL_TABLE: 'db.sql.table', /** - * The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. - */ + * The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. + */ EXCEPTION_TYPE: 'exception.type', /** - * The exception message. - */ + * The exception message. + */ EXCEPTION_MESSAGE: 'exception.message', /** - * A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. - */ + * A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. + */ EXCEPTION_STACKTRACE: 'exception.stacktrace', /** @@ -167,466 +167,490 @@ clear whether the exception will escape. EXCEPTION_ESCAPED: 'exception.escaped', /** - * Type of the trigger on which the function is executed. - */ + * Type of the trigger on which the function is executed. + */ FAAS_TRIGGER: 'faas.trigger', /** - * The execution ID of the current function execution. - */ + * The execution ID of the current function execution. + */ FAAS_EXECUTION: 'faas.execution', /** - * The name of the source on which the triggering operation was performed. For example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the database name. - */ + * The name of the source on which the triggering operation was performed. For example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the database name. + */ FAAS_DOCUMENT_COLLECTION: 'faas.document.collection', /** - * Describes the type of the operation that was performed on the data. - */ + * Describes the type of the operation that was performed on the data. + */ FAAS_DOCUMENT_OPERATION: 'faas.document.operation', /** - * A string containing the time when the data was accessed in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). - */ + * A string containing the time when the data was accessed in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + */ FAAS_DOCUMENT_TIME: 'faas.document.time', /** - * The document name/table subjected to the operation. For example, in Cloud Storage or S3 is the name of the file, and in Cosmos DB the table name. - */ + * The document name/table subjected to the operation. For example, in Cloud Storage or S3 is the name of the file, and in Cosmos DB the table name. + */ FAAS_DOCUMENT_NAME: 'faas.document.name', /** - * A string containing the function invocation time in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). - */ + * A string containing the function invocation time in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + */ FAAS_TIME: 'faas.time', /** - * A string containing the schedule period as [Cron Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). - */ + * A string containing the schedule period as [Cron Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + */ FAAS_CRON: 'faas.cron', /** - * A boolean that is true if the serverless function is executed for the first time (aka cold-start). - */ + * A boolean that is true if the serverless function is executed for the first time (aka cold-start). + */ FAAS_COLDSTART: 'faas.coldstart', /** - * The name of the invoked function. - * - * Note: SHOULD be equal to the `faas.name` resource attribute of the invoked function. - */ + * The name of the invoked function. + * + * Note: SHOULD be equal to the `faas.name` resource attribute of the invoked function. + */ FAAS_INVOKED_NAME: 'faas.invoked_name', /** - * The cloud provider of the invoked function. - * - * Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function. - */ + * The cloud provider of the invoked function. + * + * Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function. + */ FAAS_INVOKED_PROVIDER: 'faas.invoked_provider', /** - * The cloud region of the invoked function. - * - * Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked function. - */ + * The cloud region of the invoked function. + * + * Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked function. + */ FAAS_INVOKED_REGION: 'faas.invoked_region', /** - * Transport protocol used. See note below. - */ + * Transport protocol used. See note below. + */ NET_TRANSPORT: 'net.transport', /** - * Remote address of the peer (dotted decimal for IPv4 or [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6). - */ + * Remote address of the peer (dotted decimal for IPv4 or [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6). + */ NET_PEER_IP: 'net.peer.ip', /** - * Remote port number. - */ + * Remote port number. + */ NET_PEER_PORT: 'net.peer.port', /** - * Remote hostname or similar, see note below. - */ + * Remote hostname or similar, see note below. + */ NET_PEER_NAME: 'net.peer.name', /** - * Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host. - */ + * Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host. + */ NET_HOST_IP: 'net.host.ip', /** - * Like `net.peer.port` but for the host port. - */ + * Like `net.peer.port` but for the host port. + */ NET_HOST_PORT: 'net.host.port', /** - * Local hostname or similar, see note below. - */ + * Local hostname or similar, see note below. + */ NET_HOST_NAME: 'net.host.name', /** - * The [`service.name`](../../resource/semantic_conventions/README.md#service) of the remote service. SHOULD be equal to the actual `service.name` resource attribute of the remote service if any. - */ + * The [`service.name`](../../resource/semantic_conventions/README.md#service) of the remote service. SHOULD be equal to the actual `service.name` resource attribute of the remote service if any. + */ PEER_SERVICE: 'peer.service', /** - * Username or client_id extracted from the access token or [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the inbound request from outside the system. - */ + * Username or client_id extracted from the access token or [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the inbound request from outside the system. + */ ENDUSER_ID: 'enduser.id', /** - * Actual/assumed role the client is making the request under extracted from token or application security context. - */ + * Actual/assumed role the client is making the request under extracted from token or application security context. + */ ENDUSER_ROLE: 'enduser.role', /** - * Scopes or granted authorities the client currently possesses extracted from token or application security context. The value would come from the scope associated with an [OAuth 2.0 Access Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value in a [SAML 2.0 Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). - */ + * Scopes or granted authorities the client currently possesses extracted from token or application security context. The value would come from the scope associated with an [OAuth 2.0 Access Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value in a [SAML 2.0 Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + */ ENDUSER_SCOPE: 'enduser.scope', /** - * Current "managed" thread ID (as opposed to OS thread ID). - */ + * Current "managed" thread ID (as opposed to OS thread ID). + */ THREAD_ID: 'thread.id', /** - * Current thread name. - */ + * Current thread name. + */ THREAD_NAME: 'thread.name', /** - * The method or function name, or equivalent (usually rightmost part of the code unit's name). - */ + * The method or function name, or equivalent (usually rightmost part of the code unit's name). + */ CODE_FUNCTION: 'code.function', /** - * The "namespace" within which `code.function` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function` form a unique identifier for the code unit. - */ + * The "namespace" within which `code.function` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function` form a unique identifier for the code unit. + */ CODE_NAMESPACE: 'code.namespace', /** - * The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path). - */ + * The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path). + */ CODE_FILEPATH: 'code.filepath', /** - * The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. - */ + * The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. + */ CODE_LINENO: 'code.lineno', /** - * HTTP request method. - */ + * HTTP request method. + */ HTTP_METHOD: 'http.method', /** - * Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not transmitted over HTTP, but if it is known, it should be included nevertheless. - * - * Note: `http.url` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case the attribute's value should be `https://www.example.com/`. - */ + * Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not transmitted over HTTP, but if it is known, it should be included nevertheless. + * + * Note: `http.url` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case the attribute's value should be `https://www.example.com/`. + */ HTTP_URL: 'http.url', /** - * The full request target as passed in a HTTP request line or equivalent. - */ + * The full request target as passed in a HTTP request line or equivalent. + */ HTTP_TARGET: 'http.target', /** - * The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is empty or not present, this attribute should be the same. - */ + * The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is empty or not present, this attribute should be the same. + */ HTTP_HOST: 'http.host', /** - * The URI scheme identifying the used protocol. - */ + * The URI scheme identifying the used protocol. + */ HTTP_SCHEME: 'http.scheme', /** - * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). - */ + * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). + */ HTTP_STATUS_CODE: 'http.status_code', /** - * Kind of HTTP protocol used. - * - * Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. - */ + * Kind of HTTP protocol used. + * + * Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + */ HTTP_FLAVOR: 'http.flavor', /** - * Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client. - */ + * Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client. + */ HTTP_USER_AGENT: 'http.user_agent', /** - * The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For requests using transport encoding, this should be the compressed size. - */ + * The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For requests using transport encoding, this should be the compressed size. + */ HTTP_REQUEST_CONTENT_LENGTH: 'http.request_content_length', /** - * The size of the uncompressed request payload body after transport decoding. Not set if transport encoding not used. - */ - HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED: - 'http.request_content_length_uncompressed', + * The size of the uncompressed request payload body after transport decoding. Not set if transport encoding not used. + */ + HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED: 'http.request_content_length_uncompressed', /** - * The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For requests using transport encoding, this should be the compressed size. - */ + * The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For requests using transport encoding, this should be the compressed size. + */ HTTP_RESPONSE_CONTENT_LENGTH: 'http.response_content_length', /** - * The size of the uncompressed response payload body after transport decoding. Not set if transport encoding not used. - */ - HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED: - 'http.response_content_length_uncompressed', + * The size of the uncompressed response payload body after transport decoding. Not set if transport encoding not used. + */ + HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED: 'http.response_content_length_uncompressed', /** - * The primary server name of the matched virtual host. This should be obtained via configuration. If no such configuration can be obtained, this attribute MUST NOT be set ( `net.host.name` should be used instead). - * - * Note: `http.url` is usually not readily available on the server side but would have to be assembled in a cumbersome and sometimes lossy process from other information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus preferred to supply the raw data that is available. - */ + * The primary server name of the matched virtual host. This should be obtained via configuration. If no such configuration can be obtained, this attribute MUST NOT be set ( `net.host.name` should be used instead). + * + * Note: `http.url` is usually not readily available on the server side but would have to be assembled in a cumbersome and sometimes lossy process from other information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus preferred to supply the raw data that is available. + */ HTTP_SERVER_NAME: 'http.server_name', /** - * The matched route (path template). - */ + * The matched route (path template). + */ HTTP_ROUTE: 'http.route', /** - * The IP address of the original client behind all proxies, if known (e.g. from [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). - * - * Note: This is not necessarily the same as `net.peer.ip`, which would identify the network-level peer, which may be a proxy. - */ + * The IP address of the original client behind all proxies, if known (e.g. from [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). + * + * Note: This is not necessarily the same as `net.peer.ip`, which would identify the network-level peer, which may be a proxy. + */ HTTP_CLIENT_IP: 'http.client_ip', /** - * The keys in the `RequestItems` object field. - */ + * The keys in the `RequestItems` object field. + */ AWS_DYNAMODB_TABLE_NAMES: 'aws.dynamodb.table_names', /** - * The JSON-serialized value of each item in the `ConsumedCapacity` response field. - */ + * The JSON-serialized value of each item in the `ConsumedCapacity` response field. + */ AWS_DYNAMODB_CONSUMED_CAPACITY: 'aws.dynamodb.consumed_capacity', /** - * The JSON-serialized value of the `ItemCollectionMetrics` response field. - */ + * The JSON-serialized value of the `ItemCollectionMetrics` response field. + */ AWS_DYNAMODB_ITEM_COLLECTION_METRICS: 'aws.dynamodb.item_collection_metrics', /** - * The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. - */ - AWS_DYNAMODB_PROVISIONED_READ_CAPACITY: - 'aws.dynamodb.provisioned_read_capacity', + * The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. + */ + AWS_DYNAMODB_PROVISIONED_READ_CAPACITY: 'aws.dynamodb.provisioned_read_capacity', /** - * The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. - */ - AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY: - 'aws.dynamodb.provisioned_write_capacity', + * The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. + */ + AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY: 'aws.dynamodb.provisioned_write_capacity', /** - * The value of the `ConsistentRead` request parameter. - */ + * The value of the `ConsistentRead` request parameter. + */ AWS_DYNAMODB_CONSISTENT_READ: 'aws.dynamodb.consistent_read', /** - * The value of the `ProjectionExpression` request parameter. - */ + * The value of the `ProjectionExpression` request parameter. + */ AWS_DYNAMODB_PROJECTION: 'aws.dynamodb.projection', /** - * The value of the `Limit` request parameter. - */ + * The value of the `Limit` request parameter. + */ AWS_DYNAMODB_LIMIT: 'aws.dynamodb.limit', /** - * The value of the `AttributesToGet` request parameter. - */ + * The value of the `AttributesToGet` request parameter. + */ AWS_DYNAMODB_ATTRIBUTES_TO_GET: 'aws.dynamodb.attributes_to_get', /** - * The value of the `IndexName` request parameter. - */ + * The value of the `IndexName` request parameter. + */ AWS_DYNAMODB_INDEX_NAME: 'aws.dynamodb.index_name', /** - * The value of the `Select` request parameter. - */ + * The value of the `Select` request parameter. + */ AWS_DYNAMODB_SELECT: 'aws.dynamodb.select', /** - * The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field. - */ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES: - 'aws.dynamodb.global_secondary_indexes', + * The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field. + */ + AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES: 'aws.dynamodb.global_secondary_indexes', /** - * The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field. - */ + * The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field. + */ AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES: 'aws.dynamodb.local_secondary_indexes', /** - * The value of the `ExclusiveStartTableName` request parameter. - */ + * The value of the `ExclusiveStartTableName` request parameter. + */ AWS_DYNAMODB_EXCLUSIVE_START_TABLE: 'aws.dynamodb.exclusive_start_table', /** - * The the number of items in the `TableNames` response parameter. - */ + * The the number of items in the `TableNames` response parameter. + */ AWS_DYNAMODB_TABLE_COUNT: 'aws.dynamodb.table_count', /** - * The value of the `ScanIndexForward` request parameter. - */ + * The value of the `ScanIndexForward` request parameter. + */ AWS_DYNAMODB_SCAN_FORWARD: 'aws.dynamodb.scan_forward', /** - * The value of the `Segment` request parameter. - */ + * The value of the `Segment` request parameter. + */ AWS_DYNAMODB_SEGMENT: 'aws.dynamodb.segment', /** - * The value of the `TotalSegments` request parameter. - */ + * The value of the `TotalSegments` request parameter. + */ AWS_DYNAMODB_TOTAL_SEGMENTS: 'aws.dynamodb.total_segments', /** - * The value of the `Count` response parameter. - */ + * The value of the `Count` response parameter. + */ AWS_DYNAMODB_COUNT: 'aws.dynamodb.count', /** - * The value of the `ScannedCount` response parameter. - */ + * The value of the `ScannedCount` response parameter. + */ AWS_DYNAMODB_SCANNED_COUNT: 'aws.dynamodb.scanned_count', /** - * The JSON-serialized value of each item in the `AttributeDefinitions` request field. - */ + * The JSON-serialized value of each item in the `AttributeDefinitions` request field. + */ AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS: 'aws.dynamodb.attribute_definitions', /** - * The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` request field. - */ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES: - 'aws.dynamodb.global_secondary_index_updates', + * The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` request field. + */ + AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES: 'aws.dynamodb.global_secondary_index_updates', /** - * A string identifying the messaging system. - */ + * A string identifying the messaging system. + */ MESSAGING_SYSTEM: 'messaging.system', /** - * The message destination name. This might be equal to the span name but is required nevertheless. - */ + * The message destination name. This might be equal to the span name but is required nevertheless. + */ MESSAGING_DESTINATION: 'messaging.destination', /** - * The kind of message destination. - */ + * The kind of message destination. + */ MESSAGING_DESTINATION_KIND: 'messaging.destination_kind', /** - * A boolean that is true if the message destination is temporary. - */ + * A boolean that is true if the message destination is temporary. + */ MESSAGING_TEMP_DESTINATION: 'messaging.temp_destination', /** - * The name of the transport protocol. - */ + * The name of the transport protocol. + */ MESSAGING_PROTOCOL: 'messaging.protocol', /** - * The version of the transport protocol. - */ + * The version of the transport protocol. + */ MESSAGING_PROTOCOL_VERSION: 'messaging.protocol_version', /** - * Connection string. - */ + * Connection string. + */ MESSAGING_URL: 'messaging.url', /** - * A value used by the messaging system as an identifier for the message, represented as a string. - */ + * A value used by the messaging system as an identifier for the message, represented as a string. + */ MESSAGING_MESSAGE_ID: 'messaging.message_id', /** - * The [conversation ID](#conversations) identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID". - */ + * The [conversation ID](#conversations) identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID". + */ MESSAGING_CONVERSATION_ID: 'messaging.conversation_id', /** - * The (uncompressed) size of the message payload in bytes. Also use this attribute if it is unknown whether the compressed or uncompressed payload size is reported. - */ + * The (uncompressed) size of the message payload in bytes. Also use this attribute if it is unknown whether the compressed or uncompressed payload size is reported. + */ MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES: 'messaging.message_payload_size_bytes', /** - * The compressed size of the message payload in bytes. - */ - MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES: - 'messaging.message_payload_compressed_size_bytes', + * The compressed size of the message payload in bytes. + */ + MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES: 'messaging.message_payload_compressed_size_bytes', /** - * A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. If the operation is "send", this attribute MUST NOT be set, since the operation can be inferred from the span kind in that case. - */ + * A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. If the operation is "send", this attribute MUST NOT be set, since the operation can be inferred from the span kind in that case. + */ MESSAGING_OPERATION: 'messaging.operation', /** - * Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from `messaging.message_id` in that they're not unique. If the key is `null`, the attribute MUST NOT be set. - * - * Note: If the key type is not string, it's string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value. - */ + * RabbitMQ message routing key. + */ + MESSAGING_RABBITMQ_ROUTING_KEY: 'messaging.rabbitmq.routing_key', + + /** + * Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from `messaging.message_id` in that they're not unique. If the key is `null`, the attribute MUST NOT be set. + * + * Note: If the key type is not string, it's string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value. + */ MESSAGING_KAFKA_MESSAGE_KEY: 'messaging.kafka.message_key', /** - * Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers. - */ + * Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers. + */ MESSAGING_KAFKA_CONSUMER_GROUP: 'messaging.kafka.consumer_group', /** - * Client Id for the Consumer or Producer that is handling the message. - */ + * Client Id for the Consumer or Producer that is handling the message. + */ MESSAGING_KAFKA_CLIENT_ID: 'messaging.kafka.client_id', /** - * Partition the message is sent to. - */ + * Partition the message is sent to. + */ MESSAGING_KAFKA_PARTITION: 'messaging.kafka.partition', /** - * A boolean that is true if the message is a tombstone. - */ + * A boolean that is true if the message is a tombstone. + */ MESSAGING_KAFKA_TOMBSTONE: 'messaging.kafka.tombstone', /** - * A string identifying the remoting system. - */ + * A string identifying the remoting system. + */ RPC_SYSTEM: 'rpc.system', /** - * The full name of the service being called, including its package name, if applicable. - */ + * The full name of the service being called, including its package name, if applicable. + */ RPC_SERVICE: 'rpc.service', /** - * The name of the method being called, must be equal to the $method part in the span name. - */ + * The name of the method being called, must be equal to the $method part in the span name. + */ RPC_METHOD: 'rpc.method', /** - * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. - */ + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + */ RPC_GRPC_STATUS_CODE: 'rpc.grpc.status_code', -}; + + /** + * Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 does not specify this, the value can be omitted. + */ + RPC_JSONRPC_VERSION: 'rpc.jsonrpc.version', + + /** + * `method` property from request. Unlike `rpc.method`, this may not relate to the actual method being called. Useful for client-side traces since client does not know what will be called on the server. + */ + RPC_JSONRPC_METHOD: 'rpc.jsonrpc.method', + + /** + * `id` property of request or response. Since protocol allows id to be int, string, `null` or missing (for notifications), value is expected to be cast to string for simplicity. Use empty string in case of `null` value. Omit entirely if this is a notification. + */ + RPC_JSONRPC_REQUEST_ID: 'rpc.jsonrpc.request_id', + + /** + * `error.code` property of response if it is an error response. + */ + RPC_JSONRPC_ERROR_CODE: 'rpc.jsonrpc.error_code', + + /** + * `error.message` property of response if it is an error response. + */ + RPC_JSONRPC_ERROR_MESSAGE: 'rpc.jsonrpc.error_message', +} // Enum definitions + export enum DbSystemValues { /** Some other SQL database. Fallback only. See notes. */ OTHER_SQL = 'other_sql', @@ -718,33 +742,43 @@ export enum DbSystemValues { GEODE = 'geode', /** Elasticsearch. */ ELASTICSEARCH = 'elasticsearch', + /** Memcached. */ + MEMCACHED = 'memcached', + /** CockroachDB. */ + COCKROACHDB = 'cockroachdb', } + + + export enum DbCassandraConsistencyLevelValues { - /** ALL. */ - ALL = 'ALL', - /** EACH_QUORUM. */ - EACH_QUORUM = 'EACH_QUORUM', - /** QUORUM. */ - QUORUM = 'QUORUM', - /** LOCAL_QUORUM. */ - LOCAL_QUORUM = 'LOCAL_QUORUM', - /** ONE. */ - ONE = 'ONE', - /** TWO. */ - TWO = 'TWO', - /** THREE. */ - THREE = 'THREE', - /** LOCAL_ONE. */ - LOCAL_ONE = 'LOCAL_ONE', - /** ANY. */ - ANY = 'ANY', - /** SERIAL. */ - SERIAL = 'SERIAL', - /** LOCAL_SERIAL. */ - LOCAL_SERIAL = 'LOCAL_SERIAL', + /** all. */ + ALL = 'all', + /** each_quorum. */ + EACH_QUORUM = 'each_quorum', + /** quorum. */ + QUORUM = 'quorum', + /** local_quorum. */ + LOCAL_QUORUM = 'local_quorum', + /** one. */ + ONE = 'one', + /** two. */ + TWO = 'two', + /** three. */ + THREE = 'three', + /** local_one. */ + LOCAL_ONE = 'local_one', + /** any. */ + ANY = 'any', + /** serial. */ + SERIAL = 'serial', + /** local_serial. */ + LOCAL_SERIAL = 'local_serial', } + + + export enum FaasTriggerValues { /** A response to some data source operation such as a database or filesystem read/write. */ DATASOURCE = 'datasource', @@ -758,6 +792,9 @@ export enum FaasTriggerValues { OTHER = 'other', } + + + export enum FaasDocumentOperationValues { /** When a new object is created. */ INSERT = 'insert', @@ -767,6 +804,9 @@ export enum FaasDocumentOperationValues { DELETE = 'delete', } + + + export enum FaasInvokedProviderValues { /** Amazon Web Services. */ AWS = 'aws', @@ -776,15 +816,18 @@ export enum FaasInvokedProviderValues { GCP = 'gcp', } + + + export enum NetTransportValues { - /** IP.TCP. */ - IP_TCP = 'IP.TCP', - /** IP.UDP. */ - IP_UDP = 'IP.UDP', + /** ip_tcp. */ + IP_TCP = 'ip_tcp', + /** ip_udp. */ + IP_UDP = 'ip_udp', /** Another IP-based protocol. */ - IP = 'IP', + IP = 'ip', /** Unix Domain socket. See below. */ - UNIX = 'Unix', + UNIX = 'unix', /** Named or anonymous pipe. See note below. */ PIPE = 'pipe', /** In-process communication. */ @@ -793,6 +836,9 @@ export enum NetTransportValues { OTHER = 'other', } + + + export enum HttpFlavorValues { /** HTTP 1.0. */ HTTP_1_0 = '1.0', @@ -806,6 +852,9 @@ export enum HttpFlavorValues { QUIC = 'QUIC', } + + + export enum MessagingDestinationKindValues { /** A message sent to a queue. */ QUEUE = 'queue', @@ -813,6 +862,9 @@ export enum MessagingDestinationKindValues { TOPIC = 'topic', } + + + export enum MessagingOperationValues { /** receive. */ RECEIVE = 'receive', @@ -820,6 +872,9 @@ export enum MessagingOperationValues { PROCESS = 'process', } + + + export enum RpcGrpcStatusCodeValues { /** OK. */ OK = 0, @@ -856,3 +911,4 @@ export enum RpcGrpcStatusCodeValues { /** UNAUTHENTICATED. */ UNAUTHENTICATED = 16, } + diff --git a/packages/opentelemetry-semantic-conventions/src/version.ts b/packages/opentelemetry-semantic-conventions/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-semantic-conventions/src/version.ts +++ b/packages/opentelemetry-semantic-conventions/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-shim-opentracing/package.json b/packages/opentelemetry-shim-opentracing/package.json index 30ecc063f4..a7f5c25afe 100644 --- a/packages/opentelemetry-shim-opentracing/package.json +++ b/packages/opentelemetry-shim-opentracing/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/shim-opentracing", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTracing to OpenTelemetry shim", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -38,28 +38,25 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/tracing": "0.19.0", - "@opentelemetry/propagator-b3": "0.19.0", - "@opentelemetry/propagator-jaeger": "0.19.0", + "@opentelemetry/api": "^1.0.0", + "@opentelemetry/tracing": "0.21.0", + "@opentelemetry/propagator-b3": "0.21.0", + "@opentelemetry/propagator-jaeger": "0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "tslint-consistent-codestyle": "1.16.0", - "tslint-microsoft-contrib": "6.2.0", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", + "@opentelemetry/core": "0.21.0", "opentracing": "^0.14.4" } } diff --git a/packages/opentelemetry-shim-opentracing/src/shim.ts b/packages/opentelemetry-shim-opentracing/src/shim.ts index 0fedcb5e01..0e4a890b6b 100644 --- a/packages/opentelemetry-shim-opentracing/src/shim.ts +++ b/packages/opentelemetry-shim-opentracing/src/shim.ts @@ -17,9 +17,9 @@ import * as api from '@opentelemetry/api'; import * as opentracing from 'opentracing'; import { - createBaggage, SpanAttributes, SpanAttributeValue, + SpanStatusCode, TextMapPropagator, } from '@opentelemetry/api'; @@ -54,9 +54,9 @@ function translateSpanOptions( function getContextWithParent(options: opentracing.SpanOptions) { if (options.childOf) { if (options.childOf instanceof SpanShim) { - return api.setSpan(api.context.active(), options.childOf.getSpan()); + return api.trace.setSpan(api.context.active(), options.childOf.getSpan()); } else if (options.childOf instanceof SpanContextShim) { - return api.setSpanContext( + return api.trace.setSpanContext( api.context.active(), options.childOf.getSpanContext() ); @@ -96,14 +96,14 @@ export class SpanContextShim extends opentracing.SpanContext { /** * Returns the trace ID as a string. */ - toTraceId(): string { + override toTraceId(): string { return this._spanContext.traceId; } /** * Returns the span ID as a string. */ - toSpanId(): string { + override toSpanId(): string { return this._spanContext.spanId; } @@ -131,7 +131,7 @@ export class TracerShim extends opentracing.Tracer { this._propagators = propagators; } - startSpan( + override startSpan( name: string, options: opentracing.SpanOptions = {} ): opentracing.Span { @@ -141,7 +141,7 @@ export class TracerShim extends opentracing.Tracer { getContextWithParent(options) ); - let baggage: api.Baggage = createBaggage(); + let baggage: api.Baggage = api.propagation.createBaggage(); if (options.childOf instanceof SpanShim) { const shimContext = options.childOf.context() as SpanContextShim; baggage = shimContext.getBaggage(); @@ -156,7 +156,7 @@ export class TracerShim extends opentracing.Tracer { return new SpanShim(this, span, baggage); } - _inject( + override _inject( spanContext: opentracing.SpanContext, format: string, carrier: unknown @@ -175,15 +175,15 @@ export class TracerShim extends opentracing.Tracer { const propagator = this._getPropagator(format); if (propagator !== undefined) { - const context = api.setBaggage( - api.setSpanContext(api.ROOT_CONTEXT, oTelSpanContext), + const context = api.propagation.setBaggage( + api.trace.setSpanContext(api.ROOT_CONTEXT, oTelSpanContext), oTelSpanBaggage ); propagator.inject(context, carrier, api.defaultTextMapSetter); } } - _extract(format: string, carrier: unknown): opentracing.SpanContext | null { + override _extract(format: string, carrier: unknown): opentracing.SpanContext | null { if (format === opentracing.FORMAT_BINARY) { api.diag.warn('OpentracingShim.extract() does not support FORMAT_BINARY'); // @todo: Implement binary format @@ -197,18 +197,18 @@ export class TracerShim extends opentracing.Tracer { carrier, api.defaultTextMapGetter ); - const spanContext = api.getSpanContext(context); - const baggage = api.getBaggage(context); + const spanContext = api.trace.getSpanContext(context); + const baggage = api.propagation.getBaggage(context); if (!spanContext) { return null; } - return new SpanContextShim(spanContext, baggage || createBaggage()); + return new SpanContextShim(spanContext, baggage || api.propagation.createBaggage()); } return null; } - private _getPropagator(format: string): TextMapPropagator | undefined { + private _getPropagator(format: string): api.TextMapPropagator | undefined { switch (format) { case opentracing.FORMAT_TEXT_MAP: return this._propagators?.textMapPropagator ?? api.propagation; @@ -235,7 +235,7 @@ export class SpanShim extends opentracing.Span { constructor(tracerShim: TracerShim, span: api.Span, baggage: api.Baggage) { super(); this._span = span; - this._contextShim = new SpanContextShim(span.context(), baggage); + this._contextShim = new SpanContextShim(span.spanContext(), baggage); this._tracerShim = tracerShim; } @@ -244,14 +244,14 @@ export class SpanShim extends opentracing.Span { * * @returns a {@link SpanContextShim} containing the underlying context. */ - context(): opentracing.SpanContext { + override context(): opentracing.SpanContext { return this._contextShim; } /** * Returns the {@link opentracing.Tracer} that created the span. */ - tracer(): opentracing.Tracer { + override tracer(): opentracing.Tracer { return this._tracerShim; } @@ -260,7 +260,7 @@ export class SpanShim extends opentracing.Span { * * @param name the Span name. */ - setOperationName(name: string): this { + override setOperationName(name: string): this { this._span.updateName(name); return this; } @@ -271,7 +271,7 @@ export class SpanShim extends opentracing.Span { * * @param finishTime An optional timestamp to explicitly set the span's end time. */ - finish(finishTime?: number): void { + override finish(finishTime?: number): void { this._span.end(finishTime); } @@ -280,7 +280,7 @@ export class SpanShim extends opentracing.Span { * @param eventName name of the event. * @param payload an arbitrary object to be attached to the event. */ - logEvent(eventName: string, payload?: SpanAttributes): void { + override logEvent(eventName: string, payload?: SpanAttributes): void { this._span.addEvent(eventName, payload); } @@ -288,7 +288,7 @@ export class SpanShim extends opentracing.Span { * 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: SpanAttributes, _timestamp?: number): this { + override log(keyValuePairs: SpanAttributes, _timestamp?: number): this { // @todo: Handle timestamp this._span.addEvent('log', keyValuePairs); return this; @@ -298,8 +298,15 @@ export class SpanShim extends opentracing.Span { * Adds a set of tags to the span. * @param keyValueMap set of KV pairs representing tags */ - addTags(keyValueMap: SpanAttributes): this { - this._span.setAttributes(keyValueMap); + override addTags(keyValueMap: SpanAttributes): this { + for (const [key, value] of Object.entries(keyValueMap)) { + if (this._setErrorAsSpanStatusCode(key, value)) { + continue; + } + if (value !== undefined) { + this._span.setAttribute(key, value); + } + } return this; } @@ -309,12 +316,8 @@ export class SpanShim extends opentracing.Span { * @param key key for the tag * @param value value for the tag */ - setTag(key: string, value: SpanAttributeValue): this { - if ( - key === opentracing.Tags.ERROR && - (value === true || value === 'true') - ) { - this._span.setStatus({ code: api.SpanStatusCode.ERROR }); + override setTag(key: string, value: SpanAttributeValue): this { + if (this._setErrorAsSpanStatusCode(key, value)) { return this; } @@ -322,22 +325,49 @@ export class SpanShim extends opentracing.Span { return this; } - getBaggageItem(key: string): string | undefined { + override getBaggageItem(key: string): string | undefined { return this._contextShim.getBaggageItem(key); } - setBaggageItem(key: string, value: string): this { + override setBaggageItem(key: string, value: string): this { this._contextShim.setBaggageItem(key, value); return this; } - /* - * Returns the underlying {@link types.Span} that the shim + /** + * Returns the underlying {@link api.Span} that the shim * is wrapping. */ getSpan(): api.Span { return this._span; } + + private _setErrorAsSpanStatusCode( + key: string, + value: SpanAttributeValue | undefined + ): boolean { + if (key === opentracing.Tags.ERROR) { + const statusCode = SpanShim._mapErrorTag(value); + this._span.setStatus({ code: statusCode }); + return statusCode !== SpanStatusCode.UNSET; + } + return false; + } + + private static _mapErrorTag( + value: SpanAttributeValue | undefined + ): SpanStatusCode { + switch (value) { + case true: + case 'true': + return SpanStatusCode.ERROR; + case false: + case 'false': + return SpanStatusCode.OK; + default: + return SpanStatusCode.UNSET; + } + } } /** diff --git a/packages/opentelemetry-shim-opentracing/src/version.ts b/packages/opentelemetry-shim-opentracing/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-shim-opentracing/src/version.ts +++ b/packages/opentelemetry-shim-opentracing/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-shim-opentracing/test/Shim.test.ts b/packages/opentelemetry-shim-opentracing/test/Shim.test.ts index 47d197c877..c8bcd2f92b 100644 --- a/packages/opentelemetry-shim-opentracing/test/Shim.test.ts +++ b/packages/opentelemetry-shim-opentracing/test/Shim.test.ts @@ -25,14 +25,13 @@ import { timeInputToHrTime, } from '@opentelemetry/core'; import { - createBaggage, defaultTextMapGetter, defaultTextMapSetter, - getSpanContext, INVALID_SPAN_CONTEXT, propagation, ROOT_CONTEXT, - setSpanContext, + SpanStatusCode, + trace, } from '@opentelemetry/api'; import { performance } from 'perf_hooks'; import { B3Propagator } from '@opentelemetry/propagator-b3'; @@ -148,7 +147,7 @@ describe('OpenTracing Shim', () => { it('injects HTTP carriers', () => { const carrier: { [key: string]: unknown } = {}; shimTracer.inject(context, opentracing.FORMAT_HTTP_HEADERS, carrier); - const extractedContext = getSpanContext( + const extractedContext = trace.getSpanContext( jaegerPropagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); assert.ok(extractedContext !== null); @@ -159,7 +158,7 @@ describe('OpenTracing Shim', () => { it('extracts HTTP carriers', () => { const carrier: { [key: string]: unknown } = {}; jaegerPropagator.inject( - setSpanContext( + trace.setSpanContext( ROOT_CONTEXT, (context as SpanContextShim).getSpanContext() ), @@ -179,7 +178,7 @@ describe('OpenTracing Shim', () => { it('injects TextMap carriers', () => { const carrier: { [key: string]: unknown } = {}; shimTracer.inject(context, opentracing.FORMAT_TEXT_MAP, carrier); - const extractedContext = getSpanContext( + const extractedContext = trace.getSpanContext( b3Propagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) ); assert.ok(extractedContext !== null); @@ -190,7 +189,7 @@ describe('OpenTracing Shim', () => { it('extracts TextMap carriers', () => { const carrier: { [key: string]: unknown } = {}; b3Propagator.inject( - setSpanContext( + trace.setSpanContext( ROOT_CONTEXT, (context as SpanContextShim).getSpanContext() ), @@ -268,7 +267,7 @@ describe('OpenTracing Shim', () => { describe('SpanContextShim', () => { it('returns the correct context', () => { - const shim = new SpanContextShim(INVALID_SPAN_CONTEXT, createBaggage()); + const shim = new SpanContextShim(INVALID_SPAN_CONTEXT, propagation.createBaggage()); assert.strictEqual(shim.getSpanContext(), INVALID_SPAN_CONTEXT); assert.strictEqual(shim.toTraceId(), INVALID_SPAN_CONTEXT.traceId); assert.strictEqual(shim.toSpanId(), INVALID_SPAN_CONTEXT.spanId); @@ -293,13 +292,67 @@ describe('OpenTracing Shim', () => { otSpan = (span as SpanShim).getSpan() as Span; }); - it('sets tags', () => { - span.setTag('hello', 'world'); - assert.strictEqual(otSpan.attributes.hello, 'world'); + describe('tags', () => { + 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'); + span.addTags({ hello: 'stars', from: 'earth' }); + assert.strictEqual(otSpan.attributes.hello, 'stars'); + assert.strictEqual(otSpan.attributes.from, 'earth'); + }); + + it('ignores undefined tags', () => { + span.addTags({ hello: 'stars', from: undefined }); + assert.deepStrictEqual(otSpan.attributes, { hello: 'stars' }); + }); + + it('maps error tag to status code', () => { + span.setTag('error', ''); + assert.strictEqual(otSpan.status.code, SpanStatusCode.UNSET); + + span.setTag('error', true); + assert.strictEqual(otSpan.status.code, SpanStatusCode.ERROR); + + span.setTag('error', false); + assert.strictEqual(otSpan.status.code, SpanStatusCode.OK); + + span.setTag('error', 'true'); + assert.strictEqual(otSpan.status.code, SpanStatusCode.ERROR); + + span.setTag('error', 'false'); + assert.strictEqual(otSpan.status.code, SpanStatusCode.OK); + }); + + it('sets unknown error tag as attribute', () => { + span.setTag('error', 'whoopsie'); + assert.strictEqual(otSpan.status.code, SpanStatusCode.UNSET); + assert.strictEqual(otSpan.attributes.error, 'whoopsie'); + }); + + it('maps error tag to status code when adding multiple tags', () => { + span.addTags({ hello: 'stars', error: '' }); + assert.strictEqual(otSpan.status.code, SpanStatusCode.UNSET); + + span.addTags({ hello: 'stars', error: true }); + assert.strictEqual(otSpan.status.code, SpanStatusCode.ERROR); + + span.addTags({ hello: 'stars', error: false }); + assert.strictEqual(otSpan.status.code, SpanStatusCode.OK); + + span.addTags({ hello: 'stars', error: 'true' }); + assert.strictEqual(otSpan.status.code, SpanStatusCode.ERROR); + + span.addTags({ hello: 'stars', error: 'false' }); + assert.strictEqual(otSpan.status.code, SpanStatusCode.OK); + }); + + it('sets unknown error tag as attribute when adding multiple tags', () => { + span.addTags({ hello: 'stars', error: 'whoopsie' }); + assert.strictEqual(otSpan.status.code, SpanStatusCode.UNSET); + assert.strictEqual(otSpan.attributes.hello, 'stars'); + assert.strictEqual(otSpan.attributes.error, 'whoopsie'); + }); }); it('logs KV pairs', () => { diff --git a/packages/opentelemetry-tracing/karma.conf.js b/packages/opentelemetry-tracing/karma.conf.js index 3019564a15..455b1437c8 100644 --- a/packages/opentelemetry-tracing/karma.conf.js +++ b/packages/opentelemetry-tracing/karma.conf.js @@ -19,6 +19,8 @@ const karmaBaseConfig = require('../../karma.base'); module.exports = (config) => { config.set(Object.assign({}, karmaBaseConfig, { - webpack: karmaWebpackConfig + webpack: karmaWebpackConfig, + files: ['test/browser/index-webpack.ts'], + preprocessors: { 'test/browser/index-webpack.ts': ['webpack'] } })) }; diff --git a/packages/opentelemetry-tracing/package.json b/packages/opentelemetry-tracing/package.json index 4fe9a038bc..a6c81483d4 100644 --- a/packages/opentelemetry-tracing/package.json +++ b/packages/opentelemetry-tracing/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/tracing", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry Tracing", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -14,7 +14,7 @@ "scripts": { "compile": "tsc --build tsconfig.json tsconfig.esm.json", "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", - "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/index-webpack.ts'", + "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", "test:browser": "nyc karma start --single-run", "tdd": "npm run tdd:node", "tdd:node": "npm run test -- --watch-extensions ts --watch", @@ -53,21 +53,20 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0", + "@opentelemetry/api": "^1.0.0", "@types/lodash.merge": "4.6.6", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", "@types/webpack-env": "1.16.0", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", "karma-spec-reporter": "0.0.32", - "karma-webpack": "5.0.0", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", @@ -75,16 +74,16 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0", + "@opentelemetry/core": "0.21.0", + "@opentelemetry/resources": "0.21.0", + "@opentelemetry/semantic-conventions": "0.21.0", "lodash.merge": "^4.6.2" } } diff --git a/packages/opentelemetry-tracing/src/BasicTracerProvider.ts b/packages/opentelemetry-tracing/src/BasicTracerProvider.ts index 436bf313a7..d02d92bccb 100644 --- a/packages/opentelemetry-tracing/src/BasicTracerProvider.ts +++ b/packages/opentelemetry-tracing/src/BasicTracerProvider.ts @@ -34,9 +34,10 @@ import { DEFAULT_CONFIG } from './config'; import { MultiSpanProcessor } from './MultiSpanProcessor'; import { NoopSpanProcessor } from './export/NoopSpanProcessor'; import { SDKRegistrationConfig, TracerConfig } from './types'; +// eslint-disable-next-line @typescript-eslint/no-var-requires const merge = require('lodash.merge'); import { SpanExporter } from './export/SpanExporter'; -import { BatchSpanProcessor } from './export/BatchSpanProcessor'; +import { BatchSpanProcessor } from './platform'; export type PROPAGATOR_FACTORY = () => TextMapPropagator; export type EXPORTER_FACTORY = () => SpanExporter; @@ -74,8 +75,8 @@ export class BasicTracerProvider implements TracerProvider { constructor(config: TracerConfig = {}) { const mergedConfig = merge({}, DEFAULT_CONFIG, config); - this.resource = - mergedConfig.resource ?? Resource.createTelemetrySDKResource(); + this.resource = mergedConfig.resource ?? Resource.empty(); + this.resource = Resource.default().merge(this.resource); this._config = Object.assign({}, mergedConfig, { resource: this.resource, }); diff --git a/packages/opentelemetry-tracing/src/Span.ts b/packages/opentelemetry-tracing/src/Span.ts index d7a18fbe2e..8ffad7ab0a 100644 --- a/packages/opentelemetry-tracing/src/Span.ts +++ b/packages/opentelemetry-tracing/src/Span.ts @@ -39,7 +39,7 @@ import { ExceptionEventName } from './enums'; export class Span implements api.Span, ReadableSpan { // Below properties are included to implement ReadableSpan for export // purposes but are not intended to be written-to directly. - readonly spanContext: api.SpanContext; + private readonly _spanContext: api.SpanContext; readonly kind: api.SpanKind; readonly parentSpanId?: string; readonly attributes: api.SpanAttributes = {}; @@ -70,7 +70,7 @@ export class Span implements api.Span, ReadableSpan { startTime: api.TimeInput = hrTime() ) { this.name = spanName; - this.spanContext = spanContext; + this._spanContext = spanContext; this.parentSpanId = parentSpanId; this.kind = kind; this.links = links; @@ -82,8 +82,8 @@ export class Span implements api.Span, ReadableSpan { this._spanProcessor.onStart(this, context); } - context(): api.SpanContext { - return this.spanContext; + spanContext(): api.SpanContext { + return this._spanContext; } setAttribute(key: string, value?: SpanAttributeValue): this; @@ -229,8 +229,8 @@ export class Span implements api.Span, ReadableSpan { if (this._ended) { api.diag.warn( 'Can not execute the operation on ended Span {traceId: %s, spanId: %s}', - this.spanContext.traceId, - this.spanContext.spanId + this._spanContext.traceId, + this._spanContext.spanId ); } return this._ended; diff --git a/packages/opentelemetry-tracing/src/Tracer.ts b/packages/opentelemetry-tracing/src/Tracer.ts index e84ebf77b4..446e944189 100644 --- a/packages/opentelemetry-tracing/src/Tracer.ts +++ b/packages/opentelemetry-tracing/src/Tracer.ts @@ -20,6 +20,7 @@ import { InstrumentationLibrary, RandomIdGenerator, sanitizeAttributes, + isTracingSuppressed, } from '@opentelemetry/core'; import { Resource } from '@opentelemetry/resources'; import { BasicTracerProvider } from './BasicTracerProvider'; @@ -62,9 +63,9 @@ export class Tracer implements api.Tracer { options: api.SpanOptions = {}, context = api.context.active() ): api.Span { - if (api.isInstrumentationSuppressed(context)) { + if (isTracingSuppressed(context)) { api.diag.debug('Instrumentation suppressed, returning Noop Span'); - return api.NOOP_TRACER.startSpan(name, options, context); + return api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT); } const parentContext = getParent(options, context); @@ -88,7 +89,7 @@ export class Tracer implements api.Tracer { // make sampling decision const samplingResult = this._sampler.shouldSample( options.root - ? api.setSpanContext(context, api.INVALID_SPAN_CONTEXT) + ? api.trace.setSpanContext(context, api.INVALID_SPAN_CONTEXT) : context, traceId, name, @@ -103,12 +104,8 @@ export class Tracer implements api.Tracer { : api.TraceFlags.NONE; const spanContext = { traceId, spanId, traceFlags, traceState }; if (samplingResult.decision === api.SamplingDecision.NOT_RECORD) { - api.diag.debug('Recording is off, starting no recording span'); - return api.NOOP_TRACER.startSpan( - name, - options, - api.setSpanContext(context, spanContext) - ); + api.diag.debug('Recording is off, propagating context in a non-recording span'); + return api.trace.wrapSpanContext(spanContext); } const span = new Span( @@ -126,6 +123,94 @@ export class Tracer implements api.Tracer { return span; } + /** + * Starts a new {@link Span} and calls the given function passing it the + * created span as first argument. + * Additionally the new span gets set in context and this context is activated + * for the duration of the function call. + * + * @param name The name of the span + * @param [options] SpanOptions used for span creation + * @param [context] Context to use to extract parent + * @param fn function called in the context of the span and receives the newly created span as an argument + * @returns return value of fn + * @example + * const something = tracer.startActiveSpan('op', span => { + * try { + * do some work + * span.setStatus({code: SpanStatusCode.OK}); + * return something; + * } catch (err) { + * span.setStatus({ + * code: SpanStatusCode.ERROR, + * message: err.message, + * }); + * throw err; + * } finally { + * span.end(); + * } + * }); + * @example + * const span = tracer.startActiveSpan('op', span => { + * try { + * do some work + * return span; + * } catch (err) { + * span.setStatus({ + * code: SpanStatusCode.ERROR, + * message: err.message, + * }); + * throw err; + * } + * }); + * do some more work + * span.end(); + */ + startActiveSpan ReturnType>( + name: string, + fn: F + ): ReturnType; + startActiveSpan ReturnType>( + name: string, + opts: api.SpanOptions, + fn: F + ): ReturnType; + startActiveSpan ReturnType>( + name: string, + opts: api.SpanOptions, + ctx: api.Context, + fn: F + ): ReturnType; + startActiveSpan ReturnType>( + name: string, + arg2?: F | api.SpanOptions, + arg3?: F | api.Context, + arg4?: F + ): ReturnType | undefined { + let opts: api.SpanOptions | undefined; + let ctx: api.Context | undefined; + let fn: F; + + if (arguments.length < 2) { + return; + } else if (arguments.length === 2) { + fn = arg2 as F; + } else if (arguments.length === 3) { + opts = arg2 as api.SpanOptions | undefined; + fn = arg3 as F; + } else { + opts = arg2 as api.SpanOptions | undefined; + ctx = arg3 as api.Context | undefined; + fn = arg4 as F; + } + + const parentContext = ctx ?? api.context.active(); + const span = this.startSpan(name, opts, parentContext); + const contextWithSpanSet = api.trace.setSpan(parentContext, span); + + return api.context.with(contextWithSpanSet, fn, undefined, span); + } + /** Returns the active {@link SpanLimits}. */ getSpanLimits(): SpanLimits { return this._spanLimits; @@ -148,5 +233,5 @@ function getParent( context: api.Context ): api.SpanContext | undefined { if (options.root) return undefined; - return api.getSpanContext(context); + return api.trace.getSpanContext(context); } diff --git a/packages/opentelemetry-tracing/src/export/BatchSpanProcessor.ts b/packages/opentelemetry-tracing/src/export/BatchSpanProcessorBase.ts similarity index 92% rename from packages/opentelemetry-tracing/src/export/BatchSpanProcessor.ts rename to packages/opentelemetry-tracing/src/export/BatchSpanProcessorBase.ts index 29a396bac3..03efc430bd 100644 --- a/packages/opentelemetry-tracing/src/export/BatchSpanProcessor.ts +++ b/packages/opentelemetry-tracing/src/export/BatchSpanProcessorBase.ts @@ -14,12 +14,13 @@ * limitations under the License. */ -import { context, suppressInstrumentation } from '@opentelemetry/api'; +import { context } from '@opentelemetry/api'; import { ExportResultCode, + getEnv, globalErrorHandler, + suppressTracing, unrefTimer, - getEnv, } from '@opentelemetry/core'; import { Span } from '../Span'; import { SpanProcessor } from '../SpanProcessor'; @@ -31,7 +32,7 @@ import { SpanExporter } from './SpanExporter'; * Implementation of the {@link SpanProcessor} that batches spans exported by * the SDK then pushes them to the exporter pipeline. */ -export class BatchSpanProcessor implements SpanProcessor { +export abstract class BatchSpanProcessorBase implements SpanProcessor { private readonly _maxExportBatchSize: number; private readonly _maxQueueSize: number; private readonly _scheduledDelayMillis: number; @@ -42,7 +43,7 @@ export class BatchSpanProcessor implements SpanProcessor { private _isShutdown = false; private _shuttingDownPromise: Promise = Promise.resolve(); - constructor(private readonly _exporter: SpanExporter, config?: BufferConfig) { + constructor(private readonly _exporter: SpanExporter, config?: T) { const env = getEnv(); this._maxExportBatchSize = typeof config?.maxExportBatchSize === 'number' @@ -50,15 +51,15 @@ export class BatchSpanProcessor implements SpanProcessor { : env.OTEL_BSP_MAX_EXPORT_BATCH_SIZE; this._maxQueueSize = typeof config?.maxQueueSize === 'number' - ? config?.maxQueueSize + ? config.maxQueueSize : env.OTEL_BSP_MAX_QUEUE_SIZE; this._scheduledDelayMillis = typeof config?.scheduledDelayMillis === 'number' - ? config?.scheduledDelayMillis + ? config.scheduledDelayMillis : env.OTEL_BSP_SCHEDULE_DELAY; this._exportTimeoutMillis = typeof config?.exportTimeoutMillis === 'number' - ? config?.exportTimeoutMillis + ? config.exportTimeoutMillis : env.OTEL_BSP_EXPORT_TIMEOUT; } @@ -86,6 +87,9 @@ export class BatchSpanProcessor implements SpanProcessor { this._isShutdown = true; this._shuttingDownPromise = new Promise((resolve, reject) => { Promise.resolve() + .then(() => { + return this.onShutdown(); + }) .then(() => { return this._flushAll(); }) @@ -144,7 +148,7 @@ export class BatchSpanProcessor implements SpanProcessor { reject(new Error('Timeout')); }, this._exportTimeoutMillis); // prevent downstream exporter calls from generating spans - context.with(suppressInstrumentation(context.active()), () => { + context.with(suppressTracing(context.active()), () => { // Reset the finished spans buffer here because the next invocations of the _flush method // could pass the same finished spans to the exporter if the buffer is cleared // outside of the execution of this callback. @@ -189,4 +193,6 @@ export class BatchSpanProcessor implements SpanProcessor { this._timer = undefined; } } + + protected abstract onShutdown(): void; } diff --git a/packages/opentelemetry-tracing/src/export/ConsoleSpanExporter.ts b/packages/opentelemetry-tracing/src/export/ConsoleSpanExporter.ts index 8c481f62bf..60f803c5d0 100644 --- a/packages/opentelemetry-tracing/src/export/ConsoleSpanExporter.ts +++ b/packages/opentelemetry-tracing/src/export/ConsoleSpanExporter.ts @@ -55,10 +55,10 @@ export class ConsoleSpanExporter implements SpanExporter { */ private _exportInfo(span: ReadableSpan) { return { - traceId: span.spanContext.traceId, + traceId: span.spanContext().traceId, parentId: span.parentSpanId, name: span.name, - id: span.spanContext.spanId, + id: span.spanContext().spanId, kind: span.kind, timestamp: hrTimeToMicroseconds(span.startTime), duration: hrTimeToMicroseconds(span.duration), diff --git a/packages/opentelemetry-tracing/src/export/ReadableSpan.ts b/packages/opentelemetry-tracing/src/export/ReadableSpan.ts index 381de674ff..8552134a56 100644 --- a/packages/opentelemetry-tracing/src/export/ReadableSpan.ts +++ b/packages/opentelemetry-tracing/src/export/ReadableSpan.ts @@ -29,7 +29,7 @@ import { TimedEvent } from '../TimedEvent'; export interface ReadableSpan { readonly name: string; readonly kind: SpanKind; - readonly spanContext: SpanContext; + readonly spanContext: () => SpanContext; readonly parentSpanId?: string; readonly startTime: HrTime; readonly endTime: HrTime; diff --git a/packages/opentelemetry-tracing/src/export/SimpleSpanProcessor.ts b/packages/opentelemetry-tracing/src/export/SimpleSpanProcessor.ts index 487ccccea4..c92b869bad 100644 --- a/packages/opentelemetry-tracing/src/export/SimpleSpanProcessor.ts +++ b/packages/opentelemetry-tracing/src/export/SimpleSpanProcessor.ts @@ -14,12 +14,16 @@ * limitations under the License. */ -import { context, suppressInstrumentation } from '@opentelemetry/api'; -import { ExportResultCode, globalErrorHandler } from '@opentelemetry/core'; +import { context } from '@opentelemetry/api'; +import { + ExportResultCode, + globalErrorHandler, + suppressTracing, +} from '@opentelemetry/core'; import { Span } from '../Span'; -import { SpanExporter } from './SpanExporter'; import { SpanProcessor } from '../SpanProcessor'; import { ReadableSpan } from './ReadableSpan'; +import { SpanExporter } from './SpanExporter'; /** * An implementation of the {@link SpanProcessor} that converts the {@link Span} @@ -47,7 +51,7 @@ export class SimpleSpanProcessor implements SpanProcessor { } // prevent downstream exporter calls from generating spans - context.with(suppressInstrumentation(context.active()), () => { + context.with(suppressTracing(context.active()), () => { this._exporter.export([span], result => { if (result.code !== ExportResultCode.SUCCESS) { globalErrorHandler( diff --git a/packages/opentelemetry-tracing/src/index.ts b/packages/opentelemetry-tracing/src/index.ts index 298657290f..3fb4bc2248 100644 --- a/packages/opentelemetry-tracing/src/index.ts +++ b/packages/opentelemetry-tracing/src/index.ts @@ -16,8 +16,8 @@ export * from './Tracer'; export * from './BasicTracerProvider'; +export * from './platform'; export * from './export/ConsoleSpanExporter'; -export * from './export/BatchSpanProcessor'; export * from './export/InMemorySpanExporter'; export * from './export/ReadableSpan'; export * from './export/SimpleSpanProcessor'; diff --git a/packages/opentelemetry-tracing/src/platform/browser/export/BatchSpanProcessor.ts b/packages/opentelemetry-tracing/src/platform/browser/export/BatchSpanProcessor.ts new file mode 100644 index 0000000000..07156e7b90 --- /dev/null +++ b/packages/opentelemetry-tracing/src/platform/browser/export/BatchSpanProcessor.ts @@ -0,0 +1,55 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BatchSpanProcessorBase } from '../../../export/BatchSpanProcessorBase'; +import { SpanExporter } from '../../../export/SpanExporter'; +import { BatchSpanProcessorBrowserConfig } from '../../../types'; + +export class BatchSpanProcessor extends BatchSpanProcessorBase { + private _visibilityChangeListener?: () => void + private _pageHideListener?: () => void + + constructor(_exporter: SpanExporter, config?: BatchSpanProcessorBrowserConfig) { + super(_exporter, config) + this.onInit(config) + } + + private onInit(config?: BatchSpanProcessorBrowserConfig): void { + if (config?.disableAutoFlushOnDocumentHide !== true && document != null) { + this._visibilityChangeListener = () => { + if (document.visibilityState === 'hidden') { + void this.forceFlush(); + } + } + this._pageHideListener = () => { + void this.forceFlush() + } + document.addEventListener('visibilitychange', this._visibilityChangeListener); + + // use 'pagehide' event as a fallback for Safari; see https://bugs.webkit.org/show_bug.cgi?id=116769 + document.addEventListener('pagehide', this._pageHideListener); + } + } + + protected onShutdown(): void { + if (this._visibilityChangeListener) { + document.removeEventListener('visibilitychange', this._visibilityChangeListener); + } + if (this._pageHideListener) { + document.removeEventListener('pagehide', this._pageHideListener); + } + } +} diff --git a/packages/opentelemetry-tracing/src/platform/browser/index.ts b/packages/opentelemetry-tracing/src/platform/browser/index.ts new file mode 100644 index 0000000000..7992546b9d --- /dev/null +++ b/packages/opentelemetry-tracing/src/platform/browser/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './export/BatchSpanProcessor'; diff --git a/packages/opentelemetry-tracing/src/platform/index.ts b/packages/opentelemetry-tracing/src/platform/index.ts new file mode 100644 index 0000000000..cdaf8858ce --- /dev/null +++ b/packages/opentelemetry-tracing/src/platform/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './node'; diff --git a/packages/opentelemetry-tracing/src/platform/node/export/BatchSpanProcessor.ts b/packages/opentelemetry-tracing/src/platform/node/export/BatchSpanProcessor.ts new file mode 100644 index 0000000000..8c860cfdde --- /dev/null +++ b/packages/opentelemetry-tracing/src/platform/node/export/BatchSpanProcessor.ts @@ -0,0 +1,22 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BatchSpanProcessorBase } from '../../../export/BatchSpanProcessorBase'; +import { BufferConfig } from '../../../types'; + +export class BatchSpanProcessor extends BatchSpanProcessorBase { + protected onShutdown(): void {} +} diff --git a/packages/opentelemetry-tracing/src/platform/node/index.ts b/packages/opentelemetry-tracing/src/platform/node/index.ts new file mode 100644 index 0000000000..7992546b9d --- /dev/null +++ b/packages/opentelemetry-tracing/src/platform/node/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './export/BatchSpanProcessor'; diff --git a/packages/opentelemetry-tracing/src/types.ts b/packages/opentelemetry-tracing/src/types.ts index be3a595490..d8329aa567 100644 --- a/packages/opentelemetry-tracing/src/types.ts +++ b/packages/opentelemetry-tracing/src/types.ts @@ -89,3 +89,10 @@ export interface BufferConfig { * The default value is 2048. */ maxQueueSize?: number; } + +/** Interface configuration for BatchSpanProcessor on browser */ +export interface BatchSpanProcessorBrowserConfig extends BufferConfig { + /** Disable flush when a user navigates to a new page, closes the tab or the browser, or, + * on mobile, switches to a different app. Auto flush is enabled by default. */ + disableAutoFlushOnDocumentHide?: boolean; +} diff --git a/packages/opentelemetry-tracing/src/version.ts b/packages/opentelemetry-tracing/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-tracing/src/version.ts +++ b/packages/opentelemetry-tracing/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-tracing/test/browser/export/BatchSpanProcessor.test.ts b/packages/opentelemetry-tracing/test/browser/export/BatchSpanProcessor.test.ts new file mode 100644 index 0000000000..9c422f2245 --- /dev/null +++ b/packages/opentelemetry-tracing/test/browser/export/BatchSpanProcessor.test.ts @@ -0,0 +1,102 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SpanExporter } from '../../../src'; +import { BatchSpanProcessor } from '../../../src/platform/browser/export/BatchSpanProcessor'; +import { TestTracingSpanExporter } from '../../common/export/TestTracingSpanExporter'; + +describe('BatchSpanProcessor - web', () => { + let visibilityState: VisibilityState = 'visible'; + let exporter: SpanExporter + let processor: BatchSpanProcessor; + let forceFlushSpy: sinon.SinonStub; + let visibilityChangeEvent: Event; + let pageHideEvent: Event + + beforeEach(() => { + sinon.replaceGetter(document, 'visibilityState', () => visibilityState); + visibilityState = 'visible'; + exporter = new TestTracingSpanExporter(); + processor = new BatchSpanProcessor(exporter, {}); + forceFlushSpy = sinon.stub(processor, 'forceFlush'); + visibilityChangeEvent = new Event('visibilitychange'); + pageHideEvent = new Event('pagehide'); + }); + + afterEach(async () => { + sinon.restore(); + }); + + describe('when document becomes hidden', () => { + const testDocumentHide = (hideDocument: () => void) => { + it('should force flush spans', () => { + assert.strictEqual(forceFlushSpy.callCount, 0); + hideDocument() + assert.strictEqual(forceFlushSpy.callCount, 1); + }); + + describe('AND shutdown has been called', () => { + it('should NOT force flush spans', async () => { + assert.strictEqual(forceFlushSpy.callCount, 0); + await processor.shutdown(); + hideDocument() + assert.strictEqual(forceFlushSpy.callCount, 0); + }); + }) + + describe('AND disableAutoFlushOnDocumentHide configuration option', () => { + it('set to false should force flush spans', () => { + processor = new BatchSpanProcessor(exporter, { disableAutoFlushOnDocumentHide: false }); + forceFlushSpy = sinon.stub(processor, 'forceFlush'); + assert.strictEqual(forceFlushSpy.callCount, 0); + hideDocument() + assert.strictEqual(forceFlushSpy.callCount, 1); + }) + + it('set to true should NOT force flush spans', () => { + processor = new BatchSpanProcessor(exporter, { disableAutoFlushOnDocumentHide: true }); + forceFlushSpy = sinon.stub(processor, 'forceFlush'); + assert.strictEqual(forceFlushSpy.callCount, 0); + hideDocument() + assert.strictEqual(forceFlushSpy.callCount, 0); + }) + }) + } + + describe('by the visibilitychange event', () => { + testDocumentHide(() => { + visibilityState = 'hidden'; + document.dispatchEvent(visibilityChangeEvent); + }) + }) + + describe('by the pagehide event', () => { + testDocumentHide(() => { + document.dispatchEvent(pageHideEvent); + }) + }) + }) + + describe('when document becomes visible', () => { + it('should NOT force flush spans', () => { + assert.strictEqual(forceFlushSpy.callCount, 0); + document.dispatchEvent(visibilityChangeEvent); + assert.strictEqual(forceFlushSpy.callCount, 0); + }); + }) +}); diff --git a/packages/opentelemetry-tracing/test/index-webpack.ts b/packages/opentelemetry-tracing/test/browser/index-webpack.ts similarity index 79% rename from packages/opentelemetry-tracing/test/index-webpack.ts rename to packages/opentelemetry-tracing/test/browser/index-webpack.ts index 061a48ccfa..99100a0f6e 100644 --- a/packages/opentelemetry-tracing/test/index-webpack.ts +++ b/packages/opentelemetry-tracing/test/browser/index-webpack.ts @@ -13,8 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -const testsContext = require.context('.', true, /test$/); +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-tracing/test/BasicTracerProvider.test.ts b/packages/opentelemetry-tracing/test/common/BasicTracerProvider.test.ts similarity index 93% rename from packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts rename to packages/opentelemetry-tracing/test/common/BasicTracerProvider.test.ts index 06bdb2d6e0..f824049a84 100644 --- a/packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts +++ b/packages/opentelemetry-tracing/test/common/BasicTracerProvider.test.ts @@ -16,12 +16,10 @@ import { context, + trace, SpanContext, TraceFlags, ROOT_CONTEXT, - setSpan, - setSpanContext, - getSpan, TextMapPropagator, TextMapSetter, Context, @@ -45,7 +43,7 @@ import { InMemorySpanExporter, SpanExporter, BatchSpanProcessor, -} from '../src'; +} from '../../src'; describe('BasicTracerProvider', () => { let removeEvent: Function | undefined; @@ -161,7 +159,7 @@ describe('BasicTracerProvider', () => { let setGlobalPropagatorStub: sinon.SinonSpy< [TextMapPropagator], - TextMapPropagator + boolean >; let originalPropagators: string | number | undefined | string[]; beforeEach(() => { @@ -227,7 +225,7 @@ describe('BasicTracerProvider', () => { describe('exporter', () => { class CustomTracerProvider extends BasicTracerProvider { - protected _getSpanExporter(name: string): SpanExporter | undefined { + protected override _getSpanExporter(name: string): SpanExporter | undefined { return name === 'memory' ? new InMemorySpanExporter() : BasicTracerProvider._registeredExporters.get(name)?.(); @@ -285,7 +283,7 @@ describe('BasicTracerProvider', () => { const span = tracer.startSpan('my-span', {}); assert.ok(span); assert.ok(span instanceof Span); - const context = span.context(); + const context = span.spanContext(); assert.ok(context.traceId.match(/[a-f0-9]{32}/)); assert.ok(context.spanId.match(/[a-f0-9]{16}/)); assert.strictEqual(context.traceFlags, TraceFlags.SAMPLED); @@ -318,7 +316,7 @@ describe('BasicTracerProvider', () => { const span = tracer.startSpan( 'my-span', {}, - setSpanContext(ROOT_CONTEXT, { + trace.setSpanContext(ROOT_CONTEXT, { traceId: 'd4cda95b652f4a1592b449d5929fda1b', spanId: '6e0c63257de34c92', traceFlags: TraceFlags.SAMPLED, @@ -326,7 +324,7 @@ describe('BasicTracerProvider', () => { }) ); assert.ok(span instanceof Span); - const context = span.context(); + const context = span.spanContext(); assert.strictEqual(context.traceId, 'd4cda95b652f4a1592b449d5929fda1b'); assert.strictEqual(context.traceFlags, TraceFlags.SAMPLED); assert.deepStrictEqual(context.traceState, state); @@ -339,10 +337,10 @@ describe('BasicTracerProvider', () => { const childSpan = tracer.startSpan( 'child-span', {}, - setSpan(ROOT_CONTEXT, span) + trace.setSpan(ROOT_CONTEXT, span) ); - const context = childSpan.context(); - assert.strictEqual(context.traceId, span.context().traceId); + const context = childSpan.spanContext(); + assert.strictEqual(context.traceId, span.spanContext().traceId); assert.strictEqual(context.traceFlags, TraceFlags.SAMPLED); span.end(); childSpan.end(); @@ -355,10 +353,10 @@ describe('BasicTracerProvider', () => { const rootSpan = tracer.startSpan( 'root-span', { root: true }, - setSpan(ROOT_CONTEXT, span) + trace.setSpan(ROOT_CONTEXT, span) ); - const context = rootSpan.context(); - assert.notStrictEqual(context.traceId, overrideParent.context().traceId); + const context = rootSpan.spanContext(); + assert.notStrictEqual(context.traceId, overrideParent.spanContext().traceId); span.end(); rootSpan.end(); }); @@ -370,7 +368,7 @@ describe('BasicTracerProvider', () => { const span = tracer.startSpan( 'my-span', {}, - setSpanContext( + trace.setSpanContext( ROOT_CONTEXT, ('invalid-parent' as unknown) as SpanContext ) @@ -384,14 +382,14 @@ describe('BasicTracerProvider', () => { const span = tracer.startSpan( 'my-span', {}, - setSpanContext(ROOT_CONTEXT, { + trace.setSpanContext(ROOT_CONTEXT, { traceId: '0', spanId: '0', traceFlags: TraceFlags.SAMPLED, }) ); assert.ok(span instanceof Span); - const context = span.context(); + const context = span.spanContext(); assert.ok(context.traceId.match(/[a-f0-9]{32}/)); assert.ok(context.spanId.match(/[a-f0-9]{16}/)); assert.strictEqual(context.traceFlags, TraceFlags.SAMPLED); @@ -404,7 +402,7 @@ describe('BasicTracerProvider', () => { }).getTracer('default'); const span = tracer.startSpan('my-span'); assert.ok(!span.isRecording()); - const context = span.context(); + const context = span.spanContext(); assert.ok(context.traceId.match(/[a-f0-9]{32}/)); assert.ok(context.spanId.match(/[a-f0-9]{16}/)); assert.strictEqual(context.traceFlags, TraceFlags.NONE); @@ -418,7 +416,7 @@ describe('BasicTracerProvider', () => { }).getTracer('default'); const span = tracer.startSpan('my-span'); assert.ok(span instanceof Span); - assert.strictEqual(span.context().traceFlags, TraceFlags.SAMPLED); + assert.strictEqual(span.spanContext().traceFlags, TraceFlags.SAMPLED); assert.strictEqual(span.isRecording(), true); }); @@ -434,8 +432,8 @@ describe('BasicTracerProvider', () => { it('should run context with NoopContextManager context manager', done => { const tracer = new BasicTracerProvider().getTracer('default'); const span = tracer.startSpan('my-span'); - context.with(setSpan(context.active(), span), () => { - assert.deepStrictEqual(getSpan(context.active()), undefined); + context.with(trace.setSpan(context.active(), span), () => { + assert.deepStrictEqual(trace.getSpan(context.active()), undefined); return done(); }); }); @@ -504,10 +502,10 @@ describe('BasicTracerProvider', () => { const tracer = new BasicTracerProvider().getTracer('default'); const span = tracer.startSpan('my-span'); const fn = () => { - assert.deepStrictEqual(getSpan(context.active()), undefined); + assert.deepStrictEqual(trace.getSpan(context.active()), undefined); return done(); }; - const patchedFn = context.bind(fn, setSpan(context.active(), span)); + const patchedFn = context.bind(trace.setSpan(context.active(), span), fn); return patchedFn(); }); }); diff --git a/packages/opentelemetry-tracing/test/MultiSpanProcessor.test.ts b/packages/opentelemetry-tracing/test/common/MultiSpanProcessor.test.ts similarity index 98% rename from packages/opentelemetry-tracing/test/MultiSpanProcessor.test.ts rename to packages/opentelemetry-tracing/test/common/MultiSpanProcessor.test.ts index 68723d2114..5c263caa4f 100644 --- a/packages/opentelemetry-tracing/test/MultiSpanProcessor.test.ts +++ b/packages/opentelemetry-tracing/test/common/MultiSpanProcessor.test.ts @@ -22,12 +22,12 @@ import { SimpleSpanProcessor, Span, SpanProcessor, -} from '../src'; +} from '../../src'; import { setGlobalErrorHandler, loggingErrorHandler, } from '@opentelemetry/core'; -import { MultiSpanProcessor } from '../src/MultiSpanProcessor'; +import { MultiSpanProcessor } from '../../src/MultiSpanProcessor'; class TestProcessor implements SpanProcessor { spans: Span[] = []; diff --git a/packages/opentelemetry-tracing/test/Span.test.ts b/packages/opentelemetry-tracing/test/common/Span.test.ts similarity index 98% rename from packages/opentelemetry-tracing/test/Span.test.ts rename to packages/opentelemetry-tracing/test/common/Span.test.ts index 75631fa5c3..bd2072bf00 100644 --- a/packages/opentelemetry-tracing/test/Span.test.ts +++ b/packages/opentelemetry-tracing/test/common/Span.test.ts @@ -17,7 +17,6 @@ import { SpanStatusCode, Exception, - LinkContext, ROOT_CONTEXT, SpanContext, SpanKind, @@ -31,7 +30,7 @@ import { } from '@opentelemetry/core'; import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; import * as assert from 'assert'; -import { BasicTracerProvider, Span, SpanProcessor } from '../src'; +import { BasicTracerProvider, Span, SpanProcessor } from '../../src'; const performanceTimeOrigin = hrTime(); @@ -48,9 +47,10 @@ describe('Span', () => { spanId: '6e0c63257de34c92', traceFlags: TraceFlags.SAMPLED, }; - const linkContext: LinkContext = { + const linkContext: SpanContext = { traceId: 'e4cda95b652f4a1592b449d5929fda1b', spanId: '7e0c63257de34c92', + traceFlags: TraceFlags.SAMPLED }; it('should create a Span instance', () => { @@ -179,7 +179,7 @@ describe('Span', () => { spanContext, SpanKind.CLIENT ); - const context = span.context(); + const context = span.spanContext(); assert.strictEqual(context.traceId, spanContext.traceId); assert.strictEqual(context.traceFlags, TraceFlags.SAMPLED); assert.strictEqual(context.traceState, undefined); @@ -312,9 +312,10 @@ describe('Span', () => { spanId: '5e0c63257de34c92', traceFlags: TraceFlags.SAMPLED, }; - const linkContext: LinkContext = { + const linkContext: SpanContext = { traceId: 'b3cda95b652f4a1592b449d5929fda1b', spanId: '6e0c63257de34c92', + traceFlags: TraceFlags.SAMPLED }; const attributes = { attr1: 'value', attr2: 123, attr3: true }; const span = new Span( @@ -380,7 +381,7 @@ describe('Span', () => { assert.strictEqual(span.name, 'my-span'); assert.strictEqual(span.kind, SpanKind.INTERNAL); assert.strictEqual(span.parentSpanId, parentId); - assert.strictEqual(span.spanContext.traceId, spanContext.traceId); + assert.strictEqual(span.spanContext().traceId, spanContext.traceId); assert.deepStrictEqual(span.status, { code: SpanStatusCode.UNSET, }); diff --git a/packages/opentelemetry-tracing/test/Tracer.test.ts b/packages/opentelemetry-tracing/test/common/Tracer.test.ts similarity index 68% rename from packages/opentelemetry-tracing/test/Tracer.test.ts rename to packages/opentelemetry-tracing/test/common/Tracer.test.ts index cde378b4eb..30180ef468 100644 --- a/packages/opentelemetry-tracing/test/Tracer.test.ts +++ b/packages/opentelemetry-tracing/test/common/Tracer.test.ts @@ -13,24 +13,28 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import * as assert from 'assert'; import { + context, + createContextKey, + INVALID_TRACEID, + ROOT_CONTEXT, Sampler, SamplingDecision, - TraceFlags, - ROOT_CONTEXT, - suppressInstrumentation, SpanContext, - INVALID_TRACEID, - setSpanContext, + trace, + TraceFlags } from '@opentelemetry/api'; -import { BasicTracerProvider, Tracer, Span } from '../src'; +import { getSpan } from '@opentelemetry/api/build/src/trace/context-utils'; import { - InstrumentationLibrary, - AlwaysOnSampler, AlwaysOffSampler, + AlwaysOnSampler, + InstrumentationLibrary, + suppressTracing } from '@opentelemetry/core'; +import * as assert from 'assert'; +import { BasicTracerProvider, Span, Tracer } from '../../src'; +import { TestStackContextManager } from './export/TestStackContextManager'; +import * as sinon from 'sinon'; describe('Tracer', () => { const tracerProvider = new BasicTracerProvider(); @@ -49,7 +53,13 @@ describe('Tracer', () => { } } + beforeEach(() => { + const contextManager = new TestStackContextManager().enable(); + context.setGlobalContextManager(contextManager); + }); + afterEach(() => { + context.disable(); delete envSource.OTEL_TRACES_SAMPLER; delete envSource.OTEL_TRACES_SAMPLER_ARG; }); @@ -121,8 +131,8 @@ describe('Tracer', () => { assert.strictEqual(lib.version, '0.0.1'); }); - describe('when suppressInstrumentation true', () => { - const context = suppressInstrumentation(ROOT_CONTEXT); + describe('when suppressTracing true', () => { + const context = suppressTracing(ROOT_CONTEXT); it('should return cached no-op span ', done => { const tracer = new Tracer( @@ -154,10 +164,10 @@ describe('Tracer', () => { const span = tracer.startSpan( 'aSpan', undefined, - setSpanContext(ROOT_CONTEXT, parent) + trace.setSpanContext(ROOT_CONTEXT, parent) ); assert.strictEqual((span as Span).parentSpanId, parent.spanId); - assert.strictEqual(span.context().traceId, parent.traceId); + assert.strictEqual(span.spanContext().traceId, parent.traceId); }); it('should not use spanId from invalid parent', () => { @@ -174,7 +184,7 @@ describe('Tracer', () => { const span = tracer.startSpan( 'aSpan', undefined, - setSpanContext(ROOT_CONTEXT, parent) + trace.setSpanContext(ROOT_CONTEXT, parent) ); assert.strictEqual((span as Span).parentSpanId, undefined); }); @@ -188,7 +198,7 @@ describe('Tracer', () => { tracerProvider ); const span = tracer.startSpan('my-span'); - const context = span.context(); + const context = span.spanContext(); assert.strictEqual(context.traceFlags, TraceFlags.SAMPLED); span.end(); }); @@ -202,7 +212,7 @@ describe('Tracer', () => { tracerProvider ); const span = tracer.startSpan('my-span'); - const context = span.context(); + const context = span.spanContext(); assert.strictEqual(context.traceFlags, TraceFlags.SAMPLED); span.end(); }); @@ -216,8 +226,74 @@ describe('Tracer', () => { tracerProvider ); const span = tracer.startSpan('my-span'); - const context = span.context(); + const context = span.spanContext(); assert.strictEqual(context.traceFlags, TraceFlags.NONE); span.end(); }); + + it('should start an active span with name and function args', () => { + const tracer = new Tracer( + { name: 'default', version: '0.0.1' }, + { sampler: new TestSampler() }, + tracerProvider + ); + + const spy = sinon.spy(tracer, "startSpan"); + + assert.strictEqual(tracer.startActiveSpan('my-span', span => { + try { + assert(spy.calledWith('my-span')) + assert.strictEqual(getSpan(context.active()), span) + return 1 + } finally { + span.end(); + } + }), 1); + }); + + it('should start an active span with name, options and function args', () => { + + const tracer = new Tracer( + { name: 'default', version: '0.0.1' }, + { sampler: new TestSampler() }, + tracerProvider + ); + + const spy = sinon.spy(tracer, "startSpan"); + + assert.strictEqual(tracer.startActiveSpan('my-span', {attributes: {foo: 'bar'}}, span => { + try { + assert(spy.calledWith('my-span', {attributes: {foo: 'bar'}})) + assert.strictEqual(getSpan(context.active()), span) + return 1 + } finally { + span.end(); + } + }), 1); + }); + + it('should start an active span with name, options, context and function args', () => { + const tracer = new Tracer( + { name: 'default', version: '0.0.1' }, + { sampler: new TestSampler() }, + tracerProvider + ); + + const ctxKey = createContextKey('foo'); + + const ctx = context.active().setValue(ctxKey, 'bar') + + const spy = sinon.spy(tracer, "startSpan"); + + assert.strictEqual(tracer.startActiveSpan('my-span', {attributes: {foo: 'bar'}}, ctx, span => { + try { + assert(spy.calledWith('my-span', {attributes: {foo: 'bar'}}, ctx)) + assert.strictEqual(getSpan(context.active()), span) + assert.strictEqual(ctx.getValue(ctxKey), 'bar') + return 1 + } finally { + span.end(); + } + }), 1); + }); }); diff --git a/packages/opentelemetry-tracing/test/config.test.ts b/packages/opentelemetry-tracing/test/common/config.test.ts similarity index 98% rename from packages/opentelemetry-tracing/test/config.test.ts rename to packages/opentelemetry-tracing/test/common/config.test.ts index 7f81183c13..ea27f21e9d 100644 --- a/packages/opentelemetry-tracing/test/config.test.ts +++ b/packages/opentelemetry-tracing/test/common/config.test.ts @@ -20,7 +20,7 @@ import { TraceIdRatioBasedSampler, } from '@opentelemetry/core'; import * as assert from 'assert'; -import { buildSamplerFromEnv } from '../src/config'; +import { buildSamplerFromEnv } from '../../src/config'; describe('config', () => { const envSource = (typeof window !== 'undefined' diff --git a/packages/opentelemetry-tracing/test/export/BatchSpanProcessor.test.ts b/packages/opentelemetry-tracing/test/common/export/BatchSpanProcessorBase.test.ts similarity index 95% rename from packages/opentelemetry-tracing/test/export/BatchSpanProcessor.test.ts rename to packages/opentelemetry-tracing/test/common/export/BatchSpanProcessorBase.test.ts index 4f5d734713..7015d03595 100644 --- a/packages/opentelemetry-tracing/test/export/BatchSpanProcessor.test.ts +++ b/packages/opentelemetry-tracing/test/common/export/BatchSpanProcessorBase.test.ts @@ -23,15 +23,11 @@ import { } from '@opentelemetry/core'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import { - BasicTracerProvider, - BatchSpanProcessor, - InMemorySpanExporter, - Span, -} from '../../src'; +import { BasicTracerProvider, BufferConfig, InMemorySpanExporter, Span } from '../../../src'; import { context } from '@opentelemetry/api'; import { TestTracingSpanExporter } from './TestTracingSpanExporter'; import { TestStackContextManager } from './TestStackContextManager'; +import { BatchSpanProcessorBase } from '../../../src/export/BatchSpanProcessorBase'; function createSampledSpan(spanName: string): Span { const tracer = new BasicTracerProvider({ @@ -42,16 +38,23 @@ function createSampledSpan(spanName: string): Span { return span as Span; } -describe('BatchSpanProcessor', () => { +class BatchSpanProcessor extends BatchSpanProcessorBase { + onInit() {} + onShutdown() {} +} + +describe('BatchSpanProcessorBase', () => { const name = 'span-name'; const defaultBufferConfig = { maxExportBatchSize: 5, scheduledDelayMillis: 2500, }; let exporter: InMemorySpanExporter; + beforeEach(() => { exporter = new InMemorySpanExporter(); }); + afterEach(() => { exporter.reset(); sinon.restore(); @@ -104,6 +107,14 @@ describe('BatchSpanProcessor', () => { }); describe('.onStart/.onEnd/.shutdown', () => { + it('should call onShutdown', async () => { + const processor = new BatchSpanProcessor(exporter, defaultBufferConfig); + const onShutdownSpy = sinon.stub(processor, 'onShutdown'); + assert.strictEqual(onShutdownSpy.callCount, 0); + await processor.shutdown(); + assert.strictEqual(onShutdownSpy.callCount, 1); + }); + it('should do nothing after processor is shutdown', async () => { const processor = new BatchSpanProcessor(exporter, defaultBufferConfig); const spy: sinon.SinonSpy = sinon.spy(exporter, 'export') as any; diff --git a/packages/opentelemetry-tracing/test/export/ConsoleSpanExporter.test.ts b/packages/opentelemetry-tracing/test/common/export/ConsoleSpanExporter.test.ts similarity index 96% rename from packages/opentelemetry-tracing/test/export/ConsoleSpanExporter.test.ts rename to packages/opentelemetry-tracing/test/common/export/ConsoleSpanExporter.test.ts index 1370bdbec3..8e5e40adfb 100644 --- a/packages/opentelemetry-tracing/test/export/ConsoleSpanExporter.test.ts +++ b/packages/opentelemetry-tracing/test/common/export/ConsoleSpanExporter.test.ts @@ -21,7 +21,7 @@ import { BasicTracerProvider, ConsoleSpanExporter, SimpleSpanProcessor, -} from '../../src'; +} from '../../../src'; /* eslint-disable no-console */ describe('ConsoleSpanExporter', () => { @@ -79,7 +79,7 @@ describe('ConsoleSpanExporter', () => { assert.ok(firstSpan.name === 'foo'); assert.ok(firstEvent.name === 'foobar'); - assert.ok(consoleSpan.id === firstSpan.spanContext.spanId); + 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/common/export/InMemorySpanExporter.test.ts similarity index 81% rename from packages/opentelemetry-tracing/test/export/InMemorySpanExporter.test.ts rename to packages/opentelemetry-tracing/test/common/export/InMemorySpanExporter.test.ts index 3f8c916768..66514155f0 100644 --- a/packages/opentelemetry-tracing/test/export/InMemorySpanExporter.test.ts +++ b/packages/opentelemetry-tracing/test/common/export/InMemorySpanExporter.test.ts @@ -19,8 +19,8 @@ import { InMemorySpanExporter, SimpleSpanProcessor, BasicTracerProvider, -} from '../../src'; -import { context, setSpan } from '@opentelemetry/api'; +} from '../../../src'; +import { context, trace } from '@opentelemetry/api'; import { ExportResult, ExportResultCode } from '@opentelemetry/core'; describe('InMemorySpanExporter', () => { @@ -37,10 +37,10 @@ describe('InMemorySpanExporter', () => { const root = provider.getTracer('default').startSpan('root'); const child = provider .getTracer('default') - .startSpan('child', {}, setSpan(context.active(), root)); + .startSpan('child', {}, trace.setSpan(context.active(), root)); const grandChild = provider .getTracer('default') - .startSpan('grand-child', {}, setSpan(context.active(), child)); + .startSpan('grand-child', {}, trace.setSpan(context.active(), child)); assert.strictEqual(memoryExporter.getFinishedSpans().length, 0); grandChild.end(); @@ -54,10 +54,10 @@ describe('InMemorySpanExporter', () => { 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); + 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', () => { @@ -65,7 +65,7 @@ describe('InMemorySpanExporter', () => { provider .getTracer('default') - .startSpan('child', {}, setSpan(context.active(), root)) + .startSpan('child', {}, trace.setSpan(context.active(), root)) .end(); root.end(); assert.strictEqual(memoryExporter.getFinishedSpans().length, 2); @@ -75,7 +75,7 @@ describe('InMemorySpanExporter', () => { // after shutdown no new spans are accepted provider .getTracer('default') - .startSpan('child1', {}, setSpan(context.active(), root)) + .startSpan('child1', {}, trace.setSpan(context.active(), root)) .end(); assert.strictEqual(memoryExporter.getFinishedSpans().length, 0); }); diff --git a/packages/opentelemetry-tracing/test/export/SimpleSpanProcessor.test.ts b/packages/opentelemetry-tracing/test/common/export/SimpleSpanProcessor.test.ts similarity index 99% rename from packages/opentelemetry-tracing/test/export/SimpleSpanProcessor.test.ts rename to packages/opentelemetry-tracing/test/common/export/SimpleSpanProcessor.test.ts index b3a5f1ecd5..df5fa66f81 100644 --- a/packages/opentelemetry-tracing/test/export/SimpleSpanProcessor.test.ts +++ b/packages/opentelemetry-tracing/test/common/export/SimpleSpanProcessor.test.ts @@ -33,7 +33,7 @@ import { InMemorySpanExporter, SimpleSpanProcessor, Span, -} from '../../src'; +} from '../../../src'; import { TestStackContextManager } from './TestStackContextManager'; import { TestTracingSpanExporter } from './TestTracingSpanExporter'; diff --git a/packages/opentelemetry-tracing/test/export/TestStackContextManager.ts b/packages/opentelemetry-tracing/test/common/export/TestStackContextManager.ts similarity index 97% rename from packages/opentelemetry-tracing/test/export/TestStackContextManager.ts rename to packages/opentelemetry-tracing/test/common/export/TestStackContextManager.ts index 5196c86d79..3413a4aa1e 100644 --- a/packages/opentelemetry-tracing/test/export/TestStackContextManager.ts +++ b/packages/opentelemetry-tracing/test/common/export/TestStackContextManager.ts @@ -43,7 +43,7 @@ export class TestStackContextManager implements ContextManager { } } - bind(target: T, context?: Context): T { + bind(context: Context, target: T): T { throw new Error('Method not implemented.'); } diff --git a/packages/opentelemetry-tracing/test/export/TestTracingSpanExporter.ts b/packages/opentelemetry-tracing/test/common/export/TestTracingSpanExporter.ts similarity index 95% rename from packages/opentelemetry-tracing/test/export/TestTracingSpanExporter.ts rename to packages/opentelemetry-tracing/test/common/export/TestTracingSpanExporter.ts index 499faf91eb..9415c67fe7 100644 --- a/packages/opentelemetry-tracing/test/export/TestTracingSpanExporter.ts +++ b/packages/opentelemetry-tracing/test/common/export/TestTracingSpanExporter.ts @@ -20,7 +20,7 @@ import { ReadableSpan, Tracer, SpanProcessor, -} from '../../src'; +} from '../../../src'; import { ExportResult, AlwaysOnSampler } from '@opentelemetry/core'; /** @@ -58,7 +58,7 @@ export class TestTracingSpanExporter extends InMemorySpanExporter { ); } - export( + override export( spans: ReadableSpan[], resultCallback: (result: ExportResult) => void ): void { @@ -71,13 +71,13 @@ export class TestTracingSpanExporter extends InMemorySpanExporter { super.export(spans, resultCallback); } - shutdown(): Promise { + override shutdown(): Promise { return super.shutdown().then(() => { this._exporterCreatedSpans = []; }); } - reset() { + override reset() { super.reset(); this._exporterCreatedSpans = []; } diff --git a/packages/opentelemetry-web/package.json b/packages/opentelemetry-web/package.json index e0d73f1716..29cbb36417 100644 --- a/packages/opentelemetry-web/package.json +++ b/packages/opentelemetry-web/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/web", - "version": "0.19.0", + "version": "0.21.0", "description": "OpenTelemetry Web Tracer", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -46,18 +46,17 @@ }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^1.0.0-rc.0", - "@opentelemetry/context-zone": "0.19.0", - "@opentelemetry/propagator-b3": "0.19.0", - "@opentelemetry/resources": "0.19.0", + "@opentelemetry/api": "^1.0.0", + "@opentelemetry/context-zone": "0.21.0", + "@opentelemetry/propagator-b3": "0.21.0", + "@opentelemetry/resources": "0.21.0", "@types/jquery": "3.5.5", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", "@types/webpack-env": "1.16.0", "babel-loader": "8.2.2", - "codecov": "3.8.1", - "gts": "3.1.0", + "codecov": "3.8.2", "istanbul-instrumenter-loader": "3.0.1", "karma": "5.2.3", "karma-chrome-launcher": "3.1.0", @@ -65,7 +64,7 @@ "karma-jquery": "0.2.4", "karma-mocha": "2.0.1", "karma-spec-reporter": "0.0.32", - "karma-webpack": "5.0.0", + "karma-webpack": "4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", @@ -73,17 +72,17 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0", "webpack-cli": "4.6.0", "webpack-merge": "5.7.3" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.0-rc.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/core": "0.21.0", + "@opentelemetry/semantic-conventions": "0.21.0", + "@opentelemetry/tracing": "0.21.0" } } diff --git a/packages/opentelemetry-web/src/StackContextManager.ts b/packages/opentelemetry-web/src/StackContextManager.ts index 0c87d6e7c6..c293be8833 100644 --- a/packages/opentelemetry-web/src/StackContextManager.ts +++ b/packages/opentelemetry-web/src/StackContextManager.ts @@ -62,10 +62,11 @@ export class StackContextManager implements ContextManager { /** * Binds a the certain context or the active one to the target function and then returns the target - * @param target - * @param context + * @param context A context (span) to be bind to target + * @param target a function or event emitter. When target or one of its callbacks is called, + * the provided context will be used as the active context for the duration of the call. */ - bind(target: T, context = ROOT_CONTEXT): T { + bind(context: Context, target: T): T { // if no specific context to propagate is given, we use the current one if (context === undefined) { context = this.active(); diff --git a/packages/opentelemetry-web/src/WebTracerProvider.ts b/packages/opentelemetry-web/src/WebTracerProvider.ts index 0212f132af..15065502cb 100644 --- a/packages/opentelemetry-web/src/WebTracerProvider.ts +++ b/packages/opentelemetry-web/src/WebTracerProvider.ts @@ -55,7 +55,7 @@ export class WebTracerProvider extends BasicTracerProvider { * * @param config Configuration object for SDK registration */ - register(config: SDKRegistrationConfig = {}) { + override register(config: SDKRegistrationConfig = {}) { if (config.contextManager === undefined) { config.contextManager = new StackContextManager(); } diff --git a/packages/opentelemetry-web/src/version.ts b/packages/opentelemetry-web/src/version.ts index 3fc2009a62..fb47fc303b 100644 --- a/packages/opentelemetry-web/src/version.ts +++ b/packages/opentelemetry-web/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.21.0'; diff --git a/packages/opentelemetry-web/test/StackContextManager.test.ts b/packages/opentelemetry-web/test/StackContextManager.test.ts index 2753260b86..1509780e7b 100644 --- a/packages/opentelemetry-web/test/StackContextManager.test.ts +++ b/packages/opentelemetry-web/test/StackContextManager.test.ts @@ -176,46 +176,46 @@ describe('StackContextManager', () => { const ctx = ROOT_CONTEXT.setValue(key1, obj1); obj1.title = 'a2'; const obj2 = new Obj('b1'); - const wrapper: any = contextManager.bind(obj2.getTitle, ctx); + const wrapper: any = contextManager.bind(ctx, obj2.getTitle); assert.ok(wrapper(), 'a2'); }); it('should return the same target (when enabled)', () => { const test = ROOT_CONTEXT.setValue(key1, 1); - assert.deepStrictEqual(contextManager.bind(test), test); + assert.deepStrictEqual(contextManager.bind(contextManager.active(), test), test); }); it('should return the same target (when disabled)', () => { contextManager.disable(); const test = ROOT_CONTEXT.setValue(key1, 1); - assert.deepStrictEqual(contextManager.bind(test), test); + assert.deepStrictEqual(contextManager.bind(contextManager.active(), test), test); contextManager.enable(); }); it('should return current context (when enabled)', done => { const context = ROOT_CONTEXT.setValue(key1, 1); - const fn: any = contextManager.bind(() => { + const fn: any = contextManager.bind(context, () => { assert.strictEqual( contextManager.active(), context, 'should have context' ); return done(); - }, context); + }); fn(); }); it('should return current context (when disabled)', done => { contextManager.disable(); const context = ROOT_CONTEXT.setValue(key1, 1); - const fn: any = contextManager.bind(() => { + const fn: any = contextManager.bind(context, () => { 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 index a73845bfff..18462a14a6 100644 --- a/packages/opentelemetry-web/test/WebTracerProvider.test.ts +++ b/packages/opentelemetry-web/test/WebTracerProvider.test.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { context, getSpan, setSpan, ContextManager } from '@opentelemetry/api'; +import { context, ContextManager, trace } from '@opentelemetry/api'; import { ZoneContextManager } from '@opentelemetry/context-zone'; import { B3Propagator } from '@opentelemetry/propagator-b3'; import { Resource } from '@opentelemetry/resources'; @@ -91,9 +91,9 @@ describe('WebTracerProvider', () => { const rootSpan = webTracerWithZone.startSpan('rootSpan'); - context.with(setSpan(context.active(), rootSpan), () => { + context.with(trace.setSpan(context.active(), rootSpan), () => { assert.ok( - getSpan(context.active()) === rootSpan, + trace.getSpan(context.active()) === rootSpan, 'Current span is rootSpan' ); const concurrentSpan1 = webTracerWithZone.startSpan( @@ -103,19 +103,19 @@ describe('WebTracerProvider', () => { 'concurrentSpan2' ); - context.with(setSpan(context.active(), concurrentSpan1), () => { + context.with(trace.setSpan(context.active(), concurrentSpan1), () => { setTimeout(() => { assert.ok( - getSpan(context.active()) === concurrentSpan1, + trace.getSpan(context.active()) === concurrentSpan1, 'Current span is concurrentSpan1' ); }, 10); }); - context.with(setSpan(context.active(), concurrentSpan2), () => { + context.with(trace.setSpan(context.active(), concurrentSpan2), () => { setTimeout(() => { assert.ok( - getSpan(context.active()) === concurrentSpan2, + trace.getSpan(context.active()) === concurrentSpan2, 'Current span is concurrentSpan2' ); done(); diff --git a/packages/opentelemetry-web/test/registration.test.ts b/packages/opentelemetry-web/test/registration.test.ts index 89ff0c0cd4..baab6a4d77 100644 --- a/packages/opentelemetry-web/test/registration.test.ts +++ b/packages/opentelemetry-web/test/registration.test.ts @@ -16,8 +16,6 @@ import { context, - NoopContextManager, - NoopTextMapPropagator, propagation, trace, ProxyTracerProvider, @@ -48,8 +46,8 @@ describe('API registration', () => { it('should register configured implementations', () => { const tracerProvider = new WebTracerProvider(); - const contextManager = new NoopContextManager(); - const propagator = new NoopTextMapPropagator(); + const contextManager = { disable() { }, enable() { } } as any; + const propagator = {} as any; tracerProvider.register({ contextManager, @@ -64,12 +62,13 @@ describe('API registration', () => { }); it('should skip null context manager', () => { + const ctxManager = context['_getContextManager'](); const tracerProvider = new WebTracerProvider(); tracerProvider.register({ contextManager: null, }); - assert.ok(context['_getContextManager']() instanceof NoopContextManager); + assert.strictEqual(context['_getContextManager'](), ctxManager, "context manager should not change"); assert.ok( propagation['_getGlobalPropagator']() instanceof CompositePropagator @@ -79,14 +78,13 @@ describe('API registration', () => { }); it('should skip null propagator', () => { + const propagator = propagation['_getGlobalPropagator'](); const tracerProvider = new WebTracerProvider(); tracerProvider.register({ propagator: null, }); - assert.ok( - propagation['_getGlobalPropagator']() instanceof NoopTextMapPropagator - ); + assert.strictEqual(propagation["_getGlobalPropagator"](), propagator, "propagator should not change") assert.ok(context['_getContextManager']() instanceof StackContextManager); const apiTracerProvider = trace.getTracerProvider() as ProxyTracerProvider; diff --git a/packages/template/package.json b/packages/template/package.json index aeefcf09f5..f47af0ea22 100644 --- a/packages/template/package.json +++ b/packages/template/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/template", - "version": "0.19.0", + "version": "0.21.0", "private": true, "publishConfig": { "access": "restricted" @@ -66,12 +66,12 @@ ], "devDependencies": { "@types/node": "14.14.43", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "Add these to devDependencies for testing": { "@types/mocha": "8.2.0", "@types/sinon": "9.0.9", - "codecov": "3.8.1", + "codecov": "3.8.2", "istanbul-instrumenter-loader": "3.0.1", "mocha": "7.2.0", "nyc": "15.1.0", @@ -88,8 +88,5 @@ "karma-spec-reporter": "0.0.32", "karma-webpack": "4.0.2", "webpack": "4.44.2" - }, - "Add these to devDependencies for linting": { - "gts": "3.1.0" } } diff --git a/renovate.json b/renovate.json index de13f791c0..debd9bceb4 100644 --- a/renovate.json +++ b/renovate.json @@ -11,7 +11,7 @@ "rangeStrategy": "bump" } ], - "ignoreDeps": ["gcp-metadata", "got", "mocha", "husky"], + "ignoreDeps": ["gcp-metadata", "got", "mocha", "husky", "karma-webpack"], "assignees": ["@dyladan", "@obecny", "@vmarchaud"], "schedule": ["before 3am on Friday"], "labels": ["dependencies"] diff --git a/scripts/semconv/generate.sh b/scripts/semconv/generate.sh index 4aa7ac6f18..96cc1cb90d 100755 --- a/scripts/semconv/generate.sh +++ b/scripts/semconv/generate.sh @@ -4,7 +4,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="${SCRIPT_DIR}/../../" # freeze the spec version to make SpanAttributess generation reproducible -SPEC_VERSION=v1.2.0 +SPEC_VERSION=v1.4.0 GENERATOR_VERSION=0.3.1 cd ${SCRIPT_DIR} diff --git a/scripts/semconv/templates/SemanticAttributes.ts.j2 b/scripts/semconv/templates/SemanticAttributes.ts.j2 index 0342f32aea..18004561d9 100644 --- a/scripts/semconv/templates/SemanticAttributes.ts.j2 +++ b/scripts/semconv/templates/SemanticAttributes.ts.j2 @@ -16,7 +16,7 @@ {%- macro print_value(type, value) -%} - {{ "\"" if type == "string"}}{{value}}{{ "\"" if type == "string"}} + {{ "'" if type == "string"}}{{value}}{{ "'" if type == "string"}} {%- endmacro %} {%- macro upFirst(text) -%} {{ text[0]|upper}}{{text[1:] }} diff --git a/tsconfig.base.json b/tsconfig.base.json index 83c860a168..b2d1a3bd96 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -11,6 +11,7 @@ "noFallthroughCasesInSwitch": true, "noImplicitReturns": true, "noUnusedLocals": true, + "noImplicitOverride": true, "pretty": true, "sourceMap": true, "strict": true,