diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000000..04961b83df --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,63 @@ +name: Benchmark Tests + +on: + push: + branches: [ main ] + +jobs: + benchmark-tests: + strategy: + fail-fast: false + matrix: + node_version: + - "18" + runs-on: self-hosted + timeout-minutes: 10 + env: + NPM_CONFIG_UNSAFE_PERM: true + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node_version }} + + - run: npm install -g npm@latest + + - name: restore lerna + id: cache + uses: actions/cache@v3 + with: + path: | + node_modules + package-lock.json + packages/*/node_modules + packages/*/package-lock.json + experimental/packages/*/node_modules + experimental/packages/*/package-lock.json + key: node-tests-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04292022 + + - name: Bootstrap + run: | + npm install --ignore-scripts + npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --ignore @opentelemetry/selenium-tests + + - name: Build πŸ”§ + run: | + npm run compile + + - name: Benchmark tests + run: | + npm run test:bench + find . -name .benchmark-results.txt -exec cat {} + > combined_benchmarks.txt + + - name: Store benchmark results + uses: benchmark-action/github-action-benchmark@v1 + with: + tool: 'benchmarkjs' + output-file-path: combined_benchmarks.txt + gh-pages-branch: gh-pages + github-token: ${{ secrets.GITHUB_TOKEN }} + benchmark-data-dir-path: "benchmarks" + auto-push: true diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 70fb482d60..0d8d88ca73 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -15,7 +15,7 @@ jobs: if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'Skip Changelog')}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check for CHANGELOG changes run: | diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 659cde8d2f..f67b78fe0e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -2,17 +2,9 @@ name: "CodeQL Analysis" on: workflow_dispatch: - schedule: - # β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ minute (0 - 59) - # β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ hour (0 - 23) - # β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ day of the month (1 - 31) - # β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ month (1 - 12 or JAN-DEC) - # β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ day of the week (0 - 6 or SUN-SAT) - # β”‚ β”‚ β”‚ β”‚ β”‚ - # β”‚ β”‚ β”‚ β”‚ β”‚ - # β”‚ β”‚ β”‚ β”‚ β”‚ - # * * * * * - - cron: '30 1 * * *' + push: + branches: [ main ] + pull_request: jobs: CodeQL-Build: @@ -20,7 +12,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index d11fe80ab6..787e11a91e 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: @@ -23,7 +23,7 @@ jobs: path: | package-lock.json packages/*/package-lock.json - backwards-compatability/*/package-lock.json + backwards-compatibility/*/package-lock.json metapackages/*/package-lock.json packages/*/package-lock.json integration-tests/*/package-lock.json diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 16b9d4b4cd..a8bb9e14dc 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,9 +14,9 @@ jobs: steps: - uses: actions/setup-node@v3 with: - node-version: '14' + node-version: '16' - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Lint changelog file uses: avto-dev/markdown-lint@v1 diff --git a/.github/workflows/peer-api.yml b/.github/workflows/peer-api.yml index e6f52cccd7..bb5094ec40 100644 --- a/.github/workflows/peer-api.yml +++ b/.github/workflows/peer-api.yml @@ -14,7 +14,7 @@ jobs: image: node:20 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install lerna run: npm install -g lerna diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 6c61133e69..da15818d5f 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -20,13 +20,18 @@ jobs: NPM_CONFIG_UNSAFE_PERM: true steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node_version }} - run: npm install -g npm@latest + if: ${{ matrix.node_version == '18' || matrix.node_version == '20' }} + + # npm@10.0.0 drops support for Node.js v14 and v16 + - run: npm install -g npm@"<10.0.0" + if: ${{ matrix.node_version == '14' || matrix.node_version == '16' }} - name: restore lerna id: cache @@ -41,6 +46,10 @@ jobs: experimental/packages/*/package-lock.json key: node-tests-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04292022 + # temporary fix for https://github.com/nrwl/nx/issues/19022 + - run: npm install --save-dev nx@16.7.4 @nx/devkit@16.7.4 + if: ${{ matrix.node_version == '14' }} + - name: Bootstrap run: | npm install --ignore-scripts @@ -66,11 +75,11 @@ jobs: NPM_CONFIG_UNSAFE_PERM: true steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: - node-version: '16' + node-version: '18' - run: npm install -g npm@latest @@ -98,6 +107,8 @@ jobs: npm run compile - name: Unit tests + env: + NODE_OPTIONS: --openssl-legacy-provider run: npm run test browser-tests: runs-on: ubuntu-latest @@ -105,7 +116,7 @@ jobs: NPM_CONFIG_UNSAFE_PERM: true steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: @@ -143,7 +154,7 @@ jobs: NPM_CONFIG_UNSAFE_PERM: true steps: - name: Checkout - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v4.0.0 - uses: actions/setup-node@v3 with: node-version: 16 @@ -185,7 +196,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: @@ -201,4 +212,9 @@ jobs: - name: Test working-directory: ./api - run: npm test + # running test:eol as node 8 is not supported anymore by the version of nyc we use, as we don't report coverage + # for this step we leave it out. + # Details: nyc requires istanbul-lib-report, which silently dropped support for Node.js v8 when going from + # 3.0.0 to 3.0.1 by requiring make-dir@^4.0.0 to fix https://github.com/advisories/GHSA-c2qf-rxjj-qqgw. + # make-dir does not support Node.js v8 anymore. + run: npm run test:eol diff --git a/.github/workflows/w3c-integration-test.yml b/.github/workflows/w3c-integration-test.yml index 443fe85fac..04c07379ab 100644 --- a/.github/workflows/w3c-integration-test.yml +++ b/.github/workflows/w3c-integration-test.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout πŸ›ŽοΈ - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: diff --git a/.gitignore b/.gitignore index 90ef9bd3f2..59141394bb 100644 --- a/.gitignore +++ b/.gitignore @@ -89,3 +89,6 @@ package.json.lerna_backup #IDEA .idea *.iml + +# non-aggregated benchmark results +.benchmark-results.txt diff --git a/.nycrc b/.nycrc index 22383d8aba..eb64eeca29 100644 --- a/.nycrc +++ b/.nycrc @@ -8,7 +8,6 @@ "build/**/*.*", "src/index.ts", "src/platform/**/index.ts", - "src/platform/browser/*.ts", "src/version.ts", "test/**/*.*", ".eslintrc.js", diff --git a/CHANGELOG.md b/CHANGELOG.md index f827e31585..40b17374f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/ ### :rocket: (Enhancement) -* feat(SpanExpoter): Add optional forceFlush to SpanExporter interface [#3753](https://github.com/open-telemetry/opentelemetry-js/pull/3753/) @sgracias1 @JacksonWeber +* feat(metrics): prototype experimental advice support [#3876](https://github.com/open-telemetry/opentelemetry-js/pull/3876) @legendecas ### :bug: (Bug Fix) @@ -19,6 +19,86 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/ ### :house: (Internal) +## 1.17.1 + +### :bug: (Bug Fix) + +* fix(sdk-trace-base): BatchSpanProcessor flushes when `maxExportBatchSize` is reached [#3958](https://github.com/open-telemetry/opentelemetry-js/pull/3958) @nordfjord +* fix(sdk-metrics): allow instrument names to contain '/' [#4155](https://github.com/open-telemetry/opentelemetry-js/pull/4155) +* fix(sdk-metrics): prevent per-reader storages from keeping unreported accumulations in memory [#4163](https://github.com/open-telemetry/opentelemetry-js/pull/4163) @pichlermarc + * fixes a memory leak which occurred when two or more `MetricReader` instances are registered to a `MeterProvider` +* fix(sdk-metrics): do not report empty scopes and metrics [#4135](https://github.com/open-telemetry/opentelemetry-js/pull/4135) @pichlermarc + * Instruments that were created, but did not have measurements will not be exported anymore + * Meters (Scopes) that were created, but did not have any instruments with measurements under them will not be exported anymore. +* fix(exporter-zipkin): round duration to the nearest int in annotations to be compliant with zipkin protocol [#4167](https://github.com/open-telemetry/opentelemetry-js/pull/4167) @FelipeEmerim + +### :books: (Refine Doc) + +* docs(contributing): added guidelines for adding benchmark tests [#4169](https://github.com/open-telemetry/opentelemetry-js/pull/4169) + +### :house: (Internal) + +* test: added a performance benchmark test for span creation [#4105](https://github.com/open-telemetry/opentelemetry-js/pull/4105) +* test: added a workflow to run performance benchmark tests automatically [#4144](https://github.com/open-telemetry/opentelemetry-js/pull/4144) + +## 1.17.0 + +### :bug: (Bug Fix) + +* Revert "feat(api): add attributes argument to recordException API [#4071](https://github.com/open-telemetry/opentelemetry-js/pull/4071)" + * This feature was an unintentional breaking change introduced with API 1.5.0 + * This PR updates all SDK packages to allow API 1.6.0, where this change has been reverted. + +## 1.16.0 + +### :rocket: (Enhancement) + +* feat(sdk-metrics): implement MetricProducer specification [#4007](https://github.com/open-telemetry/opentelemetry-js/pull/4007) +* feat: update PeriodicExportingMetricReader and PrometheusExporter to accept optional metric producers [#4077](https://github.com/open-telemetry/opentelemetry-js/pull/4077) @aabmass + +### :bug: (Bug Fix) + +* fix(exporter-zipkin): rounding duration to the nearest int to be compliant with zipkin protocol [#4064](https://github.com/open-telemetry/opentelemetry-js/pull/4064) @n0cloud +* fix(sdk-metrics): metric names should be case-insensitive + +### :books: (Refine Doc) + +* docs(guidelines): add dependencies guidelines [#4040](https://github.com/open-telemetry/opentelemetry-js/pull/4040) + +## 1.15.2 + +### :bug: (Bug Fix) + +* fix(core): stop rounding to nearest int in hrTimeTo*seconds() functions [#4014](https://github.com/open-telemetry/opentelemetry-js/pull/4014/) @aabmass +* fix(sdk-metrics): ignore invalid metric values [#3988](https://github.com/open-telemetry/opentelemetry-js/pull/3988) @legendecas +* fix(core): add baggage support for values containing an equals sign [#3975](https://github.com/open-telemetry/opentelemetry-js/pull/3975) @krosenk729 + +## 1.15.1 + +### :bug: (Bug Fix) + +* Revert "feat(minification): Add noEmitHelpers, importHelpers and tslib as a dependency (#3914)" + [#4011](https://github.com/open-telemetry/opentelemetry-js/pull/4011) @dyladan + +## 1.15.0 + +### :bug: (Bug Fix) + +* fix(opentelemetry-exporter-prometheus): Update default PrometheusExporter to not append a timestamp to match the text based exposition format [#3961](https://github.com/open-telemetry/opentelemetry-js/pull/3961) @JacksonWeber +* fix(sdk-metrics): Update default Histogram's boundary to match OTEL's spec [#3893](https://github.com/open-telemetry/opentelemetry-js/pull/3893/) @chigia001 +* fix(sdk-metrics): preserve startTime for cumulative ExponentialHistograms [#3934](https://github.com/open-telemetry/opentelemetry-js/pull/3934/) @aabmass +* fix(sdk-trace-web): add secureConnectionStart to https only [#3879](https://github.com/open-telemetry/opentelemetry-js/pull/3879) @Abinet18 + +### :house: (Internal) + +* feat(minification): [Minification] Add noEmitHelpers, importHelpers and tslib as a dependency [#3913](https://github.com/open-telemetry/opentelemetry-js/issues/3913) @MSNev + +## 1.14.0 + +### :rocket: (Enhancement) + +* feat(SpanExporter): Add optional forceFlush to SpanExporter interface [#3753](https://github.com/open-telemetry/opentelemetry-js/pull/3753/) @sgracias1 @JacksonWeber + ## 1.13.0 ### :rocket: (Enhancement) diff --git a/README.md b/README.md index ca72796747..c07b4e5924 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ ## About this project -This is the JavaScript version of [OpenTelemetry](https://opentelemetry.io/), a framework for collecting traces and metrics from applications. +This is the JavaScript version of [OpenTelemetry](https://opentelemetry.io/), a framework for collecting traces, metrics, and logs from applications. ## Quick Start @@ -109,24 +109,29 @@ If you are a library author looking to build OpenTelemetry into your library, pl ## Supported Runtimes -| Platform Version | Supported | -| ------------------- | ----------------------------------------------- | -| Node.JS `v18` | βœ… | -| Node.JS `v16` | βœ… | -| Node.JS `v14` | βœ… | -| Older Node Versions | See [Node Support](#node-support) | -| Web Browsers | βœ… See [Browser Support](#browser-support) below | +| Platform Version | Supported | +|---------------------|-----------------------------------------------| +| Node.JS `v18` | :heavy_check_mark: | +| Node.JS `v16` | :heavy_check_mark: | +| Node.JS `v14` | :heavy_check_mark: | +| Older Node Versions | See [Node Support](#node-support) | +| Web Browsers | See [Browser Support](#browser-support) below | ### Node Support Only Node.js Active or Maintenance LTS versions are supported. Previous versions of node *may* work, but they are not tested by OpenTelemetry and they are not guaranteed to work. -Please note that versions of Node.JS v8 prior to `v8.12.0` will NOT work, because OpenTelemetry Node depends on the `perf_hooks` module introduced in `v8.5.0` and `performance.timeOrigin` that is set correctly starting in `v8.12.0`. +Note that versions of Node.JS v8 prior to `v8.12.0` will NOT work, because OpenTelemetry Node depends on the +`perf_hooks` module introduced in `v8.5.0` and `performance.timeOrigin` that is set correctly starting in `v8.12.0`. ### Browser Support -Automated browser tests are run in the latest version of Headless Chrome. -There is currently no list of officially supported browsers, but OpenTelemetry is developed using standard web technologies with wide support and should work in currently supported versions of major browsers. +> [!IMPORTANT] +> Client instrumentation for the browser is **experimental** and mostly **unspecified**. If you are interested in +> helping out, get in touch with the [Client Instrumentation SIG][client-instrumentation-sig]. + +There is currently no list of officially supported browsers. OpenTelemetry is developed using standard web +technologies and aims to work in currently supported versions of major browsers. ## Package Version Compatibility @@ -136,19 +141,27 @@ There may also be API packages for experimental signals in the experimental dire All stable packages are released with the same version, and all experimental packages are released with the same version. The below table describes which versions of each set of packages are expected to work together. -| API | Stable Packages | Experimental Packages | -| ----- | --------------- | --------------------- | -| 1.3.x | 1.9.x | 0.35.x | -| 1.3.x | 1.8.x | 0.34.x | -| 1.2.x | 1.7.x | 0.33.x | -| 1.2.x | 1.6.x | 0.32.x | -| 1.1.x | 1.5.x | 0.31.x | -| 1.1.x | 1.4.x | 0.30.x | -| 1.1.x | 1.3.x | 0.29.x | -| 1.1.x | 1.2.x | 0.29.x | -| 1.1.x | 1.1.x | 0.28.x | -| 1.0.x | 1.0.x | 0.27.x | -| 1.0.x | 1.0.x | 0.26.x | +| Stable Packages | Experimental Packages | +|-----------------------------------------------------------------|-----------------------| +| 1.17.x | 0.43.x | +| 1.16.x | 0.42.x | +| 1.15.x | 0.41.x | +| 1.14.x | 0.40.x | +| 1.13.x | 0.39.x | +| 1.12.x | 0.38.x | +| 1.11.x | 0.37.x | +| 1.10.x | 0.36.x | +| 1.9.x | 0.35.x | +| 1.8.x (this and later versions require API >=1.3.0 for metrics) | 0.34.x | +| 1.7.x | 0.33.x | +| 1.6.x | 0.32.x | +| 1.5.x | 0.31.x | +| 1.4.x | 0.30.x | +| 1.3.x | 0.29.x | +| 1.2.x | 0.29.x | +| 1.1.x | 0.28.x | +| 1.0.x | 0.27.x | +| 1.0.x (this and later versions require API >=1.0.0 for traces) | 0.26.x | ## Versioning @@ -177,7 +190,7 @@ We have a weekly SIG meeting! See the [community page](https://github.com/open-t #### Maintainers ([@open-telemetry/js-maintainers](https://github.com/orgs/open-telemetry/teams/javascript-maintainers)) -- [Amir Blum](https://github.com/blumamir), Aspecto +- [Amir Blum](https://github.com/blumamir), Keyval - [Chengzhong Wu](https://github.com/legendecas), Alibaba - [Daniel Dyla](https://github.com/dyladan), Dynatrace - [Marc Pichler](https://github.com/pichlermarc), Dynatrace @@ -190,13 +203,10 @@ We have a weekly SIG meeting! See the [community page](https://github.com/open-t - [Haddas Bronfman](https://github.com/haddasbronfman), Cisco - [Hector Hernandez](https://github.com/hectorhdzg), Microsoft - [Jamie Danielson](https://github.com/JamieDanielson), Honeycomb -- [John Bley](https://github.com/johnbley), Splunk -- [Mark Wolff](https://github.com/markwolff), Microsoft - [Martin Kuba](https://github.com/martinkuba), Lightstep - [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 - [Purvi Kanal](https://github.com/pkanal), Honeycomb - [Svetlana Brennan](https://github.com/svetlanabrennan), New Relic @@ -211,6 +221,9 @@ We have a weekly SIG meeting! See the [community page](https://github.com/open-t - [Valentin Marchaud](https://github.com/vmarchaud), Maintainer - [Brandon Gonzalez](https://github.com/bg451), LightStep, Approver - [Roch Devost](https://github.com/rochdev), DataDog, Approver +- [John Bley](https://github.com/johnbley), Splunk, Approver +- [Mark Wolff](https://github.com/markwolff), Microsoft, Approver +- [Olivier Albertini](https://github.com/OlivierAlbertini), Ville de MontrΓ©al, Approver *Find more about the emeritus role in [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md#emeritus-maintainerapprovertriager).* @@ -552,6 +565,8 @@ Apache 2.0 - See [LICENSE][license-url] for more information. [up-for-grabs-issues]: https://github.com/open-telemetry/OpenTelemetry-js/issues?q=is%3Aissue+is%3Aopen+label%3Aup-for-grabs [good-first-issues]: https://github.com/open-telemetry/OpenTelemetry-js/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22 +[client-instrumentation-sig]: https://docs.google.com/document/d/16Vsdh-DM72AfMg_FIt9yT9ExEWF4A_vRbQ3jRNBe09w/edit + [docs]: https://open-telemetry.github.io/opentelemetry-js [compliance-matrix]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/spec-compliance-matrix.md [CONTRIBUTING]: https://github.com/open-telemetry/opentelemetry-js/blob/main/CONTRIBUTING.md diff --git a/api/.eslintrc.js b/api/.eslintrc.js index 7d5c10c7f9..08f88d4912 100644 --- a/api/.eslintrc.js +++ b/api/.eslintrc.js @@ -4,5 +4,5 @@ module.exports = { "commonjs": true, "shared-node-browser": true }, - ...require('../eslint.config.js') + ...require('../eslint.base.js') } diff --git a/api/CHANGELOG.md b/api/CHANGELOG.md index 5b52050074..4738e1449e 100644 --- a/api/CHANGELOG.md +++ b/api/CHANGELOG.md @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file. ## Unreleased +### :rocket: (Enhancement) + +* feat(metrics): prototype experimental advice support [#3876](https://github.com/open-telemetry/opentelemetry-js/pull/3876) @legendecas + +## 1.6.0 + +### :bug: (Bug Fix) + +* Revert "feat(api): add attributes argument to recordException API [#4071](https://github.com/open-telemetry/opentelemetry-js/pull/4071)" + * This feature was an unintentional breaking change introduced with 1.5.0 + +## 1.5.0 + +### :rocket: (Enhancement) + +* feat(api): add attributes argument to recordException API [#4071](https://github.com/open-telemetry/opentelemetry-js/pull/4071) + ## 1.4.1 ### :bug: (Bug Fix) diff --git a/api/package.json b/api/package.json index a82fd886b8..e06c2f28de 100644 --- a/api/package.json +++ b/api/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/api", - "version": "1.4.1", + "version": "1.6.0", "description": "Public API for OpenTelemetry", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -16,16 +16,17 @@ "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../", "codecov:webworker": "nyc report --reporter=json && codecov -f coverage/*.json -p ../", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "docs": "typedoc", "docs:deploy": "gh-pages --dist docs/out", "docs:test": "linkinator docs/out --silent && linkinator docs/*.md *.md --markdown --silent", "lint:fix": "eslint . --ext .ts --fix", "lint": "eslint . --ext .ts", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", - "test:webworker": "nyc karma start karma.worker.js --single-run", + "test:eol": "ts-mocha -p tsconfig.json 'test/**/*.test.ts'", + "test:webworker": "karma start karma.worker.js --single-run", "cycle-check": "dpdm --exit-code circular:1 src/index.ts", "version": "node ../scripts/version-update.js", "prewatch": "npm run precompile", @@ -60,29 +61,31 @@ "access": "public" }, "devDependencies": { - "@types/mocha": "10.0.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", - "@types/webpack": "4.41.26", + "@types/sinon": "10.0.18", + "@types/webpack": "4.41.34", "@types/webpack-env": "1.16.3", "codecov": "3.8.3", - "dpdm": "3.10.0", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", + "cross-var": "1.1.0", + "dpdm": "3.13.1", + "babel-plugin-istanbul": "6.1.1", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", "karma-mocha-webworker": "1.3.0", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "memfs": "3.4.9", - "mocha": "10.0.0", + "lerna": "7.1.5", + "memfs": "3.5.3", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", - "unionfs": "4.4.0", + "unionfs": "4.5.1", "webpack": "4.46.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/api", diff --git a/api/src/index.ts b/api/src/index.ts index 6992005874..c5dbe1685b 100644 --- a/api/src/index.ts +++ b/api/src/index.ts @@ -51,6 +51,7 @@ export { ObservableUpDownCounter, UpDownCounter, BatchObservableCallback, + MetricAdvice, MetricAttributes, MetricAttributeValue, ObservableCallback, diff --git a/api/src/metrics/Meter.ts b/api/src/metrics/Meter.ts index c399fc5fb7..1405ae7473 100644 --- a/api/src/metrics/Meter.ts +++ b/api/src/metrics/Meter.ts @@ -85,7 +85,7 @@ export interface Meter { * @param [options] the metric options. */ createUpDownCounter< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, >( name: string, options?: MetricOptions @@ -100,7 +100,7 @@ export interface Meter { * @param [options] the metric options. */ createObservableGauge< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, >( name: string, options?: MetricOptions @@ -115,7 +115,7 @@ export interface Meter { * @param [options] the metric options. */ createObservableCounter< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, >( name: string, options?: MetricOptions @@ -130,7 +130,7 @@ export interface Meter { * @param [options] the metric options. */ createObservableUpDownCounter< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, >( name: string, options?: MetricOptions @@ -151,7 +151,7 @@ export interface Meter { * @param observables the observables associated with this batch observable callback */ addBatchObservableCallback< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, >( callback: BatchObservableCallback, observables: Observable[] @@ -167,7 +167,7 @@ export interface Meter { * @param observables the observables associated with this batch observable callback */ removeBatchObservableCallback< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, >( callback: BatchObservableCallback, observables: Observable[] diff --git a/api/src/metrics/Metric.ts b/api/src/metrics/Metric.ts index 36d773441e..e8abca3b1d 100644 --- a/api/src/metrics/Metric.ts +++ b/api/src/metrics/Metric.ts @@ -18,6 +18,18 @@ import { Attributes, AttributeValue } from '../common/Attributes'; import { Context } from '../context/types'; import { BatchObservableResult, ObservableResult } from './ObservableResult'; +/** + * Advisory options influencing aggregation configuration parameters. + * @experimental + */ +export interface MetricAdvice { + /** + * Hint the explicit bucket boundaries for SDK if the metric is been + * aggregated with a HistogramAggregator. + */ + explicitBucketBoundaries?: number[]; +} + /** * Options needed for metric creation */ @@ -39,6 +51,12 @@ export interface MetricOptions { * @default {@link ValueType.DOUBLE} */ valueType?: ValueType; + + /** + * The advice influencing aggregation configuration parameters. + * @experimental + */ + advice?: MetricAdvice; } /** The Type of value. It describes how the data is reported. */ @@ -63,7 +81,7 @@ export enum ValueType { *
    */ export interface Counter< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, > { /** * Increment value of counter by the input. Inputs must not be negative. @@ -72,7 +90,7 @@ export interface Counter< } export interface UpDownCounter< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, > { /** * Increment value of counter by the input. Inputs may be negative. @@ -81,7 +99,7 @@ export interface UpDownCounter< } export interface Histogram< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, > { /** * Records a measurement. Value of the measurement must not be negative. @@ -103,7 +121,7 @@ export type MetricAttributeValue = AttributeValue; * The observable callback for Observable instruments. */ export type ObservableCallback< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, > = ( observableResult: ObservableResult ) => void | Promise; @@ -112,13 +130,13 @@ export type ObservableCallback< * The observable callback for a batch of Observable instruments. */ export type BatchObservableCallback< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, > = ( observableResult: BatchObservableResult ) => void | Promise; export interface Observable< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, > { /** * Sets up a function that will be called whenever a metric collection is initiated. @@ -134,11 +152,11 @@ export interface Observable< } export type ObservableCounter< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, > = Observable; export type ObservableUpDownCounter< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, > = Observable; export type ObservableGauge< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, > = Observable; diff --git a/api/src/metrics/ObservableResult.ts b/api/src/metrics/ObservableResult.ts index 5b4f9e962b..29a82db120 100644 --- a/api/src/metrics/ObservableResult.ts +++ b/api/src/metrics/ObservableResult.ts @@ -20,7 +20,7 @@ import { MetricAttributes, Observable } from './Metric'; * Interface that is being used in callback function for Observable Metric. */ export interface ObservableResult< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, > { /** * Observe a measurement of the value associated with the given attributes. @@ -41,7 +41,7 @@ export interface ObservableResult< * Interface that is being used in batch observable callback function. */ export interface BatchObservableResult< - AttributesTypes extends MetricAttributes = MetricAttributes + AttributesTypes extends MetricAttributes = MetricAttributes, > { /** * Observe a measurement of the value associated with the given attributes. diff --git a/doc/GUIDELINES.md b/doc/GUIDELINES.md new file mode 100644 index 0000000000..ea349fdde7 --- /dev/null +++ b/doc/GUIDELINES.md @@ -0,0 +1,35 @@ +# OpenTelemetry JS Code Contribution Guide + +This document outlines the essential guidelines for contributing code to the OpenTelemetry JS repository. These guidelines are designed to ensure consistency, stability, and the highest quality of code across the project. + +## Dependencies + +This section refers to `"dependencies"` and `"devDependencies"` entries in `package.json` file. +> [!IMPORTANT] +> Not all libraries follow [Semantic Versioning](https://semver.org/). Even those who do might occasionally introduce breaking changes due to human errors. Exceptions to the guidelines in this document MAY be granted by Approvers or Maintainers to work around this. + +### Development Dependencies + +`"devDependencies"` SHOULD be pinned to reduce the risk of autobreaking the build. Since we cannot use the `package-lock.json` file (because the libraries are distributed without it), control over the version our contributors will get is limited. By using pinned versions, we prevent potential disruptions caused by unpinned versions. + +**Example:** `^1.2.3` might inadvertently lead to version `1.2.6` which includes unintended breaking changes). + +> [!NOTE] +> As this approach might leave our project with outdated tooling, we adopt `renovate-bot`. This automated dependency update tool proactively opens pull requests upon the release of new patch/minor/major versions. The complete configuration for renovate-bot can be found in [renovate.json](../renovate.json) file. + +### @opentelemetry/* dependencies + +All packages from the `@opentelemetry/` namespace MUST have the same pinned version, as these dependencies are automatically updated on each release by lerna. + +**Example:** all packages under `packages/` should consistently maintain the same version, as should those under `experimental/packages/`. + +An exception is granted for dependencies on `@opentelemetry/api`, which, if used by the package SHOULD NOT be included as a `dependency`. `@opentelemetry/api` SHOULD be included as a `peerDependency` instead. The version range of the `peerDependency` SHOULD reflect the minimum supported, and SHOULD NOT allow versions greater than the latest released minor version. + +### Third-Party Library Dependencies + +Packages categorized as third-party and listed under the `"dependencies"` section (e.g., @grpc/grpc-js, @grpc/proto-loader, shimmer, etc.) should remain unpinned and utilize the caret (`^`) symbol. This approach offers several advantages: + +* Our users could get bug fixes of those 3rd-party packages easily, without waiting for us to update our library. +* In cases where multiple packages have dependencies on different versions of the same package, npm will opt for the most recent version, saving space and preventing potential disruptions. + +It's important to acknowledge that this approach does expose users to potential breaking changes arising from either human error or libraries that do not strictly follow to semver conventions. This trade-off is an inherent aspect of this approach. diff --git a/doc/contributing/benchmark-tests.md b/doc/contributing/benchmark-tests.md new file mode 100644 index 0000000000..e97b1659b8 --- /dev/null +++ b/doc/contributing/benchmark-tests.md @@ -0,0 +1,53 @@ + +# Performance Benchmark Testing Guide + +Benchmark tests are intended to measure performance of small units of code. + +It is recommended that operations that have a high impact on the performance of the SDK (or potential for) are accompanied by a benchmark test. This helps end-users understand the performance trend over time, and it also helps maintainers catch performance regressions. + +Benchmark tests are run automatically with every merge to main, and the results are available at . + +## Running benchmark tests + +Performance benchmark tests can be run from the root for all modules or from a single module directory only for that module: + +``` bash +# benchmark all modules +npm run test:bench + +# benchmark a single module +cd packages/opentelemetry-sdk-trace-base +npm run test:bench +``` + +## Adding a benchmark test + +Unlike unit tests, benchmark tests should be written in plain JavaScript (not Typescript). + +Add a new test file in folder `test/performance/benchmark` using the following as a template: + +``` javascript +const Benchmark = require('benchmark'); + +const suite = new Benchmark.Suite(); + +suite.on('cycle', event => { + console.log(String(event.target)); +}); + +suite.add('new benchmark test', function() { + // write code to test ... +}); + +suite.run(); +``` + +## Automatically running benchmark tests + +If you want your test to run automatically with every merge to main (to track trend over time), register the new test file by requiring it in `test/performance/benchmark/index.js`. + +Add the `test:bench` script in package.json, if the module does not contain it already. + +``` json +"test:bench": "node test/performance/benchmark/index.js | tee .benchmark-results.txt" +``` diff --git a/doc/library-author.md b/doc/library-author.md deleted file mode 100644 index 44e5f1e97e..0000000000 --- a/doc/library-author.md +++ /dev/null @@ -1,3 +0,0 @@ -# OpenTelemetry for Library Authors - -TODO diff --git a/doc/metrics.md b/doc/metrics.md index 7162f43638..3f48775e49 100644 --- a/doc/metrics.md +++ b/doc/metrics.md @@ -1,6 +1,6 @@ # Metrics -This quick start is for end users of OpenTelemetry who wish to manually measure their applications. If you are a library author, please see the [Library Authors Guide](library-author.md). If you wish to automatically instrument your application, see the automatic instrumentation documentation for the SDK you wish to use. +This quick start is for end users of OpenTelemetry who wish to manually measure their applications. If you wish to automatically instrument your application, see the automatic instrumentation documentation for the SDK you wish to use. For a high-level overview of OpenTelemetry metrics in general and definitions of some common terms, you can refer to the [OpenTelemetry Specification Overview][spec-overview] @@ -20,7 +20,7 @@ _Metrics API Reference: _ +_See the current metrics semantic conventions in the OpenTelemetry Specification repository: _ [spec-overview]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/overview.md @@ -479,7 +479,7 @@ new View({ After you have instrumented your application with metrics, you also need to make sure that the metrics get collected by your metrics backend. The most common formats -that are used are Prometheus and OLTP. +that are used are Prometheus and OTLP. The latter is the [OpenTelemetry protocol format](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md) which is supported by the OpenTelemetry Collector. The former is based on the [OpenMetrics @@ -528,7 +528,7 @@ at: - -The processor has two responsibilities: choosing which aggregator to choose for a metric instrument and store the last record for each metric ready to be exported. - -## Selecting a specific aggregator for metrics - -Sometimes you may want to use a specific aggregator for one of your metric, export an average of the last X values instead of just the last one. - -Here is what an aggregator that does that would look like: - -```ts -import { Aggregator } from '@opentelemetry/sdk-metrics'; -import { hrTime } from '@opentelemetry/core'; - -export class AverageAggregator implements Aggregator { - - private _values: number[] = []; - private _limit: number; - - constructor (limit?: number) { - this._limit = limit ?? 10; - } - - update (value: number) { - this._values.push(value); - if (this._values.length >= this._limit) { - this._values = this._values.slice(0, 10); - } - } - - toPoint() { - const sum =this._values.reduce((agg, value) => { - agg += value; - return agg; - }, 0); - return { - value: this._values.length > 0 ? sum / this._values.length : 0, - timestamp: hrTime(), - } - } -} -``` - -Now we will need to implement our own processor to configure the sdk to use our new aggregator. To simplify even more, we will just extend the `UngroupedProcessor` (which is the default) to avoid re-implementing the whole `Aggregator` interface. - -Here the result: - -```ts -import { - UngroupedProcessor, - MetricDescriptor, - CounterSumAggregator, - ObserverAggregator, - MeasureExactAggregator, -} from '@opentelemetry/sdk-metrics'; - -export class CustomProcessor extends UngroupedProcessor { - aggregatorFor (metricDescriptor: MetricDescriptor) { - if (metricDescriptor.name === 'requests') { - return new AverageAggregator(10); - } - // this is exactly what the "UngroupedProcessor" does, we will re-use it - // to fallback on the default behavior - switch (metricDescriptor.metricKind) { - case MetricKind.COUNTER: - return new CounterSumAggregator(); - case MetricKind.OBSERVER: - return new ObserverAggregator(); - default: - return new MeasureExactAggregator(); - } - } -} -``` - -Finally, we need to specify to the `MeterProvider` to use our `CustomProcessor` when creating new meter: - -```ts -import { - UngroupedProcessor, - MetricDescriptor, - CounterSumAggregator, - ObserverAggregator, - MeasureExactAggregator, - MeterProvider, - Aggregator, -} from '@opentelemetry/sdk-metrics'; -import { hrTime } from '@opentelemetry/core'; - -export class AverageAggregator implements Aggregator { - - private _values: number[] = []; - private _limit: number; - - constructor (limit?: number) { - this._limit = limit ?? 10; - } - - update (value: number) { - this._values.push(value); - if (this._values.length >= this._limit) { - this._values = this._values.slice(0, 10); - } - } - - toPoint() { - const sum =this._values.reduce((agg, value) => { - agg += value; - return agg; - }, 0); - return { - value: this._values.length > 0 ? sum / this._values.length : 0, - timestamp: hrTime(), - } - } -} - -export class CustomProcessor extends UngroupedProcessor { - aggregatorFor (metricDescriptor: MetricDescriptor) { - if (metricDescriptor.name === 'requests') { - return new AverageAggregator(10); - } - // this is exactly what the "UngroupedProcessor" does, we will re-use it - // to fallback on the default behavior - switch (metricDescriptor.metricKind) { - case MetricKind.COUNTER: - return new CounterSumAggregator(); - case MetricKind.OBSERVER: - return new ObserverAggregator(); - default: - return new MeasureExactAggregator(); - } - } -} - -const meter = new MeterProvider({ - processor: new CustomProcessor(), - interval: 1000, -}).getMeter('example-custom-processor'); - -const requestsLatency = meter.createHistogram('requests', { - monotonic: true, - description: 'Average latency' -}); -``` diff --git a/doc/tracing.md b/doc/tracing.md index ea3e38284b..392ca95736 100644 --- a/doc/tracing.md +++ b/doc/tracing.md @@ -1,6 +1,6 @@ # Tracing -This quick start is for end users of OpenTelemetry who wish to manually trace their applications. If you are a library author, please see the [Library Authors Guide](library-author.md). If you wish to automatically instrument your application, see the automatic instrumentation documentation for the SDK you wish to use. +This quick start is for end users of OpenTelemetry who wish to manually trace their applications. If you wish to automatically instrument your application, see the automatic instrumentation documentation for the SDK you wish to use. For a high-level overview of OpenTelemetry tracing in general and definitions of some common terms, you can refer to the [OpenTelemetry Specification Overview][spec-overview] @@ -76,10 +76,10 @@ server.on("GET", "/user/:id", onGet); ## Describing a Span -Using span relationships, attributes, kind, and the related [semantic conventions](https://github.com/open-telemetry/opentelemetry-specification/tree/main/specification/trace/semantic_conventions), we can more accurately describe the span in a way our tracing backend will more easily understand. The following example uses these mechanisms, which are described below. +Using span relationships, attributes, kind, and the related [semantic conventions](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/trace.md), we can more accurately describe the span in a way our tracing backend will more easily understand. The following example uses these mechanisms, which are described below. ```typescript -import { NetTransportValues SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { NetTransportValues, SemanticAttributes } from '@opentelemetry/semantic-conventions'; import { trace, context, SpanKind, SpanStatusCode } from '@opentelemetry/api'; async function onGet(request, response) { @@ -209,6 +209,6 @@ Consumer spans represent the processing of a job created by a producer and may s One problem with span names and attributes is recognizing, categorizing, and analyzing them in your tracing backend. Between different applications, libraries, and tracing backends there might be different names and expected values for various attributes. For example, your application may use `http.status` to describe the HTTP status code, but a library you use may use `http.status_code`. In order to solve this problem, OpenTelemetry uses a library of semantic conventions which describe the name and attributes which should be used for specific types of spans. The use of semantic conventions is always recommended where applicable, but they are merely conventions. For example, you may find that some name other than the name suggested by the semantic conventions more accurately describes your span, you may decide not to include a span attribute which is suggested by semantic conventions for privacy reasons, or you may wish to add a custom attribute which isn't covered by semantic conventions. All of these cases are fine, but please keep in mind that if you stray from the semantic conventions, the categorization of spans in your tracing backend may be affected. -_See the current trace semantic conventions in the OpenTelemetry Specification repository: _ +_See the current trace semantic conventions in the OpenTelemetry Specification repository: _ [spec-overview]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/overview.md diff --git a/eslint.config.js b/eslint.base.js similarity index 100% rename from eslint.config.js rename to eslint.base.js diff --git a/examples/esm-http-ts/package.json b/examples/esm-http-ts/package.json index 49c0e2601f..8920f11670 100644 --- a/examples/esm-http-ts/package.json +++ b/examples/esm-http-ts/package.json @@ -1,7 +1,7 @@ { "name": "esm-http-ts", "private": true, - "version": "0.38.0", + "version": "0.44.0", "description": "Example of HTTP integration with OpenTelemetry using ESM and TypeScript", "main": "build/index.js", "type": "module", @@ -30,13 +30,13 @@ }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/", "dependencies": { - "@opentelemetry/api": "1.4.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.38.0", - "@opentelemetry/instrumentation": "0.38.0", - "@opentelemetry/instrumentation-http": "0.38.0", - "@opentelemetry/resources": "1.9.1", - "@opentelemetry/sdk-trace-base": "1.9.1", - "@opentelemetry/sdk-trace-node": "1.9.1", - "@opentelemetry/semantic-conventions": "1.9.1" + "@opentelemetry/api": "1.6.0", + "@opentelemetry/exporter-trace-otlp-proto": "0.44.0", + "@opentelemetry/instrumentation": "0.44.0", + "@opentelemetry/instrumentation-http": "0.44.0", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@opentelemetry/sdk-trace-node": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1" } } diff --git a/examples/grpc/README.md b/examples/grpc/README.md deleted file mode 100644 index 1ec7a42a0e..0000000000 --- a/examples/grpc/README.md +++ /dev/null @@ -1,71 +0,0 @@ -# Overview - -OpenTelemetry gRPC Instrumentation allows the user to automatically collect trace data and export them to the backend of choice (we can use Zipkin or Jaeger for this example), to give observability to distributed systems. - -## Installation - -```sh -# from this directory -npm install -``` - -Setup [Zipkin Tracing](https://zipkin.io/pages/quickstart.html) -or -Setup [Jaeger Tracing](https://www.jaegertracing.io/docs/latest/getting-started/#all-in-one) - -## Run the Application - -### Zipkin - -- Run the server - - ```sh - # from this directory - npm run zipkin:server - ``` - -- Run the client - - ```sh - # from this directory - npm run zipkin:client - ``` - -#### Zipkin UI - -`zipkin:server` script should output the `traceid` in the terminal (e.g `traceid: 4815c3d576d930189725f1f1d1bdfcc6`). -Go to Zipkin with your browser (e.g - -

    - -### Jaeger - -- Run the server - - ```sh - # from this directory - npm run jaeger:server - ``` - -- Run the client - - ```sh - # from this directory - npm run jaeger:client - ``` - -#### Jaeger UI - -`jaeger:server` script should output the `traceid` in the terminal (e.g `traceid: 4815c3d576d930189725f1f1d1bdfcc6`). -Go to Jaeger with your browser (e.g - -

    - -## Useful links - -- For more information on OpenTelemetry, visit: -- For more information on OpenTelemetry for Node.js, visit: - -## LICENSE - -Apache License 2.0 diff --git a/examples/grpc/client.js b/examples/grpc/client.js deleted file mode 100644 index 18c7cf7354..0000000000 --- a/examples/grpc/client.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -const api = require('@opentelemetry/api'); -const tracer = require('./tracer')('example-grpc-client'); -const grpc = require('grpc'); -const messages = require('./helloworld_pb'); -const services = require('./helloworld_grpc_pb'); - -const PORT = 50051; - -/** A function which makes requests and handles response. */ -function main() { - // span corresponds to outgoing requests. Here, we have manually created - // 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.trace.setSpan(api.context.active(), span), () => { - console.log('Client traceId ', span.spanContext().traceId); - const client = new services.GreeterClient( - `localhost:${PORT}`, - grpc.credentials.createInsecure(), - ); - const request = new messages.HelloRequest(); - let user; - if (process.argv.length >= 3) { - // eslint-disable-next-line prefer-destructuring - user = process.argv[2]; - } else { - user = 'world'; - } - request.setName(user); - client.sayHello(request, (err, response) => { - span.end(); - if (err) throw err; - console.log('Greeting:', response.getMessage()); - }); - }); - - // The process must live for at least the interval past any traces that - // must be exported, or some risk being lost if they are recorded after the - // last export. - console.log('Sleeping 5 seconds before shutdown to ensure all records are flushed.'); - setTimeout(() => { console.log('Completed.'); }, 5000); -} - -main(); diff --git a/examples/grpc/helloworld_grpc_pb.js b/examples/grpc/helloworld_grpc_pb.js deleted file mode 100644 index 1e39a0f46a..0000000000 --- a/examples/grpc/helloworld_grpc_pb.js +++ /dev/null @@ -1,64 +0,0 @@ -// GENERATED CODE -- DO NOT EDIT! - -// Original file comments: -// Copyright 2015 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -'use strict'; - -const grpc = require('grpc'); -const helloworld_pb = require('./helloworld_pb.js'); - -function serialize_HelloReply(arg) { - if (!(arg instanceof helloworld_pb.HelloReply)) { - throw new Error('Expected argument of type HelloReply'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_HelloReply(buffer_arg) { - return helloworld_pb.HelloReply.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_HelloRequest(arg) { - if (!(arg instanceof helloworld_pb.HelloRequest)) { - throw new Error('Expected argument of type HelloRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_HelloRequest(buffer_arg) { - return helloworld_pb.HelloRequest.deserializeBinary( - new Uint8Array(buffer_arg), - ); -} - -// The greeting service definition. -const GreeterService = (exports.GreeterService = { - // Sends a greeting - sayHello: { - path: '/helloworld.Greeter/SayHello', - requestStream: false, - responseStream: false, - requestType: helloworld_pb.HelloRequest, - responseType: helloworld_pb.HelloReply, - requestSerialize: serialize_HelloRequest, - requestDeserialize: deserialize_HelloRequest, - responseSerialize: serialize_HelloReply, - responseDeserialize: deserialize_HelloReply, - }, -}); - -exports.GreeterClient = grpc.makeGenericClientConstructor(GreeterService); diff --git a/examples/grpc/helloworld_pb.js b/examples/grpc/helloworld_pb.js deleted file mode 100644 index 066acd68e8..0000000000 --- a/examples/grpc/helloworld_pb.js +++ /dev/null @@ -1,332 +0,0 @@ -/** - * @fileoverview - * @enhanceable - * @public - */ -// GENERATED CODE -- DO NOT EDIT! - -const jspb = require('google-protobuf'); - -const goog = jspb; -const global = Function('return this')(); - -goog.exportSymbol('proto.helloworld.HelloReply', null, global); -goog.exportSymbol('proto.helloworld.HelloRequest', null, global); - -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.helloworld.HelloRequest = function (opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.helloworld.HelloRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.helloworld.HelloRequest.displayName = 'proto.helloworld.HelloRequest'; -} - -if (jspb.Message.GENERATE_TO_OBJECT) { - /** - * Creates an object representation of this proto suitable for use in Soy templates. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. - * @param {boolean=} opt_includeInstance Whether to include the JSPB instance - * for transitional soy proto support: http://goto/soy-param-migration - * @return {!Object} - */ - proto.helloworld.HelloRequest.prototype.toObject = function ( - opt_includeInstance, - ) { - return proto.helloworld.HelloRequest.toObject(opt_includeInstance, this); - }; - - /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Whether to include the JSPB - * instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.helloworld.HelloRequest} msg The msg instance to transform. - * @return {!Object} - */ - proto.helloworld.HelloRequest.toObject = function (includeInstance, msg) { - let f; - - const obj = { - name: msg.getName(), - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; - }; -} - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.helloworld.HelloRequest} - */ -proto.helloworld.HelloRequest.deserializeBinary = function (bytes) { - const reader = new jspb.BinaryReader(bytes); - const msg = new proto.helloworld.HelloRequest(); - return proto.helloworld.HelloRequest.deserializeBinaryFromReader(msg, reader); -}; - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.helloworld.HelloRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.helloworld.HelloRequest} - */ -proto.helloworld.HelloRequest.deserializeBinaryFromReader = function ( - msg, - reader, -) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - const field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setName(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - -/** - * Class method variant: serializes the given message to binary data - * (in protobuf wire format), writing to the given BinaryWriter. - * @param {!proto.helloworld.HelloRequest} message - * @param {!jspb.BinaryWriter} writer - */ -proto.helloworld.HelloRequest.serializeBinaryToWriter = function ( - message, - writer, -) { - message.serializeBinaryToWriter(writer); -}; - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.helloworld.HelloRequest.prototype.serializeBinary = function () { - const writer = new jspb.BinaryWriter(); - this.serializeBinaryToWriter(writer); - return writer.getResultBuffer(); -}; - -/** - * Serializes the message to binary data (in protobuf wire format), - * writing to the given BinaryWriter. - * @param {!jspb.BinaryWriter} writer - */ -proto.helloworld.HelloRequest.prototype.serializeBinaryToWriter = function ( - writer, -) { - let f; - f = this.getName(); - if (f.length > 0) { - writer.writeString(1, f); - } -}; - -/** - * Creates a deep clone of this proto. No data is shared with the original. - * @return {!proto.helloworld.HelloRequest} The clone. - */ -proto.helloworld.HelloRequest.prototype.cloneMessage = function () { - return /** @type {!proto.helloworld.HelloRequest} */ (jspb.Message.cloneMessage( - this, - )); -}; - -/** - * optional string name = 1; - * @return {string} - */ -proto.helloworld.HelloRequest.prototype.getName = function () { - return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, '')); -}; - -/** @param {string} value */ -proto.helloworld.HelloRequest.prototype.setName = function (value) { - jspb.Message.setField(this, 1, value); -}; - -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.helloworld.HelloReply = function (opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.helloworld.HelloReply, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.helloworld.HelloReply.displayName = 'proto.helloworld.HelloReply'; -} - -if (jspb.Message.GENERATE_TO_OBJECT) { - /** - * Creates an object representation of this proto suitable for use in Soy templates. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. - * @param {boolean=} opt_includeInstance Whether to include the JSPB instance - * for transitional soy proto support: http://goto/soy-param-migration - * @return {!Object} - */ - proto.helloworld.HelloReply.prototype.toObject = function ( - opt_includeInstance, - ) { - return proto.helloworld.HelloReply.toObject(opt_includeInstance, this); - }; - - /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Whether to include the JSPB - * instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.helloworld.HelloReply} msg The msg instance to transform. - * @return {!Object} - */ - proto.helloworld.HelloReply.toObject = function (includeInstance, msg) { - let f; - - const obj = { - message: msg.getMessage(), - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; - }; -} - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.helloworld.HelloReply} - */ -proto.helloworld.HelloReply.deserializeBinary = function (bytes) { - const reader = new jspb.BinaryReader(bytes); - const msg = new proto.helloworld.HelloReply(); - return proto.helloworld.HelloReply.deserializeBinaryFromReader(msg, reader); -}; - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.helloworld.HelloReply} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.helloworld.HelloReply} - */ -proto.helloworld.HelloReply.deserializeBinaryFromReader = function ( - msg, - reader, -) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - const field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setMessage(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - -/** - * Class method variant: serializes the given message to binary data - * (in protobuf wire format), writing to the given BinaryWriter. - * @param {!proto.helloworld.HelloReply} message - * @param {!jspb.BinaryWriter} writer - */ -proto.helloworld.HelloReply.serializeBinaryToWriter = function ( - message, - writer, -) { - message.serializeBinaryToWriter(writer); -}; - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.helloworld.HelloReply.prototype.serializeBinary = function () { - const writer = new jspb.BinaryWriter(); - this.serializeBinaryToWriter(writer); - return writer.getResultBuffer(); -}; - -/** - * Serializes the message to binary data (in protobuf wire format), - * writing to the given BinaryWriter. - * @param {!jspb.BinaryWriter} writer - */ -proto.helloworld.HelloReply.prototype.serializeBinaryToWriter = function ( - writer, -) { - let f; - f = this.getMessage(); - if (f.length > 0) { - writer.writeString(1, f); - } -}; - -/** - * Creates a deep clone of this proto. No data is shared with the original. - * @return {!proto.helloworld.HelloReply} The clone. - */ -proto.helloworld.HelloReply.prototype.cloneMessage = function () { - return /** @type {!proto.helloworld.HelloReply} */ (jspb.Message.cloneMessage( - this, - )); -}; - -/** - * optional string message = 1; - * @return {string} - */ -proto.helloworld.HelloReply.prototype.getMessage = function () { - return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, '')); -}; - -/** @param {string} value */ -proto.helloworld.HelloReply.prototype.setMessage = function (value) { - jspb.Message.setField(this, 1, value); -}; - -goog.object.extend(exports, proto.helloworld); diff --git a/examples/grpc/images/jaeger.png b/examples/grpc/images/jaeger.png deleted file mode 100644 index 20eead3ba3..0000000000 Binary files a/examples/grpc/images/jaeger.png and /dev/null differ diff --git a/examples/grpc/images/zipkin.png b/examples/grpc/images/zipkin.png deleted file mode 100644 index d1dcd125a7..0000000000 Binary files a/examples/grpc/images/zipkin.png and /dev/null differ diff --git a/examples/grpc/package.json b/examples/grpc/package.json deleted file mode 100644 index d33861fccf..0000000000 --- a/examples/grpc/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "grpc-example", - "private": true, - "version": "0.25.0", - "description": "Example of gRPC integration with OpenTelemetry", - "main": "index.js", - "scripts": { - "zipkin:server": "cross-env EXPORTER=zipkin node ./server.js", - "zipkin:client": "cross-env EXPORTER=zipkin node ./client.js", - "jaeger:server": "cross-env EXPORTER=jaeger node ./server.js", - "jaeger:client": "cross-env EXPORTER=jaeger node ./client.js" - }, - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/open-telemetry/opentelemetry-js.git" - }, - "keywords": [ - "opentelemetry", - "grpc", - "tracing" - ], - "engines": { - "node": ">=14" - }, - "author": "OpenTelemetry Authors", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/open-telemetry/opentelemetry-js/issues" - }, - "dependencies": { - "@opentelemetry/api": "^1.0.2", - "@opentelemetry/exporter-jaeger": "^1.0.1", - "@opentelemetry/exporter-zipkin": "^1.0.1", - "@opentelemetry/instrumentation": "^0.27.0", - "@opentelemetry/instrumentation-grpc": "^0.27.0", - "@opentelemetry/resources": "^1.0.1", - "@opentelemetry/semantic-conventions": "^1.0.1", - "@opentelemetry/sdk-trace-base": "^1.0.1", - "@opentelemetry/sdk-trace-node": "^1.0.1", - "google-protobuf": "^3.9.2", - "grpc": "^1.23.3", - "node-pre-gyp": "0.14.0" - }, - "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/grpc", - "devDependencies": { - "cross-env": "^6.0.0" - } -} diff --git a/examples/grpc/server.js b/examples/grpc/server.js deleted file mode 100644 index 6cb34dee5e..0000000000 --- a/examples/grpc/server.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - -const api = require('@opentelemetry/api'); -const tracer = require('./tracer')(('example-grpc-server')); -const grpc = require('grpc'); - -const messages = require('./helloworld_pb'); -const services = require('./helloworld_grpc_pb'); - -const PORT = 50051; - -/** Starts a gRPC server that receives requests on sample server port. */ -function startServer() { - // Creates a server - const server = new grpc.Server(); - server.addService(services.GreeterService, { sayHello }); - server.bind(`0.0.0.0:${PORT}`, grpc.ServerCredentials.createInsecure()); - console.log(`binding server on 0.0.0.0:${PORT}`); - server.start(); -} - -function sayHello(call, callback) { - const currentSpan = api.trace.getSpan(api.context.active()); - // display traceid in the terminal - console.log(`traceid: ${currentSpan.spanContext().traceId}`); - const span = tracer.startSpan('server.js:sayHello()', { - parent: currentSpan, - kind: 1, // server - attributes: { key: 'value' }, - }); - span.addEvent(`invoking sayHello() to ${call.request.getName()}`); - const reply = new messages.HelloReply(); - reply.setMessage(`Hello ${call.request.getName()}`); - callback(null, reply); - span.end(); -} - -startServer(); diff --git a/examples/grpc/tracer.js b/examples/grpc/tracer.js deleted file mode 100644 index 3dd3adddc7..0000000000 --- a/examples/grpc/tracer.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -const opentelemetry = require('@opentelemetry/api'); -const { registerInstrumentations } = require('@opentelemetry/instrumentation'); -const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node'); -const { Resource } = require('@opentelemetry/resources'); -const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions'); -const { SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base'); -const { JaegerExporter } = require('@opentelemetry/exporter-jaeger'); -const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); -const { GrpcInstrumentation } = require('@opentelemetry/instrumentation-grpc'); - -const EXPORTER = process.env.EXPORTER || ''; - -module.exports = (serviceName) => { - const provider = new NodeTracerProvider({ - resource: new Resource({ - [SemanticResourceAttributes.SERVICE_NAME]: serviceName, - }), - }); - - let exporter; - if (EXPORTER.toLowerCase().startsWith('z')) { - exporter = new ZipkinExporter(); - } else { - exporter = new JaegerExporter(); - } - - provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); - - // Initialize the OpenTelemetry APIs to use the NodeTracerProvider bindings - provider.register(); - - registerInstrumentations({ - instrumentations: [ - new GrpcInstrumentation(), - ], - }); - - return opentelemetry.trace.getTracer('grpc-example'); -}; diff --git a/examples/http/package.json b/examples/http/package.json index e06dd1af2f..4ea1cafe3f 100644 --- a/examples/http/package.json +++ b/examples/http/package.json @@ -1,7 +1,7 @@ { "name": "http-example", "private": true, - "version": "0.39.1", + "version": "0.44.0", "description": "Example of HTTP integration with OpenTelemetry", "main": "index.js", "scripts": { @@ -29,14 +29,14 @@ }, "dependencies": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/exporter-jaeger": "1.13.0", - "@opentelemetry/exporter-zipkin": "1.13.0", - "@opentelemetry/instrumentation": "0.39.1", - "@opentelemetry/instrumentation-http": "0.39.1", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "@opentelemetry/sdk-trace-node": "1.13.0", - "@opentelemetry/semantic-conventions": "1.13.0" + "@opentelemetry/exporter-jaeger": "1.17.1", + "@opentelemetry/exporter-zipkin": "1.17.1", + "@opentelemetry/instrumentation": "0.44.0", + "@opentelemetry/instrumentation-http": "0.44.0", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@opentelemetry/sdk-trace-node": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/http", "devDependencies": { diff --git a/examples/https/package.json b/examples/https/package.json index 62b65273f2..13434d9151 100644 --- a/examples/https/package.json +++ b/examples/https/package.json @@ -1,7 +1,7 @@ { "name": "https-example", "private": true, - "version": "0.39.1", + "version": "0.44.0", "description": "Example of HTTPs integration with OpenTelemetry", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -33,14 +33,14 @@ }, "dependencies": { "@opentelemetry/api": "^1.0.0", - "@opentelemetry/exporter-jaeger": "1.13.0", - "@opentelemetry/exporter-zipkin": "1.13.0", - "@opentelemetry/instrumentation": "0.39.1", - "@opentelemetry/instrumentation-http": "0.39.1", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "@opentelemetry/sdk-trace-node": "1.13.0", - "@opentelemetry/semantic-conventions": "1.13.0" + "@opentelemetry/exporter-jaeger": "1.17.1", + "@opentelemetry/exporter-zipkin": "1.17.1", + "@opentelemetry/instrumentation": "0.44.0", + "@opentelemetry/instrumentation-http": "0.44.0", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@opentelemetry/sdk-trace-node": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/https", "devDependencies": { diff --git a/examples/opentelemetry-web/package.json b/examples/opentelemetry-web/package.json index c4c75e460c..0e3d5febad 100644 --- a/examples/opentelemetry-web/package.json +++ b/examples/opentelemetry-web/package.json @@ -1,7 +1,7 @@ { "name": "web-opentelemetry-example", "private": true, - "version": "0.39.1", + "version": "0.44.0", "description": "Example of using @opentelemetry/sdk-trace-web and @opentelemetry/sdk-metrics in browser", "main": "index.js", "scripts": { @@ -43,20 +43,20 @@ }, "dependencies": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/context-zone": "1.13.0", - "@opentelemetry/core": "1.13.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.39.1", - "@opentelemetry/exporter-trace-otlp-http": "0.39.1", - "@opentelemetry/exporter-trace-otlp-proto": "0.39.1", - "@opentelemetry/exporter-zipkin": "1.13.0", - "@opentelemetry/instrumentation": "0.39.1", - "@opentelemetry/instrumentation-fetch": "0.39.1", - "@opentelemetry/instrumentation-xml-http-request": "0.39.1", - "@opentelemetry/propagator-b3": "1.13.0", - "@opentelemetry/sdk-metrics": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "@opentelemetry/sdk-trace-web": "1.13.0", - "@opentelemetry/semantic-conventions": "1.13.0" + "@opentelemetry/context-zone": "1.17.1", + "@opentelemetry/core": "1.17.1", + "@opentelemetry/exporter-metrics-otlp-http": "0.44.0", + "@opentelemetry/exporter-trace-otlp-http": "0.44.0", + "@opentelemetry/exporter-trace-otlp-proto": "0.44.0", + "@opentelemetry/exporter-zipkin": "1.17.1", + "@opentelemetry/instrumentation": "0.44.0", + "@opentelemetry/instrumentation-fetch": "0.44.0", + "@opentelemetry/instrumentation-xml-http-request": "0.44.0", + "@opentelemetry/propagator-b3": "1.17.1", + "@opentelemetry/sdk-metrics": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@opentelemetry/sdk-trace-web": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/tracer-web" } diff --git a/examples/otlp-exporter-node/metrics.js b/examples/otlp-exporter-node/metrics.js index f6c3efa55b..0594ba42e3 100644 --- a/examples/otlp-exporter-node/metrics.js +++ b/examples/otlp-exporter-node/metrics.js @@ -4,25 +4,50 @@ const { DiagConsoleLogger, DiagLogLevel, diag } = require('@opentelemetry/api'); const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-http'); // const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-grpc'); // const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-proto'); -const { MeterProvider, PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics'); +// const { ConsoleMetricExporter } = require('@opentelemetry/sdk-metrics'); +const { + ExponentialHistogramAggregation, + MeterProvider, + PeriodicExportingMetricReader, + View, +} = require('@opentelemetry/sdk-metrics'); const { Resource } = require('@opentelemetry/resources'); -const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions'); +const { + SemanticResourceAttributes, +} = require('@opentelemetry/semantic-conventions'); // Optional and only needed to see the internal diagnostic logging (during development) diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG); -const metricExporter = new OTLPMetricExporter({}); +const metricExporter = new OTLPMetricExporter({ + // headers: { + // foo: 'bar' + // }, +}); + +// Define view for the exponential histogram metric +const expHistogramView = new View({ + aggregation: new ExponentialHistogramAggregation(), + // Note, the instrumentName is the same as the name that has been passed for + // the Meter#createHistogram function for exponentialHistogram. + instrumentName: 'test_exponential_histogram', +}); +// Create an instance of the metric provider const meterProvider = new MeterProvider({ resource: new Resource({ [SemanticResourceAttributes.SERVICE_NAME]: 'basic-metric-service', }), + views: [expHistogramView], }); -meterProvider.addMetricReader(new PeriodicExportingMetricReader({ - exporter: metricExporter, - exportIntervalMillis: 1000, -})); +meterProvider.addMetricReader( + new PeriodicExportingMetricReader({ + exporter: metricExporter, + // exporter: new ConsoleMetricExporter(), + exportIntervalMillis: 1000, + }) +); const meter = meterProvider.getMeter('example-exporter-collector'); @@ -38,10 +63,15 @@ const histogram = meter.createHistogram('test_histogram', { description: 'Example of a Histogram', }); +const exponentialHistogram = meter.createHistogram('test_exponential_histogram', { + description: 'Example of an ExponentialHistogram', +}); + const attributes = { pid: process.pid, environment: 'staging' }; setInterval(() => { requestCounter.add(1, attributes); upDownCounter.add(Math.random() > 0.5 ? 1 : -1, attributes); histogram.record(Math.random(), attributes); + exponentialHistogram.record(Math.random(), attributes); }, 1000); diff --git a/examples/otlp-exporter-node/package.json b/examples/otlp-exporter-node/package.json index c19ae9ea59..871a2a423a 100644 --- a/examples/otlp-exporter-node/package.json +++ b/examples/otlp-exporter-node/package.json @@ -1,7 +1,7 @@ { "name": "example-otlp-exporter-node", "private": true, - "version": "0.39.1", + "version": "0.44.0", "description": "Example of using @opentelemetry/collector-exporter in Node.js", "main": "index.js", "scripts": { @@ -29,17 +29,17 @@ }, "dependencies": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/core": "1.13.0", - "@opentelemetry/exporter-metrics-otlp-grpc": "0.39.1", - "@opentelemetry/exporter-metrics-otlp-http": "0.39.1", - "@opentelemetry/exporter-metrics-otlp-proto": "0.39.1", - "@opentelemetry/exporter-trace-otlp-grpc": "0.39.1", - "@opentelemetry/exporter-trace-otlp-http": "0.39.1", - "@opentelemetry/exporter-trace-otlp-proto": "0.39.1", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/sdk-metrics": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "@opentelemetry/semantic-conventions": "1.13.0" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/exporter-metrics-otlp-grpc": "0.44.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.44.0", + "@opentelemetry/exporter-metrics-otlp-proto": "0.44.0", + "@opentelemetry/exporter-trace-otlp-grpc": "0.44.0", + "@opentelemetry/exporter-trace-otlp-http": "0.44.0", + "@opentelemetry/exporter-trace-otlp-proto": "0.44.0", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-metrics": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/otlp-exporter-node" } diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index b109e6f0d0..26a4a58636 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -6,6 +6,116 @@ All notable changes to experimental packages in this project will be documented ### :boom: Breaking Change +### :rocket: (Enhancement) + +### :bug: (Bug Fix) + +### :books: (Refine Doc) + +### :house: (Internal) + +## 0.44.0 + +### :boom: Breaking Change + +* fix(exporter-logs-otlp-proto): change OTLPLogExporter to OTLPLogExporter [#4140](https://github.com/open-telemetry/opentelemetry-js/pull/4140) @Vunovati +* fix(sdk-node): remove explicit dependency on @opentelemetry/exporter-jaeger + * '@opentelemetry/exporter-jaeger' is no longer be a dependency of this package. To continue using '@opentelemetry/exporter-jaeger', please install it manually. + * NOTE: `@opentelemetry/exporter-jaeger` is deprecated, consider switching to one of the alternatives described [here](https://www.npmjs.com/package/@opentelemetry/exporter-jaeger) +* fix(sdk-logs): hide internal methods with internal shared state [#3865](https://github.com/open-telemetry/opentelemetry-js/pull/3865) @legendecas + +### :rocket: (Enhancement) + +* feat(exporter-metrics-otlp-proto): add esm build [#4099](https://github.com/open-telemetry/opentelemetry-js/pull/4099) @pichlermarc +* feat(opencensus-shim): implement OpenCensus metric producer [#4066](https://github.com/open-telemetry/opentelemetry-js/pull/4066) @aabmass + +### :bug: (Bug Fix) + +* fix(otlp-exporter-base): replaced usage of window with _globalThis [#4157](https://github.com/open-telemetry/opentelemetry-js/pull/4157) @cristianmadularu +* fix(otlp-transformer): Avoid precision loss when converting from HrTime to unix nanoseconds. [#4062](https://github.com/open-telemetry/opentelemetry-js/pull/4062) + +## 0.43.0 + +### :bug: (Bug Fix) + +* Revert "feat(api): add attributes argument to recordException API [#4071](https://github.com/open-telemetry/opentelemetry-js/pull/4071)" + * This feature was an unintentional breaking change introduced with API 1.5.0 + * This PR updates all experimental packages to allow API 1.6.0, where this change has been reverted. + +## 0.42.0 + +### :boom: Breaking Change + +* chore(sdk-node): deprecate methods in favor of constructor options [#3996](https://github.com/open-telemetry/opentelemetry-js/pull/3996) @pichlermarc + * The following methods are now deprecated and will be removed in `0.43.0` + * `NodeSDK.configureTracerProvider()`, please use constructor options instead + * `NodeSDK.configureMeterProvider()`, please use constructor options instead + * `NodeSDK.configureLoggerProvider()`, please use constructor options instead + * `NodeSDK.addResource()`, please use constructor options instead + * `NodeSDK.detectResources()`, this is not necessary anymore, resources are now auto-detected on startup. +* chore(sdk-node): add notice that '@opentelemetry/exporter-jaeger' has to be installed manually in the next version [#4068](https://github.com/open-telemetry/opentelemetry-js/pull/4068) @pichlermarc + * Starting with 0.43.0 '@opentelemetry/exporter-jaeger' will no longer be a dependency of this package. To continue using '@opentelemetry/exporter-jaeger', please install it manually. + * NOTE: `@opentelemetry/exporter-jaeger` is deprecated, consider switching to one of the alternatives described [here](https://www.npmjs.com/package/@opentelemetry/exporter-jaeger) + +### :rocket: (Enhancement) + +* feat: update PeriodicExportingMetricReader and PrometheusExporter to accept optional metric producers [#4077](https://github.com/open-telemetry/opentelemetry-js/pull/4077) @aabmass + +### :bug: (Bug Fix) + +* fix(exporter-logs-otlp-http): add @opentelemetry/api-logs as dependency + +## 0.41.2 + +### :bug: (Bug Fix) + +* fix(opentelemetry-exporter-logs-otlp-http): Add otel-api as dev dep for tests as they are directly importing the api and which is breaking the web-sandbox tests which is using rollup +* fix(instrumentation-grpc): instrument @grpc/grpc-js Client methods [#3804](https://github.com/open-telemetry/opentelemetry-js/pull/3804) @pichlermarc + +## 0.41.1 + +### :books: (Refine Doc) + +* docs(sdk-metrics): add example of exponential histogram metric [#3855](https://github.com/open-telemetry/opentelemetry-js/pull/3855) @JamieDanielson + +### :rocket: (Enhancement) + +* feat(sdk-node): logs support added [#3969](https://github.com/open-telemetry/opentelemetry-js/pull/3969) @psk001 + +### :bug: (Bug Fix) + +* Revert "feat(minification): Add noEmitHelpers, importHelpers and tslib as a dependency (#3914)" + [#4011](https://github.com/open-telemetry/opentelemetry-js/pull/4011) @dyladan + +## 0.41.0 + +### :boom: Breaking Change + +* chore(instrumentation-grpc): Drop support for package `grpc`. [#3807](https://github.com/open-telemetry/opentelemetry-js/pull/3807) @llc1123 + +### :rocket: (Enhancement) + +* feat(otlp-grpc-exporters): add support for UDS endpoints. [#3853](https://github.com/open-telemetry/opentelemetry-js/pull/3853) @llc1123 +* feat(otlp-exporters): bump otlp proto to 0.20.0 [#3932](https://github.com/open-telemetry/opentelemetry-js/pull/3932) @pichlermarc +* feat(exporter-metrics-otlp-*): add LowMemory metrics temporality preference [#3915](https://github.com/open-telemetry/opentelemetry-js/pull/3915) @martinkuba + * Adds support for [LowMemory temporality preference](https://github.com/open-telemetry/opentelemetry-specification/blob/f09624bb97e9be3be259733b93be507df18927bd/specification/metrics/sdk_exporters/otlp.md#additional-configuration) + * Adds support for `lowmemory` in `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` + +### :bug: (Bug Fix) + +* fix(exporter-logs-otlp-http): set useHex to true [#3875](https://github.com/open-telemetry/opentelemetry-js/pull/3875) @Nico385412 +* fix(otlp-proto-exporter-base): add missing type import [#3937](https://github.com/open-telemetry/opentelemetry-js/pull/3937) @pichlermarc +* fix(example-opencensus-shim): avoid OpenCensus auto instrumentations [#3951](https://github.com/open-telemetry/opentelemetry-js/pull/3951) @llc1123 +* fix(http-intrumentation): prevent request socket null from throwing uncaught error [#3858](https://github.com/open-telemetry/opentelemetry-js/pull/3858) @aodysseos + +### :house: (Internal) + +* chore(instrumentation-grpc): Cleanup remnants of grpc-native support. [#3886](https://github.com/open-telemetry/opentelemetry-js/pull/3886) @llc1123 + +## 0.40.0 + +### :boom: Breaking Change + * fix(exporter-logs-otlp-grpc): change OTLPLogsExporter to OTLPLogExporter [#3819](https://github.com/open-telemetry/opentelemetry-js/pull/3819) @fuaiyi * chore(instrumentation-grpc): add 'grpc' deprecation notice postinstall script [#3833](https://github.com/open-telemetry/opentelemetry-js/pull/3833) @pichlermarc * Support for telemetry generation for the [`grpc`](https://www.npmjs.com/package/grpc) module will be dropped in the next release as the package has been @@ -27,10 +137,6 @@ All notable changes to experimental packages in this project will be documented * fix(sdk-node): use resource interface instead of concrete class [#3803](https://github.com/open-telemetry/opentelemetry-js/pull/3803) @blumamir * fix(sdk-logs): remove includeTraceContext configuration and use LogRecord context when available [#3817](https://github.com/open-telemetry/opentelemetry-js/pull/3817) @hectorhdzg -### :books: (Refine Doc) - -### :house: (Internal) - ## 0.39.1 ### :bug: (Bug Fix) diff --git a/experimental/backwards-compatability/node14/index.ts b/experimental/backwards-compatibility/node14/index.ts similarity index 100% rename from experimental/backwards-compatability/node14/index.ts rename to experimental/backwards-compatibility/node14/index.ts diff --git a/experimental/backwards-compatability/node14/package.json b/experimental/backwards-compatibility/node14/package.json similarity index 74% rename from experimental/backwards-compatability/node14/package.json rename to experimental/backwards-compatibility/node14/package.json index fb30bd3215..41ac4219ee 100644 --- a/experimental/backwards-compatability/node14/package.json +++ b/experimental/backwards-compatibility/node14/package.json @@ -1,16 +1,16 @@ { "name": "backcompat-node14", - "version": "0.39.1", + "version": "0.44.0", "private": true, - "description": "Backwards compatability app for node 14 types and the OpenTelemetry Node.js SDK", + "description": "Backwards compatibility app for node 14 types and the OpenTelemetry Node.js SDK", "main": "index.js", "scripts": { "test:backcompat": "tsc --noEmit index.ts && tsc --noEmit --esModuleInterop index.ts", "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "dependencies": { - "@opentelemetry/sdk-node": "0.39.1", - "@opentelemetry/sdk-trace-base": "1.13.0" + "@opentelemetry/sdk-node": "0.44.0", + "@opentelemetry/sdk-trace-base": "1.17.1" }, "devDependencies": { "@types/node": "14.18.25", diff --git a/experimental/backwards-compatability/node14/tsconfig.json b/experimental/backwards-compatibility/node14/tsconfig.json similarity index 100% rename from experimental/backwards-compatability/node14/tsconfig.json rename to experimental/backwards-compatibility/node14/tsconfig.json diff --git a/experimental/backwards-compatability/node16/index.ts b/experimental/backwards-compatibility/node16/index.ts similarity index 100% rename from experimental/backwards-compatability/node16/index.ts rename to experimental/backwards-compatibility/node16/index.ts diff --git a/experimental/backwards-compatability/node16/package.json b/experimental/backwards-compatibility/node16/package.json similarity index 74% rename from experimental/backwards-compatability/node16/package.json rename to experimental/backwards-compatibility/node16/package.json index bf74118063..a489071678 100644 --- a/experimental/backwards-compatability/node16/package.json +++ b/experimental/backwards-compatibility/node16/package.json @@ -1,16 +1,16 @@ { "name": "backcompat-node16", - "version": "0.39.1", + "version": "0.44.0", "private": true, - "description": "Backwards compatability app for node 16 types and the OpenTelemetry Node.js SDK", + "description": "Backwards compatibility app for node 16 types and the OpenTelemetry Node.js SDK", "main": "index.js", "scripts": { "test:backcompat": "tsc --noEmit index.ts && tsc --noEmit --esModuleInterop index.ts", "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "dependencies": { - "@opentelemetry/sdk-node": "0.39.1", - "@opentelemetry/sdk-trace-base": "1.13.0" + "@opentelemetry/sdk-node": "0.44.0", + "@opentelemetry/sdk-trace-base": "1.17.1" }, "devDependencies": { "@types/node": "16.11.52", diff --git a/experimental/backwards-compatability/node16/tsconfig.json b/experimental/backwards-compatibility/node16/tsconfig.json similarity index 100% rename from experimental/backwards-compatability/node16/tsconfig.json rename to experimental/backwards-compatibility/node16/tsconfig.json diff --git a/experimental/examples/.eslintrc.js b/experimental/examples/.eslintrc.js index 7927fa0c36..3f58849df9 100644 --- a/experimental/examples/.eslintrc.js +++ b/experimental/examples/.eslintrc.js @@ -3,5 +3,5 @@ module.exports = { "mocha": true, "node": true }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/experimental/examples/logs/package.json b/experimental/examples/logs/package.json index 3e10700d19..b39d19b959 100644 --- a/experimental/examples/logs/package.json +++ b/experimental/examples/logs/package.json @@ -1,14 +1,14 @@ { "name": "logs-example", - "version": "0.2.0", + "version": "0.44.0", "private": true, "scripts": { "start": "ts-node index.ts" }, "dependencies": { - "@opentelemetry/api": "^1.4.1", - "@opentelemetry/api-logs": "0.39.1", - "@opentelemetry/sdk-logs": "0.39.1" + "@opentelemetry/api": "^1.6.0", + "@opentelemetry/api-logs": "0.41.0", + "@opentelemetry/sdk-logs": "0.41.0" }, "devDependencies": { "@types/node": "18.6.5", diff --git a/experimental/examples/opencensus-shim/README.md b/experimental/examples/opencensus-shim/README.md new file mode 100644 index 0000000000..6d95a91356 --- /dev/null +++ b/experimental/examples/opencensus-shim/README.md @@ -0,0 +1,85 @@ +# Overview + +The OpenCensus shim allows existing OpenCensus instrumentation to interoperate with OpenTelemetry instrumentation by using the OpenTelemetry SDK as an implementation for OpenCensus. + +This is a simple example that demonstrates how existing OpenCensus instrumentation can be integrated with OpenTelemetry. + +The example has: + +- Root Spans (on client), instrumented with OpenCensus's HTTP instrumentation +- Child Span from a remote parent (on server), instrumented with OpenCensus's HTTP instrumentation +- Another Child Span created in the server representing some work being done, instrumented manually with OpenTelemetry. +- Server metrics coming from OpenCensus's HTTP instrumentation, available through the +OpenTelemetry's Prometheus exporter. + +## Installation + +```sh +# from this directory +$ npm install +``` + +## Run the Application + +### Jaeger + +Setup [Jaeger Tracing All in One](https://www.jaegertracing.io/docs/latest/getting-started/#all-in-one) agent. If you have docker installed: + +```sh +docker run \ + --rm \ + --name jaeger \ + -e COLLECTOR_OTLP_ENABLED=true \ + -p 16686:16686 \ + -p 4317:4317 \ + jaegertracing/all-in-one:latest +``` + +### Run the sample server + +```sh +# from this directory +$ node -r @opentelemetry/shim-opencensus/register ./server.js +``` + +The `-r @opentelemetry/shim-opencensus/register` flag to Node tells it to load the OpenCensus +shim's register module to install the OpenCensus shim. The shim bridges all calls to +OpenCensus's tracers to OpenTelemetry. + +### Run the sample client + +```sh +# from this directory +node -r @opentelemetry/shim-opencensus/register ./client.js +``` + +Again, we use the `-r @opentelemetry/shim-opencensus/register` flag to install the OpenCensus shim. + +## Check the trace + +Go to Jaeger with your browser and click on the "Service" dropdown. Choose `opencensus-shim-example-server` and hit "Find Traces". Click on one of the available traces and you should see 3 spans: + +- An outer span from the client. This came from the OpenCensus HTTP instrumentation. + - A child from the server. This came from the OpenCensus HTTP instrumentation. + - A child for the sleep operation. This was manually instrumented with OpenTelemetry. + Notice this span is correctly recorded as a child of the OpenCensus instrumentation. + +

    + +## Check the Prometheus metrics + +Load the Prometheus metrics endpoint of the server at in your +browser. You should see the `opencensus_io_http_server_*` related metrics in +the output. + +

    + +## Useful links + +- For more information on OpenTelemetry, visit: +- For more information on OpenTelemetry for Node.js, visit: +- For more information on OpenCensus, visit: + +## LICENSE + +Apache License 2.0 diff --git a/experimental/examples/opencensus-shim/client.js b/experimental/examples/opencensus-shim/client.js new file mode 100644 index 0000000000..e0a2ed52fa --- /dev/null +++ b/experimental/examples/opencensus-shim/client.js @@ -0,0 +1,54 @@ +/* + * 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. + */ +'use strict'; + +const setup = require('./setup'); + +const provider = setup('opencensus-shim-example-client'); + +const http = require('http'); + +makeRequest(); + +async function makeRequest() { + const data = await new Promise((resolve, reject) => { + http + .get( + { + host: 'localhost', + port: 3000, + path: '/', + }, + resp => { + let data = ''; + + resp.on('data', chunk => { + data += chunk; + }); + + resp.on('end', async () => { + resolve(JSON.parse(data)); + }); + } + ) + .on('error', err => { + reject(err); + }); + }); + console.log('Got data from server: ', data); + + await provider.shutdown(); +} diff --git a/experimental/examples/opencensus-shim/images/jaeger-trace.png b/experimental/examples/opencensus-shim/images/jaeger-trace.png new file mode 100644 index 0000000000..15521f64cd Binary files /dev/null and b/experimental/examples/opencensus-shim/images/jaeger-trace.png differ diff --git a/experimental/examples/opencensus-shim/images/prom-metrics.png b/experimental/examples/opencensus-shim/images/prom-metrics.png new file mode 100644 index 0000000000..953e12253d Binary files /dev/null and b/experimental/examples/opencensus-shim/images/prom-metrics.png differ diff --git a/experimental/examples/opencensus-shim/package.json b/experimental/examples/opencensus-shim/package.json new file mode 100644 index 0000000000..1890708445 --- /dev/null +++ b/experimental/examples/opencensus-shim/package.json @@ -0,0 +1,43 @@ +{ + "name": "opencensus-shim", + "private": true, + "version": "0.44.0", + "description": "Example of using @opentelemetry/shim-opencensus in Node.js", + "main": "index.js", + "scripts": { + "client": "node -r @opentelemetry/shim-opencensus/register ./client.js", + "server": "node -r @opentelemetry/shim-opencensus/register ./server.js" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/open-telemetry/opentelemetry-js.git" + }, + "keywords": [ + "opentelemetry", + "http", + "tracing", + "opencensus" + ], + "engines": { + "node": ">=14" + }, + "author": "OpenTelemetry Authors", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/open-telemetry/opentelemetry-js/issues" + }, + "dependencies": { + "@opencensus/core": "0.1.0", + "@opencensus/instrumentation-http": "0.1.0", + "@opencensus/nodejs-base": "0.1.0", + "@opentelemetry/api": "1.6.0", + "@opentelemetry/exporter-prometheus": "0.44.0", + "@opentelemetry/exporter-trace-otlp-grpc": "0.44.0", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-metrics": "1.17.1", + "@opentelemetry/sdk-trace-node": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1", + "@opentelemetry/shim-opencensus": "0.44.0" + }, + "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/examples/opencensus-shim" +} diff --git a/experimental/examples/opencensus-shim/server.js b/experimental/examples/opencensus-shim/server.js new file mode 100644 index 0000000000..00893bafe9 --- /dev/null +++ b/experimental/examples/opencensus-shim/server.js @@ -0,0 +1,41 @@ +'use strict'; + +const { SpanStatusCode } = require('@opentelemetry/api'); +const setup = require('./setup'); +const utils = require('./utils'); +const { trace } = require('@opentelemetry/api'); + +const oc = require('@opencensus/core'); + +setup('opencensus-shim-example-server'); +const http = require('http'); + +const otelTracer = trace.getTracer('opencensus-shim-example'); + +function startServer(port) { + // requests are traced by OpenCensus http instrumentation + const server = http.createServer(async (req, res) => { + // you can mix OTel and OC instrumentation + + // deliberately sleeping to mock some action + await otelTracer.startActiveSpan('sleep', async span => { + await utils.sleep(1000); + span.end(); + }); + + trace.getActiveSpan()?.addEvent('write headers'); + res.writeHead(200, { 'Content-Type': 'application/json' }); + trace.getActiveSpan()?.addEvent('write json response'); + res.write(JSON.stringify({ status: 'OK', message: 'Hello World!' })); + trace.getActiveSpan()?.setStatus(SpanStatusCode.OK); + res.end(); + }); + + server.listen(port, err => { + if (err) throw err; + + console.log(`Server is listening on ${port}`); + }); +} + +startServer(3000); diff --git a/experimental/examples/opencensus-shim/setup.js b/experimental/examples/opencensus-shim/setup.js new file mode 100644 index 0000000000..99bf8bf8b4 --- /dev/null +++ b/experimental/examples/opencensus-shim/setup.js @@ -0,0 +1,78 @@ +/* + * 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. + */ +'use strict'; + +const { diag, metrics } = require('@opentelemetry/api'); +const { + NodeTracerProvider, + BatchSpanProcessor, +} = require('@opentelemetry/sdk-trace-node'); +const { MeterProvider } = require('@opentelemetry/sdk-metrics'); +const { + OTLPTraceExporter, +} = require('@opentelemetry/exporter-trace-otlp-grpc'); +const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus'); +const { Resource } = require('@opentelemetry/resources'); +const { + SemanticResourceAttributes, +} = require('@opentelemetry/semantic-conventions'); +const { OpenCensusMetricProducer } = require('@opentelemetry/shim-opencensus'); +const instrumentationHttp = require('@opencensus/instrumentation-http'); +const { TracingBase } = require('@opencensus/nodejs-base'); +const oc = require('@opencensus/core'); + +module.exports = function setup(serviceName) { + /** + * You can alternatively just use the @opentelemetry/nodejs package directly: + * + * ```js + * const tracing = require('@opencensus/nodejs'); + * ``` + */ + const tracing = new TracingBase(['http']); + tracing.tracer = new oc.CoreTracer(); + + const resource = new Resource({ + [SemanticResourceAttributes.SERVICE_NAME]: serviceName, + }); + const tracerProvider = new NodeTracerProvider({ resource }); + tracerProvider.addSpanProcessor( + new BatchSpanProcessor(new OTLPTraceExporter(), { + scheduledDelayMillis: 5000, + }) + ); + tracerProvider.register(); + + const meterProvider = new MeterProvider({ resource }); + meterProvider.addMetricReader( + new PrometheusExporter({ + metricProducers: [ + new OpenCensusMetricProducer({ + openCensusMetricProducerManager: + oc.Metrics.getMetricProducerManager(), + }), + ], + }) + ); + metrics.setGlobalMeterProvider(meterProvider); + + // Start OpenCensus tracing + tracing.start({ samplingRate: 1, logger: diag, stats: oc.globalStats }); + // Register OpenCensus HTTP stats views + instrumentationHttp.registerAllViews(oc.globalStats); + + return tracerProvider; +}; diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/test/grpc.test.ts b/experimental/examples/opencensus-shim/utils.js similarity index 65% rename from experimental/packages/opentelemetry-instrumentation-grpc/test/grpc.test.ts rename to experimental/examples/opencensus-shim/utils.js index 453c6d6ef9..3b1c625009 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/test/grpc.test.ts +++ b/experimental/examples/opencensus-shim/utils.js @@ -13,16 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +'use strict'; -import { runTests } from './helper'; -import { GrpcInstrumentation } from '../src/instrumentation'; +async function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} -const instrumentation = new GrpcInstrumentation(); -instrumentation.enable(); -instrumentation.disable(); - -import * as grpc from 'grpc'; - -describe('#grpc', () => { - runTests(instrumentation, 'grpc', grpc, 12345); -}); +exports.sleep = sleep; diff --git a/experimental/examples/prometheus/package.json b/experimental/examples/prometheus/package.json index d1c5cb9ce6..7c7f8f5713 100644 --- a/experimental/examples/prometheus/package.json +++ b/experimental/examples/prometheus/package.json @@ -1,6 +1,6 @@ { "name": "prometheus-example", - "version": "0.39.1", + "version": "0.44.0", "private": true, "description": "Example of using @opentelemetry/sdk-metrics and @opentelemetry/exporter-prometheus", "main": "index.js", @@ -11,7 +11,7 @@ "license": "Apache-2.0", "dependencies": { "@opentelemetry/api": "^1.3.0", - "@opentelemetry/exporter-prometheus": "0.39.1", - "@opentelemetry/sdk-metrics": "1.13.0" + "@opentelemetry/exporter-prometheus": "0.44.0", + "@opentelemetry/sdk-metrics": "1.17.1" } } diff --git a/experimental/packages/api-events/.eslintrc.js b/experimental/packages/api-events/.eslintrc.js index 7654abb6ac..5cb19b0298 100644 --- a/experimental/packages/api-events/.eslintrc.js +++ b/experimental/packages/api-events/.eslintrc.js @@ -4,5 +4,5 @@ module.exports = { "commonjs": true, "shared-node-browser": true }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/api-events/package.json b/experimental/packages/api-events/package.json index bc1a24a54b..fc3537d6d3 100644 --- a/experimental/packages/api-events/package.json +++ b/experimental/packages/api-events/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/api-events", - "version": "0.39.1", + "version": "0.44.0", "description": "Public events API for OpenTelemetry", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -18,7 +18,7 @@ "compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "build": "npm run compile", @@ -26,7 +26,7 @@ "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "node ../../../scripts/version-update.js" }, "keywords": [ @@ -64,18 +64,20 @@ "@opentelemetry/api": "^1.0.0" }, "devDependencies": { - "@types/mocha": "10.0.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", "@types/webpack-env": "1.16.3", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", diff --git a/experimental/packages/api-logs/.eslintrc.js b/experimental/packages/api-logs/.eslintrc.js index 7654abb6ac..5cb19b0298 100644 --- a/experimental/packages/api-logs/.eslintrc.js +++ b/experimental/packages/api-logs/.eslintrc.js @@ -4,5 +4,5 @@ module.exports = { "commonjs": true, "shared-node-browser": true }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/api-logs/README.md b/experimental/packages/api-logs/README.md index b36d5bf06e..a4e3459f01 100644 --- a/experimental/packages/api-logs/README.md +++ b/experimental/packages/api-logs/README.md @@ -1,13 +1,19 @@ -# OpenTelemetry API for JavaScript +# OpenTelemetry Logs Bridge API for JavaScript [![NPM Published Version][npm-img]][npm-url] [![Apache License][license-image]][license-image] -This package provides everything needed to interact with the unstable OpenTelemetry Logs API, including all TypeScript interfaces, enums, and no-op implementations. It is intended for use both on the server and in the browser. +**Note: This is an experimental package under active development. New releases may include breaking changes.** -## Beta Software - Use at your own risk +This package provides everything needed to interact with the unstable OpenTelemetry Logs Bridge API, including all TypeScript interfaces, enums, and no-op implementations. It is intended for use both on the server and in the browser. -The logs API is considered alpha software and there is no guarantee of stability or long-term support. When the API is stabilized, it will be made available and supported long-term in the `@opentelemetry/api` package and this package will be deprecated. +**Note: This module defines a log backend API. The API is not intended to be called by application developers directly. +It is provided for logging library authors to build log appenders, which use this API to bridge between existing +logging libraries and the OpenTelemetry log data model.** + +## Alpha Software - Use at your own risk + +The Logs Bridge API is considered alpha software and there is no guarantee of stability or long-term support. When the API is stabilized, it will be made available and supported long-term in the `@opentelemetry/api` package and this package will be deprecated. ## Quick Start diff --git a/experimental/packages/api-logs/package.json b/experimental/packages/api-logs/package.json index 9143ef36d0..84605e3306 100644 --- a/experimental/packages/api-logs/package.json +++ b/experimental/packages/api-logs/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/api-logs", - "version": "0.39.1", + "version": "0.44.0", "description": "Public logs API for OpenTelemetry", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -18,7 +18,7 @@ "compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "build": "npm run compile", @@ -26,7 +26,7 @@ "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "node ../../../scripts/version-update.js" }, "keywords": [ @@ -64,18 +64,20 @@ "@opentelemetry/api": "^1.0.0" }, "devDependencies": { - "@types/mocha": "10.0.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", "@types/webpack-env": "1.16.3", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", diff --git a/experimental/packages/exporter-logs-otlp-grpc/.eslintrc.js b/experimental/packages/exporter-logs-otlp-grpc/.eslintrc.js index 3ed0fbeba3..9cfb3fd423 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/.eslintrc.js +++ b/experimental/packages/exporter-logs-otlp-grpc/.eslintrc.js @@ -4,5 +4,5 @@ module.exports = { "commonjs": true, "node": true, }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/exporter-logs-otlp-grpc/README.md b/experimental/packages/exporter-logs-otlp-grpc/README.md index 17c9573398..b2ba24bf9a 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/README.md +++ b/experimental/packages/exporter-logs-otlp-grpc/README.md @@ -5,7 +5,7 @@ **Note: This is an experimental package under active development. New releases may include breaking changes.** -This module provides an exporter for OTLP gRPC logs using protocol version `v0.18`. +This module provides a logs-exporter for OTLP (gRPC) using protocol version `v0.20.0`. ## Installation @@ -34,6 +34,7 @@ import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-grpc'; const collectorOptions = { // url is optional and can be omitted - default is http://localhost:4317 + // Unix domain sockets are also supported: 'unix:///path/to/socket.sock' url: 'http://:', }; diff --git a/experimental/packages/exporter-logs-otlp-grpc/package.json b/experimental/packages/exporter-logs-otlp-grpc/package.json index 99cb19287e..6be018babb 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/package.json +++ b/experimental/packages/exporter-logs-otlp-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-logs-otlp-grpc", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenTelemetry Collector Exporter allows user to send collected log records to the OpenTelemetry Collector", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -15,7 +15,7 @@ "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "version": "node ../../../scripts/version-update.js", "watch": "tsc --watch --build", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" @@ -48,20 +48,22 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", - "@grpc/proto-loader": "^0.7.3", - "@opentelemetry/api": "1.4.1", - "@opentelemetry/api-logs": "0.39.1", - "@opentelemetry/otlp-exporter-base": "0.39.1", - "@opentelemetry/resources": "1.13.0", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@grpc/proto-loader": "^0.7.10", + "@opentelemetry/api": "1.6.0", + "@opentelemetry/api-logs": "0.44.0", + "@opentelemetry/otlp-exporter-base": "0.44.0", + "@opentelemetry/resources": "1.17.1", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "codecov": "3.8.3", "cpx": "1.5.0", - "mocha": "10.0.0", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4" @@ -71,10 +73,10 @@ }, "dependencies": { "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.13.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.39.1", - "@opentelemetry/otlp-transformer": "0.39.1", - "@opentelemetry/sdk-logs": "0.39.1" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/otlp-grpc-exporter-base": "0.44.0", + "@opentelemetry/otlp-transformer": "0.44.0", + "@opentelemetry/sdk-logs": "0.44.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-logs-otlp-grpc", "sideEffects": false diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts b/experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts index 48f1fa865e..9bda910924 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts +++ b/experimental/packages/exporter-logs-otlp-grpc/test/OTLPLogExporter.test.ts @@ -44,9 +44,11 @@ const includeDirs = [ path.resolve(__dirname, '../../otlp-grpc-exporter-base/protos'), ]; -const address = 'localhost:1503'; +const httpAddr = 'https://localhost:1503'; +const udsAddr = 'unix:///tmp/otlp-logs.sock'; type TestParams = { + address?: string; useTLS?: boolean; metadata?: grpc.Metadata; }; @@ -54,10 +56,11 @@ type TestParams = { const metadata = new grpc.Metadata(); metadata.set('k', 'v'); -const testCollectorExporter = (params: TestParams) => - describe(`OTLPLogExporter - node ${params.useTLS ? 'with' : 'without'} TLS, ${ - params.metadata ? 'with' : 'without' - } metadata`, () => { +const testCollectorExporter = (params: TestParams) => { + const { address = httpAddr, useTLS, metadata } = params; + return describe(`OTLPLogExporter - node ${useTLS ? 'with' : 'without'} TLS, ${ + metadata ? 'with' : 'without' + } metadata, target ${address}`, () => { let collectorExporter: OTLPLogExporter; let server: grpc.Server; let exportedData: IResourceLogs | undefined; @@ -92,7 +95,7 @@ const testCollectorExporter = (params: TestParams) => }, } ); - const credentials = params.useTLS + const credentials = useTLS ? grpc.ServerCredentials.createSsl( fs.readFileSync('./test/certs/ca.crt'), [ @@ -103,10 +106,15 @@ const testCollectorExporter = (params: TestParams) => ] ) : grpc.ServerCredentials.createInsecure(); - server.bindAsync(address, credentials, () => { - server.start(); - done(); - }); + const serverAddr = new URL(address); + server.bindAsync( + serverAddr.protocol === 'https:' ? serverAddr.host : address, + credentials, + () => { + server.start(); + done(); + } + ); }); }); @@ -115,7 +123,7 @@ const testCollectorExporter = (params: TestParams) => }); beforeEach(done => { - const credentials = params.useTLS + const credentials = useTLS ? grpc.credentials.createSsl( fs.readFileSync('./test/certs/ca.crt'), fs.readFileSync('./test/certs/client.key'), @@ -123,9 +131,9 @@ const testCollectorExporter = (params: TestParams) => ) : grpc.credentials.createInsecure(); collectorExporter = new OTLPLogExporter({ - url: 'https://' + address, + url: address, credentials, - metadata: params.metadata, + metadata: metadata, }); done(); }); @@ -141,7 +149,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 OTLPLogExporter({ - url: `http://${address}`, + url: address, headers: { foo: 'bar', }, @@ -150,9 +158,13 @@ const testCollectorExporter = (params: TestParams) => assert.strictEqual(args[0], 'Headers cannot be set when using grpc'); }); it('should warn about path in url', () => { + if (new URL(address).protocol === 'unix:') { + // Skip this test for UDS + return; + } const spyLoggerWarn = sinon.stub(diag, 'warn'); collectorExporter = new OTLPLogExporter({ - url: `http://${address}/v1/logs`, + url: `${address}/v1/logs`, }); const args = spyLoggerWarn.args[0]; assert.strictEqual( @@ -190,7 +202,7 @@ const testCollectorExporter = (params: TestParams) => }, 500); }); it('should log deadline exceeded error', done => { - const credentials = params.useTLS + const credentials = useTLS ? grpc.credentials.createSsl( fs.readFileSync('./test/certs/ca.crt'), fs.readFileSync('./test/certs/client.key'), @@ -199,9 +211,9 @@ const testCollectorExporter = (params: TestParams) => : grpc.credentials.createInsecure(); const collectorExporterWithTimeout = new OTLPLogExporter({ - url: 'grpcs://' + address, + url: address, credentials, - metadata: params.metadata, + metadata: metadata, timeoutMillis: 100, }); @@ -222,7 +234,7 @@ const testCollectorExporter = (params: TestParams) => }); describe('export - with gzip compression', () => { beforeEach(() => { - const credentials = params.useTLS + const credentials = useTLS ? grpc.credentials.createSsl( fs.readFileSync('./test/certs/ca.crt'), fs.readFileSync('./test/certs/client.key'), @@ -230,13 +242,13 @@ const testCollectorExporter = (params: TestParams) => ) : grpc.credentials.createInsecure(); collectorExporter = new OTLPLogExporter({ - url: 'https://' + address, + url: address, credentials, - metadata: params.metadata, + metadata: metadata, compression: CompressionAlgorithm.GZIP, }); }); - it('should successfully send the spans', done => { + it('should successfully send the log records', done => { const responseSpy = sinon.spy(); const logRecords = [Object.assign({}, mockedReadableLogRecord)]; collectorExporter.export(logRecords, responseSpy); @@ -248,13 +260,13 @@ const testCollectorExporter = (params: TestParams) => const logs = exportedData.scopeLogs[0].logRecords; const resource = exportedData.resource; - assert.ok(typeof logs !== 'undefined', 'spans do not exist'); + assert.ok(typeof logs !== 'undefined', 'log records do not exist'); ensureExportedLogRecordIsCorrect(logs[0]); assert.ok(typeof resource !== 'undefined', "resource doesn't exist"); ensureResourceIsCorrect(resource); - ensureMetadataIsCorrect(reqMetadata, params.metadata); + ensureMetadataIsCorrect(reqMetadata, metadata); done(); }, 500); @@ -263,7 +275,7 @@ const testCollectorExporter = (params: TestParams) => describe('Logs Exporter with compression', () => { const envSource = process.env; it('should return gzip compression algorithm on exporter', () => { - const credentials = params.useTLS + const credentials = useTLS ? grpc.credentials.createSsl( fs.readFileSync('./test/certs/ca.crt'), fs.readFileSync('./test/certs/client.key'), @@ -273,9 +285,9 @@ const testCollectorExporter = (params: TestParams) => envSource.OTEL_EXPORTER_OTLP_COMPRESSION = 'gzip'; collectorExporter = new OTLPLogExporter({ - url: 'https://' + address, + url: address, credentials, - metadata: params.metadata, + metadata: metadata, }); assert.strictEqual( collectorExporter.compression, @@ -285,6 +297,7 @@ const testCollectorExporter = (params: TestParams) => }); }); }); +}; describe('OTLPLogExporter - node (getDefaultUrl)', () => { it('should default to localhost', done => { @@ -344,3 +357,5 @@ describe('when configuring via environment', () => { testCollectorExporter({ useTLS: true }); testCollectorExporter({ useTLS: false }); testCollectorExporter({ metadata }); +// skip UDS tests on windows +process.platform !== 'win32' && testCollectorExporter({ address: udsAddr }); diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/ca.crt b/experimental/packages/exporter-logs-otlp-grpc/test/certs/ca.crt index 27e1d6826b..c194f04954 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/ca.crt +++ b/experimental/packages/exporter-logs-otlp-grpc/test/certs/ca.crt @@ -1,33 +1,33 @@ -----BEGIN CERTIFICATE----- -MIIFozCCA4ugAwIBAgIUC57UkrmvltHwm0jdwHjbFx/wIcMwDQYJKoZIhvcNAQEL +MIIFozCCA4ugAwIBAg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EZsbES6a54+7sc1QKOVSWwPuGEd +ShFHhTzoaB0dpwm6kLdYsEkC8JLIjV+Ikg5X3VTDITjUlHoJf2mxCGOzBiCnUr75 +Am0eBqlVcc/2aVk1tcVS9N7reY/KcMaAJvI314O9I94pYdIIm5jw3UmA9Y6HmpN0 +vYtQUF2sS5W82XoFD8bpOq/bx1o2ib2x32dfPQkVgd4sbmpsyN62Fy1HpHwXtXno +xGVaDzGSWj/7RyYyKhNmp3nfQsU0Tt6iVkM+N30vl2heZqEUgXxCG9qHVzWv9z6x +AJzuafjM8tviROpiHkvzsmq7uDhksGooKCi+m+eoEBJrd0J4gjngAi1NYjTsB2GT +4mvPz05UkA== -----END CERTIFICATE----- diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/ca.key b/experimental/packages/exporter-logs-otlp-grpc/test/certs/ca.key index 3ca1e8e149..00ccb04622 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/ca.key +++ b/experimental/packages/exporter-logs-otlp-grpc/test/certs/ca.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKQIBAAKCAgEA27scEIN1LkRK0BA/tbgrXvFwTMZYH3D6bz+lmkwhAxUnQC+/ -GQYLWun+5jNwUqPKYKo6oVGNNXNrmzeW2ToMQkpvCSzMAiJRMDbr8AgrHL2JYKpu -pLfi61IgDxJ9QMnH41v08dbb8Fn0Oouw2rFR6r/c07n3Pf+4xC3eszuKM7wRO5aR -eaN7mv1aK4xchqlUFLMporAi5fyKRmddYcWU/0d6PtQw0CWrHnD9ZU7/XxQiolG3 -Abv64Q3W6634nDV+qzBy0T7r3KDX9OCsX0D2TH17zVkpH0skTcr8FnDnPeNFU3F/ -KFZUI9LwbfOeaKO5OhpLsakvpLc3Gnu9jGM/HcXorkPMXa1jPWrPqLLG+Gbcn9Mv -Po7Mmo/uoiDQOLUcFz893MZVJvflXE9gXBaOsAZYvcTOZbPoCtAMJB0rq1IqUvYu -k3QgfE4JIiZANkwH1im9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poC+hdg1kJ3KblULzZJ6A+LaOoeyAtKcdpf7ZiRfeM5smIOTSGmUMUEe +Duqno/XZ7xVAElJ95k3a1z+BJvMvy80aoCKgROskDdcnOUQbohx2+O5W85aWNX59 +a7e9ab8H9TkVAy2EoCu4K0KBGhaUvxMLXQKCAQAORESNb5Ne+bBHbrSA6nVMH0Ti +Gt9Nx2bgNLxgGPGHLIFkQPnR9akk8mm94T/Ow1y8Jrx/rE0bxR0ayVYbxLiF+Zqz +i/G+CYGg72j+PXdugo4ocfGf17BpqR577uqUAycvtsk50zTgxYyoob5HxdXcFjnH +PEiJBGSSSY1VJJlPxIftHLE6ULfwslyMkHPGBxh6NJe/nkM7obuQYMc7JGpNngLb +G5NF6b8nV5yJ7a5hhhSbArFWuzlfbRsZwgqadWFDChXiAyCbzE5ey5gUOs22K4Ax +M4Ky5evO6Srk3gtFGCWPqSxcDJk57DSy/on35IwerlQTI6Btz0OT6EmDWXOn -----END RSA PRIVATE KEY----- diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.crt b/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.crt index cb5c4508d7..fd05c9c40b 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.crt +++ b/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.crt @@ -1,31 +1,31 @@ -----BEGIN CERTIFICATE----- MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjIwNjA4MDk1NDAxWhcN -MjMwNjA4MDk1NDAxWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjMwNjA4MTY0NDI2WhcN +MjQwNjA3MTY0NDI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htxoHLz1LJWoZ1uegmKrGF1w16K05k5mpzwH6fzqDzzbF1xyynGX +yfbIqsvsBniuWGmhMjlfT5+l0VG2GgsD7Yijv6SV0YZrVf85iA5q6XdKTBuKYmin +ZEbneEjw9kc9myMeC5ik7wHuksA/BQcja1TPwB4ZRbPEcfi2iFxbtsSzAgMBAAEw +DQYJKoZIhvcNAQELBQADggIBAGdcqEI2l/dKxu9vPuRC2/VRgjgDBN4UJJCY111T +2A7GsGzd7lRhtxB5ZzClF77UiRJG+cvFai00c9+L3wp8qy4sZWY4MaJIWoKRh72Q +sRiH8AskeIl3uvvvaH86bbmpDo7M48Cs/zXZo9VhLzD8ZuHcS1mdjkOcnQzkbSzR +YeM9ActeuJRmsdQ+gSzCTvFqmGutL6xvM8b9a6PwyY5nPxS+eh0/7KNp+EXBvp0U +MWp6mMfq22nAwAQRLbvh5f+a/4GSwg73By6hwnsgb7tpBBJ6ppnKAIALRf7l5JwS +V0LM5Vnpp4J4JjdYyQzk2xkxi+UGIP1IRigbeWc4K3qgg6BUUkfSf4W9oJD4JCa2 +cOsqnKqFxTwXT4b9j9qsPpg7mUQ2+UtU4Lv3h/7sXpbpx0ldb2Hnaq+JqUz0l/7c +54y3+nzke7I4CWKtLJUSamQiyOC3CBVkRX0YEYUBhMXim6dKAfiOEV6K3bwiU+YZ +aDe0lEeLbzAp87DKRTAvDYhRMIFtD3g2qmYrWpQ4gj8vSEorNAfg3kVHMFRGlk9o +jaFduAz0hKk+QG5SgePXMph5ZRXGRq0FnDbF2gZ7WV+jZiIhsYGJ43+RBWHh4HO4 +P4h9eOWQG8AxpDRmOo2KmyPbV0V/eltC4N0oOAmWz+i0qqulnpG4dOzQKpinRBBr +jPt5 -----END CERTIFICATE----- diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.csr b/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.csr index 30ac376794..b783896725 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.csr +++ b/experimental/packages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1EmYw6cxBg2lbhRlTwPYUf3ijQX6 +Oufa7+OaWIbcaBy89SyVqGdbnoJiqxhdcNeitOZOZqc8B+n86g882xdccspxl8n2 +yKrL7AZ4rlhpoTI5X0+fpdFRthoLA+2Io7+kldGGa1X/OYgOaul3SkwbimJop2RG +53hI8PZHPZsjHguYpO8B7pLAPwUHI2tUz8AeGUWzxHH4tohcW7bEswIDAQABoAAw +DQYJKoZIhvcNAQELBQADggIBACboOarzimaArw3lDm6ET5yiU7NxTWtnWwFUOoSh +qS2cvumnCokUlrDyMSSKoHl2i2biUd9uiHuEqlh0yufNgnTsyAXLg0UiBHAv5Tos +Esc5A+JTV5ehy+Zrjpl3Ayh8difS8hJEBjMhH+7rCN3rhpvwkTSaXDCQTBzWPhQ1 +R0EIho/SNOh5mXQKAUWwhtleI0sEJC/PqezGfN+w+URHnzE7YMwg02bvoMxBEror +YVddG4o0nIyd6CPg++K7TBzYGGOf1CUCrI9S1bBn3jcv2mq5YgZMdLEa0HkA9XzU +J/dTSGz5pJbkoaX9IHv8a3uoc+V1jdNWZRmTUYG/cNoAFISoG+uuJLgesF5l+vxx +GUwkE6wj4bNYR/Pqy5963oDmA3ndBzR1wtCZqIsLX3t3A9fLLtIEgeN/XDSvNDBs +YdwBrx2HTatK7QCJ5e+4ACs6Wc2c1nnDviPddpxUgl0pHKcMbT+xNk7bY5fjl5Qr +wzuBNgvQcsZxNNvI8bs13k/eBmKrKOV2WUP1mHRzSoxPX3gzGRSWCe/7QR51oWlB +Qkb6OGVGLCKPnhIKFeZ6G1Qv8q7/hOOlmWGO4bN7s5fjAKEsm3JV1xrsqSKRofRG +JfdPjQD88jewIAk6xGSMKmc4usQN+y/IfU8yZ57MHSHULccA1Wl/VXfgKCAxS5fK +uXtm -----END CERTIFICATE REQUEST----- diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.key b/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.key index fd649acf54..58414d8d59 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.key +++ b/experimental/packages/exporter-logs-otlp-grpc/test/certs/client.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKQIBAAKCAgEAyj0CVVuoqTQ0jdTgg+FcBGsD/0cK1bpMrxs2P4qoERM8nQ5X -oSkULUBQbyHpmlDLWUBVyEw5dfNUjF6MnndarZoEwQuXspqF4RQDNtA2pIHEvtxj -rWWyTWt3SvJDTXruP+01XmHcUfhlrAPu+3aga17gPGKmP6AVDH8xcPWPa84qbRI7 -rGsh1JaDv0dGcxvqYkwK1NzqS9flcM3dq/CuGd2w8plESGzV6LqWFjiKnc3vTfns -wHq80Xt64AxBTspnS5lluPSWog1P7qPAQnrKGRkz0gspvELz4gCEIA6y7Zspe2SE -NI1X7cmvfHw9FaWGUKK0a31rz8OVPREh9xdAdGZjuF2cyq37u8mKjnqgdzK/b7xq -n4Ktavk5+xG5C9Kzd5ufXOEOKbQCyko593AZ6k+5uAz8y6KVgiLfkvoJtGn5VtIa -YjIZQ4ahZre7KRww6biEgrptsU4ZROLFvAiNF/HO4988uogr5pDmQFJR0OEr0sek -04yfRGKFcGhF8TdV+e5ZVx62n8UbsHk9OAK8/RKz1CK9NX85CaLWO49rU42a1mh1 -lPN5XaYO9ktAoUgic5AT/p3Eyf7KuZiVB1XacSIlTXKIqnnrTU6SWp5fQE7WtZDL -bzcBTBsBLlkGZB4XgqYNm0SmF05MQOa7lhPIOEi9IrnxGr6JCr4IuZpgfcECAwEA -AQKCAgAOu17+JM0mdj0Vz9oDAVmYoMsLv3sUkpufbdYHzuvrQoF511+ex8VGfpbd -YZUIvrXxbHRTQOo2o2EXUJPhv0QFvWB3R4bnZcY23SRWy9gPJ7zTQm6oZO4WIavw -87DfZgMQ+RCYLXzFI9kULL0t6DhLWf/vpigCHoEqBeHuHpUx/zSr+VYLe0pdmBFE -z8ZcAD6UpoFrfCQ9Hh8Clpx9N+0WyUVohq2osPTsHRttxvSiBixWe8w5QTeb8ujC -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ocAirdf5fEeE -----END RSA PRIVATE KEY----- diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/regenerate.sh b/experimental/packages/exporter-logs-otlp-grpc/test/certs/regenerate.sh index e1f1af5b54..84637be753 100755 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/regenerate.sh +++ b/experimental/packages/exporter-logs-otlp-grpc/test/certs/regenerate.sh @@ -8,15 +8,15 @@ rm ca.crt ca.key client.crt client.csr client.key server.crt server.csr server.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 -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 -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 -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 -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 +openssl genrsa -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/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.crt b/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.crt index da8b6beedd..ace156a29e 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.crt +++ b/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.crt @@ -1,31 +1,31 @@ -----BEGIN CERTIFICATE----- MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjIwNjA4MDk1NDAwWhcN -MjMwNjA4MDk1NDAwWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjMwNjA4MTY0NDI0WhcN +MjQwNjA3MTY0NDI0WjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZT ZXJ2ZXIxEjAQBgNVBAMMCWxvY2FsaG9zdDCCAiIwDQYJKoZIhvcNAQEBBQADggIP -ADCCAgoCggIBAKF4wbhjwTd048CdtquNjhuVGIvPxpdNaCPXbSJN9joRqRwp0vt4 -DnRfLWda34UzZ9fxXN4HTgYrzLYkrdOUhvourhjka2mjcs1kOjlfFeGwgJe8LTVG -6qE+LdJFw4xPd53dZtsN1dQaj7e/GlK4jNI69qtq16dnFswjbzAI62or9MHdzY4F -fEFReMr25kGSo+/nNwI21PbiMhZ+OSTuoSgomx6JmXUYG9+uZFZTrE+fn47jMK4w -Bv1W+U2D1w2Aof01lyfQQ/giM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0TRheEtx3AeEXNps5Yhq0daLTnmnuFeyaJHm2F1QuBmma1TTwIF3HDclv2wLn +Jp+MWG9yoN9oEJLqS/AvDu1BltPSuvnYgLZr7cl0os+TEqpzxroa4ziE98dEiy0D +K4YQ59UTz6C8Ps0uX0hcs3jsvZOkBWptusvJBfZN59xLJAVmF2igkgIBKoiXvXmv +fXDx0hsOBg2IPe2O8lLHlFKlJZlMc+prH1iD0Xv6HefSP4L1eZHU37zjrRf/GiNX +r6GoEhJR2pKEoZQT81xpYp/w+qjzWcTl/mLD6FEePRzV92h3ubjRWBB36UhLtnEG +LJgp7yq3aGu7rg9rnuz8J6DG8DStE9rNuRjkV1O2C/PvR97XmVoIqbrMlxX9MUQJ +XxLm5dqBz7EVuhDJSyp4zCkDYsOj1y/SLL2O3cTyQQeZg6jlqripNqWnviAdTWe5 +JIPp -----END CERTIFICATE----- diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.csr b/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.csr index d8ab7deb4b..b421a7a60c 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.csr +++ b/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.csr @@ -2,27 +2,27 @@ MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGU2Vy dmVyMRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQCheMG4Y8E3dOPAnbarjY4blRiLz8aXTWgj120iTfY6EakcKdL7eA50 -Xy1nWt+FM2fX8VzeB04GK8y2JK3TlIb6Lq4Y5Gtpo3LNZDo5XxXhsICXvC01Ruqh -Pi3SRcOMT3ed3WbbDdXUGo+3vxpSuIzSOvaratenZxbMI28wCOtqK/TB3c2OBXxB -UXjK9uZBkqPv5zcCNtT24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fXVlmiPHEKRsQG9/DNIPe1mHP0p+S9qYKmCx7Jlpee7IstW/hNjt7alDn +uFaxFjxmCCSdWaMRyMW/qNRks9q3VdhJPan+amFeXceoEG7SOKiFiOc8A7DribSm +iKc2YlOw14xqc+cJutiKBvoBMri2eh1JgCbPT4ufVGFpbDkfYwAJxWx44Eg0X90j +gJUw8IRuHQZkEYss6jwFMFcOqjpe+AqrssOl4GZmu5gcaiUnj8PkSVZLTOrLilPg +sSDjzmoHdv4QcBppTrjj6PyR5Xd6DeGasWkMPvIPjiPN3mOhfxJ3C87atMqOhTLx +em7vFOBegAW6g40J9JD1XMoI/zFnTU8NevZQgCyx/Tq1XNRmUeMA6y/qpfTNKi/f +F7v/7nDWoxBgpOw3J0E9R+6rxD7Cjb2RWZEf20ZGdNBlPE+UG9c9b3HC3IHiwRHb +L9Fi0251w+fkaPX8dojQKErCEknqJ1SCP5S5F5g1QCQby22Y7LQsggMMf94s/wQX +4uMh -----END CERTIFICATE REQUEST----- diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.key b/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.key index 9147802e7d..80b9cea7bf 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.key +++ b/experimental/packages/exporter-logs-otlp-grpc/test/certs/server.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKAIBAAKCAgEAoXjBuGPBN3TjwJ22q42OG5UYi8/Gl01oI9dtIk32OhGpHCnS -+3gOdF8tZ1rfhTNn1/Fc3gdOBivMtiSt05SG+i6uGORraaNyzWQ6OV8V4bCAl7wt -NUbqoT4t0kXDjE93nd1m2w3V1BqPt78aUriM0jr2q2rXp2cWzCNvMAjraiv0wd3N -jgV8QVF4yvbmQZKj7+c3AjbU9uIyFn45JO6hKCibHomZdRgb365kVlOsT5+fjuMw -rjAG/Vb5TYPXDYCh/TWXJ9BD+CIxjpdQAg8cjIES8XIXWx1T5knO5uXe88bN/zgh -/z7fWJ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C8Qv9gY/CAxKL4e4efasfffDxnTSiZWcbfiDanyV +Fq8qYrcGnwkCJsz3tx9URvYEZZ8Xf3a3djbzMYQDTezBXNOdXxYq4YDpTD3grfba +P08EII6LKhDRPN5+RpsmNIytssLLBF2QlvMk9X2qF7CDVJLxlnkihue6G53jGWr4 +EjIaqNnST+9d10VEttwFPtnH5PIhX3pHpOm1onFI6t8dZWOiB5bhhAhDVceEz9BB +M0RPIBam+Zx9HQiBx5Cy9wHqN7rUJdh050RpCHo3PkqNz8M87NRV38QiOzx8FO1K +XytYvoHp6xC7Wd2uAU11IVdsipyPeifNAoIBAQCw47tJyyss2FqqXGl6IDEXFk12 +mcgrRuPnohAF7Z49/jp5wruYd8heyQdMGk8Z3l+OSFsdMIKxNDWbPuItxK/pCVRM +OooNEdM2uHAighJR9x9/kXFB3j7YuqbTbEz7MvLd+AJVfUos+zwcTuj7q72XGMsb +Gt4jRsrgeDA+paiavKKWyGgw125xXUx1xOUvhGJfL+MB3XTHdOb9nyaDANMw4MN2 +Ff18SMRkj0NzqmRaoEPg5dP0ORcpWJjM5R7Qt6FLnyfx2dhWNltyBBtgSTEVAjoN +Gcr4EgpmFEpA3aaG5QmYYJ/b9m2mWUpnr1iVmeDvadKu9IAi7LgPpV26ar4D -----END RSA PRIVATE KEY----- diff --git a/experimental/packages/exporter-logs-otlp-grpc/test/logsHelper.ts b/experimental/packages/exporter-logs-otlp-grpc/test/logsHelper.ts index 1dfd82675a..633d1a7833 100644 --- a/experimental/packages/exporter-logs-otlp-grpc/test/logsHelper.ts +++ b/experimental/packages/exporter-logs-otlp-grpc/test/logsHelper.ts @@ -88,7 +88,7 @@ export function ensureExportedLogRecordIsCorrect(logRecord: ILogRecord) { ensureExportedAttributesAreCorrect(logRecord.attributes); assert.strictEqual( logRecord.timeUnixNano, - '1680253513123241728', + '1680253513123241635', 'timeUnixNano is wrong' ); assert.strictEqual( diff --git a/experimental/packages/exporter-logs-otlp-http/.eslintrc.js b/experimental/packages/exporter-logs-otlp-http/.eslintrc.js index f3f22e8617..24f29328f9 100644 --- a/experimental/packages/exporter-logs-otlp-http/.eslintrc.js +++ b/experimental/packages/exporter-logs-otlp-http/.eslintrc.js @@ -5,5 +5,5 @@ module.exports = { node: true, browser: true, }, - ...require('../../../eslint.config.js'), + ...require('../../../eslint.base.js'), }; diff --git a/experimental/packages/exporter-logs-otlp-http/README.md b/experimental/packages/exporter-logs-otlp-http/README.md index 256e1d88d8..24f0d7f4a0 100644 --- a/experimental/packages/exporter-logs-otlp-http/README.md +++ b/experimental/packages/exporter-logs-otlp-http/README.md @@ -5,7 +5,7 @@ **Note: This is an experimental package under active development. New releases may include breaking changes.** -This module provides an exporter for OTLP (http/json) logs using protocol version `v0.18`. +This module provides a logs-exporter for OTLP (http/json) using protocol version `v0.20.0`. ## Installation diff --git a/experimental/packages/exporter-logs-otlp-http/package.json b/experimental/packages/exporter-logs-otlp-http/package.json index b6f4808b42..a3b53e05bc 100644 --- a/experimental/packages/exporter-logs-otlp-http/package.json +++ b/experimental/packages/exporter-logs-otlp-http/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-logs-otlp-http", - "version": "0.39.1", + "version": "0.44.0", "publishConfig": { "access": "public" }, @@ -38,10 +38,10 @@ "tdd": "npm run test -- --watch-extensions ts --watch", "tdd:browser": "karma start", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" @@ -71,39 +71,43 @@ ], "sideEffects": false, "devDependencies": { - "@babel/core": "7.16.0", - "@opentelemetry/api-logs": ">=0.38.0", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@opentelemetry/api": "1.6.0", + "@opentelemetry/resources": "1.17.1", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "@types/webpack-env": "1.16.3", - "babel-loader": "8.2.3", + "babel-loader": "8.3.0", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", "cpx": "1.5.0", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "14.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", "webpack": "4.46.0", - "webpack-cli": "4.9.1", - "webpack-merge": "5.8.0" + "webpack-cli": "4.10.0", + "webpack-merge": "5.9.0" }, "peerDependencies": { - "@opentelemetry/api-logs": ">=0.38.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/otlp-exporter-base": "0.39.1", - "@opentelemetry/otlp-transformer": "0.39.1", - "@opentelemetry/sdk-logs": "0.39.1" + "@opentelemetry/api-logs": "0.44.0", + "@opentelemetry/core": "1.17.1", + "@opentelemetry/otlp-exporter-base": "0.44.0", + "@opentelemetry/otlp-transformer": "0.44.0", + "@opentelemetry/sdk-logs": "0.44.0" } } diff --git a/experimental/packages/exporter-logs-otlp-http/src/platform/browser/OTLPLogExporter.ts b/experimental/packages/exporter-logs-otlp-http/src/platform/browser/OTLPLogExporter.ts index ef837614e2..a7ecbbac95 100644 --- a/experimental/packages/exporter-logs-otlp-http/src/platform/browser/OTLPLogExporter.ts +++ b/experimental/packages/exporter-logs-otlp-http/src/platform/browser/OTLPLogExporter.ts @@ -48,7 +48,7 @@ export class OTLPLogExporter } convert(logRecords: ReadableLogRecord[]): IExportLogsServiceRequest { - return createExportLogsServiceRequest(logRecords); + return createExportLogsServiceRequest(logRecords, true); } getDefaultUrl(config: OTLPExporterConfigBase): string { diff --git a/experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts b/experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts index 7f7c538df7..a1d101e87c 100644 --- a/experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts +++ b/experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts @@ -48,7 +48,7 @@ export class OTLPLogExporter } convert(logRecords: ReadableLogRecord[]): IExportLogsServiceRequest { - return createExportLogsServiceRequest(logRecords); + return createExportLogsServiceRequest(logRecords, true); } getDefaultUrl(config: OTLPExporterNodeConfigBase): string { diff --git a/experimental/packages/exporter-logs-otlp-http/test/browser/OTLPLogExporter.test.ts b/experimental/packages/exporter-logs-otlp-http/test/browser/OTLPLogExporter.test.ts index 66958a9fef..2443c97ef4 100644 --- a/experimental/packages/exporter-logs-otlp-http/test/browser/OTLPLogExporter.test.ts +++ b/experimental/packages/exporter-logs-otlp-http/test/browser/OTLPLogExporter.test.ts @@ -13,15 +13,24 @@ * 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 * as Config from '../../src/platform/config'; import { OTLPLogExporter } from '../../src/platform/browser'; +import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; +import { ReadableLogRecord } from '@opentelemetry/sdk-logs'; +import { mockedReadableLogRecord } from '../logHelper'; +import { ExportResultCode } from '@opentelemetry/core'; describe('OTLPLogExporter', () => { let envSource: Record; + let collectorExporter: OTLPLogExporter; + let collectorExporterConfig: OTLPExporterConfigBase; + + afterEach(() => { + sinon.restore(); + }); if (typeof process === 'undefined') { envSource = globalThis as unknown as Record; @@ -61,4 +70,79 @@ describe('OTLPLogExporter', () => { assert.strictEqual(getDefaultUrl.callCount, 2); }); }); + + describe('export - common', () => { + let spySend: any; + beforeEach(() => { + spySend = sinon.stub(OTLPLogExporter.prototype, 'send'); + collectorExporter = new OTLPLogExporter(collectorExporterConfig); + }); + + it('should export spans as otlpTypes.Spans', done => { + const logs: ReadableLogRecord[] = []; + logs.push(Object.assign({}, mockedReadableLogRecord)); + + collectorExporter.export(logs, () => {}); + setTimeout(() => { + const log = spySend.args[0][0][0] as ReadableLogRecord; + assert.deepStrictEqual(logs[0], log); + done(); + }); + assert.strictEqual(spySend.callCount, 1); + }); + + describe('when exporter is shutdown', () => { + it( + 'should not export anything but return callback with code' + + ' "FailedNotRetryable"', + async () => { + const spans: ReadableLogRecord[] = []; + spans.push(Object.assign({}, mockedReadableLogRecord)); + await collectorExporter.shutdown(); + spySend.resetHistory(); + + const callbackSpy = sinon.spy(); + collectorExporter.export(spans, callbackSpy); + const returnCode = callbackSpy.args[0][0]; + + assert.strictEqual( + returnCode.code, + ExportResultCode.FAILED, + 'return value is wrong' + ); + assert.strictEqual(spySend.callCount, 0, 'should not call send'); + } + ); + }); + describe('when an error occurs', () => { + it('should return failed export result', done => { + const spans: ReadableLogRecord[] = []; + spans.push(Object.assign({}, mockedReadableLogRecord)); + spySend.throws({ + code: 100, + details: 'Test error', + metadata: {}, + message: 'Non-retryable', + stack: 'Stack', + }); + const callbackSpy = sinon.spy(); + collectorExporter.export(spans, callbackSpy); + setTimeout(() => { + const returnCode = callbackSpy.args[0][0]; + assert.strictEqual( + returnCode.code, + ExportResultCode.FAILED, + 'return value is wrong' + ); + assert.strictEqual( + returnCode.error.message, + 'Non-retryable', + 'return error message is wrong' + ); + assert.strictEqual(spySend.callCount, 1, 'should call send'); + done(); + }); + }); + }); + }); }); diff --git a/experimental/packages/exporter-logs-otlp-http/test/logHelper.ts b/experimental/packages/exporter-logs-otlp-http/test/logHelper.ts new file mode 100644 index 0000000000..b5832f7cd4 --- /dev/null +++ b/experimental/packages/exporter-logs-otlp-http/test/logHelper.ts @@ -0,0 +1,172 @@ +/* + * 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 { HrTime, TraceFlags } from '@opentelemetry/api'; +import { SeverityNumber } from '@opentelemetry/api-logs'; +import { Resource } from '@opentelemetry/resources'; +import * as assert from 'assert'; +import { VERSION } from '@opentelemetry/core'; +import { + hrTimeToFixed64Nanos, + IAnyValue, + IExportLogsServiceRequest, + IKeyValue, + ILogRecord, + IResource, +} from '@opentelemetry/otlp-transformer'; +import { ReadableLogRecord } from '@opentelemetry/sdk-logs'; + +export const mockedReadableLogRecord: ReadableLogRecord = { + resource: Resource.default().merge( + new Resource({ + 'resource-attribute': 'some resource-attr value', + }) + ), + instrumentationScope: { + name: 'scope_name_1', + version: '0.1.0', + schemaUrl: 'http://url.to.schema', + }, + hrTime: [1680253513, 123241635] as HrTime, + hrTimeObserved: [1680253513, 123241635] as HrTime, + attributes: { + 'some-attribute': 'some attribute value', + }, + severityNumber: SeverityNumber.ERROR, + severityText: 'error', + body: 'some_log_body', + spanContext: { + traceFlags: TraceFlags.SAMPLED, + traceId: '1f1008dc8e270e85c40a0d7c3939b278', + spanId: '5e107261f64fa53e', + }, +}; +export function ensureExportedAttributesAreCorrect(attributes: IKeyValue[]) { + assert.deepStrictEqual( + attributes, + [ + { + key: 'some-attribute', + value: { + stringValue: 'some attribute value', + }, + }, + ], + 'exported attributes are incorrect' + ); +} + +export function ensureExportedBodyIsCorrect(body?: IAnyValue) { + assert.deepStrictEqual( + body, + { stringValue: 'some_log_body' }, + 'exported attributes are incorrect' + ); +} + +function hrTimeToFixed64(hrTime: HrTime) { + const { low, high } = hrTimeToFixed64Nanos(hrTime); + return { low, high }; +} + +export function ensureExportedLogRecordIsCorrect(logRecord: ILogRecord) { + ensureExportedBodyIsCorrect(logRecord.body); + ensureExportedAttributesAreCorrect(logRecord.attributes); + assert.deepStrictEqual( + logRecord.timeUnixNano, + hrTimeToFixed64(mockedReadableLogRecord.hrTime), + 'timeUnixNano is wrong' + ); + assert.deepStrictEqual( + logRecord.observedTimeUnixNano, + hrTimeToFixed64(mockedReadableLogRecord.hrTimeObserved), + 'observedTimeUnixNano is wrong' + ); + assert.strictEqual( + logRecord.severityNumber, + SeverityNumber.ERROR, + 'severityNumber is wrong' + ); + assert.strictEqual(logRecord.severityText, 'error', 'severityText is wrong'); + assert.strictEqual( + logRecord.droppedAttributesCount, + 0, + 'droppedAttributesCount is wrong' + ); + assert.strictEqual(logRecord.flags, TraceFlags.SAMPLED, 'flags is wrong'); +} + +export function ensureResourceIsCorrect(resource: IResource) { + assert.deepStrictEqual(resource, { + attributes: [ + { + 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: 'resource-attribute', + value: { + stringValue: 'some resource-attr value', + value: 'stringValue', + }, + }, + ], + droppedAttributesCount: 0, + }); +} + +export function ensureExportLogsServiceRequestIsSet( + json: IExportLogsServiceRequest +) { + const resourceLogs = json.resourceLogs; + assert.strictEqual(resourceLogs?.length, 1, 'resourceLogs is missing'); + + const resource = resourceLogs?.[0].resource; + assert.ok(resource, 'resource is missing'); + + const scopeLogs = resourceLogs?.[0].scopeLogs; + assert.strictEqual(scopeLogs?.length, 1, 'scopeLogs is missing'); + + const scope = scopeLogs?.[0].scope; + assert.ok(scope, 'scope is missing'); + + const logRecords = scopeLogs?.[0].logRecords; + assert.strictEqual(logRecords?.length, 1, 'logs are missing'); +} diff --git a/experimental/packages/exporter-logs-otlp-http/test/node/OTLPLogExporter.test.ts b/experimental/packages/exporter-logs-otlp-http/test/node/OTLPLogExporter.test.ts index aa0d345348..6dac23b580 100644 --- a/experimental/packages/exporter-logs-otlp-http/test/node/OTLPLogExporter.test.ts +++ b/experimental/packages/exporter-logs-otlp-http/test/node/OTLPLogExporter.test.ts @@ -14,14 +14,58 @@ * limitations under the License. */ +import { diag } from '@opentelemetry/api'; import * as assert from 'assert'; +import * as http from 'http'; import * as sinon from 'sinon'; - import * as Config from '../../src/platform/config'; + import { OTLPLogExporter } from '../../src/platform/node'; +import { OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base'; +import { ReadableLogRecord } from '@opentelemetry/sdk-logs'; +import { + ensureExportLogsServiceRequestIsSet, + ensureExportedLogRecordIsCorrect, + mockedReadableLogRecord, +} from '../logHelper'; +import { PassThrough, Stream } from 'stream'; +import { IExportLogsServiceRequest } from '@opentelemetry/otlp-transformer'; +import { ExportResultCode } from '@opentelemetry/core'; + +let fakeRequest: PassThrough; + +class MockedResponse extends Stream { + constructor( + private _code: number, + private _msg?: string + ) { + super(); + } + + send(data: string) { + this.emit('data', data); + this.emit('end'); + } + + get statusCode() { + return this._code; + } + + get statusMessage() { + return this._msg; + } +} describe('OTLPLogExporter', () => { let envSource: Record; + let collectorExporter: OTLPLogExporter; + let collectorExporterConfig: OTLPExporterNodeConfigBase; + let logs: ReadableLogRecord[]; + + afterEach(() => { + fakeRequest = new Stream.PassThrough(); + sinon.restore(); + }); if (typeof process === 'undefined') { envSource = globalThis as unknown as Record; @@ -61,4 +105,130 @@ describe('OTLPLogExporter', () => { assert.strictEqual(getDefaultUrl.callCount, 2); }); }); + + describe('export', () => { + beforeEach(() => { + collectorExporterConfig = { + headers: { + foo: 'bar', + }, + hostname: 'foo', + url: 'http://foo.bar.com', + keepAlive: true, + httpAgentOptions: { keepAliveMsecs: 2000 }, + }; + collectorExporter = new OTLPLogExporter(collectorExporterConfig); + logs = []; + logs.push(Object.assign({}, mockedReadableLogRecord)); + }); + afterEach(() => { + sinon.restore(); + }); + + it('should open the connection', done => { + sinon.stub(http, 'request').callsFake((options: any, cb: any) => { + assert.strictEqual(options.hostname, 'foo.bar.com'); + assert.strictEqual(options.method, 'POST'); + assert.strictEqual(options.path, '/'); + + const mockRes = new MockedResponse(200); + cb(mockRes); + mockRes.send('success'); + done(); + return fakeRequest as any; + }); + collectorExporter.export(logs, () => {}); + }); + + it('should set custom headers', done => { + sinon.stub(http, 'request').callsFake((options: any, cb: any) => { + assert.strictEqual(options.headers['foo'], 'bar'); + + const mockRes = new MockedResponse(200); + cb(mockRes); + mockRes.send('success'); + done(); + return fakeRequest as any; + }); + + collectorExporter.export(logs, () => {}); + }); + + it('should have keep alive and keepAliveMsecs option set', done => { + sinon.stub(http, 'request').callsFake((options: any, cb: any) => { + assert.strictEqual(options.agent.keepAlive, true); + assert.strictEqual(options.agent.options.keepAliveMsecs, 2000); + + const mockRes = new MockedResponse(200); + cb(mockRes); + mockRes.send('success'); + done(); + return fakeRequest as any; + }); + + collectorExporter.export(logs, () => {}); + }); + + it('should successfully send the logs', done => { + const fakeRequest = new Stream.PassThrough(); + sinon.stub(http, 'request').returns(fakeRequest as any); + + let buff = Buffer.from(''); + fakeRequest.on('end', () => { + const responseBody = buff.toString(); + const json = JSON.parse(responseBody) as IExportLogsServiceRequest; + const log1 = json.resourceLogs?.[0].scopeLogs?.[0].logRecords?.[0]; + assert.ok(typeof log1 !== 'undefined', "log doesn't exist"); + ensureExportedLogRecordIsCorrect(log1); + + ensureExportLogsServiceRequestIsSet(json); + + done(); + }); + + fakeRequest.on('data', chunk => { + buff = Buffer.concat([buff, chunk]); + }); + + const clock = sinon.useFakeTimers(); + collectorExporter.export(logs, () => {}); + clock.tick(200); + clock.restore(); + }); + + it('should log the successful message', done => { + // Need to stub/spy on the underlying logger as the "diag" instance is global + const spyLoggerError = sinon.stub(diag, 'error'); + + sinon.stub(http, 'request').callsFake((options: any, cb: any) => { + const mockRes = new MockedResponse(200); + cb(mockRes); + mockRes.send('success'); + return fakeRequest as any; + }); + + collectorExporter.export(logs, result => { + assert.strictEqual(result.code, ExportResultCode.SUCCESS); + assert.strictEqual(spyLoggerError.args.length, 0); + done(); + }); + }); + + it('should log the error message', done => { + sinon.stub(http, 'request').callsFake((options: any, cb: any) => { + const mockResError = new MockedResponse(400); + cb(mockResError); + mockResError.send('failed'); + + return fakeRequest as any; + }); + + collectorExporter.export(logs, result => { + assert.strictEqual(result.code, ExportResultCode.FAILED); + // @ts-expect-error verify error code + assert.strictEqual(result.error.code, 400); + done(); + }); + }); + }); }); diff --git a/experimental/packages/exporter-logs-otlp-http/tsconfig.esm.json b/experimental/packages/exporter-logs-otlp-http/tsconfig.esm.json index 554367c373..0edcb89fa7 100644 --- a/experimental/packages/exporter-logs-otlp-http/tsconfig.esm.json +++ b/experimental/packages/exporter-logs-otlp-http/tsconfig.esm.json @@ -9,9 +9,15 @@ "src/**/*.ts" ], "references": [ + { + "path": "../../../api" + }, { "path": "../../../packages/opentelemetry-core" }, + { + "path": "../../../packages/opentelemetry-resources" + }, { "path": "../api-logs" }, diff --git a/experimental/packages/exporter-logs-otlp-http/tsconfig.esnext.json b/experimental/packages/exporter-logs-otlp-http/tsconfig.esnext.json index 87a369521c..0c19aa0aaf 100644 --- a/experimental/packages/exporter-logs-otlp-http/tsconfig.esnext.json +++ b/experimental/packages/exporter-logs-otlp-http/tsconfig.esnext.json @@ -9,9 +9,15 @@ "src/**/*.ts" ], "references": [ + { + "path": "../../../api" + }, { "path": "../../../packages/opentelemetry-core" }, + { + "path": "../../../packages/opentelemetry-resources" + }, { "path": "../api-logs" }, diff --git a/experimental/packages/exporter-logs-otlp-http/tsconfig.json b/experimental/packages/exporter-logs-otlp-http/tsconfig.json index c4eda837a9..96f229bb8e 100644 --- a/experimental/packages/exporter-logs-otlp-http/tsconfig.json +++ b/experimental/packages/exporter-logs-otlp-http/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../../tsconfig.base.json", "compilerOptions": { - "esModuleInterop": true, "outDir": "build", "rootDir": "." }, @@ -10,9 +9,15 @@ "test/**/*.ts" ], "references": [ + { + "path": "../../../api" + }, { "path": "../../../packages/opentelemetry-core" }, + { + "path": "../../../packages/opentelemetry-resources" + }, { "path": "../api-logs" }, diff --git a/experimental/packages/exporter-logs-otlp-proto/.eslintrc.js b/experimental/packages/exporter-logs-otlp-proto/.eslintrc.js index 3ed0fbeba3..9cfb3fd423 100644 --- a/experimental/packages/exporter-logs-otlp-proto/.eslintrc.js +++ b/experimental/packages/exporter-logs-otlp-proto/.eslintrc.js @@ -4,5 +4,5 @@ module.exports = { "commonjs": true, "node": true, }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/exporter-logs-otlp-proto/README.md b/experimental/packages/exporter-logs-otlp-proto/README.md index 3019f50d3f..30f1e8bb34 100644 --- a/experimental/packages/exporter-logs-otlp-proto/README.md +++ b/experimental/packages/exporter-logs-otlp-proto/README.md @@ -5,7 +5,7 @@ **Note: This is an experimental package under active development. New releases may include breaking changes.** -This module provides an exporter for OTLP (http/protobuf) logs using protocol version `v0.18`. +This module provides a logs-exporter for OTLP (http/protobuf) using protocol version `v0.20.0`. ## Installation @@ -22,7 +22,7 @@ To see documentation and sample code for the metric exporter, see the [exporter- ```js const { LoggerProvider, SimpleLogRecordProcessor } = require('@opentelemetry/sdk-logs'); -const { OTLPLogsExporter } = require('@opentelemetry/exporter-logs-otlp-proto'); +const { OTLPLogExporter } = require('@opentelemetry/exporter-logs-otlp-proto'); const collectorOptions = { url: '', // url is optional and can be omitted - default is http://localhost:4318/v1/logs @@ -32,7 +32,7 @@ const collectorOptions = { }; const logProvider = new LoggerProvider({resource: new Resource({'service.name': 'testApp'})}); -const logExporter = new OTLPLogsExporter(collectorOptions); +const logExporter = new OTLPLogExporter(collectorOptions); logProvider.addLogRecordProcessor(new SimpleLogRecordProcessor(exporter)); const logger = logProvider.getLogger('test_log_instrumentation'); @@ -44,7 +44,7 @@ logger.emit({ ## Exporter Timeout Configuration -The OTLPLogsExporter has a timeout configuration option which is the maximum time, in milliseconds, the OTLP exporter will wait for each batch export. The default value is 10000ms. +The OTLPLogExporter has a timeout configuration option which is the maximum time, in milliseconds, the OTLP exporter will wait for each batch export. The default value is 10000ms. To override the default timeout duration, use the following options: @@ -57,7 +57,7 @@ To override the default timeout duration, use the following options: > `OTEL_EXPORTER_OTLP_LOGS_TIMEOUT` takes precedence and overrides `OTEL_EXPORTER_OTLP_TIMEOUT`. -+ Provide `timeoutMillis` to OTLPLogsExporter with `collectorOptions`: ++ Provide `timeoutMillis` to OTLPLogExporter with `collectorOptions`: ```js const collectorOptions = { @@ -68,7 +68,7 @@ To override the default timeout duration, use the following options: }, //an optional object containing custom headers to be sent with each request will only work with http }; - const exporter = new OTLPLogsExporter(collectorOptions); + const exporter = new OTLPLogExporter(collectorOptions); ``` > Providing `timeoutMillis` with `collectorOptions` takes precedence and overrides timeout set with environment variables. diff --git a/experimental/packages/exporter-logs-otlp-proto/package.json b/experimental/packages/exporter-logs-otlp-proto/package.json index 016ec13486..5ad2664217 100644 --- a/experimental/packages/exporter-logs-otlp-proto/package.json +++ b/experimental/packages/exporter-logs-otlp-proto/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-logs-otlp-proto", - "version": "0.39.1", + "version": "0.44.0", "description": "An OTLP exporter to send logs using protobuf over HTTP", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -21,10 +21,10 @@ "lint:fix": "eslint . --ext .ts --fix", "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" @@ -63,32 +63,44 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", - "@opentelemetry/api": "1.4.1", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@opentelemetry/api": "1.6.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", "cpx": "1.5.0", - "mocha": "10.0.0", + "cross-var": "1.1.0", + "karma": "6.4.2", + "karma-chrome-launcher": "3.1.0", + "karma-coverage": "2.2.1", + "karma-mocha": "2.0.1", + "karma-spec-reporter": "0.0.36", + "karma-webpack": "4.0.2", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", - "typescript": "4.4.4" + "typescript": "4.4.4", + "webpack": "4.46.0", + "webpack-cli": "4.10.0", + "webpack-merge": "5.9.0" }, "peerDependencies": { "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/otlp-transformer": "0.39.1", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "@opentelemetry/api-logs": "^0.39.1", - "@opentelemetry/otlp-exporter-base": "0.39.1", - "@opentelemetry/otlp-proto-exporter-base": "0.39.1", - "@opentelemetry/sdk-logs": "^0.39.1" + "@opentelemetry/api-logs": "0.44.0", + "@opentelemetry/core": "1.17.1", + "@opentelemetry/otlp-exporter-base": "0.44.0", + "@opentelemetry/otlp-proto-exporter-base": "0.44.0", + "@opentelemetry/otlp-transformer": "0.44.0", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-logs": "0.44.0", + "@opentelemetry/sdk-trace-base": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-logs-otlp-proto", "sideEffects": false diff --git a/experimental/packages/exporter-logs-otlp-proto/src/index.ts b/experimental/packages/exporter-logs-otlp-proto/src/index.ts index 9fde4be45b..dd74bc70be 100644 --- a/experimental/packages/exporter-logs-otlp-proto/src/index.ts +++ b/experimental/packages/exporter-logs-otlp-proto/src/index.ts @@ -13,4 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export { OTLPLogsExporter } from './platform'; +export { OTLPLogExporter } from './platform'; diff --git a/experimental/packages/exporter-logs-otlp-proto/src/platform/browser/OTLPLogsExporter.ts b/experimental/packages/exporter-logs-otlp-proto/src/platform/browser/OTLPLogExporter.ts similarity index 98% rename from experimental/packages/exporter-logs-otlp-proto/src/platform/browser/OTLPLogsExporter.ts rename to experimental/packages/exporter-logs-otlp-proto/src/platform/browser/OTLPLogExporter.ts index 185d5094f1..fff28d4e77 100644 --- a/experimental/packages/exporter-logs-otlp-proto/src/platform/browser/OTLPLogsExporter.ts +++ b/experimental/packages/exporter-logs-otlp-proto/src/platform/browser/OTLPLogExporter.ts @@ -37,7 +37,7 @@ const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURC /** * Collector Trace Exporter for Web */ -export class OTLPLogsExporter +export class OTLPLogExporter extends OTLPProtoExporterBrowserBase< ReadableLogRecord, IExportLogsServiceRequest diff --git a/experimental/packages/exporter-logs-otlp-proto/src/platform/browser/index.ts b/experimental/packages/exporter-logs-otlp-proto/src/platform/browser/index.ts index e6968b3466..abaa4216f1 100644 --- a/experimental/packages/exporter-logs-otlp-proto/src/platform/browser/index.ts +++ b/experimental/packages/exporter-logs-otlp-proto/src/platform/browser/index.ts @@ -13,4 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export { OTLPLogsExporter } from './OTLPLogsExporter'; +export { OTLPLogExporter } from './OTLPLogExporter'; diff --git a/experimental/packages/exporter-logs-otlp-proto/src/platform/index.ts b/experimental/packages/exporter-logs-otlp-proto/src/platform/index.ts index 851ff9a015..86a29a341c 100644 --- a/experimental/packages/exporter-logs-otlp-proto/src/platform/index.ts +++ b/experimental/packages/exporter-logs-otlp-proto/src/platform/index.ts @@ -13,4 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export { OTLPLogsExporter } from './node'; +export { OTLPLogExporter } from './node'; diff --git a/experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogsExporter.ts b/experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts similarity index 98% rename from experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogsExporter.ts rename to experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts index 88d97e21d3..53191c0625 100644 --- a/experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogsExporter.ts +++ b/experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts @@ -37,7 +37,7 @@ const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURC /** * Collector Trace Exporter for Node */ -export class OTLPLogsExporter +export class OTLPLogExporter extends OTLPProtoExporterNodeBase< ReadableLogRecord, IExportLogsServiceRequest diff --git a/experimental/packages/exporter-logs-otlp-proto/src/platform/node/index.ts b/experimental/packages/exporter-logs-otlp-proto/src/platform/node/index.ts index 4797b30651..2472e4a796 100644 --- a/experimental/packages/exporter-logs-otlp-proto/src/platform/node/index.ts +++ b/experimental/packages/exporter-logs-otlp-proto/src/platform/node/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export { OTLPLogsExporter } from './OTLPLogsExporter'; +export { OTLPLogExporter } from './OTLPLogExporter'; diff --git a/experimental/packages/exporter-logs-otlp-proto/test/browser/OTLPLogsExporter.test.ts b/experimental/packages/exporter-logs-otlp-proto/test/browser/OTLPLogExporter.test.ts similarity index 81% rename from experimental/packages/exporter-logs-otlp-proto/test/browser/OTLPLogsExporter.test.ts rename to experimental/packages/exporter-logs-otlp-proto/test/browser/OTLPLogExporter.test.ts index 382a132c3e..6a76ed24a0 100644 --- a/experimental/packages/exporter-logs-otlp-proto/test/browser/OTLPLogsExporter.test.ts +++ b/experimental/packages/exporter-logs-otlp-proto/test/browser/OTLPLogExporter.test.ts @@ -16,19 +16,19 @@ import * as assert from 'assert'; import * as sinon from 'sinon'; -import { OTLPLogsExporter } from '../../src/platform/browser/index'; +import { OTLPLogExporter } from '../../src/platform/browser/index'; -describe('OTLPLogsExporter - web', () => { - let collectorLogsExporter: OTLPLogsExporter; +describe('OTLPLogExporter - web', () => { + let collectorLogsExporter: OTLPLogExporter; describe('constructor', () => { let onInitSpy: any; beforeEach(() => { - onInitSpy = sinon.stub(OTLPLogsExporter.prototype, 'onInit'); + onInitSpy = sinon.stub(OTLPLogExporter.prototype, 'onInit'); const collectorExporterConfig = { hostname: 'foo', url: 'http://foo.bar.com', }; - collectorLogsExporter = new OTLPLogsExporter(collectorExporterConfig); + collectorLogsExporter = new OTLPLogExporter(collectorExporterConfig); }); afterEach(() => { sinon.restore(); diff --git a/experimental/packages/exporter-logs-otlp-proto/test/logHelper.ts b/experimental/packages/exporter-logs-otlp-proto/test/logHelper.ts index 7b8c8e8b9a..ae72deae33 100644 --- a/experimental/packages/exporter-logs-otlp-proto/test/logHelper.ts +++ b/experimental/packages/exporter-logs-otlp-proto/test/logHelper.ts @@ -82,12 +82,12 @@ export function ensureExportedLogRecordIsCorrect(logRecord: ILogRecord) { ensureExportedAttributesAreCorrect(logRecord.attributes); assert.strictEqual( logRecord.timeUnixNano, - '1680253513123241728', + '1680253513123241635', 'timeUnixNano is wrong' ); assert.strictEqual( logRecord.observedTimeUnixNano, - '1680253513123241728', + '1680253513123241635', 'observedTimeUnixNano is wrong' ); assert.strictEqual( @@ -167,7 +167,10 @@ export function ensureExportLogsServiceRequestIsSet( } export class MockedResponse extends Stream { - constructor(private _code: number, private _msg?: string) { + constructor( + private _code: number, + private _msg?: string + ) { super(); } diff --git a/experimental/packages/exporter-logs-otlp-proto/test/node/OTLPLogsExporter.test.ts b/experimental/packages/exporter-logs-otlp-proto/test/node/OTLPLogExporter.test.ts similarity index 92% rename from experimental/packages/exporter-logs-otlp-proto/test/node/OTLPLogsExporter.test.ts rename to experimental/packages/exporter-logs-otlp-proto/test/node/OTLPLogExporter.test.ts index 994a2f0ea4..0810109e81 100644 --- a/experimental/packages/exporter-logs-otlp-proto/test/node/OTLPLogsExporter.test.ts +++ b/experimental/packages/exporter-logs-otlp-proto/test/node/OTLPLogExporter.test.ts @@ -21,7 +21,7 @@ import * as http from 'http'; import * as sinon from 'sinon'; import { Stream, PassThrough } from 'stream'; import * as zlib from 'zlib'; -import { OTLPLogsExporter } from '../../src'; +import { OTLPLogExporter } from '../../src'; import { ensureExportLogsServiceRequestIsSet, ensureExportedLogRecordIsCorrect, @@ -42,8 +42,8 @@ import { ReadableLogRecord } from '@opentelemetry/sdk-logs'; let fakeRequest: PassThrough; -describe('OTLPLogsExporter - node with proto over http', () => { - let collectorExporter: OTLPLogsExporter; +describe('OTLPLogExporter - node with proto over http', () => { + let collectorExporter: OTLPLogExporter; let collectorExporterConfig: OTLPExporterNodeConfigBase; let logs: ReadableLogRecord[]; @@ -56,7 +56,7 @@ describe('OTLPLogsExporter - node with proto over http', () => { const envSource = process.env; it('should use url defined in env that ends with root path and append version and signal path', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/'; - const collectorExporter = new OTLPLogsExporter(); + const collectorExporter = new OTLPLogExporter(); assert.strictEqual( collectorExporter.url, `${envSource.OTEL_EXPORTER_OTLP_ENDPOINT}v1/logs` @@ -65,7 +65,7 @@ describe('OTLPLogsExporter - node with proto over http', () => { }); it('should use url defined in env without checking if path is already present', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/v1/logs'; - const collectorExporter = new OTLPLogsExporter(); + const collectorExporter = new OTLPLogExporter(); assert.strictEqual( collectorExporter.url, `${envSource.OTEL_EXPORTER_OTLP_ENDPOINT}/v1/logs` @@ -74,7 +74,7 @@ describe('OTLPLogsExporter - node with proto over http', () => { }); it('should use url defined in env and append version and signal', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; - const collectorExporter = new OTLPLogsExporter(); + const collectorExporter = new OTLPLogExporter(); assert.strictEqual( collectorExporter.url, `${envSource.OTEL_EXPORTER_OTLP_ENDPOINT}/v1/logs` @@ -84,7 +84,7 @@ describe('OTLPLogsExporter - node with proto over http', () => { it('should override global exporter url with signal url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/'; envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = 'http://foo.logs/'; - const collectorExporter = new OTLPLogsExporter(); + const collectorExporter = new OTLPLogExporter(); assert.strictEqual( collectorExporter.url, envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT @@ -94,7 +94,7 @@ describe('OTLPLogsExporter - node with proto over http', () => { }); it('should add root path when signal url defined in env contains no path and no root path', () => { envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = 'http://foo.bar'; - const collectorExporter = new OTLPLogsExporter(); + const collectorExporter = new OTLPLogExporter(); assert.strictEqual( collectorExporter.url, `${envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT}/` @@ -103,7 +103,7 @@ describe('OTLPLogsExporter - node with proto over http', () => { }); it('should not add root path when signal url defined in env contains root path but no path', () => { envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = 'http://foo.bar/'; - const collectorExporter = new OTLPLogsExporter(); + const collectorExporter = new OTLPLogExporter(); assert.strictEqual( collectorExporter.url, `${envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT}` @@ -112,7 +112,7 @@ describe('OTLPLogsExporter - node with proto over http', () => { }); it('should not add root path when signal url defined in env contains path', () => { envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = 'http://foo.bar/v1/logs'; - const collectorExporter = new OTLPLogsExporter(); + const collectorExporter = new OTLPLogExporter(); assert.strictEqual( collectorExporter.url, `${envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT}` @@ -121,7 +121,7 @@ describe('OTLPLogsExporter - node with proto over http', () => { }); it('should not add root path when signal url defined in env contains path and ends in /', () => { envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT = 'http://foo.bar/v1/logs/'; - const collectorExporter = new OTLPLogsExporter(); + const collectorExporter = new OTLPLogExporter(); assert.strictEqual( collectorExporter.url, `${envSource.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT}` @@ -130,14 +130,14 @@ describe('OTLPLogsExporter - node with proto over http', () => { }); it('should use headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_LOGS_HEADERS = 'foo=bar'; - const collectorExporter = new OTLPLogsExporter(); + const collectorExporter = new OTLPLogExporter(); assert.strictEqual(collectorExporter.headers.foo, 'bar'); envSource.OTEL_EXPORTER_OTLP_HEADERS = ''; }); it('should override global headers config with signal headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar,bar=foo'; envSource.OTEL_EXPORTER_OTLP_LOGS_HEADERS = 'foo=boo'; - const collectorExporter = new OTLPLogsExporter(); + const collectorExporter = new OTLPLogExporter(); assert.strictEqual(collectorExporter.headers.foo, 'boo'); assert.strictEqual(collectorExporter.headers.bar, 'foo'); envSource.OTEL_EXPORTER_OTLP_LOGS_HEADERS = ''; @@ -156,7 +156,7 @@ describe('OTLPLogsExporter - node with proto over http', () => { keepAlive: true, httpAgentOptions: { keepAliveMsecs: 2000 }, }; - collectorExporter = new OTLPLogsExporter(collectorExporterConfig); + collectorExporter = new OTLPLogExporter(collectorExporterConfig); logs = []; logs.push(Object.assign({}, mockedReadableLogRecord)); }); @@ -286,7 +286,7 @@ describe('OTLPLogsExporter - node with proto over http', () => { compression: CompressionAlgorithm.GZIP, httpAgentOptions: { keepAliveMsecs: 2000 }, }; - collectorExporter = new OTLPLogsExporter(collectorExporterConfig); + collectorExporter = new OTLPLogExporter(collectorExporterConfig); logs = []; logs.push(Object.assign({}, mockedReadableLogRecord)); }); @@ -331,7 +331,7 @@ describe('OTLPLogsExporter - node with proto over http', () => { }); describe('export - real http request destroyed before response received', () => { - let collectorExporter: OTLPLogsExporter; + let collectorExporter: OTLPLogExporter; let collectorExporterConfig: OTLPExporterNodeConfigBase; let logs: ReadableLogRecord[]; const server = http.createServer((_, res) => { @@ -351,7 +351,7 @@ describe('export - real http request destroyed before response received', () => url: 'http://localhost:8082', timeoutMillis: 1, }; - collectorExporter = new OTLPLogsExporter(collectorExporterConfig); + collectorExporter = new OTLPLogExporter(collectorExporterConfig); logs = []; logs.push(Object.assign({}, mockedReadableLogRecord)); @@ -368,7 +368,7 @@ describe('export - real http request destroyed before response received', () => url: 'http://localhost:8082', timeoutMillis: 100, }; - collectorExporter = new OTLPLogsExporter(collectorExporterConfig); + collectorExporter = new OTLPLogExporter(collectorExporterConfig); logs = []; logs.push(Object.assign({}, mockedReadableLogRecord)); @@ -383,7 +383,7 @@ describe('export - real http request destroyed before response received', () => }); describe('export - real http request destroyed after response received', () => { - let collectorExporter: OTLPLogsExporter; + let collectorExporter: OTLPLogExporter; let collectorExporterConfig: OTLPExporterNodeConfigBase; let logs: ReadableLogRecord[]; @@ -401,7 +401,7 @@ describe('export - real http request destroyed after response received', () => { url: 'http://localhost:8082', timeoutMillis: 300, }; - collectorExporter = new OTLPLogsExporter(collectorExporterConfig); + collectorExporter = new OTLPLogExporter(collectorExporterConfig); logs = []; logs.push(Object.assign({}, mockedReadableLogRecord)); diff --git a/experimental/packages/exporter-trace-otlp-grpc/.eslintrc.js b/experimental/packages/exporter-trace-otlp-grpc/.eslintrc.js index 3ed0fbeba3..9cfb3fd423 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/.eslintrc.js +++ b/experimental/packages/exporter-trace-otlp-grpc/.eslintrc.js @@ -4,5 +4,5 @@ module.exports = { "commonjs": true, "node": true, }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/exporter-trace-otlp-grpc/README.md b/experimental/packages/exporter-trace-otlp-grpc/README.md index b03274b320..32d4231870 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/README.md +++ b/experimental/packages/exporter-trace-otlp-grpc/README.md @@ -5,8 +5,7 @@ **Note: This is an experimental package under active development. New releases may include breaking changes.** -This module provides exporter for node to be used with OTLP (`grpc`) compatible receivers. -Compatible with [opentelemetry-collector][opentelemetry-collector-url] versions `>=0.16 <=0.50`. +This module provides a trace-exporter for OTLP (gRPC) traces using protocol version `v0.20.0`. ## Installation @@ -30,6 +29,7 @@ const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc' const collectorOptions = { // url is optional and can be omitted - default is http://localhost:4317 + // Unix domain sockets are also supported: 'unix:///path/to/socket.sock' url: 'http://:', }; @@ -54,6 +54,7 @@ const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc' const collectorOptions = { // url is optional and can be omitted - default is http://localhost:4317 + // Unix domain sockets are also supported: 'unix:///path/to/socket.sock' url: 'http://:', credentials: grpc.credentials.createSsl(), }; @@ -94,6 +95,7 @@ metadata.set('k', 'v'); const collectorOptions = { // url is optional and can be omitted - default is http://localhost:4317 + // Unix domain sockets are also supported: 'unix:///path/to/socket.sock' url: 'http://:', metadata, // // an optional grpc.Metadata object to be sent with each request }; @@ -120,6 +122,7 @@ The OTLPTraceExporter has a timeout configuration option which is the maximum ti const collectorOptions = { timeoutMillis: 15000, // url is optional and can be omitted - default is localhost:4317 + // Unix domain sockets are also supported: 'unix:///path/to/socket.sock' url: ':', metadata, // // an optional grpc.Metadata object to be sent with each request }; @@ -138,6 +141,7 @@ const { CompressionAlgorithm } = require('@opentelemetry/exporter-trace-otlp-grp const collectorOptions = { // url is optional and can be omitted - default is http://localhost:4317 + // Unix domain sockets are also supported: 'unix:///path/to/socket.sock' url: 'http://:', metadata, // // an optional grpc.Metadata object to be sent with each request compression: CompressionAlgorithm.GZIP, diff --git a/experimental/packages/exporter-trace-otlp-grpc/package.json b/experimental/packages/exporter-trace-otlp-grpc/package.json index 506bf706e8..bc14408e58 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/package.json +++ b/experimental/packages/exporter-trace-otlp-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-trace-otlp-grpc", - "version": "0.39.1", + "version": "0.44.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", @@ -15,7 +15,7 @@ "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "version": "node ../../../scripts/version-update.js", "watch": "tsc --watch --build", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" @@ -47,18 +47,20 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", - "@grpc/proto-loader": "^0.7.3", - "@opentelemetry/api": "1.4.1", - "@opentelemetry/otlp-exporter-base": "0.39.1", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@grpc/proto-loader": "^0.7.10", + "@opentelemetry/api": "1.6.0", + "@opentelemetry/otlp-exporter-base": "0.44.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "codecov": "3.8.3", "cpx": "1.5.0", - "mocha": "10.0.0", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4" @@ -68,11 +70,11 @@ }, "dependencies": { "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.13.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.39.1", - "@opentelemetry/otlp-transformer": "0.39.1", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/otlp-grpc-exporter-base": "0.44.0", + "@opentelemetry/otlp-transformer": "0.44.0", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-trace-otlp-grpc", "sideEffects": false diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts index 17e5511010..f22fc95d2a 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts +++ b/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts @@ -49,9 +49,11 @@ const includeDirs = [ path.resolve(__dirname, '../../otlp-grpc-exporter-base/protos'), ]; -const address = 'localhost:1501'; +const httpAddr = 'https://localhost:1501'; +const udsAddr = 'unix:///tmp/otlp-traces.sock'; type TestParams = { + address?: string; useTLS?: boolean; metadata?: grpc.Metadata; }; @@ -59,10 +61,11 @@ type TestParams = { const metadata = new grpc.Metadata(); metadata.set('k', 'v'); -const testCollectorExporter = (params: TestParams) => - describe(`OTLPTraceExporter - node ${ - params.useTLS ? 'with' : 'without' - } TLS, ${params.metadata ? 'with' : 'without'} metadata`, () => { +const testCollectorExporter = (params: TestParams) => { + const { address = httpAddr, useTLS, metadata } = params; + return describe(`OTLPTraceExporter - node ${ + useTLS ? 'with' : 'without' + } TLS, ${metadata ? 'with' : 'without'} metadata, target ${address}`, () => { let collectorExporter: OTLPTraceExporter; let server: grpc.Server; let exportedData: IResourceSpans | undefined; @@ -97,7 +100,7 @@ const testCollectorExporter = (params: TestParams) => }, } ); - const credentials = params.useTLS + const credentials = useTLS ? grpc.ServerCredentials.createSsl( fs.readFileSync('./test/certs/ca.crt'), [ @@ -108,10 +111,15 @@ const testCollectorExporter = (params: TestParams) => ] ) : grpc.ServerCredentials.createInsecure(); - server.bindAsync(address, credentials, () => { - server.start(); - done(); - }); + const serverAddr = new URL(address); + server.bindAsync( + serverAddr.protocol === 'https:' ? serverAddr.host : address, + credentials, + () => { + server.start(); + done(); + } + ); }); }); @@ -120,7 +128,7 @@ const testCollectorExporter = (params: TestParams) => }); beforeEach(done => { - const credentials = params.useTLS + const credentials = useTLS ? grpc.credentials.createSsl( fs.readFileSync('./test/certs/ca.crt'), fs.readFileSync('./test/certs/client.key'), @@ -128,9 +136,9 @@ const testCollectorExporter = (params: TestParams) => ) : grpc.credentials.createInsecure(); collectorExporter = new OTLPTraceExporter({ - url: 'https://' + address, + url: address, credentials, - metadata: params.metadata, + metadata: metadata, }); const provider = new BasicTracerProvider(); @@ -149,7 +157,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 OTLPTraceExporter({ - url: `http://${address}`, + url: address, headers: { foo: 'bar', }, @@ -158,9 +166,13 @@ const testCollectorExporter = (params: TestParams) => assert.strictEqual(args[0], 'Headers cannot be set when using grpc'); }); it('should warn about path in url', () => { + if (new URL(address).protocol === 'unix:') { + // Skip this test for UDS + return; + } const spyLoggerWarn = sinon.stub(diag, 'warn'); collectorExporter = new OTLPTraceExporter({ - url: `http://${address}/v1/trace`, + url: `${address}/v1/trace`, }); const args = spyLoggerWarn.args[0]; assert.strictEqual( @@ -198,7 +210,7 @@ const testCollectorExporter = (params: TestParams) => }, 500); }); it('should log deadline exceeded error', done => { - const credentials = params.useTLS + const credentials = useTLS ? grpc.credentials.createSsl( fs.readFileSync('./test/certs/ca.crt'), fs.readFileSync('./test/certs/client.key'), @@ -207,9 +219,9 @@ const testCollectorExporter = (params: TestParams) => : grpc.credentials.createInsecure(); const collectorExporterWithTimeout = new OTLPTraceExporter({ - url: 'grpcs://' + address, + url: address, credentials, - metadata: params.metadata, + metadata: metadata, timeoutMillis: 100, }); @@ -230,7 +242,7 @@ const testCollectorExporter = (params: TestParams) => }); describe('export - with gzip compression', () => { beforeEach(() => { - const credentials = params.useTLS + const credentials = useTLS ? grpc.credentials.createSsl( fs.readFileSync('./test/certs/ca.crt'), fs.readFileSync('./test/certs/client.key'), @@ -238,9 +250,9 @@ const testCollectorExporter = (params: TestParams) => ) : grpc.credentials.createInsecure(); collectorExporter = new OTLPTraceExporter({ - url: 'https://' + address, + url: address, credentials, - metadata: params.metadata, + metadata: metadata, compression: CompressionAlgorithm.GZIP, }); @@ -265,7 +277,7 @@ const testCollectorExporter = (params: TestParams) => assert.ok(typeof resource !== 'undefined', "resource doesn't exist"); ensureResourceIsCorrect(resource); - ensureMetadataIsCorrect(reqMetadata, params.metadata); + ensureMetadataIsCorrect(reqMetadata, metadata); done(); }, 500); @@ -274,7 +286,7 @@ const testCollectorExporter = (params: TestParams) => describe('Trace Exporter with compression', () => { const envSource = process.env; it('should return gzip compression algorithm on exporter', () => { - const credentials = params.useTLS + const credentials = useTLS ? grpc.credentials.createSsl( fs.readFileSync('./test/certs/ca.crt'), fs.readFileSync('./test/certs/client.key'), @@ -284,9 +296,9 @@ const testCollectorExporter = (params: TestParams) => envSource.OTEL_EXPORTER_OTLP_COMPRESSION = 'gzip'; collectorExporter = new OTLPTraceExporter({ - url: 'https://' + address, + url: address, credentials, - metadata: params.metadata, + metadata: metadata, }); assert.strictEqual( collectorExporter.compression, @@ -296,6 +308,7 @@ const testCollectorExporter = (params: TestParams) => }); }); }); +}; describe('OTLPTraceExporter - node (getDefaultUrl)', () => { it('should default to localhost', done => { @@ -361,3 +374,5 @@ describe('when configuring via environment', () => { testCollectorExporter({ useTLS: true }); testCollectorExporter({ useTLS: false }); testCollectorExporter({ metadata }); +// skip UDS tests on windows +process.platform !== 'win32' && testCollectorExporter({ address: udsAddr }); diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/ca.crt b/experimental/packages/exporter-trace-otlp-grpc/test/certs/ca.crt index 27e1d6826b..c194f04954 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/ca.crt +++ b/experimental/packages/exporter-trace-otlp-grpc/test/certs/ca.crt @@ -1,33 +1,33 @@ -----BEGIN CERTIFICATE----- -MIIFozCCA4ugAwIBAgIUC57UkrmvltHwm0jdwHjbFx/wIcMwDQYJKoZIhvcNAQEL +MIIFozCCA4ugAwIBAgIUFA6cfBQ2t0ZOpLTRUIE6VN+kGBkwDQYJKoZIhvcNAQEL BQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQHDBFPcGVuVGVs ZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9vdDENMAsGA1UECwwEVGVzdDELMAkGA1UE -AwwCY2EwHhcNMjIwNjA4MDk1MzU5WhcNMjMwNjA4MDk1MzU5WjBhMQswCQYDVQQG +AwwCY2EwHhcNMjMwNjA4MTY0NDIzWhcNMjQwNjA3MTY0NDIzWjBhMQswCQYDVQQG EwJDTDELMAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0w CwYDVQQKDARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTCCAiIwDQYJ -KoZIhvcNAQEBBQADggIPADCCAgoCggIBANu7HBCDdS5EStAQP7W4K17xcEzGWB9w -+m8/pZpMIQMVJ0AvvxkGC1rp/uYzcFKjymCqOqFRjTVza5s3ltk6DEJKbwkszAIi -UTA26/AIKxy9iWCqbqS34utSIA8SfUDJx+Nb9PHW2/BZ9DqLsNqxUeq/3NO59z3/ -uMQt3rM7ijO8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NVHSMEGDAWgBSwH/Wk2wTc+MEPAEornj1eGKra0zAPBgNVHRMBAf8EBTAD +AQH/MA0GCSqGSIb3DQEBCwUAA4ICAQCNkzOjjqH3qeQ0wT/Has5PSoWwRwq+B1JT +gg29bgEMD6dVkLdzgEuRVVkMtc/tCZAkA02pc0VN8+lNLW7ckNU/QhMTQYn+FgMR +cG86vR9loTnwUrxR4dS6Nbx1sQ7hpe2GZkWpTNmjh1duHBNHv9nS2JmMkRypqRne +oAI3/th1Qlrtl/zDn02/+P5/av0YJcMOcnRkULHnI62cbXHa2iPd/nENgH2xC6CA +EuYN/bnmOEUPeKljU1IZS6asjGMLdWLmpLs7oOcHGLD3pax+om69Pmn7rps8Z071 +WsJDHFCftItCUrg4KWwpXr77Vq4WAN2tOBdDHEZsbES6a54+7sc1QKOVSWwPuGEd +ShFHhTzoaB0dpwm6kLdYsEkC8JLIjV+Ikg5X3VTDITjUlHoJf2mxCGOzBiCnUr75 +Am0eBqlVcc/2aVk1tcVS9N7reY/KcMaAJvI314O9I94pYdIIm5jw3UmA9Y6HmpN0 +vYtQUF2sS5W82XoFD8bpOq/bx1o2ib2x32dfPQkVgd4sbmpsyN62Fy1HpHwXtXno +xGVaDzGSWj/7RyYyKhNmp3nfQsU0Tt6iVkM+N30vl2heZqEUgXxCG9qHVzWv9z6x +AJzuafjM8tviROpiHkvzsmq7uDhksGooKCi+m+eoEBJrd0J4gjngAi1NYjTsB2GT +4mvPz05UkA== -----END CERTIFICATE----- diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/ca.key b/experimental/packages/exporter-trace-otlp-grpc/test/certs/ca.key index 3ca1e8e149..00ccb04622 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/ca.key +++ b/experimental/packages/exporter-trace-otlp-grpc/test/certs/ca.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKQIBAAKCAgEA27scEIN1LkRK0BA/tbgrXvFwTMZYH3D6bz+lmkwhAxUnQC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yB1up8zO28p+H3g8wSC/Qf +RB8viBO9j5l4tpr6Qq05zNVaRP2kEcEO7IHxixmU+mLqeua0B1EYFhuB6adt5KyJ +Yq/CV6kitxVD00jbV+cFoIMZnm3PtAdiQb6CtBfVjWcenyj4i2AE8C7+jK/gzvoY +BAqhICUJFvJDtWjYOdf2FbjJYhZhMthgI3qlGQESuNBivOcOfTEkNa6Rqn6qkqF/ +BylLdfkCggEAH5d4UxmAsT+HiPz5Jc8fJXb9ayA60nw0z83QrZC2Jufob8cDBIWL +kNRGctlc9JJVMusfMQPbzwsNQxuOlnwhKjshYhiPSG9zg59IIMWla5RHqlx3mlq5 +Erly+BJg6nb8/7BTGFLE06kCSkRc5m0bXaaU6EyqtQIilGzBZe+VfVgzF/AdW7xl +K2NmdXg8poC+hdg1kJ3KblULzZJ6A+LaOoeyAtKcdpf7ZiRfeM5smIOTSGmUMUEe +Duqno/XZ7xVAElJ95k3a1z+BJvMvy80aoCKgROskDdcnOUQbohx2+O5W85aWNX59 +a7e9ab8H9TkVAy2EoCu4K0KBGhaUvxMLXQKCAQAORESNb5Ne+bBHbrSA6nVMH0Ti +Gt9Nx2bgNLxgGPGHLIFkQPnR9akk8mm94T/Ow1y8Jrx/rE0bxR0ayVYbxLiF+Zqz +i/G+CYGg72j+PXdugo4ocfGf17BpqR577uqUAycvtsk50zTgxYyoob5HxdXcFjnH +PEiJBGSSSY1VJJlPxIftHLE6ULfwslyMkHPGBxh6NJe/nkM7obuQYMc7JGpNngLb +G5NF6b8nV5yJ7a5hhhSbArFWuzlfbRsZwgqadWFDChXiAyCbzE5ey5gUOs22K4Ax +M4Ky5evO6Srk3gtFGCWPqSxcDJk57DSy/on35IwerlQTI6Btz0OT6EmDWXOn -----END RSA PRIVATE KEY----- diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.crt b/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.crt index cb5c4508d7..fd05c9c40b 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.crt +++ b/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.crt @@ -1,31 +1,31 @@ -----BEGIN CERTIFICATE----- MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjIwNjA4MDk1NDAxWhcN -MjMwNjA4MDk1NDAxWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjMwNjA4MTY0NDI2WhcN +MjQwNjA3MTY0NDI2WjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZD bGllbnQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCAiIwDQYJKoZIhvcNAQEBBQADggIP -ADCCAgoCggIBAMo9AlVbqKk0NI3U4IPhXARrA/9HCtW6TK8bNj+KqBETPJ0OV6Ep -FC1AUG8h6ZpQy1lAVchMOXXzVIxejJ53Wq2aBMELl7KaheEUAzbQNqSBxL7cY61l -sk1rd0ryQ0167j/tNV5h3FH4ZawD7vt2oGte4Dxipj+gFQx/MXD1j2vOKm0SO6xr -IdSWg79HRnMb6mJMCtTc6kvX5XDN3avwrhndsPKZREhs1ei6lhY4ip3N70357MB6 -vNF7euAMQU7KZ0uZZbj0lqINT+6jwEJ6yhkZM9ILKbxC8+IAhCAOsu2bKXtkhDSN -V+3Jr3x8PRWlhlCitGt9a8/DlT0RIfcXQHRmY7hdnMqt+7vJio56oHcyv2+8ap+C -rWr5OfsRuQvSs3ebn1zhDim0AspKOfdwGepPubgM/MuilYIi35L6CbRp+VbSGmIy -GUOGoWa3uykcMOm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y3+nzke7I4CWKtLJUSamQiyOC3CBVkRX0YEYUBhMXim6dKAfiOEV6K3bwiU+YZ +aDe0lEeLbzAp87DKRTAvDYhRMIFtD3g2qmYrWpQ4gj8vSEorNAfg3kVHMFRGlk9o +jaFduAz0hKk+QG5SgePXMph5ZRXGRq0FnDbF2gZ7WV+jZiIhsYGJ43+RBWHh4HO4 +P4h9eOWQG8AxpDRmOo2KmyPbV0V/eltC4N0oOAmWz+i0qqulnpG4dOzQKpinRBBr +jPt5 -----END CERTIFICATE----- diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.csr b/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.csr index 30ac376794..b783896725 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.csr +++ b/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.csr @@ -2,27 +2,27 @@ MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGQ2xp ZW50MRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQDKPQJVW6ipNDSN1OCD4VwEawP/RwrVukyvGzY/iqgREzydDlehKRQt -QFBvIemaUMtZQFXITDl181SMXoyed1qtmgTBC5eymoXhFAM20DakgcS+3GOtZbJN -a3dK8kNNeu4/7TVeYdxR+GWsA+77dqBrXuA8YqY/oBUMfzFw9Y9rziptEjusayHU -loO/R0ZzG+piTArU3OpL1+Vwzd2r8K4Z3bDymURIbNXoupYWOIqdze9N+ezAerzR -e3rgDEFOymdLmWW49JaiDU/uo8BCesoZGTPSCym8QvPiAIQgDrLtmyl7ZIQ0jVft -ya98fD0VpYZQorRrfWvPw5U9ESH3F0B0ZmO4XZzKrfu7yYqOeqB3Mr9vvGqfgq1q -+Tn7EbkL0rN3m59c4Q4ptALKSjn3cB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A9fLLtIEgeN/XDSvNDBs +YdwBrx2HTatK7QCJ5e+4ACs6Wc2c1nnDviPddpxUgl0pHKcMbT+xNk7bY5fjl5Qr +wzuBNgvQcsZxNNvI8bs13k/eBmKrKOV2WUP1mHRzSoxPX3gzGRSWCe/7QR51oWlB +Qkb6OGVGLCKPnhIKFeZ6G1Qv8q7/hOOlmWGO4bN7s5fjAKEsm3JV1xrsqSKRofRG +JfdPjQD88jewIAk6xGSMKmc4usQN+y/IfU8yZ57MHSHULccA1Wl/VXfgKCAxS5fK +uXtm -----END CERTIFICATE REQUEST----- diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.key b/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.key index fd649acf54..58414d8d59 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.key +++ b/experimental/packages/exporter-trace-otlp-grpc/test/certs/client.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKQIBAAKCAgEAyj0CVVuoqTQ0jdTgg+FcBGsD/0cK1bpMrxs2P4qoERM8nQ5X -oSkULUBQbyHpmlDLWUBVyEw5dfNUjF6MnndarZoEwQuXspqF4RQDNtA2pIHEvtxj -rWWyTWt3SvJDTXruP+01XmHcUfhlrAPu+3aga17gPGKmP6AVDH8xcPWPa84qbRI7 -rGsh1JaDv0dGcxvqYkwK1NzqS9flcM3dq/CuGd2w8plESGzV6LqWFjiKnc3vTfns -wHq80Xt64AxBTspnS5lluPSWog1P7qPAQnrKGRkz0gspvELz4gCEIA6y7Zspe2SE -NI1X7cmvfHw9FaWGUKK0a31rz8OVPREh9xdAdGZjuF2cyq37u8mKjnqgdzK/b7xq -n4Ktavk5+xG5C9Kzd5ufXOEOKbQCyko593AZ6k+5uAz8y6KVgiLfkvoJtGn5VtIa -YjIZQ4ahZre7KRww6biEgrptsU4ZROLFvAiNF/HO4988uogr5pDmQFJR0OEr0sek -04yfRGKFcGhF8TdV+e5ZVx62n8UbsHk9OAK8/RKz1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zrn9P4Jr/PVOcUnp8ac4s7nr3KTpA/IKsbbVMGPRKegw7FSddr +ros57KltjQB5+kxlgb8V0FbubXO/a4r1AoIBAQC6GfLZDflLbmGx9cd7OV3nLm5m +hlfKuKwkYa7gKLGgR56/eKbqy/SY+y4K4xQLiNgVyayuUSqd8+fupESaG8J+kY6N +3K7LjdWzYzIJDYnonyqueqsn437CltWG0iBjpPZztexAiI8qk/jVniwIEOHzc4Cb +tPCP51NBbj0dSP9EFB+LbHh2F+zO0DkraA4P+bvKA6GLtfRPfqBi2rz9VVIvV0oR +sM6qfGJVECOxAc5seFSUO8RzEoNf5KQ+ATeRhWJQqGIhw+lP23w1rDv8FOWgxoxw +9O4IfGsSH6V+KYMN7wDx1Sebpw2IosCoGOjWHSH7mJcWy/uqocAirdf5fEeE -----END RSA PRIVATE KEY----- diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/regenerate.sh b/experimental/packages/exporter-trace-otlp-grpc/test/certs/regenerate.sh index e1f1af5b54..84637be753 100755 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/regenerate.sh +++ b/experimental/packages/exporter-trace-otlp-grpc/test/certs/regenerate.sh @@ -8,15 +8,15 @@ rm ca.crt ca.key client.crt client.csr client.key server.crt server.csr server.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 -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 -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 -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 -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 +openssl genrsa -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/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.crt b/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.crt index da8b6beedd..ace156a29e 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.crt +++ b/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.crt @@ -1,31 +1,31 @@ -----BEGIN CERTIFICATE----- MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjIwNjA4MDk1NDAwWhcN -MjMwNjA4MDk1NDAwWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjMwNjA4MTY0NDI0WhcN +MjQwNjA3MTY0NDI0WjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAY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54i3CoAkQbi5YeUdEZD6 +/mNLs/BABgzSbANw7Fn1Pd9gY/JIsRhMskcFRqXe9tOqKk8/GxMv/r9MgJn6HHlk +iDa3OZsoOtFbjjOPFoy/Xq9YMi4ODnJkEhe7BSsVl/wkDAUdg7Zfu8XVAgMBAAEw +DQYJKoZIhvcNAQELBQADggIBAEft+R+qGyKffiiJpYWLPn0C9SmpjZiWPK331n57 +Nk3GA8u9gRgD1gyqqLr19r86nLArF8jcB/nChPB1A9ysW3xyTNvpOlAwYvEjxWR2 +tJr8wiDucAd+SnQud6e+5PI5e8LnyxYoeoZ+i6hMbhNV70NthoINHMAQx+5NeSpa +Q0GJ4d0XA3W/8Pu6oK7O0QkVovVut73Koz5DqsF91zFJp7SjVKaCnnjRKyU8wbg5 +uTO0TRheEtx3AeEXNps5Yhq0daLTnmnuFeyaJHm2F1QuBmma1TTwIF3HDclv2wLn +Jp+MWG9yoN9oEJLqS/AvDu1BltPSuvnYgLZr7cl0os+TEqpzxroa4ziE98dEiy0D +K4YQ59UTz6C8Ps0uX0hcs3jsvZOkBWptusvJBfZN59xLJAVmF2igkgIBKoiXvXmv +fXDx0hsOBg2IPe2O8lLHlFKlJZlMc+prH1iD0Xv6HefSP4L1eZHU37zjrRf/GiNX +r6GoEhJR2pKEoZQT81xpYp/w+qjzWcTl/mLD6FEePRzV92h3ubjRWBB36UhLtnEG +LJgp7yq3aGu7rg9rnuz8J6DG8DStE9rNuRjkV1O2C/PvR97XmVoIqbrMlxX9MUQJ +XxLm5dqBz7EVuhDJSyp4zCkDYsOj1y/SLL2O3cTyQQeZg6jlqripNqWnviAdTWe5 +JIPp -----END CERTIFICATE----- diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.csr b/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.csr index d8ab7deb4b..b421a7a60c 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.csr +++ b/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.csr @@ -2,27 +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0Dxaa5jw1rY4ltI3DA95B +1fNfa9hfGonSjfeEPtyiPjf5sJ9UHQ1bKrogqtMG0eeItwqAJEG4uWHlHRGQ+v5j +S7PwQAYM0mwDcOxZ9T3fYGPySLEYTLJHBUal3vbTqipPPxsTL/6/TICZ+hx5ZIg2 +tzmbKDrRW44zjxaMv16vWDIuDg5yZBIXuwUrFZf8JAwFHYO2X7vF1QIDAQABoAAw +DQYJKoZIhvcNAQELBQADggIBAJCMEdjKyklN2izvOhd7+JMXm/ClW3hjowbu+csO +JNz8NqUNLrKJjFyV3yAUGWuyp3z982S+XGfcm3nU7n9AJOjT4DLJId6opOtA6CSp +KTRgVZmeViL6O6UqBLTacz5DDjwMQXxszc+QpU53cMT6Y7VMvIOhQ6AmIvz1v71u +5gaYmlbfXVlmiPHEKRsQG9/DNIPe1mHP0p+S9qYKmCx7Jlpee7IstW/hNjt7alDn +uFaxFjxmCCSdWaMRyMW/qNRks9q3VdhJPan+amFeXceoEG7SOKiFiOc8A7DribSm +iKc2YlOw14xqc+cJutiKBvoBMri2eh1JgCbPT4ufVGFpbDkfYwAJxWx44Eg0X90j +gJUw8IRuHQZkEYss6jwFMFcOqjpe+AqrssOl4GZmu5gcaiUnj8PkSVZLTOrLilPg +sSDjzmoHdv4QcBppTrjj6PyR5Xd6DeGasWkMPvIPjiPN3mOhfxJ3C87atMqOhTLx +em7vFOBegAW6g40J9JD1XMoI/zFnTU8NevZQgCyx/Tq1XNRmUeMA6y/qpfTNKi/f +F7v/7nDWoxBgpOw3J0E9R+6rxD7Cjb2RWZEf20ZGdNBlPE+UG9c9b3HC3IHiwRHb +L9Fi0251w+fkaPX8dojQKErCEknqJ1SCP5S5F5g1QCQby22Y7LQsggMMf94s/wQX +4uMh -----END CERTIFICATE REQUEST----- diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.key b/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.key index 9147802e7d..80b9cea7bf 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.key +++ b/experimental/packages/exporter-trace-otlp-grpc/test/certs/server.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKAIBAAKCAgEAoXjBuGPBN3TjwJ22q42OG5UYi8/Gl01oI9dtIk32OhGpHCnS -+3gOdF8tZ1rfhTNn1/Fc3gdOBivMtiSt05SG+i6uGORraaNyzWQ6OV8V4bCAl7wt -NUbqoT4t0kXDjE93nd1m2w3V1BqPt78aUriM0jr2q2rXp2cWzCNvMAjraiv0wd3N -jgV8QVF4yvbmQZKj7+c3AjbU9uIyFn45JO6hKCibHomZdRgb365kVlOsT5+fjuMw -rjAG/Vb5TYPXDYCh/TWXJ9BD+CIxjpdQAg8cjIES8XIXWx1T5knO5uXe88bN/zgh -/z7fWJixgSipHe/Bizv5+YBZc5xeeMvw3RCpk9Pft+wosXWX5YLGFYsyVzzH0qrw -Z7OY4lGtHePlSL67HpOlBXdohePfKRQh4MgjBE82wOvDMks0bbxhUxXWvPj5Xb8y -xDgwvUyKU/dkH27FQ3f3Ve6UvGxAjSiW/4tmopieqp4dsUO3rUevhaZ5+oqoHiuU -7WNYfhIsITKTNOgVCkr0xCk+ZQnZRmu503d+UkZnxumca7aADauCp96MHnYPmOll -PNNFT05mnW/olaONGHe9ypVKKfSY8sRdCPXVyko4HMgESOqg+2meMfxJB32Zvuf+ -jmryAtK5Nw6qfeUsfcO8tMGKWyY1whsEi2kLpAZzkRWo+UAkoi8u84ZvoHkCAwEA -AQKCAgB16ox1TgvEpszHVaUXZJk5VUkGmKXqyfFZ8zDUU2CTiWAYnAZh84uCuhqb -FoaSbDbSQIVT8rus0AF/pgt2rklfnAUxUmWKUH0+tom6adC97roJlLbi6DXhqFmn -66Bg74tnsk4xe8oCSZ9YTOs5K2JTCBIoni58JlFEpD/HMUxRTWZAyOwaYbEathdj -CKifjCnBwPSv3kDpRcfUGzs52DXB8N1OkKeLFh8M2vqU/CeiQewwWYKsQZBpI0GN -tNCwIJarJZ6LyZB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Upnr1iVmeDvadKu9IAi7LgPpV26ar4D -----END RSA PRIVATE KEY----- diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/traceHelper.ts b/experimental/packages/exporter-trace-otlp-grpc/test/traceHelper.ts index 6ce80bf2c2..62157741a8 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/test/traceHelper.ts +++ b/experimental/packages/exporter-trace-otlp-grpc/test/traceHelper.ts @@ -114,49 +114,49 @@ export function ensureExportedEventsAreCorrect(events: IEvent[]) { [ { attributes: [], - timeUnixNano: '1574120165429803008', + timeUnixNano: '1574120165429803070', name: 'fetchStart', droppedAttributesCount: 0, }, { attributes: [], - timeUnixNano: '1574120165429803008', + timeUnixNano: '1574120165429803070', name: 'domainLookupStart', droppedAttributesCount: 0, }, { attributes: [], - timeUnixNano: '1574120165429803008', + timeUnixNano: '1574120165429803070', name: 'domainLookupEnd', droppedAttributesCount: 0, }, { attributes: [], - timeUnixNano: '1574120165429803008', + timeUnixNano: '1574120165429803070', name: 'connectStart', droppedAttributesCount: 0, }, { attributes: [], - timeUnixNano: '1574120165429803008', + timeUnixNano: '1574120165429803070', name: 'connectEnd', droppedAttributesCount: 0, }, { attributes: [], - timeUnixNano: '1574120165435513088', + timeUnixNano: '1574120165435513070', name: 'requestStart', droppedAttributesCount: 0, }, { attributes: [], - timeUnixNano: '1574120165436923136', + timeUnixNano: '1574120165436923070', name: 'responseStart', droppedAttributesCount: 0, }, { attributes: [], - timeUnixNano: '1574120165438688000', + timeUnixNano: '1574120165438688070', name: 'responseEnd', droppedAttributesCount: 0, }, @@ -235,12 +235,12 @@ export function ensureExportedSpanIsCorrect(span: ISpan) { assert.strictEqual(span.kind, 'SPAN_KIND_INTERNAL', 'kind is wrong'); assert.strictEqual( span.startTimeUnixNano, - '1574120165429803008', + '1574120165429803070', 'startTimeUnixNano is wrong' ); assert.strictEqual( span.endTimeUnixNano, - '1574120165438688000', + '1574120165438688070', 'endTimeUnixNano is wrong' ); assert.strictEqual( diff --git a/experimental/packages/exporter-trace-otlp-http/.eslintrc.js b/experimental/packages/exporter-trace-otlp-http/.eslintrc.js index e41d9a9299..c054089042 100644 --- a/experimental/packages/exporter-trace-otlp-http/.eslintrc.js +++ b/experimental/packages/exporter-trace-otlp-http/.eslintrc.js @@ -5,5 +5,5 @@ module.exports = { "node": true, "browser": true }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/exporter-trace-otlp-http/README.md b/experimental/packages/exporter-trace-otlp-http/README.md index f5944a047b..141a4a2765 100644 --- a/experimental/packages/exporter-trace-otlp-http/README.md +++ b/experimental/packages/exporter-trace-otlp-http/README.md @@ -5,8 +5,7 @@ **Note: This is an experimental package under active development. New releases may include breaking changes.** -This module provides exporter for web and node to be used with OTLP (`http/json`) compatible receivers. -Compatible with [opentelemetry-collector][opentelemetry-collector-url] versions `>=0.48 <=0.50`. +This module provides a trace-exporter for OTLP (http/json) using protocol version `v0.20.0`. ## Installation diff --git a/experimental/packages/exporter-trace-otlp-http/package.json b/experimental/packages/exporter-trace-otlp-http/package.json index 2910830372..a9bb8fc47f 100644 --- a/experimental/packages/exporter-trace-otlp-http/package.json +++ b/experimental/packages/exporter-trace-otlp-http/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-trace-otlp-http", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenTelemetry Collector Trace Exporter allows user to send collected traces to the OpenTelemetry Collector", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -23,10 +23,10 @@ "tdd": "npm run test -- --watch-extensions ts --watch", "tdd:browser": "karma start", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" @@ -63,42 +63,44 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", - "@opentelemetry/api": "1.4.1", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@opentelemetry/api": "1.6.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "@types/webpack-env": "1.16.3", - "babel-loader": "8.2.3", + "babel-loader": "8.3.0", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", "cpx": "1.5.0", + "cross-var": "1.1.0", "fetch-mock": "9.11.0", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", "webpack": "4.46.0", - "webpack-cli": "4.9.1", - "webpack-merge": "5.8.0" + "webpack-cli": "4.10.0", + "webpack-merge": "5.9.0" }, "peerDependencies": { "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/otlp-exporter-base": "0.39.1", - "@opentelemetry/otlp-transformer": "0.39.1", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/otlp-exporter-base": "0.44.0", + "@opentelemetry/otlp-transformer": "0.44.0", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-trace-otlp-http", "sideEffects": false diff --git a/experimental/packages/exporter-trace-otlp-http/test/certs/ca.crt b/experimental/packages/exporter-trace-otlp-http/test/certs/ca.crt deleted file mode 100644 index 529ce2f7b8..0000000000 --- a/experimental/packages/exporter-trace-otlp-http/test/certs/ca.crt +++ /dev/null @@ -1,33 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFozCCA4ugAwIBAgIUa6OxgyEYxNjpjac0jTAKn+IkGTYwDQYJKoZIhvcNAQEL -BQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQHDBFPcGVuVGVs -ZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9vdDENMAsGA1UECwwEVGVzdDELMAkGA1UE -AwwCY2EwHhcNMjEwNjA3MjAxMDExWhcNMjIwNjA3MjAxMDExWjBhMQswCQYDVQQG -EwJDTDELMAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0w -CwYDVQQKDARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTCCAiIwDQYJ -KoZIhvcNAQEBBQADggIPADCCAgoCggIBAMbVyp3NCtDwKpGbV+MCML63o+vGVhpd -Dlt3ncpcwz0FMK6UJDXzTe4joKCaezWto3Bmhb28Lezcf8AdzmTdnoENAaqUX2SE -giGVoeaJ/M1hW1IiOffa9zIMkt6cwf8MUUMl5kTRMdAqmpikNqN0rqNpaGuqBYf9 -kvDy3hw+dj19hKEeEXI2zt/HYDOBHYgpalWiOS8qwj0zSfxAUeura+eXKMlx0JOY -h5N25OUH1oLt1flhyuHnwRThKbvyMnL36Ey+G7uCFH0hQSGO0BLhg1LPDWG1PmTn -KzsvqaIgDF/tMCXykvaWcsSxrhvsNeOFFmmkKp1ECVOFgFYsGuK8lJlEvm6Owrvz -4X69L0phCJtaCCaSUFdybqx+G2ZKLZNqTtnMw/3YECp37KyrR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w+/Ou8bxWs3BuCQvFcG2+FBMWh0dL1FxVq3BPyq -oveTgr1sfQ== ------END CERTIFICATE----- diff --git a/experimental/packages/exporter-trace-otlp-http/test/certs/ca.key b/experimental/packages/exporter-trace-otlp-http/test/certs/ca.key deleted file mode 100644 index df94d44c38..0000000000 --- a/experimental/packages/exporter-trace-otlp-http/test/certs/ca.key +++ /dev/null @@ -1,54 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,7EE0C188F59416E9 - -C6U1lvr1RyEnqzF5P05cyDgQChQICuJIj1C6N8CA/5izdK1kk84qSHlrHYZD9bOC -VKljHd9D7OMlGOxwdMC6/3y8tXQTj4AGEuESMqQyUdgl6odGMa5bjjdrMT4Ul0AR -Ngxm9JRLG6YJdM9uXVIYK9AgyT1cSlcmdKUrtmRgy9+ObrkiDht7Z13tvWKkieVG -/xf7aLZ6hFja3X1RPgWIMVTBOqJO8a1HBReVrfiVe7CRWGHbOPlRZLYL3bWywQ0p -JWRaoY5uF0WQqu03T3lRNxPBpRfJeo2qkzNc5nabp5ZHqUYblVNmsSksADsTKXxV -NIu/sShtQzChu5QqlPbf7aYEC3jp8VjkPhxQLQ/s3t/PRG+uyFlgk8jgD1rYX4TD -5Bwzk/enm3AmqvKLLydjeSm0NX5Z0fjCjZj/I3SKiDV4l6XHVIya9KCuTAOZesl7 -fmj7UGjwgvHIz1F+EJOc7ItEj0WcJ7bJkZGp9ol0F2Q+x46Yls3ByOwJS49r6VF2 -htpWMwV07V1UifdifUzEIwMr354P45VncloYEokhx25VBMsDuzrr27AO5UlxLuMP -m7gG/NJb5z2aISvAXGoPxr4Wfh0o60C8Jc1HIwpgfgOhnn+Ix1NvnVPqPPFaSIRv -xNm2yAEnc/cm0tOMFXTxyntqp7R8S5Zj8ehQkXRHbh98scZX2nhQIXSUFfwLLgqL -Z9eBrOhuWn3L7HfVzkYoKXL04uc3HLMedxqxKwS+xsNIKI3n7FntR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N6RwK6V+kEZrHrBCQoXGtSM96opTM878krkcRap7ci -nwnP/EvD5CfNgT7uGn/dleNs5f4325PYA2uGPgBfJIpTkgGR7DyUjR8AU4mP8hwc -j0GydgSuYF0AOUNQRZuiNlHT3Buio7lKJMmwuuLFSACcnp9LVBhRgbypDRIxGSFw -GST/70V5OaDibFC7bl37pbKh1qzBqVB1qlylqxvS/ZID3iMEqjuuumYBO11Pkm1f ------END RSA PRIVATE KEY----- diff --git a/experimental/packages/exporter-trace-otlp-http/test/certs/client.crt b/experimental/packages/exporter-trace-otlp-http/test/certs/client.crt deleted file mode 100644 index b1519dede6..0000000000 --- a/experimental/packages/exporter-trace-otlp-http/test/certs/client.crt +++ /dev/null @@ -1,31 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV -BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjEwNjA3MjAxMDExWhcN -MjIwNjA3MjAxMDExWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV -BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZD -bGllbnQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCAiIwDQYJKoZIhvcNAQEBBQADggIP -ADCCAgoCggIBAN1or7F+548RpVIgdrzYmuWgKMfWsO5FhgqpGp+xuoVgMMTlZM3i -yiarMnAE0G6ZVMwqCeXkiUGL9QLatJ1S/HO2sWLUkWaPD7X7O4k1yGtl6UsRcr4K -+YBUbucxfrCQjaWKlBc1GMBrDyY/u/rl0CIYu3GtegniN6HG6rBXC2e98DVctQ3M -r/RXB9DWqMC2KW2X92X+FyWqTfGjv8wjRnhQdDNXPA/PCembzhfCL8VlmG65rDiz -V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ikJZWhVvDrK -IcKRHpkmrzLJbatxeDNlCtLRSAXeuTheLqqSA2HACReNYkQLPd5V7mY6uRw3d3o6 -3rKe ------END CERTIFICATE----- diff --git a/experimental/packages/exporter-trace-otlp-http/test/certs/client.csr b/experimental/packages/exporter-trace-otlp-http/test/certs/client.csr deleted file mode 100644 index 2d99fab566..0000000000 --- a/experimental/packages/exporter-trace-otlp-http/test/certs/client.csr +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH -DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGQ2xp -ZW50MRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQDdaK+xfuePEaVSIHa82JrloCjH1rDuRYYKqRqfsbqFYDDE5WTN4som -qzJwBNBumVTMKgnl5IlBi/UC2rSdUvxztrFi1JFmjw+1+zuJNchrZelLEXK+CvmA -VG7nMX6wkI2lipQXNRjAaw8mP7v65dAiGLtxrXoJ4jehxuqwVwtnvfA1XLUNzK/0 -VwfQ1qjAtiltl/dl/hclqk3xo7/MI0Z4UHQzVzwPzwnpm84Xwi/FZZhuuaw4s1UM -Yk6LUzgpmsVC3Rd9O46KzEyyB2VVdjpwAP7nXg3MSE5ynJLC4kSigIh1FzCD6kRs -TbS19bHQQ/xaENvLK/KOiqO6m97mgOAmYadiOEUfduaGSEsjm82N0Ma5WnzeIIRZ -1pExSWNCvuN3MbWvCt4AJ0F8TfwQDQxMnUtWDPWnamG7dPcHLUlIzKiRxmVp5yFT -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/experimental/packages/exporter-trace-otlp-http/test/certs/client.key b/experimental/packages/exporter-trace-otlp-http/test/certs/client.key deleted file mode 100644 index 00f82cfeeb..0000000000 --- a/experimental/packages/exporter-trace-otlp-http/test/certs/client.key +++ /dev/null @@ -1,51 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIJKgIBAAKCAgEA3WivsX7njxGlUiB2vNia5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EC+82opuIl7azsNsW -MjgOIdxHdS4xU4+pPr/aX5SwDLT9GWHGtQsnX8bpokh+las8oJx9cp0L+lbrp4qj -PtGw6/dCPoLAVc1WuFx5wV2EU0cN7eZ63MbqSY3zoTziHNXarlfTlqQO5FwpUkqE -nl1xAiPrapVfknBezk+oYvAynnGGB8lg9OKSnJnGzckCXVHMcwQa4BIT7ixjCj3p -IuQmwstg5t8p67K2Mgwd8fAQoEfg0bXGWcyUqgGQ/zq33uS+GyMlVS0mXLdxT2F1 -d44UAQKCAQEAtB3sGMfJIgZSKVQ5BXDfseT3Ajho1dSMY8OWrhNaarhMJ6MKrcpL -mwkpX1nW4yKhajSxkl5nBw6GM+1zDmVphdq9Hv+MG2GNebO+orSolXpFxGr+XvPP -yt2kU5v2Ff+9kGigncd2QHa7mbfdR30Gn+MWJuix7yxhsIe3J0hZR7EM4qHIUP1T -gxrqlvr0waN5tlUiIeNWSACf85yRiBTK+7P6tV9cqnv3VskMnGBj7ZCK5JthhYn9 -NdeuMjk8PeAIvo6QN28wY/UMbl3mWtUSWe8XEL2xGgD60Y+qbKVm8+3vh+/1MRzZ -tBM836ginHHApya0bNBPmtGoya2rVTDliQKCAQEAiiX5sNs3uvKyz7Z+LIiXaVL6 -C4CaNUMgyNv536FBzmMKXAsBFiAw/G96OPlwrNsIATVwumjq5mxYxeeMLwuodNJL -uNczdyNmsT9721tQEMTnS99VrtqISZZlAR0jVhTATU/cla/BMykqWTiAYUSHcFHw -2gOnyCTnBbW1EI3fdLQOqPiRNvpDwp4xNhXLnr8ANuewnw3yRCdZvJVsAmUpMLME -vjT3lzh4i2diKnAHF2l+ZTkqHFzg7oEOOms38Vi8rrhhwN0uvRdrbtcdrFc9YiW0 -IVJ5JWQ60oBdytnuoRvTLsnWrqfvgwcQYtZ3oFo+qO4fXFB1X54+IoyZFC1saA== ------END RSA PRIVATE KEY----- diff --git a/experimental/packages/exporter-trace-otlp-http/test/certs/regenerate.sh b/experimental/packages/exporter-trace-otlp-http/test/certs/regenerate.sh deleted file mode 100755 index 9e2e972c99..0000000000 --- a/experimental/packages/exporter-trace-otlp-http/test/certs/regenerate.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env sh -# -# Usage: regenerate.sh -# -# regenerate.sh regenerates certificates that are used to test gRPC with TLS -# Make sure you run it in test/certs directory. -# 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 -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/experimental/packages/exporter-trace-otlp-http/test/certs/server.crt b/experimental/packages/exporter-trace-otlp-http/test/certs/server.crt deleted file mode 100644 index 55f0c3dbb9..0000000000 --- a/experimental/packages/exporter-trace-otlp-http/test/certs/server.crt +++ /dev/null @@ -1,31 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV -BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjEwNjA3MjAxMDExWhcN -MjIwNjA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02PRM3mF5cmLMNu5aMUoIArG5dO1LTSxl5/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/experimental/packages/exporter-trace-otlp-http/test/certs/server.csr b/experimental/packages/exporter-trace-otlp-http/test/certs/server.csr deleted file mode 100644 index 0c5e9291bf..0000000000 --- a/experimental/packages/exporter-trace-otlp-http/test/certs/server.csr +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH -DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGU2Vy -dmVyMRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQC2rJDJNBaaAGfHh6TojWCFtsjnosxrLyez7DWbo21BUP3+/wGE2QgU -PR3PJSs/t2B5JWZ07ACVukCwgSkoLK4zwFwNucwRUGs1Lim/kK46CKn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TWbcLU7s1SeDwYiEP6DFZHLBPHDcNLz77d6nQ -zgvOgXqeNfk9uI5NdYBMbtdHW/mwGgEfPlDkKbY2KveOJjLlTM1EduGFsYHAXyhI -SiYozrbFeS5ts4f1EZ5tVT73KBv97MiQkKhBoVXtF1CHPUP1LTkGxtH2uoDiVfDi -r1OkRzoO05pHAh2o+4gujThsc0d3T5mmoeSySs56lgqDmC4blXNOS0kBZ4+I2u7A -C2YH ------END CERTIFICATE REQUEST----- diff --git a/experimental/packages/exporter-trace-otlp-http/test/certs/server.key b/experimental/packages/exporter-trace-otlp-http/test/certs/server.key deleted file mode 100644 index 9fa740554a..0000000000 --- a/experimental/packages/exporter-trace-otlp-http/test/certs/server.key +++ /dev/null @@ -1,51 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIJKQIBAAKCAgEAtqyQyTQWmgBnx4ek6I1ghbbI56LMay8ns+w1m6NtQVD9/v8B -hNkIFD0dzyUrP7dgeSVmdOwAlbpAsIEpKCyuM8BcDbnMEVBrNS4pv5CuOgip5qrw -PzDqIcvvN0eymVtZmNiuc+MtY+qhzWBrofSnw2wft4LqEVclGnZmKXJldRHiO/Ix -zcPar8xegjRW9De0j9BoutTaJo3QNkGzImGvgH+M3M5jMYC5WJ4TJXnbAWc6xSUk -M2mOxP+/X9DwmuM5dJv6Sj/vhWVItMJq6g9KyJRvWtrRNu7dnQTpvu+UUp5lo7HB -TJZ4uLphPpn1lM4Qm6Ilqf/tJOmsrU2uov44+d4rUDQ+WvXSFjvpKm0C7Z9OqAY4 -UahCTFOiyeymmJKQJVoOIsoJWvgNDMGb/QIuhKBeTh8k2GI2shP5vfmBfxeabeFS -r5QZqdnJeElh+iMFS6E8kUBQqlRSNKyJFTwOPxHuchlP5xRa+yVias4bhmMKekhe -eiikCMWVpmS/rb+0QbAmbIGQaTaVjOf0prUb9o73YiN/PKlSVIpcKe1PEsPoHNY0 -Xv+qO3X1dM5Y+MKFAdBxheaVNI1S9RDT0cxpEhR7kwJ7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r49uSDTYI/XoMAQOlaHnj9nsNXbSEgQBAoIBAQC6RnqNrsHki+CGdddEtRdxYVtf -ZEP3rc5xIEe3zG4L0FfjYxWk/aOW5Xl4akm6ddudEgndpJxa6T6ut4geMDIfSrvL -r2t/7WZ31fpAtwnI7exV6D230dWnSWf0u0sQc23TJhTSKd4R+Mm8WLzJQHY0rm3y -jOL0bWrEm5BXOcewXeSzQkcYbrViniHUv1OQDmNdTGw+bLCyM3fY3Ud2oBJGTfTw -wDoyG6D6zdLztGxTQQ2C39DXdRelGhYwrz2MlKJK5K2EVNLJ8O91c+VjvxKKJmJ1 -fkxF7omyNBh5dBnvFC/jFuxVL+PRqnvO0SH1YH1Y9eiqNhXrds0B4U+/YBDZ ------END RSA PRIVATE KEY----- diff --git a/experimental/packages/exporter-trace-otlp-http/test/node/CollectorTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-http/test/node/CollectorTraceExporter.test.ts index 9238260d30..3de60027dc 100644 --- a/experimental/packages/exporter-trace-otlp-http/test/node/CollectorTraceExporter.test.ts +++ b/experimental/packages/exporter-trace-otlp-http/test/node/CollectorTraceExporter.test.ts @@ -316,7 +316,6 @@ describe('OTLPTraceExporter - node with json over http', () => { fakeRequest.on('end', () => { const responseBody = buff.toString(); - const json = JSON.parse(responseBody) as IExportTraceServiceRequest; const span1 = json.resourceSpans?.[0].scopeSpans?.[0].spans?.[0]; assert.ok(typeof span1 !== 'undefined', "span doesn't exist"); diff --git a/experimental/packages/exporter-trace-otlp-http/test/node/nodeHelpers.ts b/experimental/packages/exporter-trace-otlp-http/test/node/nodeHelpers.ts index 1219f2d976..d2dce6517b 100644 --- a/experimental/packages/exporter-trace-otlp-http/test/node/nodeHelpers.ts +++ b/experimental/packages/exporter-trace-otlp-http/test/node/nodeHelpers.ts @@ -17,7 +17,10 @@ import { Stream } from 'stream'; export class MockedResponse extends Stream { - constructor(private _code: number, private _msg?: string) { + constructor( + private _code: number, + private _msg?: string + ) { super(); } diff --git a/experimental/packages/exporter-trace-otlp-http/test/traceHelper.ts b/experimental/packages/exporter-trace-otlp-http/test/traceHelper.ts index 06e256d253..6726b49017 100644 --- a/experimental/packages/exporter-trace-otlp-http/test/traceHelper.ts +++ b/experimental/packages/exporter-trace-otlp-http/test/traceHelper.ts @@ -31,6 +31,7 @@ import { ILink, IResource, ISpan, + UnsignedLong, } from '@opentelemetry/otlp-transformer'; if (typeof Buffer === 'undefined') { @@ -243,54 +244,59 @@ export const multiInstrumentationLibraryTrace: ReadableSpan[] = [ }, ]; +function fixed64FromString(str: string) { + const { low, high } = UnsignedLong.fromString(str); + return { low, high }; +} + export function ensureEventsAreCorrect(events: IEvent[]) { assert.deepStrictEqual( events, [ { - timeUnixNano: 1574120165429803000, + timeUnixNano: fixed64FromString('1574120165429803070'), name: 'fetchStart', attributes: [], droppedAttributesCount: 0, }, { - timeUnixNano: 1574120165429803000, + timeUnixNano: fixed64FromString('1574120165429803070'), name: 'domainLookupStart', attributes: [], droppedAttributesCount: 0, }, { - timeUnixNano: 1574120165429803000, + timeUnixNano: fixed64FromString('1574120165429803070'), name: 'domainLookupEnd', attributes: [], droppedAttributesCount: 0, }, { - timeUnixNano: 1574120165429803000, + timeUnixNano: fixed64FromString('1574120165429803070'), name: 'connectStart', attributes: [], droppedAttributesCount: 0, }, { - timeUnixNano: 1574120165429803000, + timeUnixNano: fixed64FromString('1574120165429803070'), name: 'connectEnd', attributes: [], droppedAttributesCount: 0, }, { - timeUnixNano: 1574120165435513000, + timeUnixNano: fixed64FromString('1574120165435513070'), name: 'requestStart', attributes: [], droppedAttributesCount: 0, }, { - timeUnixNano: 1574120165436923100, + timeUnixNano: fixed64FromString('1574120165436923070'), name: 'responseStart', attributes: [], droppedAttributesCount: 0, }, { - timeUnixNano: 1574120165438688000, + timeUnixNano: fixed64FromString('1574120165438688070'), name: 'responseEnd', attributes: [], droppedAttributesCount: 0, @@ -364,14 +370,14 @@ export function ensureSpanIsCorrect(span: ISpan, useHex = true) { ); assert.strictEqual(span.name, 'documentFetch', 'name is wrong'); assert.strictEqual(span.kind, ESpanKind.SPAN_KIND_INTERNAL, 'kind is wrong'); - assert.strictEqual( + assert.deepStrictEqual( span.startTimeUnixNano, - 1574120165429803008, + fixed64FromString('1574120165429803070'), 'startTimeUnixNano is wrong' ); - assert.strictEqual( + assert.deepStrictEqual( span.endTimeUnixNano, - 1574120165438688000, + fixed64FromString('1574120165438688070'), 'endTimeUnixNano is wrong' ); assert.strictEqual( diff --git a/experimental/packages/exporter-trace-otlp-proto/.eslintrc.js b/experimental/packages/exporter-trace-otlp-proto/.eslintrc.js index 3ed0fbeba3..9cfb3fd423 100644 --- a/experimental/packages/exporter-trace-otlp-proto/.eslintrc.js +++ b/experimental/packages/exporter-trace-otlp-proto/.eslintrc.js @@ -4,5 +4,5 @@ module.exports = { "commonjs": true, "node": true, }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/exporter-trace-otlp-proto/README.md b/experimental/packages/exporter-trace-otlp-proto/README.md index efd22d2abf..0be283bebe 100644 --- a/experimental/packages/exporter-trace-otlp-proto/README.md +++ b/experimental/packages/exporter-trace-otlp-proto/README.md @@ -5,8 +5,7 @@ **Note: This is an experimental package under active development. New releases may include breaking changes.** -This module provides exporter for node to be used with OTLP (`http/protobuf`) compatible receivers. -Compatible with [opentelemetry-collector][opentelemetry-collector-url] versions `>=0.32 <=0.50`. +This module provides a trace-exporter for OTLP (http/protobuf) using protocol version `v0.20.0`. ## Installation diff --git a/experimental/packages/exporter-trace-otlp-proto/package.json b/experimental/packages/exporter-trace-otlp-proto/package.json index bfe610b4d2..d50cd51eaa 100644 --- a/experimental/packages/exporter-trace-otlp-proto/package.json +++ b/experimental/packages/exporter-trace-otlp-proto/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-trace-otlp-proto", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector using protobuf over HTTP", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -21,10 +21,10 @@ "lint:fix": "eslint . --ext .ts --fix", "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" @@ -62,30 +62,42 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", - "@opentelemetry/api": "1.4.1", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@opentelemetry/api": "1.6.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", "cpx": "1.5.0", - "mocha": "10.0.0", + "cross-var": "1.1.0", + "karma": "6.4.2", + "karma-chrome-launcher": "3.1.0", + "karma-coverage": "2.2.1", + "karma-mocha": "2.0.1", + "karma-spec-reporter": "0.0.36", + "karma-webpack": "4.0.2", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", - "typescript": "4.4.4" + "typescript": "4.4.4", + "webpack": "4.46.0", + "webpack-cli": "4.10.0", + "webpack-merge": "5.9.0" }, "peerDependencies": { "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/otlp-exporter-base": "0.39.1", - "@opentelemetry/otlp-proto-exporter-base": "0.39.1", - "@opentelemetry/otlp-transformer": "0.39.1", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/otlp-exporter-base": "0.44.0", + "@opentelemetry/otlp-proto-exporter-base": "0.44.0", + "@opentelemetry/otlp-transformer": "0.44.0", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-trace-otlp-proto", "sideEffects": false diff --git a/experimental/packages/exporter-trace-otlp-proto/test/certs/ca.crt b/experimental/packages/exporter-trace-otlp-proto/test/certs/ca.crt deleted file mode 100644 index d54d3fc5d3..0000000000 --- a/experimental/packages/exporter-trace-otlp-proto/test/certs/ca.crt +++ /dev/null @@ -1,33 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFozCCA4ugAwIBAgIUJy5SEslTLFkUTocZvXO1+3qd+c8wDQYJKoZIhvcNAQEL -BQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQHDBFPcGVuVGVs -ZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9vdDENMAsGA1UECwwEVGVzdDELMAkGA1UE -AwwCY2EwHhcNMjEwNjA3MjAyNzUxWhcNMjIwNjA3MjAyNzUxWjBhMQswCQYDVQQG -EwJDTDELMAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0w -CwYDVQQKDARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTCCAiIwDQYJ -KoZIhvcNAQEBBQADggIPADCCAgoCggIBALHeRFPaPJhHNCwMkcGZMGNaoskj8Qw6 -Ar2PQVC5YzByrNWaxv4HcPArHxbfsMTHJsV8vZfN2K3AQCNsPNVy/YfBFwYbkr5J -K7KeiFSAw8mDz+Hr2NETvQA5xbxTROaBYlNxQirIUtGc0sl0OXinKEsuO5/CqB0V -aPTCmdY0iMNIKtGywSc10XzWSBIzwpq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ztTlwRo3pHrOxh -6BF4XPtSiG6tpA20hokrnMY5cmYbeUNUWQcnQXdwUgpfdvss5r6PRhHUz2UgZmRm -/Jpq4/TE54HCt6j+OWeZyFOHWXwgJDPdco3CgXol3la0wNT7bbNBO8M7ZY3J80Fe -7PkceQyyjcHIym2fSiJECUA0IdrovykMg3LXENDUcX/TuMzLqM7DMHzAnG4i4lot -hzh4MdC8MzLbiyNl/GKiJTsnhn8nzjAqFV0qSdwp6iSo6GdYbMoVewa3x/BPFLQD -gYCn3pHgIg== ------END CERTIFICATE----- diff --git a/experimental/packages/exporter-trace-otlp-proto/test/certs/ca.key b/experimental/packages/exporter-trace-otlp-proto/test/certs/ca.key deleted file mode 100644 index 1a770f08f8..0000000000 --- a/experimental/packages/exporter-trace-otlp-proto/test/certs/ca.key +++ /dev/null @@ -1,54 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,356304F34E38896B - -94Y4hm88gWGlbvbrGW4OCkqqqsVusM6SJhkQnCTRR0avy/ftOdIr2+gtaAbPROPt -6m3wsycLM7MO5zjHGvkqXQGqEluiDz1cY0GS+tnDt/p+1DlkM+w5yfTwpaKVXIbx -m3ixtlw2D1lpcXOmlJ2tGXv/9e6sfUbyZVUkU+w70A4HaDWdQBOcHOel1U82XnN1 -b1Fy5X1mNxQoKpkDQjWuiMYeJSyR8aMT9+I9DGB5eqwe7rZTFcfaJCpdlK+zWM57 -6NZlMttU3Y5HoUHMzGHZwMrb84/WYlrfdyks+ytAGMICcEPtGywpodiwIO6gr6Ad -UZUwuXV5wZB77LiUyUBbFEP0RQmJdgP+EPDxzl0dsyJ8l4lqHghRAzsxCjC4DP8d -eLqksph5+3y27w5yqzfat349l/oglKbWy7VseNsyb/Y2jxGs3CI5krari9MlsJNa -ivXSmW1MojclKCXgPZOIC8ZLHjJLBSR0/NdzHxg3yPwMrMvQtWWniv5c13yt8tRj -TcBLF5LInww6awVLAENkF7q6Bs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OdWe9kMKpaFYkhXCTIFaeYAdyopEjl+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/experimental/packages/exporter-trace-otlp-proto/test/certs/client.crt b/experimental/packages/exporter-trace-otlp-proto/test/certs/client.crt deleted file mode 100644 index f02b0ec199..0000000000 --- a/experimental/packages/exporter-trace-otlp-proto/test/certs/client.crt +++ /dev/null @@ -1,31 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV -BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjEwNjA3MjAyNzUzWhcN -MjIwNjA3MjAyNzUzWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV -BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZD -bGllbnQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCAiIwDQYJKo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XCMD91w+DAHUi85X75C4fpRkaJcPB0oVqEog2 -ZtcyTE/aAsHJGwC7PEpgsQYOpApb2pnfZnhABb8pTBeK/dldrqIW3OJeRCzthh6w -N0p/pxfPXS2Xg5lDlSUoZNWmNObBOpBVevUlMJ+WhK6oFwfkfTbH7z0+o3k70XMZ -mb0R2nXIjZrbU/baGKOUVw9iqQNoRr5DBoInSFuuriTwyHU+O2MVL/UZCZ7TeY4o -5FyGh5+51eWqjt+uyHbJPBeYMoECj4S1PXbMvZSSqI+MR8RdUrEX0F25r60QjLe/ -ETKhZTeqM6GO8DG9WdlaWPDtZ08ZYrKgx4iIN1mu0ytYi0z8QRRvyJ9jBeLa7Lii -/0ud ------END CERTIFICATE----- diff --git a/experimental/packages/exporter-trace-otlp-proto/test/certs/client.csr b/experimental/packages/exporter-trace-otlp-proto/test/certs/client.csr deleted file mode 100644 index 234045e9ea..0000000000 --- a/experimental/packages/exporter-trace-otlp-proto/test/certs/client.csr +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH -DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGQ2xp -ZW50MRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQCmwAzZvCb+55TaUmtwPsAF6+XzDxdlMbpvux7o7eV2m31IhTkhEEI+ -UXd2l8bY61wddNhOaHlia51CM0X59CAkShrnaToCkS9tosDZSLsu8GM9qmu1co3c -LD/sY5+LH1qog3vLLBq1c0MvP17p6FsvjV0ToghORedRjzCg63bVZL77ShkBXk4Y -wT/ka0+nUjp+yQlHJcEEv0j5YSqKXhsoAUbSt30GOYW9MXCBL86f6qUajo8iJFZJ -yUr2gd0OdgZvKlbx3j5A2tyYPC4NdRtRNkfczhvHiENgO/AnPESYeZ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qmfMzzE5VQnHh4iPvZ7ULvEgVcz6DbXjjGgEhQQcMq -s7bV ------END CERTIFICATE REQUEST----- diff --git a/experimental/packages/exporter-trace-otlp-proto/test/certs/client.key b/experimental/packages/exporter-trace-otlp-proto/test/certs/client.key deleted file mode 100644 index f5ebbdc625..0000000000 --- a/experimental/packages/exporter-trace-otlp-proto/test/certs/client.key +++ /dev/null @@ -1,51 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIJJwIBAAKCAgEApsAM2bwm/ueU2lJrcD7ABevl8w8XZTG6b7se6O3ldpt9SIU5 -IRBCPlF3dpfG2OtcHXTYTmh5YmudQjNF+fQgJEoa52k6ApEvbaLA2Ui7LvBjPapr -tXKN3Cw/7GOfix9aqIN7yywatXNDLz9e6ehbL41dE6IITkXnUY8woOt21WS++0oZ -AV5OGME/5GtPp1I6fskJRyXBBL9I+WEqil4bKAFG0rd9BjmFvTFwgS/On+qlGo6P -IiRWSclK9oHdDnYGbypW8d4+QNrcmDwuDXUbUTZH3M4bx4hDYDvwJzxEmHmW0OIc -cG8cThOgLmvQjik93CBljOojzvp80r/gNeaHOdSh9LAYvHdJPV3SThWP67y7k29Q -auD0ATjtFLQECpQVDOqow6NINfDeuVgRoLQkzLZPfqqKXxOLjzhwg49j36uqK3IB -zXKluFsBOu1/3pQR4NAt0DjKBp9Rday60swbbNKutnG3bFbx/cfSJ+ycgLE0dvGL -5968CoJ6Tbf6JYf6La2B+Udt7uE/AAgHJVo3KWT8UtXgPhhBsbWFVn6y97HQA9db -EudPVnvm9iYaGkFAty3Kq2rRi2PSBzMR/BpoRdkFy6Hs8x6lCYHESPYnvW9+nZ52 -jBwtZNZnT5oE5SHrFNxV5Z3KuYSyqtJ61OBnEpi3o83Jc/xL3edW4kwI26kCAwEA -AQKCAgAF+/56EfaUT1tYOn0Amj/p9n1aK8B7MT2vpNeHJIKHryzf3Wgfd6Xo9qOC -7g+E2W2E4RyiM72nepU6OvzX65r7sm0kwPIEBZHeLWkeYy3Uk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AlFicyrXA7GGjw1iU -0NRbqHJC1JoTkZNAZItG/3De9iSzq7chZGFIrG2BU4Kw+hJrQS7LrarFNrvWiMsJ -fHEIzc3uMmRfWbyU3M6nbfFDh0J+rvMiPXWN4aWb6HdJl0dpJ1pEr4OWp3sXolbj -QuB1ZGoUxPQZUNmOPqezlM4cd/9WIpOuGx9gdmpf8Ammw1VRsEizRU1efg== ------END RSA PRIVATE KEY----- diff --git a/experimental/packages/exporter-trace-otlp-proto/test/certs/regenerate.sh b/experimental/packages/exporter-trace-otlp-proto/test/certs/regenerate.sh deleted file mode 100755 index 728c0cbfb3..0000000000 --- a/experimental/packages/exporter-trace-otlp-proto/test/certs/regenerate.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env sh -# -# Usage: regenerate.sh -# -# regenerate.sh regenerates certificates that are used to test gRPC with TLS -# Make sure you run it in test/certs directory. -# 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 -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/experimental/packages/exporter-trace-otlp-proto/test/certs/server.crt b/experimental/packages/exporter-trace-otlp-proto/test/certs/server.crt deleted file mode 100644 index 8e76b7b4a6..0000000000 --- a/experimental/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m/c99x2hpVl8dyAWK5dX86DVtTsrIBz6rgitAN4kPrl5eWVmZp -gf1VFwFZfEjS4SOV/qxbkJDls/r+tD6JhlC1dNT+XVooVq/DgON+Zkk1AgMBAAEw -DQYJKoZIhvcNAQELBQADggIBAFmiQCJLSCLoH/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/experimental/packages/exporter-trace-otlp-proto/test/certs/server.csr b/experimental/packages/exporter-trace-otlp-proto/test/certs/server.csr deleted file mode 100644 index 45c77ba43f..0000000000 --- a/experimental/packages/exporter-trace-otlp-proto/test/certs/server.csr +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVB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YbF3m+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/experimental/packages/exporter-trace-otlp-proto/test/certs/server.key b/experimental/packages/exporter-trace-otlp-proto/test/certs/server.key deleted file mode 100644 index b00ffb89bf..0000000000 --- a/experimental/packages/exporter-trace-otlp-proto/test/certs/server.key +++ /dev/null @@ -1,51 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIJKQIBAAKCAgEAmqNbAsT1D6pzzEExCeJ/oPwajFE0bMdCVbSXEabHQ4r6KvAG -o0KB2amOf2AqHhKQkvXv1buvanJzvNnDTDOXRSn/isdv5nsfnmyGCYxrEjSnEt1R -TB/Q6yo5BYTixQTeS7lAgZfTPDUz1G5LrAOmFlde6+Ewfz7WxlewNATjR4BpMZSW -f2SXtkEqloeAw6n6xMdKmSdwpdbhmEfwX2NIKAc2s0JjxHY+IQjacHWIgA7gHgBQ -diH1fw7Up7h4DEbsARAv9CyQStfRj32gGx3pjM6WJUEecist6sIaeOlqkcj1Cp4J -Qj1OhXUCJ7EEJLQ7vIdgCEeJ9ncZMEzb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4D9sYADq5aRagzTGG9O2Sib -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/experimental/packages/exporter-trace-otlp-proto/test/traceHelper.ts b/experimental/packages/exporter-trace-otlp-proto/test/traceHelper.ts index 5e2b71c573..3a21d9b79d 100644 --- a/experimental/packages/exporter-trace-otlp-proto/test/traceHelper.ts +++ b/experimental/packages/exporter-trace-otlp-proto/test/traceHelper.ts @@ -109,42 +109,42 @@ export function ensureProtoEventsAreCorrect(events: IEvent[]) { events, [ { - timeUnixNano: '1574120165429803008', + timeUnixNano: '1574120165429803070', name: 'fetchStart', droppedAttributesCount: 0, }, { - timeUnixNano: '1574120165429803008', + timeUnixNano: '1574120165429803070', name: 'domainLookupStart', droppedAttributesCount: 0, }, { - timeUnixNano: '1574120165429803008', + timeUnixNano: '1574120165429803070', name: 'domainLookupEnd', droppedAttributesCount: 0, }, { - timeUnixNano: '1574120165429803008', + timeUnixNano: '1574120165429803070', name: 'connectStart', droppedAttributesCount: 0, }, { - timeUnixNano: '1574120165429803008', + timeUnixNano: '1574120165429803070', name: 'connectEnd', droppedAttributesCount: 0, }, { - timeUnixNano: '1574120165435513088', + timeUnixNano: '1574120165435513070', name: 'requestStart', droppedAttributesCount: 0, }, { - timeUnixNano: '1574120165436923136', + timeUnixNano: '1574120165436923070', name: 'responseStart', droppedAttributesCount: 0, }, { - timeUnixNano: '1574120165438688000', + timeUnixNano: '1574120165438688070', name: 'responseEnd', droppedAttributesCount: 0, }, @@ -219,12 +219,12 @@ export function ensureProtoSpanIsCorrect(span: ISpan) { assert.strictEqual(span.kind, 'SPAN_KIND_INTERNAL', 'kind is wrong'); assert.strictEqual( span.startTimeUnixNano, - '1574120165429803008', + '1574120165429803070', 'startTimeUnixNano is wrong' ); assert.strictEqual( span.endTimeUnixNano, - '1574120165438688000', + '1574120165438688070', 'endTimeUnixNano is wrong' ); assert.strictEqual( @@ -261,7 +261,10 @@ export function ensureExportTraceServiceRequestIsSet( } export class MockedResponse extends Stream { - constructor(private _code: number, private _msg?: string) { + constructor( + private _code: number, + private _msg?: string + ) { super(); } diff --git a/experimental/packages/opentelemetry-browser-detector/.eslintrc.js b/experimental/packages/opentelemetry-browser-detector/.eslintrc.js index 3ed0fbeba3..9cfb3fd423 100644 --- a/experimental/packages/opentelemetry-browser-detector/.eslintrc.js +++ b/experimental/packages/opentelemetry-browser-detector/.eslintrc.js @@ -4,5 +4,5 @@ module.exports = { "commonjs": true, "node": true, }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/opentelemetry-browser-detector/package.json b/experimental/packages/opentelemetry-browser-detector/package.json index fa3e4746a0..a82c73f60f 100644 --- a/experimental/packages/opentelemetry-browser-detector/package.json +++ b/experimental/packages/opentelemetry-browser-detector/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/opentelemetry-browser-detector", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenTelemetry Resource Detector for Browser", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -14,13 +14,13 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "tdd": "npm run test -- --watch-extensions ts --watch", "tdd:browser": "karma start", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js" }, @@ -53,25 +53,37 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", - "@opentelemetry/api": "1.4.1", - "@types/mocha": "9.1.1", + "@babel/core": "7.22.20", + "@opentelemetry/api": "1.6.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", - "mocha": "10.0.0", + "cross-var": "1.1.0", + "karma": "6.4.2", + "karma-chrome-launcher": "3.1.0", + "karma-coverage": "2.2.1", + "karma-mocha": "2.0.1", + "karma-spec-reporter": "0.0.36", + "karma-webpack": "4.0.2", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", - "typescript": "4.4.4" + "typescript": "4.4.4", + "webpack": "4.46.0", + "webpack-cli": "4.10.0", + "webpack-merge": "5.9.0" }, "peerDependencies": { "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/semantic-conventions": "1.13.0" + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/browser-detector" } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/.eslintrc.js b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/.eslintrc.js index 3ed0fbeba3..9cfb3fd423 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/.eslintrc.js +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/.eslintrc.js @@ -4,5 +4,5 @@ module.exports = { "commonjs": true, "node": true, }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/README.md b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/README.md index 3aee8d08a4..7a257ba1b7 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/README.md +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/README.md @@ -5,8 +5,7 @@ **Note: This is an experimental package under active development. New releases may include breaking changes.** -This module provides exporter for node to be used with OTLP (`grpc`) compatible receivers. -Compatible with [opentelemetry-collector][opentelemetry-collector-url] versions `>=0.16 <=0.53`. +This module provides a metrics-exporter for OTLP (gRPC) using protocol version `v0.20.0`. ## Installation @@ -32,6 +31,7 @@ const { MeterProvider, PeriodicExportingMetricReader } = require('@opentelemetry const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-grpc'); const collectorOptions = { // url is optional and can be omitted - default is http://localhost:4317 + // Unix domain sockets are also supported: 'unix:///path/to/socket.sock' url: 'http://:', }; @@ -70,7 +70,7 @@ In addition to settings passed to the constructor, the exporter also supports co | OTEL_EXPORTER_OTLP_CLIENT_KEY | The path to the file containing private client key to use when verifying an OTLP trace, metric or log client's TLS credentials. Must provide a client certificate/chain when providing a private client key. By default no client key file is used. | | OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE | The path to the file containing trusted client certificate/chain for clients private key to use when verifying an OTLP metric server's TLS credentials. Must provide a private client key when providing a certificate/chain. By default no chain file is used. | | OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE | The path to the file containing trusted client certificate/chain for clients private key to use when verifying an OTLP trace, metric and log server's TLS credentials. Must provide a private client key when providing a certificate/chain. By default no chain file is used. | -| OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE | The exporters aggregation temporality preference. Valid values are `cumulative`, and `delta`. `cumulative` selects cumulative temporality for all instrument kinds. `delta` selects delta aggregation temporality for Counter, Asynchronous Counter and Histogram instrument kinds, and selects cumulative aggregation for UpDownCounter and Asynchronous UpDownCounter instrument kinds. By default `cumulative` is used. | +| OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE | The exporters aggregation temporality preference. Valid values are `cumulative`, `delta`, and `lowmemory`. `cumulative` selects cumulative temporality for all instrument kinds. `delta` selects delta aggregation temporality for Counter, Asynchronous Counter and Histogram instrument kinds, and selects cumulative aggregation for UpDownCounter and Asynchronous UpDownCounter instrument kinds. `lowmemory` select delta aggregation temporality for Synchronous Counter and Histogram instrument kinds, and selects cumulative aggregation for Synchronous UpDownCounter, Asynchronous Counter and Asynchronous UpDownCounter instrument kinds. By default `cumulative` is used. | > Settings configured programmatically take precedence over environment variables. Per-signal environment variables take precedence over non-per-signal environment variables. diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json index 85b92e6fcb..7c612bf036 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-metrics-otlp-grpc", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -15,7 +15,7 @@ "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "version": "node ../../../scripts/version-update.js", "watch": "tsc -w", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" @@ -47,17 +47,19 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", - "@grpc/proto-loader": "^0.7.3", - "@opentelemetry/api": "1.4.1", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@grpc/proto-loader": "^0.7.10", + "@opentelemetry/api": "1.6.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "codecov": "3.8.3", "cpx": "1.5.0", - "mocha": "10.0.0", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4" @@ -67,12 +69,12 @@ }, "dependencies": { "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.13.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.39.1", - "@opentelemetry/otlp-grpc-exporter-base": "0.39.1", - "@opentelemetry/otlp-transformer": "0.39.1", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/sdk-metrics": "1.13.0" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/exporter-metrics-otlp-http": "0.44.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.44.0", + "@opentelemetry/otlp-transformer": "0.44.0", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-metrics": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc", "sideEffects": false diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/OTLPMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/OTLPMetricExporter.test.ts index 9e4e27ecb0..1df8e0cc12 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/OTLPMetricExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/OTLPMetricExporter.test.ts @@ -35,15 +35,13 @@ import { setUp, shutdown, } from './metricsHelper'; -import { - AggregationTemporality, - ResourceMetrics, -} from '@opentelemetry/sdk-metrics'; +import { ResourceMetrics } from '@opentelemetry/sdk-metrics'; import { IExportMetricsServiceRequest, IResourceMetrics, } from '@opentelemetry/otlp-transformer'; import { VERSION } from '../src/version'; +import { AggregationTemporalityPreference } from '@opentelemetry/exporter-metrics-otlp-http'; const metricsServiceProtoPath = 'opentelemetry/proto/collector/metrics/v1/metrics_service.proto'; @@ -51,9 +49,11 @@ const includeDirs = [ path.resolve(__dirname, '../../otlp-grpc-exporter-base/protos'), ]; -const address = 'localhost:1502'; +const httpAddr = 'https://localhost:1502'; +const udsAddr = 'unix:///tmp/otlp-metrics.sock'; type TestParams = { + address?: string; useTLS?: boolean; metadata?: grpc.Metadata; }; @@ -61,10 +61,11 @@ type TestParams = { const metadata = new grpc.Metadata(); metadata.set('k', 'v'); -const testOTLPMetricExporter = (params: TestParams) => - describe(`OTLPMetricExporter - node ${ - params.useTLS ? 'with' : 'without' - } TLS, ${params.metadata ? 'with' : 'without'} metadata`, () => { +const testOTLPMetricExporter = (params: TestParams) => { + const { address = httpAddr, useTLS, metadata } = params; + return describe(`OTLPMetricExporter - node ${ + useTLS ? 'with' : 'without' + } TLS, ${metadata ? 'with' : 'without'} metadata, target ${address}`, () => { let collectorExporter: OTLPMetricExporter; let server: grpc.Server; let exportedData: IResourceMetrics[] | undefined; @@ -102,7 +103,7 @@ const testOTLPMetricExporter = (params: TestParams) => }, } ); - const credentials = params.useTLS + const credentials = useTLS ? grpc.ServerCredentials.createSsl( fs.readFileSync('./test/certs/ca.crt'), [ @@ -113,10 +114,15 @@ const testOTLPMetricExporter = (params: TestParams) => ] ) : grpc.ServerCredentials.createInsecure(); - server.bindAsync(address, credentials, () => { - server.start(); - done(); - }); + const serverAddr = new URL(address); + server.bindAsync( + serverAddr.protocol === 'https:' ? serverAddr.host : address, + credentials, + () => { + server.start(); + done(); + } + ); }); }); @@ -125,7 +131,7 @@ const testOTLPMetricExporter = (params: TestParams) => }); beforeEach(async () => { - const credentials = params.useTLS + const credentials = useTLS ? grpc.credentials.createSsl( fs.readFileSync('./test/certs/ca.crt'), fs.readFileSync('./test/certs/client.key'), @@ -133,10 +139,10 @@ const testOTLPMetricExporter = (params: TestParams) => ) : grpc.credentials.createInsecure(); collectorExporter = new OTLPMetricExporter({ - url: 'https://' + address, + url: address, credentials, - metadata: params.metadata, - temporalityPreference: AggregationTemporality.CUMULATIVE, + metadata: metadata, + temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, }); setUp(); @@ -187,19 +193,23 @@ const testOTLPMetricExporter = (params: TestParams) => it('should warn about headers', () => { collectorExporter = new OTLPMetricExporter({ - url: `http://${address}`, + url: address, headers: { foo: 'bar', }, - temporalityPreference: AggregationTemporality.CUMULATIVE, + temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, }); const args = warnStub.args[0]; assert.strictEqual(args[0], 'Headers cannot be set when using grpc'); }); it('should warn about path in url', () => { + if (new URL(address).protocol === 'unix:') { + // Skip this test for UDS + return; + } collectorExporter = new OTLPMetricExporter({ - url: `http://${address}/v1/metrics`, - temporalityPreference: AggregationTemporality.CUMULATIVE, + url: `${address}/v1/metrics`, + temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, }); const args = warnStub.args[0]; assert.strictEqual( @@ -243,31 +253,37 @@ const testOTLPMetricExporter = (params: TestParams) => exportedData[0].scopeMetrics[0].metrics[histogramIndex]; ensureExportedCounterIsCorrect( counter, - counter.sum?.dataPoints[0].timeUnixNano, - counter.sum?.dataPoints[0].startTimeUnixNano + metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0].endTime, + metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0] + .startTime ); ensureExportedObservableGaugeIsCorrect( observableGauge, - observableGauge.gauge?.dataPoints[0].timeUnixNano, - observableGauge.gauge?.dataPoints[0].startTimeUnixNano + metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] + .endTime, + metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] + .startTime ); ensureExportedHistogramIsCorrect( histogram, - histogram.histogram?.dataPoints[0].timeUnixNano, - histogram.histogram?.dataPoints[0].startTimeUnixNano, + metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] + .endTime, + metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] + .startTime, [0, 100], ['0', '2', '0'] ); assert.ok(typeof resource !== 'undefined', "resource doesn't exist"); ensureResourceIsCorrect(resource); - ensureMetadataIsCorrect(reqMetadata, params.metadata); + ensureMetadataIsCorrect(reqMetadata, metadata); done(); }, 500); }); }); }); +}; describe('OTLPMetricExporter - node (getDefaultUrl)', () => { it('should default to localhost', done => { @@ -281,7 +297,7 @@ describe('OTLPMetricExporter - node (getDefaultUrl)', () => { const url = 'http://foo.bar.com'; const collectorExporter = new OTLPMetricExporter({ url, - temporalityPreference: AggregationTemporality.CUMULATIVE, + temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, }); setTimeout(() => { assert.strictEqual(collectorExporter._otlpExporter.url, 'foo.bar.com'); @@ -330,7 +346,7 @@ describe('when configuring via environment', () => { envSource.OTEL_EXPORTER_OTLP_METRICS_HEADERS = 'foo=boo'; const collectorExporter = new OTLPMetricExporter({ metadata, - temporalityPreference: AggregationTemporality.CUMULATIVE, + temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, }); assert.deepStrictEqual( collectorExporter._otlpExporter.metadata?.get('foo'), @@ -352,3 +368,5 @@ describe('when configuring via environment', () => { testOTLPMetricExporter({ useTLS: true }); testOTLPMetricExporter({ useTLS: false }); testOTLPMetricExporter({ metadata }); +// skip UDS tests on windows +process.platform !== 'win32' && testOTLPMetricExporter({ address: udsAddr }); diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/ca.crt b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/ca.crt index 79e43541a2..c194f04954 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/ca.crt +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/ca.crt @@ -1,33 +1,33 @@ -----BEGIN CERTIFICATE----- -MIIFozCCA4ugAwIBAgIUU/1w3O3wzjXdsiAVROAPaSxeAB8wDQYJKoZIhvcNAQEL +MIIFozCCA4ugAwIBAgIUFA6cfBQ2t0ZOpLTRUIE6VN+kGBkwDQYJKoZIhvcNAQEL BQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQHDBFPcGVuVGVs ZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9vdDENMAsGA1UECwwEVGVzdDELMAkGA1UE -AwwCY2EwHhcNMjIwNjA4MDkwNDU2WhcNMjMwNjA4MDkwNDU2WjBhMQswCQYDVQQG +AwwCY2EwHhcNMjMwNjA4MTY0NDIzWhcNMjQwNjA3MTY0NDIzWjBhMQswCQYDVQQG EwJDTDELMAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0w CwYDVQQKDARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTCCAiIwDQYJ -KoZIhvcNAQEBBQADggIPADCCAgoCggIBAL/YJuxNGNIzwoq1alb4Z/lP4+JRS1iI -LyEJ98Hcw2gfW+nYuIGA0XX7vwVRo7hStCEQRWP4KtdzfJkfNeicWUAnoCTKTf9L -DaxvBr8/4x7DF/7TkYIpK3uuAXadl3kz3R6CA1Mue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jUzBRMB0GA1UdDgQWBBSwH/Wk2wTc+MEPAEornj1eGKra +0zAfBgNVHSMEGDAWgBSwH/Wk2wTc+MEPAEornj1eGKra0zAPBgNVHRMBAf8EBTAD +AQH/MA0GCSqGSIb3DQEBCwUAA4ICAQCNkzOjjqH3qeQ0wT/Has5PSoWwRwq+B1JT +gg29bgEMD6dVkLdzgEuRVVkMtc/tCZAkA02pc0VN8+lNLW7ckNU/QhMTQYn+FgMR +cG86vR9loTnwUrxR4dS6Nbx1sQ7hpe2GZkWpTNmjh1duHBNHv9nS2JmMkRypqRne +oAI3/th1Qlrtl/zDn02/+P5/av0YJcMOcnRkULHnI62cbXHa2iPd/nENgH2xC6CA +EuYN/bnmOEUPeKljU1IZS6asjGMLdWLmpLs7oOcHGLD3pax+om69Pmn7rps8Z071 +WsJDHFCftItCUrg4KWwpXr77Vq4WAN2tOBdDHEZsbES6a54+7sc1QKOVSWwPuGEd +ShFHhTzoaB0dpwm6kLdYsEkC8JLIjV+Ikg5X3VTDITjUlHoJf2mxCGOzBiCnUr75 +Am0eBqlVcc/2aVk1tcVS9N7reY/KcMaAJvI314O9I94pYdIIm5jw3UmA9Y6HmpN0 +vYtQUF2sS5W82XoFD8bpOq/bx1o2ib2x32dfPQkVgd4sbmpsyN62Fy1HpHwXtXno +xGVaDzGSWj/7RyYyKhNmp3nfQsU0Tt6iVkM+N30vl2heZqEUgXxCG9qHVzWv9z6x +AJzuafjM8tviROpiHkvzsmq7uDhksGooKCi+m+eoEBJrd0J4gjngAi1NYjTsB2GT +4mvPz05UkA== -----END CERTIFICATE----- diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/ca.key b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/ca.key index b991da8086..00ccb04622 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/ca.key +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/ca.key @@ -1,51 +1,51 @@ -----BE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ItkdGLd52By8PHxzDFQT43hiFF8+oOsfVh4KTbQXm9kJS +r3crJh/vwWm69bUzT2N7eGD4bg1FmFuXZf2RyT+eWyyB1up8zO28p+H3g8wSC/Qf +RB8viBO9j5l4tpr6Qq05zNVaRP2kEcEO7IHxixmU+mLqeua0B1EYFhuB6adt5KyJ +Yq/CV6kitxVD00jbV+cFoIMZnm3PtAdiQb6CtBfVjWcenyj4i2AE8C7+jK/gzvoY +BAqhICUJFvJDtWjYOdf2FbjJYhZhMthgI3qlGQESuNBivOcOfTEkNa6Rqn6qkqF/ +BylLdfkCggEAH5d4UxmAsT+HiPz5Jc8fJXb9ayA60nw0z83QrZC2Jufob8cDBIWL +kNRGctlc9JJVMusfMQPbzwsNQxuOlnwhKjshYhiPSG9zg59IIMWla5RHqlx3mlq5 +Erly+BJg6nb8/7BTGFLE06kCSkRc5m0bXaaU6EyqtQIilGzBZe+VfVgzF/AdW7xl +K2NmdXg8poC+hdg1kJ3KblULzZJ6A+LaOoeyAtKcdpf7ZiRfeM5smIOTSGmUMUEe +Duqno/XZ7xVAElJ95k3a1z+BJvMvy80aoCKgROskDdcnOUQbohx2+O5W85aWNX59 +a7e9ab8H9TkVAy2EoCu4K0KBGhaUvxMLXQKCAQAORESNb5Ne+bBHbrSA6nVMH0Ti +Gt9Nx2bgNLxgGPGHLIFkQPnR9akk8mm94T/Ow1y8Jrx/rE0bxR0ayVYbxLiF+Zqz +i/G+CYGg72j+PXdugo4ocfGf17BpqR577uqUAycvtsk50zTgxYyoob5HxdXcFjnH +PEiJBGSSSY1VJJlPxIftHLE6ULfwslyMkHPGBxh6NJe/nkM7obuQYMc7JGpNngLb +G5NF6b8nV5yJ7a5hhhSbArFWuzlfbRsZwgqadWFDChXiAyCbzE5ey5gUOs22K4Ax +M4Ky5evO6Srk3gtFGCWPqSxcDJk57DSy/on35IwerlQTI6Btz0OT6EmDWXOn -----END RSA PRIVATE KEY----- diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.crt b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.crt index a411611e29..fd05c9c40b 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.crt +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.crt @@ -1,31 +1,31 @@ -----BEGIN CERTIFICATE----- MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjIwNjA4MDkwNDU3WhcN -MjMwNjA4MDkwNDU3WjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjMwNjA4MTY0NDI2WhcN +MjQwNjA3MTY0NDI2WjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZD bGllbnQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCAiIwDQYJKoZIhvcNAQEBBQADggIP -ADCCAgoCggIBAKmJw3BpO3T+4AIiOwE6FYCge7+R4F300DAHKKsZfSpZWcoCYEs3 -cwhEuoE0cbupK/wPHc4imhL4cI97w0hMeupIGYEH5nhBRlFz++P9lj99Vya4DUhc -VGYo/5VqS6SJGLXIQX1QVN5u4HxX7zCsYLOxhpS/NkG0MtdHQHnhEiCi+zxINFsX -o2ESme5U7w8YDr/iS6+934Ym60euLRqLTvg3mc2KWEhC/x3L8M6hKBqwPaVI8nR1 -nr6uUnk9DvPX6C+yieYfReqhZm9QHrNFM5ZlZF7gqLjCDgW730Gb2vkmRje2a13Z -aqgFI1NwTZHr3b3eyotLjvCRfgEWSE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beWc4K3qgg6BUUkfSf4W9oJD4JCa2 +cOsqnKqFxTwXT4b9j9qsPpg7mUQ2+UtU4Lv3h/7sXpbpx0ldb2Hnaq+JqUz0l/7c +54y3+nzke7I4CWKtLJUSamQiyOC3CBVkRX0YEYUBhMXim6dKAfiOEV6K3bwiU+YZ +aDe0lEeLbzAp87DKRTAvDYhRMIFtD3g2qmYrWpQ4gj8vSEorNAfg3kVHMFRGlk9o +jaFduAz0hKk+QG5SgePXMph5ZRXGRq0FnDbF2gZ7WV+jZiIhsYGJ43+RBWHh4HO4 +P4h9eOWQG8AxpDRmOo2KmyPbV0V/eltC4N0oOAmWz+i0qqulnpG4dOzQKpinRBBr +jPt5 -----END CERTIFICATE----- diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.csr b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.csr index ecca8ff676..b783896725 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.csr +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.csr @@ -2,27 +2,27 @@ MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGQ2xp ZW50MRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQCpicNwaTt0/uACIjsBOhWAoHu/keBd9NAwByirGX0qWVnKAmBLN3MI -RLqBNHG7qSv8Dx3OIpoS+HCPe8NITHrqSBmBB+Z4QUZRc/vj/ZY/fVcmuA1IXFRm -KP+VakukiRi1yEF9UFTebuB8V+8wrGCzsYaUvzZBtDLXR0B54RIgovs8SDRbF6Nh -EpnuVO8PGA6/4kuvvd+GJutHri0ai074N5nNilhIQv8dy/DOoSgasD2lSPJ0dZ6+ -rlJ5PQ7z1+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nIyd6CPg++K7TBzYGGOf1CUCrI9S1bBn3jcv2mq5YgZMdLEa0HkA9XzU +J/dTSGz5pJbkoaX9IHv8a3uoc+V1jdNWZRmTUYG/cNoAFISoG+uuJLgesF5l+vxx +GUwkE6wj4bNYR/Pqy5963oDmA3ndBzR1wtCZqIsLX3t3A9fLLtIEgeN/XDSvNDBs +YdwBrx2HTatK7QCJ5e+4ACs6Wc2c1nnDviPddpxUgl0pHKcMbT+xNk7bY5fjl5Qr +wzuBNgvQcsZxNNvI8bs13k/eBmKrKOV2WUP1mHRzSoxPX3gzGRSWCe/7QR51oWlB +Qkb6OGVGLCKPnhIKFeZ6G1Qv8q7/hOOlmWGO4bN7s5fjAKEsm3JV1xrsqSKRofRG +JfdPjQD88jewIAk6xGSMKmc4usQN+y/IfU8yZ57MHSHULccA1Wl/VXfgKCAxS5fK +uXtm -----END CERTIFICATE REQUEST----- diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.key b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.key index 298d5296dd..58414d8d59 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.key +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/client.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKQIBAAKCAgEAqYnDcGk7dP7gAiI7AToVgKB7v5HgXfTQMAcoqxl9KllZygJg -SzdzCES6gTRxu6kr/A8dziKaEvhwj3vDSEx66kgZgQfmeEFGUXP74/2WP31XJrgN -SFxUZij/lWpLpIkYtchBfVBU3m7gfFfvMKxgs7GGlL82QbQy10dAeeESIKL7PEg0 -WxejYRKZ7lTvDxgOv+JLr73fhibrR64tGotO+DeZzYpYSEL/HcvwzqEoGrA9pUjy -dHWevq5SeT0O89foL7KJ5h9F6qFmb1Aes0UzlmVkXuCouMIOBbvfQZva+SZGN7Zr -XdlqqAUjU3BNkevdvd7Ki0uO8JF+ARZ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GQXGJi5F +3ckLV8H3QdQv3Waj9qqTVexKCAvf8MMCFR67YahLpIUMKvfqM0e2tmb5deNyOFbg +PHLLuE2urecQkasEGr478HHocsRhXpx03oDl4bcbUNceqo7my0YucoGtB5vczQtI +rKam9XimLHStrpHCwxxfPUnRVgEfT5bzwhWmeoDi4TZ8d0WvhfgtZ4FY1qKqal0v +eTIGFPU7YYTLIJzrn9P4Jr/PVOcUnp8ac4s7nr3KTpA/IKsbbVMGPRKegw7FSddr +ros57KltjQB5+kxlgb8V0FbubXO/a4r1AoIBAQC6GfLZDflLbmGx9cd7OV3nLm5m +hlfKuKwkYa7gKLGgR56/eKbqy/SY+y4K4xQLiNgVyayuUSqd8+fupESaG8J+kY6N +3K7LjdWzYzIJDYnonyqueqsn437CltWG0iBjpPZztexAiI8qk/jVniwIEOHzc4Cb +tPCP51NBbj0dSP9EFB+LbHh2F+zO0DkraA4P+bvKA6GLtfRPfqBi2rz9VVIvV0oR +sM6qfGJVECOxAc5seFSUO8RzEoNf5KQ+ATeRhWJQqGIhw+lP23w1rDv8FOWgxoxw +9O4IfGsSH6V+KYMN7wDx1Sebpw2IosCoGOjWHSH7mJcWy/uqocAirdf5fEeE -----END RSA PRIVATE KEY----- diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/regenerate.sh b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/regenerate.sh index e1f1af5b54..84637be753 100755 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/regenerate.sh +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/regenerate.sh @@ -8,15 +8,15 @@ rm ca.crt ca.key client.crt client.csr client.key server.crt server.csr server.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 -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 -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 -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 -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 +openssl genrsa -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/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.crt b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.crt index 7ef4b0f546..ace156a29e 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.crt +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.crt @@ -1,31 +1,31 @@ -----BEGIN CERTIFICATE----- MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ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m5dqBz7EVuhDJSyp4zCkDYsOj1y/SLL2O3cTyQQeZg6jlqripNqWnviAdTWe5 +JIPp -----END CERTIFICATE----- diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.csr b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.csr index 8485c97579..b421a7a60c 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.csr +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.csr @@ -2,27 +2,27 @@ MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGU2Vy dmVyMRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQDWrQdKnyLAYaYaG+r5BAerC3PUEbPhBl+WQpN4Fq6eo+B8OeCNL8CD -+R0LibRPH4g0ecQuHVjFo385hEX1yfAmHlmw/cx7BLCNebs/pZpV/oUySk8s1jzb -RTfiG2JnvrczUGQVcax6uisUahA4CpRbyOi9KKtF42JlbdAKkZ6FUVtY6gaE3SmH -ytbTZVi7n+pRM6YSs12TNF03PbyFMcPhVpaIMyVAfG6DW5FT628DjUJOgs/pnhQ9 -g+9XWDBq+DE8qWbSvAtKY1N9kcA/NhTVNguwx4ElJ3KbX1ilo0914LuK972A5Dw6 -B7QGWk7OkuWDQ46A1BAvoZ+Nm5b9NCyoCIknw9tp6dwbf4M8nfV7JSIpZNXcz7t7 -kz4va/+JtKTHl7qzDk5YYzOVExvOwLoKUCOA12Hp/1Be33sNurBDWTKDizX6kpPt -q5L6ZMw40UEgh6jYEYXny+/azvUtg5b98mnQZ/4dBq2td1keB368V2criPRXH47V -zaOfannks6PG0FGGUb9gDYLloNQ1NRB0dnBcktJcmHWgnYGjb7nrCrALMaABh5W5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eMA6y/qpfTNKi/f +F7v/7nDWoxBgpOw3J0E9R+6rxD7Cjb2RWZEf20ZGdNBlPE+UG9c9b3HC3IHiwRHb +L9Fi0251w+fkaPX8dojQKErCEknqJ1SCP5S5F5g1QCQby22Y7LQsggMMf94s/wQX +4uMh -----END CERTIFICATE REQUEST----- diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.key b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.key index 2dcd9159c5..80b9cea7bf 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.key +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/certs/server.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKAIBAAKCAgEA1q0HSp8iwGGmGhvq+QQHqwtz1BGz4QZflkKTeBaunqPgfDng -jS/Ag/kdC4m0Tx+INHnELh1YxaN/OYRF9cnwJh5ZsP3MewSwjXm7P6WaVf6FMkpP -LNY820U34htiZ763M1BkFXGserorFGoQOAqUW8jovSirReNiZW3QCpGehVFbWOoG -hN0ph8rW02VYu5/qUTOmErNdkzRdNz28hTHD4VaWiDMlQHxug1uRU+tvA41CToLP -6Z4UPYPvV1gwavgxPKlm0rwLSmNTfZHAPzYU1TYLsMeBJSdym19YpaNPdeC7ive9 -gOQ8Oge0BlpOzpLlg0OOgNQQL6GfjZuW/TQsqAiJJ8PbaencG3+DPJ31eyUiKWTV -3M+7e5M+L2v/ibSkx5e6sw5OWGMzlRMbzsC6ClAjgNdh6f9QXt97DbqwQ1kyg4s1 -+pKT7auS+mTMONFBIIeo2BGF58vv2s71LYOW/fJp0Gf+HQatrXdZHgd+vFdnK4j0 -Vx+O1c2jn2p55LOjxtBRhlG/YA2C5aDUNTUQdHZwXJLSXJh1oJ2Bo2+56wqwCzGg -AYeVubfZ85J7yRyBUK179x4x29MWH1Er0Kr6JpB25vjGjYlgm95Eq3/0jzIOmj3m -Z32m3W+a4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qqXGl6IDEXFk12 +mcgrRuPnohAF7Z49/jp5wruYd8heyQdMGk8Z3l+OSFsdMIKxNDWbPuItxK/pCVRM +OooNEdM2uHAighJR9x9/kXFB3j7YuqbTbEz7MvLd+AJVfUos+zwcTuj7q72XGMsb +Gt4jRsrgeDA+paiavKKWyGgw125xXUx1xOUvhGJfL+MB3XTHdOb9nyaDANMw4MN2 +Ff18SMRkj0NzqmRaoEPg5dP0ORcpWJjM5R7Qt6FLnyfx2dhWNltyBBtgSTEVAjoN +Gcr4EgpmFEpA3aaG5QmYYJ/b9m2mWUpnr1iVmeDvadKu9IAi7LgPpV26ar4D -----END RSA PRIVATE KEY----- diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/metricsHelper.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/metricsHelper.ts index 4713e7aa3f..e6332ff36f 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/metricsHelper.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/metricsHelper.ts @@ -17,6 +17,7 @@ import { Counter, Histogram, + HrTime, ObservableGauge, ObservableResult, ValueType, @@ -31,7 +32,13 @@ import { MetricReader, View, } from '@opentelemetry/sdk-metrics'; -import { IKeyValue, IMetric, IResource } from '@opentelemetry/otlp-transformer'; +import { + hrTimeToFixed64Nanos, + IKeyValue, + IMetric, + IResource, + UnsignedLong, +} from '@opentelemetry/otlp-transformer'; class TestMetricReader extends MetricReader { protected onForceFlush(): Promise { @@ -125,92 +132,99 @@ export function ensureExportedAttributesAreCorrect(attributes: IKeyValue[]) { export function ensureExportedCounterIsCorrect( metric: IMetric, - time?: number, - startTime?: number + time: HrTime, + startTime: HrTime ) { - assert.deepStrictEqual(metric, { - name: 'int-counter', - description: 'sample counter description', - unit: '', - data: 'sum', - sum: { - dataPoints: [ - { - attributes: [], - exemplars: [], - value: 'asInt', - asInt: '1', - flags: 0, - startTimeUnixNano: String(startTime), - timeUnixNano: String(time), - }, - ], - isMonotonic: true, - aggregationTemporality: 'AGGREGATION_TEMPORALITY_CUMULATIVE', - }, - }); + assert.strictEqual(metric.name, 'int-counter'); + assert.strictEqual(metric.description, 'sample counter description'); + assert.strictEqual(metric.unit, ''); + assert.strictEqual(metric.sum?.dataPoints.length, 1); + assert.strictEqual( + metric.sum?.aggregationTemporality, + 'AGGREGATION_TEMPORALITY_CUMULATIVE' + ); + assert.strictEqual(metric.sum?.isMonotonic, true); + + const [dp] = metric.sum.dataPoints; + + assert.deepStrictEqual(dp.attributes, []); + assert.deepStrictEqual(dp.exemplars, []); + assert.strictEqual(dp.asInt, '1'); + assert.strictEqual(dp.flags, 0); + + assert.deepStrictEqual( + UnsignedLong.fromString(dp.startTimeUnixNano as string), + hrTimeToFixed64Nanos(startTime) + ); + assert.deepStrictEqual( + UnsignedLong.fromString(dp.timeUnixNano as string), + hrTimeToFixed64Nanos(time) + ); } export function ensureExportedObservableGaugeIsCorrect( metric: IMetric, - time?: number, - startTime?: number + time: HrTime, + startTime: HrTime ) { - assert.deepStrictEqual(metric, { - name: 'double-observable-gauge', - description: 'sample observable gauge description', - unit: '', - data: 'gauge', - gauge: { - dataPoints: [ - { - attributes: [], - exemplars: [], - value: 'asDouble', - asDouble: 6, - flags: 0, - startTimeUnixNano: String(startTime), - timeUnixNano: String(time), - }, - ], - }, - }); + assert.strictEqual(metric.name, 'double-observable-gauge'); + assert.strictEqual(metric.description, 'sample observable gauge description'); + assert.strictEqual(metric.unit, ''); + assert.strictEqual(metric.gauge?.dataPoints.length, 1); + + const [dp] = metric.gauge.dataPoints; + + assert.deepStrictEqual(dp.attributes, []); + assert.deepStrictEqual(dp.exemplars, []); + assert.strictEqual(dp.asDouble, 6); + assert.strictEqual(dp.flags, 0); + + assert.deepStrictEqual( + UnsignedLong.fromString(dp.startTimeUnixNano as string), + hrTimeToFixed64Nanos(startTime) + ); + assert.deepStrictEqual( + UnsignedLong.fromString(dp.timeUnixNano as string), + hrTimeToFixed64Nanos(time) + ); } export function ensureExportedHistogramIsCorrect( metric: IMetric, - time?: number, - startTime?: number, + time: HrTime, + startTime: HrTime, explicitBounds: number[] = [Infinity], bucketCounts: string[] = ['2', '0'] ) { - assert.deepStrictEqual(metric, { - name: 'int-histogram', - description: 'sample histogram description', - unit: '', - data: 'histogram', - histogram: { - dataPoints: [ - { - attributes: [], - exemplars: [], - flags: 0, - _sum: 'sum', - _min: 'min', - _max: 'max', - sum: 21, - count: '2', - min: 7, - max: 14, - startTimeUnixNano: String(startTime), - timeUnixNano: String(time), - bucketCounts, - explicitBounds, - }, - ], - aggregationTemporality: 'AGGREGATION_TEMPORALITY_CUMULATIVE', - }, - }); + assert.strictEqual(metric.name, 'int-histogram'); + assert.strictEqual(metric.description, 'sample histogram description'); + assert.strictEqual(metric.unit, ''); + assert.strictEqual(metric.histogram?.dataPoints.length, 1); + assert.strictEqual( + metric.histogram?.aggregationTemporality, + 'AGGREGATION_TEMPORALITY_CUMULATIVE' + ); + + const [dp] = metric.histogram.dataPoints; + + assert.deepStrictEqual(dp.attributes, []); + assert.deepStrictEqual(dp.exemplars, []); + assert.strictEqual(dp.flags, 0); + assert.strictEqual(dp.sum, 21); + assert.strictEqual(dp.count, '2'); + assert.strictEqual(dp.min, 7); + assert.strictEqual(dp.max, 14); + + assert.deepStrictEqual( + UnsignedLong.fromString(dp.startTimeUnixNano as string), + hrTimeToFixed64Nanos(startTime) + ); + assert.deepStrictEqual( + UnsignedLong.fromString(dp.timeUnixNano as string), + hrTimeToFixed64Nanos(time) + ); + assert.deepStrictEqual(dp.bucketCounts, bucketCounts); + assert.deepStrictEqual(dp.explicitBounds, explicitBounds); } export function ensureResourceIsCorrect(resource: IResource) { diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/.eslintrc.js b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/.eslintrc.js index e41d9a9299..c054089042 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/.eslintrc.js +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/.eslintrc.js @@ -5,5 +5,5 @@ module.exports = { "node": true, "browser": true }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/README.md b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/README.md index 0645aa1219..ba449280b0 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/README.md +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/README.md @@ -5,8 +5,7 @@ **Note: This is an experimental package under active development. New releases may include breaking changes.** -This module provides exporter for web and node to be used with OTLP (`http/json`) compatible receivers. -Compatible with [opentelemetry-collector][opentelemetry-collector-url] versions `>=0.52 <=0.53`. +This module provides a metrics-exporter for OTLP (http/json) using protocol version `v0.20.0`. ## Installation @@ -81,7 +80,7 @@ In addition to settings passed to the constructor, the exporter also supports co |---------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | OTEL_EXPORTER_OTLP_ENDPOINT | The endpoint to send metrics to. This will also be used for the traces exporter if `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` is not configured. By default `http://localhost:4318` will be used. `/v1/metrics` will be automatically appended to configured values. | | OTEL_EXPORTER_OTLP_METRICS_ENDPOINT | The endpoint to send metrics to. By default `https://localhost:4318/v1/metrics` will be used. `v1/metrics` will not be appended automatically and has to be added explicitly. | -| OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE | The exporters aggregation temporality preference. Valid values are `cumulative`, and `delta`. `cumulative` selects cumulative temporality for all instrument kinds. `delta` selects delta aggregation temporality for Counter, Asynchronous Counter and Histogram instrument kinds, and selects cumulative aggregation for UpDownCounter and Asynchronous UpDownCounter instrument kinds. By default `cumulative` is used. | +| OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE | The exporters aggregation temporality preference. Valid values are `cumulative`, `delta`, and `lowmemory`. `cumulative` selects cumulative temporality for all instrument kinds. `delta` selects delta aggregation temporality for Counter, Asynchronous Counter and Histogram instrument kinds, and selects cumulative aggregation for UpDownCounter and Asynchronous UpDownCounter instrument kinds. `lowmemory` selects delta aggregation temporality for Counter and Histogram instrument kinds, and selects cumulative aggregation for UpDownCounter, Asynchronous Counter and Asynchronous UpDownCounter instrument kinds. By default `cumulative` is used. | > Settings configured programmatically take precedence over environment variables. Per-signal environment variables take > precedence over non-per-signal environment variables. diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json index 7ddbd94874..7ab50d0ea8 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-metrics-otlp-http", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -23,10 +23,10 @@ "tdd": "npm run test -- --watch-extensions ts --watch", "tdd:browser": "karma start", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" @@ -63,41 +63,43 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", - "@opentelemetry/api": "1.4.1", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@opentelemetry/api": "1.6.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "@types/webpack-env": "1.16.3", - "babel-loader": "8.2.3", + "babel-loader": "8.3.0", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", "cpx": "1.5.0", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", "webpack": "4.46.0", - "webpack-cli": "4.9.1", - "webpack-merge": "5.8.0" + "webpack-cli": "4.10.0", + "webpack-merge": "5.9.0" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/otlp-exporter-base": "0.39.1", - "@opentelemetry/otlp-transformer": "0.39.1", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/sdk-metrics": "1.13.0" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/otlp-exporter-base": "0.44.0", + "@opentelemetry/otlp-transformer": "0.44.0", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-metrics": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-http", "sideEffects": false diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts index bbebe6cd1f..db8a4a32ed 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts @@ -22,7 +22,10 @@ import { PushMetricExporter, ResourceMetrics, } from '@opentelemetry/sdk-metrics'; -import { OTLPMetricExporterOptions } from './OTLPMetricExporterOptions'; +import { + AggregationTemporalityPreference, + OTLPMetricExporterOptions, +} from './OTLPMetricExporterOptions'; import { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base'; import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; import { diag } from '@opentelemetry/api'; @@ -45,6 +48,21 @@ export const DeltaTemporalitySelector: AggregationTemporalitySelector = ( } }; +export const LowMemoryTemporalitySelector: AggregationTemporalitySelector = ( + instrumentType: InstrumentType +) => { + switch (instrumentType) { + case InstrumentType.COUNTER: + case InstrumentType.HISTOGRAM: + return AggregationTemporality.DELTA; + case InstrumentType.UP_DOWN_COUNTER: + case InstrumentType.OBSERVABLE_UP_DOWN_COUNTER: + case InstrumentType.OBSERVABLE_COUNTER: + case InstrumentType.OBSERVABLE_GAUGE: + return AggregationTemporality.CUMULATIVE; + } +}; + function chooseTemporalitySelectorFromEnvironment() { const env = getEnv(); const configuredTemporality = @@ -56,6 +74,9 @@ function chooseTemporalitySelectorFromEnvironment() { if (configuredTemporality === 'delta') { return DeltaTemporalitySelector; } + if (configuredTemporality === 'lowmemory') { + return LowMemoryTemporalitySelector; + } diag.warn( `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.` @@ -64,12 +85,18 @@ function chooseTemporalitySelectorFromEnvironment() { } function chooseTemporalitySelector( - temporalityPreference?: AggregationTemporality + temporalityPreference?: + | AggregationTemporalityPreference + | AggregationTemporality ): AggregationTemporalitySelector { // Directly passed preference has priority. if (temporalityPreference != null) { - if (temporalityPreference === AggregationTemporality.DELTA) { + if (temporalityPreference === AggregationTemporalityPreference.DELTA) { return DeltaTemporalitySelector; + } else if ( + temporalityPreference === AggregationTemporalityPreference.LOWMEMORY + ) { + return LowMemoryTemporalitySelector; } return CumulativeTemporalitySelector; } @@ -82,11 +109,11 @@ export class OTLPMetricExporterBase< OTLPMetricExporterOptions, ResourceMetrics, IExportMetricsServiceRequest - > + >, > implements PushMetricExporter { public _otlpExporter: T; - protected _aggregationTemporalitySelector: AggregationTemporalitySelector; + private _aggregationTemporalitySelector: AggregationTemporalitySelector; constructor(exporter: T, config?: OTLPMetricExporterOptions) { this._otlpExporter = exporter; diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterOptions.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterOptions.ts index 32529efee1..e03bde4e75 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterOptions.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterOptions.ts @@ -14,9 +14,17 @@ * limitations under the License. */ -import { AggregationTemporality } from '@opentelemetry/sdk-metrics'; import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; +import { AggregationTemporality } from '@opentelemetry/sdk-metrics'; export interface OTLPMetricExporterOptions extends OTLPExporterConfigBase { - temporalityPreference?: AggregationTemporality; + temporalityPreference?: + | AggregationTemporalityPreference + | AggregationTemporality; +} + +export enum AggregationTemporalityPreference { + DELTA, + CUMULATIVE, + LOWMEMORY, } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/browser/CollectorMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/browser/CollectorMetricExporter.test.ts index 17bb066c38..df4028db38 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/browser/CollectorMetricExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/browser/CollectorMetricExporter.test.ts @@ -21,11 +21,8 @@ import { Counter, Histogram, } from '@opentelemetry/api'; -import { ExportResultCode, hrTimeToNanoseconds } from '@opentelemetry/core'; -import { - AggregationTemporality, - ResourceMetrics, -} from '@opentelemetry/sdk-metrics'; +import { ExportResultCode } from '@opentelemetry/core'; +import { ResourceMetrics } from '@opentelemetry/sdk-metrics'; import * as assert from 'assert'; import * as sinon from 'sinon'; import { OTLPMetricExporter } from '../../src/platform/browser'; @@ -44,7 +41,10 @@ import { setUp, shutdown, } from '../metricsHelper'; -import { OTLPMetricExporterOptions } from '../../src'; +import { + AggregationTemporalityPreference, + OTLPMetricExporterOptions, +} from '../../src'; import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; import { FetchMockStatic, MockCall } from 'fetch-mock/esm/client'; @@ -104,7 +104,7 @@ describe('OTLPMetricExporter - web', () => { beforeEach(() => { collectorExporter = new OTLPMetricExporter({ url: 'http://foo.bar.com', - temporalityPreference: AggregationTemporality.CUMULATIVE, + temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, }); }); @@ -140,14 +140,9 @@ describe('OTLPMetricExporter - web', () => { ensureCounterIsCorrect( metric1, - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0] - .endTime - ), - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0] - .startTime - ) + metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0].endTime, + metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0] + .startTime ); assert.ok( @@ -156,14 +151,10 @@ describe('OTLPMetricExporter - web', () => { ); ensureObservableGaugeIsCorrect( metric2, - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] - .endTime - ), - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] - .startTime - ), + metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] + .endTime, + metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] + .startTime, 6, 'double-observable-gauge2' ); @@ -174,14 +165,10 @@ describe('OTLPMetricExporter - web', () => { ); ensureHistogramIsCorrect( metric3, - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] - .endTime - ), - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] - .startTime - ), + metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] + .endTime, + metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] + .startTime, [0, 100], [0, 2, 0] ); @@ -232,7 +219,7 @@ describe('OTLPMetricExporter - web', () => { (window.navigator as any).sendBeacon = false; collectorExporter = new OTLPMetricExporter({ url: 'http://foo.bar.com', - temporalityPreference: AggregationTemporality.CUMULATIVE, + temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, }); // Overwrites the start time to make tests consistent Object.defineProperty(collectorExporter, '_startTime', { @@ -275,14 +262,9 @@ describe('OTLPMetricExporter - web', () => { assert.ok(typeof metric1 !== 'undefined', "metric doesn't exist"); ensureCounterIsCorrect( metric1, - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0] - .endTime - ), - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0] - .startTime - ) + metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0].endTime, + metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0] + .startTime ); assert.ok( @@ -291,14 +273,10 @@ describe('OTLPMetricExporter - web', () => { ); ensureObservableGaugeIsCorrect( metric2, - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] - .endTime - ), - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] - .startTime - ), + metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] + .endTime, + metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] + .startTime, 6, 'double-observable-gauge2' ); @@ -309,14 +287,10 @@ describe('OTLPMetricExporter - web', () => { ); ensureHistogramIsCorrect( metric3, - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] - .endTime - ), - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] - .startTime - ), + metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] + .endTime, + metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] + .startTime, [0, 100], [0, 2, 0] ); @@ -381,7 +355,7 @@ describe('OTLPMetricExporter - web', () => { stubXhr = sinon.stub(globalThis, 'XMLHttpRequest').value(undefined); collectorExporter = new OTLPMetricExporter({ url, - temporalityPreference: AggregationTemporality.CUMULATIVE, + temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, }); // Overwrites the start time to make tests consistent Object.defineProperty(collectorExporter, '_startTime', { @@ -427,14 +401,9 @@ describe('OTLPMetricExporter - web', () => { assert.ok(typeof metric1 !== 'undefined', "metric doesn't exist"); ensureCounterIsCorrect( metric1, - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0] - .endTime - ), - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0] - .startTime - ) + metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0].endTime, + metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0] + .startTime ); assert.ok( @@ -443,14 +412,10 @@ describe('OTLPMetricExporter - web', () => { ); ensureObservableGaugeIsCorrect( metric2, - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] - .endTime - ), - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] - .startTime - ), + metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] + .endTime, + metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] + .startTime, 6, 'double-observable-gauge2' ); @@ -461,14 +426,10 @@ describe('OTLPMetricExporter - web', () => { ); ensureHistogramIsCorrect( metric3, - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] - .endTime - ), - hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] - .startTime - ), + metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] + .endTime, + metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] + .startTime, [0, 100], [0, 2, 0] ); @@ -531,7 +492,7 @@ describe('OTLPMetricExporter - web', () => { it('should send custom headers', done => { collectorExporter = new OTLPMetricExporter({ url, - temporalityPreference: AggregationTemporality.CUMULATIVE, + temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, headers: { 'My-Custom-Header1': '123', 'My-Custom-Header2': 'abc', @@ -573,7 +534,7 @@ describe('OTLPMetricExporter - web', () => { beforeEach(() => { collectorExporterConfig = { headers: customHeaders, - temporalityPreference: AggregationTemporality.CUMULATIVE, + temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, }; server = sinon.fakeServer.create(); }); @@ -763,7 +724,7 @@ describe('when configuring via environment', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar'; const collectorExporter = new OTLPMetricExporter({ headers: {}, - temporalityPreference: AggregationTemporality.CUMULATIVE, + temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, }); assert.strictEqual( collectorExporter['_otlpExporter']['_headers'].foo, @@ -776,7 +737,7 @@ describe('when configuring via environment', () => { envSource.OTEL_EXPORTER_OTLP_METRICS_HEADERS = 'foo=boo'; const collectorExporter = new OTLPMetricExporter({ headers: {}, - temporalityPreference: AggregationTemporality.CUMULATIVE, + temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, }); assert.strictEqual( collectorExporter['_otlpExporter']['_headers'].foo, diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/metricsHelper.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/metricsHelper.ts index 6796c155f0..9bbeee652f 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/metricsHelper.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/metricsHelper.ts @@ -22,6 +22,7 @@ import { ObservableCounter, ObservableGauge, ObservableUpDownCounter, + HrTime, } from '@opentelemetry/api'; import { Resource } from '@opentelemetry/resources'; import * as assert from 'assert'; @@ -33,6 +34,7 @@ import { View, } from '@opentelemetry/sdk-metrics'; import { + hrTimeToFixed64Nanos, IExportMetricsServiceRequest, IKeyValue, IMetric, @@ -205,28 +207,29 @@ export function ensureWebResourceIsCorrect(resource: IResource) { assert.strictEqual(resource.droppedAttributesCount, 0); } +function hrTimeToFixed64(hrTime: HrTime) { + const { low, high } = hrTimeToFixed64Nanos(hrTime); + return { low, high }; +} + export function ensureCounterIsCorrect( metric: IMetric, - time?: number, - startTime?: number + time: HrTime, + startTime: HrTime ) { - assert.deepStrictEqual(metric, { - name: 'int-counter', - description: 'sample counter description', - unit: '', - sum: { - dataPoints: [ - { - attributes: [], - asInt: 1, - startTimeUnixNano: startTime, - timeUnixNano: time, - }, - ], - isMonotonic: true, - aggregationTemporality: 2, - }, - }); + assert.strictEqual(metric.name, 'int-counter'); + assert.strictEqual(metric.description, 'sample counter description'); + assert.strictEqual(metric.unit, ''); + assert.strictEqual(metric.sum?.dataPoints.length, 1); + assert.strictEqual(metric.sum?.isMonotonic, true); + assert.strictEqual(metric.sum?.aggregationTemporality, 2); + + const [dp] = metric.sum.dataPoints; + + assert.deepStrictEqual(dp.attributes, []); + assert.strictEqual(dp.asInt, 1); + assert.deepStrictEqual(dp.startTimeUnixNano, hrTimeToFixed64(startTime)); + assert.deepStrictEqual(dp.timeUnixNano, hrTimeToFixed64(time)); } export function ensureDoubleCounterIsCorrect( @@ -255,108 +258,50 @@ export function ensureDoubleCounterIsCorrect( export function ensureObservableGaugeIsCorrect( metric: IMetric, - time: number, - startTime: number, + time: HrTime, + startTime: HrTime, value: number, name = 'double-observable-gauge' ) { - assert.deepStrictEqual(metric, { - name, - description: 'sample observable gauge description', - unit: '', - gauge: { - dataPoints: [ - { - attributes: [], - asDouble: value, - startTimeUnixNano: startTime, - timeUnixNano: time, - }, - ], - }, - }); -} + assert.strictEqual(metric.name, name); + assert.strictEqual(metric.description, 'sample observable gauge description'); + assert.strictEqual(metric.unit, ''); + assert.strictEqual(metric.gauge?.dataPoints.length, 1); -export function ensureObservableCounterIsCorrect( - metric: IMetric, - time: number, - startTime: number, - value: number, - name = 'double-observable-counter' -) { - assert.deepStrictEqual(metric, { - name, - description: 'sample observable counter description', - unit: '', - doubleSum: { - isMonotonic: true, - dataPoints: [ - { - attributes: [], - value, - startTimeUnixNano: startTime, - timeUnixNano: time, - }, - ], - aggregationTemporality: 2, - }, - }); -} + const [dp] = metric.gauge.dataPoints; -export function ensureObservableUpDownCounterIsCorrect( - metric: IMetric, - time: number, - startTime: number, - value: number, - name = 'double-up-down-observable-counter' -) { - assert.deepStrictEqual(metric, { - name, - description: 'sample observable up down counter description', - unit: '', - doubleSum: { - isMonotonic: false, - dataPoints: [ - { - labels: [], - value, - startTimeUnixNano: startTime, - timeUnixNano: time, - }, - ], - aggregationTemporality: 2, - }, - }); + assert.deepStrictEqual(dp.attributes, []); + assert.strictEqual(dp.asDouble, value); + + assert.deepStrictEqual(dp.startTimeUnixNano, hrTimeToFixed64(startTime)); + assert.deepStrictEqual(dp.timeUnixNano, hrTimeToFixed64(time)); } export function ensureHistogramIsCorrect( metric: IMetric, - time: number, - startTime: number, + time: HrTime, + startTime: HrTime, explicitBounds: (number | null)[] = [Infinity], bucketCounts: number[] = [2, 0] ) { - assert.deepStrictEqual(metric, { - name: 'int-histogram', - description: 'sample histogram description', - unit: '', - histogram: { - dataPoints: [ - { - attributes: [], - sum: 21, - count: 2, - min: 7, - max: 14, - startTimeUnixNano: startTime, - timeUnixNano: time, - bucketCounts, - explicitBounds, - }, - ], - aggregationTemporality: 2, - }, - }); + assert.strictEqual(metric.name, 'int-histogram'); + assert.strictEqual(metric.description, 'sample histogram description'); + assert.strictEqual(metric.unit, ''); + assert.strictEqual(metric.histogram?.dataPoints.length, 1); + assert.strictEqual(metric.histogram?.aggregationTemporality, 2); + + const [dp] = metric.histogram.dataPoints; + + assert.deepStrictEqual(dp.attributes, []); + assert.strictEqual(dp.sum, 21); + assert.strictEqual(dp.count, 2); + assert.strictEqual(dp.min, 7); + assert.strictEqual(dp.max, 14); + assert.deepStrictEqual(dp.bucketCounts, bucketCounts); + assert.deepStrictEqual(dp.explicitBounds, explicitBounds); + + assert.deepStrictEqual(dp.startTimeUnixNano, hrTimeToFixed64(startTime)); + assert.deepStrictEqual(dp.timeUnixNano, hrTimeToFixed64(time)); } export function ensureExportMetricsServiceRequestIsSet( diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts index 042e5ebb4b..2f809e6251 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts @@ -20,8 +20,10 @@ import * as assert from 'assert'; import * as http from 'http'; import * as sinon from 'sinon'; import { + AggregationTemporalityPreference, CumulativeTemporalitySelector, DeltaTemporalitySelector, + LowMemoryTemporalitySelector, OTLPMetricExporterOptions, } from '../../src'; @@ -42,6 +44,7 @@ import { import { MockedResponse } from './nodeHelpers'; import { AggregationTemporality, + InstrumentType, ResourceMetrics, } from '@opentelemetry/sdk-metrics'; import { PassThrough, Stream } from 'stream'; @@ -105,6 +108,116 @@ describe('OTLPMetricExporter - node with json over http', () => { }); }); + describe('temporality', () => { + it('should use the right temporality when Cumulative preference is selected', () => { + const exporter = new OTLPMetricExporter({ + temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, + }); + + assert.equal( + exporter.selectAggregationTemporality(InstrumentType.COUNTER), + AggregationTemporality.CUMULATIVE, + 'Counter' + ); + assert.equal( + exporter.selectAggregationTemporality(InstrumentType.HISTOGRAM), + AggregationTemporality.CUMULATIVE, + 'Histogram' + ); + assert.equal( + exporter.selectAggregationTemporality(InstrumentType.UP_DOWN_COUNTER), + AggregationTemporality.CUMULATIVE, + 'UpDownCounter' + ); + assert.equal( + exporter.selectAggregationTemporality( + InstrumentType.OBSERVABLE_COUNTER + ), + AggregationTemporality.CUMULATIVE, + 'Asynchronous Counter' + ); + assert.equal( + exporter.selectAggregationTemporality( + InstrumentType.OBSERVABLE_UP_DOWN_COUNTER + ), + AggregationTemporality.CUMULATIVE, + 'Asynchronous UpDownCounter' + ); + }); + + it('should use the right temporality when Delta preference is selected', () => { + const exporter = new OTLPMetricExporter({ + temporalityPreference: AggregationTemporalityPreference.DELTA, + }); + + assert.equal( + exporter.selectAggregationTemporality(InstrumentType.COUNTER), + AggregationTemporality.DELTA, + 'Counter' + ); + assert.equal( + exporter.selectAggregationTemporality(InstrumentType.HISTOGRAM), + AggregationTemporality.DELTA, + 'Histogram' + ); + assert.equal( + exporter.selectAggregationTemporality(InstrumentType.UP_DOWN_COUNTER), + AggregationTemporality.CUMULATIVE, + 'UpDownCounter' + ); + assert.equal( + exporter.selectAggregationTemporality( + InstrumentType.OBSERVABLE_COUNTER + ), + AggregationTemporality.DELTA, + 'Asynchronous Counter' + ); + assert.equal( + exporter.selectAggregationTemporality( + InstrumentType.OBSERVABLE_UP_DOWN_COUNTER + ), + AggregationTemporality.CUMULATIVE, + 'Asynchronous UpDownCounter' + ); + }); + + it('should use the right temporality when LowMemory preference is selected', () => { + const exporter = new OTLPMetricExporter({ + temporalityPreference: AggregationTemporalityPreference.LOWMEMORY, + }); + + assert.equal( + exporter.selectAggregationTemporality(InstrumentType.COUNTER), + AggregationTemporality.DELTA, + 'Counter' + ); + assert.equal( + exporter.selectAggregationTemporality(InstrumentType.HISTOGRAM), + AggregationTemporality.DELTA, + 'Histogram' + ); + assert.equal( + exporter.selectAggregationTemporality(InstrumentType.UP_DOWN_COUNTER), + AggregationTemporality.CUMULATIVE, + 'UpDownCounter' + ); + assert.equal( + exporter.selectAggregationTemporality( + InstrumentType.OBSERVABLE_COUNTER + ), + AggregationTemporality.CUMULATIVE, + 'Asynchronous Counter' + ); + assert.equal( + exporter.selectAggregationTemporality( + InstrumentType.OBSERVABLE_UP_DOWN_COUNTER + ), + AggregationTemporality.CUMULATIVE, + 'Asynchronous UpDownCounter' + ); + }); + }); + describe('when configuring via environment', () => { const envSource = process.env; it('should use url defined in env that ends with root path and append version and signal path', () => { @@ -230,6 +343,21 @@ describe('OTLPMetricExporter - node with json over http', () => { ); } }); + it('should use low memory temporality defined via env', () => { + for (const envValue of [ + 'lowmemory', + 'LOWMEMORY', + 'LoWMeMOrY', + 'lowmemory ', + ]) { + envSource.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE = envValue; + const exporter = new OTLPMetricExporter(); + assert.strictEqual( + exporter['_aggregationTemporalitySelector'], + LowMemoryTemporalitySelector + ); + } + }); it('should configure cumulative temporality with invalid value in env', () => { for (const envValue of ['invalid', ' ']) { envSource.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE = envValue; @@ -244,7 +372,7 @@ describe('OTLPMetricExporter - node with json over http', () => { envSource.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE = 'cumulative'; const exporter = new OTLPMetricExporter({ - temporalityPreference: AggregationTemporality.DELTA, + temporalityPreference: AggregationTemporalityPreference.DELTA, }); assert.strictEqual( exporter['_aggregationTemporalitySelector'], @@ -264,7 +392,7 @@ describe('OTLPMetricExporter - node with json over http', () => { url: 'http://foo.bar.com', keepAlive: true, httpAgentOptions: { keepAliveMsecs: 2000 }, - temporalityPreference: AggregationTemporality.CUMULATIVE, + temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, }; collectorExporter = new OTLPMetricExporter(collectorExporterConfig); @@ -363,13 +491,8 @@ describe('OTLPMetricExporter - node with json over http', () => { assert.ok(typeof metric1 !== 'undefined', "counter doesn't exist"); ensureCounterIsCorrect( metric1, - core.hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0].endTime - ), - core.hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0] - .startTime - ) + metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0].endTime, + metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0].startTime ); assert.ok( typeof metric2 !== 'undefined', @@ -377,28 +500,19 @@ describe('OTLPMetricExporter - node with json over http', () => { ); ensureObservableGaugeIsCorrect( metric2, - core.hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] - .endTime - ), - core.hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] - .startTime - ), + metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] + .endTime, + metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] + .startTime, 6, 'double-observable-gauge2' ); assert.ok(typeof metric3 !== 'undefined', "histogram doesn't exist"); ensureHistogramIsCorrect( metric3, - core.hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] - .endTime - ), - core.hrTimeToNanoseconds( - metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] - .startTime - ), + metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0].endTime, + metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] + .startTime, [0, 100], [0, 2, 0] ); @@ -485,7 +599,7 @@ describe('OTLPMetricExporter - node with json over http', () => { const url = 'http://foo.bar.com'; const collectorExporter = new OTLPMetricExporter({ url, - temporalityPreference: AggregationTemporality.CUMULATIVE, + temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, }); setTimeout(() => { assert.strictEqual(collectorExporter._otlpExporter.url, url); diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/nodeHelpers.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/nodeHelpers.ts index 1219f2d976..d2dce6517b 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/nodeHelpers.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/nodeHelpers.ts @@ -17,7 +17,10 @@ import { Stream } from 'stream'; export class MockedResponse extends Stream { - constructor(private _code: number, private _msg?: string) { + constructor( + private _code: number, + private _msg?: string + ) { super(); } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/.eslintrc.js b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/.eslintrc.js index 3ed0fbeba3..9cfb3fd423 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/.eslintrc.js +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/.eslintrc.js @@ -4,5 +4,5 @@ module.exports = { "commonjs": true, "node": true, }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/README.md b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/README.md index 6a2e160bac..0056d2f3ca 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/README.md +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/README.md @@ -5,8 +5,7 @@ **Note: This is an experimental package under active development. New releases may include breaking changes.** -This module provides exporter for node to be used with OTLP (`http/protobuf`) compatible receivers. -Compatible with [opentelemetry-collector][opentelemetry-collector-url] versions `>=0.32 <=0.53`. +This module provides a metrics-exporter for OTLP (http/protobuf) using protocol version `v0.20.0`. ## Installation @@ -51,7 +50,7 @@ In addition to settings passed to the constructor, the exporter also supports co |---------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | OTEL_EXPORTER_OTLP_ENDPOINT | The endpoint to send metrics to. This will also be used for the traces exporter if `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` is not configured. By default `http://localhost:4318` will be used. `/v1/metrics` will be automatically appended to configured values. | | OTEL_EXPORTER_OTLP_METRICS_ENDPOINT | The endpoint to send metrics to. By default `https://localhost:4318/v1/metrics` will be used. `v1/metrics` will not be appended automatically and has to be added explicitly. | -| OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE | The exporters aggregation temporality preference. Valid values are `cumulative`, and `delta`. `cumulative` selects cumulative temporality for all instrument kinds. `delta` selects delta aggregation temporality for Counter, Asynchronous Counter and Histogram instrument kinds, and selects cumulative aggregation for UpDownCounter and Asynchronous UpDownCounter instrument kinds. By default `cumulative` is used. | +| OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE | The exporters aggregation temporality preference. Valid values are `cumulative`, `delta` and `lowmemory`. `cumulative` selects cumulative temporality for all instrument kinds. `delta` selects delta aggregation temporality for Counter, Asynchronous Counter and Histogram instrument kinds, and selects cumulative aggregation for UpDownCounter and Asynchronous UpDownCounter instrument kinds. `lowmemory` selects delta aggregation temporality for Counter and Histogram instrument kinds, and selects cumulative aggregation for UpDownCounter, Asynchronous Counter and Asynchronous UpDownCounter instrument kinds. By default `cumulative` is used. | > Settings configured programmatically take precedence over environment variables. Per-signal environment variables take > precedence over non-per-signal environment variables. diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json index d384051e56..f9ddf74a6e 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json @@ -1,21 +1,23 @@ { "name": "@opentelemetry/exporter-metrics-otlp-proto", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector using protobuf over HTTP", "main": "build/src/index.js", + "module": "build/esm/index.js", + "esnext": "build/esnext/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js", "scripts": { "prepublishOnly": "npm run compile", - "compile": "tsc --build", - "clean": "tsc --build --clean", + "compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", + "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "tdd": "npm run test -- --watch-extensions ts --watch", - "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", + "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", "version": "node ../../../scripts/version-update.js", - "watch": "tsc -w", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" @@ -35,6 +37,12 @@ "node": ">=14" }, "files": [ + "build/esm/**/*.js", + "build/esm/**/*.js.map", + "build/esm/**/*.d.ts", + "build/esnext/**/*.js", + "build/esnext/**/*.js.map", + "build/esnext/**/*.d.ts", "build/src/**/*.js", "build/src/**/*.js.map", "build/src/**/*.d.ts", @@ -47,16 +55,18 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", - "@opentelemetry/api": "1.4.1", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@opentelemetry/api": "1.6.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "codecov": "3.8.3", "cpx": "1.5.0", - "mocha": "10.0.0", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4" @@ -65,13 +75,13 @@ "@opentelemetry/api": "^1.3.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/exporter-metrics-otlp-http": "0.39.1", - "@opentelemetry/otlp-exporter-base": "0.39.1", - "@opentelemetry/otlp-proto-exporter-base": "0.39.1", - "@opentelemetry/otlp-transformer": "0.39.1", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/sdk-metrics": "1.13.0" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/exporter-metrics-otlp-http": "0.44.0", + "@opentelemetry/otlp-exporter-base": "0.44.0", + "@opentelemetry/otlp-proto-exporter-base": "0.44.0", + "@opentelemetry/otlp-transformer": "0.44.0", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-metrics": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-proto", "sideEffects": false diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts index d3270b6a9f..80902daeaa 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts @@ -38,14 +38,13 @@ import { setUp, shutdown, } from './metricsHelper'; +import { ResourceMetrics } from '@opentelemetry/sdk-metrics'; import { - AggregationTemporality, - ResourceMetrics, -} from '@opentelemetry/sdk-metrics'; -import { OTLPMetricExporterOptions } from '@opentelemetry/exporter-metrics-otlp-http'; + AggregationTemporalityPreference, + OTLPMetricExporterOptions, +} from '@opentelemetry/exporter-metrics-otlp-http'; import { Stream, PassThrough } from 'stream'; import { OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base'; -import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; import { VERSION } from '../src/version'; let fakeRequest: PassThrough; @@ -176,7 +175,7 @@ describe('OTLPMetricExporter - node with proto over http', () => { url: 'http://foo.bar.com', keepAlive: true, httpAgentOptions: { keepAliveMsecs: 2000 }, - temporalityPreference: AggregationTemporality.CUMULATIVE, + temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, }; collectorExporter = new OTLPMetricExporter(collectorExporterConfig); setUp(); @@ -260,7 +259,7 @@ describe('OTLPMetricExporter - node with proto over http', () => { ServiceClientType.METRICS ); const data = ExportTraceServiceRequestProto.decode(buff); - const json = data?.toJSON() as IExportMetricsServiceRequest; + const json = data?.toJSON() as any; // The order of the metrics is not guaranteed. const counterIndex = metrics.scopeMetrics[0].metrics.findIndex( @@ -283,8 +282,8 @@ describe('OTLPMetricExporter - node with proto over http', () => { assert.ok(typeof metric1 !== 'undefined', "counter doesn't exist"); ensureExportedCounterIsCorrect( metric1, - metric1.sum?.dataPoints[0].timeUnixNano, - metric1.sum?.dataPoints[0].startTimeUnixNano + metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0].endTime, + metrics.scopeMetrics[0].metrics[counterIndex].dataPoints[0].startTime ); assert.ok( typeof metric2 !== 'undefined', @@ -292,8 +291,10 @@ describe('OTLPMetricExporter - node with proto over http', () => { ); ensureExportedObservableGaugeIsCorrect( metric2, - metric2.gauge?.dataPoints[0].timeUnixNano, - metric2.gauge?.dataPoints[0].startTimeUnixNano + metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] + .endTime, + metrics.scopeMetrics[0].metrics[observableIndex].dataPoints[0] + .startTime ); assert.ok( typeof metric3 !== 'undefined', @@ -301,8 +302,9 @@ describe('OTLPMetricExporter - node with proto over http', () => { ); ensureExportedHistogramIsCorrect( metric3, - metric3.histogram?.dataPoints[0].timeUnixNano, - metric3.histogram?.dataPoints[0].startTimeUnixNano, + metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0].endTime, + metrics.scopeMetrics[0].metrics[histogramIndex].dataPoints[0] + .startTime, [0, 100], ['0', '2', '0'] ); diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/metricsHelper.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/metricsHelper.ts index 0012f0c118..6a47a9a8f6 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/metricsHelper.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/metricsHelper.ts @@ -20,6 +20,7 @@ import { Histogram, ValueType, ObservableGauge, + HrTime, } from '@opentelemetry/api'; import { Resource } from '@opentelemetry/resources'; import * as assert from 'assert'; @@ -30,9 +31,11 @@ import { View, } from '@opentelemetry/sdk-metrics'; import { + hrTimeToFixed64Nanos, IExportMetricsServiceRequest, IKeyValue, IMetric, + UnsignedLong, } from '@opentelemetry/otlp-transformer'; import { Stream } from 'stream'; @@ -129,75 +132,86 @@ export function ensureProtoAttributesAreCorrect(attributes: IKeyValue[]) { export function ensureExportedCounterIsCorrect( metric: IMetric, - time?: number, - startTime?: number + time: HrTime, + startTime: HrTime ) { - assert.deepStrictEqual(metric, { - name: 'int-counter', - description: 'sample counter description', - unit: '', - sum: { - dataPoints: [ - { - asInt: '1', - startTimeUnixNano: String(startTime), - timeUnixNano: String(time), - }, - ], - isMonotonic: true, - aggregationTemporality: 'AGGREGATION_TEMPORALITY_CUMULATIVE', - }, - }); + assert.strictEqual(metric.name, 'int-counter'); + assert.strictEqual(metric.description, 'sample counter description'); + assert.strictEqual(metric.unit, ''); + assert.strictEqual(metric.sum?.dataPoints.length, 1); + assert.strictEqual(metric.sum?.isMonotonic, true); + assert.strictEqual( + metric.sum?.aggregationTemporality, + 'AGGREGATION_TEMPORALITY_CUMULATIVE' + ); + + const [dp] = metric.sum.dataPoints; + assert.strictEqual(dp.asInt, '1'); + assert.deepStrictEqual( + UnsignedLong.fromString(dp.startTimeUnixNano as string), + hrTimeToFixed64Nanos(startTime) + ); + assert.deepStrictEqual( + UnsignedLong.fromString(dp.timeUnixNano as string), + hrTimeToFixed64Nanos(time) + ); } export function ensureExportedObservableGaugeIsCorrect( metric: IMetric, - time?: number, - startTime?: number + time: HrTime, + startTime: HrTime ) { - assert.deepStrictEqual(metric, { - name: 'double-observable-gauge', - description: 'sample observable gauge description', - unit: '', - gauge: { - dataPoints: [ - { - asDouble: 6, - startTimeUnixNano: String(startTime), - timeUnixNano: String(time), - }, - ], - }, - }); + assert.strictEqual(metric.name, 'double-observable-gauge'); + assert.strictEqual(metric.description, 'sample observable gauge description'); + assert.strictEqual(metric.unit, ''); + assert.strictEqual(metric.gauge?.dataPoints.length, 1); + + const [dp] = metric.gauge.dataPoints; + assert.strictEqual(dp.asDouble, 6); + assert.deepStrictEqual( + UnsignedLong.fromString(dp.startTimeUnixNano as string), + hrTimeToFixed64Nanos(startTime) + ); + assert.deepStrictEqual( + UnsignedLong.fromString(dp.timeUnixNano as string), + hrTimeToFixed64Nanos(time) + ); } export function ensureExportedHistogramIsCorrect( metric: IMetric, - time?: number, - startTime?: number, + time: HrTime, + startTime: HrTime, explicitBounds: number[] = [Infinity], bucketCounts: string[] = ['2', '0'] ) { - assert.deepStrictEqual(metric, { - name: 'int-histogram', - description: 'sample histogram description', - unit: '', - histogram: { - dataPoints: [ - { - sum: 21, - count: '2', - min: 7, - max: 14, - startTimeUnixNano: String(startTime), - timeUnixNano: String(time), - bucketCounts, - explicitBounds, - }, - ], - aggregationTemporality: 'AGGREGATION_TEMPORALITY_CUMULATIVE', - }, - }); + assert.strictEqual(metric.name, 'int-histogram'); + assert.strictEqual(metric.description, 'sample histogram description'); + assert.strictEqual(metric.unit, ''); + + assert.strictEqual(metric.histogram?.dataPoints.length, 1); + assert.strictEqual( + metric.histogram.aggregationTemporality, + 'AGGREGATION_TEMPORALITY_CUMULATIVE' + ); + + const [dp] = metric.histogram.dataPoints; + + assert.strictEqual(dp.sum, 21); + assert.strictEqual(dp.count, '2'); + assert.strictEqual(dp.min, 7); + assert.strictEqual(dp.max, 14); + assert.deepStrictEqual(dp.explicitBounds, explicitBounds); + assert.deepStrictEqual(dp.bucketCounts, bucketCounts); + assert.deepStrictEqual( + UnsignedLong.fromString(dp.startTimeUnixNano as string), + hrTimeToFixed64Nanos(startTime) + ); + assert.deepStrictEqual( + UnsignedLong.fromString(dp.timeUnixNano as string), + hrTimeToFixed64Nanos(time) + ); } export function ensureExportMetricsServiceRequestIsSet( @@ -224,7 +238,10 @@ export function ensureExportMetricsServiceRequestIsSet( } export class MockedResponse extends Stream { - constructor(private _code: number, private _msg?: string) { + constructor( + private _code: number, + private _msg?: string + ) { super(); } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.esm.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.esm.json new file mode 100644 index 0000000000..b657f54211 --- /dev/null +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.esm.json @@ -0,0 +1,37 @@ +{ + "extends": "../../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "build/esm", + "rootDir": "src", + "tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ], + "references": [ + { + "path": "../../../api" + }, + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-resources" + }, + { + "path": "../../../packages/sdk-metrics" + }, + { + "path": "../opentelemetry-exporter-metrics-otlp-http" + }, + { + "path": "../otlp-exporter-base" + }, + { + "path": "../otlp-proto-exporter-base" + }, + { + "path": "../otlp-transformer" + } + ] +} diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.esnext.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.esnext.json new file mode 100644 index 0000000000..31e46faeda --- /dev/null +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.esnext.json @@ -0,0 +1,37 @@ +{ + "extends": "../../../tsconfig.base.esnext.json", + "compilerOptions": { + "outDir": "build/esnext", + "rootDir": "src", + "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ], + "references": [ + { + "path": "../../../api" + }, + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-resources" + }, + { + "path": "../../../packages/sdk-metrics" + }, + { + "path": "../opentelemetry-exporter-metrics-otlp-http" + }, + { + "path": "../otlp-exporter-base" + }, + { + "path": "../otlp-proto-exporter-base" + }, + { + "path": "../otlp-transformer" + } + ] +} diff --git a/experimental/packages/opentelemetry-exporter-prometheus/.eslintrc.js b/experimental/packages/opentelemetry-exporter-prometheus/.eslintrc.js index f756f4488b..9baf1b4956 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/.eslintrc.js +++ b/experimental/packages/opentelemetry-exporter-prometheus/.eslintrc.js @@ -3,5 +3,5 @@ module.exports = { "mocha": true, "node": true }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/opentelemetry-exporter-prometheus/package.json b/experimental/packages/opentelemetry-exporter-prometheus/package.json index 144c4e62d8..15cdcffe9a 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/package.json +++ b/experimental/packages/opentelemetry-exporter-prometheus/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-prometheus", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenTelemetry Exporter Prometheus provides a metrics endpoint for Prometheus", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -16,7 +16,7 @@ "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js" }, @@ -43,15 +43,17 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "1.4.1", - "@opentelemetry/semantic-conventions": "1.13.0", - "@types/mocha": "10.0.0", + "@opentelemetry/api": "1.6.0", + "@opentelemetry/semantic-conventions": "1.17.1", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "codecov": "3.8.3", - "mocha": "10.0.0", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-mocha": "10.0.0", "typescript": "4.4.4" }, @@ -59,9 +61,9 @@ "@opentelemetry/api": "^1.3.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/sdk-metrics": "1.13.0" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-metrics": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-prometheus", "sideEffects": false diff --git a/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusExporter.ts b/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusExporter.ts index 2a7cb5fb43..42e4fc41e8 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusExporter.ts +++ b/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusExporter.ts @@ -33,7 +33,7 @@ export class PrometheusExporter extends MetricReader { port: 9464, endpoint: '/metrics', prefix: '', - appendTimestamp: true, + appendTimestamp: false, }; private readonly _host?: string; @@ -62,6 +62,7 @@ export class PrometheusExporter extends MetricReader { aggregationSelector: _instrumentType => Aggregation.Default(), aggregationTemporalitySelector: _instrumentType => AggregationTemporality.CUMULATIVE, + metricProducers: config.metricProducers, }); this._host = config.host || diff --git a/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts b/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts index 75b29bb61b..7dc424a2b7 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts +++ b/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts @@ -176,7 +176,7 @@ export class PrometheusSerializer { private _prefix: string | undefined; private _appendTimestamp: boolean; - constructor(prefix?: string, appendTimestamp = true) { + constructor(prefix?: string, appendTimestamp = false) { if (prefix) { this._prefix = prefix + '_'; } diff --git a/experimental/packages/opentelemetry-exporter-prometheus/src/export/types.ts b/experimental/packages/opentelemetry-exporter-prometheus/src/export/types.ts index f43c456813..78721a90c0 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/src/export/types.ts +++ b/experimental/packages/opentelemetry-exporter-prometheus/src/export/types.ts @@ -14,6 +14,8 @@ * limitations under the License. */ +import { MetricProducer } from '@opentelemetry/sdk-metrics'; + /** * Configuration interface for prometheus exporter */ @@ -56,4 +58,12 @@ export interface ExporterConfig { * @default false */ preventServerStart?: boolean; + + /** + * **Note, this option is experimental**. Additional MetricProducers to use as a source of + * aggregated metric data in addition to the SDK's metric data. The resource returned by + * these MetricProducers is ignored; the SDK's resource will be used instead. + * @experimental + */ + metricProducers?: MetricProducer[]; } diff --git a/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusExporter.test.ts b/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusExporter.test.ts index 55061be083..b4c6f0ade0 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusExporter.test.ts @@ -21,12 +21,12 @@ import * as sinon from 'sinon'; import * as http from 'http'; import { PrometheusExporter } from '../src'; import { - mockedHrTimeMs, mockHrTime, sdkLanguage, sdkName, sdkVersion, serviceName, + mockedHrTimeMs, } from './util'; import { SinonStubbedInstance } from 'sinon'; @@ -290,7 +290,7 @@ describe('PrometheusExporter', () => { ...serializedDefaultResourceLines, '# HELP counter_total a test description', '# TYPE counter_total counter', - `counter_total{key1="attributeValue1"} 10 ${mockedHrTimeMs}`, + 'counter_total{key1="attributeValue1"} 10', '', ]); }); @@ -320,7 +320,7 @@ describe('PrometheusExporter', () => { ...serializedDefaultResourceLines, '# HELP metric_observable_gauge a test description', '# TYPE metric_observable_gauge gauge', - `metric_observable_gauge{pid="123",core="1"} 0.999 ${mockedHrTimeMs}`, + 'metric_observable_gauge{pid="123",core="1"} 0.999', '', ]); }); @@ -340,8 +340,8 @@ describe('PrometheusExporter', () => { ...serializedDefaultResourceLines, '# HELP counter_total a test description', '# TYPE counter_total counter', - `counter_total{counterKey1="attributeValue1"} 10 ${mockedHrTimeMs}`, - `counter_total{counterKey1="attributeValue2"} 20 ${mockedHrTimeMs}`, + 'counter_total{counterKey1="attributeValue1"} 10', + 'counter_total{counterKey1="attributeValue2"} 20', '', ]); }); @@ -389,7 +389,7 @@ describe('PrometheusExporter', () => { ...serializedDefaultResourceLines, '# HELP counter_total description missing', '# TYPE counter_total counter', - `counter_total{key1="attributeValue1"} 10 ${mockedHrTimeMs}`, + 'counter_total{key1="attributeValue1"} 10', '', ]); }); @@ -406,7 +406,7 @@ describe('PrometheusExporter', () => { ...serializedDefaultResourceLines, '# HELP counter_bad_name_total description missing', '# TYPE counter_bad_name_total counter', - `counter_bad_name_total{key1="attributeValue1"} 10 ${mockedHrTimeMs}`, + 'counter_bad_name_total{key1="attributeValue1"} 10', '', ]); }); @@ -424,7 +424,7 @@ describe('PrometheusExporter', () => { ...serializedDefaultResourceLines, '# HELP counter a test description', '# TYPE counter gauge', - `counter{key1="attributeValue1"} 20 ${mockedHrTimeMs}`, + 'counter{key1="attributeValue1"} 20', '', ]); }); @@ -453,7 +453,7 @@ describe('PrometheusExporter', () => { ...serializedDefaultResourceLines, '# HELP metric_observable_counter a test description', '# TYPE metric_observable_counter counter', - `metric_observable_counter{key1="attributeValue1"} 20 ${mockedHrTimeMs}`, + 'metric_observable_counter{key1="attributeValue1"} 20', '', ]); }); @@ -484,7 +484,7 @@ describe('PrometheusExporter', () => { ...serializedDefaultResourceLines, '# HELP metric_observable_up_down_counter a test description', '# TYPE metric_observable_up_down_counter gauge', - `metric_observable_up_down_counter{key1="attributeValue1"} 20 ${mockedHrTimeMs}`, + 'metric_observable_up_down_counter{key1="attributeValue1"} 20', '', ]); }); @@ -503,19 +503,24 @@ describe('PrometheusExporter', () => { ...serializedDefaultResourceLines, '# HELP test_histogram a test description', '# TYPE test_histogram histogram', - `test_histogram_count{key1="attributeValue1"} 1 ${mockedHrTimeMs}`, - `test_histogram_sum{key1="attributeValue1"} 20 ${mockedHrTimeMs}`, - `test_histogram_bucket{key1="attributeValue1",le="0"} 0 ${mockedHrTimeMs}`, - `test_histogram_bucket{key1="attributeValue1",le="5"} 0 ${mockedHrTimeMs}`, - `test_histogram_bucket{key1="attributeValue1",le="10"} 0 ${mockedHrTimeMs}`, - `test_histogram_bucket{key1="attributeValue1",le="25"} 1 ${mockedHrTimeMs}`, - `test_histogram_bucket{key1="attributeValue1",le="50"} 1 ${mockedHrTimeMs}`, - `test_histogram_bucket{key1="attributeValue1",le="75"} 1 ${mockedHrTimeMs}`, - `test_histogram_bucket{key1="attributeValue1",le="100"} 1 ${mockedHrTimeMs}`, - `test_histogram_bucket{key1="attributeValue1",le="250"} 1 ${mockedHrTimeMs}`, - `test_histogram_bucket{key1="attributeValue1",le="500"} 1 ${mockedHrTimeMs}`, - `test_histogram_bucket{key1="attributeValue1",le="1000"} 1 ${mockedHrTimeMs}`, - `test_histogram_bucket{key1="attributeValue1",le="+Inf"} 1 ${mockedHrTimeMs}`, + 'test_histogram_count{key1="attributeValue1"} 1', + 'test_histogram_sum{key1="attributeValue1"} 20', + 'test_histogram_bucket{key1="attributeValue1",le="0"} 0', + 'test_histogram_bucket{key1="attributeValue1",le="5"} 0', + 'test_histogram_bucket{key1="attributeValue1",le="10"} 0', + 'test_histogram_bucket{key1="attributeValue1",le="25"} 1', + 'test_histogram_bucket{key1="attributeValue1",le="50"} 1', + 'test_histogram_bucket{key1="attributeValue1",le="75"} 1', + 'test_histogram_bucket{key1="attributeValue1",le="100"} 1', + 'test_histogram_bucket{key1="attributeValue1",le="250"} 1', + 'test_histogram_bucket{key1="attributeValue1",le="500"} 1', + 'test_histogram_bucket{key1="attributeValue1",le="750"} 1', + 'test_histogram_bucket{key1="attributeValue1",le="1000"} 1', + 'test_histogram_bucket{key1="attributeValue1",le="2500"} 1', + 'test_histogram_bucket{key1="attributeValue1",le="5000"} 1', + 'test_histogram_bucket{key1="attributeValue1",le="7500"} 1', + 'test_histogram_bucket{key1="attributeValue1",le="10000"} 1', + 'test_histogram_bucket{key1="attributeValue1",le="+Inf"} 1', '', ]); }); @@ -557,7 +562,7 @@ describe('PrometheusExporter', () => { ...serializedDefaultResourceLines, '# HELP test_prefix_counter_total description missing', '# TYPE test_prefix_counter_total counter', - `test_prefix_counter_total{key1="attributeValue1"} 10 ${mockedHrTimeMs}`, + 'test_prefix_counter_total{key1="attributeValue1"} 10', '', ]); @@ -586,7 +591,7 @@ describe('PrometheusExporter', () => { ...serializedDefaultResourceLines, '# HELP counter_total description missing', '# TYPE counter_total counter', - `counter_total{key1="attributeValue1"} 10 ${mockedHrTimeMs}`, + 'counter_total{key1="attributeValue1"} 10', '', ]); @@ -615,7 +620,7 @@ describe('PrometheusExporter', () => { ...serializedDefaultResourceLines, '# HELP counter_total description missing', '# TYPE counter_total counter', - `counter_total{key1="attributeValue1"} 10 ${mockedHrTimeMs}`, + 'counter_total{key1="attributeValue1"} 10', '', ]); @@ -627,10 +632,10 @@ describe('PrometheusExporter', () => { ); }); - it('should export a metric without timestamp', done => { + it('should export a metric with timestamp', done => { exporter = new PrometheusExporter( { - appendTimestamp: false, + appendTimestamp: true, }, async () => { setup(exporter); @@ -644,7 +649,7 @@ describe('PrometheusExporter', () => { ...serializedDefaultResourceLines, '# HELP counter_total description missing', '# TYPE counter_total counter', - 'counter_total{key1="attributeValue1"} 10', + `counter_total{key1="attributeValue1"} 10 ${mockedHrTimeMs}`, '', ]); diff --git a/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts b/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts index 5495ca0a8b..1a39aae003 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts +++ b/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts @@ -118,17 +118,17 @@ describe('PrometheusSerializer', () => { it('should serialize metrics with singular data type', async () => { const serializer = new PrometheusSerializer(); const result = await testSerializer(serializer); + assert.strictEqual(result, 'test_total{foo1="bar1",foo2="bar2"} 1\n'); + }); + + it('should serialize metrics with singular data type with timestamp', async () => { + const serializer = new PrometheusSerializer(undefined, true); + const result = await testSerializer(serializer); assert.strictEqual( result, `test_total{foo1="bar1",foo2="bar2"} 1 ${mockedHrTimeMs}\n` ); }); - - it('should serialize metrics with singular data type without timestamp', async () => { - const serializer = new PrometheusSerializer(undefined, false); - const result = await testSerializer(serializer); - assert.strictEqual(result, 'test_total{foo1="bar1",foo2="bar2"} 1\n'); - }); }); describe('Histogram', () => { @@ -168,20 +168,6 @@ describe('PrometheusSerializer', () => { it('should serialize metrics with histogram data type', async () => { const serializer = new PrometheusSerializer(); const result = await testSerializer(serializer); - assert.strictEqual( - result, - `test_count{foo1="bar1",foo2="bar2"} 1 ${mockedHrTimeMs}\n` + - `test_sum{foo1="bar1",foo2="bar2"} 5 ${mockedHrTimeMs}\n` + - `test_bucket{foo1="bar1",foo2="bar2",le="1"} 0 ${mockedHrTimeMs}\n` + - `test_bucket{foo1="bar1",foo2="bar2",le="10"} 1 ${mockedHrTimeMs}\n` + - `test_bucket{foo1="bar1",foo2="bar2",le="100"} 1 ${mockedHrTimeMs}\n` + - `test_bucket{foo1="bar1",foo2="bar2",le="+Inf"} 1 ${mockedHrTimeMs}\n` - ); - }); - - it('serialize metric record with sum aggregator without timestamp', async () => { - const serializer = new PrometheusSerializer(undefined, false); - const result = await testSerializer(serializer); assert.strictEqual( result, 'test_count{foo1="bar1",foo2="bar2"} 1\n' + @@ -192,6 +178,20 @@ describe('PrometheusSerializer', () => { 'test_bucket{foo1="bar1",foo2="bar2",le="+Inf"} 1\n' ); }); + + it('serialize metric record with sum aggregator with timestamp', async () => { + const serializer = new PrometheusSerializer(undefined, true); + const result = await testSerializer(serializer); + assert.strictEqual( + result, + `test_count{foo1="bar1",foo2="bar2"} 1 ${mockedHrTimeMs}\n` + + `test_sum{foo1="bar1",foo2="bar2"} 5 ${mockedHrTimeMs}\n` + + `test_bucket{foo1="bar1",foo2="bar2",le="1"} 0 ${mockedHrTimeMs}\n` + + `test_bucket{foo1="bar1",foo2="bar2",le="10"} 1 ${mockedHrTimeMs}\n` + + `test_bucket{foo1="bar1",foo2="bar2",le="100"} 1 ${mockedHrTimeMs}\n` + + `test_bucket{foo1="bar1",foo2="bar2",le="+Inf"} 1 ${mockedHrTimeMs}\n` + ); + }); }); }); @@ -233,20 +233,20 @@ describe('PrometheusSerializer', () => { result, '# HELP test_total foobar\n' + '# TYPE test_total counter\n' + - `test_total{val="1"} 1 ${mockedHrTimeMs}\n` + - `test_total{val="2"} 1 ${mockedHrTimeMs}\n` + 'test_total{val="1"} 1\n' + + 'test_total{val="2"} 1\n' ); }); - it('should serialize metric record without timestamp', async () => { - const serializer = new PrometheusSerializer(undefined, false); + it('should serialize metric record with timestamp', async () => { + const serializer = new PrometheusSerializer(undefined, true); const result = await testSerializer(serializer); assert.strictEqual( result, '# HELP test_total foobar\n' + '# TYPE test_total counter\n' + - 'test_total{val="1"} 1\n' + - 'test_total{val="2"} 1\n' + `test_total{val="1"} 1 ${mockedHrTimeMs}\n` + + `test_total{val="2"} 1 ${mockedHrTimeMs}\n` ); }); }); @@ -287,20 +287,20 @@ describe('PrometheusSerializer', () => { result, '# HELP test_total foobar\n' + '# TYPE test_total gauge\n' + - `test_total{val="1"} 1 ${mockedHrTimeMs}\n` + - `test_total{val="2"} 1 ${mockedHrTimeMs}\n` + 'test_total{val="1"} 1\n' + + 'test_total{val="2"} 1\n' ); }); - it('serialize metric record without timestamp', async () => { - const serializer = new PrometheusSerializer(undefined, false); + it('serialize metric record with timestamp', async () => { + const serializer = new PrometheusSerializer(undefined, true); const result = await testSerializer(serializer); assert.strictEqual( result, '# HELP test_total foobar\n' + '# TYPE test_total gauge\n' + - 'test_total{val="1"} 1\n' + - 'test_total{val="2"} 1\n' + `test_total{val="1"} 1 ${mockedHrTimeMs}\n` + + `test_total{val="2"} 1 ${mockedHrTimeMs}\n` ); }); }); @@ -341,20 +341,20 @@ describe('PrometheusSerializer', () => { result, '# HELP test_total foobar\n' + '# TYPE test_total gauge\n' + - `test_total{val="1"} 1 ${mockedHrTimeMs}\n` + - `test_total{val="2"} 1 ${mockedHrTimeMs}\n` + 'test_total{val="1"} 1\n' + + 'test_total{val="2"} 1\n' ); }); - it('serialize metric record without timestamp', async () => { - const serializer = new PrometheusSerializer(undefined, false); + it('serialize metric record with timestamp', async () => { + const serializer = new PrometheusSerializer(undefined, true); const result = await testSerializer(serializer); assert.strictEqual( result, '# HELP test_total foobar\n' + '# TYPE test_total gauge\n' + - 'test_total{val="1"} 1\n' + - 'test_total{val="2"} 1\n' + `test_total{val="1"} 1 ${mockedHrTimeMs}\n` + + `test_total{val="2"} 1 ${mockedHrTimeMs}\n` ); }); }); @@ -399,18 +399,18 @@ describe('PrometheusSerializer', () => { result, '# HELP test foobar\n' + '# TYPE test histogram\n' + - `test_count{val="1"} 3 ${mockedHrTimeMs}\n` + - `test_sum{val="1"} 175 ${mockedHrTimeMs}\n` + - `test_bucket{val="1",le="1"} 0 ${mockedHrTimeMs}\n` + - `test_bucket{val="1",le="10"} 1 ${mockedHrTimeMs}\n` + - `test_bucket{val="1",le="100"} 2 ${mockedHrTimeMs}\n` + - `test_bucket{val="1",le="+Inf"} 3 ${mockedHrTimeMs}\n` + - `test_count{val="2"} 1 ${mockedHrTimeMs}\n` + - `test_sum{val="2"} 5 ${mockedHrTimeMs}\n` + - `test_bucket{val="2",le="1"} 0 ${mockedHrTimeMs}\n` + - `test_bucket{val="2",le="10"} 1 ${mockedHrTimeMs}\n` + - `test_bucket{val="2",le="100"} 1 ${mockedHrTimeMs}\n` + - `test_bucket{val="2",le="+Inf"} 1 ${mockedHrTimeMs}\n` + 'test_count{val="1"} 3\n' + + 'test_sum{val="1"} 175\n' + + 'test_bucket{val="1",le="1"} 0\n' + + 'test_bucket{val="1",le="10"} 1\n' + + 'test_bucket{val="1",le="100"} 2\n' + + 'test_bucket{val="1",le="+Inf"} 3\n' + + 'test_count{val="2"} 1\n' + + 'test_sum{val="2"} 5\n' + + 'test_bucket{val="2",le="1"} 0\n' + + 'test_bucket{val="2",le="10"} 1\n' + + 'test_bucket{val="2",le="100"} 1\n' + + 'test_bucket{val="2",le="+Inf"} 1\n' ); }); @@ -448,16 +448,16 @@ describe('PrometheusSerializer', () => { result, '# HELP test foobar\n' + '# TYPE test histogram\n' + - `test_count{val="1"} 3 ${mockedHrTimeMs}\n` + - `test_bucket{val="1",le="1"} 0 ${mockedHrTimeMs}\n` + - `test_bucket{val="1",le="10"} 1 ${mockedHrTimeMs}\n` + - `test_bucket{val="1",le="100"} 2 ${mockedHrTimeMs}\n` + - `test_bucket{val="1",le="+Inf"} 3 ${mockedHrTimeMs}\n` + - `test_count{val="2"} 1 ${mockedHrTimeMs}\n` + - `test_bucket{val="2",le="1"} 0 ${mockedHrTimeMs}\n` + - `test_bucket{val="2",le="10"} 1 ${mockedHrTimeMs}\n` + - `test_bucket{val="2",le="100"} 1 ${mockedHrTimeMs}\n` + - `test_bucket{val="2",le="+Inf"} 1 ${mockedHrTimeMs}\n` + 'test_count{val="1"} 3\n' + + 'test_bucket{val="1",le="1"} 0\n' + + 'test_bucket{val="1",le="10"} 1\n' + + 'test_bucket{val="1",le="100"} 2\n' + + 'test_bucket{val="1",le="+Inf"} 3\n' + + 'test_count{val="2"} 1\n' + + 'test_bucket{val="2",le="1"} 0\n' + + 'test_bucket{val="2",le="10"} 1\n' + + 'test_bucket{val="2",le="100"} 1\n' + + 'test_bucket{val="2",le="+Inf"} 1\n' ); }); }); @@ -518,7 +518,7 @@ describe('PrometheusSerializer', () => { '# HELP test_total description missing\n' + `# UNIT test_total ${unitOfMetric}\n` + '# TYPE test_total counter\n' + - `test_total 1 ${mockedHrTimeMs}\n` + 'test_total 1\n' ); }); @@ -533,7 +533,7 @@ describe('PrometheusSerializer', () => { serializedDefaultResource + '# HELP test_total description missing\n' + '# TYPE test_total counter\n' + - `test_total 1 ${mockedHrTimeMs}\n` + 'test_total 1\n' ); }); @@ -541,14 +541,14 @@ describe('PrometheusSerializer', () => { const serializer = new PrometheusSerializer(); const result = await getCounterResult('test', serializer); - assert.strictEqual(result, `test_total 1 ${mockedHrTimeMs}\n`); + assert.strictEqual(result, 'test_total 1\n'); }); it('should not rename metric of type counter when name contains _total suffix', async () => { const serializer = new PrometheusSerializer(); const result = await getCounterResult('test_total', serializer); - assert.strictEqual(result, `test_total 1 ${mockedHrTimeMs}\n`); + assert.strictEqual(result, 'test_total 1\n'); }); }); @@ -594,7 +594,7 @@ describe('PrometheusSerializer', () => { counter.add(1); }); - assert.strictEqual(result, `test_total 1 ${mockedHrTimeMs}\n`); + assert.strictEqual(result, 'test_total 1\n'); }); it('should serialize non-string attribute values in JSON representations', async () => { @@ -615,7 +615,7 @@ describe('PrometheusSerializer', () => { assert.strictEqual( result, - `test_total{true="true",false="false",array="[1,null,null,2]",object="{}",Infinity="null",NaN="null",null="null",undefined=""} 1 ${mockedHrTimeMs}\n` + 'test_total{true="true",false="false",array="[1,null,null,2]",object="{}",Infinity="null",NaN="null",null="null",undefined=""} 1\n' ); }); @@ -634,7 +634,7 @@ describe('PrometheusSerializer', () => { assert.strictEqual( result, - `test{foo1="bar1",foo2="bar2"} ${esac[1]} ${mockedHrTimeMs}\n` + `test{foo1="bar1",foo2="bar2"} ${esac[1]}\n` ); } }); @@ -662,7 +662,7 @@ describe('PrometheusSerializer', () => { 'backslashN="\u005c\u005c\u006e",' + 'backslashDoubleQuote="\u005c\u005c\u005c\u0022",' + 'backslashLineFeed="\u005c\u005c\u005c\u006e"' + - `} 1 ${mockedHrTimeMs}\n` + '} 1\n' ); }); @@ -678,10 +678,7 @@ describe('PrometheusSerializer', () => { } as unknown as MetricAttributes); }); - assert.strictEqual( - result, - `test_total{account_id="123456"} 1 ${mockedHrTimeMs}\n` - ); + assert.strictEqual(result, 'test_total{account_id="123456"} 1\n'); }); }); diff --git a/experimental/packages/opentelemetry-instrumentation-fetch/.eslintrc.js b/experimental/packages/opentelemetry-instrumentation-fetch/.eslintrc.js index e41d9a9299..c054089042 100644 --- a/experimental/packages/opentelemetry-instrumentation-fetch/.eslintrc.js +++ b/experimental/packages/opentelemetry-instrumentation-fetch/.eslintrc.js @@ -5,5 +5,5 @@ module.exports = { "node": true, "browser": true }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/opentelemetry-instrumentation-fetch/package.json b/experimental/packages/opentelemetry-instrumentation-fetch/package.json index 29479c7c8f..f83b054bd0 100644 --- a/experimental/packages/opentelemetry-instrumentation-fetch/package.json +++ b/experimental/packages/opentelemetry-instrumentation-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-fetch", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenTelemetry fetch automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -16,9 +16,9 @@ "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "version": "node ../../../scripts/version-update.js", "tdd": "karma start", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "node ../../../scripts/version-update.js", "peer-api-check": "node ../../../scripts/peer-api-check.js" }, @@ -54,42 +54,44 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", - "@opentelemetry/api": "1.4.1", - "@opentelemetry/context-zone": "1.13.0", - "@opentelemetry/propagator-b3": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@opentelemetry/api": "1.6.0", + "@opentelemetry/context-zone": "1.17.1", + "@opentelemetry/propagator-b3": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "@types/webpack-env": "1.16.3", - "babel-loader": "8.2.3", + "babel-loader": "8.3.0", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", "webpack": "4.46.0", - "webpack-cli": "4.9.1", - "webpack-merge": "5.8.0" + "webpack-cli": "4.10.0", + "webpack-merge": "5.9.0" }, "peerDependencies": { "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/instrumentation": "0.39.1", - "@opentelemetry/sdk-trace-web": "1.13.0", - "@opentelemetry/semantic-conventions": "1.13.0" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/instrumentation": "0.44.0", + "@opentelemetry/sdk-trace-web": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-fetch", "sideEffects": false diff --git a/experimental/packages/opentelemetry-instrumentation-fetch/test/fetch.test.ts b/experimental/packages/opentelemetry-instrumentation-fetch/test/fetch.test.ts index 318e0f98c3..14dcec9978 100644 --- a/experimental/packages/opentelemetry-instrumentation-fetch/test/fetch.test.ts +++ b/experimental/packages/opentelemetry-instrumentation-fetch/test/fetch.test.ts @@ -139,6 +139,19 @@ function createFakePerformanceObs(url: string) { return FakePerfObs; } +function testForCorrectEvents( + events: tracing.TimedEvent[], + eventNames: string[] +) { + for (let i = 0; i < events.length; i++) { + assert.strictEqual( + events[i].name, + eventNames[i], + `event ${eventNames[i]} is not defined` + ); + } +} + describe('fetch', () => { let contextManager: ZoneContextManager; let lastResponse: any | undefined; @@ -152,6 +165,7 @@ describe('fetch', () => { let fetchInstrumentation: FetchInstrumentation; const url = 'http://localhost:8090/get'; + const secureUrl = 'https://localhost:8090/get'; const badUrl = 'http://foo.bar.com/get'; const clearData = () => { @@ -399,53 +413,17 @@ describe('fetch', () => { it('span should have correct events', () => { const span: tracing.ReadableSpan = exportSpy.args[1][0][0]; const events = span.events; - assert.strictEqual(events.length, 9, 'number of events is wrong'); - - assert.strictEqual( - events[0].name, + assert.strictEqual(events.length, 8, 'number of events is wrong'); + testForCorrectEvents(events, [ PTN.FETCH_START, - `event ${PTN.FETCH_START} is not defined` - ); - assert.strictEqual( - events[1].name, PTN.DOMAIN_LOOKUP_START, - `event ${PTN.DOMAIN_LOOKUP_START} is not defined` - ); - assert.strictEqual( - events[2].name, PTN.DOMAIN_LOOKUP_END, - `event ${PTN.DOMAIN_LOOKUP_END} is not defined` - ); - assert.strictEqual( - events[3].name, PTN.CONNECT_START, - `event ${PTN.CONNECT_START} is not defined` - ); - assert.strictEqual( - events[4].name, - PTN.SECURE_CONNECTION_START, - `event ${PTN.SECURE_CONNECTION_START} is not defined` - ); - assert.strictEqual( - events[5].name, PTN.CONNECT_END, - `event ${PTN.CONNECT_END} is not defined` - ); - assert.strictEqual( - events[6].name, PTN.REQUEST_START, - `event ${PTN.REQUEST_START} is not defined` - ); - assert.strictEqual( - events[7].name, PTN.RESPONSE_START, - `event ${PTN.RESPONSE_START} is not defined` - ); - assert.strictEqual( - events[8].name, PTN.RESPONSE_END, - `event ${PTN.RESPONSE_END} is not defined` - ); + ]); }); it('should create a span for preflight request', () => { @@ -479,53 +457,17 @@ describe('fetch', () => { it('preflight request span should have correct events', () => { const span: tracing.ReadableSpan = exportSpy.args[0][0][0]; const events = span.events; - assert.strictEqual(events.length, 9, 'number of events is wrong'); - - assert.strictEqual( - events[0].name, + assert.strictEqual(events.length, 8, 'number of events is wrong'); + testForCorrectEvents(events, [ PTN.FETCH_START, - `event ${PTN.FETCH_START} is not defined` - ); - assert.strictEqual( - events[1].name, PTN.DOMAIN_LOOKUP_START, - `event ${PTN.DOMAIN_LOOKUP_START} is not defined` - ); - assert.strictEqual( - events[2].name, PTN.DOMAIN_LOOKUP_END, - `event ${PTN.DOMAIN_LOOKUP_END} is not defined` - ); - assert.strictEqual( - events[3].name, PTN.CONNECT_START, - `event ${PTN.CONNECT_START} is not defined` - ); - assert.strictEqual( - events[4].name, - PTN.SECURE_CONNECTION_START, - `event ${PTN.SECURE_CONNECTION_START} is not defined` - ); - assert.strictEqual( - events[5].name, PTN.CONNECT_END, - `event ${PTN.CONNECT_END} is not defined` - ); - assert.strictEqual( - events[6].name, PTN.REQUEST_START, - `event ${PTN.REQUEST_START} is not defined` - ); - assert.strictEqual( - events[7].name, PTN.RESPONSE_START, - `event ${PTN.RESPONSE_START} is not defined` - ); - assert.strictEqual( - events[8].name, PTN.RESPONSE_END, - `event ${PTN.RESPONSE_END} is not defined` - ); + ]); }); it('should set trace headers', () => { @@ -639,6 +581,51 @@ describe('fetch', () => { }); }); + describe('when request is secure and successful', () => { + beforeEach(async () => { + const propagateTraceHeaderCorsUrls = [secureUrl]; + await prepareData(secureUrl, { propagateTraceHeaderCorsUrls }); + }); + + afterEach(() => { + clearData(); + }); + + it('span should have correct events', () => { + const span: tracing.ReadableSpan = exportSpy.args[1][0][0]; + const events = span.events; + assert.strictEqual(events.length, 9, 'number of events is wrong'); + testForCorrectEvents(events, [ + PTN.FETCH_START, + PTN.DOMAIN_LOOKUP_START, + PTN.DOMAIN_LOOKUP_END, + PTN.CONNECT_START, + PTN.SECURE_CONNECTION_START, + PTN.CONNECT_END, + PTN.REQUEST_START, + PTN.RESPONSE_START, + PTN.RESPONSE_END, + ]); + }); + + it('preflight request span should have correct events', () => { + const span: tracing.ReadableSpan = exportSpy.args[0][0][0]; + const events = span.events; + assert.strictEqual(events.length, 9, 'number of events is wrong'); + testForCorrectEvents(events, [ + PTN.FETCH_START, + PTN.DOMAIN_LOOKUP_START, + PTN.DOMAIN_LOOKUP_END, + PTN.CONNECT_START, + PTN.SECURE_CONNECTION_START, + PTN.CONNECT_END, + PTN.REQUEST_START, + PTN.RESPONSE_START, + PTN.RESPONSE_END, + ]); + }); + }); + describe('applyCustomAttributesOnSpan option', () => { const prepare = async ( url: string, @@ -815,13 +802,18 @@ describe('fetch', () => { `Wrong number of spans: ${exportSpy.args.length}` ); - assert.strictEqual(events.length, 9, 'number of events is wrong'); + assert.strictEqual(events.length, 8, 'number of events is wrong'); - assert.strictEqual( - events[6].name, + testForCorrectEvents(events, [ + PTN.FETCH_START, + PTN.DOMAIN_LOOKUP_START, + PTN.DOMAIN_LOOKUP_END, + PTN.CONNECT_START, + PTN.CONNECT_END, PTN.REQUEST_START, - `event ${PTN.REQUEST_START} is not defined` - ); + PTN.RESPONSE_START, + PTN.RESPONSE_END, + ]); }); }); @@ -844,12 +836,17 @@ describe('fetch', () => { `Wrong number of spans: ${exportSpy.args.length}` ); - assert.strictEqual(events.length, 9, 'number of events is wrong'); - assert.strictEqual( - events[6].name, + assert.strictEqual(events.length, 8, 'number of events is wrong'); + testForCorrectEvents(events, [ + PTN.FETCH_START, + PTN.DOMAIN_LOOKUP_START, + PTN.DOMAIN_LOOKUP_END, + PTN.CONNECT_START, + PTN.CONNECT_END, PTN.REQUEST_START, - `event ${PTN.REQUEST_START} is not defined` - ); + PTN.RESPONSE_START, + PTN.RESPONSE_END, + ]); }); it('should have an absolute http.url attribute', () => { @@ -882,12 +879,17 @@ describe('fetch', () => { 2, `Wrong number of spans: ${exportSpy.args.length}` ); - assert.strictEqual(events.length, 9, 'number of events is wrong'); - assert.strictEqual( - events[6].name, + assert.strictEqual(events.length, 8, 'number of events is wrong'); + testForCorrectEvents(events, [ + PTN.FETCH_START, + PTN.DOMAIN_LOOKUP_START, + PTN.DOMAIN_LOOKUP_END, + PTN.CONNECT_START, + PTN.CONNECT_END, PTN.REQUEST_START, - `event ${PTN.REQUEST_START} is not defined` - ); + PTN.RESPONSE_START, + PTN.RESPONSE_END, + ]); }); }); diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/.eslintignore b/experimental/packages/opentelemetry-instrumentation-grpc/.eslintignore index 378eac25d3..cd163f08be 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/.eslintignore +++ b/experimental/packages/opentelemetry-instrumentation-grpc/.eslintignore @@ -1 +1,2 @@ build +test/proto diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/.eslintrc.js b/experimental/packages/opentelemetry-instrumentation-grpc/.eslintrc.js index f756f4488b..9baf1b4956 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/.eslintrc.js +++ b/experimental/packages/opentelemetry-instrumentation-grpc/.eslintrc.js @@ -3,5 +3,5 @@ module.exports = { "mocha": true, "node": true }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/README.md b/experimental/packages/opentelemetry-instrumentation-grpc/README.md index 2aa6038c03..8916054eb4 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/README.md +++ b/experimental/packages/opentelemetry-instrumentation-grpc/README.md @@ -5,7 +5,7 @@ **Note: This is an experimental package under active development. New releases may include breaking changes.** -This module provides automatic instrumentation for [`grpc`](https://grpc.github.io/grpc/node/) and [`@grpc/grpc-js`](https://grpc.io/blog/grpc-js-1.0/). Currently, version [`1.x`](https://www.npmjs.com/package/grpc?activeTab=versions) of `grpc` and version [`1.x`](https://www.npmjs.com/package/@grpc/grpc-js?activeTab=versions) of `@grpc/grpc-js` is supported. +This module provides automatic instrumentation for [`@grpc/grpc-js`](https://grpc.io/blog/grpc-js-1.0/). Currently, version [`1.x`](https://www.npmjs.com/package/@grpc/grpc-js?activeTab=versions) of `@grpc/grpc-js` is supported. For automatic instrumentation see the [@opentelemetry/sdk-trace-node](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package. @@ -18,7 +18,7 @@ npm install --save @opentelemetry/instrumentation-grpc ## Usage -OpenTelemetry gRPC Instrumentation allows the user to automatically collect trace data and export them to the backend of choice, to give observability to distributed systems when working with [gRPC](https://www.npmjs.com/package/grpc) or ([grpc-js](https://www.npmjs.com/package/@grpc/grpc-js)). +OpenTelemetry gRPC Instrumentation allows the user to automatically collect trace data and export them to the backend of choice, to give observability to distributed systems when working with ([grpc-js](https://www.npmjs.com/package/@grpc/grpc-js)). To load a specific instrumentation (**gRPC** in this case), specify it in the Node Tracer's configuration. @@ -38,15 +38,15 @@ registerInstrumentations({ ``` -See [examples/grpc](https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/grpc) or [examples/grpc-js](https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/grpc-js) for examples. +See [examples/grpc-js](https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/grpc-js) for examples. ### gRPC Instrumentation Options gRPC instrumentation accepts the following configuration: -| Options | Type | Description | -|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [`ignoreGrpcMethods`](https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/opentelemetry-instrumentation-grpc/src/types.ts#L25) | `IgnoreMatcher[]` | gRPC instrumentation will not trace any methods that match anything in this list. You may pass a string (case-insensitive match), a `RegExp` object, or a filter function. | +| Options | Type | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [`ignoreGrpcMethods`](https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/opentelemetry-instrumentation-grpc/src/types.ts#L25) | `IgnoreMatcher[]` | gRPC instrumentation will not trace any methods that match anything in this list. You may pass a string (case-insensitive match), a `RegExp` object, or a filter function. | | [`metadataToSpanAttributes`](https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/opentelemetry-instrumentation-grpc/src/types.ts#L27) | `object` | List of case insensitive metadata to convert to span attributes. Client and server (outgoing requests, incoming responses) metadata attributes will be converted to span attributes in the form of `rpc.{request\response}.metadata.metadata_key`, e.g. `rpc.response.metadata.date` | ## Useful links diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/package.json b/experimental/packages/opentelemetry-instrumentation-grpc/package.json index 1e63a6dd06..72dc5034b8 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/package.json +++ b/experimental/packages/opentelemetry-instrumentation-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-grpc", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenTelemetry grpc automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -9,17 +9,17 @@ "prepublishOnly": "npm run compile", "compile": "tsc --build", "clean": "tsc --build --clean", - "test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts", + "test": "npm run protos:generate && nyc ts-mocha -p tsconfig.json test/**/*.test.ts", "tdd": "npm run test -- --watch-extensions ts --watch", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "node ../../../scripts/version-update.js", "peer-api-check": "node ../../../scripts/peer-api-check.js", - "postinstall": "node -e \"console.log(\\\"\\x1b[95m%s\\x1b[0m\\\", \\\"@opentelemetry/instrumentation-grpc - warning: The package 'grpc' (https://www.npmjs.com/package/grpc) is deprecated. It will no longer be instrumented in the next release of '@opentelemetry/instrumentation-grpc'. Please migrate to '@grpc/grpc-js' (https://www.npmjs.com/package/@grpc/grpc-js) to continue receiving telemetry.\\\");\"" + "protos:generate": "cd test/fixtures && buf generate" }, "keywords": [ "opentelemetry", @@ -46,24 +46,28 @@ "access": "public" }, "devDependencies": { + "@bufbuild/buf": "1.21.0-1", "@grpc/grpc-js": "^1.7.1", - "@grpc/proto-loader": "^0.7.3", - "@opentelemetry/api": "1.4.1", - "@opentelemetry/context-async-hooks": "1.13.0", - "@opentelemetry/core": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "@opentelemetry/sdk-trace-node": "1.13.0", - "@types/mocha": "10.0.0", + "@grpc/proto-loader": "^0.7.10", + "@opentelemetry/api": "1.6.0", + "@opentelemetry/context-async-hooks": "1.17.1", + "@opentelemetry/core": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@opentelemetry/sdk-trace-node": "1.17.1", + "@protobuf-ts/grpc-transport": "2.9.1", + "@protobuf-ts/runtime": "2.9.1", + "@protobuf-ts/runtime-rpc": "2.9.1", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/semver": "7.3.9", - "@types/sinon": "10.0.13", + "@types/semver": "7.5.3", + "@types/sinon": "10.0.18", "codecov": "3.8.3", - "grpc": "1.24.11", - "mocha": "10.0.0", - "node-pre-gyp": "0.17.0", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "semver": "7.3.5", - "sinon": "15.0.0", + "semver": "7.5.4", + "sinon": "15.1.2", "ts-mocha": "10.0.0", "typescript": "4.4.4" }, @@ -71,8 +75,8 @@ "@opentelemetry/api": "^1.3.0" }, "dependencies": { - "@opentelemetry/instrumentation": "0.39.1", - "@opentelemetry/semantic-conventions": "1.13.0" + "@opentelemetry/instrumentation": "0.44.0", + "@opentelemetry/semantic-conventions": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-grpc", "sideEffects": false diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts index 8c98a10936..9e26062d1c 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts @@ -14,27 +14,24 @@ * limitations under the License. */ -import { GrpcJsInstrumentation } from './'; -import type { GrpcClientFunc, SendUnaryDataCallback } from './types'; -import { - Span, - SpanStatusCode, - SpanStatus, - propagation, - context, -} from '@opentelemetry/api'; +import type { EventEmitter } from 'events'; +import type { Span, SpanStatus } from '@opentelemetry/api'; +import type { Client, Metadata, ServiceError } from '@grpc/grpc-js'; import type * as grpcJs from '@grpc/grpc-js'; +import type { GrpcJsInstrumentation } from './'; +import type { GrpcClientFunc, SendUnaryDataCallback } from './types'; +import type { metadataCaptureType } from '../internal-types'; + +import { propagation, context } from '@opentelemetry/api'; +import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { AttributeNames } from '../enums/AttributeNames'; +import { GRPC_STATUS_CODE_OK } from '../status-code'; import { _grpcStatusCodeToSpanStatus, _grpcStatusCodeToOpenTelemetryStatusCode, _methodIsIgnored, } from '../utils'; -import { CALL_SPAN_ENDED } from './serverUtils'; -import { EventEmitter } from 'events'; -import { AttributeNames } from '../enums/AttributeNames'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; -import { metadataCaptureType } from '../internal-types'; -import { GRPC_STATUS_CODE_OK } from '../status-code'; +import { errorMonitor } from 'events'; /** * Parse a package method list and return a list of methods to patch @@ -42,7 +39,7 @@ import { GRPC_STATUS_CODE_OK } from '../status-code'; */ export function getMethodsToWrap( this: GrpcJsInstrumentation, - client: typeof grpcJs.Client, + client: typeof Client, methods: { [key: string]: { originalName?: string } } ): string[] { const methodList: string[] = []; @@ -66,6 +63,91 @@ export function getMethodsToWrap( return methodList; } +/** + * Patches a callback so that the current span for this trace is also ended + * when the callback is invoked. + */ +export function patchedCallback( + span: Span, + callback: SendUnaryDataCallback +) { + const wrappedFn: SendUnaryDataCallback = ( + err: grpcJs.ServiceError | null, + res?: ResponseType + ) => { + if (err) { + if (err.code) { + span.setStatus(_grpcStatusCodeToSpanStatus(err.code)); + span.setAttribute(SemanticAttributes.RPC_GRPC_STATUS_CODE, err.code); + } + span.setAttributes({ + [AttributeNames.GRPC_ERROR_NAME]: err.name, + [AttributeNames.GRPC_ERROR_MESSAGE]: err.message, + }); + } else { + span.setAttribute( + SemanticAttributes.RPC_GRPC_STATUS_CODE, + GRPC_STATUS_CODE_OK + ); + } + + span.end(); + callback(err, res); + }; + return context.bind(context.active(), wrappedFn); +} + +export function patchResponseMetadataEvent( + span: Span, + call: EventEmitter, + metadataCapture: metadataCaptureType +) { + call.on('metadata', (responseMetadata: any) => { + metadataCapture.client.captureResponseMetadata(span, responseMetadata); + }); +} + +export function patchResponseStreamEvents(span: Span, call: EventEmitter) { + // Both error and status events can be emitted + // the first one emitted set spanEnded to true + let spanEnded = false; + const endSpan = () => { + if (!spanEnded) { + span.end(); + spanEnded = true; + } + }; + context.bind(context.active(), call); + call.on(errorMonitor, (err: ServiceError) => { + if (spanEnded) { + return; + } + + span.setStatus({ + code: _grpcStatusCodeToOpenTelemetryStatusCode(err.code), + message: err.message, + }); + span.setAttributes({ + [AttributeNames.GRPC_ERROR_NAME]: err.name, + [AttributeNames.GRPC_ERROR_MESSAGE]: err.message, + [SemanticAttributes.RPC_GRPC_STATUS_CODE]: err.code, + }); + + endSpan(); + }); + + call.on('status', (status: SpanStatus) => { + if (spanEnded) { + return; + } + + span.setStatus(_grpcStatusCodeToSpanStatus(status.code)); + span.setAttribute(SemanticAttributes.RPC_GRPC_STATUS_CODE, status.code); + + endSpan(); + }); +} + /** * Execute grpc client call. Apply completitionspan properties and end the * span on callback or receiving an emitted event. @@ -77,41 +159,6 @@ export function makeGrpcClientRemoteCall( metadata: grpcJs.Metadata, self: grpcJs.Client ): (span: Span) => EventEmitter { - /** - * Patches a callback so that the current span for this trace is also ended - * when the callback is invoked. - */ - function patchedCallback( - span: Span, - callback: SendUnaryDataCallback - ) { - const wrappedFn: SendUnaryDataCallback = ( - err: grpcJs.ServiceError | null, - res: any - ) => { - if (err) { - if (err.code) { - span.setStatus(_grpcStatusCodeToSpanStatus(err.code)); - span.setAttribute(SemanticAttributes.RPC_GRPC_STATUS_CODE, err.code); - } - span.setAttributes({ - [AttributeNames.GRPC_ERROR_NAME]: err.name, - [AttributeNames.GRPC_ERROR_MESSAGE]: err.message, - }); - } else { - span.setStatus({ code: SpanStatusCode.UNSET }); - span.setAttribute( - SemanticAttributes.RPC_GRPC_STATUS_CODE, - GRPC_STATUS_CODE_OK - ); - } - - span.end(); - callback(err, res); - }; - return context.bind(context.active(), wrappedFn); - } - return (span: Span) => { // if unary or clientStream if (!original.responseStream) { @@ -135,97 +182,71 @@ export function makeGrpcClientRemoteCall( // if server stream or bidi if (original.responseStream) { - // Both error and status events can be emitted - // the first one emitted set spanEnded to true - let spanEnded = false; - const endSpan = () => { - if (!spanEnded) { - span.end(); - spanEnded = true; - } - }; - context.bind(context.active(), call); - call.on('error', (err: grpcJs.ServiceError) => { - if (call[CALL_SPAN_ENDED]) { - return; - } - call[CALL_SPAN_ENDED] = true; - - span.setStatus({ - code: _grpcStatusCodeToOpenTelemetryStatusCode(err.code), - message: err.message, - }); - span.setAttributes({ - [AttributeNames.GRPC_ERROR_NAME]: err.name, - [AttributeNames.GRPC_ERROR_MESSAGE]: err.message, - [SemanticAttributes.RPC_GRPC_STATUS_CODE]: err.code, - }); - - endSpan(); - }); - - call.on('status', (status: SpanStatus) => { - if (call[CALL_SPAN_ENDED]) { - return; - } - call[CALL_SPAN_ENDED] = true; - - span.setStatus(_grpcStatusCodeToSpanStatus(status.code)); - span.setAttribute(SemanticAttributes.RPC_GRPC_STATUS_CODE, status.code); - - endSpan(); - }); + patchResponseStreamEvents(span, call); } return call; }; } -/** - * Returns the metadata argument from user provided arguments (`args`) - */ -export function getMetadata( - this: GrpcJsInstrumentation, - grpcClient: typeof grpcJs, - original: GrpcClientFunc, - args: Array -): grpcJs.Metadata { - let metadata: grpcJs.Metadata; - +export function getMetadataIndex(args: Array): number { // This finds an instance of Metadata among the arguments. // A possible issue that could occur is if the 'options' parameter from // the user contains an '_internal_repr' as well as a 'getMap' function, // but this is an extremely rare case. - let metadataIndex = args.findIndex((arg: unknown | grpcJs.Metadata) => { + return args.findIndex((arg: unknown | Metadata) => { return ( arg && typeof arg === 'object' && - (arg as grpcJs.Metadata)['internalRepr'] && // changed from _internal_repr in grpc --> @grpc/grpc-js https://github.com/grpc/grpc-node/blob/95289edcaf36979cccf12797cc27335da8d01f03/packages/grpc-js/src/metadata.ts#L88 - typeof (arg as grpcJs.Metadata).getMap === 'function' + (arg as Metadata)['internalRepr'] && // changed from _internal_repr in grpc --> @grpc/grpc-js https://github.com/grpc/grpc-node/blob/95289edcaf36979cccf12797cc27335da8d01f03/packages/grpc-js/src/metadata.ts#L88 + typeof (arg as Metadata).getMap === 'function' ); }); +} + +/** + * Returns the metadata argument from user provided arguments (`args`) + * If no metadata is provided in `args`: adds empty metadata to `args` and returns that empty metadata + */ +export function extractMetadataOrSplice( + grpcLib: typeof grpcJs, + args: Array, + spliceIndex: number +) { + let metadata: grpcJs.Metadata; + const metadataIndex = getMetadataIndex(args); if (metadataIndex === -1) { - metadata = new grpcClient.Metadata(); - if (!original.requestStream) { - // unary or server stream - metadataIndex = 1; - } else { - // client stream or bidi - metadataIndex = 0; - } - args.splice(metadataIndex, 0, metadata); + // Create metadata if it does not exist + metadata = new grpcLib.Metadata(); + args.splice(spliceIndex, 0, metadata); } else { - metadata = args[metadataIndex] as grpcJs.Metadata; + metadata = args[metadataIndex] as Metadata; } return metadata; } +/** + * Returns the metadata argument from user provided arguments (`args`) + * Adds empty metadata to arguments if the default is used. + */ +export function extractMetadataOrSpliceDefault( + grpcClient: typeof grpcJs, + original: GrpcClientFunc, + args: Array +): grpcJs.Metadata { + return extractMetadataOrSplice( + grpcClient, + args, + original.requestStream ? 0 : 1 + ); +} + /** * Inject opentelemetry trace context into `metadata` for use by another * grpc receiver * @param metadata */ -export function setSpanContext(metadata: grpcJs.Metadata): void { +export function setSpanContext(metadata: Metadata): void { propagation.inject(context.active(), metadata, { - set: (metadata, k, v) => metadata.set(k, v as grpcJs.MetadataValue), + set: (meta, k, v) => meta.set(k, v), }); } diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts index 6608521bd6..36be79fd07 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts @@ -14,15 +14,22 @@ * limitations under the License. */ +import type { EventEmitter } from 'events'; + +import type { + Server, + serialize as Serialize, + deserialize as Deserialize, + Metadata, + Client, + ServiceDefinition, + loadPackageDefinition, + GrpcObject, +} from '@grpc/grpc-js'; + import type * as grpcJs from '@grpc/grpc-js'; -import { - InstrumentationNodeModuleDefinition, - isWrapped, -} from '@opentelemetry/instrumentation'; -import { InstrumentationBase } from '@opentelemetry/instrumentation'; -import { GrpcInstrumentationConfig } from '../types'; -import { metadataCaptureType } from '../internal-types'; -import { + +import type { ServerCallWithMeta, SendUnaryDataCallback, ServerRegisterFunction, @@ -30,7 +37,11 @@ import { MakeClientConstructorFunction, PackageDefinition, GrpcClientFunc, + ClientRequestFunction, } from './types'; +import type { GrpcInstrumentationConfig } from '../types'; +import type { metadataCaptureType } from '../internal-types'; + import { context, propagation, @@ -38,7 +49,15 @@ import { SpanOptions, SpanKind, trace, + Span, } from '@opentelemetry/api'; +import { + InstrumentationNodeModuleDefinition, + isWrapped, + InstrumentationBase, +} from '@opentelemetry/instrumentation'; +import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; + import { shouldNotTraceServerCall, handleServerFunction, @@ -47,12 +66,20 @@ import { import { getMethodsToWrap, makeGrpcClientRemoteCall, - getMetadata, + extractMetadataOrSpliceDefault, + setSpanContext, + patchedCallback, + patchResponseStreamEvents, + patchResponseMetadataEvent, + extractMetadataOrSplice, } from './clientUtils'; -import { EventEmitter } from 'events'; -import { _extractMethodAndService, metadataCapture, URI_REGEX } from '../utils'; +import { + _extractMethodAndService, + metadataCapture, + URI_REGEX, + _methodIsIgnored, +} from '../utils'; import { AttributeValues } from '../enums/AttributeValues'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; export class GrpcJsInstrumentation extends InstrumentationBase { private _metadataCapture: metadataCaptureType; @@ -80,7 +107,7 @@ export class GrpcJsInstrumentation extends InstrumentationBase { this._wrap( moduleExports.Server.prototype, 'register', - this._patchServer() as any + this._patchServer() ); // Patch Client methods if (isWrapped(moduleExports.makeGenericClientConstructor)) { @@ -107,6 +134,41 @@ export class GrpcJsInstrumentation extends InstrumentationBase { 'loadPackageDefinition', this._patchLoadPackageDefinition(moduleExports) ); + if (isWrapped(moduleExports.Client.prototype)) { + this._unwrap(moduleExports.Client.prototype, 'makeUnaryRequest'); + this._unwrap( + moduleExports.Client.prototype, + 'makeClientStreamRequest' + ); + this._unwrap( + moduleExports.Client.prototype, + 'makeServerStreamRequest' + ); + this._unwrap( + moduleExports.Client.prototype, + 'makeBidiStreamRequest' + ); + } + this._wrap( + moduleExports.Client.prototype, + 'makeUnaryRequest', + this._patchClientRequestMethod(moduleExports, false) as any + ); + this._wrap( + moduleExports.Client.prototype, + 'makeClientStreamRequest', + this._patchClientRequestMethod(moduleExports, false) as any + ); + this._wrap( + moduleExports.Client.prototype, + 'makeServerStreamRequest', + this._patchClientRequestMethod(moduleExports, true) as any + ); + this._wrap( + moduleExports.Client.prototype, + 'makeBidiStreamRequest', + this._patchClientRequestMethod(moduleExports, true) as any + ); return moduleExports; }, (moduleExports, version) => { @@ -117,6 +179,16 @@ export class GrpcJsInstrumentation extends InstrumentationBase { this._unwrap(moduleExports, 'makeClientConstructor'); this._unwrap(moduleExports, 'makeGenericClientConstructor'); this._unwrap(moduleExports, 'loadPackageDefinition'); + this._unwrap(moduleExports.Client.prototype, 'makeUnaryRequest'); + this._unwrap( + moduleExports.Client.prototype, + 'makeClientStreamRequest' + ); + this._unwrap( + moduleExports.Client.prototype, + 'makeServerStreamRequest' + ); + this._unwrap(moduleExports.Client.prototype, 'makeBidiStreamRequest'); } ), ]; @@ -143,11 +215,11 @@ export class GrpcJsInstrumentation extends InstrumentationBase { const config = this.getConfig(); instrumentation._diag.debug('patched gRPC server'); return function register( - this: grpcJs.Server, + this: Server, name: string, handler: HandleCall, - serialize: grpcJs.serialize, - deserialize: grpcJs.deserialize, + serialize: Serialize, + deserialize: Deserialize, type: string ): boolean { const originalRegisterResult = originalRegister.call( @@ -171,13 +243,7 @@ export class GrpcJsInstrumentation extends InstrumentationBase { ) { const self = this; - if ( - shouldNotTraceServerCall( - call.metadata, - name, - config.ignoreGrpcMethods - ) - ) { + if (shouldNotTraceServerCall(name, config.ignoreGrpcMethods)) { return handleUntracedServerFunction( type, originalFunc, @@ -220,14 +286,13 @@ export class GrpcJsInstrumentation extends InstrumentationBase { instrumentation._wrap( call, 'sendMetadata', - originalSendMetadata => - (responseMetadata: grpcJs.Metadata) => { - instrumentation._metadataCapture.server.captureResponseMetadata( - span, - responseMetadata - ); - originalSendMetadata.call(call, responseMetadata); - } + originalSendMetadata => (responseMetadata: Metadata) => { + instrumentation._metadataCapture.server.captureResponseMetadata( + span, + responseMetadata + ); + originalSendMetadata.call(call, responseMetadata); + } ); context.with(trace.setSpan(context.active(), span), () => { @@ -246,7 +311,85 @@ export class GrpcJsInstrumentation extends InstrumentationBase { } ); return originalRegisterResult; - } as typeof grpcJs.Server.prototype.register; + } as typeof Server.prototype.register; + }; + } + + /** + * Patch for grpc.Client.make*Request(...) functions. + * Provides auto-instrumentation for client requests when using a Client without + * makeGenericClientConstructor/makeClientConstructor + */ + private _patchClientRequestMethod( + grpcLib: typeof grpcJs, + hasResponseStream: boolean + ): ( + original: ClientRequestFunction + ) => ClientRequestFunction { + const instrumentation = this; + return (original: ClientRequestFunction) => { + instrumentation._diag.debug( + 'patched makeClientStreamRequest on grpc client' + ); + + return function makeClientStreamRequest(this: grpcJs.Client) { + // method must always be at first position + const method = arguments[0]; + const { name, service, methodAttributeValue } = + instrumentation._splitMethodString(method); + + // Do not attempt to trace/inject context if method is ignored + if ( + method != null && + _methodIsIgnored( + methodAttributeValue, + instrumentation.getConfig().ignoreGrpcMethods + ) + ) { + return original.apply(this, [...arguments]); + } + + const modifiedArgs = [...arguments]; + const metadata = extractMetadataOrSplice(grpcLib, modifiedArgs, 4); + + const span = instrumentation.createClientSpan( + name, + methodAttributeValue, + service, + metadata + ); + instrumentation.extractNetMetadata(this, span); + + // Callback is only present when there is no responseStream + if (!hasResponseStream) { + // Replace the callback with the patched one if it is there. + // If the callback arg is not a function on the last position then the client will throw + // and never call the callback -> so there's nothing to patch + const lastArgIndex = modifiedArgs.length - 1; + const callback = modifiedArgs[lastArgIndex]; + if (typeof callback === 'function') { + modifiedArgs[lastArgIndex] = patchedCallback(span, callback); + } + } + + return context.with(trace.setSpan(context.active(), span), () => { + setSpanContext(metadata); + + const call = original.apply(this, [...modifiedArgs]); + patchResponseMetadataEvent( + span, + call, + instrumentation._metadataCapture + ); + + // Subscribe to response stream events when there's a response stream. + if (hasResponseStream) { + patchResponseStreamEvents(span, call); + } + + return call; + }); + }; }; } @@ -263,8 +406,8 @@ export class GrpcJsInstrumentation extends InstrumentationBase { return (original: MakeClientConstructorFunction) => { instrumentation._diag.debug('patching client'); return function makeClientConstructor( - this: typeof grpcJs.Client, - methods: grpcJs.ServiceDefinition, + this: typeof Client, + methods: ServiceDefinition, serviceName: string, options?: object ) { @@ -286,18 +429,18 @@ export class GrpcJsInstrumentation extends InstrumentationBase { private _patchLoadPackageDefinition(grpcClient: typeof grpcJs) { const instrumentation = this; instrumentation._diag.debug('patching loadPackageDefinition'); - return (original: typeof grpcJs.loadPackageDefinition) => { + return (original: typeof loadPackageDefinition) => { return function patchedLoadPackageDefinition( this: null, packageDef: PackageDefinition ) { - const result: grpcJs.GrpcObject = original.call( + const result: GrpcObject = original.call( this, packageDef - ) as grpcJs.GrpcObject; + ) as GrpcObject; instrumentation._patchLoadedPackage(grpcClient, result); return result; - } as typeof grpcJs.loadPackageDefinition; + } as typeof loadPackageDefinition; }; } @@ -310,10 +453,10 @@ export class GrpcJsInstrumentation extends InstrumentationBase { const instrumentation = this; return (original: GrpcClientFunc) => { instrumentation._diag.debug('patch all client methods'); - function clientMethodTrace(this: grpcJs.Client) { + function clientMethodTrace(this: Client) { const name = `grpc.${original.path.replace('/', '')}`; const args = [...arguments]; - const metadata = getMetadata.call( + const metadata = extractMetadataOrSpliceDefault.call( instrumentation, grpcClient, original, @@ -328,18 +471,7 @@ export class GrpcJsInstrumentation extends InstrumentationBase { [SemanticAttributes.RPC_METHOD]: method, [SemanticAttributes.RPC_SERVICE]: service, }); - // set net.peer.* from target (e.g., "dns:otel-productcatalogservice:8080") as a hint to APMs - const parsedUri = URI_REGEX.exec(this.getChannel().getTarget()); - if (parsedUri != null && parsedUri.groups != null) { - span.setAttribute( - SemanticAttributes.NET_PEER_NAME, - parsedUri.groups['name'] - ); - span.setAttribute( - SemanticAttributes.NET_PEER_PORT, - parseInt(parsedUri.groups['port']) - ); - } + instrumentation.extractNetMetadata(this, span); instrumentation._metadataCapture.client.captureRequestMetadata( span, @@ -361,6 +493,51 @@ export class GrpcJsInstrumentation extends InstrumentationBase { }; } + private _splitMethodString(method: string) { + if (method == null) { + return { name: '', service: '', methodAttributeValue: '' }; + } + const name = `grpc.${method.replace('/', '')}`; + const { service, method: methodAttributeValue } = + _extractMethodAndService(method); + return { name, service, methodAttributeValue }; + } + + private createClientSpan( + name: string, + methodAttributeValue: string, + service: string, + metadata?: grpcJs.Metadata + ) { + const span = this.tracer + .startSpan(name, { kind: SpanKind.CLIENT }) + .setAttributes({ + [SemanticAttributes.RPC_SYSTEM]: 'grpc', + [SemanticAttributes.RPC_METHOD]: methodAttributeValue, + [SemanticAttributes.RPC_SERVICE]: service, + }); + + if (metadata != null) { + this._metadataCapture.client.captureRequestMetadata(span, metadata); + } + return span; + } + + private extractNetMetadata(client: grpcJs.Client, span: Span) { + // set net.peer.* from target (e.g., "dns:otel-productcatalogservice:8080") as a hint to APMs + const parsedUri = URI_REGEX.exec(client.getChannel().getTarget()); + if (parsedUri != null && parsedUri.groups != null) { + span.setAttribute( + SemanticAttributes.NET_PEER_NAME, + parsedUri.groups['name'] + ); + span.setAttribute( + SemanticAttributes.NET_PEER_PORT, + parseInt(parsedUri.groups['port']) + ); + } + } + /** * Utility function to patch *all* functions loaded through a proto file. * Recursively searches for Client classes and patches all methods, reversing the @@ -369,7 +546,7 @@ export class GrpcJsInstrumentation extends InstrumentationBase { */ private _patchLoadedPackage( grpcClient: typeof grpcJs, - result: grpcJs.GrpcObject + result: GrpcObject ): void { Object.values(result).forEach(service => { if (typeof service === 'function') { @@ -380,11 +557,7 @@ export class GrpcJsInstrumentation extends InstrumentationBase { ); } else if (typeof service.format !== 'string') { // GrpcObject - this._patchLoadedPackage.call( - this, - grpcClient, - service as grpcJs.GrpcObject - ); + this._patchLoadedPackage.call(this, grpcClient, service as GrpcObject); } }); } diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/serverUtils.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/serverUtils.ts index ecfbc3d957..ad07828e68 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/serverUtils.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/serverUtils.ts @@ -20,21 +20,31 @@ * error event should be processed. */ -import { context, Span, SpanStatusCode } from '@opentelemetry/api'; -import type * as grpcJs from '@grpc/grpc-js'; +import type { + ClientReadableStream, + handleBidiStreamingCall, + handleServerStreamingCall, + handleUnaryCall, + ServiceError, +} from '@grpc/grpc-js'; +import type { Span } from '@opentelemetry/api'; + import type { ServerCallWithMeta, SendUnaryDataCallback, GrpcEmitter, HandleCall, } from './types'; +import type { IgnoreMatcher } from '../types'; + +import { context, SpanStatusCode } from '@opentelemetry/api'; +import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; + import { _grpcStatusCodeToOpenTelemetryStatusCode, _methodIsIgnored, } from '../utils'; -import { IgnoreMatcher } from '../types'; import { AttributeNames } from '../enums/AttributeNames'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; import { GRPC_STATUS_CODE_OK } from '../status-code'; export const CALL_SPAN_ENDED = Symbol('opentelemetry call span ended'); @@ -46,8 +56,8 @@ function serverStreamAndBidiHandler( span: Span, call: GrpcEmitter, original: - | grpcJs.handleBidiStreamingCall - | grpcJs.handleServerStreamingCall + | handleBidiStreamingCall + | handleServerStreamingCall ): void { let spanEnded = false; const endSpan = () => { @@ -79,7 +89,7 @@ function serverStreamAndBidiHandler( endSpan(); }); - call.on('error', (err: grpcJs.ServiceError) => { + call.on('error', (err: ServiceError) => { if (call[CALL_SPAN_ENDED]) { return; } @@ -111,11 +121,11 @@ function clientStreamAndUnaryHandler( call: ServerCallWithMeta, callback: SendUnaryDataCallback, original: - | grpcJs.handleUnaryCall - | grpcJs.ClientReadableStream + | handleUnaryCall + | ClientReadableStream ): void { const patchedCallback: SendUnaryDataCallback = ( - err: grpcJs.ServiceError | null, + err: ServiceError | null, value?: ResponseType ) => { if (err) { @@ -166,8 +176,8 @@ export function handleServerFunction( call, callback, originalFunc as - | grpcJs.handleUnaryCall - | grpcJs.ClientReadableStream + | handleUnaryCall + | ClientReadableStream ); case 'serverStream': case 'server_stream': @@ -176,8 +186,8 @@ export function handleServerFunction( span, call, originalFunc as - | grpcJs.handleBidiStreamingCall - | grpcJs.handleServerStreamingCall + | handleBidiStreamingCall + | handleServerStreamingCall ); default: break; @@ -212,7 +222,6 @@ export function handleUntracedServerFunction( * Returns true if the server call should not be traced. */ export function shouldNotTraceServerCall( - metadata: grpcJs.Metadata, methodName: string, ignoreGrpcMethods?: IgnoreMatcher[] ): boolean { diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/types.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/types.ts index e0ae1545d2..06ca7c0b61 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/types.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/types.ts @@ -14,29 +14,38 @@ * limitations under the License. */ -import type * as grpcJs from '@grpc/grpc-js'; import type { EventEmitter } from 'events'; import type { CALL_SPAN_ENDED } from './serverUtils'; +import type { + requestCallback, + ServerUnaryCall, + ServerReadableStream, + ServerWritableStream, + ServerDuplexStream, + Metadata, + Server, + makeGenericClientConstructor, +} from '@grpc/grpc-js'; /** * Server Unary callback type */ -export type SendUnaryDataCallback = grpcJs.requestCallback; +export type SendUnaryDataCallback = requestCallback; /** * Intersection type of all grpc server call types */ export type ServerCall = - | grpcJs.ServerUnaryCall - | grpcJs.ServerReadableStream - | grpcJs.ServerWritableStream - | grpcJs.ServerDuplexStream; + | ServerUnaryCall + | ServerReadableStream + | ServerWritableStream + | ServerDuplexStream; /** * {@link ServerCall} ServerCall extended with misc. missing utility types */ export type ServerCallWithMeta = ServerCall & { - metadata: grpcJs.Metadata; + metadata: Metadata; }; /** @@ -53,10 +62,13 @@ export type GrpcClientFunc = ((...args: unknown[]) => GrpcEmitter) & { responseStream: boolean; }; -export type ServerRegisterFunction = typeof grpcJs.Server.prototype.register; +export type ServerRegisterFunction = typeof Server.prototype.register; -export type MakeClientConstructorFunction = - typeof grpcJs.makeGenericClientConstructor; +export type ClientRequestFunction = ( + ...args: unknown[] +) => ReturnType; + +export type MakeClientConstructorFunction = typeof makeGenericClientConstructor; export type { HandleCall } from '@grpc/grpc-js/build/src/server-call'; export type { PackageDefinition } from '@grpc/grpc-js/build/src/make-client'; diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/clientUtils.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/clientUtils.ts deleted file mode 100644 index af56330a85..0000000000 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/clientUtils.ts +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type * as grpcTypes from 'grpc'; -import type * as events from 'events'; -import { SendUnaryDataCallback, GrpcClientFunc } from './types'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; -import { context, Span, SpanStatusCode, propagation } from '@opentelemetry/api'; -import { - _grpcStatusCodeToSpanStatus, - _grpcStatusCodeToOpenTelemetryStatusCode, - findIndex, -} from '../utils'; -import { AttributeNames } from '../enums/AttributeNames'; -import { metadataCaptureType } from '../internal-types'; -import { GRPC_STATUS_CODE_OK } from '../status-code'; - -/** - * This method handles the client remote call - */ -export const makeGrpcClientRemoteCall = function ( - metadataCapture: metadataCaptureType, - original: GrpcClientFunc, - args: any[], - metadata: grpcTypes.Metadata, - self: grpcTypes.Client -) { - /** - * Patches a callback so that the current span for this trace is also ended - * when the callback is invoked. - */ - function patchedCallback( - span: Span, - callback: SendUnaryDataCallback, - _metadata: grpcTypes.Metadata - ) { - const wrappedFn = (err: grpcTypes.ServiceError, res: any) => { - if (err) { - if (err.code) { - span.setStatus(_grpcStatusCodeToSpanStatus(err.code)); - span.setAttribute(SemanticAttributes.RPC_GRPC_STATUS_CODE, err.code); - } - span.setAttributes({ - [AttributeNames.GRPC_ERROR_NAME]: err.name, - [AttributeNames.GRPC_ERROR_MESSAGE]: err.message, - }); - } else { - span.setStatus({ code: SpanStatusCode.UNSET }); - span.setAttribute( - SemanticAttributes.RPC_GRPC_STATUS_CODE, - GRPC_STATUS_CODE_OK - ); - } - - span.end(); - callback(err, res); - }; - return context.bind(context.active(), wrappedFn); - } - - return (span: Span) => { - if (!span) { - return original.apply(self, args); - } - - // if unary or clientStream - if (!original.responseStream) { - const callbackFuncIndex = findIndex(args, arg => { - return typeof arg === 'function'; - }); - if (callbackFuncIndex !== -1) { - args[callbackFuncIndex] = patchedCallback( - span, - args[callbackFuncIndex], - metadata - ); - } - } - - span.addEvent('sent'); - - setSpanContext(metadata); - const call = original.apply(self, args); - - (call as unknown as events.EventEmitter).on( - 'metadata', - responseMetadata => { - metadataCapture.client.captureResponseMetadata(span, responseMetadata); - } - ); - - // if server stream or bidi - if (original.responseStream) { - // Both error and status events can be emitted - // the first one emitted set spanEnded to true - let spanEnded = false; - const endSpan = () => { - if (!spanEnded) { - span.end(); - spanEnded = true; - } - }; - context.bind(context.active(), call); - (call as unknown as events.EventEmitter).on( - 'error', - (err: grpcTypes.ServiceError) => { - span.setStatus({ - code: _grpcStatusCodeToOpenTelemetryStatusCode(err.code), - message: err.message, - }); - span.setAttributes({ - [AttributeNames.GRPC_ERROR_NAME]: err.name, - [AttributeNames.GRPC_ERROR_MESSAGE]: err.message, - }); - if (err.code != null) { - span.setAttribute( - SemanticAttributes.RPC_GRPC_STATUS_CODE, - err.code - ); - } - endSpan(); - } - ); - - (call as unknown as events.EventEmitter).on( - 'status', - (status: grpcTypes.StatusObject) => { - span.setStatus({ code: SpanStatusCode.UNSET }); - span.setAttribute( - SemanticAttributes.RPC_GRPC_STATUS_CODE, - status.code - ); - endSpan(); - } - ); - } - return call; - }; -}; - -export const getMetadata = function ( - grpcClient: typeof grpcTypes, - original: GrpcClientFunc, - args: any[] -): grpcTypes.Metadata { - let metadata: grpcTypes.Metadata; - - // This finds an instance of Metadata among the arguments. - // A possible issue that could occur is if the 'options' parameter from - // the user contains an '_internal_repr' as well as a 'getMap' function, - // but this is an extremely rare case. - let metadataIndex = findIndex(args, (arg: any) => { - return ( - arg && - typeof arg === 'object' && - arg._internal_repr && - typeof arg.getMap === 'function' - ); - }); - if (metadataIndex === -1) { - metadata = new grpcClient.Metadata(); - if (!original.requestStream) { - // unary or server stream - if (args.length === 0) { - // No argument (for the gRPC call) was provided, so we will have to - // provide one, since metadata cannot be the first argument. - // The internal representation of argument defaults to undefined - // in its non-presence. - // Note that we can't pass null instead of undefined because the - // serializer within gRPC doesn't accept it. - args.push(undefined); - } - metadataIndex = 1; - } else { - // client stream or bidi - metadataIndex = 0; - } - args.splice(metadataIndex, 0, metadata); - } else { - metadata = args[metadataIndex]; - } - return metadata; -}; - -const setSpanContext = function (metadata: grpcTypes.Metadata): void { - propagation.inject(context.active(), metadata, { - set: (metadata, k, v) => metadata.set(k, v as grpcTypes.MetadataValue), - }); -}; diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/index.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/index.ts deleted file mode 100644 index fbeac0395e..0000000000 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/index.ts +++ /dev/null @@ -1,403 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type * as grpcTypes from 'grpc'; -import { - InstrumentationNodeModuleDefinition, - InstrumentationNodeModuleFile, - InstrumentationBase, - isWrapped, -} from '@opentelemetry/instrumentation'; -import { - GrpcInternalClientTypes, - ServerCallWithMeta, - SendUnaryDataCallback, - GrpcClientFunc, -} from './types'; -import { GrpcInstrumentationConfig } from '../types'; -import { metadataCaptureType } from '../internal-types'; -import { - context, - propagation, - SpanOptions, - SpanKind, - trace, -} from '@opentelemetry/api'; -import { - clientStreamAndUnaryHandler, - shouldNotTraceServerCall, - serverStreamAndBidiHandler, -} from './serverUtils'; -import { makeGrpcClientRemoteCall, getMetadata } from './clientUtils'; -import { - _extractMethodAndService, - _methodIsIgnored, - metadataCapture, - URI_REGEX, -} from '../utils'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; -import { AttributeValues } from '../enums/AttributeValues'; - -/** - * Holding reference to grpc module here to access constant of grpc modules - * instead of just requiring it avoid directly depending on grpc itself. - */ -let grpcClient: typeof grpcTypes; - -export class GrpcNativeInstrumentation extends InstrumentationBase< - typeof grpcTypes -> { - private _metadataCapture: metadataCaptureType; - - constructor( - name: string, - version: string, - config?: GrpcInstrumentationConfig - ) { - super(name, version, config); - this._metadataCapture = this._createMetadataCapture(); - } - - init() { - return [ - new InstrumentationNodeModuleDefinition( - 'grpc', - ['1.*'], - (moduleExports, version) => { - this._diag.debug(`Applying patch for grpc@${version}`); - grpcClient = moduleExports; - - if (isWrapped(moduleExports.Server.prototype.register)) { - this._unwrap(moduleExports.Server.prototype, 'register'); - } - this._wrap( - moduleExports.Server.prototype, - 'register', - this._patchServer() as any - ); - // Wrap the externally exported client constructor - if (isWrapped(moduleExports.makeGenericClientConstructor)) { - this._unwrap(moduleExports, 'makeGenericClientConstructor'); - } - this._wrap( - moduleExports, - 'makeGenericClientConstructor', - this._patchClient() - ); - return moduleExports; - }, - (moduleExports, version) => { - if (moduleExports === undefined) return; - this._diag.debug(`Removing patch for grpc@${version}`); - - this._unwrap(moduleExports.Server.prototype, 'register'); - }, - this._getInternalPatchs() - ), - ]; - } - - override getConfig(): GrpcInstrumentationConfig { - return super.getConfig(); - } - - override setConfig(config?: GrpcInstrumentationConfig): void { - super.setConfig(config); - this._metadataCapture = this._createMetadataCapture(); - } - - private _getInternalPatchs() { - const onPatch = ( - moduleExports: GrpcInternalClientTypes, - version?: string - ) => { - this._diag.debug(`Applying internal patch for grpc@${version}`); - if (isWrapped(moduleExports.makeClientConstructor)) { - this._unwrap(moduleExports, 'makeClientConstructor'); - } - this._wrap(moduleExports, 'makeClientConstructor', this._patchClient()); - return moduleExports; - }; - const onUnPatch = ( - moduleExports?: GrpcInternalClientTypes, - version?: string - ) => { - if (moduleExports === undefined) return; - this._diag.debug(`Removing internal patch for grpc@${version}`); - this._unwrap(moduleExports, 'makeClientConstructor'); - }; - return [ - new InstrumentationNodeModuleFile( - 'grpc/src/node/src/client.js', - ['0.13 - 1.6'], - onPatch, - onUnPatch - ), - new InstrumentationNodeModuleFile( - 'grpc/src/client.js', - ['^1.7'], - onPatch, - onUnPatch - ), - ]; - } - - private _patchServer() { - const instrumentation = this; - return (originalRegister: typeof grpcTypes.Server.prototype.register) => { - instrumentation._diag.debug('patched gRPC server'); - - return function register( - this: grpcTypes.Server & { handlers: any }, - name: string, - handler: grpcTypes.handleCall, - serialize: grpcTypes.serialize, - deserialize: grpcTypes.deserialize, - type: string - ) { - const originalResult = originalRegister.apply(this, arguments as any); - const handlerSet = this.handlers[name]; - - instrumentation._wrap( - handlerSet, - 'func', - (originalFunc: grpcTypes.handleCall) => { - return function func( - this: typeof handlerSet, - call: ServerCallWithMeta, - callback: SendUnaryDataCallback - ) { - const self = this; - if (shouldNotTraceServerCall.call(instrumentation, call, name)) { - switch (type) { - case 'unary': - case 'client_stream': - return (originalFunc as Function).call( - self, - call, - callback - ); - case 'server_stream': - case 'bidi': - return (originalFunc as Function).call(self, call); - default: - return originalResult; - } - } - const spanName = `grpc.${name.replace('/', '')}`; - const spanOptions: SpanOptions = { - kind: SpanKind.SERVER, - }; - - instrumentation._diag.debug( - `patch func: ${JSON.stringify(spanOptions)}` - ); - - context.with( - propagation.extract(context.active(), call.metadata, { - get: (metadata, key) => metadata.get(key).map(String), - keys: metadata => Object.keys(metadata.getMap()), - }), - () => { - const { service, method } = _extractMethodAndService(name); - - const span = instrumentation.tracer - .startSpan(spanName, spanOptions) - .setAttributes({ - [SemanticAttributes.RPC_SYSTEM]: - AttributeValues.RPC_SYSTEM, - [SemanticAttributes.RPC_METHOD]: method, - [SemanticAttributes.RPC_SERVICE]: service, - }); - - instrumentation._metadataCapture.server.captureRequestMetadata( - span, - call.metadata - ); - - instrumentation._wrap( - call as any, - 'sendMetadata', - originalSendMetadata => - (responseMetadata: grpcTypes.Metadata) => { - instrumentation._metadataCapture.server.captureResponseMetadata( - span, - responseMetadata - ); - originalSendMetadata.call(call, responseMetadata); - } - ); - - context.with(trace.setSpan(context.active(), span), () => { - switch (type) { - case 'unary': - case 'client_stream': - return clientStreamAndUnaryHandler( - span, - call, - callback, - originalFunc, - self - ); - case 'server_stream': - case 'bidi': - return serverStreamAndBidiHandler( - span, - call, - originalFunc, - self - ); - default: - break; - } - }); - } - ); - }; - } - ); - - return originalResult; - }; - }; - } - - private _patchClient() { - const instrumentation = this; - return (original: typeof grpcTypes.makeGenericClientConstructor): never => { - instrumentation._diag.debug('patching client'); - return function makeClientConstructor( - this: typeof grpcTypes.Client, - methods: { [key: string]: { originalName?: string } }, - _serviceName: string, - _options: grpcTypes.GenericClientOptions - ) { - const client = original.apply(this, arguments as any); - instrumentation._massWrap( - client.prototype as never, - instrumentation._getMethodsToWrap(client, methods) as never[], - instrumentation._getPatchedClientMethods() as any - ); - return client; - } as never; - }; - } - - private _getMethodsToWrap( - client: typeof grpcTypes.Client, - methods: { [key: string]: { originalName?: string } } - ): string[] { - const methodList: string[] = []; - - // For a method defined in .proto as "UnaryMethod" - Object.entries(methods).forEach(([name, { originalName }]) => { - if (!_methodIsIgnored(name, this.getConfig().ignoreGrpcMethods)) { - methodList.push(name); // adds camel case method name: "unaryMethod" - if ( - originalName && - // eslint-disable-next-line no-prototype-builtins - client.prototype.hasOwnProperty(originalName) && - name !== originalName // do not add duplicates - ) { - // adds original method name: "UnaryMethod", - methodList.push(originalName); - } - } - }); - return methodList; - } - - private _getPatchedClientMethods() { - const instrumentation = this; - return (original: GrpcClientFunc) => { - instrumentation._diag.debug('patch all client methods'); - function clientMethodTrace(this: grpcTypes.Client) { - const name = `grpc.${(original.path as string | undefined)?.replace( - '/', - '' - )}`; - const args = Array.prototype.slice.call(arguments); - const metadata = getMetadata(grpcClient, original, args); - const { service, method } = _extractMethodAndService(original.path); - const span = instrumentation.tracer - .startSpan(name, { - kind: SpanKind.CLIENT, - }) - .setAttributes({ - [SemanticAttributes.RPC_SYSTEM]: AttributeValues.RPC_SYSTEM, - [SemanticAttributes.RPC_METHOD]: method, - [SemanticAttributes.RPC_SERVICE]: service, - }); - // set net.peer.* from target (e.g., "dns:otel-productcatalogservice:8080") as a hint to APMs - const parsedUri = URI_REGEX.exec(this.getChannel().getTarget()); - if (parsedUri != null && parsedUri.groups != null) { - span.setAttribute( - SemanticAttributes.NET_PEER_NAME, - parsedUri.groups['name'] - ); - span.setAttribute( - SemanticAttributes.NET_PEER_PORT, - parseInt(parsedUri.groups['port']) - ); - } - - instrumentation._metadataCapture.client.captureRequestMetadata( - span, - metadata - ); - - return context.with(trace.setSpan(context.active(), span), () => - makeGrpcClientRemoteCall( - instrumentation._metadataCapture, - original, - args, - metadata, - this - )(span) - ); - } - Object.assign(clientMethodTrace, original); - return clientMethodTrace; - }; - } - - private _createMetadataCapture(): metadataCaptureType { - const config = this.getConfig(); - - return { - client: { - captureRequestMetadata: metadataCapture( - 'request', - config.metadataToSpanAttributes?.client?.requestMetadata ?? [] - ), - captureResponseMetadata: metadataCapture( - 'response', - config.metadataToSpanAttributes?.client?.responseMetadata ?? [] - ), - }, - server: { - captureRequestMetadata: metadataCapture( - 'request', - config.metadataToSpanAttributes?.server?.requestMetadata ?? [] - ), - captureResponseMetadata: metadataCapture( - 'response', - config.metadataToSpanAttributes?.server?.responseMetadata ?? [] - ), - }, - }; - } -} diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/serverUtils.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/serverUtils.ts deleted file mode 100644 index d97a947443..0000000000 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/serverUtils.ts +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type * as grpcTypes from 'grpc'; -import { SendUnaryDataCallback, ServerCallWithMeta } from './types'; -import { GrpcNativeInstrumentation } from './'; -import { context, Span, SpanStatusCode } from '@opentelemetry/api'; -import { - _grpcStatusCodeToOpenTelemetryStatusCode, - _grpcStatusCodeToSpanStatus, - _methodIsIgnored, -} from '../utils'; -import { AttributeNames } from '../enums/AttributeNames'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; -import { GRPC_STATUS_CODE_OK } from '../status-code'; - -export const clientStreamAndUnaryHandler = function ( - span: Span, - call: ServerCallWithMeta, - callback: SendUnaryDataCallback, - original: - | grpcTypes.handleCall - | grpcTypes.ClientReadableStream, - self: {} -) { - function patchedCallback( - err: grpcTypes.ServiceError, - value: any, - trailer: grpcTypes.Metadata, - flags: grpcTypes.writeFlags - ) { - if (err) { - if (err.code) { - span.setStatus({ - code: _grpcStatusCodeToOpenTelemetryStatusCode(err.code), - message: err.message, - }); - span.setAttribute(SemanticAttributes.RPC_GRPC_STATUS_CODE, err.code); - } - span.setAttributes({ - [AttributeNames.GRPC_ERROR_NAME]: err.name, - [AttributeNames.GRPC_ERROR_MESSAGE]: err.message, - }); - } else { - span.setStatus({ code: SpanStatusCode.UNSET }); - span.setAttribute( - SemanticAttributes.RPC_GRPC_STATUS_CODE, - GRPC_STATUS_CODE_OK - ); - } - span.addEvent('received'); - - // end the span - span.end(); - return callback(err, value, trailer, flags); - } - - context.bind(context.active(), call); - return (original as Function).call(self, call, patchedCallback); -}; - -export const serverStreamAndBidiHandler = function ( - span: Span, - call: ServerCallWithMeta, - original: grpcTypes.handleCall, - self: {} -) { - let spanEnded = false; - const endSpan = () => { - if (!spanEnded) { - spanEnded = true; - span.end(); - } - }; - - context.bind(context.active(), call); - call.on('finish', () => { - span.setStatus(_grpcStatusCodeToSpanStatus(call.status.code)); - span.setAttribute( - SemanticAttributes.RPC_GRPC_STATUS_CODE, - call.status.code - ); - - // if there is an error, span will be ended on error event, otherwise end it here - if (call.status.code === 0) { - span.addEvent('finished'); - endSpan(); - } - }); - - call.on('error', (err: grpcTypes.ServiceError) => { - span.setStatus({ - code: _grpcStatusCodeToOpenTelemetryStatusCode(err.code), - message: err.message, - }); - span.addEvent('finished with error'); - span.setAttributes({ - [AttributeNames.GRPC_ERROR_NAME]: err.name, - [AttributeNames.GRPC_ERROR_MESSAGE]: err.message, - }); - if (err.code != null) { - span.setAttribute(SemanticAttributes.RPC_GRPC_STATUS_CODE, err.code); - } - endSpan(); - }); - - return (original as any).call(self, call); -}; - -/** - * Returns true if the server call should not be traced. - */ -export const shouldNotTraceServerCall = function ( - this: GrpcNativeInstrumentation, - call: ServerCallWithMeta, - name: string -): boolean { - const parsedName = name.split('/'); - return _methodIsIgnored( - parsedName[parsedName.length - 1] || name, - this.getConfig().ignoreGrpcMethods - ); -}; diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/types.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/types.ts deleted file mode 100644 index ef3e4ef9bb..0000000000 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/types.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type * as grpcTypes from 'grpc'; -import * as events from 'events'; - -export type SendUnaryDataCallback = ( - error: grpcTypes.ServiceError | null, - value?: any, - trailer?: grpcTypes.Metadata, - flags?: grpcTypes.writeFlags -) => void; - -interface GrpcStatus { - code: number; - details: string; - metadata: grpcTypes.Metadata; -} - -export type ServerCall = - | typeof grpcTypes.ServerUnaryCall - | typeof grpcTypes.ServerReadableStream - | typeof grpcTypes.ServerWritableStream - | typeof grpcTypes.ServerDuplexStream; - -export type ServerCallWithMeta = ServerCall & { - metadata: grpcTypes.Metadata; - status: GrpcStatus; - request?: unknown; -} & events.EventEmitter; - -export type GrpcClientFunc = typeof Function & { - path: string; - requestStream: boolean; - responseStream: boolean; -}; - -export type GrpcInternalClientTypes = { - makeClientConstructor: typeof grpcTypes.makeGenericClientConstructor; -}; diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/index.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/index.ts index 26ea0efdb4..5e1bb947d1 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/index.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/index.ts @@ -15,4 +15,4 @@ */ export * from './instrumentation'; -export { GrpcInstrumentationConfig } from './types'; +export type { GrpcInstrumentationConfig } from './types'; diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/instrumentation.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/instrumentation.ts index c2a8946f97..bb6e095cf7 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/instrumentation.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/instrumentation.ts @@ -14,17 +14,16 @@ * limitations under the License. */ -import { GrpcInstrumentationConfig } from './types'; +import type { GrpcInstrumentationConfig } from './types'; +import type { MeterProvider, TracerProvider } from '@opentelemetry/api'; + import { VERSION } from './version'; -import { GrpcNativeInstrumentation } from './grpc'; import { GrpcJsInstrumentation } from './grpc-js'; -import * as api from '@opentelemetry/api'; /** The metadata key under which span context is stored as a binary value. */ export const GRPC_TRACE_KEY = 'grpc-trace-bin'; export class GrpcInstrumentation { - private _grpcNativeInstrumentation: GrpcNativeInstrumentation; private _grpcJsInstrumentation: GrpcJsInstrumentation; public readonly instrumentationName: string = @@ -37,16 +36,10 @@ export class GrpcInstrumentation { this.instrumentationVersion, config ); - this._grpcNativeInstrumentation = new GrpcNativeInstrumentation( - this.instrumentationName, - this.instrumentationVersion, - config - ); } public setConfig(config?: GrpcInstrumentationConfig) { this._grpcJsInstrumentation.setConfig(config); - this._grpcNativeInstrumentation.setConfig(config); } /** @@ -66,29 +59,25 @@ export class GrpcInstrumentation { enable() { this._grpcJsInstrumentation.enable(); - this._grpcNativeInstrumentation.enable(); } disable() { this._grpcJsInstrumentation.disable(); - this._grpcNativeInstrumentation.disable(); } /** * Sets MeterProvider to this plugin * @param meterProvider */ - public setMeterProvider(meterProvider: api.MeterProvider) { + public setMeterProvider(meterProvider: MeterProvider) { this._grpcJsInstrumentation.setMeterProvider(meterProvider); - this._grpcNativeInstrumentation.setMeterProvider(meterProvider); } /** * Sets TraceProvider to this plugin * @param tracerProvider */ - public setTracerProvider(tracerProvider: api.TracerProvider) { + public setTracerProvider(tracerProvider: TracerProvider) { this._grpcJsInstrumentation.setTracerProvider(tracerProvider); - this._grpcNativeInstrumentation.setTracerProvider(tracerProvider); } } diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/internal-types.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/internal-types.ts index ebc17ae1d4..50d337b636 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/internal-types.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/internal-types.ts @@ -14,29 +14,16 @@ * limitations under the License. */ -import { Span } from '@opentelemetry/api'; -import type * as grpcJsTypes from '@grpc/grpc-js'; -import type * as grpcTypes from 'grpc'; +import type { Span } from '@opentelemetry/api'; +import type { Metadata } from '@grpc/grpc-js'; export type metadataCaptureType = { client: { - captureRequestMetadata: ( - span: Span, - metadata: grpcJsTypes.Metadata | grpcTypes.Metadata - ) => void; - captureResponseMetadata: ( - span: Span, - metadata: grpcJsTypes.Metadata | grpcTypes.Metadata - ) => void; + captureRequestMetadata: (span: Span, metadata: Metadata) => void; + captureResponseMetadata: (span: Span, metadata: Metadata) => void; }; server: { - captureRequestMetadata: ( - span: Span, - metadata: grpcJsTypes.Metadata | grpcTypes.Metadata - ) => void; - captureResponseMetadata: ( - span: Span, - metadata: grpcJsTypes.Metadata | grpcTypes.Metadata - ) => void; + captureRequestMetadata: (span: Span, metadata: Metadata) => void; + captureResponseMetadata: (span: Span, metadata: Metadata) => void; }; }; diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/src/utils.ts b/experimental/packages/opentelemetry-instrumentation-grpc/src/utils.ts index 8d031107dd..3cfbfc1f55 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/src/utils.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/src/utils.ts @@ -14,10 +14,10 @@ * limitations under the License. */ -import { SpanStatusCode, SpanStatus, Span } from '@opentelemetry/api'; -import type * as grpcTypes from 'grpc'; -import type * as grpcJsTypes from '@grpc/grpc-js'; -import { IgnoreMatcher } from './types'; +import { SpanStatusCode } from '@opentelemetry/api'; +import type { SpanStatus, Span } from '@opentelemetry/api'; +import type { status as GrpcStatus, Metadata } from '@grpc/grpc-js'; +import type { IgnoreMatcher } from './types'; // e.g., "dns:otel-productcatalogservice:8080" or "otel-productcatalogservice:8080" or "127.0.0.1:8080" export const URI_REGEX = @@ -26,7 +26,7 @@ export const URI_REGEX = // Equivalent to lodash _.findIndex export const findIndex: (args: T[], fn: (arg: T) => boolean) => number = ( args, - fn: Function + fn ) => { let index = -1; for (const arg of args) { @@ -43,7 +43,7 @@ export const findIndex: (args: T[], fn: (arg: T) => boolean) => number = ( * @param status */ export const _grpcStatusCodeToOpenTelemetryStatusCode = ( - status?: grpcTypes.status | grpcJsTypes.status + status?: GrpcStatus ): SpanStatusCode => { if (status !== undefined && status === 0) { return SpanStatusCode.UNSET; @@ -128,7 +128,7 @@ export function metadataCapture( ]) ); - return (span: Span, metadata: grpcJsTypes.Metadata | grpcTypes.Metadata) => { + return (span: Span, metadata: Metadata) => { for (const [ capturedMetadata, normalizedMetadata, @@ -137,7 +137,7 @@ export function metadataCapture( .get(capturedMetadata) .flatMap(value => (typeof value === 'string' ? value.toString() : [])); - if (metadataValues === undefined || metadataValues === []) { + if (metadataValues === undefined || metadataValues.length === 0) { continue; } diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/test/.gitignore b/experimental/packages/opentelemetry-instrumentation-grpc/test/.gitignore new file mode 100644 index 0000000000..c9438a302c --- /dev/null +++ b/experimental/packages/opentelemetry-instrumentation-grpc/test/.gitignore @@ -0,0 +1 @@ +/proto diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/test/fixtures/buf.gen.yaml b/experimental/packages/opentelemetry-instrumentation-grpc/test/fixtures/buf.gen.yaml new file mode 100644 index 0000000000..a0aba044f1 --- /dev/null +++ b/experimental/packages/opentelemetry-instrumentation-grpc/test/fixtures/buf.gen.yaml @@ -0,0 +1,9 @@ +version: v1 +plugins: + - plugin: buf.build/community/timostamm-protobuf-ts:v2.9.0 + out: ../../test/proto/ts/fixtures + opt: + - long_type_string + - generate_dependencies + - ts_nocheck + diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/test/fixtures/buf.lock b/experimental/packages/opentelemetry-instrumentation-grpc/test/fixtures/buf.lock new file mode 100644 index 0000000000..65d8f1f75c --- /dev/null +++ b/experimental/packages/opentelemetry-instrumentation-grpc/test/fixtures/buf.lock @@ -0,0 +1,8 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: googleapis + repository: googleapis + commit: cc916c31859748a68fd229a3c8d7a2e8 + digest: shake256:469b049d0eb04203d5272062636c078decefc96fec69739159c25d85349c50c34c7706918a8b216c5c27f76939df48452148cff8c5c3ae77fa6ba5c25c1b8bf8 diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/test/fixtures/buf.yaml b/experimental/packages/opentelemetry-instrumentation-grpc/test/fixtures/buf.yaml new file mode 100644 index 0000000000..dc977e439a --- /dev/null +++ b/experimental/packages/opentelemetry-instrumentation-grpc/test/fixtures/buf.yaml @@ -0,0 +1,9 @@ +version: v1 +lint: + use: + - DEFAULT +breaking: + use: + - FILE +deps: + - buf.build/googleapis/googleapis diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/test/grpc-js.test.ts b/experimental/packages/opentelemetry-instrumentation-grpc/test/grpc-js.test.ts index 624d267a21..b7e2210298 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/test/grpc-js.test.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/test/grpc-js.test.ts @@ -21,8 +21,8 @@ const instrumentation = new GrpcInstrumentation(); instrumentation.enable(); instrumentation.disable(); -import * as grpcJs from '@grpc/grpc-js'; +import '@grpc/grpc-js'; describe('#grpc-js', () => { - runTests(instrumentation, 'grpc', grpcJs, 12346); + runTests(instrumentation, 'grpc', 12346); }); diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/test/grpc-protobuf-ts.test.ts b/experimental/packages/opentelemetry-instrumentation-grpc/test/grpc-protobuf-ts.test.ts new file mode 100644 index 0000000000..8e238a6acc --- /dev/null +++ b/experimental/packages/opentelemetry-instrumentation-grpc/test/grpc-protobuf-ts.test.ts @@ -0,0 +1,831 @@ +/* + * 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 { GrpcInstrumentation } from '../src'; + +const instrumentation = new GrpcInstrumentation(); +instrumentation.enable(); +instrumentation.disable(); + +import { GrpcTransport } from '@protobuf-ts/grpc-transport'; +import * as grpc from '@grpc/grpc-js'; +import { GrpcTesterClient } from './proto/ts/fixtures/grpc-test.client'; +import { + InMemorySpanExporter, + NodeTracerProvider, + SimpleSpanProcessor, +} from '@opentelemetry/sdk-trace-node'; +import * as protoLoader from '@grpc/proto-loader'; +import * as path from 'path'; +import * as assert from 'assert'; +import { + context, + ContextManager, + propagation, + SpanKind, + trace, +} from '@opentelemetry/api'; +import { W3CTraceContextPropagator } from '@opentelemetry/core'; +import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks'; +import { startServer } from './helper'; +import { + assertExportedSpans, + assertNoSpansExported, + SpanAssertionFunction, + TestFunction, +} from './protobuf-ts-utils'; + +const memoryExporter = new InMemorySpanExporter(); +const PROTO_PATH = path.resolve(__dirname, './fixtures/grpc-test.proto'); +const NO_ERROR = grpc.status.UNAUTHENTICATED + 1; + +/** + * Creates a client generated via protobuf-ts that is using the {@link grpc.Client} class + * directly. + */ +function createClient() { + return new GrpcTesterClient( + new GrpcTransport({ + host: 'localhost:3333', + channelCredentials: grpc.credentials.createInsecure(), + }) + ); +} + +/** + * Loads the server from proto and starts it on port 3333. + */ +async function loadAndStartServer() { + const options = { + keepCase: true, + longs: String, + enums: String, + defaults: true, + oneofs: true, + }; + + // Reloading from proto is needed as only servers loaded after the + // instrumentation is enabled will be instrumented. + const packageDefinition = await protoLoader.load(PROTO_PATH, options); + const proto = grpc.loadPackageDefinition(packageDefinition).pkg_test; + return startServer(proto, 3333); +} + +/** + * Creates a list of test data that includes all possible cases of status codes + * returned by the server, the input for the server to provoke the status codes, + * and the expected result code that should be present on the span. + */ +function getStatusCodeTestData(): { + // Name of the key used in the test (OK, UNAUTHENTICATED, DATA_LOSS, ...) + key: string; + // Input for the server implementation that will provoke the status code from 'key' + input: number; + // The result code that should be present on the created span + expectedResultCode: number; +}[] { + const codes = Object.keys(grpc.status) + .filter(key => !isNaN(Number(grpc.status[key as any]))) + // Remove 'OK' as the test server has special behavior to provoke an 'OK' response + .filter(key => key !== 'OK') + // Create the test data + .map(key => { + return { + key: key, + input: Number(grpc.status[key as any]), + expectedResultCode: Number(grpc.status[key as any]), + }; + }); + + // Push 'OK' with special input to provoke 'OK' response from test-server + codes.push({ + key: 'OK', + input: NO_ERROR, + expectedResultCode: grpc.status.OK, + }); + + return codes; +} + +/** + * Creates tests that assert that no spans are created. + * @param statusCodeTestWithRootSpan function that creates tests that include a root span + * @param statusCodeTestNoRootSpan function that creates tests that do not include a root span + */ +function shouldNotCreateSpans( + statusCodeTestWithRootSpan: TestFunction, + statusCodeTestNoRootSpan: TestFunction +) { + describe('with root span', () => { + getStatusCodeTestData().forEach(({ key, input, expectedResultCode }) => { + statusCodeTestWithRootSpan( + input, + key, + expectedResultCode, + assertNoSpansExported + ); + }); + }); + + describe('without root span', () => { + getStatusCodeTestData().forEach(({ key, input, expectedResultCode }) => { + statusCodeTestNoRootSpan( + input, + key, + expectedResultCode, + assertNoSpansExported + ); + }); + }); +} + +describe('#grpc-protobuf', () => { + let client: GrpcTesterClient; + let server: grpc.Server; + const provider = new NodeTracerProvider(); + let contextManager: ContextManager; + provider.addSpanProcessor(new SimpleSpanProcessor(memoryExporter)); + + before(() => { + propagation.setGlobalPropagator(new W3CTraceContextPropagator()); + instrumentation.setTracerProvider(provider); + }); + + beforeEach(() => { + memoryExporter.reset(); + contextManager = new AsyncHooksContextManager().enable(); + context.setGlobalContextManager(contextManager); + }); + + describe('client', async () => { + beforeEach(async () => { + instrumentation.enable(); + client = createClient(); + + server = await loadAndStartServer(); + }); + + afterEach(done => { + context.disable(); + server.tryShutdown(() => { + instrumentation.disable(); + done(); + }); + }); + + describe('makeUnaryRequest()', async () => { + async function act(status: number) { + return client.unaryMethod({ + num: status, + }); + } + + function statusCodeTestNoRootSpan( + input: number, + key: string, + expectedSpanStatus: number, + assertSpans: SpanAssertionFunction + ) { + it('with status code: ' + key, async () => { + // Act + try { + const request = await act(input); + // Assert success results + assert.strictEqual(request.response.num, input); + } catch (e) { + // Assert failure results + assert.strictEqual(e.code, key); + } + // Assert span data + assertSpans( + memoryExporter, + 'pkg_test.GrpcTester', + 'UnaryMethod', + expectedSpanStatus + ); + }); + } + + function statusCodeTestWithRootSpan( + input: number, + key: string, + expectedResultCode: number, + assertSpans: SpanAssertionFunction + ) { + it('with status code: ' + key, async () => { + // Arrange + const span = provider + .getTracer('default') + .startSpan('TestSpan', { kind: SpanKind.PRODUCER }); + return context.with( + trace.setSpan(context.active(), span), + async () => { + const rootSpan = trace.getSpan(context.active()); + assert.ok(rootSpan != null); + assert.deepStrictEqual(rootSpan, span); + + // Act + try { + const request = await act(input); + // Assert success results + assert.strictEqual(request.response.num, input); + } catch (e) { + // Assert failure results + assert.strictEqual(e.code, key); + } + + // Assert + assertSpans( + memoryExporter, + 'pkg_test.GrpcTester', + 'UnaryMethod', + expectedResultCode, + rootSpan + ); + } + ); + }); + } + + describe('should create root client span and server child span', () => { + getStatusCodeTestData().forEach( + ({ key, input, expectedResultCode }) => { + statusCodeTestNoRootSpan( + input, + key, + expectedResultCode, + assertExportedSpans + ); + } + ); + }); + + describe('should create child client span when parent span exists', () => { + getStatusCodeTestData().forEach( + ({ key, input, expectedResultCode }) => { + statusCodeTestWithRootSpan( + input, + key, + expectedResultCode, + assertExportedSpans + ); + } + ); + }); + + describe('should not create any spans when disabled', () => { + beforeEach(done => { + instrumentation.disable(); + server.tryShutdown(() => { + loadAndStartServer().then(loadedServer => { + server = loadedServer; + done(); + }); + }); + }); + + afterEach(() => { + instrumentation.enable(); + }); + + shouldNotCreateSpans( + statusCodeTestWithRootSpan, + statusCodeTestNoRootSpan + ); + }); + }); + + describe('makeClientStreamRequest()', () => { + async function act(input: number) { + const call = client.clientStreamMethod({ + num: input, + }); + + await call.requests.send({ num: input }); + await call.requests.send({ num: input }); + await call.requests.complete(); + + return await call.response; + } + + async function statusCodeTestNoRootSpan( + input: number, + key: string, + expectedSpanStatus: number, + assertSpans: SpanAssertionFunction + ) { + it('with status code: ' + key, async () => { + // Act + try { + const response = await act(input); + // Assert success results + assert.strictEqual(response.num, input * 2); + } catch (e) { + // Assert failure results + assert.strictEqual(e.code, key); + } + + assertSpans( + memoryExporter, + 'pkg_test.GrpcTester', + 'ClientStreamMethod', + expectedSpanStatus + ); + }); + } + + async function statusCodeTestWithRootSpan( + input: number, + key: string, + expectedSpanStatus: number, + assertSpans: SpanAssertionFunction + ) { + it('with status code: ' + key, async () => { + // Arrange + const span = provider + .getTracer('default') + .startSpan('TestSpan', { kind: SpanKind.PRODUCER }); + return context.with( + trace.setSpan(context.active(), span), + async () => { + const rootSpan = trace.getSpan(context.active()); + assert.ok(rootSpan != null); + assert.deepStrictEqual(rootSpan, span); + + // Act + try { + const response = await act(input); + // Assert success results + assert.strictEqual(response.num, input * 2); + } catch (e) { + // Assert failure results + assert.strictEqual(e.code, key); + } + + // Assert + assertSpans( + memoryExporter, + 'pkg_test.GrpcTester', + 'ClientStreamMethod', + expectedSpanStatus, + rootSpan + ); + } + ); + }); + } + + describe('should create root client span and server child span', () => { + getStatusCodeTestData().forEach( + ({ key, input, expectedResultCode }) => { + statusCodeTestNoRootSpan( + input, + key, + expectedResultCode, + assertExportedSpans + ); + } + ); + }); + + describe('should create child client span when parent span exists', () => { + getStatusCodeTestData().forEach( + ({ key, input, expectedResultCode }) => { + statusCodeTestWithRootSpan( + input, + key, + expectedResultCode, + assertExportedSpans + ); + } + ); + }); + + describe('should not create any spans when disabled', () => { + beforeEach(done => { + instrumentation.disable(); + server.tryShutdown(() => { + loadAndStartServer().then(loadedServer => { + server = loadedServer; + done(); + }); + }); + }); + + afterEach(() => { + instrumentation.enable(); + }); + + shouldNotCreateSpans( + statusCodeTestWithRootSpan, + statusCodeTestNoRootSpan + ); + }); + }); + + describe('makeServerStreamRequest()', () => { + function statusCodeTestNoRootSpan( + input: number, + key: string, + expectedSpanStatus: number, + assertSpans: SpanAssertionFunction + ) { + it('with status code: ' + key, done => { + const serverStream = client.serverStreamMethod({ + num: input, + }); + + serverStream.responses.onMessage(message => { + assert.strictEqual(message.num, input); + }); + + function completeCallback() { + try { + assertSpans( + memoryExporter, + 'pkg_test.GrpcTester', + 'ServerStreamMethod', + expectedSpanStatus + ); + } catch (err) { + // catch error and call done() to ensure an error message + // is shown in the test results instead of a test timeout + done(err); + return; + } + done(); + } + + serverStream.responses.onError(completeCallback); + serverStream.responses.onComplete(completeCallback); + }); + } + + function statusCodeTestWithRootSpan( + input: number, + key: string, + expectedSpanStatus: number, + assertSpans: SpanAssertionFunction + ) { + it('with status code: ' + key, done => { + // Arrange + const span = provider + .getTracer('default') + .startSpan('TestSpan', { kind: SpanKind.PRODUCER }); + context.with(trace.setSpan(context.active(), span), async () => { + const rootSpan = trace.getSpan(context.active()); + assert.ok(rootSpan != null); + assert.deepStrictEqual(rootSpan, span); + + // Act + const serverStream = client.serverStreamMethod({ + num: input, + }); + + serverStream.responses.onMessage(message => { + assert.strictEqual(message.num, input); + }); + + function completeCallback() { + try { + // Assert + assertSpans( + memoryExporter, + 'pkg_test.GrpcTester', + 'ServerStreamMethod', + expectedSpanStatus, + rootSpan + ); + } catch (err) { + // catch error and call done() to ensure an error message + // is shown in the test results instead of a test timeout + done(err); + return; + } + done(); + } + + serverStream.responses.onError(completeCallback); + serverStream.responses.onComplete(completeCallback); + }); + }); + } + + describe('should create root client span and server child span', () => { + getStatusCodeTestData().forEach( + ({ key, input, expectedResultCode }) => { + statusCodeTestNoRootSpan( + input, + key, + expectedResultCode, + assertExportedSpans + ); + } + ); + }); + + describe('should create child client span when parent span exists', () => { + getStatusCodeTestData().forEach( + ({ key, input, expectedResultCode }) => { + statusCodeTestWithRootSpan( + input, + key, + expectedResultCode, + assertExportedSpans + ); + } + ); + }); + + describe('should not create any spans when disabled', () => { + beforeEach(done => { + instrumentation.disable(); + server.tryShutdown(() => { + loadAndStartServer().then(loadedServer => { + server = loadedServer; + done(); + }); + }); + }); + + afterEach(() => { + instrumentation.enable(); + }); + + shouldNotCreateSpans( + statusCodeTestWithRootSpan, + statusCodeTestNoRootSpan + ); + }); + }); + + describe('makeBidiStreamRequest()', () => { + function statusCodeTestNoRootSpan( + input: number, + key: string, + expectedSpanStatus: number, + assertSpans: SpanAssertionFunction + ) { + it('with status code: ' + key, done => { + const bidiStream = client.bidiStreamMethod(); + + bidiStream.responses.onMessage(message => { + assert.strictEqual(message.num, input); + }); + + function completeHandler() { + try { + assertSpans( + memoryExporter, + 'pkg_test.GrpcTester', + 'BidiStreamMethod', + expectedSpanStatus + ); + } catch (err) { + // catch error and call done() to ensure an error message + // is shown in the test results instead of a test timeout + done(err); + return; + } + done(); + } + + bidiStream.responses.onError(completeHandler); + bidiStream.responses.onComplete(completeHandler); + + bidiStream.requests.send({ + num: input, + }); + bidiStream.requests.send({ + num: input, + }); + bidiStream.requests.complete(); + }); + } + + function statusCodeTestWithRootSpan( + input: number, + key: string, + expectedSpanStatus: number, + assertSpans: SpanAssertionFunction + ) { + it('with status code: ' + key, done => { + // Arrange + const span = provider + .getTracer('default') + .startSpan('TestSpan', { kind: SpanKind.PRODUCER }); + context.with(trace.setSpan(context.active(), span), () => { + const rootSpan = trace.getSpan(context.active()); + assert.ok(rootSpan != null); + assert.deepStrictEqual(rootSpan, span); + + // Act + const bidiStream = client.bidiStreamMethod(); + + function completeHandler() { + try { + assertSpans( + memoryExporter, + 'pkg_test.GrpcTester', + 'BidiStreamMethod', + expectedSpanStatus, + rootSpan + ); + } catch (err) { + // catch error and call done() to ensure an error message + // is shown in the test results instead of a test timeout + done(err); + return; + } + done(); + } + + bidiStream.responses.onMessage(message => { + assert.strictEqual(message.num, input); + }); + + bidiStream.responses.onError(completeHandler); + bidiStream.responses.onComplete(completeHandler); + + bidiStream.requests.send({ + num: input, + }); + bidiStream.requests.send({ + num: input, + }); + bidiStream.requests.complete(); + }); + }); + } + + describe('should create root client span and server child span', () => { + getStatusCodeTestData().forEach( + ({ key, input, expectedResultCode }) => { + statusCodeTestNoRootSpan( + input, + key, + expectedResultCode, + assertExportedSpans + ); + } + ); + }); + + describe('should create child client span when parent span exists', () => { + getStatusCodeTestData().forEach( + ({ key, input, expectedResultCode }) => { + statusCodeTestWithRootSpan( + input, + key, + expectedResultCode, + assertExportedSpans + ); + } + ); + }); + + describe('should not create any spans when disabled', () => { + beforeEach(done => { + instrumentation.disable(); + server.tryShutdown(() => { + loadAndStartServer().then(loadedServer => { + server = loadedServer; + done(); + }); + }); + }); + + afterEach(() => { + instrumentation.enable(); + }); + + shouldNotCreateSpans( + statusCodeTestWithRootSpan, + statusCodeTestNoRootSpan + ); + }); + }); + }); + + describe('should not produce telemetry when ignored via config', () => { + beforeEach(async () => { + instrumentation.disable(); + instrumentation.setConfig({ + ignoreGrpcMethods: [ + 'UnaryMethod', + new RegExp(/^camel.*Method$/), + (str: string) => str === 'BidiStreamMethod', + ], + }); + instrumentation.enable(); + client = createClient(); + + server = await loadAndStartServer(); + }); + + it('when filtered by exact string', async () => { + await client.unaryMethod({ num: NO_ERROR }); + assertNoSpansExported( + memoryExporter, + 'pkg_test.GrpcTester', + 'UnaryMethod', + grpc.status.OK + ); + }); + + it('when filtered by RegExp', async () => { + await client.camelCaseMethod({ num: NO_ERROR }); + assertNoSpansExported( + memoryExporter, + 'pkg_test.GrpcTester', + 'UnaryMethod', + grpc.status.OK + ); + }); + + it('when filtered by predicate', done => { + const stream = client.bidiStreamMethod({ num: NO_ERROR }); + stream.requests.send({ + num: NO_ERROR, + }); + stream.requests.complete(); + + stream.responses.onComplete(() => { + assertNoSpansExported( + memoryExporter, + 'pkg_test.GrpcTester', + 'UnaryMethod', + grpc.status.OK + ); + done(); + }); + }); + + afterEach(done => { + instrumentation.setConfig({}); + context.disable(); + server.tryShutdown(() => { + instrumentation.disable(); + done(); + }); + }); + }); + + describe('should capture metadata when set up in config', () => { + beforeEach(async () => { + instrumentation.setConfig({ + metadataToSpanAttributes: { + client: { + requestMetadata: ['client_metadata_key'], + responseMetadata: ['server_metadata_key'], + }, + server: { + requestMetadata: ['client_metadata_key'], + responseMetadata: ['server_metadata_key'], + }, + }, + }); + instrumentation.enable(); + client = createClient(); + + server = await loadAndStartServer(); + }); + + it('should capture client metadata', async () => { + await client.unaryMethod( + { num: NO_ERROR }, + { + meta: { + client_metadata_key: 'client_metadata_value', + }, + } + ); + const spans = memoryExporter.getFinishedSpans(); + assert.equal( + spans[0].attributes['rpc.request.metadata.client_metadata_key'], + 'client_metadata_value' + ); + }); + + afterEach(done => { + instrumentation.setConfig({}); + context.disable(); + server.tryShutdown(() => { + instrumentation.disable(); + done(); + }); + }); + }); +}); diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/test/helper.ts b/experimental/packages/opentelemetry-instrumentation-grpc/test/helper.ts index 58855a6a5f..9d861fd651 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/test/helper.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/test/helper.ts @@ -32,8 +32,21 @@ import { } from '@opentelemetry/sdk-trace-base'; import * as assert from 'assert'; import * as protoLoader from '@grpc/proto-loader'; -import type * as grpcNapi from 'grpc'; -import type * as grpcJs from '@grpc/grpc-js'; +import { + status as GrpcStatus, + ServerUnaryCall, + requestCallback, + ServerReadableStream, + ServerDuplexStream, + ServerWritableStream, + Client, + Metadata, + ServiceError, + Server, + credentials, + loadPackageDefinition, + ServerCredentials, +} from '@grpc/grpc-js'; import { assertPropagation, assertSpan } from './utils/assertionUtils'; import { promisify } from 'util'; import type { GrpcInstrumentation } from '../src'; @@ -54,25 +67,7 @@ interface TestRequestResponse { num: number; } -type ServiceError = grpcNapi.ServiceError | grpcJs.ServiceError; -type Client = grpcNapi.Client | grpcJs.Client; -type Server = grpcNapi.Server | grpcJs.Server; -type ServerUnaryCall = - | grpcNapi.ServerUnaryCall - | grpcJs.ServerUnaryCall; -type RequestCallback = grpcJs.requestCallback; -type ServerReadableStream = - | grpcNapi.ServerReadableStream - | grpcJs.ServerReadableStream; -type ServerWriteableStream = - | grpcNapi.ServerWriteableStream - | grpcJs.ServerWritableStream; -type ServerDuplexStream = - | grpcNapi.ServerDuplexStream - | grpcJs.ServerDuplexStream; -type Metadata = grpcNapi.Metadata | grpcJs.Metadata; - -type TestGrpcClient = (typeof grpcJs | typeof grpcNapi)['Client'] & { +type TestGrpcClient = Client & { unaryMethodWithMetadata: any; unaryMethod: any; UnaryMethod: any; @@ -114,14 +109,149 @@ const checkEqual = ? requestEqual(x)(y) : false; +const replicate = (request: TestRequestResponse) => { + const result: TestRequestResponse[] = []; + for (let i = 0; i < request.num; i++) { + result.push(request); + } + return result; +}; + +export async function startServer(proto: any, port: number) { + const MAX_ERROR_STATUS = GrpcStatus.UNAUTHENTICATED; + const server = new Server(); + + function getError(msg: string, code: number): ServiceError | null { + const err: ServiceError = { + ...new Error(msg), + name: msg, + message: msg, + code, + details: msg, + metadata: new Metadata(), + }; + return err; + } + + server.addService(proto.GrpcTester.service, { + // An error is emitted every time + // request.num <= MAX_ERROR_STATUS = (status.UNAUTHENTICATED) + // in those cases, erro.code = request.num + + // This method returns the request + // This method returns the request + unaryMethodWithMetadata( + call: ServerUnaryCall, + callback: requestCallback + ) { + const serverMetadata: any = new Metadata(); + serverMetadata.add('server_metadata_key', 'server_metadata_value'); + + call.sendMetadata(serverMetadata); + + call.request.num <= MAX_ERROR_STATUS + ? callback( + getError( + 'Unary Method with Metadata Error', + call.request.num + ) as ServiceError + ) + : callback(null, { num: call.request.num }); + }, + + // This method returns the request + unaryMethod( + call: ServerUnaryCall, + callback: requestCallback + ) { + call.request.num <= MAX_ERROR_STATUS + ? callback( + getError('Unary Method Error', call.request.num) as ServiceError + ) + : callback(null, { num: call.request.num }); + }, + + // This method returns the request + camelCaseMethod( + call: ServerUnaryCall, + callback: requestCallback + ) { + call.request.num <= MAX_ERROR_STATUS + ? callback( + getError('Unary Method Error', call.request.num) as ServiceError + ) + : callback(null, { num: call.request.num }); + }, + + // This method sums the requests + clientStreamMethod( + call: ServerReadableStream, + callback: requestCallback + ) { + let sum = 0; + let hasError = false; + let code = GrpcStatus.OK; + call.on('data', (data: TestRequestResponse) => { + sum += data.num; + if (data.num <= MAX_ERROR_STATUS) { + hasError = true; + code = data.num; + } + }); + call.on('end', () => { + hasError + ? callback(getError('Client Stream Method Error', code) as any) + : callback(null, { num: sum }); + }); + }, + + // This method returns an array that replicates the request, request.num of + // times + serverStreamMethod: (call: ServerWritableStream) => { + const result = replicate(call.request); + + if (call.request.num <= MAX_ERROR_STATUS) { + call.emit( + 'error', + getError('Server Stream Method Error', call.request.num) + ); + } else { + result.forEach(element => { + call.write(element); + }); + } + call.end(); + }, + + // This method returns the request + bidiStreamMethod: (call: ServerDuplexStream) => { + call.on('data', (data: TestRequestResponse) => { + if (data.num <= MAX_ERROR_STATUS) { + call.emit('error', getError('Server Stream Method Error', data.num)); + } else { + call.write(data); + } + }); + call.on('end', () => { + call.end(); + }); + }, + }); + const bindAwait = promisify(server.bindAsync); + await bindAwait.call( + server, + 'localhost:' + port, + ServerCredentials.createInsecure() + ); + server.start(); + return server; +} + export const runTests = ( plugin: GrpcInstrumentation, moduleName: string, - grpc: typeof grpcNapi | typeof grpcJs, grpcPort: number ) => { - const MAX_ERROR_STATUS = grpc.status.UNAUTHENTICATED; - const grpcClient = { unaryMethodWithMetadata: ( client: TestGrpcClient, @@ -146,7 +276,7 @@ export const runTests = ( unaryMethod: ( client: TestGrpcClient, request: TestRequestResponse, - metadata: Metadata = new grpc.Metadata() + metadata = new Metadata() ): Promise => { return new Promise((resolve, reject) => { return client.unaryMethod( @@ -166,7 +296,7 @@ export const runTests = ( UnaryMethod: ( client: TestGrpcClient, request: TestRequestResponse, - metadata: Metadata = new grpc.Metadata() + metadata = new Metadata() ): Promise => { return new Promise((resolve, reject) => { return client.UnaryMethod( @@ -186,7 +316,7 @@ export const runTests = ( camelCaseMethod: ( client: TestGrpcClient, request: TestRequestResponse, - metadata: Metadata = new grpc.Metadata() + metadata = new Metadata() ): Promise => { return new Promise((resolve, reject) => { return client.camelCaseMethod( @@ -206,7 +336,7 @@ export const runTests = ( clientStreamMethod: ( client: TestGrpcClient, request: TestRequestResponse[], - metadata: Metadata = new grpc.Metadata() + metadata = new Metadata() ): Promise => { return new Promise((resolve, reject) => { const writeStream = client.clientStreamMethod( @@ -230,7 +360,7 @@ export const runTests = ( serverStreamMethod: ( client: TestGrpcClient, request: TestRequestResponse, - metadata: Metadata = new grpc.Metadata() + metadata = new Metadata() ): Promise => { return new Promise((resolve, reject) => { const result: TestRequestResponse[] = []; @@ -251,7 +381,7 @@ export const runTests = ( bidiStreamMethod: ( client: TestGrpcClient, request: TestRequestResponse[], - metadata: Metadata = new grpc.Metadata() + metadata = new Metadata() ): Promise => { return new Promise((resolve, reject) => { const result: TestRequestResponse[] = []; @@ -281,151 +411,10 @@ export const runTests = ( let server: Server; let client: Client; - const replicate = (request: TestRequestResponse) => { - const result: TestRequestResponse[] = []; - for (let i = 0; i < request.num; i++) { - result.push(request); - } - return result; - }; - - async function startServer( - grpc: typeof grpcJs | typeof grpcNapi, - proto: any - ) { - const server = new grpc.Server(); - - function getError(msg: string, code: number): ServiceError | null { - const err: ServiceError = { - ...new Error(msg), - name: msg, - message: msg, - code, - details: msg, - }; - return err; - } - - server.addService(proto.GrpcTester.service, { - // An error is emitted every time - // request.num <= MAX_ERROR_STATUS = (status.UNAUTHENTICATED) - // in those cases, erro.code = request.num - - // This method returns the request - unaryMethodWithMetadata( - call: ServerUnaryCall, - callback: RequestCallback - ) { - const serverMetadata: any = new grpc.Metadata(); - serverMetadata.add('server_metadata_key', 'server_metadata_value'); - - call.sendMetadata(serverMetadata); - - call.request.num <= MAX_ERROR_STATUS - ? callback( - getError( - 'Unary Method with Metadata Error', - call.request.num - ) as grpcJs.ServiceError - ) - : callback(null, { num: call.request.num }); - }, - - // This method returns the request - unaryMethod(call: ServerUnaryCall, callback: RequestCallback) { - call.request.num <= MAX_ERROR_STATUS - ? callback( - getError( - 'Unary Method Error', - call.request.num - ) as grpcJs.ServiceError - ) - : callback(null, { num: call.request.num }); - }, - - // This method returns the request - camelCaseMethod(call: ServerUnaryCall, callback: RequestCallback) { - call.request.num <= MAX_ERROR_STATUS - ? callback( - getError( - 'Unary Method Error', - call.request.num - ) as grpcJs.ServiceError - ) - : callback(null, { num: call.request.num }); - }, - - // This method sums the requests - clientStreamMethod( - call: ServerReadableStream, - callback: RequestCallback - ) { - let sum = 0; - let hasError = false; - let code = grpc.status.OK; - call.on('data', (data: TestRequestResponse) => { - sum += data.num; - if (data.num <= MAX_ERROR_STATUS) { - hasError = true; - code = data.num; - } - }); - call.on('end', () => { - hasError - ? callback(getError('Client Stream Method Error', code) as any) - : callback(null, { num: sum }); - }); - }, - - // This method returns an array that replicates the request, request.num of - // times - serverStreamMethod: (call: ServerWriteableStream) => { - const result = replicate(call.request); - - if (call.request.num <= MAX_ERROR_STATUS) { - call.emit( - 'error', - getError('Server Stream Method Error', call.request.num) - ); - } else { - result.forEach(element => { - call.write(element); - }); - } - call.end(); - }, - - // This method returns the request - bidiStreamMethod: (call: ServerDuplexStream) => { - call.on('data', (data: TestRequestResponse) => { - if (data.num <= MAX_ERROR_STATUS) { - call.emit( - 'error', - getError('Server Stream Method Error', data.num) - ); - } else { - call.write(data); - } - }); - call.on('end', () => { - call.end(); - }); - }, - }); - const bindAwait = promisify(server.bindAsync); - await bindAwait.call( - server, - 'localhost:' + grpcPort, - grpc.ServerCredentials.createInsecure() as grpcJs.ServerCredentials - ); - server.start(); - return server; - } - - function createClient(grpc: typeof grpcJs | typeof grpcNapi, proto: any) { + function createClient(proto: any) { return new proto.GrpcTester( 'localhost:' + grpcPort, - grpc.credentials.createInsecure() + credentials.createInsecure() ); } @@ -514,7 +503,7 @@ export const runTests = ( ) => { const validations = { name: `grpc.pkg_test.GrpcTester/${methodName}`, - status: grpc.status.OK, + status: GrpcStatus.OK, netPeerName: 'localhost', netPeerPort: grpcPort, }; @@ -544,7 +533,7 @@ export const runTests = ( }; const ClientServerValidationTest = ( - method: typeof methodList[0], + method: (typeof methodList)[0], provider: NodeTracerProvider, checkSpans = true, attributesValidation?: { @@ -588,7 +577,7 @@ export const runTests = ( }; const ErrorValidationTest = ( - method: typeof methodList[0], + method: (typeof methodList)[0], provider: NodeTracerProvider, checkSpans = true, attributesValidation?: { @@ -605,9 +594,7 @@ export const runTests = ( .startSpan('TestSpan', { kind: SpanKind.PRODUCER }); return context.with(trace.setSpan(context.active(), span), async () => { const rootSpan = trace.getSpan(context.active()); - if (!rootSpan) { - return assert.ok(false); - } + assert.ok(rootSpan != null); assert.deepStrictEqual(rootSpan, span); const args = [client, method.request, method.metadata]; @@ -646,7 +633,7 @@ export const runTests = ( }; const runTestWithAttributeValidation = ( - method: typeof methodList[0], + method: (typeof methodList)[0], provider: NodeTracerProvider, checkSpans = true, attributesValidation: { @@ -664,7 +651,7 @@ export const runTests = ( }; const runTest = ( - method: typeof methodList[0], + method: (typeof methodList)[0], provider: NodeTracerProvider, checkSpans = true ) => { @@ -678,7 +665,7 @@ export const runTests = ( request instanceof Array ? [{ num: code }, ...request] : { num: code }; const runErrorTest = ( - method: typeof methodList[0], + method: (typeof methodList)[0], key: string, errorCode: number, provider: NodeTracerProvider @@ -721,9 +708,7 @@ export const runTests = ( .startSpan('TestSpan', { kind: SpanKind.PRODUCER }); return context.with(trace.setSpan(context.active(), span), async () => { const rootSpan = trace.getSpan(context.active()); - if (!rootSpan) { - return assert.ok(false); - } + assert.ok(rootSpan != null); assert.deepStrictEqual(rootSpan, span); const args = [client, insertError(method.request)(errorCode)]; @@ -761,7 +746,7 @@ export const runTests = ( }); }; - const runClientMethodTest = (method: typeof methodList[0]) => { + const runClientMethodTest = (method: (typeof methodList)[0]) => { it(`should assign original properties for grpc remote method ${method.methodName}`, async () => { const patchedClientMethod = (client as any)[method.methodName]; const properties = Object.keys(patchedClientMethod); @@ -781,10 +766,10 @@ export const runTests = ( plugin.enable(); const packageDefinition = await protoLoader.load(PROTO_PATH, options); - const proto = grpc.loadPackageDefinition(packageDefinition).pkg_test; + const proto = loadPackageDefinition(packageDefinition).pkg_test; - server = await startServer(grpc, proto); - client = createClient(grpc, proto); + server = await startServer(proto, grpcPort); + client = createClient(proto); }); after(done => { @@ -803,9 +788,9 @@ export const runTests = ( methodList.forEach(method => { describe(`Test error raising for grpc remote ${method.description}`, () => { - Object.keys(grpc.status).forEach((statusKey: string) => { - const errorCode = Number(grpc.status[statusKey as any]); - if (errorCode > grpc.status.OK) { + Object.keys(GrpcStatus).forEach((statusKey: string) => { + const errorCode = Number(GrpcStatus[statusKey as any]); + if (errorCode > GrpcStatus.OK) { runErrorTest(method, statusKey, errorCode, provider); } }); @@ -824,10 +809,10 @@ export const runTests = ( plugin.disable(); const packageDefinition = await protoLoader.load(PROTO_PATH, options); - const proto = grpc.loadPackageDefinition(packageDefinition).pkg_test; + const proto = loadPackageDefinition(packageDefinition).pkg_test; - server = await startServer(grpc, proto); - client = createClient(grpc, proto); + server = await startServer(proto, grpcPort); + client = createClient(proto); }); after(done => { @@ -858,10 +843,10 @@ export const runTests = ( plugin.enable(); const packageDefinition = await protoLoader.load(PROTO_PATH, options); - const proto = grpc.loadPackageDefinition(packageDefinition).pkg_test; + const proto = loadPackageDefinition(packageDefinition).pkg_test; - server = await startServer(grpc, proto); - client = createClient(grpc, proto); + server = await startServer(proto, grpcPort); + client = createClient(proto); }); after(done => { @@ -902,10 +887,10 @@ export const runTests = ( plugin.enable(); const packageDefinition = await protoLoader.load(PROTO_PATH, options); - const proto = grpc.loadPackageDefinition(packageDefinition).pkg_test; + const proto = loadPackageDefinition(packageDefinition).pkg_test; - server = await startServer(grpc, proto); - client = createClient(grpc, proto); + server = await startServer(proto, grpcPort); + client = createClient(proto); }); after(done => { @@ -932,9 +917,9 @@ export const runTests = ( plugin.enable(); const packageDefinition = await protoLoader.load(PROTO_PATH, options); - const proto = grpc.loadPackageDefinition(packageDefinition).pkg_test; + const proto = loadPackageDefinition(packageDefinition).pkg_test; - client = createClient(grpc, proto); + client = createClient(proto); }); after(done => { @@ -954,7 +939,7 @@ export const runTests = ( const provider = new NodeTracerProvider(); provider.addSpanProcessor(new SimpleSpanProcessor(memoryExporter)); - const clientMetadata: Metadata = new grpc.Metadata(); + const clientMetadata = new Metadata(); clientMetadata.add('client_metadata_key', 'client_metadata_value'); const customMetadataMethod: TestGrpcCall = { @@ -989,10 +974,10 @@ export const runTests = ( plugin.enable(); const packageDefinition = await protoLoader.load(PROTO_PATH, options); - const proto = grpc.loadPackageDefinition(packageDefinition).pkg_test; + const proto = loadPackageDefinition(packageDefinition).pkg_test; - server = await startServer(grpc, proto); - client = createClient(grpc, proto); + server = await startServer(proto, grpcPort); + client = createClient(proto); }); after(done => { diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/test/protobuf-ts-utils.ts b/experimental/packages/opentelemetry-instrumentation-grpc/test/protobuf-ts-utils.ts new file mode 100644 index 0000000000..2fc2a3d1be --- /dev/null +++ b/experimental/packages/opentelemetry-instrumentation-grpc/test/protobuf-ts-utils.ts @@ -0,0 +1,111 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Span, SpanKind } from '@opentelemetry/api'; +import * as assert from 'assert'; + +import { + InMemorySpanExporter, + ReadableSpan, +} from '@opentelemetry/sdk-trace-base'; +import { assertPropagation, assertSpan } from './utils/assertionUtils'; +import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; + +export type SpanAssertionFunction = ( + exporter: InMemorySpanExporter, + rpcService: string, + rpcMethod: string, + expectedSpanStatus: number, + rootSpan?: Span +) => void; + +export type TestFunction = ( + input: number, + errorKey: string, + expectedResultCode: number, + assertSpans: SpanAssertionFunction +) => void; + +function validateSpans( + clientSpan: ReadableSpan, + serverSpan: ReadableSpan, + rpcService: string, + rpcMethod: string, + status: number +) { + const validations = { + name: `grpc.${rpcService}/${rpcMethod}`, + netPeerName: 'localhost', + status: status, + netPeerPort: 3333, + }; + + assert.strictEqual( + clientSpan.spanContext().traceId, + serverSpan.spanContext().traceId + ); + assertPropagation(serverSpan, clientSpan); + + assertSpan('grpc', serverSpan, SpanKind.SERVER, validations); + assertSpan('grpc', clientSpan, SpanKind.CLIENT, validations); + assert.strictEqual( + clientSpan.attributes[SemanticAttributes.RPC_METHOD], + rpcMethod + ); + assert.strictEqual( + clientSpan.attributes[SemanticAttributes.RPC_SERVICE], + rpcService + ); +} + +export function assertNoSpansExported( + exporter: InMemorySpanExporter, + _rpcService: string, + _rpcMethod: string, + _expectedSpanStatus: number, + _rootSpan?: Span +) { + const spans = exporter.getFinishedSpans(); + assert.strictEqual(spans.length, 0); +} + +export function assertExportedSpans( + exporter: InMemorySpanExporter, + rpcService: string, + rpcMethod: string, + expectedSpanStatus: number, + rootSpan?: Span +) { + const spans = exporter.getFinishedSpans(); + assert.strictEqual(spans.length, 2); + const serverSpan = spans[0]; + const clientSpan = spans[1]; + + validateSpans( + clientSpan, + serverSpan, + rpcService, + rpcMethod, + expectedSpanStatus + ); + + if (rootSpan) { + assert.strictEqual( + rootSpan?.spanContext().traceId, + serverSpan.spanContext().traceId + ); + assert.strictEqual(rootSpan?.spanContext().spanId, clientSpan.parentSpanId); + } +} diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/test/utils/assertionUtils.ts b/experimental/packages/opentelemetry-instrumentation-grpc/test/utils/assertionUtils.ts index 24d4bf7af8..1b7966639e 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/test/utils/assertionUtils.ts +++ b/experimental/packages/opentelemetry-instrumentation-grpc/test/utils/assertionUtils.ts @@ -16,8 +16,7 @@ import { SpanKind, SpanStatusCode } from '@opentelemetry/api'; import * as assert from 'assert'; -import type * as grpc from 'grpc'; -import type * as grpcJs from '@grpc/grpc-js'; +import type { status as GrpcStatus } from '@grpc/grpc-js'; import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; import { hrTimeToMilliseconds, @@ -26,7 +25,7 @@ import { import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; export const grpcStatusCodeToOpenTelemetryStatusCode = ( - status: grpc.status | grpcJs.status + status: GrpcStatus ): SpanStatusCode => { if (status !== undefined && status === 0) { return SpanStatusCode.UNSET; @@ -40,7 +39,7 @@ export const assertSpan = ( kind: SpanKind, validations: { name: string; - status: grpc.status | grpcJs.status; + status: GrpcStatus; netPeerName?: string; netPeerPort?: number; } diff --git a/experimental/packages/opentelemetry-instrumentation-http/.eslintrc.js b/experimental/packages/opentelemetry-instrumentation-http/.eslintrc.js index f756f4488b..9baf1b4956 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/.eslintrc.js +++ b/experimental/packages/opentelemetry-instrumentation-http/.eslintrc.js @@ -3,5 +3,5 @@ module.exports = { "mocha": true, "node": true }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/opentelemetry-instrumentation-http/package.json b/experimental/packages/opentelemetry-instrumentation-http/package.json index b46eef6a18..1c1d524e8b 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/package.json +++ b/experimental/packages/opentelemetry-instrumentation-http/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-http", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenTelemetry http/https automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -16,7 +16,7 @@ "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "node ../../../scripts/version-update.js", "peer-api-check": "node ../../../scripts/peer-api-check.js" }, @@ -45,26 +45,28 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "1.4.1", - "@opentelemetry/context-async-hooks": "1.13.0", - "@opentelemetry/sdk-metrics": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "@opentelemetry/sdk-trace-node": "1.13.0", - "@types/mocha": "10.0.0", + "@opentelemetry/api": "1.6.0", + "@opentelemetry/context-async-hooks": "1.17.1", + "@opentelemetry/sdk-metrics": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@opentelemetry/sdk-trace-node": "1.17.1", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/request-promise-native": "1.0.18", - "@types/semver": "7.3.9", - "@types/sinon": "10.0.13", - "@types/superagent": "4.1.13", - "axios": "1.4.0", + "@types/request-promise-native": "1.0.19", + "@types/semver": "7.5.3", + "@types/sinon": "10.0.18", + "@types/superagent": "4.1.19", + "axios": "1.5.1", "codecov": "3.8.3", - "mocha": "10.0.0", - "nock": "13.0.11", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", + "nock": "13.3.3", "nyc": "15.1.0", "request": "2.88.2", "request-promise-native": "1.0.9", - "sinon": "15.0.0", - "superagent": "8.0.0", + "sinon": "15.1.2", + "superagent": "8.0.9", "ts-mocha": "10.0.0", "typescript": "4.4.4" }, @@ -72,10 +74,10 @@ "@opentelemetry/api": "^1.3.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/instrumentation": "0.39.1", - "@opentelemetry/semantic-conventions": "1.13.0", - "semver": "^7.3.5" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/instrumentation": "0.44.0", + "@opentelemetry/semantic-conventions": "1.17.1", + "semver": "^7.5.2" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-http", "sideEffects": false diff --git a/experimental/packages/opentelemetry-instrumentation-http/src/http.ts b/experimental/packages/opentelemetry-instrumentation-http/src/http.ts index 15ca92a45e..9422bbc9ef 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/src/http.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/src/http.ts @@ -105,7 +105,7 @@ export class HttpInstrumentation extends InstrumentationBase { init(): [ InstrumentationNodeModuleDefinition, - InstrumentationNodeModuleDefinition + InstrumentationNodeModuleDefinition, ] { return [this._getHttpsInstrumentation(), this._getHttpInstrumentation()]; } @@ -237,7 +237,7 @@ export class HttpInstrumentation extends InstrumentationBase { // https://nodejs.org/dist/latest/docs/api/http.html#http_http_get_options_callback // https://github.com/googleapis/cloud-trace-nodejs/blob/master/src/instrumentations/instrumentation-http.ts#L198 return function outgoingGetRequest< - T extends http.RequestOptions | string | url.URL + T extends http.RequestOptions | string | url.URL, >(options: T, ...args: HttpRequestArgs): http.ClientRequest { const req = clientRequest(options, ...args); req.end(); diff --git a/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts b/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts index a563e29471..a70dd3de85 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts @@ -403,11 +403,12 @@ export const getOutgoingRequestAttributesOnResponse = ( response: IncomingMessage ): SpanAttributes => { const { statusCode, statusMessage, httpVersion, socket } = response; - const { remoteAddress, remotePort } = socket; - const attributes: SpanAttributes = { - [SemanticAttributes.NET_PEER_IP]: remoteAddress, - [SemanticAttributes.NET_PEER_PORT]: remotePort, - }; + const attributes: SpanAttributes = {}; + if (socket) { + const { remoteAddress, remotePort } = socket; + attributes[SemanticAttributes.NET_PEER_IP] = remoteAddress; + attributes[SemanticAttributes.NET_PEER_PORT] = remotePort; + } setResponseContentLengthAttribute(response, attributes); if (statusCode) { @@ -529,17 +530,20 @@ export const getIncomingRequestAttributesOnResponse = ( // 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 rpcMetadata = getRPCMetadata(context.active()); - const attributes: SpanAttributes = { - [SemanticAttributes.NET_HOST_IP]: localAddress, - [SemanticAttributes.NET_HOST_PORT]: localPort, - [SemanticAttributes.NET_PEER_IP]: remoteAddress, - [SemanticAttributes.NET_PEER_PORT]: remotePort, - [SemanticAttributes.HTTP_STATUS_CODE]: statusCode, - [AttributeNames.HTTP_STATUS_TEXT]: (statusMessage || '').toUpperCase(), - }; + const rpcMetadata = getRPCMetadata(context.active()); + const attributes: SpanAttributes = {}; + if (socket) { + const { localAddress, localPort, remoteAddress, remotePort } = socket; + attributes[SemanticAttributes.NET_HOST_IP] = localAddress; + attributes[SemanticAttributes.NET_HOST_PORT] = localPort; + attributes[SemanticAttributes.NET_PEER_IP] = remoteAddress; + attributes[SemanticAttributes.NET_PEER_PORT] = remotePort; + } + attributes[SemanticAttributes.HTTP_STATUS_CODE] = statusCode; + attributes[AttributeNames.HTTP_STATUS_TEXT] = ( + statusMessage || '' + ).toUpperCase(); if (rpcMetadata?.type === RPCType.HTTP && rpcMetadata.route !== undefined) { attributes[SemanticAttributes.HTTP_ROUTE] = rpcMetadata.route; diff --git a/experimental/packages/opentelemetry-instrumentation-xml-http-request/.eslintrc.js b/experimental/packages/opentelemetry-instrumentation-xml-http-request/.eslintrc.js index b50dfd815b..7364a382d0 100644 --- a/experimental/packages/opentelemetry-instrumentation-xml-http-request/.eslintrc.js +++ b/experimental/packages/opentelemetry-instrumentation-xml-http-request/.eslintrc.js @@ -3,5 +3,5 @@ module.exports = { "mocha": true, "browser": true, }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json b/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json index 4bf5707caf..0e4a8583ed 100644 --- a/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json +++ b/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-xml-http-request", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenTelemetry XMLHttpRequest automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -16,9 +16,9 @@ "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "version": "node ../../../scripts/version-update.js", "tdd": "karma start", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "node ../../../scripts/version-update.js", "peer-api-check": "node ../../../scripts/peer-api-check.js" }, @@ -54,42 +54,44 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", - "@opentelemetry/api": "1.4.1", - "@opentelemetry/context-zone": "1.13.0", - "@opentelemetry/propagator-b3": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@opentelemetry/api": "1.6.0", + "@opentelemetry/context-zone": "1.17.1", + "@opentelemetry/propagator-b3": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "@types/webpack-env": "1.16.3", - "babel-loader": "8.2.3", + "babel-loader": "8.3.0", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", "webpack": "4.46.0", - "webpack-cli": "4.9.1", - "webpack-merge": "5.8.0" + "webpack-cli": "4.10.0", + "webpack-merge": "5.9.0" }, "peerDependencies": { "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/instrumentation": "0.39.1", - "@opentelemetry/sdk-trace-web": "1.13.0", - "@opentelemetry/semantic-conventions": "1.13.0" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/instrumentation": "0.44.0", + "@opentelemetry/sdk-trace-web": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-xml-http-request", "sideEffects": false diff --git a/experimental/packages/opentelemetry-instrumentation-xml-http-request/test/xhr.test.ts b/experimental/packages/opentelemetry-instrumentation-xml-http-request/test/xhr.test.ts index b304bb9c03..c3614a42e8 100644 --- a/experimental/packages/opentelemetry-instrumentation-xml-http-request/test/xhr.test.ts +++ b/experimental/packages/opentelemetry-instrumentation-xml-http-request/test/xhr.test.ts @@ -162,6 +162,19 @@ function createFakePerformanceObs(url: string) { return FakePerfObs; } +function testForCorrectEvents( + events: tracing.TimedEvent[], + eventNames: string[] +) { + for (let i = 0; i < events.length; i++) { + assert.strictEqual( + events[i].name, + eventNames[i], + `event ${eventNames[i]} is not defined` + ); + } +} + describe('xhr', () => { const asyncTests = [{ async: true }, { async: false }]; asyncTests.forEach(test => { @@ -200,6 +213,7 @@ describe('xhr', () => { let rootSpan: api.Span; let spyEntries: any; const url = 'http://localhost:8090/xml-http-request.js'; + const secureUrl = 'https://localhost:8090/xml-http-request.js'; let fakeNow = 0; let xmlHttpRequestInstrumentation: XMLHttpRequestInstrumentation; @@ -383,69 +397,20 @@ describe('xhr', () => { it('span should have correct events', () => { const span: tracing.ReadableSpan = exportSpy.args[1][0][0]; const events = span.events; - - assert.strictEqual( - events[0].name, + testForCorrectEvents(events, [ EventNames.METHOD_OPEN, - `event ${EventNames.METHOD_OPEN} is not defined` - ); - assert.strictEqual( - events[1].name, EventNames.METHOD_SEND, - `event ${EventNames.METHOD_SEND} is not defined` - ); - assert.strictEqual( - events[2].name, PTN.FETCH_START, - `event ${PTN.FETCH_START} is not defined` - ); - assert.strictEqual( - events[3].name, PTN.DOMAIN_LOOKUP_START, - `event ${PTN.DOMAIN_LOOKUP_START} is not defined` - ); - assert.strictEqual( - events[4].name, PTN.DOMAIN_LOOKUP_END, - `event ${PTN.DOMAIN_LOOKUP_END} is not defined` - ); - assert.strictEqual( - events[5].name, PTN.CONNECT_START, - `event ${PTN.CONNECT_START} is not defined` - ); - assert.strictEqual( - events[6].name, - PTN.SECURE_CONNECTION_START, - `event ${PTN.SECURE_CONNECTION_START} is not defined` - ); - assert.strictEqual( - events[7].name, PTN.CONNECT_END, - `event ${PTN.CONNECT_END} is not defined` - ); - assert.strictEqual( - events[8].name, PTN.REQUEST_START, - `event ${PTN.REQUEST_START} is not defined` - ); - assert.strictEqual( - events[9].name, PTN.RESPONSE_START, - `event ${PTN.RESPONSE_START} is not defined` - ); - assert.strictEqual( - events[10].name, PTN.RESPONSE_END, - `event ${PTN.RESPONSE_END} is not defined` - ); - assert.strictEqual( - events[11].name, EventNames.EVENT_LOAD, - `event ${EventNames.EVENT_LOAD} is not defined` - ); - - assert.strictEqual(events.length, 12, 'number of events is wrong'); + ]); + assert.strictEqual(events.length, 11, 'number of events is wrong'); }); it('should create a span for preflight request', () => { @@ -479,53 +444,17 @@ describe('xhr', () => { it('preflight request span should have correct events', () => { const span: tracing.ReadableSpan = exportSpy.args[0][0][0]; const events = span.events; - assert.strictEqual(events.length, 9, 'number of events is wrong'); - - assert.strictEqual( - events[0].name, + assert.strictEqual(events.length, 8, 'number of events is wrong'); + testForCorrectEvents(events, [ PTN.FETCH_START, - `event ${PTN.FETCH_START} is not defined` - ); - assert.strictEqual( - events[1].name, PTN.DOMAIN_LOOKUP_START, - `event ${PTN.DOMAIN_LOOKUP_START} is not defined` - ); - assert.strictEqual( - events[2].name, PTN.DOMAIN_LOOKUP_END, - `event ${PTN.DOMAIN_LOOKUP_END} is not defined` - ); - assert.strictEqual( - events[3].name, PTN.CONNECT_START, - `event ${PTN.CONNECT_START} is not defined` - ); - assert.strictEqual( - events[4].name, - PTN.SECURE_CONNECTION_START, - `event ${PTN.SECURE_CONNECTION_START} is not defined` - ); - assert.strictEqual( - events[5].name, PTN.CONNECT_END, - `event ${PTN.CONNECT_END} is not defined` - ); - assert.strictEqual( - events[6].name, PTN.REQUEST_START, - `event ${PTN.REQUEST_START} is not defined` - ); - assert.strictEqual( - events[7].name, PTN.RESPONSE_START, - `event ${PTN.RESPONSE_START} is not defined` - ); - assert.strictEqual( - events[8].name, PTN.RESPONSE_END, - `event ${PTN.RESPONSE_END} is not defined` - ); + ]); }); it('should NOT clear the resources', () => { @@ -534,6 +463,53 @@ describe('xhr', () => { 'resources have been cleared' ); }); + describe('When making https requests', () => { + beforeEach(done => { + clearData(); + // this won't generate a preflight span + const propagateTraceHeaderCorsUrls = [secureUrl]; + prepareData(done, secureUrl, { + propagateTraceHeaderCorsUrls, + }); + }); + + it('span should have correct events', () => { + const span: tracing.ReadableSpan = exportSpy.args[1][0][0]; + const events = span.events; + testForCorrectEvents(events, [ + EventNames.METHOD_OPEN, + EventNames.METHOD_SEND, + PTN.FETCH_START, + PTN.DOMAIN_LOOKUP_START, + PTN.DOMAIN_LOOKUP_END, + PTN.CONNECT_START, + PTN.SECURE_CONNECTION_START, + PTN.CONNECT_END, + PTN.REQUEST_START, + PTN.RESPONSE_START, + PTN.RESPONSE_END, + EventNames.EVENT_LOAD, + ]); + assert.strictEqual(events.length, 12, 'number of events is wrong'); + }); + + it('preflight request span should have correct events', () => { + const span: tracing.ReadableSpan = exportSpy.args[0][0][0]; + const events = span.events; + assert.strictEqual(events.length, 9, 'number of events is wrong'); + testForCorrectEvents(events, [ + PTN.FETCH_START, + PTN.DOMAIN_LOOKUP_START, + PTN.DOMAIN_LOOKUP_END, + PTN.CONNECT_START, + PTN.SECURE_CONNECTION_START, + PTN.CONNECT_END, + PTN.REQUEST_START, + PTN.RESPONSE_START, + PTN.RESPONSE_END, + ]); + }); + }); describe('AND origin match with window.location', () => { beforeEach(done => { @@ -786,11 +762,11 @@ describe('xhr', () => { assert.strictEqual( events.length, - 12, + 11, `number of events is wrong: ${events.length}` ); assert.strictEqual( - events[8].name, + events[7].name, PTN.REQUEST_START, `event ${PTN.REQUEST_START} is not defined` ); @@ -1008,67 +984,20 @@ describe('xhr', () => { const span: tracing.ReadableSpan = exportSpy.args[0][0][0]; const events = span.events; - assert.strictEqual( - events[0].name, + testForCorrectEvents(events, [ EventNames.METHOD_OPEN, - `event ${EventNames.METHOD_OPEN} is not defined` - ); - assert.strictEqual( - events[1].name, EventNames.METHOD_SEND, - `event ${EventNames.METHOD_SEND} is not defined` - ); - assert.strictEqual( - events[2].name, PTN.FETCH_START, - `event ${PTN.FETCH_START} is not defined` - ); - assert.strictEqual( - events[3].name, PTN.DOMAIN_LOOKUP_START, - `event ${PTN.DOMAIN_LOOKUP_START} is not defined` - ); - assert.strictEqual( - events[4].name, PTN.DOMAIN_LOOKUP_END, - `event ${PTN.DOMAIN_LOOKUP_END} is not defined` - ); - assert.strictEqual( - events[5].name, PTN.CONNECT_START, - `event ${PTN.CONNECT_START} is not defined` - ); - assert.strictEqual( - events[6].name, PTN.SECURE_CONNECTION_START, - `event ${PTN.SECURE_CONNECTION_START} is not defined` - ); - assert.strictEqual( - events[7].name, PTN.CONNECT_END, - `event ${PTN.CONNECT_END} is not defined` - ); - assert.strictEqual( - events[8].name, PTN.REQUEST_START, - `event ${PTN.REQUEST_START} is not defined` - ); - assert.strictEqual( - events[9].name, PTN.RESPONSE_START, - `event ${PTN.RESPONSE_START} is not defined` - ); - assert.strictEqual( - events[10].name, PTN.RESPONSE_END, - `event ${PTN.RESPONSE_END} is not defined` - ); - assert.strictEqual( - events[11].name, EventNames.EVENT_ERROR, - `event ${EventNames.EVENT_ERROR} is not defined` - ); - + ]); assert.strictEqual(events.length, 12, 'number of events is wrong'); }); }); @@ -1123,23 +1052,11 @@ describe('xhr', () => { it('span should have correct events', () => { const span: tracing.ReadableSpan = exportSpy.args[0][0][0]; const events = span.events; - - assert.strictEqual( - events[0].name, + testForCorrectEvents(events, [ EventNames.METHOD_OPEN, - `event ${EventNames.METHOD_OPEN} is not defined` - ); - assert.strictEqual( - events[1].name, EventNames.METHOD_SEND, - `event ${EventNames.METHOD_SEND} is not defined` - ); - assert.strictEqual( - events[2].name, EventNames.EVENT_ERROR, - `event ${EventNames.EVENT_ERROR} is not defined` - ); - + ]); assert.strictEqual(events.length, 3, 'number of events is wrong'); }); }); @@ -1201,23 +1118,11 @@ describe('xhr', () => { it('span should have correct events', () => { const span: tracing.ReadableSpan = exportSpy.args[0][0][0]; const events = span.events; - - assert.strictEqual( - events[0].name, + testForCorrectEvents(events, [ EventNames.METHOD_OPEN, - `event ${EventNames.METHOD_OPEN} is not defined` - ); - assert.strictEqual( - events[1].name, EventNames.METHOD_SEND, - `event ${EventNames.METHOD_SEND} is not defined` - ); - assert.strictEqual( - events[2].name, EventNames.EVENT_ABORT, - `event ${EventNames.EVENT_ABORT} is not defined` - ); - + ]); assert.strictEqual(events.length, 3, 'number of events is wrong'); }); }); @@ -1280,22 +1185,11 @@ describe('xhr', () => { const span: tracing.ReadableSpan = exportSpy.args[0][0][0]; const events = span.events; - assert.strictEqual( - events[0].name, + testForCorrectEvents(events, [ EventNames.METHOD_OPEN, - `event ${EventNames.METHOD_OPEN} is not defined` - ); - assert.strictEqual( - events[1].name, EventNames.METHOD_SEND, - `event ${EventNames.METHOD_SEND} is not defined` - ); - assert.strictEqual( - events[2].name, EventNames.EVENT_TIMEOUT, - `event ${EventNames.EVENT_TIMEOUT} is not defined` - ); - + ]); assert.strictEqual(events.length, 3, 'number of events is wrong'); }); }); diff --git a/experimental/packages/opentelemetry-instrumentation/.eslintrc.js b/experimental/packages/opentelemetry-instrumentation/.eslintrc.js index e41d9a9299..c054089042 100644 --- a/experimental/packages/opentelemetry-instrumentation/.eslintrc.js +++ b/experimental/packages/opentelemetry-instrumentation/.eslintrc.js @@ -5,5 +5,5 @@ module.exports = { "node": true, "browser": true }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/opentelemetry-instrumentation/package.json b/experimental/packages/opentelemetry-instrumentation/package.json index 4164952821..5cf7554397 100644 --- a/experimental/packages/opentelemetry-instrumentation/package.json +++ b/experimental/packages/opentelemetry-instrumentation/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation", - "version": "0.39.1", + "version": "0.44.0", "description": "Base class for node which OpenTelemetry instrumentation modules extend", "author": "OpenTelemetry Authors", "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation", @@ -51,10 +51,10 @@ "test:cjs": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", "test:esm": "nyc node --experimental-loader=./hook.mjs ../../../node_modules/mocha/bin/mocha 'test/node/*.test.mjs' test/node/*.test.mjs", "test": "npm run test:cjs && npm run test:esm", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "node ../../../scripts/version-update.js", "peer-api-check": "node ../../../scripts/peer-api-check.js" }, @@ -72,42 +72,44 @@ }, "dependencies": { "@types/shimmer": "^1.0.2", - "import-in-the-middle": "1.3.5", - "require-in-the-middle": "^7.1.0", - "semver": "^7.3.2", + "import-in-the-middle": "1.4.2", + "require-in-the-middle": "^7.1.1", + "semver": "^7.5.2", "shimmer": "^1.2.1" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" }, "devDependencies": { - "@babel/core": "7.16.0", - "@opentelemetry/api": "1.4.1", - "@opentelemetry/sdk-metrics": "1.13.0", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@opentelemetry/api": "1.6.0", + "@opentelemetry/sdk-metrics": "1.17.1", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/semver": "7.3.9", - "@types/sinon": "10.0.13", + "@types/semver": "7.5.3", + "@types/sinon": "10.0.18", "@types/webpack-env": "1.16.3", - "babel-loader": "8.2.3", + "babel-loader": "8.3.0", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", "cpx": "1.5.0", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", "webpack": "4.46.0", - "webpack-cli": "4.9.1", - "webpack-merge": "5.8.0" + "webpack-cli": "4.10.0", + "webpack-merge": "5.9.0" }, "engines": { "node": ">=14" diff --git a/experimental/packages/opentelemetry-instrumentation/src/types_internal.ts b/experimental/packages/opentelemetry-instrumentation/src/types_internal.ts index 016be0ad36..2cff387711 100644 --- a/experimental/packages/opentelemetry-instrumentation/src/types_internal.ts +++ b/experimental/packages/opentelemetry-instrumentation/src/types_internal.ts @@ -20,7 +20,7 @@ import { Instrumentation } from './types'; export type InstrumentationOption = | typeof InstrumentationBase - | typeof InstrumentationBase[] + | (typeof InstrumentationBase)[] | Instrumentation | Instrumentation[]; diff --git a/experimental/packages/opentelemetry-sdk-node/.eslintrc.js b/experimental/packages/opentelemetry-sdk-node/.eslintrc.js index f756f4488b..9baf1b4956 100644 --- a/experimental/packages/opentelemetry-sdk-node/.eslintrc.js +++ b/experimental/packages/opentelemetry-sdk-node/.eslintrc.js @@ -3,5 +3,5 @@ module.exports = { "mocha": true, "node": true }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/opentelemetry-sdk-node/README.md b/experimental/packages/opentelemetry-sdk-node/README.md index 2e09308958..b5086b8668 100644 --- a/experimental/packages/opentelemetry-sdk-node/README.md +++ b/experimental/packages/opentelemetry-sdk-node/README.md @@ -36,6 +36,7 @@ Before any other module in your application is loaded, you must initialize the S If you fail to initialize the SDK or initialize it too late, no-op implementations will be provided to any library which acquires a tracer or meter from the API. This example uses Jaeger and Prometheus, but exporters exist for [other tracing backends][other-tracing-backends]. +As shown in the installation instructions, exporters passed to the SDK must be installed alongside `@opentelemetry/sdk-node`. ```javascript const opentelemetry = require("@opentelemetry/sdk-node"); diff --git a/experimental/packages/opentelemetry-sdk-node/package.json b/experimental/packages/opentelemetry-sdk-node/package.json index b6dd740713..6a5261623a 100644 --- a/experimental/packages/opentelemetry-sdk-node/package.json +++ b/experimental/packages/opentelemetry-sdk-node/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-node", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenTelemetry SDK for Node.js", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -15,7 +15,7 @@ "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js" }, @@ -44,35 +44,39 @@ "access": "public" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/exporter-jaeger": "1.13.0", - "@opentelemetry/exporter-trace-otlp-grpc": "0.39.1", - "@opentelemetry/exporter-trace-otlp-http": "0.39.1", - "@opentelemetry/exporter-trace-otlp-proto": "0.39.1", - "@opentelemetry/exporter-zipkin": "1.13.0", - "@opentelemetry/instrumentation": "0.39.1", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/sdk-metrics": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "@opentelemetry/sdk-trace-node": "1.13.0", - "@opentelemetry/semantic-conventions": "1.13.0" + "@opentelemetry/api-logs": "0.44.0", + "@opentelemetry/core": "1.17.1", + "@opentelemetry/exporter-jaeger": "1.17.1", + "@opentelemetry/exporter-trace-otlp-grpc": "0.44.0", + "@opentelemetry/exporter-trace-otlp-http": "0.44.0", + "@opentelemetry/exporter-trace-otlp-proto": "0.44.0", + "@opentelemetry/exporter-zipkin": "1.17.1", + "@opentelemetry/instrumentation": "0.44.0", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-logs": "0.44.0", + "@opentelemetry/sdk-metrics": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@opentelemetry/sdk-trace-node": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1" }, "peerDependencies": { - "@opentelemetry/api": ">=1.3.0 <1.5.0" + "@opentelemetry/api": ">=1.3.0 <1.7.0" }, "devDependencies": { - "@opentelemetry/api": "1.4.1", - "@opentelemetry/context-async-hooks": "1.13.0", - "@types/mocha": "10.0.0", + "@opentelemetry/api": "1.6.0", + "@opentelemetry/context-async-hooks": "1.17.1", + "@opentelemetry/exporter-jaeger": "1.17.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/semver": "7.3.9", - "@types/sinon": "10.0.13", + "@types/semver": "7.5.3", + "@types/sinon": "10.0.18", "codecov": "3.8.3", - "istanbul-instrumenter-loader": "3.0.1", - "mocha": "10.0.0", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "semver": "7.3.5", - "sinon": "15.0.0", + "semver": "7.5.4", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4" diff --git a/experimental/packages/opentelemetry-sdk-node/src/index.ts b/experimental/packages/opentelemetry-sdk-node/src/index.ts index d246174208..891288ee6e 100644 --- a/experimental/packages/opentelemetry-sdk-node/src/index.ts +++ b/experimental/packages/opentelemetry-sdk-node/src/index.ts @@ -17,6 +17,7 @@ export * as api from '@opentelemetry/api'; export * as contextBase from '@opentelemetry/api'; export * as core from '@opentelemetry/core'; +export * as logs from '@opentelemetry/sdk-logs'; export * as metrics from '@opentelemetry/sdk-metrics'; export * as node from '@opentelemetry/sdk-trace-node'; export * as resources from '@opentelemetry/resources'; diff --git a/experimental/packages/opentelemetry-sdk-node/src/sdk.ts b/experimental/packages/opentelemetry-sdk-node/src/sdk.ts index 07921a88b9..30a1bea790 100644 --- a/experimental/packages/opentelemetry-sdk-node/src/sdk.ts +++ b/experimental/packages/opentelemetry-sdk-node/src/sdk.ts @@ -21,6 +21,7 @@ import { diag, DiagConsoleLogger, } from '@opentelemetry/api'; +import { logs } from '@opentelemetry/api-logs'; import { InstrumentationOption, registerInstrumentations, @@ -35,6 +36,7 @@ import { Resource, ResourceDetectionConfig, } from '@opentelemetry/resources'; +import { LogRecordProcessor, LoggerProvider } from '@opentelemetry/sdk-logs'; import { MeterProvider, MetricReader, View } from '@opentelemetry/sdk-metrics'; import { BatchSpanProcessor, @@ -63,6 +65,13 @@ export type MeterProviderConfig = { views?: View[]; }; +export type LoggerProviderConfig = { + /** + * Reference to the LoggerRecordProcessor instance by the NodeSDK + */ + logRecordProcessor: LogRecordProcessor; +}; + export class NodeSDK { private _tracerProviderConfig?: { tracerConfig: NodeTracerConfig; @@ -70,6 +79,7 @@ export class NodeSDK { contextManager?: ContextManager; textMapPropagator?: TextMapPropagator; }; + private _loggerProviderConfig?: LoggerProviderConfig; private _meterProviderConfig?: MeterProviderConfig; private _instrumentations: InstrumentationOption[]; @@ -79,6 +89,7 @@ export class NodeSDK { private _autoDetectResources: boolean; private _tracerProvider?: NodeTracerProvider | TracerProviderWithEnvExporters; + private _loggerProvider?: LoggerProvider; private _meterProvider?: MeterProvider; private _serviceName?: string; @@ -140,6 +151,13 @@ export class NodeSDK { ); } + if (configuration.logRecordProcessor) { + const loggerProviderConfig: LoggerProviderConfig = { + logRecordProcessor: configuration.logRecordProcessor, + }; + this.configureLoggerProvider(loggerProviderConfig); + } + if (configuration.metricReader || configuration.views) { const meterProviderConfig: MeterProviderConfig = {}; if (configuration.metricReader) { @@ -160,7 +178,14 @@ export class NodeSDK { this._instrumentations = instrumentations; } - /** Set configurations required to register a NodeTracerProvider */ + /** + * + * @deprecated Please pass {@code sampler}, {@code generalLimits}, {@code spanLimits}, {@code resource}, + * {@code IdGenerator}, {@code spanProcessor}, {@code contextManager} and {@code textMapPropagator}, + * to the constructor options instead. + * + * Set configurations needed to register a TracerProvider + */ public configureTracerProvider( tracerConfig: NodeTracerConfig, spanProcessor: SpanProcessor, @@ -175,7 +200,39 @@ export class NodeSDK { }; } - /** Set configurations needed to register a MeterProvider */ + /** + * @deprecated Please pass {@code logRecordProcessor} to the constructor options instead. + * + * Set configurations needed to register a LoggerProvider + */ + public configureLoggerProvider(config: LoggerProviderConfig): void { + // nothing is set yet, we can set config and then return + if (this._loggerProviderConfig == null) { + this._loggerProviderConfig = config; + return; + } + + // make sure we do not override existing logRecordProcessor with other logRecordProcessors. + if ( + this._loggerProviderConfig.logRecordProcessor != null && + config.logRecordProcessor != null + ) { + throw new Error( + 'LogRecordProcessor passed but LogRecordProcessor has already been configured.' + ); + } + + // set logRecordProcessor, but make sure we do not override existing logRecordProcessors with null/undefined. + if (config.logRecordProcessor != null) { + this._loggerProviderConfig.logRecordProcessor = config.logRecordProcessor; + } + } + + /** + * @deprecated Please pass {@code views} and {@code reader} to the constructor options instead. + * + * Set configurations needed to register a MeterProvider + */ public configureMeterProvider(config: MeterProviderConfig): void { // nothing is set yet, we can set config and return. if (this._meterProviderConfig == null) { @@ -206,7 +263,12 @@ export class NodeSDK { } } - /** Detect resource attributes */ + /** + * @deprecated Resources are detected automatically on {@link NodeSDK.start()}, when the {@code autoDetectResources} + * constructor option is set to {@code true} or left {@code undefined}. + * + * Detect resource attributes + */ public detectResources(): void { if (this._disabled) { return; @@ -219,13 +281,18 @@ export class NodeSDK { this.addResource(detectResourcesSync(internalConfig)); } - /** Manually add a resource */ + /** + * @deprecated Please pre-merge resources and pass them to the constructor + * + * Manually add a Resource + * @param resource + */ public addResource(resource: IResource): void { this._resource = this._resource.merge(resource); } /** - * Once the SDK has been configured, call this method to construct SDK components and register them with the OpenTelemetry API. + * Call this method to construct SDK components and register them with the OpenTelemetry API. */ public start(): void { if (this._disabled) { @@ -269,6 +336,19 @@ export class NodeSDK { propagator: this._tracerProviderConfig?.textMapPropagator, }); + if (this._loggerProviderConfig) { + const loggerProvider = new LoggerProvider({ + resource: this._resource, + }); + loggerProvider.addLogRecordProcessor( + this._loggerProviderConfig.logRecordProcessor + ); + + this._loggerProvider = loggerProvider; + + logs.setGlobalLoggerProvider(loggerProvider); + } + if (this._meterProviderConfig) { const meterProvider = new MeterProvider({ resource: this._resource, @@ -299,6 +379,9 @@ export class NodeSDK { if (this._tracerProvider) { promises.push(this._tracerProvider.shutdown()); } + if (this._loggerProvider) { + promises.push(this._loggerProvider.shutdown()); + } if (this._meterProvider) { promises.push(this._meterProvider.shutdown()); } diff --git a/experimental/packages/opentelemetry-sdk-node/src/types.ts b/experimental/packages/opentelemetry-sdk-node/src/types.ts index 03efc31142..9292e0ae70 100644 --- a/experimental/packages/opentelemetry-sdk-node/src/types.ts +++ b/experimental/packages/opentelemetry-sdk-node/src/types.ts @@ -18,6 +18,7 @@ import type { ContextManager } from '@opentelemetry/api'; import { TextMapPropagator } from '@opentelemetry/api'; import { InstrumentationOption } from '@opentelemetry/instrumentation'; import { Detector, DetectorSync, IResource } from '@opentelemetry/resources'; +import { LogRecordProcessor } from '@opentelemetry/sdk-logs'; import { MetricReader, View } from '@opentelemetry/sdk-metrics'; import { Sampler, @@ -31,6 +32,7 @@ export interface NodeSDKConfiguration { autoDetectResources: boolean; contextManager: ContextManager; textMapPropagator: TextMapPropagator; + logRecordProcessor: LogRecordProcessor; metricReader: MetricReader; views: View[]; instrumentations: InstrumentationOption[]; diff --git a/experimental/packages/opentelemetry-sdk-node/test/sdk.test.ts b/experimental/packages/opentelemetry-sdk-node/test/sdk.test.ts index 7a385a7604..6fb76f3dad 100644 --- a/experimental/packages/opentelemetry-sdk-node/test/sdk.test.ts +++ b/experimental/packages/opentelemetry-sdk-node/test/sdk.test.ts @@ -59,6 +59,12 @@ import { Resource, } from '@opentelemetry/resources'; import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'; +import { logs } from '@opentelemetry/api-logs'; +import { + SimpleLogRecordProcessor, + InMemoryLogRecordExporter, + LoggerProvider, +} from '@opentelemetry/sdk-logs'; const DefaultContextManager = semver.gte(process.version, '14.8.0') ? AsyncLocalStorageContextManager @@ -112,6 +118,7 @@ describe('Node SDK', () => { 'tracer provider should not have changed' ); assert.ok(!(metrics.getMeterProvider() instanceof MeterProvider)); + assert.ok(!(logs.getLoggerProvider() instanceof LoggerProvider)); delete env.OTEL_TRACES_EXPORTER; }); @@ -233,6 +240,40 @@ describe('Node SDK', () => { await sdk.shutdown(); delete env.OTEL_TRACES_EXPORTER; }); + + it('should register a logger provider if a log record processor is provided', async () => { + env.OTEL_TRACES_EXPORTER = 'none'; + const logRecordExporter = new InMemoryLogRecordExporter(); + const logRecordProcessor = new SimpleLogRecordProcessor( + logRecordExporter + ); + const sdk = new NodeSDK({ + logRecordProcessor: logRecordProcessor, + autoDetectResources: false, + }); + + sdk.start(); + + 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(logs.getLoggerProvider() instanceof LoggerProvider); + await sdk.shutdown(); + delete env.OTEL_TRACES_EXPORTER; + }); }); async function waitForNumberOfMetrics( @@ -406,6 +447,28 @@ describe('Node SDK', () => { ); }); + it('should throw error when calling configureLoggerProvider when logRecordProcessor is already configured', () => { + const logRecordExporter = new InMemoryLogRecordExporter(); + const logRecordProcessor = new SimpleLogRecordProcessor(logRecordExporter); + const sdk = new NodeSDK({ + logRecordProcessor: logRecordProcessor, + autoDetectResources: false, + }); + + assert.throws( + () => { + sdk.configureLoggerProvider({ + logRecordProcessor: logRecordProcessor, + }); + }, + (error: Error) => { + return error.message.includes( + 'LogRecordProcessor passed but LogRecordProcessor has already been configured.' + ); + } + ); + }); + describe('detectResources', async () => { beforeEach(() => { process.env.OTEL_RESOURCE_ATTRIBUTES = diff --git a/experimental/packages/opentelemetry-sdk-node/tsconfig.json b/experimental/packages/opentelemetry-sdk-node/tsconfig.json index add730f8bc..94c80b8846 100644 --- a/experimental/packages/opentelemetry-sdk-node/tsconfig.json +++ b/experimental/packages/opentelemetry-sdk-node/tsconfig.json @@ -39,6 +39,9 @@ { "path": "../../../packages/sdk-metrics" }, + { + "path": "../api-logs" + }, { "path": "../exporter-trace-otlp-grpc" }, @@ -50,6 +53,9 @@ }, { "path": "../opentelemetry-instrumentation" + }, + { + "path": "../sdk-logs" } ] } diff --git a/experimental/packages/otlp-exporter-base/.eslintrc.js b/experimental/packages/otlp-exporter-base/.eslintrc.js index e41d9a9299..c054089042 100644 --- a/experimental/packages/otlp-exporter-base/.eslintrc.js +++ b/experimental/packages/otlp-exporter-base/.eslintrc.js @@ -5,5 +5,5 @@ module.exports = { "node": true, "browser": true }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/otlp-exporter-base/package.json b/experimental/packages/otlp-exporter-base/package.json index 2d06e7b181..089d767ebc 100644 --- a/experimental/packages/otlp-exporter-base/package.json +++ b/experimental/packages/otlp-exporter-base/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/otlp-exporter-base", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenTelemetry OTLP Exporter base (for internal use only)", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -24,10 +24,10 @@ "tdd": "npm run test -- --watch-extensions ts --watch", "tdd:browser": "karma start", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile" }, "keywords": [ @@ -61,23 +61,34 @@ "access": "public" }, "dependencies": { - "@opentelemetry/core": "1.13.0" + "@opentelemetry/core": "1.17.1" }, "devDependencies": { - "@opentelemetry/api": "1.4.1", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@opentelemetry/api": "1.6.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", + "cross-var": "1.1.0", "fetch-mock": "9.11.0", - "istanbul-instrumenter-loader": "3.0.1", - "mocha": "10.0.0", - "nock": "13.0.11", + "karma": "6.4.2", + "karma-chrome-launcher": "3.1.0", + "karma-coverage": "2.2.1", + "karma-mocha": "2.0.1", + "karma-spec-reporter": "0.0.36", + "karma-webpack": "4.0.2", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", - "typescript": "4.4.4" + "typescript": "4.4.4", + "webpack": "4.46.0", + "webpack-cli": "4.10.0", + "webpack-merge": "5.9.0" }, "peerDependencies": { "@opentelemetry/api": "^1.0.0" diff --git a/experimental/packages/otlp-exporter-base/src/OTLPExporterBase.ts b/experimental/packages/otlp-exporter-base/src/OTLPExporterBase.ts index c960305783..2c55a7f91c 100644 --- a/experimental/packages/otlp-exporter-base/src/OTLPExporterBase.ts +++ b/experimental/packages/otlp-exporter-base/src/OTLPExporterBase.ts @@ -33,7 +33,7 @@ import { configureExporterTimeout } from './util'; export abstract class OTLPExporterBase< T extends OTLPExporterConfigBase, ExportItem, - ServiceRequest + ServiceRequest, > { public readonly url: string; public readonly hostname: string | undefined; diff --git a/experimental/packages/otlp-exporter-base/src/platform/browser/OTLPExporterBrowserBase.ts b/experimental/packages/otlp-exporter-base/src/platform/browser/OTLPExporterBrowserBase.ts index 9d0967824a..93de7812b6 100644 --- a/experimental/packages/otlp-exporter-base/src/platform/browser/OTLPExporterBrowserBase.ts +++ b/experimental/packages/otlp-exporter-base/src/platform/browser/OTLPExporterBrowserBase.ts @@ -27,7 +27,7 @@ import { getEnv, baggageUtils, _globalThis } from '@opentelemetry/core'; */ export abstract class OTLPExporterBrowserBase< ExportItem, - ServiceRequest + ServiceRequest, > extends OTLPExporterBase { protected _headers: Record; private sendMethod: 'beacon' | 'xhr' | 'fetch' = 'beacon'; diff --git a/experimental/packages/otlp-exporter-base/src/platform/node/OTLPExporterNodeBase.ts b/experimental/packages/otlp-exporter-base/src/platform/node/OTLPExporterNodeBase.ts index 088a0fd0a0..5a8b1dfdfa 100644 --- a/experimental/packages/otlp-exporter-base/src/platform/node/OTLPExporterNodeBase.ts +++ b/experimental/packages/otlp-exporter-base/src/platform/node/OTLPExporterNodeBase.ts @@ -30,7 +30,7 @@ import { getEnv, baggageUtils } from '@opentelemetry/core'; */ export abstract class OTLPExporterNodeBase< ExportItem, - ServiceRequest + ServiceRequest, > extends OTLPExporterBase< OTLPExporterNodeConfigBase, ExportItem, diff --git a/experimental/packages/otlp-exporter-base/test/certs/ca.crt b/experimental/packages/otlp-exporter-base/test/certs/ca.crt deleted file mode 100644 index 529ce2f7b8..0000000000 --- a/experimental/packages/otlp-exporter-base/test/certs/ca.crt +++ /dev/null @@ -1,33 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFozCCA4ugAwIBAgIUa6OxgyEYxNjpjac0jTAKn+IkGTYwDQYJKoZIhvcNAQEL -BQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQHDBFPcGVuVGVs -ZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9vdDENMAsGA1UECwwEVGVzdDELMAkGA1UE -AwwCY2EwHhcNMjEwNjA3MjAxMDExWhcNMjIwNjA3MjAxMDExWjBhMQswCQYDVQQG -EwJDTDELMAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0w -CwYDVQQKDARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTCCAiIwDQYJ -KoZIhvcNAQEBBQADggIPADCCAgoCggIBAMbVyp3NCtDwKpGbV+MCML63o+vGVhpd -Dlt3ncpcwz0FMK6UJDXzTe4joKCaezWto3Bmhb28Lezcf8AdzmTdnoENAaqUX2SE -giGVoeaJ/M1hW1IiOffa9zIMkt6cwf8MUUMl5kTRMdAqmpikNqN0rqNpaGuqBYf9 -kvDy3hw+dj19hKEeEXI2zt/HYDOBHYgpalWiOS8qwj0zSfxAUeura+eXKMlx0JOY -h5N25OUH1oLt1flhyuHnwRThKbvyMnL36Ey+G7uCFH0hQSGO0BLhg1LPDWG1PmTn -KzsvqaIgDF/tMCXykvaWcsSxrhvsNeOFFmmkKp1ECVOFgFYsGuK8lJlEvm6Owrvz -4X69L0phCJtaCCaSUFdybqx+G2ZKLZNqTtnMw/3YECp37KyrRd75Gy1UrU031+XC -Fpt4pHw+3isjAOf1bj32F2Ed7aaqVqM2A7m8AgA0m22J/f+jBzmv6UJN/kvfFXzC -0lbX6b1fGj49vU9WEO/o+F3qaH/c50HPf45AB2d4pWbDl5alXZei58ZyEemBndlv -XcGPtVR9S/5rphlX1vAIOT7ePWgUVkAi5fB/rLVGyC1FwA0zYvdyj9CVigJNs29G -yftsvMynF8TL7/qCIGNz72qtW/Pn227OI4WamvYhX6fJwJirXwTEQhAfKXljocI/ -Liqxx15Sfs+3AgMBAAGjUzBRMB0GA1UdDgQWBBSMocah0cTqX4owoPL4+zV1pe5F -QzAfBgNVHSMEGDAWgBSMocah0cTqX4owoPL4+zV1pe5FQzAPBgNVHRMBAf8EBTAD -AQH/MA0GCSqGSIb3DQEBCwUAA4ICAQCIpnaYSMXT+nrdOgw2zKHTk47wANGf6nfK -76VwsQfzVkJm/tzEgq+saEznGRW1ttdQfXHJM3NCfneVhjXDkihrHsxiL4S+5OMq -cusp2tKupGXlxwOt7tsAhH5j4SQLyEUiWMmm/Wvwtx2HWuNO8LZGhoAcUrT7r94f -vqr3tYyb3D06/rBRj2QcybYGJHsQAULEQvmWJvCveh5gqxkRjDJlwmqV/lIarPCt -diKbsZqHJMNaRMbgsxV8hVSvD6RKtBG+K8hpuHF2ZKfzb7Yt1IDPtUGCL811ykzh -2PjumjaQ2JCP6vtYAhTS1r/+cbOi+4v5JzF+kxHxFc9vK/gzBT88174S2MQaqwhF -jQiS3YfElLXkr37E9gxMKLDanbFsxPPiXO96s0RSjNK2mzSbz/gfmsjGqxKNq3t1 -IwAfjePmmx4FJ1O/FwOA5RWE+KRhzNucktjxz39oZrnqtPeTqHnAivNOyK3XB68v -5HRjP79TrzIbLCauyJD/qM5UtCRXW2La1rsH8lIBtcxUcZOkvDnE6Po44D5hH2kQ -swRqF9Vy7PL9MWJPTgn4+WFLNoBe+nMY82y7xstRv7c2ctXpAxSWxIXgBN+B9nXo -3Lqpgg0UkjTiCp13Mejq/7DYAw+/Ou8bxWs3BuCQvFcG2+FBMWh0dL1FxVq3BPyq -oveTgr1sfQ== ------END CERTIFICATE----- diff --git a/experimental/packages/otlp-exporter-base/test/certs/ca.key b/experimental/packages/otlp-exporter-base/test/certs/ca.key deleted file mode 100644 index df94d44c38..0000000000 --- a/experimental/packages/otlp-exporter-base/test/certs/ca.key +++ /dev/null @@ -1,54 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,7EE0C188F59416E9 - -C6U1lvr1RyEnqzF5P05cyDgQChQICuJIj1C6N8CA/5izdK1kk84qSHlrHYZD9bOC -VKljHd9D7OMlGOxwdMC6/3y8tXQTj4AGEuESMqQyUdgl6odGMa5bjjdrMT4Ul0AR -Ngxm9JRLG6YJdM9uXVIYK9AgyT1cSlcmdKUrtmRgy9+ObrkiDht7Z13tvWKkieVG -/xf7aLZ6hFja3X1RPgWIMVTBOqJO8a1HBReVrfiVe7CRWGHbOPlRZLYL3bWywQ0p -JWRaoY5uF0WQqu03T3lRNxPBpRfJeo2qkzNc5nabp5ZHqUYblVNmsSksADsTKXxV -NIu/sShtQzChu5QqlPbf7aYEC3jp8VjkPhxQLQ/s3t/PRG+uyFlgk8jgD1rYX4TD -5Bwzk/enm3AmqvKLLydjeSm0NX5Z0fjCjZj/I3SKiDV4l6XHVIya9KCuTAOZesl7 -fmj7UGjwgvHIz1F+EJOc7ItEj0WcJ7bJkZGp9ol0F2Q+x46Yls3ByOwJS49r6VF2 -htpWMwV07V1UifdifUzEIwMr354P45VncloYEokhx25VBMsDuzrr27AO5UlxLuMP -m7gG/NJb5z2aISvAXGoPxr4Wfh0o60C8Jc1HIwpgfgOhnn+Ix1NvnVPqPPFaSIRv -xNm2yAEnc/cm0tOMFXTxyntqp7R8S5Zj8ehQkXRHbh98scZX2nhQIXSUFfwLLgqL -Z9eBrOhuWn3L7HfVzkYoKXL04uc3HLMedxqxKwS+xsNIKI3n7FntRUHveOma+Dus -TThjktIKbtwFEHnkZ2DwX7Cv5jcDD7XrealsuF8pDPK6tdzR7Q1ujOVOTJEH/z4/ -o7Kn3qB5oeC1l2qWC6Sk80G4NAL0BgbOk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AOUNQRZuiNlHT3Buio7lKJMmwuuLFSACcnp9LVBhRgbypDRIxGSFw -GST/70V5OaDibFC7bl37pbKh1qzBqVB1qlylqxvS/ZID3iMEqjuuumYBO11Pkm1f ------END RSA PRIVATE KEY----- diff --git a/experimental/packages/otlp-exporter-base/test/certs/client.crt b/experimental/packages/otlp-exporter-base/test/certs/client.crt deleted file mode 100644 index b1519dede6..0000000000 --- a/experimental/packages/otlp-exporter-base/test/certs/client.crt +++ /dev/null @@ -1,31 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV -BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjEwNjA3MjAxMDExWhcN -MjIwNjA3MjAxMDExWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV -BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZD -bGllbnQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCAiIwDQYJKoZIhvcNAQEBBQADggIP -ADCCAgoCggIBAN1or7F+548RpVIgdrzYmuWgKMfWsO5FhgqpGp+xuoVgMMTlZM3i -yiarMnAE0G6ZVMwqCeXkiUGL9QLatJ1S/HO2sWLUkWaPD7X7O4k1yGtl6UsRcr4K -+YBUbucxfrCQjaWKlBc1GMBrDyY/u/rl0CIYu3GtegniN6HG6rBXC2e98DVctQ3M -r/RXB9DWqMC2KW2X92X+FyWqTfGjv8wjRnhQdDNXPA/PCembzhfCL8VlmG65rDiz -VQxiTotTOCmaxULdF307jorMTLIHZVV2OnAA/udeDcxITnKcksLiRKKAiHUXMIPq -RGxNtLX1sdBD/FoQ28sr8o6Ko7qb3uaA4CZhp2I4RR925oZISyObzY3QxrlafN4g -hFnWkTFJY0K+43cxta8K3gAnQXxN/BANDEydS1YM9adqYbt09wctSUjMqJHGZWnn -IVOged+/DEIW9EmyLSPM1DC1s1owOrgwBXzHRRNXuUFjZPPrMC8TkBexNjsapLjr -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/experimental/packages/otlp-exporter-base/test/certs/client.csr b/experimental/packages/otlp-exporter-base/test/certs/client.csr deleted file mode 100644 index 2d99fab566..0000000000 --- a/experimental/packages/otlp-exporter-base/test/certs/client.csr +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH -DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGQ2xp -ZW50MRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQDdaK+xfuePEaVSIHa82JrloCjH1rDuRYYKqRqfsbqFYDDE5WTN4som -qzJwBNBumVTMKgnl5IlBi/UC2rSdUvxztrFi1JFmjw+1+zuJNchrZelLEXK+CvmA -VG7nMX6wkI2lipQXNRjAaw8mP7v65dAiGLtxrXoJ4jehxuqwVwtnvfA1XLUNzK/0 -VwfQ1qjAtiltl/dl/hclqk3xo7/MI0Z4UHQzVzwPzwnpm84Xwi/FZZhuuaw4s1UM -Yk6LUzgpmsVC3Rd9O46KzEyyB2VVdjpwAP7nXg3MSE5ynJLC4kSigIh1FzCD6kRs -TbS19bHQQ/xaENvLK/KOiqO6m97mgOAmYadiOEUfduaGSEsjm82N0Ma5WnzeIIRZ -1pExSWNCvuN3MbWvCt4AJ0F8TfwQDQxMnUtWDPWnamG7dPcHLUlIzKiRxmVp5yFT -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/experimental/packages/otlp-exporter-base/test/certs/client.key b/experimental/packages/otlp-exporter-base/test/certs/client.key deleted file mode 100644 index 00f82cfeeb..0000000000 --- a/experimental/packages/otlp-exporter-base/test/certs/client.key +++ /dev/null @@ -1,51 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIJKgIBAAKCAgEA3WivsX7njxGlUiB2vNia5aAox9aw7kWGCqkan7G6hWAwxOVk -zeLKJqsycATQbplUzCoJ5eSJQYv1Atq0nVL8c7axYtSRZo8Ptfs7iTXIa2XpSxFy -vgr5gFRu5zF+sJCNpYqUFzUYwGsPJj+7+uXQIhi7ca16CeI3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kqE -nl1xAiPrapVfknBezk+oYvAynnGGB8lg9OKSnJnGzckCXVHMcwQa4BIT7ixjCj3p -IuQmwstg5t8p67K2Mgwd8fAQoEfg0bXGWcyUqgGQ/zq33uS+GyMlVS0mXLdxT2F1 -d44UAQKCAQEAtB3sGMfJIgZSKVQ5BXDfseT3Ajho1dSMY8OWrhNaarhMJ6MKrcpL -mwkpX1nW4yKhajSxkl5nBw6GM+1zDmVphdq9Hv+MG2GNebO+orSolXpFxGr+XvPP -yt2kU5v2Ff+9kGigncd2QHa7mbfdR30Gn+MWJuix7yxhsIe3J0hZR7EM4qHIUP1T -gxrqlvr0waN5tlUiIeNWSACf85yRiBTK+7P6tV9cqnv3VskMnGBj7ZCK5JthhYn9 -NdeuMjk8PeAIvo6QN28wY/UMbl3mWtUSWe8XEL2xGgD60Y+qbKVm8+3vh+/1MRzZ -tBM836ginHHApya0bNBPmtGoya2rVTDliQKCAQEAiiX5sNs3uvKyz7Z+LIiXaVL6 -C4CaNUMgyNv536FBzmMKXAsBFiAw/G96OPlwrNsIATVwumjq5mxYxeeMLwuodNJL -uNczdyNmsT9721tQEMTnS99VrtqISZZlAR0jVhTATU/cla/BMykqWTiAYUSHcFHw -2gOnyCTnBbW1EI3fdLQOqPiRNvpDwp4xNhXLnr8ANuewnw3yRCdZvJVsAmUpMLME -vjT3lzh4i2diKnAHF2l+ZTkqHFzg7oEOOms38Vi8rrhhwN0uvRdrbtcdrFc9YiW0 -IVJ5JWQ60oBdytnuoRvTLsnWrqfvgwcQYtZ3oFo+qO4fXFB1X54+IoyZFC1saA== ------END RSA PRIVATE KEY----- diff --git a/experimental/packages/otlp-exporter-base/test/certs/regenerate.sh b/experimental/packages/otlp-exporter-base/test/certs/regenerate.sh deleted file mode 100755 index 9e2e972c99..0000000000 --- a/experimental/packages/otlp-exporter-base/test/certs/regenerate.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env sh -# -# Usage: regenerate.sh -# -# regenerate.sh regenerates certificates that are used to test gRPC with TLS -# Make sure you run it in test/certs directory. -# 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 -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/experimental/packages/otlp-exporter-base/test/certs/server.crt b/experimental/packages/otlp-exporter-base/test/certs/server.crt deleted file mode 100644 index 55f0c3dbb9..0000000000 --- a/experimental/packages/otlp-exporter-base/test/certs/server.crt +++ /dev/null @@ -1,31 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV -BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjEwNjA3MjAxMDExWhcN -MjIwNjA3MjAxMDExWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV -BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZT -ZXJ2ZXIxEjAQBgNVBAMMCWxvY2FsaG9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GgfQUuljkNKkKfj -N02siSNjIuKzE/DSW6yV0OFL/FCNPyvzs8CKTMwfyrrvA0UAspkFCWZFXFlA+uLs -0at4SmPecOsc+O8ATon9nUyXh06anBwtp03aXX6Mr/7UIRRPHF70BY7MDV4OvvQt -PD0osFo0uEHubflCnPBUdMrQN9KbELVJeV7G0Xj2fHTAVoEnCmSpow+LB1ehWGbR -M3U8q9wlpXi4Awhr19kRcSdE/JzI7eu9MqjsazfUdAtCcgg4dHixOre8oXgauhZ5 -jMOv9lUI6Glf61xt8mamicohSf9CFyH5PgZqRM0aSacdJ7jH6EitABOx21ZqwiBp -o4W37lV55oy+N0r7yxaNy/mSUUcjsQo6kGw/4cMpYTSEzRMtfwYPOS1DeTl9zArE -7TBI ------END CERTIFICATE----- diff --git a/experimental/packages/otlp-exporter-base/test/certs/server.csr b/experimental/packages/otlp-exporter-base/test/certs/server.csr deleted file mode 100644 index 0c5e9291bf..0000000000 --- a/experimental/packages/otlp-exporter-base/test/certs/server.csr +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH -DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGU2Vy -dmVyMRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQC2rJDJNBaaAGfHh6TojWCFtsjnosxrLyez7DWbo21BUP3+/wGE2QgU -PR3PJSs/t2B5JWZ07ACVukCwgSkoLK4zwFwNucwRUGs1Lim/kK46CKnmqvA/MOoh -y+83R7KZW1mY2K5z4y1j6qHNYGuh9KfDbB+3guoRVyUadmYpcmV1EeI78jHNw9qv -zF6CNFb0N7SP0Gi61NomjdA2QbMiYa+Af4zczmMxgLlYnhMledsBZzrFJSQzaY7E -/79f0PCa4zl0m/pKP++FZUi0wmrqD0rIl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-r1OkRzoO05pHAh2o+4gujThsc0d3T5mmoeSySs56lgqDmC4blXNOS0kBZ4+I2u7A -C2YH ------END CERTIFICATE REQUEST----- diff --git a/experimental/packages/otlp-exporter-base/test/certs/server.key b/experimental/packages/otlp-exporter-base/test/certs/server.key deleted file mode 100644 index 9fa740554a..0000000000 --- a/experimental/packages/otlp-exporter-base/test/certs/server.key +++ /dev/null @@ -1,51 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIJKQIBAAKCAgEAtqyQyTQWmgBnx4ek6I1ghbbI56LMay8ns+w1m6NtQVD9/v8B -hNkIFD0dzyUrP7dgeSVmdOwAlbpAsIEpKCyuM8BcDbnMEVBrNS4pv5CuOgip5qrw -PzDqIcvvN0eymVtZmNiuc+MtY+qhzWBrofSnw2wft4LqEVclGnZmKXJldRHiO/Ix -zcPar8xegjRW9De0j9BoutTaJo3QNkGzImGvgH+M3M5jMYC5WJ4TJXnbAWc6xSUk -M2mOxP+/X9DwmuM5dJv6Sj/vhWVItMJq6g9KyJRvWtrRNu7dnQTpvu+UUp5lo7HB -TJZ4uLphPpn1lM4Qm6Ilqf/tJOmsrU2uov44+d4rUDQ+WvXSFjvpKm0C7Z9OqAY4 -UahCTFOiyeymmJKQJVoOIsoJWvgNDMGb/QIuhKBeTh8k2GI2shP5vfmBfxeabeFS -r5QZqdnJeElh+iMFS6E8kUBQqlRSNKyJFTwOPxHuchlP5xRa+yVias4bhmMKekhe -eiikCMWVpmS/rb+0QbAmbIGQaTaVjOf0prUb9o73YiN/PKlSVIpcKe1PEsPoHNY0 -Xv+qO3X1dM5Y+MKFAdBxheaVNI1S9RDT0cxpEhR7kwJ7GVZiV5fqVUbpe0zA5vTr -Dk7KdW4weOIAZ+SMutSQZCpLEetLa/9p/UnsX4IgKU2Aj6ranPl1hZgxoIUCAwEA -AQKCAgAzcuLMaEk9UoPoJIIDpV3cCyEGbEmanotWF1752Mt6q+79lKC+48lsudHd -d6B4r5MSS8BRie6YPP7fN2F6GStvE+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m8WLzJQHY0rm3y -jOL0bWrEm5BXOcewXeSzQkcYbrViniHUv1OQDmNdTGw+bLCyM3fY3Ud2oBJGTfTw -wDoyG6D6zdLztGxTQQ2C39DXdRelGhYwrz2MlKJK5K2EVNLJ8O91c+VjvxKKJmJ1 -fkxF7omyNBh5dBnvFC/jFuxVL+PRqnvO0SH1YH1Y9eiqNhXrds0B4U+/YBDZ ------END RSA PRIVATE KEY----- diff --git a/experimental/packages/otlp-grpc-exporter-base/.eslintignore b/experimental/packages/otlp-grpc-exporter-base/.eslintignore index 378eac25d3..345f1a599e 100644 --- a/experimental/packages/otlp-grpc-exporter-base/.eslintignore +++ b/experimental/packages/otlp-grpc-exporter-base/.eslintignore @@ -1 +1,2 @@ build +src/generated diff --git a/experimental/packages/otlp-grpc-exporter-base/.eslintrc.js b/experimental/packages/otlp-grpc-exporter-base/.eslintrc.js index 3ed0fbeba3..9cfb3fd423 100644 --- a/experimental/packages/otlp-grpc-exporter-base/.eslintrc.js +++ b/experimental/packages/otlp-grpc-exporter-base/.eslintrc.js @@ -4,5 +4,5 @@ module.exports = { "commonjs": true, "node": true, }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/otlp-grpc-exporter-base/package.json b/experimental/packages/otlp-grpc-exporter-base/package.json index 97f8940ef6..4be5e7d7b5 100644 --- a/experimental/packages/otlp-grpc-exporter-base/package.json +++ b/experimental/packages/otlp-grpc-exporter-base/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/otlp-grpc-exporter-base", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenTelemetry OTLP-gRPC Exporter base (for internal use only)", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -19,7 +19,7 @@ "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "version": "node ../../../scripts/version-update.js", "watch": "npm run protos && tsc -w", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile" }, "keywords": [ @@ -48,20 +48,22 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", - "@opentelemetry/api": "1.4.1", - "@opentelemetry/otlp-transformer": "0.39.1", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@opentelemetry/api": "1.6.0", + "@opentelemetry/otlp-transformer": "0.44.0", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "codecov": "3.8.3", "cpx": "1.5.0", - "mocha": "10.0.0", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "protobufjs-cli": "1.0.2", - "sinon": "15.0.0", + "protobufjs-cli": "1.1.2", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4" @@ -71,9 +73,9 @@ }, "dependencies": { "@grpc/grpc-js": "^1.7.1", - "@opentelemetry/core": "1.13.0", - "@opentelemetry/otlp-exporter-base": "0.39.1", - "protobufjs": "^7.2.2" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/otlp-exporter-base": "0.44.0", + "protobufjs": "^7.2.3" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/otlp-grpc-exporter-base", "sideEffects": false diff --git a/experimental/packages/otlp-grpc-exporter-base/src/LogsExportServiceClient.ts b/experimental/packages/otlp-grpc-exporter-base/src/LogsExportServiceClient.ts index 148fca31a1..b867743cea 100644 --- a/experimental/packages/otlp-grpc-exporter-base/src/LogsExportServiceClient.ts +++ b/experimental/packages/otlp-grpc-exporter-base/src/LogsExportServiceClient.ts @@ -16,9 +16,11 @@ import * as root from './generated/root'; import * as grpc from '@grpc/grpc-js'; -import { IExportLogsServiceRequest } from '@opentelemetry/otlp-transformer'; +import { + IExportLogsServiceRequest, + IExportLogsServiceResponse, +} from '@opentelemetry/otlp-transformer'; import { ExportType } from './internal-types'; -import IExportLogsServiceResponse = root.opentelemetry.proto.collector.logs.v1.IExportLogsServiceResponse; const responseType = root.opentelemetry.proto.collector.logs.v1 .ExportLogsServiceResponse as ExportType; diff --git a/experimental/packages/otlp-grpc-exporter-base/src/MetricsExportServiceClient.ts b/experimental/packages/otlp-grpc-exporter-base/src/MetricsExportServiceClient.ts index 9a791ca2f3..7f81be6087 100644 --- a/experimental/packages/otlp-grpc-exporter-base/src/MetricsExportServiceClient.ts +++ b/experimental/packages/otlp-grpc-exporter-base/src/MetricsExportServiceClient.ts @@ -16,9 +16,11 @@ import * as root from './generated/root'; import * as grpc from '@grpc/grpc-js'; -import { IExportMetricsServiceRequest } from '@opentelemetry/otlp-transformer'; +import { + IExportMetricsServiceRequest, + IExportMetricsServiceResponse, +} from '@opentelemetry/otlp-transformer'; import { ExportType } from './internal-types'; -import IExportMetricsServiceResponse = root.opentelemetry.proto.collector.metrics.v1.IExportMetricsServiceResponse; const responseType = root.opentelemetry.proto.collector.metrics.v1 .ExportMetricsServiceResponse as ExportType; diff --git a/experimental/packages/otlp-grpc-exporter-base/src/OTLPGRPCExporterNodeBase.ts b/experimental/packages/otlp-grpc-exporter-base/src/OTLPGRPCExporterNodeBase.ts index 884505daa8..b4f06472c6 100644 --- a/experimental/packages/otlp-grpc-exporter-base/src/OTLPGRPCExporterNodeBase.ts +++ b/experimental/packages/otlp-grpc-exporter-base/src/OTLPGRPCExporterNodeBase.ts @@ -34,7 +34,7 @@ import { */ export abstract class OTLPGRPCExporterNodeBase< ExportItem, - ServiceRequest + ServiceRequest, > extends OTLPExporterBase< OTLPGRPCExporterConfigNode, ExportItem, diff --git a/experimental/packages/otlp-grpc-exporter-base/src/TraceExportServiceClient.ts b/experimental/packages/otlp-grpc-exporter-base/src/TraceExportServiceClient.ts index 6a150a24b1..d332e4f4da 100644 --- a/experimental/packages/otlp-grpc-exporter-base/src/TraceExportServiceClient.ts +++ b/experimental/packages/otlp-grpc-exporter-base/src/TraceExportServiceClient.ts @@ -16,9 +16,11 @@ import * as root from './generated/root'; import * as grpc from '@grpc/grpc-js'; -import { IExportTraceServiceRequest } from '@opentelemetry/otlp-transformer'; +import { + IExportTraceServiceRequest, + IExportTraceServiceResponse, +} from '@opentelemetry/otlp-transformer'; import { ExportType } from './internal-types'; -import IExportTraceServiceResponse = root.opentelemetry.proto.collector.trace.v1.IExportTraceServiceResponse; const responseType = root.opentelemetry.proto.collector.trace.v1 .ExportTraceServiceResponse as ExportType; diff --git a/experimental/packages/otlp-grpc-exporter-base/src/util.ts b/experimental/packages/otlp-grpc-exporter-base/src/util.ts index 7e1d58dff7..78809466c9 100644 --- a/experimental/packages/otlp-grpc-exporter-base/src/util.ts +++ b/experimental/packages/otlp-grpc-exporter-base/src/util.ts @@ -125,6 +125,9 @@ export function validateAndNormalizeUrl(url: string): string { url = `https://${url}`; } const target = new URL(url); + if (target.protocol === 'unix:') { + return url; + } if (target.pathname && target.pathname !== '/') { diag.warn( 'URL path should not be set when using grpc, the path part of the URL will be ignored.' diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/ca.crt b/experimental/packages/otlp-grpc-exporter-base/test/certs/ca.crt index b6db7d0dd2..c194f04954 100644 --- a/experimental/packages/otlp-grpc-exporter-base/test/certs/ca.crt +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/ca.crt @@ -1,33 +1,33 @@ -----BEGIN CERTIFICATE----- -MIIFozCCA4ugAwIBAgIUCdllngMpqYtsqRCpqdXxPZiSbGEwDQYJKoZIhvcNAQEL +MIIFozCCA4ugAwIBAgIUFA6cfBQ2t0ZOpLTRUIE6VN+kGBkwDQYJKoZIhvcNAQEL BQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQHDBFPcGVuVGVs ZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9vdDENMAsGA1UECwwE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mA9Y6HmpN0 +vYtQUF2sS5W82XoFD8bpOq/bx1o2ib2x32dfPQkVgd4sbmpsyN62Fy1HpHwXtXno +xGVaDzGSWj/7RyYyKhNmp3nfQsU0Tt6iVkM+N30vl2heZqEUgXxCG9qHVzWv9z6x +AJzuafjM8tviROpiHkvzsmq7uDhksGooKCi+m+eoEBJrd0J4gjngAi1NYjTsB2GT +4mvPz05UkA== -----END CERTIFICATE----- diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/ca.key b/experimental/packages/otlp-grpc-exporter-base/test/certs/ca.key index 3a12f603d4..00ccb04622 100644 --- a/experimental/packages/otlp-grpc-exporter-base/test/certs/ca.key +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/ca.key @@ -1,54 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,723F7ADBF5E86DF0 - -laGpuVd6ib17eYFGAvuWCFodT4OxvWQVpvjXVEqfqoJw3x//SbS/J9GQXULJHanh -FZGagPYhv3cQjW5n8hSxFADCq09he3sN+IV6FOzQ5JzJZEQtb5jqfc23n0o2y1Sx -Xw2TOBuzzLB9NFnkTgZt0hUJW9wrqYhDLXXmwwdJb78OsFmgzlBCVrcXtZKiLK7F -4gKvMKSD/pS4INKmwHlAdNqssMyk0Snon7odLD9yTrTYVqIabytj7ZQi8Mxg/EZC -mkffRhMS591DYU86CE38of6UbSc7AXdfvpYZ+G3phIUwE+BxaDOL1RX/h04LcDjE -43R8ccI1akW3EGO0FvTr1jn4EsDv/kuYLVmC7fhuYroSBGLIdt89aEuRxBkLsn/Y -WJv/VviXlmO13wAi/kPrwPQk8GpBO73Yw367+iaHNsWihZ8qBYBjiqQyR59Tymwy -yLtTA8yhFCDwMwWLbB5NGVFuMmLGKUHvFvcXnEdK0RGJr5uu8cV/FAGpGMld3g84 -VY7srpocRLecTqQ5cfm8TZfcilIbTtpexqN97RicDdI+KjmYBVmWMOwrzzALFuKA -jVIgx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 +a7e9ab8H9TkVAy2EoCu4K0KBGhaUvxMLXQKCAQAORESNb5Ne+bBHbrSA6nVMH0Ti +Gt9Nx2bgNLxgGPGHLIFkQPnR9akk8mm94T/Ow1y8Jrx/rE0bxR0ayVYbxLiF+Zqz +i/G+CYGg72j+PXdugo4ocfGf17BpqR577uqUAycvtsk50zTgxYyoob5HxdXcFjnH +PEiJBGSSSY1VJJlPxIftHLE6ULfwslyMkHPGBxh6NJe/nkM7obuQYMc7JGpNngLb +G5NF6b8nV5yJ7a5hhhSbArFWuzlfbRsZwgqadWFDChXiAyCbzE5ey5gUOs22K4Ax +M4Ky5evO6Srk3gtFGCWPqSxcDJk57DSy/on35IwerlQTI6Btz0OT6EmDWXOn -----END RSA PRIVATE KEY----- diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/client.crt b/experimental/packages/otlp-grpc-exporter-base/test/certs/client.crt index cbd324625f..fd05c9c40b 100644 --- a/experimental/packages/otlp-grpc-exporter-base/test/certs/client.crt +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/client.crt @@ -1,31 +1,31 @@ -----BEGIN CERTIFICATE----- MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjEwNjA3MjAyNzMzWhcN -MjIwNjA3MjAyNzMzWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjMwNjA4MTY0NDI2WhcN +MjQwNjA3MTY0NDI2WjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZD bGllbnQxE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Ejw9kc9myMeC5ik7wHuksA/BQcja1TPwB4ZRbPEcfi2iFxbtsSzAgMBAAEw +DQYJKoZIhvcNAQELBQADggIBAGdcqEI2l/dKxu9vPuRC2/VRgjgDBN4UJJCY111T +2A7GsGzd7lRhtxB5ZzClF77UiRJG+cvFai00c9+L3wp8qy4sZWY4MaJIWoKRh72Q +sRiH8AskeIl3uvvvaH86bbmpDo7M48Cs/zXZo9VhLzD8ZuHcS1mdjkOcnQzkbSzR +YeM9ActeuJRmsdQ+gSzCTvFqmGutL6xvM8b9a6PwyY5nPxS+eh0/7KNp+EXBvp0U +MWp6mMfq22nAwAQRLbvh5f+a/4GSwg73By6hwnsgb7tpBBJ6ppnKAIALRf7l5JwS +V0LM5Vnpp4J4JjdYyQzk2xkxi+UGIP1IRigbeWc4K3qgg6BUUkfSf4W9oJD4JCa2 +cOsqnKqFxTwXT4b9j9qsPpg7mUQ2+UtU4Lv3h/7sXpbpx0ldb2Hnaq+JqUz0l/7c +54y3+nzke7I4CWKtLJUSamQiyOC3CBVkRX0YEYUBhMXim6dKAfiOEV6K3bwiU+YZ +aDe0lEeLbzAp87DKRTAvDYhRMIFtD3g2qmYrWpQ4gj8vSEorNAfg3kVHMFRGlk9o +jaFduAz0hKk+QG5SgePXMph5ZRXGRq0FnDbF2gZ7WV+jZiIhsYGJ43+RBWHh4HO4 +P4h9eOWQG8AxpDRmOo2KmyPbV0V/eltC4N0oOAmWz+i0qqulnpG4dOzQKpinRBBr +jPt5 -----END CERTIFICATE----- diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/client.csr b/experimental/packages/otlp-grpc-exporter-base/test/certs/client.csr index e5de7b1912..b783896725 100644 --- a/experimental/packages/otlp-grpc-exporter-base/test/certs/client.csr +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/client.csr @@ -2,27 +2,27 @@ MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH DBFPcGVuVGVsZW1ldHJ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fpdFRthoLA+2Io7+kldGGa1X/OYgOaul3SkwbimJop2RG +53hI8PZHPZsjHguYpO8B7pLAPwUHI2tUz8AeGUWzxHH4tohcW7bEswIDAQABoAAw +DQYJKoZIhvcNAQELBQADggIBACboOarzimaArw3lDm6ET5yiU7NxTWtnWwFUOoSh +qS2cvumnCokUlrDyMSSKoHl2i2biUd9uiHuEqlh0yufNgnTsyAXLg0UiBHAv5Tos +Esc5A+JTV5ehy+Zrjpl3Ayh8difS8hJEBjMhH+7rCN3rhpvwkTSaXDCQTBzWPhQ1 +R0EIho/SNOh5mXQKAUWwhtleI0sEJC/PqezGfN+w+URHnzE7YMwg02bvoMxBEror +YVddG4o0nIyd6CPg++K7TBzYGGOf1CUCrI9S1bBn3jcv2mq5YgZMdLEa0HkA9XzU +J/dTSGz5pJbkoaX9IHv8a3uoc+V1jdNWZRmTUYG/cNoAFISoG+uuJLgesF5l+vxx +GUwkE6wj4bNYR/Pqy5963oDmA3ndBzR1wtCZqIsLX3t3A9fLLtIEgeN/XDSvNDBs +YdwBrx2HTatK7QCJ5e+4ACs6Wc2c1nnDviPddpxUgl0pHKcMbT+xNk7bY5fjl5Qr +wzuBNgvQcsZxNNvI8bs13k/eBmKrKOV2WUP1mHRzSoxPX3gzGRSWCe/7QR51oWlB +Qkb6OGVGLCKPnhIKFeZ6G1Qv8q7/hOOlmWGO4bN7s5fjAKEsm3JV1xrsqSKRofRG +JfdPjQD88jewIAk6xGSMKmc4usQN+y/IfU8yZ57MHSHULccA1Wl/VXfgKCAxS5fK +uXtm -----END CERTIFICATE REQUEST----- diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/client.key b/experimental/packages/otlp-grpc-exporter-base/test/certs/client.key index 9219944ca4..58414d8d59 100644 --- a/experimental/packages/otlp-grpc-exporter-base/test/certs/client.key +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/client.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKAIBAAKCAgEAwFzUX07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UzTh9H5E6S6EORiCaEipK3ehjm8XOIZX+ofF70Bpzg/k7Dielb8Db1TXxRyHO +EqYLnWW7UZcpYrSFqqnPjSaja41oD+ZXu6m4kitxM34LjYZkpkbEhebfGxCcwq36 +kv/fh7WngKv0IWmIJncaFQMl7LzF8Gw/vUKl8Y3TqGNCNBeqOZtyGImqdVT13EOV +o5gSUobeOGTGeCLs9e6zI98AJmAfSRCV+c736JZ9ktg/MT0xpi351bvJ33O88qgK +dOMBKwKCAQAXJAQea2QOZowCK3wbTy8KmeI5uPL+sjtj/Gb+ZI3ge8NbGQXGJi5F +3ckLV8H3QdQv3Waj9qqTVexKCAvf8MMCFR67YahLpIUMKvfqM0e2tmb5deNyOFbg +PHLLuE2urecQkasEGr478HHocsRhXpx03oDl4bcbUNceqo7my0YucoGtB5vczQtI +rKam9XimLHStrpHCwxxfPUnRVgEfT5bzwhWmeoDi4TZ8d0WvhfgtZ4FY1qKqal0v +eTIGFPU7YYTLIJzrn9P4Jr/PVOcUnp8ac4s7nr3KTpA/IKsbbVMGPRKegw7FSddr +ros57KltjQB5+kxlgb8V0FbubXO/a4r1AoIBAQC6GfLZDflLbmGx9cd7OV3nLm5m +hlfKuKwkYa7gKLGgR56/eKbqy/SY+y4K4xQLiNgVyayuUSqd8+fupESaG8J+kY6N +3K7LjdWzYzIJDYnonyqueqsn437CltWG0iBjpPZztexAiI8qk/jVniwIEOHzc4Cb +tPCP51NBbj0dSP9EFB+LbHh2F+zO0DkraA4P+bvKA6GLtfRPfqBi2rz9VVIvV0oR +sM6qfGJVECOxAc5seFSUO8RzEoNf5KQ+ATeRhWJQqGIhw+lP23w1rDv8FOWgxoxw +9O4IfGsSH6V+KYMN7wDx1Sebpw2IosCoGOjWHSH7mJcWy/uqocAirdf5fEeE -----END RSA PRIVATE KEY----- diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/regenerate.sh b/experimental/packages/otlp-grpc-exporter-base/test/certs/regenerate.sh index e1f1af5b54..84637be753 100755 --- a/experimental/packages/otlp-grpc-exporter-base/test/certs/regenerate.sh +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/regenerate.sh @@ -8,15 +8,15 @@ rm ca.crt ca.key client.crt client.csr client.key server.crt server.csr server.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 -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 -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 -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 -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 +openssl genrsa -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/experimental/packages/otlp-grpc-exporter-base/test/certs/server.crt b/experimental/packages/otlp-grpc-exporter-base/test/certs/server.crt index 09094e4526..ace156a29e 100644 --- a/experimental/packages/otlp-grpc-exporter-base/test/certs/server.crt +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/server.crt @@ -1,31 +1,31 @@ -----BEGIN CERTIFICATE----- MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v -dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjEwNjA3MjAyNzMyWhcN -MjIwNjA3MjAyNzMyWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjMwNjA4MTY0NDI0WhcN +MjQwNjA3MTY0NDI0WjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZT ZXJ2ZXIxEjAQBgNVBAMMCWxvY2FsaG9zdDCCAiIwDQYJKoZIhvcNAQEBBQADggIP -ADCCAgoCggIBANaRv7jpdEedG0CQ/LoJEXuE32eZXzar45u05wq5CzqnUlYdHyx8 -cgCJJ44KThFXiOzgELFiiwjxmPo1CDLqGp8vEDHntvhxLhw/mFy/aa7YrCv1/1eX -0+cEvNUyoikjHKXECI7sV1ZVMrimGKXQNqRfub1JbJ+IzL+kp6MRtdA6GzxsU0Dg -Wwf7IQxtCQ4Tw3onJ3P3NZAkgz6zCVhOVkR7DuqGulzTQDa//mWwKQJie5wscURj -vLsJ0prS16Tc/5yXijwRjwx8ZEoDrJ5KszoMQwKIoLN7wHBo2r8/8RQsOGTVMJ1I -9kOkH3s9clswxCrnpzdNNmyIwTWaQ6CqpQpp0unGimF3VokanHhOhcpkWfzDArmU -jL4PIFBQBJvHIEKbuhZ4pUYL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ps0uX0hcs3jsvZOkBWptusvJBfZN59xLJAVmF2igkgIBKoiXvXmv +fXDx0hsOBg2IPe2O8lLHlFKlJZlMc+prH1iD0Xv6HefSP4L1eZHU37zjrRf/GiNX +r6GoEhJR2pKEoZQT81xpYp/w+qjzWcTl/mLD6FEePRzV92h3ubjRWBB36UhLtnEG +LJgp7yq3aGu7rg9rnuz8J6DG8DStE9rNuRjkV1O2C/PvR97XmVoIqbrMlxX9MUQJ +XxLm5dqBz7EVuhDJSyp4zCkDYsOj1y/SLL2O3cTyQQeZg6jlqripNqWnviAdTWe5 +JIPp -----END CERTIFICATE----- diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/server.csr b/experimental/packages/otlp-grpc-exporter-base/test/certs/server.csr index bb61322340..b421a7a60c 100644 --- a/experimental/packages/otlp-grpc-exporter-base/test/certs/server.csr +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/server.csr @@ -2,27 +2,27 @@ MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGU2Vy dmVyMRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQDWkb+46XRHnRtAkPy6CRF7hN9nmV82q+ObtOcKuQs6p1JWHR8sfHIA -iSeOCk4RV4js4BCxYosI8Zj6NQgy6hqfLxAx57b4cS4cP5hcv2mu2Kwr9f9Xl9Pn -BLzVMqIpIxylxAiO7FdWVTK4phil0DakX7m9SWyfiMy/pKejEbXQOhs8bFNA4FsH -+yEMbQkOE8N6Jydz9zWQJIM+swlYTlZEew7qhrpc00A2v/5lsCkCYnucLHFEY7y7 -CdKa0tek3P+cl4o8EY8MfGRKA6yeSrM6DEMCiKCze8BwaNq/P/EULDhk1TCdSPZD -pB97PXJbMMQq56c3TTZsiME1mkOgqqUKadLpxophd1aJ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ufVGFpbDkfYwAJxWx44Eg0X90j +gJUw8IRuHQZkEYss6jwFMFcOqjpe+AqrssOl4GZmu5gcaiUnj8PkSVZLTOrLilPg +sSDjzmoHdv4QcBppTrjj6PyR5Xd6DeGasWkMPvIPjiPN3mOhfxJ3C87atMqOhTLx +em7vFOBegAW6g40J9JD1XMoI/zFnTU8NevZQgCyx/Tq1XNRmUeMA6y/qpfTNKi/f +F7v/7nDWoxBgpOw3J0E9R+6rxD7Cjb2RWZEf20ZGdNBlPE+UG9c9b3HC3IHiwRHb +L9Fi0251w+fkaPX8dojQKErCEknqJ1SCP5S5F5g1QCQby22Y7LQsggMMf94s/wQX +4uMh -----END CERTIFICATE REQUEST----- diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/server.key b/experimental/packages/otlp-grpc-exporter-base/test/certs/server.key index ddac188c23..80b9cea7bf 100644 --- a/experimental/packages/otlp-grpc-exporter-base/test/certs/server.key +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/server.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKAIBAAKCAgEA1pG/uOl0R50bQJD8ugkRe4TfZ5lfNqvjm7TnCrkLOqdSVh0f -LHxyAIknjgpOEVeI7OAQsWKLCPGY+jUIMuoany8QMee2+HEuHD+YXL9prtisK/X/ -V5fT5wS81TKiKSMcpcQIjuxXVlUyuKYYpdA2pF+5vUlsn4jMv6SnoxG10DobPGxT -QOBbB/shDG0JDhPDeicnc/c1kCSDPrMJWE5WRHsO6oa6XNNANr/+ZbApAmJ7nCxx -RGO8uwnSmtLXpNz/nJeKPBGPDHxkSgOsnkqzOgxDAoigs3vAcGjavz/xFCw4ZNUw -nUj2Q6Qfez1yWzDEKuenN002bIjBNZpDoKqlCmnS6caKYXdWiRqceE6FymRZ/MMC -uZSMvg8gUFAEm8cgQpu6FnilRgv/pG2ASDZ/fFU97yzSGf8PPAlOBeoRf5Njta8g -qYfSwwZn1NnNZ71brgszb/jbv7ql+BA4AkMc0t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9d10VEttwFPtnH5PIhX3pHpOm1onFI6t8dZWOiB5bhhAhDVceEz9BB +M0RPIBam+Zx9HQiBx5Cy9wHqN7rUJdh050RpCHo3PkqNz8M87NRV38QiOzx8FO1K +XytYvoHp6xC7Wd2uAU11IVdsipyPeifNAoIBAQCw47tJyyss2FqqXGl6IDEXFk12 +mcgrRuPnohAF7Z49/jp5wruYd8heyQdMGk8Z3l+OSFsdMIKxNDWbPuItxK/pCVRM +OooNEdM2uHAighJR9x9/kXFB3j7YuqbTbEz7MvLd+AJVfUos+zwcTuj7q72XGMsb +Gt4jRsrgeDA+paiavKKWyGgw125xXUx1xOUvhGJfL+MB3XTHdOb9nyaDANMw4MN2 +Ff18SMRkj0NzqmRaoEPg5dP0ORcpWJjM5R7Qt6FLnyfx2dhWNltyBBtgSTEVAjoN +Gcr4EgpmFEpA3aaG5QmYYJ/b9m2mWUpnr1iVmeDvadKu9IAi7LgPpV26ar4D -----END RSA PRIVATE KEY----- diff --git a/experimental/packages/otlp-grpc-exporter-base/test/util.test.ts b/experimental/packages/otlp-grpc-exporter-base/test/util.test.ts index c25f086f8c..967ece6716 100644 --- a/experimental/packages/otlp-grpc-exporter-base/test/util.test.ts +++ b/experimental/packages/otlp-grpc-exporter-base/test/util.test.ts @@ -47,6 +47,11 @@ describe('validateAndNormalizeUrl()', () => { input: 'https://api.datacat.io:1234', expected: 'api.datacat.io:1234', }, + { + name: 'should accept unix socket', + input: 'unix:///tmp/grpc.sock', + expected: 'unix:///tmp/grpc.sock', + }, { name: 'bad protocol should warn but return host:port', input: 'badproto://api.datacat.io:1234', diff --git a/experimental/packages/otlp-proto-exporter-base/.eslintrc.js b/experimental/packages/otlp-proto-exporter-base/.eslintrc.js index 3ed0fbeba3..9cfb3fd423 100644 --- a/experimental/packages/otlp-proto-exporter-base/.eslintrc.js +++ b/experimental/packages/otlp-proto-exporter-base/.eslintrc.js @@ -4,5 +4,5 @@ module.exports = { "commonjs": true, "node": true, }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/otlp-proto-exporter-base/package.json b/experimental/packages/otlp-proto-exporter-base/package.json index 29018d61b4..602bbd9a5b 100644 --- a/experimental/packages/otlp-proto-exporter-base/package.json +++ b/experimental/packages/otlp-proto-exporter-base/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/otlp-proto-exporter-base", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenTelemetry OTLP-HTTP-protobuf Exporter base (for internal use only)", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -24,7 +24,7 @@ "submodule": "git submodule sync --recursive && git submodule update --init --recursive", "version": "node ../../../scripts/version-update.js", "watch": "npm run protos && tsc -w tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile" }, "keywords": [ @@ -59,16 +59,18 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", - "@opentelemetry/api": "1.4.1", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@opentelemetry/api": "1.6.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "codecov": "3.8.3", - "mocha": "10.0.0", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "protobufjs-cli": "1.0.2", - "sinon": "15.0.0", + "protobufjs-cli": "1.1.2", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4" @@ -77,9 +79,9 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/otlp-exporter-base": "0.39.1", - "protobufjs": "^7.1.2" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/otlp-exporter-base": "0.44.0", + "protobufjs": "^7.2.3" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/otlp-proto-exporter-base", "sideEffects": false diff --git a/experimental/packages/otlp-proto-exporter-base/src/platform/browser/OTLPProtoExporterBrowserBase.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/browser/OTLPProtoExporterBrowserBase.ts index 34c80d6e82..4bc9e5c70a 100644 --- a/experimental/packages/otlp-proto-exporter-base/src/platform/browser/OTLPProtoExporterBrowserBase.ts +++ b/experimental/packages/otlp-proto-exporter-base/src/platform/browser/OTLPProtoExporterBrowserBase.ts @@ -30,7 +30,7 @@ import { getExportRequestProto } from '../util'; */ export abstract class OTLPProtoExporterBrowserBase< ExportItem, - ServiceRequest + ServiceRequest, > extends OTLPExporterBaseMain { constructor(config: OTLPExporterConfigBase = {}) { super(config); diff --git a/experimental/packages/otlp-proto-exporter-base/src/platform/node/OTLPProtoExporterNodeBase.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/node/OTLPProtoExporterNodeBase.ts index c0ff4b6b39..17804c47b4 100644 --- a/experimental/packages/otlp-proto-exporter-base/src/platform/node/OTLPProtoExporterNodeBase.ts +++ b/experimental/packages/otlp-proto-exporter-base/src/platform/node/OTLPProtoExporterNodeBase.ts @@ -36,7 +36,7 @@ type SendFn = ( */ export abstract class OTLPProtoExporterNodeBase< ExportItem, - ServiceRequest + ServiceRequest, > extends OTLPExporterBaseMain { private _send!: SendFn; diff --git a/experimental/packages/otlp-proto-exporter-base/src/platform/util.ts b/experimental/packages/otlp-proto-exporter-base/src/platform/util.ts index c6e1272816..2fe428b432 100644 --- a/experimental/packages/otlp-proto-exporter-base/src/platform/util.ts +++ b/experimental/packages/otlp-proto-exporter-base/src/platform/util.ts @@ -16,6 +16,7 @@ import * as root from '../generated/root'; import { ServiceClientType } from './types'; +import type * as protobuf from 'protobufjs'; export interface ExportRequestType unknown }> { create(properties?: T): R; diff --git a/experimental/packages/otlp-transformer/.eslintrc.js b/experimental/packages/otlp-transformer/.eslintrc.js index b9004d2025..0fe1bbf975 100644 --- a/experimental/packages/otlp-transformer/.eslintrc.js +++ b/experimental/packages/otlp-transformer/.eslintrc.js @@ -4,5 +4,5 @@ module.exports = { "commonjs": true, "shared-node-browser": true }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/otlp-transformer/package.json b/experimental/packages/otlp-transformer/package.json index cc1e43642e..de2ef27e53 100644 --- a/experimental/packages/otlp-transformer/package.json +++ b/experimental/packages/otlp-transformer/package.json @@ -4,7 +4,7 @@ "publishConfig": { "access": "public" }, - "version": "0.39.1", + "version": "0.44.0", "description": "Transform OpenTelemetry SDK data into OTLP", "module": "build/esm/index.js", "esnext": "build/esnext/index.js", @@ -13,13 +13,15 @@ "repository": "open-telemetry/opentelemetry-js", "scripts": { "prepublishOnly": "npm run compile", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", + "prewatch": "node ../../../scripts/version-update.js", "watch": "tsc --build -w tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "peer-api-check": "node ../../../scripts/peer-api-check.js", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" @@ -52,23 +54,23 @@ "README.md" ], "peerDependencies": { - "@opentelemetry/api": ">=1.3.0 <1.5.0" + "@opentelemetry/api": ">=1.3.0 <1.7.0" }, "devDependencies": { - "@opentelemetry/api": "1.4.1", - "@opentelemetry/api-logs": "0.39.1", - "@opentelemetry/sdk-logs": "0.39.1", - "@types/mocha": "10.0.0", + "@opentelemetry/api": "1.6.0", + "@types/mocha": "10.0.2", "@types/webpack-env": "1.16.3", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", @@ -76,12 +78,12 @@ "webpack": "4.46.0" }, "dependencies": { - "@opentelemetry/api-logs": "0.39.1", - "@opentelemetry/core": "1.13.0", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/sdk-logs": "0.39.1", - "@opentelemetry/sdk-metrics": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0" + "@opentelemetry/api-logs": "0.44.0", + "@opentelemetry/core": "1.17.1", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-logs": "0.44.0", + "@opentelemetry/sdk-metrics": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/otlp-transformer", "sideEffects": false diff --git a/experimental/packages/otlp-transformer/src/common/index.ts b/experimental/packages/otlp-transformer/src/common/index.ts new file mode 100644 index 0000000000..19587be3ae --- /dev/null +++ b/experimental/packages/otlp-transformer/src/common/index.ts @@ -0,0 +1,29 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import type { IFixed64 } from './types'; +import { HrTime } from '@opentelemetry/api'; +import { UnsignedLong } from './unsigned_long'; + +export * from './unsigned_long'; + +const NANOSECONDS = UnsignedLong.fromU32(1_000_000_000); + +export function hrTimeToFixed64Nanos(hrTime: HrTime): IFixed64 { + return UnsignedLong.fromU32(hrTime[0]) + .multiply(NANOSECONDS) + .add(UnsignedLong.fromU32(hrTime[1])); +} diff --git a/experimental/packages/otlp-transformer/src/common/types.ts b/experimental/packages/otlp-transformer/src/common/types.ts index 8b30231e74..6236da4ce6 100644 --- a/experimental/packages/otlp-transformer/src/common/types.ts +++ b/experimental/packages/otlp-transformer/src/common/types.ts @@ -21,6 +21,12 @@ export interface IInstrumentationScope { /** InstrumentationScope version */ version?: string; + + /** InstrumentationScope attributes */ + attributes?: IKeyValue[]; + + /** InstrumentationScope droppedAttributesCount */ + droppedAttributesCount?: number; } /** Properties of a KeyValue. */ @@ -67,3 +73,8 @@ export interface IKeyValueList { /** KeyValueList values */ values: IKeyValue[]; } + +export interface IFixed64 { + low: number; + high: number; +} diff --git a/experimental/packages/otlp-transformer/src/common/unsigned_long.ts b/experimental/packages/otlp-transformer/src/common/unsigned_long.ts new file mode 100644 index 0000000000..d2802e3ba8 --- /dev/null +++ b/experimental/packages/otlp-transformer/src/common/unsigned_long.ts @@ -0,0 +1,122 @@ +/* + * Copyright 2009 The Closure Library Authors + * Copyright 2020 Daniel Wirtz / The long.js Authors. + * 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. + */ + +// Original version by long.js: https://github.com/dcodeIO/long.js/ + +const TWO_PWR_32 = (1 << 16) * (1 << 16); + +export class UnsignedLong { + low: number; + high: number; + + constructor(low: number, high: number) { + this.low = low; + this.high = high; + } + + static fromU32(value: number): UnsignedLong { + return new UnsignedLong(value % TWO_PWR_32 | 0, 0); + } + + multiply(value: UnsignedLong): UnsignedLong { + const a48 = this.high >>> 16; + const a32 = this.high & 0xffff; + const a16 = this.low >>> 16; + const a00 = this.low & 0xffff; + + const b48 = value.high >>> 16; + const b32 = value.high & 0xffff; + const b16 = value.low >>> 16; + const b00 = value.low & 0xffff; + + let c48 = 0; + let c32 = 0; + let c16 = 0; + let c00 = 0; + c00 += a00 * b00; + c16 += c00 >>> 16; + c00 &= 0xffff; + c16 += a16 * b00; + c32 += c16 >>> 16; + c16 &= 0xffff; + c16 += a00 * b16; + c32 += c16 >>> 16; + c16 &= 0xffff; + c32 += a32 * b00; + c48 += c32 >>> 16; + c32 &= 0xffff; + c32 += a16 * b16; + c48 += c32 >>> 16; + c32 &= 0xffff; + c32 += a00 * b32; + c48 += c32 >>> 16; + c32 &= 0xffff; + c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; + c48 &= 0xffff; + + return new UnsignedLong((c16 << 16) | c00, (c48 << 16) | c32); + } + + add(value: UnsignedLong): UnsignedLong { + const a48 = this.high >>> 16; + const a32 = this.high & 0xffff; + const a16 = this.low >>> 16; + const a00 = this.low & 0xffff; + + const b48 = value.high >>> 16; + const b32 = value.high & 0xffff; + const b16 = value.low >>> 16; + const b00 = value.low & 0xffff; + + let c48 = 0; + let c32 = 0; + let c16 = 0; + let c00 = 0; + c00 += a00 + b00; + c16 += c00 >>> 16; + c00 &= 0xffff; + c16 += a16 + b16; + c32 += c16 >>> 16; + c16 &= 0xffff; + c32 += a32 + b32; + c48 += c32 >>> 16; + c32 &= 0xffff; + c48 += a48 + b48; + c48 &= 0xffff; + + return new UnsignedLong((c16 << 16) | c00, (c48 << 16) | c32); + } + + static fromString(str: string): UnsignedLong { + let result = UnsignedLong.fromU32(0); + + for (let i = 0; i < str.length; i += 8) { + const size = Math.min(8, str.length - i); + const value = parseInt(str.substring(i, i + size)); + if (size < 8) { + const power = UnsignedLong.fromU32(Math.pow(10, size)); + result = result.multiply(power).add(UnsignedLong.fromU32(value)); + } else { + result = result.multiply(UnsignedLong.fromU32(100_000_000)); + result = result.add(UnsignedLong.fromU32(value)); + } + } + + return result; + } +} diff --git a/experimental/packages/otlp-transformer/src/index.ts b/experimental/packages/otlp-transformer/src/index.ts index a8e388e33a..9c325644dc 100644 --- a/experimental/packages/otlp-transformer/src/index.ts +++ b/experimental/packages/otlp-transformer/src/index.ts @@ -15,6 +15,7 @@ */ export * from './common/types'; +export * from './common'; export * from './metrics/types'; export * from './resource/types'; export * from './trace/types'; diff --git a/experimental/packages/otlp-transformer/src/logs/index.ts b/experimental/packages/otlp-transformer/src/logs/index.ts index c499476498..bffb7966dd 100644 --- a/experimental/packages/otlp-transformer/src/logs/index.ts +++ b/experimental/packages/otlp-transformer/src/logs/index.ts @@ -22,8 +22,9 @@ import { IResourceLogs, } from './types'; import { IResource } from '@opentelemetry/resources'; +import { hrTimeToFixed64Nanos } from '../common'; import { toAnyValue, toAttributes, toKeyValue } from '../common/internal'; -import { hexToBase64, hrTimeToNanoseconds } from '@opentelemetry/core'; +import { hexToBase64 } from '@opentelemetry/core'; import { SeverityNumber } from '@opentelemetry/api-logs'; import { IKeyValue } from '../common/types'; import { LogAttributes } from '@opentelemetry/api-logs'; @@ -94,8 +95,8 @@ function logRecordsToResourceLogs( function toLogRecord(log: ReadableLogRecord, useHex?: boolean): ILogRecord { return { - timeUnixNano: hrTimeToNanoseconds(log.hrTime), - observedTimeUnixNano: hrTimeToNanoseconds(log.hrTimeObserved), + timeUnixNano: hrTimeToFixed64Nanos(log.hrTime), + observedTimeUnixNano: hrTimeToFixed64Nanos(log.hrTimeObserved), severityNumber: toSeverityNumber(log.severityNumber), severityText: log.severityText, body: toAnyValue(log.body), diff --git a/experimental/packages/otlp-transformer/src/logs/types.ts b/experimental/packages/otlp-transformer/src/logs/types.ts index 3d3e610bc7..7704c37083 100644 --- a/experimental/packages/otlp-transformer/src/logs/types.ts +++ b/experimental/packages/otlp-transformer/src/logs/types.ts @@ -16,6 +16,7 @@ import type { IAnyValue, + IFixed64, IInstrumentationScope, IKeyValue, } from '../common/types'; @@ -27,6 +28,19 @@ export interface IExportLogsServiceRequest { resourceLogs?: IResourceLogs[]; } +export interface IExportLogsServiceResponse { + /** ExportLogsServiceResponse partialSuccess */ + partialSuccess?: IExportLogsPartialSuccess; +} + +export interface IExportLogsPartialSuccess { + /** ExportLogsPartialSuccess rejectedLogRecords */ + rejectedLogRecords?: number; + + /** ExportLogsPartialSuccess errorMessage */ + errorMessage?: string; +} + /** Properties of a ResourceLogs. */ export interface IResourceLogs { /** ResourceLogs resource */ @@ -54,10 +68,10 @@ export interface IScopeLogs { /** Properties of a LogRecord. */ export interface ILogRecord { /** LogRecord timeUnixNano */ - timeUnixNano: number; + timeUnixNano: IFixed64; /** LogRecord observedTimeUnixNano */ - observedTimeUnixNano: number; + observedTimeUnixNano: IFixed64; /** LogRecord severityNumber */ severityNumber?: ESeverityNumber; diff --git a/experimental/packages/otlp-transformer/src/metrics/internal.ts b/experimental/packages/otlp-transformer/src/metrics/internal.ts index b73696b0ab..670741eb30 100644 --- a/experimental/packages/otlp-transformer/src/metrics/internal.ts +++ b/experimental/packages/otlp-transformer/src/metrics/internal.ts @@ -14,7 +14,6 @@ * limitations under the License. */ import { ValueType } from '@opentelemetry/api'; -import { hrTimeToNanoseconds } from '@opentelemetry/core'; import { AggregationTemporality, DataPoint, @@ -25,6 +24,7 @@ import { ResourceMetrics, ScopeMetrics, } from '@opentelemetry/sdk-metrics'; +import { hrTimeToFixed64Nanos } from '../common'; import { toAttributes } from '../common/internal'; import { EAggregationTemporality, @@ -112,8 +112,8 @@ function toSingularDataPoint( ) { const out: INumberDataPoint = { attributes: toAttributes(dataPoint.attributes), - startTimeUnixNano: hrTimeToNanoseconds(dataPoint.startTime), - timeUnixNano: hrTimeToNanoseconds(dataPoint.endTime), + startTimeUnixNano: hrTimeToFixed64Nanos(dataPoint.startTime), + timeUnixNano: hrTimeToFixed64Nanos(dataPoint.endTime), }; switch (valueType) { @@ -145,8 +145,8 @@ function toHistogramDataPoints(metricData: MetricData): IHistogramDataPoint[] { sum: histogram.sum, min: histogram.min, max: histogram.max, - startTimeUnixNano: hrTimeToNanoseconds(dataPoint.startTime), - timeUnixNano: hrTimeToNanoseconds(dataPoint.endTime), + startTimeUnixNano: hrTimeToFixed64Nanos(dataPoint.startTime), + timeUnixNano: hrTimeToFixed64Nanos(dataPoint.endTime), }; }); } @@ -172,8 +172,8 @@ function toExponentialHistogramDataPoints( }, scale: histogram.scale, zeroCount: histogram.zeroCount, - startTimeUnixNano: hrTimeToNanoseconds(dataPoint.startTime), - timeUnixNano: hrTimeToNanoseconds(dataPoint.endTime), + startTimeUnixNano: hrTimeToFixed64Nanos(dataPoint.startTime), + timeUnixNano: hrTimeToFixed64Nanos(dataPoint.endTime), }; }); } diff --git a/experimental/packages/otlp-transformer/src/metrics/types.ts b/experimental/packages/otlp-transformer/src/metrics/types.ts index 6db9c17a9b..65a2348516 100644 --- a/experimental/packages/otlp-transformer/src/metrics/types.ts +++ b/experimental/packages/otlp-transformer/src/metrics/types.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { IInstrumentationScope, IKeyValue } from '../common/types'; +import { IFixed64, IInstrumentationScope, IKeyValue } from '../common/types'; import { IResource } from '../resource/types'; /** Properties of an ExportMetricsServiceRequest. */ @@ -22,6 +22,19 @@ export interface IExportMetricsServiceRequest { resourceMetrics: IResourceMetrics[]; } +export interface IExportMetricsServiceResponse { + /** ExportMetricsServiceResponse partialSuccess */ + partialSuccess?: IExportMetricsPartialSuccess; +} + +export interface IExportMetricsPartialSuccess { + /** ExportMetricsPartialSuccess rejectedDataPoints */ + rejectedDataPoints?: number; + + /** ExportMetricsPartialSuccess errorMessage */ + errorMessage?: string; +} + /** Properties of a ResourceMetrics. */ export interface IResourceMetrics { /** ResourceMetrics resource */ @@ -121,10 +134,10 @@ export interface INumberDataPoint { attributes: IKeyValue[]; /** NumberDataPoint startTimeUnixNano */ - startTimeUnixNano?: number; + startTimeUnixNano?: IFixed64 | string; /** NumberDataPoint timeUnixNano */ - timeUnixNano?: number; + timeUnixNano?: IFixed64 | string; /** NumberDataPoint asDouble */ asDouble?: number | null; @@ -145,10 +158,10 @@ export interface IHistogramDataPoint { attributes?: IKeyValue[]; /** HistogramDataPoint startTimeUnixNano */ - startTimeUnixNano?: number; + startTimeUnixNano?: IFixed64 | string; /** HistogramDataPoint timeUnixNano */ - timeUnixNano?: number; + timeUnixNano?: IFixed64 | string; /** HistogramDataPoint count */ count?: number; @@ -181,10 +194,10 @@ export interface IExponentialHistogramDataPoint { attributes?: IKeyValue[]; /** ExponentialHistogramDataPoint startTimeUnixNano */ - startTimeUnixNano?: number; + startTimeUnixNano?: IFixed64 | string; /** ExponentialHistogramDataPoint timeUnixNano */ - timeUnixNano?: number; + timeUnixNano?: IFixed64 | string; /** ExponentialHistogramDataPoint count */ count?: number; diff --git a/experimental/packages/otlp-transformer/src/trace/internal.ts b/experimental/packages/otlp-transformer/src/trace/internal.ts index 6811a8182f..d9c17855ce 100644 --- a/experimental/packages/otlp-transformer/src/trace/internal.ts +++ b/experimental/packages/otlp-transformer/src/trace/internal.ts @@ -14,8 +14,8 @@ * limitations under the License. */ import type { Link } from '@opentelemetry/api'; -import { hrTimeToNanoseconds } from '@opentelemetry/core'; import type { ReadableSpan, TimedEvent } from '@opentelemetry/sdk-trace-base'; +import { hrTimeToFixed64Nanos } from '../common'; import { toAttributes } from '../common/internal'; import { EStatusCode, IEvent, ILink, ISpan } from './types'; import * as core from '@opentelemetry/core'; @@ -36,8 +36,8 @@ export function sdkSpanToOtlpSpan(span: ReadableSpan, useHex?: boolean): ISpan { name: span.name, // Span kind is offset by 1 because the API does not define a value for unset kind: span.kind == null ? 0 : span.kind + 1, - startTimeUnixNano: hrTimeToNanoseconds(span.startTime), - endTimeUnixNano: hrTimeToNanoseconds(span.endTime), + startTimeUnixNano: hrTimeToFixed64Nanos(span.startTime), + endTimeUnixNano: hrTimeToFixed64Nanos(span.endTime), attributes: toAttributes(span.attributes), droppedAttributesCount: span.droppedAttributesCount, events: span.events.map(toOtlpSpanEvent), @@ -72,7 +72,7 @@ export function toOtlpSpanEvent(timedEvent: TimedEvent): IEvent { ? toAttributes(timedEvent.attributes) : [], name: timedEvent.name, - timeUnixNano: hrTimeToNanoseconds(timedEvent.time), + timeUnixNano: hrTimeToFixed64Nanos(timedEvent.time), droppedAttributesCount: timedEvent.droppedAttributesCount || 0, }; } diff --git a/experimental/packages/otlp-transformer/src/trace/types.ts b/experimental/packages/otlp-transformer/src/trace/types.ts index 08e52c7a06..294f45652f 100644 --- a/experimental/packages/otlp-transformer/src/trace/types.ts +++ b/experimental/packages/otlp-transformer/src/trace/types.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { IInstrumentationScope, IKeyValue } from '../common/types'; +import { IFixed64, IInstrumentationScope, IKeyValue } from '../common/types'; import { IResource } from '../resource/types'; /** Properties of an ExportTraceServiceRequest. */ @@ -23,6 +23,19 @@ export interface IExportTraceServiceRequest { resourceSpans?: IResourceSpans[]; } +export interface IExportTraceServiceResponse { + /** ExportTraceServiceResponse partialSuccess */ + partialSuccess?: IExportTracePartialSuccess; +} + +export interface IExportTracePartialSuccess { + /** ExportLogsServiceResponse rejectedLogRecords */ + rejectedSpans?: number; + + /** ExportLogsServiceResponse errorMessage */ + errorMessage?: string; +} + /** Properties of a ResourceSpans. */ export interface IResourceSpans { /** ResourceSpans resource */ @@ -68,10 +81,10 @@ export interface ISpan { kind: ESpanKind; /** Span startTimeUnixNano */ - startTimeUnixNano: number; + startTimeUnixNano: IFixed64; /** Span endTimeUnixNano */ - endTimeUnixNano: number; + endTimeUnixNano: IFixed64; /** Span attributes */ attributes: IKeyValue[]; @@ -153,7 +166,7 @@ export const enum EStatusCode { /** Properties of an Event. */ export interface IEvent { /** Event timeUnixNano */ - timeUnixNano: number; + timeUnixNano: IFixed64; /** Event name */ name: string; diff --git a/experimental/packages/otlp-transformer/test/logs.test.ts b/experimental/packages/otlp-transformer/test/logs.test.ts index ef0a4cf9d7..0937c7d152 100644 --- a/experimental/packages/otlp-transformer/test/logs.test.ts +++ b/experimental/packages/otlp-transformer/test/logs.test.ts @@ -21,6 +21,7 @@ import { createExportLogsServiceRequest, ESeverityNumber, IExportLogsServiceRequest, + UnsignedLong, } from '../src'; import { ReadableLogRecord } from '@opentelemetry/sdk-logs'; import { SeverityNumber } from '@opentelemetry/api-logs'; @@ -49,10 +50,8 @@ function createExpectedLogJson(useHex: boolean): IExportLogsServiceRequest { scope: { name: 'scope_name_1', version: '0.1.0' }, logRecords: [ { - // eslint-disable-next-line @typescript-eslint/no-loss-of-precision - timeUnixNano: 1680253513123241635, - // eslint-disable-next-line @typescript-eslint/no-loss-of-precision - observedTimeUnixNano: 1683526948965142784, + timeUnixNano: new UnsignedLong(-162521437, 391214506), + observedTimeUnixNano: new UnsignedLong(584929536, 391976663), severityNumber: ESeverityNumber.SEVERITY_NUMBER_ERROR, severityText: 'error', body: { stringValue: 'some_log_body' }, diff --git a/experimental/packages/otlp-transformer/test/metrics.test.ts b/experimental/packages/otlp-transformer/test/metrics.test.ts index 748ef75889..15fd7d0531 100644 --- a/experimental/packages/otlp-transformer/test/metrics.test.ts +++ b/experimental/packages/otlp-transformer/test/metrics.test.ts @@ -25,7 +25,8 @@ import { import * as assert from 'assert'; import { createExportMetricsServiceRequest } from '../src/metrics'; import { EAggregationTemporality } from '../src/metrics/types'; -import { hrTime, hrTimeToNanoseconds } from '@opentelemetry/core'; +import { hrTime } from '@opentelemetry/core'; +import { hrTimeToFixed64Nanos } from '../src/common'; const START_TIME = hrTime(); const END_TIME = hrTime(); @@ -350,8 +351,8 @@ describe('Metrics', () => { dataPoints: [ { attributes: expectedAttributes, - startTimeUnixNano: hrTimeToNanoseconds(START_TIME), - timeUnixNano: hrTimeToNanoseconds(END_TIME), + startTimeUnixNano: hrTimeToFixed64Nanos(START_TIME), + timeUnixNano: hrTimeToFixed64Nanos(END_TIME), asInt: 10, }, ], @@ -393,8 +394,8 @@ describe('Metrics', () => { dataPoints: [ { attributes: expectedAttributes, - startTimeUnixNano: hrTimeToNanoseconds(START_TIME), - timeUnixNano: hrTimeToNanoseconds(END_TIME), + startTimeUnixNano: hrTimeToFixed64Nanos(START_TIME), + timeUnixNano: hrTimeToFixed64Nanos(END_TIME), asInt: 10, }, ], @@ -437,8 +438,8 @@ describe('Metrics', () => { dataPoints: [ { attributes: expectedAttributes, - startTimeUnixNano: hrTimeToNanoseconds(START_TIME), - timeUnixNano: hrTimeToNanoseconds(END_TIME), + startTimeUnixNano: hrTimeToFixed64Nanos(START_TIME), + timeUnixNano: hrTimeToFixed64Nanos(END_TIME), asInt: 10, }, ], @@ -481,8 +482,8 @@ describe('Metrics', () => { dataPoints: [ { attributes: expectedAttributes, - startTimeUnixNano: hrTimeToNanoseconds(START_TIME), - timeUnixNano: hrTimeToNanoseconds(END_TIME), + startTimeUnixNano: hrTimeToFixed64Nanos(START_TIME), + timeUnixNano: hrTimeToFixed64Nanos(END_TIME), asInt: 10, }, ], @@ -523,8 +524,8 @@ describe('Metrics', () => { dataPoints: [ { attributes: expectedAttributes, - startTimeUnixNano: hrTimeToNanoseconds(START_TIME), - timeUnixNano: hrTimeToNanoseconds(END_TIME), + startTimeUnixNano: hrTimeToFixed64Nanos(START_TIME), + timeUnixNano: hrTimeToFixed64Nanos(END_TIME), asDouble: 10.5, }, ], @@ -581,8 +582,8 @@ describe('Metrics', () => { sum: 9, min: 1, max: 8, - startTimeUnixNano: hrTimeToNanoseconds(START_TIME), - timeUnixNano: hrTimeToNanoseconds(END_TIME), + startTimeUnixNano: hrTimeToFixed64Nanos(START_TIME), + timeUnixNano: hrTimeToFixed64Nanos(END_TIME), }, ], }, @@ -635,8 +636,8 @@ describe('Metrics', () => { sum: 9, min: undefined, max: undefined, - startTimeUnixNano: hrTimeToNanoseconds(START_TIME), - timeUnixNano: hrTimeToNanoseconds(END_TIME), + startTimeUnixNano: hrTimeToFixed64Nanos(START_TIME), + timeUnixNano: hrTimeToFixed64Nanos(END_TIME), }, ], }, @@ -701,8 +702,8 @@ describe('Metrics', () => { bucketCounts: [1, 0, 0, 0, 1, 0, 1, 0], }, negative: { offset: 0, bucketCounts: [0] }, - startTimeUnixNano: hrTimeToNanoseconds(START_TIME), - timeUnixNano: hrTimeToNanoseconds(END_TIME), + startTimeUnixNano: hrTimeToFixed64Nanos(START_TIME), + timeUnixNano: hrTimeToFixed64Nanos(END_TIME), }, ], }, @@ -763,8 +764,8 @@ describe('Metrics', () => { bucketCounts: [1, 0, 0, 0, 1, 0, 1, 0], }, negative: { offset: 0, bucketCounts: [0] }, - startTimeUnixNano: hrTimeToNanoseconds(START_TIME), - timeUnixNano: hrTimeToNanoseconds(END_TIME), + startTimeUnixNano: hrTimeToFixed64Nanos(START_TIME), + timeUnixNano: hrTimeToFixed64Nanos(END_TIME), }, ], }, diff --git a/experimental/packages/otlp-transformer/test/trace.test.ts b/experimental/packages/otlp-transformer/test/trace.test.ts index 9fb0e3cbfb..380c9065c2 100644 --- a/experimental/packages/otlp-transformer/test/trace.test.ts +++ b/experimental/packages/otlp-transformer/test/trace.test.ts @@ -22,6 +22,7 @@ import { createExportTraceServiceRequest, ESpanKind, EStatusCode, + UnsignedLong, } from '../src'; function createExpectedSpanJson(useHex: boolean) { @@ -79,10 +80,8 @@ function createExpectedSpanJson(useHex: boolean) { ], }, ], - // eslint-disable-next-line @typescript-eslint/no-loss-of-precision - startTimeUnixNano: 1640715557342725388, - // eslint-disable-next-line @typescript-eslint/no-loss-of-precision - endTimeUnixNano: 1640715558642725388, + startTimeUnixNano: new UnsignedLong(1155450124, 382008859), + endTimeUnixNano: new UnsignedLong(-1839517172, 382008859), events: [ { droppedAttributesCount: 0, @@ -95,7 +94,7 @@ function createExpectedSpanJson(useHex: boolean) { }, ], name: 'some event', - timeUnixNano: 1640715558542725400, + timeUnixNano: new UnsignedLong(-1939517172, 382008859), }, ], attributes: [ diff --git a/experimental/packages/sdk-logs/.eslintrc.js b/experimental/packages/sdk-logs/.eslintrc.js index 0c986a856c..fc24af194b 100644 --- a/experimental/packages/sdk-logs/.eslintrc.js +++ b/experimental/packages/sdk-logs/.eslintrc.js @@ -3,5 +3,5 @@ module.exports = { mocha: true, node: true, }, - ...require('../../../eslint.config.js'), + ...require('../../../eslint.base.js'), }; diff --git a/experimental/packages/sdk-logs/package.json b/experimental/packages/sdk-logs/package.json index f4222cb545..2bff60bbdd 100644 --- a/experimental/packages/sdk-logs/package.json +++ b/experimental/packages/sdk-logs/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-logs", - "version": "0.39.1", + "version": "0.44.0", "publishConfig": { "access": "public" }, @@ -33,7 +33,7 @@ "compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "tdd": "npm run test -- --watch-extensions ts --watch", "tdd:browser": "karma start", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", @@ -41,7 +41,7 @@ "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "node ../../../scripts/version-update.js", "peer-api-check": "node ../../../scripts/peer-api-check.js" }, @@ -68,30 +68,38 @@ ], "sideEffects": false, "peerDependencies": { - "@opentelemetry/api": ">=1.4.0 <1.5.0", + "@opentelemetry/api": ">=1.4.0 <1.7.0", "@opentelemetry/api-logs": ">=0.39.1" }, "devDependencies": { - "@opentelemetry/api": ">=1.4.0 <1.5.0", - "@opentelemetry/api-logs": "0.39.1", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@opentelemetry/api": ">=1.4.0 <1.7.0", + "@opentelemetry/api-logs": "0.44.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "14.0.0", + "sinon": "15.1.2", + "ts-loader": "8.4.0", "ts-mocha": "10.0.0", - "typescript": "4.4.4" + "typescript": "4.4.4", + "webpack": "4.46.0", + "webpack-cli": "4.10.0", + "webpack-merge": "5.9.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/resources": "1.13.0" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/resources": "1.17.1" } } diff --git a/experimental/packages/sdk-logs/src/LogRecord.ts b/experimental/packages/sdk-logs/src/LogRecord.ts index d184004e6b..ed76d5eb07 100644 --- a/experimental/packages/sdk-logs/src/LogRecord.ts +++ b/experimental/packages/sdk-logs/src/LogRecord.ts @@ -26,8 +26,8 @@ import type { IResource } from '@opentelemetry/resources'; import type { ReadableLogRecord } from './export/ReadableLogRecord'; import type { LogRecordLimits } from './types'; -import { Logger } from './Logger'; import { LogAttributes } from '@opentelemetry/api-logs'; +import { LoggerProviderSharedState } from './internal/LoggerProviderSharedState'; export class LogRecord implements ReadableLogRecord { readonly hrTime: api.HrTime; @@ -41,7 +41,7 @@ export class LogRecord implements ReadableLogRecord { private _body?: string; private _isReadonly: boolean = false; - private readonly _logRecordLimits: LogRecordLimits; + private readonly _logRecordLimits: Required; set severityText(severityText: string | undefined) { if (this._isLogRecordReadonly()) { @@ -73,7 +73,11 @@ export class LogRecord implements ReadableLogRecord { return this._body; } - constructor(logger: Logger, logRecord: logsAPI.LogRecord) { + constructor( + _sharedState: LoggerProviderSharedState, + instrumentationScope: InstrumentationScope, + logRecord: logsAPI.LogRecord + ) { const { timestamp, observedTimestamp, @@ -97,9 +101,9 @@ export class LogRecord implements ReadableLogRecord { this.severityNumber = severityNumber; this.severityText = severityText; this.body = body; - this.resource = logger.resource; - this.instrumentationScope = logger.instrumentationScope; - this._logRecordLimits = logger.getLogRecordLimits(); + this.resource = _sharedState.resource; + this.instrumentationScope = instrumentationScope; + this._logRecordLimits = _sharedState.logRecordLimits; this.setAttributes(attributes); } @@ -127,7 +131,7 @@ export class LogRecord implements ReadableLogRecord { } if ( Object.keys(this.attributes).length >= - this._logRecordLimits.attributeCountLimit! && + this._logRecordLimits.attributeCountLimit && !Object.prototype.hasOwnProperty.call(this.attributes, key) ) { return this; @@ -159,15 +163,16 @@ export class LogRecord implements ReadableLogRecord { } /** + * @internal * A LogRecordProcessor may freely modify logRecord for the duration of the OnEmit call. * If logRecord is needed after OnEmit returns (i.e. for asynchronous processing) only reads are permitted. */ - public makeReadonly() { + _makeReadonly() { this._isReadonly = true; } private _truncateToSize(value: AttributeValue): AttributeValue { - const limit = this._logRecordLimits.attributeValueLengthLimit || 0; + const limit = this._logRecordLimits.attributeValueLengthLimit; // Check limit if (limit <= 0) { // Negative values are invalid, so do not truncate diff --git a/experimental/packages/sdk-logs/src/Logger.ts b/experimental/packages/sdk-logs/src/Logger.ts index 5ea4e8f28f..7694955e62 100644 --- a/experimental/packages/sdk-logs/src/Logger.ts +++ b/experimental/packages/sdk-logs/src/Logger.ts @@ -15,28 +15,17 @@ */ import type * as logsAPI from '@opentelemetry/api-logs'; -import type { IResource } from '@opentelemetry/resources'; import type { InstrumentationScope } from '@opentelemetry/core'; import { context } from '@opentelemetry/api'; -import type { LoggerConfig, LogRecordLimits } from './types'; import { LogRecord } from './LogRecord'; -import { LoggerProvider } from './LoggerProvider'; -import { mergeConfig } from './config'; -import { LogRecordProcessor } from './LogRecordProcessor'; +import { LoggerProviderSharedState } from './internal/LoggerProviderSharedState'; export class Logger implements logsAPI.Logger { - public readonly resource: IResource; - private readonly _loggerConfig: Required; - constructor( public readonly instrumentationScope: InstrumentationScope, - config: LoggerConfig, - private _loggerProvider: LoggerProvider - ) { - this._loggerConfig = mergeConfig(config); - this.resource = _loggerProvider.resource; - } + private _sharedState: LoggerProviderSharedState + ) {} public emit(logRecord: logsAPI.LogRecord): void { const currentContext = logRecord.context || context.active(); @@ -45,30 +34,23 @@ export class Logger implements logsAPI.Logger { * the LogRecords it emits MUST automatically include the Trace Context from the active Context, * if Context has not been explicitly set. */ - const logRecordInstance = new LogRecord(this, { - context: currentContext, - ...logRecord, - }); + const logRecordInstance = new LogRecord( + this._sharedState, + this.instrumentationScope, + { + context: currentContext, + ...logRecord, + } + ); /** * the explicitly passed Context, * the current Context, or an empty Context if the Logger was obtained with include_trace_context=false */ - this.getActiveLogRecordProcessor().onEmit( - logRecordInstance, - currentContext - ); + this._sharedState.activeProcessor.onEmit(logRecordInstance, currentContext); /** * A LogRecordProcessor may freely modify logRecord for the duration of the OnEmit call. * If logRecord is needed after OnEmit returns (i.e. for asynchronous processing) only reads are permitted. */ - logRecordInstance.makeReadonly(); - } - - public getLogRecordLimits(): LogRecordLimits { - return this._loggerConfig.logRecordLimits; - } - - public getActiveLogRecordProcessor(): LogRecordProcessor { - return this._loggerProvider.getActiveLogRecordProcessor(); + logRecordInstance._makeReadonly(); } } diff --git a/experimental/packages/sdk-logs/src/LoggerProvider.ts b/experimental/packages/sdk-logs/src/LoggerProvider.ts index 81515dab86..b8fd9851f8 100644 --- a/experimental/packages/sdk-logs/src/LoggerProvider.ts +++ b/experimental/packages/sdk-logs/src/LoggerProvider.ts @@ -16,7 +16,7 @@ import { diag } from '@opentelemetry/api'; import type * as logsAPI from '@opentelemetry/api-logs'; import { NOOP_LOGGER } from '@opentelemetry/api-logs'; -import { IResource, Resource } from '@opentelemetry/resources'; +import { Resource } from '@opentelemetry/resources'; import { BindOnceFuture, merge } from '@opentelemetry/core'; import type { LoggerProviderConfig } from './types'; @@ -24,39 +24,26 @@ import type { LogRecordProcessor } from './LogRecordProcessor'; import { Logger } from './Logger'; import { loadDefaultConfig, reconfigureLimits } from './config'; import { MultiLogRecordProcessor } from './MultiLogRecordProcessor'; -import { NoopLogRecordProcessor } from './export/NoopLogRecordProcessor'; +import { LoggerProviderSharedState } from './internal/LoggerProviderSharedState'; export const DEFAULT_LOGGER_NAME = 'unknown'; export class LoggerProvider implements logsAPI.LoggerProvider { - public readonly resource: IResource; - - private readonly _loggers: Map = new Map(); - private _activeProcessor: MultiLogRecordProcessor; - private readonly _registeredLogRecordProcessors: LogRecordProcessor[] = []; - private readonly _config: LoggerProviderConfig; private _shutdownOnce: BindOnceFuture; + private readonly _sharedState: LoggerProviderSharedState; constructor(config: LoggerProviderConfig = {}) { const { - resource = Resource.empty(), + resource = Resource.default(), logRecordLimits, forceFlushTimeoutMillis, - } = merge({}, loadDefaultConfig(), reconfigureLimits(config)); - this.resource = Resource.default().merge(resource); - this._config = { - logRecordLimits, - resource: this.resource, + } = merge({}, loadDefaultConfig(), config); + this._sharedState = new LoggerProviderSharedState( + resource, forceFlushTimeoutMillis, - }; - - this._shutdownOnce = new BindOnceFuture(this._shutdown, this); - - // add a default processor: NoopLogRecordProcessor - this._activeProcessor = new MultiLogRecordProcessor( - [new NoopLogRecordProcessor()], - forceFlushTimeoutMillis + reconfigureLimits(logRecordLimits) ); + this._shutdownOnce = new BindOnceFuture(this._shutdown, this); } /** @@ -77,19 +64,17 @@ export class LoggerProvider implements logsAPI.LoggerProvider { } const loggerName = name || DEFAULT_LOGGER_NAME; const key = `${loggerName}@${version || ''}:${options?.schemaUrl || ''}`; - if (!this._loggers.has(key)) { - this._loggers.set( + if (!this._sharedState.loggers.has(key)) { + this._sharedState.loggers.set( key, new Logger( { name: loggerName, version, schemaUrl: options?.schemaUrl }, - { - logRecordLimits: this._config.logRecordLimits, - }, - this + this._sharedState ) ); } - return this._loggers.get(key)!; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return this._sharedState.loggers.get(key)!; } /** @@ -97,10 +82,10 @@ export class LoggerProvider implements logsAPI.LoggerProvider { * @param processor the new LogRecordProcessor to be added. */ public addLogRecordProcessor(processor: LogRecordProcessor) { - if (this._registeredLogRecordProcessors.length === 0) { + if (this._sharedState.registeredLogRecordProcessors.length === 0) { // since we might have enabled by default a batchProcessor, we disable it // before adding the new one - this._activeProcessor + this._sharedState.activeProcessor .shutdown() .catch(err => diag.error( @@ -109,10 +94,10 @@ export class LoggerProvider implements logsAPI.LoggerProvider { ) ); } - this._registeredLogRecordProcessors.push(processor); - this._activeProcessor = new MultiLogRecordProcessor( - this._registeredLogRecordProcessors, - this._config.forceFlushTimeoutMillis! + this._sharedState.registeredLogRecordProcessors.push(processor); + this._sharedState.activeProcessor = new MultiLogRecordProcessor( + this._sharedState.registeredLogRecordProcessors, + this._sharedState.forceFlushTimeoutMillis ); } @@ -127,7 +112,7 @@ export class LoggerProvider implements logsAPI.LoggerProvider { diag.warn('invalid attempt to force flush after LoggerProvider shutdown'); return this._shutdownOnce.promise; } - return this._activeProcessor.forceFlush(); + return this._sharedState.activeProcessor.forceFlush(); } /** @@ -144,15 +129,7 @@ export class LoggerProvider implements logsAPI.LoggerProvider { return this._shutdownOnce.call(); } - public getActiveLogRecordProcessor(): MultiLogRecordProcessor { - return this._activeProcessor; - } - - public getActiveLoggers(): Map { - return this._loggers; - } - private _shutdown(): Promise { - return this._activeProcessor.shutdown(); + return this._sharedState.activeProcessor.shutdown(); } } diff --git a/experimental/packages/sdk-logs/src/MultiLogRecordProcessor.ts b/experimental/packages/sdk-logs/src/MultiLogRecordProcessor.ts index c4e5031261..353caefe0f 100644 --- a/experimental/packages/sdk-logs/src/MultiLogRecordProcessor.ts +++ b/experimental/packages/sdk-logs/src/MultiLogRecordProcessor.ts @@ -15,7 +15,7 @@ */ import { callWithTimeout } from '@opentelemetry/core'; - +import type { Context } from '@opentelemetry/api'; import type { LogRecordProcessor } from './LogRecordProcessor'; import type { LogRecord } from './LogRecord'; @@ -38,8 +38,10 @@ export class MultiLogRecordProcessor implements LogRecordProcessor { ); } - public onEmit(logRecord: LogRecord): void { - this.processors.forEach(processors => processors.onEmit(logRecord)); + public onEmit(logRecord: LogRecord, context?: Context): void { + this.processors.forEach(processors => + processors.onEmit(logRecord, context) + ); } public async shutdown(): Promise { diff --git a/experimental/packages/sdk-logs/src/config.ts b/experimental/packages/sdk-logs/src/config.ts index af908f1650..91b2c3e488 100644 --- a/experimental/packages/sdk-logs/src/config.ts +++ b/experimental/packages/sdk-logs/src/config.ts @@ -20,7 +20,7 @@ import { getEnv, getEnvWithoutDefaults, } from '@opentelemetry/core'; -import { LoggerConfig } from './types'; +import { LogRecordLimits } from './types'; export function loadDefaultConfig() { return { @@ -37,50 +37,29 @@ export function loadDefaultConfig() { /** * When general limits are provided and model specific limits are not, * configures the model specific limits by using the values from the general ones. - * @param userConfig User provided tracer configuration + * @param logRecordLimits User provided limits configuration */ -export function reconfigureLimits(userConfig: LoggerConfig): LoggerConfig { - const logRecordLimits = Object.assign({}, userConfig.logRecordLimits); - +export function reconfigureLimits( + logRecordLimits: LogRecordLimits +): Required { const parsedEnvConfig = getEnvWithoutDefaults(); - /** - * Reassign log record attribute count limit to use first non null value defined by user or use default value - */ - logRecordLimits.attributeCountLimit = - userConfig.logRecordLimits?.attributeCountLimit ?? - parsedEnvConfig.OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT ?? - parsedEnvConfig.OTEL_ATTRIBUTE_COUNT_LIMIT ?? - DEFAULT_ATTRIBUTE_COUNT_LIMIT; - - /** - * Reassign log record attribute value length limit to use first non null value defined by user or use default value - */ - logRecordLimits.attributeValueLengthLimit = - userConfig.logRecordLimits?.attributeValueLengthLimit ?? - parsedEnvConfig.OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT ?? - parsedEnvConfig.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT ?? - DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT; - - return Object.assign({}, userConfig, { logRecordLimits }); -} - -/** - * Function to merge Default configuration (as specified in './config') with - * user provided configurations. - */ -export function mergeConfig(userConfig: LoggerConfig): Required { - const DEFAULT_CONFIG = loadDefaultConfig(); - - const target = Object.assign({}, DEFAULT_CONFIG, userConfig); - - target.logRecordLimits = Object.assign( - {}, - DEFAULT_CONFIG.logRecordLimits, - userConfig.logRecordLimits || {} - ); - - return target; + return { + /** + * Reassign log record attribute count limit to use first non null value defined by user or use default value + */ + attributeCountLimit: + logRecordLimits.attributeCountLimit ?? + parsedEnvConfig.OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT ?? + parsedEnvConfig.OTEL_ATTRIBUTE_COUNT_LIMIT ?? + DEFAULT_ATTRIBUTE_COUNT_LIMIT, + /** + * Reassign log record attribute value length limit to use first non null value defined by user or use default value + */ + attributeValueLengthLimit: + logRecordLimits.attributeValueLengthLimit ?? + parsedEnvConfig.OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT ?? + parsedEnvConfig.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT ?? + DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT, + }; } - -export const DEFAULT_EVENT_DOMAIN = 'default'; diff --git a/experimental/packages/sdk-logs/src/export/BatchLogRecordProcessorBase.ts b/experimental/packages/sdk-logs/src/export/BatchLogRecordProcessorBase.ts index 92d42fe44b..027f103c07 100644 --- a/experimental/packages/sdk-logs/src/export/BatchLogRecordProcessorBase.ts +++ b/experimental/packages/sdk-logs/src/export/BatchLogRecordProcessorBase.ts @@ -42,7 +42,10 @@ export abstract class BatchLogRecordProcessorBase private _timer: NodeJS.Timeout | undefined; private _shutdownOnce: BindOnceFuture; - constructor(private readonly _exporter: LogRecordExporter, config?: T) { + constructor( + private readonly _exporter: LogRecordExporter, + config?: T + ) { const env = getEnv(); this._maxExportBatchSize = config?.maxExportBatchSize ?? env.OTEL_BLRP_MAX_EXPORT_BATCH_SIZE; diff --git a/experimental/packages/sdk-logs/src/export/NoopLogRecordProcessor.ts b/experimental/packages/sdk-logs/src/export/NoopLogRecordProcessor.ts index 91f277e8ab..c1f62ed8ca 100644 --- a/experimental/packages/sdk-logs/src/export/NoopLogRecordProcessor.ts +++ b/experimental/packages/sdk-logs/src/export/NoopLogRecordProcessor.ts @@ -14,6 +14,7 @@ * limitations under the License. */ +import { Context } from '@opentelemetry/api'; import { LogRecordProcessor } from '../LogRecordProcessor'; import { ReadableLogRecord } from './ReadableLogRecord'; @@ -22,7 +23,7 @@ export class NoopLogRecordProcessor implements LogRecordProcessor { return Promise.resolve(); } - onEmit(_logRecord: ReadableLogRecord): void {} + onEmit(_logRecord: ReadableLogRecord, _context: Context): void {} shutdown(): Promise { return Promise.resolve(); diff --git a/experimental/packages/sdk-logs/src/index.ts b/experimental/packages/sdk-logs/src/index.ts index e718ae069e..b7347a2845 100644 --- a/experimental/packages/sdk-logs/src/index.ts +++ b/experimental/packages/sdk-logs/src/index.ts @@ -15,14 +15,12 @@ */ export { - LoggerConfig, LoggerProviderConfig, LogRecordLimits, BufferConfig, BatchLogRecordProcessorBrowserConfig, } from './types'; export { LoggerProvider } from './LoggerProvider'; -export { Logger } from './Logger'; export { LogRecord } from './LogRecord'; export { LogRecordProcessor } from './LogRecordProcessor'; export { ReadableLogRecord } from './export/ReadableLogRecord'; diff --git a/experimental/packages/sdk-logs/src/internal/LoggerProviderSharedState.ts b/experimental/packages/sdk-logs/src/internal/LoggerProviderSharedState.ts new file mode 100644 index 0000000000..16b208f72c --- /dev/null +++ b/experimental/packages/sdk-logs/src/internal/LoggerProviderSharedState.ts @@ -0,0 +1,35 @@ +/* + * 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 { Logger } from '@opentelemetry/api-logs'; +import { IResource } from '@opentelemetry/resources'; +import { LogRecordProcessor } from '../LogRecordProcessor'; +import { LogRecordLimits } from '../types'; +import { NoopLogRecordProcessor } from '../export/NoopLogRecordProcessor'; + +export class LoggerProviderSharedState { + readonly loggers: Map = new Map(); + activeProcessor: LogRecordProcessor; + readonly registeredLogRecordProcessors: LogRecordProcessor[] = []; + + constructor( + readonly resource: IResource, + readonly forceFlushTimeoutMillis: number, + readonly logRecordLimits: Required + ) { + this.activeProcessor = new NoopLogRecordProcessor(); + } +} diff --git a/experimental/packages/sdk-logs/src/types.ts b/experimental/packages/sdk-logs/src/types.ts index 026843dc15..27aefa540f 100644 --- a/experimental/packages/sdk-logs/src/types.ts +++ b/experimental/packages/sdk-logs/src/types.ts @@ -30,11 +30,6 @@ export interface LoggerProviderConfig { logRecordLimits?: LogRecordLimits; } -export interface LoggerConfig { - /** Log Record Limits*/ - logRecordLimits?: LogRecordLimits; -} - export interface LogRecordLimits { /** attributeValueLengthLimit is maximum allowed attribute value size */ attributeValueLengthLimit?: number; diff --git a/experimental/packages/sdk-logs/test/common/LogRecord.test.ts b/experimental/packages/sdk-logs/test/common/LogRecord.test.ts index cc7ce8bafd..e32ab39838 100644 --- a/experimental/packages/sdk-logs/test/common/LogRecord.test.ts +++ b/experimental/packages/sdk-logs/test/common/LogRecord.test.ts @@ -33,30 +33,32 @@ import { LogRecordLimits, LogRecordProcessor, LogRecord, - Logger, LoggerProvider, } from './../../src'; import { invalidAttributes, validAttributes } from './utils'; +import { LoggerProviderSharedState } from '../../src/internal/LoggerProviderSharedState'; +import { reconfigureLimits } from '../../src/config'; const performanceTimeOrigin: HrTime = [1, 1]; -const setup = (limits?: LogRecordLimits, data?: logsAPI.LogRecord) => { +const setup = (logRecordLimits?: LogRecordLimits, data?: logsAPI.LogRecord) => { const instrumentationScope = { name: 'test name', version: 'test version', schemaUrl: 'test schema url', }; const resource = Resource.default(); - const loggerProvider = new LoggerProvider({ resource }); - const logger = new Logger( + const sharedState = new LoggerProviderSharedState( + resource, + Infinity, + reconfigureLimits(logRecordLimits ?? {}) + ); + const logRecord = new LogRecord( + sharedState, instrumentationScope, - { - logRecordLimits: limits, - }, - loggerProvider + data ?? {} ); - const logRecord = new LogRecord(logger, data || {}); - return { logger, logRecord, instrumentationScope, resource }; + return { logRecord, instrumentationScope, resource }; }; describe('LogRecord', () => { @@ -320,7 +322,7 @@ describe('LogRecord', () => { it('should not rewrite directly through the property method', () => { const warnStub = sinon.spy(diag, 'warn'); const { logRecord } = setup(undefined, logRecordData); - logRecord.makeReadonly(); + logRecord._makeReadonly(); logRecord.body = newBody; logRecord.severityNumber = newSeverityNumber; @@ -346,7 +348,7 @@ describe('LogRecord', () => { it('should not rewrite using the set method', () => { const warnStub = sinon.spy(diag, 'warn'); const { logRecord } = setup(undefined, logRecordData); - logRecord.makeReadonly(); + logRecord._makeReadonly(); logRecord.setBody(newBody); logRecord.setSeverityNumber(newSeverityNumber); diff --git a/experimental/packages/sdk-logs/test/common/Logger.test.ts b/experimental/packages/sdk-logs/test/common/Logger.test.ts index a5f690a4b7..f78bda2d5e 100644 --- a/experimental/packages/sdk-logs/test/common/Logger.test.ts +++ b/experimental/packages/sdk-logs/test/common/Logger.test.ts @@ -17,21 +17,19 @@ import * as assert from 'assert'; import * as sinon from 'sinon'; -import { LogRecord, Logger, LoggerConfig, LoggerProvider } from '../../src'; +import { LogRecord, LoggerProvider, NoopLogRecordProcessor } from '../../src'; import { ROOT_CONTEXT, TraceFlags, context, trace } from '@opentelemetry/api'; import { LogRecord as ApiLogRecord } from '@opentelemetry/api-logs'; +import { Logger } from '../../src/Logger'; -const setup = (loggerConfig: LoggerConfig = {}) => { - const logger = new Logger( - { - name: 'test name', - version: 'test version', - schemaUrl: 'test schema url', - }, - loggerConfig, - new LoggerProvider() - ); - return { logger }; +const setup = () => { + const loggerProvider = new LoggerProvider(); + const logProcessor = new NoopLogRecordProcessor(); + loggerProvider.addLogRecordProcessor(logProcessor); + const logger = loggerProvider.getLogger('test name', 'test version', { + schemaUrl: 'test schema url', + }) as Logger; + return { logger, logProcessor }; }; describe('Logger', () => { @@ -44,8 +42,8 @@ describe('Logger', () => { describe('emit', () => { it('should emit a logRecord instance', () => { - const { logger } = setup(); - const callSpy = sinon.spy(logger.getActiveLogRecordProcessor(), 'onEmit'); + const { logger, logProcessor } = setup(); + const callSpy = sinon.spy(logProcessor, 'onEmit'); logger.emit({ body: 'test log body', }); @@ -54,7 +52,7 @@ describe('Logger', () => { it('should make log record instance readonly after emit it', () => { const { logger } = setup(); - const makeOnlySpy = sinon.spy(LogRecord.prototype, 'makeReadonly'); + const makeOnlySpy = sinon.spy(LogRecord.prototype, '_makeReadonly'); logger.emit({ body: 'test log body', }); @@ -62,8 +60,8 @@ describe('Logger', () => { }); it('should emit with current Context', () => { - const { logger } = setup({}); - const callSpy = sinon.spy(logger.getActiveLogRecordProcessor(), 'onEmit'); + const { logger, logProcessor } = setup(); + const callSpy = sinon.spy(logProcessor, 'onEmit'); logger.emit({ body: 'test log body', }); @@ -71,7 +69,7 @@ describe('Logger', () => { }); it('should emit with Context specified in LogRecord', () => { - const { logger } = setup({}); + const { logger, logProcessor } = setup(); const spanContext = { traceId: 'd4cda95b652f4a1592b449d5929fda1b', spanId: '6e0c63257de34c92', @@ -82,7 +80,7 @@ describe('Logger', () => { context: activeContext, }; - const callSpy = sinon.spy(logger.getActiveLogRecordProcessor(), 'onEmit'); + const callSpy = sinon.spy(logProcessor, 'onEmit'); logger.emit(logRecordData); assert.ok(callSpy.calledWith(sinon.match.any, activeContext)); }); diff --git a/experimental/packages/sdk-logs/test/common/LoggerProvider.test.ts b/experimental/packages/sdk-logs/test/common/LoggerProvider.test.ts index d6032515a7..e4d80265c6 100644 --- a/experimental/packages/sdk-logs/test/common/LoggerProvider.test.ts +++ b/experimental/packages/sdk-logs/test/common/LoggerProvider.test.ts @@ -19,9 +19,11 @@ import { Resource } from '@opentelemetry/resources'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import { Logger, LoggerProvider, NoopLogRecordProcessor } from '../../src'; +import { LoggerProvider, NoopLogRecordProcessor } from '../../src'; import { loadDefaultConfig } from '../../src/config'; import { DEFAULT_LOGGER_NAME } from './../../src/LoggerProvider'; +import { MultiLogRecordProcessor } from '../../src/MultiLogRecordProcessor'; +import { Logger } from '../../src/Logger'; describe('LoggerProvider', () => { let envSource: Record; @@ -48,45 +50,35 @@ describe('LoggerProvider', () => { assert.ok(provider instanceof LoggerProvider); }); - it('should use noop log record processor by default and no diag error', () => { - const errorStub = sinon.spy(diag, 'error'); + it('should use noop log record processor by default', () => { const provider = new LoggerProvider(); - const processors = provider.getActiveLogRecordProcessor().processors; - assert.ok(processors.length === 1); - assert.ok(processors[0] instanceof NoopLogRecordProcessor); - sinon.assert.notCalled(errorStub); + const sharedState = provider['_sharedState']; + const processor = sharedState.activeProcessor; + assert.ok(processor instanceof NoopLogRecordProcessor); }); it('should have default resource if not pass', () => { const provider = new LoggerProvider(); - const { resource } = provider; + const { resource } = provider['_sharedState']; assert.deepStrictEqual(resource, Resource.default()); }); it('should have default forceFlushTimeoutMillis if not pass', () => { const provider = new LoggerProvider(); - const activeProcessor = provider.getActiveLogRecordProcessor(); + const sharedState = provider['_sharedState']; assert.ok( - activeProcessor.forceFlushTimeoutMillis === + sharedState.forceFlushTimeoutMillis === loadDefaultConfig().forceFlushTimeoutMillis ); }); }); - describe('when user sets unavailable exporter', () => { - it('should use noop log record processor by default', () => { - const provider = new LoggerProvider(); - const processors = provider.getActiveLogRecordProcessor().processors; - assert.ok(processors.length === 1); - assert.ok(processors[0] instanceof NoopLogRecordProcessor); - }); - }); - describe('logRecordLimits', () => { describe('when not defined default values', () => { it('should have logger with default values', () => { - const logger = new LoggerProvider({}).getLogger('default') as Logger; - assert.deepStrictEqual(logger.getLogRecordLimits(), { + const loggerProvider = new LoggerProvider(); + const sharedState = loggerProvider['_sharedState']; + assert.deepStrictEqual(sharedState.logRecordLimits, { attributeValueLengthLimit: Infinity, attributeCountLimit: 128, }); @@ -95,34 +87,37 @@ describe('LoggerProvider', () => { describe('when "attributeCountLimit" is defined', () => { it('should have logger with defined value', () => { - const logger = new LoggerProvider({ + const loggerProvider = new LoggerProvider({ logRecordLimits: { attributeCountLimit: 100, }, - }).getLogger('default') as Logger; - const logRecordLimits = logger.getLogRecordLimits(); + }); + const logRecordLimits = + loggerProvider['_sharedState'].logRecordLimits; assert.strictEqual(logRecordLimits.attributeCountLimit, 100); }); }); describe('when "attributeValueLengthLimit" is defined', () => { it('should have logger with defined value', () => { - const logger = new LoggerProvider({ + const loggerProvider = new LoggerProvider({ logRecordLimits: { attributeValueLengthLimit: 10, }, - }).getLogger('default') as Logger; - const logRecordLimits = logger.getLogRecordLimits(); + }); + const logRecordLimits = + loggerProvider['_sharedState'].logRecordLimits; assert.strictEqual(logRecordLimits.attributeValueLengthLimit, 10); }); it('should have logger with negative "attributeValueLengthLimit" value', () => { - const logger = new LoggerProvider({ + const loggerProvider = new LoggerProvider({ logRecordLimits: { attributeValueLengthLimit: -10, }, - }).getLogger('default') as Logger; - const logRecordLimits = logger.getLogRecordLimits(); + }); + const logRecordLimits = + loggerProvider['_sharedState'].logRecordLimits; assert.strictEqual(logRecordLimits.attributeValueLengthLimit, -10); }); }); @@ -130,8 +125,9 @@ describe('LoggerProvider', () => { describe('when attribute value length limit is defined via env', () => { it('should have attribute value length limit as default of Infinity', () => { envSource.OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT = 'Infinity'; - const logger = new LoggerProvider().getLogger('default') as Logger; - const logRecordLimits = logger.getLogRecordLimits(); + const loggerProvider = new LoggerProvider(); + const logRecordLimits = + loggerProvider['_sharedState'].logRecordLimits; assert.strictEqual( logRecordLimits.attributeValueLengthLimit, Infinity @@ -142,8 +138,9 @@ describe('LoggerProvider', () => { describe('when attribute value length limit is not defined via env', () => { it('should use default value of Infinity', () => { - const logger = new LoggerProvider().getLogger('default') as Logger; - const logRecordLimits = logger.getLogRecordLimits(); + const loggerProvider = new LoggerProvider(); + const logRecordLimits = + loggerProvider['_sharedState'].logRecordLimits; assert.strictEqual( logRecordLimits.attributeValueLengthLimit, Infinity @@ -154,15 +151,17 @@ describe('LoggerProvider', () => { describe('when attribute count limit is defined via env', () => { it('should have attribute count limits as defined in env', () => { envSource.OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT = '35'; - const logger = new LoggerProvider().getLogger('default') as Logger; - const logRecordLimits = logger.getLogRecordLimits(); + const loggerProvider = new LoggerProvider(); + const logRecordLimits = + loggerProvider['_sharedState'].logRecordLimits; assert.strictEqual(logRecordLimits.attributeCountLimit, 35); delete envSource.OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT; }); it('should have attribute count limit as default of 128', () => { envSource.OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT = '128'; - const logger = new LoggerProvider().getLogger('default') as Logger; - const logRecordLimits = logger.getLogRecordLimits(); + const loggerProvider = new LoggerProvider(); + const logRecordLimits = + loggerProvider['_sharedState'].logRecordLimits; assert.strictEqual(logRecordLimits.attributeCountLimit, 128); delete envSource.OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT; }); @@ -170,8 +169,9 @@ describe('LoggerProvider', () => { describe('when attribute count limit is not defined via env', () => { it('should use default value of 128', () => { - const logger = new LoggerProvider().getLogger('default') as Logger; - const logRecordLimits = logger.getLogRecordLimits(); + const loggerProvider = new LoggerProvider(); + const logRecordLimits = + loggerProvider['_sharedState'].logRecordLimits; assert.strictEqual(logRecordLimits.attributeCountLimit, 128); }); }); @@ -186,55 +186,61 @@ describe('LoggerProvider', () => { it('should create a logger instance with default name if the name is invalid ', () => { const provider = new LoggerProvider(); const logger = provider.getLogger('') as Logger; - assert.ok(logger.instrumentationScope.name === DEFAULT_LOGGER_NAME); + assert.strictEqual(logger.instrumentationScope.name, DEFAULT_LOGGER_NAME); }); it("should create a logger instance if the name doesn't exist", () => { const provider = new LoggerProvider(); - assert.ok(provider.getActiveLoggers().size === 0); + const sharedState = provider['_sharedState']; + assert.strictEqual(sharedState.loggers.size, 0); provider.getLogger(testName); - assert.ok(provider.getActiveLoggers().size === 1); + assert.strictEqual(sharedState.loggers.size, 1); }); it('should create A new object if the name & version & schemaUrl are not unique', () => { const provider = new LoggerProvider(); - assert.ok(provider.getActiveLoggers().size === 0); + const sharedState = provider['_sharedState']; + assert.strictEqual(sharedState.loggers.size, 0); provider.getLogger(testName); - assert.ok(provider.getActiveLoggers().size === 1); + assert.strictEqual(sharedState.loggers.size, 1); provider.getLogger(testName, testVersion); - assert.ok(provider.getActiveLoggers().size === 2); + assert.strictEqual(sharedState.loggers.size, 2); provider.getLogger(testName, testVersion, { schemaUrl: testSchemaURL }); - assert.ok(provider.getActiveLoggers().size === 3); + assert.strictEqual(sharedState.loggers.size, 3); }); it('should not create A new object if the name & version & schemaUrl are unique', () => { const provider = new LoggerProvider(); + const sharedState = provider['_sharedState']; - assert.ok(provider.getActiveLoggers().size === 0); + assert.strictEqual(sharedState.loggers.size, 0); provider.getLogger(testName); - assert.ok(provider.getActiveLoggers().size === 1); + assert.strictEqual(sharedState.loggers.size, 1); const logger1 = provider.getLogger(testName, testVersion, { schemaUrl: testSchemaURL, }); - assert.ok(provider.getActiveLoggers().size === 2); + assert.strictEqual(sharedState.loggers.size, 2); const logger2 = provider.getLogger(testName, testVersion, { schemaUrl: testSchemaURL, }); - assert.ok(provider.getActiveLoggers().size === 2); + assert.strictEqual(sharedState.loggers.size, 2); assert.ok(logger2 instanceof Logger); - assert.ok(logger1 === logger2); + assert.strictEqual(logger1, logger2); }); }); describe('addLogRecordProcessor', () => { it('should add logRecord processor', () => { - const logRecordProcessor = new NoopLogRecordProcessor(); const provider = new LoggerProvider(); + const sharedState = provider['_sharedState']; + const logRecordProcessor = new NoopLogRecordProcessor(); provider.addLogRecordProcessor(logRecordProcessor); + assert.ok(sharedState.activeProcessor instanceof MultiLogRecordProcessor); + assert.strictEqual(sharedState.activeProcessor.processors.length, 1); assert.strictEqual( - provider.getActiveLogRecordProcessor().processors.length, - 1 + sharedState.activeProcessor.processors[0], + logRecordProcessor ); }); }); @@ -301,10 +307,9 @@ describe('LoggerProvider', () => { describe('.shutdown()', () => { it('should trigger shutdown when manually invoked', () => { const provider = new LoggerProvider(); - const shutdownStub = sinon.stub( - provider.getActiveLogRecordProcessor(), - 'shutdown' - ); + const processor = new NoopLogRecordProcessor(); + provider.addLogRecordProcessor(processor); + const shutdownStub = sinon.stub(processor, 'shutdown'); provider.shutdown(); sinon.assert.calledOnce(shutdownStub); }); @@ -321,10 +326,7 @@ describe('LoggerProvider', () => { const provider = new LoggerProvider(); const logRecordProcessor = new NoopLogRecordProcessor(); provider.addLogRecordProcessor(logRecordProcessor); - const forceFlushStub = sinon.stub( - provider.getActiveLogRecordProcessor(), - 'forceFlush' - ); + const forceFlushStub = sinon.stub(logRecordProcessor, 'forceFlush'); const warnStub = sinon.spy(diag, 'warn'); provider.shutdown(); provider.forceFlush(); @@ -336,10 +338,7 @@ describe('LoggerProvider', () => { const provider = new LoggerProvider(); const logRecordProcessor = new NoopLogRecordProcessor(); provider.addLogRecordProcessor(logRecordProcessor); - const shutdownStub = sinon.stub( - provider.getActiveLogRecordProcessor(), - 'shutdown' - ); + const shutdownStub = sinon.stub(logRecordProcessor, 'shutdown'); const warnStub = sinon.spy(diag, 'warn'); provider.shutdown(); provider.shutdown(); diff --git a/experimental/packages/sdk-logs/test/common/export/BatchLogRecordProcessor.test.ts b/experimental/packages/sdk-logs/test/common/export/BatchLogRecordProcessor.test.ts index 2d0fab7a2c..70859a314c 100644 --- a/experimental/packages/sdk-logs/test/common/export/BatchLogRecordProcessor.test.ts +++ b/experimental/packages/sdk-logs/test/common/export/BatchLogRecordProcessor.test.ts @@ -28,10 +28,11 @@ import { LogRecordLimits, LogRecord, InMemoryLogRecordExporter, - LoggerProvider, - Logger, } from '../../../src'; import { BatchLogRecordProcessorBase } from '../../../src/export/BatchLogRecordProcessorBase'; +import { reconfigureLimits } from '../../../src/config'; +import { LoggerProviderSharedState } from '../../../src/internal/LoggerProviderSharedState'; +import { Resource } from '@opentelemetry/resources'; class BatchLogRecordProcessor extends BatchLogRecordProcessorBase { onInit() {} @@ -39,18 +40,22 @@ class BatchLogRecordProcessor extends BatchLogRecordProcessorBase } const createLogRecord = (limits?: LogRecordLimits): LogRecord => { - const logger = new Logger( + const sharedState = new LoggerProviderSharedState( + Resource.default(), + Infinity, + reconfigureLimits(limits ?? {}) + ); + const logRecord = new LogRecord( + sharedState, { name: 'test name', version: 'test version', schemaUrl: 'test schema url', }, { - logRecordLimits: limits, - }, - new LoggerProvider() + body: 'body', + } ); - const logRecord = new LogRecord(logger, { body: 'body' }); return logRecord; }; diff --git a/experimental/packages/sdk-logs/test/common/export/SimpleLogRecordProcessor.test.ts b/experimental/packages/sdk-logs/test/common/export/SimpleLogRecordProcessor.test.ts index 202554dde9..27eacc9195 100644 --- a/experimental/packages/sdk-logs/test/common/export/SimpleLogRecordProcessor.test.ts +++ b/experimental/packages/sdk-logs/test/common/export/SimpleLogRecordProcessor.test.ts @@ -27,13 +27,30 @@ import { LogRecordExporter, SimpleLogRecordProcessor, LogRecord, - LoggerProvider, - Logger, } from './../../../src'; +import { LoggerProviderSharedState } from '../../../src/internal/LoggerProviderSharedState'; +import { Resource } from '@opentelemetry/resources'; +import { reconfigureLimits } from '../../../src/config'; const setup = (exporter: LogRecordExporter) => { + const sharedState = new LoggerProviderSharedState( + Resource.default(), + Infinity, + reconfigureLimits({}) + ); + const logRecord = new LogRecord( + sharedState, + { + name: 'test name', + version: 'test version', + schemaUrl: 'test schema url', + }, + { + body: 'body', + } + ); const processor = new SimpleLogRecordProcessor(exporter); - return { exporter, processor }; + return { exporter, processor, logRecord }; }; describe('SimpleLogRecordProcessor', () => { @@ -49,21 +66,9 @@ describe('SimpleLogRecordProcessor', () => { describe('onEmit', () => { it('should handle onEmit', async () => { const exporter = new InMemoryLogRecordExporter(); - const { processor } = setup(exporter); + const { processor, logRecord } = setup(exporter); assert.strictEqual(exporter.getFinishedLogRecords().length, 0); - const logger = new Logger( - { - name: 'test name', - version: 'test version', - schemaUrl: 'test schema url', - }, - {}, - new LoggerProvider() - ); - const logRecord = new LogRecord(logger, { - body: 'body', - }); processor.onEmit(logRecord); assert.strictEqual(exporter.getFinishedLogRecords().length, 1); @@ -82,20 +87,8 @@ describe('SimpleLogRecordProcessor', () => { ), shutdown: () => Promise.resolve(), }; - const { processor } = setup(exporter); + const { processor, logRecord } = setup(exporter); - const logger = new Logger( - { - name: 'test name', - version: 'test version', - schemaUrl: 'test schema url', - }, - {}, - new LoggerProvider() - ); - const logRecord = new LogRecord(logger, { - body: 'body', - }); const errorHandlerSpy = sinon.spy(); setGlobalErrorHandler(errorHandlerSpy); processor.onEmit(logRecord); diff --git a/experimental/packages/shim-opencensus/.eslintrc.js b/experimental/packages/shim-opencensus/.eslintrc.js index f756f4488b..9baf1b4956 100644 --- a/experimental/packages/shim-opencensus/.eslintrc.js +++ b/experimental/packages/shim-opencensus/.eslintrc.js @@ -3,5 +3,5 @@ module.exports = { "mocha": true, "node": true }, - ...require('../../../eslint.config.js') + ...require('../../../eslint.base.js') } diff --git a/experimental/packages/shim-opencensus/README.md b/experimental/packages/shim-opencensus/README.md index e614fccf38..66e4d6e3d7 100644 --- a/experimental/packages/shim-opencensus/README.md +++ b/experimental/packages/shim-opencensus/README.md @@ -13,9 +13,85 @@ More details are available in the [OpenCensus Compatibility Specification](https npm install --save @opentelemetry/shim-opencensus ``` -## Usage +## Tracing usage -TODO +### Installing the shim's require-in-the-middle hook + +This is the recommended way to use the shim for tracing. + +This package provides a `require-in-the-middle` hook which replaces OpenCensus's `CoreTracer` +class with a shim implementation that writes to the OpenTelemetry API. This will cause all +usage of OpenCensus's tracing methods (in OpenCensus instrumentation or your own custom +instrumentation) to be reported to OpenTelemetry. + +There are two options for installing the hook: + +1. Using Node's `--require` flag to load the register module: + + ```sh + node --require @opentelemetry/shim-opencensus/register ./app.js + ``` + +2. Programmatically: + + ```js + // Early in your application startup + require('@opentelemetry/shim-opencensus').installShim(); + ``` + + Note that this has to be run before any OpenCensus tracers have been created. + +### Replace OpenCensus tracer with the `ShimTracer` in your code + +Alternatively, you can replace any usage of OpenCensus tracers in your code with the `ShimTracer` directly. + +Before: + +```js +const tracing = require('@opencensus/nodejs'); +const tracer = tracing.start({samplingRate: 1}).tracer; + +// ... + +tracer.startRootSpan({name: 'main'}, rootSpan => { + rootSpan.end(); +}); +``` + +After: + +```js +const { trace } = require('@opentelemetry/api'); +const { ShimTracer } = require('@opentelemetry/shim-opencensus'); +const tracer = new ShimTracer(trace.getTracer('my-module')); + +// ... + +tracer.startRootSpan({name: 'main'}, rootSpan => { + rootSpan.end(); +}); +``` + +## Metrics usage + +OpenCensus metrics can be collected and sent to an OpenTelemetry exporter by providing the +`OpenCensusMetricProducer` to your `MetricReader`. For example, to export OpenCensus metrics +through the OpenTelemetry Prometheus exporter: + +```js +meterProvider.addMetricReader( + new PrometheusExporter({ + metricProducers: [ + new OpenCensusMetricProducer({ + openCensusMetricProducerManager: + oc.Metrics.getMetricProducerManager(), + }), + ], + }) +); +``` + +## Example See [examples/opencensus-shim](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/examples/opencensus-shim) for a short example. diff --git a/experimental/packages/shim-opencensus/package.json b/experimental/packages/shim-opencensus/package.json index 202f8e2d67..12fcba77e8 100644 --- a/experimental/packages/shim-opencensus/package.json +++ b/experimental/packages/shim-opencensus/package.json @@ -1,9 +1,13 @@ { "name": "@opentelemetry/shim-opencensus", - "version": "0.39.1", + "version": "0.44.0", "description": "OpenCensus to OpenTelemetry shim", "main": "build/src/index.js", "types": "build/src/index.d.ts", + "exports": { + ".": "./build/src/index.js", + "./register": "./build/src/register.js" + }, "repository": "open-telemetry/opentelemetry-js", "scripts": { "prepublishOnly": "npm run compile", @@ -16,7 +20,7 @@ "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js" }, @@ -44,17 +48,19 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/context-async-hooks": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", "@opencensus/core": "0.1.0", - "@opentelemetry/api": "1.4.1", - "@types/mocha": "10.0.0", + "@opentelemetry/api": "1.6.0", + "@opentelemetry/context-async-hooks": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", + "@types/sinon": "10.0.18", "codecov": "3.8.3", - "mocha": "10.0.0", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", - "@types/sinon": "10.0.13", + "sinon": "15.1.2", "ts-mocha": "10.0.0", "typescript": "4.4.4" }, @@ -63,9 +69,11 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "require-in-the-middle": "^7.0.0", - "semver": "^7.3.5" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-metrics": "1.17.1", + "require-in-the-middle": "^7.1.1", + "semver": "^7.5.2" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/shim-opencensus", "sideEffects": false diff --git a/experimental/packages/shim-opencensus/src/OpenCensusMetricProducer.ts b/experimental/packages/shim-opencensus/src/OpenCensusMetricProducer.ts new file mode 100644 index 0000000000..04d4a06738 --- /dev/null +++ b/experimental/packages/shim-opencensus/src/OpenCensusMetricProducer.ts @@ -0,0 +1,104 @@ +/* + * Copyright 2018, OpenCensus Authors + * 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 oc from '@opencensus/core'; +import { Resource } from '@opentelemetry/resources'; +import { + CollectionResult, + MetricData, + MetricProducer, + ScopeMetrics, +} from '@opentelemetry/sdk-metrics'; +import { mapOcMetric } from './metric-transform'; +import { VERSION } from './version'; + +const SCOPE = { + name: '@opentelemetry/shim-opencensus', + version: VERSION, +} as const; + +interface OpenCensusMetricProducerOptions { + /** + * An instance of OpenCensus MetricProducerManager. If not provided, + * `oc.Metrics.getMetricProducerManager()` will be used. + */ + openCensusMetricProducerManager?: oc.MetricProducerManager; +} + +/** + * A {@link MetricProducer} which collects metrics from OpenCensus. Provide an instance to your + * {@link MetricReader} when you create it to include all OpenCensus metrics in the collection + * result: + * + * @example + * ``` + * const meterProvider = new MeterProvider(); + * const reader = new PeriodicExportingMetricReader({ + * metricProducers: [new OpenCensusMetricProducer()], + * exporter: exporter, + * }); + * meterProvider.addMetricReader(reader); + * ``` + */ +export class OpenCensusMetricProducer implements MetricProducer { + private _openCensusMetricProducerManager: oc.MetricProducerManager; + + constructor(options?: OpenCensusMetricProducerOptions) { + this._openCensusMetricProducerManager = + options?.openCensusMetricProducerManager ?? + oc.Metrics.getMetricProducerManager(); + } + + async collect(): Promise { + const metrics = await this._collectOpenCensus(); + const scopeMetrics: ScopeMetrics[] = + metrics.length === 0 + ? [] + : [ + { + scope: SCOPE, + metrics, + }, + ]; + + return { + errors: [], + resourceMetrics: { + // Resource is ignored by the SDK, it just uses the SDK's resource + resource: Resource.EMPTY, + scopeMetrics, + }, + }; + } + + private async _collectOpenCensus(): Promise { + const metrics: MetricData[] = []; + + // The use of oc.Metrics.getMetricProducerManager() was adapted from + // https://github.com/census-instrumentation/opencensus-node/blob/d46c8891b15783803d724b717db9a8c22cb73d6a/packages/opencensus-exporter-stackdriver/src/stackdriver-monitoring.ts#L122 + for (const metricProducer of this._openCensusMetricProducerManager.getAllMetricProducer()) { + for (const metric of metricProducer.getMetrics()) { + const metricData = mapOcMetric(metric); + if (metricData !== null) { + metrics.push(metricData); + } + } + } + + return metrics; + } +} diff --git a/experimental/packages/shim-opencensus/src/ShimSpan.ts b/experimental/packages/shim-opencensus/src/ShimSpan.ts index 498c73e5e7..e4eaf47a2d 100644 --- a/experimental/packages/shim-opencensus/src/ShimSpan.ts +++ b/experimental/packages/shim-opencensus/src/ShimSpan.ts @@ -17,7 +17,7 @@ import * as oc from '@opencensus/core'; import { ShimTracer } from './ShimTracer'; import { AttributeValue, Span, SpanStatusCode, diag } from '@opentelemetry/api'; -import { mapMessageEvent, reverseMapSpanContext } from './transform'; +import { mapMessageEvent, reverseMapSpanContext } from './trace-transform'; // Copied from // https://github.com/census-instrumentation/opencensus-node/blob/v0.1.0/packages/opencensus-core/src/trace/model/span.ts#L61 diff --git a/experimental/packages/shim-opencensus/src/ShimTracer.ts b/experimental/packages/shim-opencensus/src/ShimTracer.ts index f5e8164e3c..c276b99e53 100644 --- a/experimental/packages/shim-opencensus/src/ShimTracer.ts +++ b/experimental/packages/shim-opencensus/src/ShimTracer.ts @@ -26,7 +26,7 @@ import { Tracer, } from '@opentelemetry/api'; import { DEFAULT_SPAN_NAME, ShimSpan } from './ShimSpan'; -import { mapSpanContext, mapSpanKind } from './transform'; +import { mapSpanContext, mapSpanKind } from './trace-transform'; import { shimPropagation } from './propagation'; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion diff --git a/experimental/packages/shim-opencensus/src/index.ts b/experimental/packages/shim-opencensus/src/index.ts index ccfe42e2f8..8889608ec3 100644 --- a/experimental/packages/shim-opencensus/src/index.ts +++ b/experimental/packages/shim-opencensus/src/index.ts @@ -15,3 +15,5 @@ */ export { ShimTracer } from './ShimTracer'; +export { OpenCensusMetricProducer } from './OpenCensusMetricProducer'; +export { installShim, uninstallShim } from './shim'; diff --git a/experimental/packages/shim-opencensus/src/metric-transform.ts b/experimental/packages/shim-opencensus/src/metric-transform.ts new file mode 100644 index 0000000000..bc136d0ed2 --- /dev/null +++ b/experimental/packages/shim-opencensus/src/metric-transform.ts @@ -0,0 +1,211 @@ +/* + * 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 oc from '@opencensus/core'; +import { Attributes, HrTime, ValueType, diag } from '@opentelemetry/api'; +import { + AggregationTemporality, + DataPoint, + DataPointType, + GaugeMetricData, + HistogramMetricData, + InstrumentType, + MetricData, + SumMetricData, +} from '@opentelemetry/sdk-metrics'; + +type BaseMetric = Omit; +interface MappedType { + type: InstrumentType; + valueType: ValueType; + dataPointType: + | DataPointType.GAUGE + | DataPointType.SUM + | DataPointType.HISTOGRAM; +} +const ZEROED_HRTIME: HrTime = [0, 0]; + +export function mapOcMetric(metric: oc.Metric): MetricData | null { + const { description, name, unit, type } = metric.descriptor; + const mappedType = mapOcMetricDescriptorType(type); + if (mappedType === null) { + return null; + } + + const baseMetric: BaseMetric = { + aggregationTemporality: AggregationTemporality.CUMULATIVE, + descriptor: { + description, + name, + unit, + type: mappedType.type, + valueType: mappedType.valueType, + }, + }; + + switch (mappedType.dataPointType) { + case DataPointType.GAUGE: + return gauge(metric, mappedType.dataPointType, baseMetric); + case DataPointType.SUM: + return sum(metric, mappedType.dataPointType, baseMetric); + case DataPointType.HISTOGRAM: + return histogram(metric, mappedType.dataPointType, baseMetric); + } +} + +function mapOcMetricDescriptorType( + type: oc.MetricDescriptorType +): MappedType | null { + switch (type) { + case oc.MetricDescriptorType.GAUGE_INT64: + return { + type: InstrumentType.OBSERVABLE_GAUGE, + valueType: ValueType.INT, + dataPointType: DataPointType.GAUGE, + }; + case oc.MetricDescriptorType.GAUGE_DOUBLE: + return { + type: InstrumentType.OBSERVABLE_GAUGE, + valueType: ValueType.DOUBLE, + dataPointType: DataPointType.GAUGE, + }; + + case oc.MetricDescriptorType.CUMULATIVE_INT64: + return { + type: InstrumentType.COUNTER, + valueType: ValueType.INT, + dataPointType: DataPointType.SUM, + }; + case oc.MetricDescriptorType.CUMULATIVE_DOUBLE: + return { + type: InstrumentType.COUNTER, + valueType: ValueType.DOUBLE, + dataPointType: DataPointType.SUM, + }; + + case oc.MetricDescriptorType.CUMULATIVE_DISTRIBUTION: + return { + type: InstrumentType.HISTOGRAM, + valueType: ValueType.DOUBLE, + dataPointType: DataPointType.HISTOGRAM, + }; + + case oc.MetricDescriptorType.SUMMARY: + case oc.MetricDescriptorType.GAUGE_DISTRIBUTION: + case oc.MetricDescriptorType.UNSPECIFIED: + diag.warn( + 'Got unsupported metric MetricDescriptorType from OpenCensus: %s', + type + ); + return null; + } +} + +function gauge( + metric: oc.Metric, + dataPointType: DataPointType.GAUGE, + baseMetric: BaseMetric +): GaugeMetricData { + return { + ...baseMetric, + dataPoints: dataPoints(metric, value => value as number), + dataPointType, + }; +} + +function sum( + metric: oc.Metric, + dataPointType: DataPointType.SUM, + baseMetric: BaseMetric +): SumMetricData { + return { + ...baseMetric, + dataPoints: dataPoints(metric, value => value as number), + isMonotonic: true, + dataPointType, + }; +} + +function histogram( + metric: oc.Metric, + dataPointType: DataPointType.HISTOGRAM, + baseMetric: BaseMetric +): HistogramMetricData { + return { + ...baseMetric, + dataPoints: dataPoints(metric, value => { + const { + bucketOptions: { + explicit: { bounds }, + }, + buckets, + count, + sum: distSum, + } = value as oc.DistributionValue; + + return { + buckets: { + boundaries: bounds, + counts: buckets.map(bucket => bucket.count), + }, + count, + sum: distSum, + }; + }), + dataPointType, + }; +} + +function dataPoints( + metric: oc.Metric, + valueMapper: (value: oc.TimeSeriesPoint['value']) => T +): DataPoint[] { + return metric.timeseries.flatMap(ts => { + const attributes = zipOcLabels(metric.descriptor.labelKeys, ts.labelValues); + + // use zeroed hrTime if it is undefined, which probably shouldn't happen + const startTime = ocTimestampToHrTime(ts.startTimestamp) ?? ZEROED_HRTIME; + + // points should be an array with a single value, so this will return a single point per + // attribute set. + return ts.points.map( + (point): DataPoint => ({ + startTime, + attributes, + value: valueMapper(point.value), + endTime: ocTimestampToHrTime(point.timestamp) ?? ZEROED_HRTIME, + }) + ); + }); +} + +function ocTimestampToHrTime(ts: oc.Timestamp | undefined): HrTime | null { + if (ts === undefined || ts.seconds === null) { + return null; + } + return [ts.seconds, ts.nanos ?? 0]; +} + +function zipOcLabels( + labelKeys: oc.LabelKey[], + labelValues: oc.LabelValue[] +): Attributes { + const attributes: Attributes = {}; + for (let i = 0; i < labelKeys.length; i++) { + attributes[labelKeys[i].key] = labelValues[i].value ?? ''; + } + return attributes; +} diff --git a/experimental/packages/shim-opencensus/src/propagation.ts b/experimental/packages/shim-opencensus/src/propagation.ts index deb2509fa7..e0045fe7d9 100644 --- a/experimental/packages/shim-opencensus/src/propagation.ts +++ b/experimental/packages/shim-opencensus/src/propagation.ts @@ -23,7 +23,7 @@ import { TextMapGetter, TextMapSetter, } from '@opentelemetry/api'; -import { mapSpanContext, reverseMapSpanContext } from './transform'; +import { mapSpanContext, reverseMapSpanContext } from './trace-transform'; class Getter implements TextMapGetter { constructor(private ocGetter: oc.HeaderGetter) {} diff --git a/experimental/packages/shim-opencensus/src/transform.ts b/experimental/packages/shim-opencensus/src/trace-transform.ts similarity index 100% rename from experimental/packages/shim-opencensus/src/transform.ts rename to experimental/packages/shim-opencensus/src/trace-transform.ts diff --git a/experimental/packages/shim-opencensus/test/OpenCensusMetricProducer.test.ts b/experimental/packages/shim-opencensus/test/OpenCensusMetricProducer.test.ts new file mode 100644 index 0000000000..15b9cc1a6b --- /dev/null +++ b/experimental/packages/shim-opencensus/test/OpenCensusMetricProducer.test.ts @@ -0,0 +1,118 @@ +/* + * 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 oc from '@opencensus/core'; +import { ValueType } from '@opentelemetry/api'; +import { Resource } from '@opentelemetry/resources'; +import { + AggregationTemporality, + DataPointType, + SumMetricData, +} from '@opentelemetry/sdk-metrics'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { OpenCensusMetricProducer } from '../src/OpenCensusMetricProducer'; + +describe('OpenCensusMetricProducer', () => { + beforeEach(() => { + oc.globalStats.clear(); + sinon.useFakeTimers(); + }); + + afterEach(() => { + sinon.restore(); + }); + + // Since the resource is replaced by the SDK anyway + it('should return an empty Resource', async () => { + const producer = new OpenCensusMetricProducer(); + const resourceMetrics = await producer.collect(); + + assert.deepStrictEqual( + resourceMetrics.resourceMetrics.resource, + Resource.EMPTY + ); + }); + + it('should return no errors when no metrics are collected from OpenCensus', async () => { + const producer = new OpenCensusMetricProducer(); + const resourceMetrics = await producer.collect(); + assert.strictEqual(resourceMetrics.errors.length, 0); + }); + + it('should elide the scope when no metrics are collected from OpenCensus', async () => { + // No OpenCensus setup so won't produce any metrics + const producer = new OpenCensusMetricProducer(); + const resourceMetrics = await producer.collect(); + assert.strictEqual(resourceMetrics.resourceMetrics.scopeMetrics.length, 0); + }); + + it('should include OpenCensus metrics', async () => { + // Initialize OC metrics with one counter, adapted from + // https://opencensus.io/quickstart/nodejs/metrics/ + const measure = oc.globalStats.createMeasureDouble( + 'measure', + oc.MeasureUnit.MS + ); + const tagKey = { name: 'label1' }; + oc.globalStats.registerView( + oc.globalStats.createView( + 'measure', + measure, + oc.AggregationType.SUM, + [tagKey], + 'Test OC description' + ) + ); + + const tagMap = new oc.TagMap(); + tagMap.set(tagKey, { value: 'tagvalue' }); + oc.globalStats.record([{ measure, value: 125 }], tagMap); + + const producer = new OpenCensusMetricProducer(); + const resourceMetrics = await producer.collect(); + + assert.strictEqual(resourceMetrics.errors.length, 0); + assert.strictEqual(resourceMetrics.resourceMetrics.scopeMetrics.length, 1); + assert.strictEqual( + resourceMetrics.resourceMetrics.scopeMetrics[0].scope.name, + '@opentelemetry/shim-opencensus' + ); + assert.strictEqual( + resourceMetrics.resourceMetrics.scopeMetrics[0].metrics.length, + 1 + ); + const ocMetric = resourceMetrics.resourceMetrics.scopeMetrics[0] + .metrics[0] as SumMetricData; + assert.deepStrictEqual(ocMetric.descriptor, { + description: 'Test OC description', + name: 'measure', + type: 'COUNTER', + unit: 'ms', + valueType: ValueType.DOUBLE, + }); + assert.strictEqual(ocMetric.dataPoints[0].value, 125); + assert.deepStrictEqual(ocMetric.dataPoints[0].attributes, { + label1: 'tagvalue', + }); + assert.strictEqual(ocMetric.dataPointType, DataPointType.SUM); + assert.strictEqual(ocMetric.isMonotonic, true); + assert.strictEqual( + ocMetric.aggregationTemporality, + AggregationTemporality.CUMULATIVE + ); + }); +}); diff --git a/experimental/packages/shim-opencensus/test/metric-transform.test.ts b/experimental/packages/shim-opencensus/test/metric-transform.test.ts new file mode 100644 index 0000000000..289fbefd0c --- /dev/null +++ b/experimental/packages/shim-opencensus/test/metric-transform.test.ts @@ -0,0 +1,321 @@ +/* + * 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 { mapOcMetric } from '../src/metric-transform'; + +import * as oc from '@opencensus/core'; +import { ValueType } from '@opentelemetry/api'; +import { + AggregationTemporality, + DataPointType, + GaugeMetricData, + HistogramMetricData, + InstrumentType, + SumMetricData, +} from '@opentelemetry/sdk-metrics'; +import * as assert from 'assert'; + +describe('metric-transform', () => { + it('should map OpenCensus CUMULATIVE_INT64 to Sum', () => { + const metricData = mapOcMetric({ + descriptor: { + description: 'ocDescription', + name: 'ocMetricName', + type: oc.MetricDescriptorType.CUMULATIVE_INT64, + unit: 'ocUnit', + labelKeys: [ + { key: 'key1', description: '' }, + { key: 'key2', description: '' }, + ], + }, + timeseries: [ + { + startTimestamp: { seconds: 10, nanos: 10 }, + labelValues: [{ value: 'value1' }, { value: 'value2' }], + points: [{ timestamp: { seconds: 20, nanos: 20 }, value: 5 }], + }, + ], + }); + + assert.deepStrictEqual(metricData, { + aggregationTemporality: AggregationTemporality.CUMULATIVE, + dataPointType: DataPointType.SUM, + dataPoints: [ + { + attributes: { key1: 'value1', key2: 'value2' }, + endTime: [20, 20], + startTime: [10, 10], + value: 5, + }, + ], + descriptor: { + description: 'ocDescription', + name: 'ocMetricName', + type: InstrumentType.COUNTER, + unit: 'ocUnit', + valueType: ValueType.INT, + }, + isMonotonic: true, + } as SumMetricData); + }); + + it('should map OpenCensus CUMULATIVE_DOUBLE to Sum', () => { + const metricData = mapOcMetric({ + descriptor: { + description: 'ocDescription', + name: 'ocMetricName', + type: oc.MetricDescriptorType.CUMULATIVE_DOUBLE, + unit: 'ocUnit', + labelKeys: [ + { key: 'key1', description: '' }, + { key: 'key2', description: '' }, + ], + }, + timeseries: [ + { + startTimestamp: { seconds: 10, nanos: 10 }, + labelValues: [{ value: 'value1' }, { value: 'value2' }], + points: [{ timestamp: { seconds: 20, nanos: 20 }, value: 5.5 }], + }, + ], + }); + + assert.deepStrictEqual(metricData, { + aggregationTemporality: AggregationTemporality.CUMULATIVE, + dataPointType: DataPointType.SUM, + dataPoints: [ + { + attributes: { key1: 'value1', key2: 'value2' }, + endTime: [20, 20], + startTime: [10, 10], + value: 5.5, + }, + ], + descriptor: { + description: 'ocDescription', + name: 'ocMetricName', + type: InstrumentType.COUNTER, + unit: 'ocUnit', + valueType: ValueType.DOUBLE, + }, + isMonotonic: true, + } as SumMetricData); + }); + + it('should map OpenCensus CUMULATIVE_DISTRIBUTION to Histogram', () => { + const metricData = mapOcMetric({ + descriptor: { + description: 'ocDescription', + name: 'ocMetricName', + type: oc.MetricDescriptorType.CUMULATIVE_DISTRIBUTION, + unit: 'ocUnit', + labelKeys: [ + { key: 'key1', description: '' }, + { key: 'key2', description: '' }, + ], + }, + timeseries: [ + { + startTimestamp: { seconds: 10, nanos: 10 }, + labelValues: [{ value: 'value1' }, { value: 'value2' }], + points: [ + { + timestamp: { seconds: 20, nanos: 20 }, + value: { + bucketOptions: { + explicit: { + bounds: [1, 10, 100], + }, + }, + buckets: [ + { count: 0 }, + { count: 1 }, + { count: 2 }, + { count: 3 }, + ], + count: 6, + sum: 121, + sumOfSquaredDeviation: 4, + }, + }, + ], + }, + ], + }); + + assert.deepStrictEqual(metricData, { + aggregationTemporality: AggregationTemporality.CUMULATIVE, + dataPointType: DataPointType.HISTOGRAM, + dataPoints: [ + { + attributes: { key1: 'value1', key2: 'value2' }, + endTime: [20, 20], + startTime: [10, 10], + value: { + buckets: { + boundaries: [1, 10, 100], + counts: [0, 1, 2, 3], + }, + count: 6, + sum: 121, + }, + }, + ], + descriptor: { + description: 'ocDescription', + name: 'ocMetricName', + type: InstrumentType.HISTOGRAM, + unit: 'ocUnit', + valueType: ValueType.DOUBLE, + }, + } as HistogramMetricData); + }); + + it('should map OpenCensus GAUGE_INT64 to Gauge', () => { + const metricData = mapOcMetric({ + descriptor: { + description: 'ocDescription', + name: 'ocMetricName', + type: oc.MetricDescriptorType.GAUGE_INT64, + unit: 'ocUnit', + labelKeys: [ + { key: 'key1', description: '' }, + { key: 'key2', description: '' }, + ], + }, + timeseries: [ + { + startTimestamp: { seconds: 10, nanos: 10 }, + labelValues: [{ value: 'value1' }, { value: 'value2' }], + points: [{ timestamp: { seconds: 20, nanos: 20 }, value: 5 }], + }, + ], + }); + + assert.deepStrictEqual(metricData, { + aggregationTemporality: AggregationTemporality.CUMULATIVE, + dataPointType: DataPointType.GAUGE, + dataPoints: [ + { + attributes: { key1: 'value1', key2: 'value2' }, + endTime: [20, 20], + startTime: [10, 10], + value: 5, + }, + ], + descriptor: { + description: 'ocDescription', + name: 'ocMetricName', + type: InstrumentType.OBSERVABLE_GAUGE, + unit: 'ocUnit', + valueType: ValueType.INT, + }, + } as GaugeMetricData); + }); + + it('should map OpenCensus GAUGE_DOUBLE to Gauge', () => { + const metricData = mapOcMetric({ + descriptor: { + description: 'ocDescription', + name: 'ocMetricName', + type: oc.MetricDescriptorType.GAUGE_DOUBLE, + unit: 'ocUnit', + labelKeys: [ + { key: 'key1', description: '' }, + { key: 'key2', description: '' }, + ], + }, + timeseries: [ + { + startTimestamp: { seconds: 10, nanos: 10 }, + labelValues: [{ value: 'value1' }, { value: 'value2' }], + points: [{ timestamp: { seconds: 20, nanos: 20 }, value: 5.5 }], + }, + ], + }); + + assert.deepStrictEqual(metricData, { + aggregationTemporality: AggregationTemporality.CUMULATIVE, + dataPointType: DataPointType.GAUGE, + dataPoints: [ + { + attributes: { key1: 'value1', key2: 'value2' }, + endTime: [20, 20], + startTime: [10, 10], + value: 5.5, + }, + ], + descriptor: { + description: 'ocDescription', + name: 'ocMetricName', + type: InstrumentType.OBSERVABLE_GAUGE, + unit: 'ocUnit', + valueType: ValueType.DOUBLE, + }, + } as GaugeMetricData); + }); + + it('should drop unsupported OpenCensus GAUGE_DISTRIBUTION', () => { + const metricData = mapOcMetric({ + descriptor: { + description: 'ocDescription', + name: 'ocMetricName', + type: oc.MetricDescriptorType.GAUGE_DISTRIBUTION, + unit: 'ocUnit', + labelKeys: [ + { key: 'key1', description: '' }, + { key: 'key2', description: '' }, + ], + }, + timeseries: [ + { + startTimestamp: { seconds: 10, nanos: 10 }, + labelValues: [{ value: 'value1' }, { value: 'value2' }], + points: [{ timestamp: { seconds: 20, nanos: 20 }, value: 5 }], + }, + ], + }); + assert.deepStrictEqual(metricData, null); + }); + + it('should drop unsupported OpenCensus SUMMARY', () => { + const metricData = mapOcMetric({ + descriptor: { + description: 'ocDescription', + name: 'ocMetricName', + type: oc.MetricDescriptorType.SUMMARY, + unit: 'ocUnit', + labelKeys: [ + { key: 'key1', description: '' }, + { key: 'key2', description: '' }, + ], + }, + timeseries: [ + { + startTimestamp: { seconds: 10, nanos: 10 }, + labelValues: [{ value: 'value1' }, { value: 'value2' }], + points: [ + { + timestamp: { seconds: 20, nanos: 20 }, + value: { count: 5, sum: 10 }, + }, + ], + }, + ], + }); + assert.deepStrictEqual(metricData, null); + }); +}); diff --git a/experimental/packages/shim-opencensus/test/transform.test.ts b/experimental/packages/shim-opencensus/test/trace-transform.test.ts similarity index 98% rename from experimental/packages/shim-opencensus/test/transform.test.ts rename to experimental/packages/shim-opencensus/test/trace-transform.test.ts index 9a7f90cda0..6aacd5e951 100644 --- a/experimental/packages/shim-opencensus/test/transform.test.ts +++ b/experimental/packages/shim-opencensus/test/trace-transform.test.ts @@ -19,14 +19,14 @@ import { mapSpanContext, mapSpanKind, reverseMapSpanContext, -} from '../src/transform'; +} from '../src/trace-transform'; import * as oc from '@opencensus/core'; import { SpanKind } from '@opentelemetry/api'; import { TraceState } from '@opentelemetry/core'; import * as assert from 'assert'; -describe('transform', () => { +describe('trace-transform', () => { describe('mapSpanKind', () => { it('should return undefined with undefined input', () => { assert.strictEqual(mapSpanKind(undefined), undefined); diff --git a/experimental/packages/shim-opencensus/tsconfig.json b/experimental/packages/shim-opencensus/tsconfig.json index 91cebb5ad5..145dd31760 100644 --- a/experimental/packages/shim-opencensus/tsconfig.json +++ b/experimental/packages/shim-opencensus/tsconfig.json @@ -18,8 +18,14 @@ { "path": "../../../packages/opentelemetry-core" }, + { + "path": "../../../packages/opentelemetry-resources" + }, { "path": "../../../packages/opentelemetry-sdk-trace-base" + }, + { + "path": "../../../packages/sdk-metrics" } ] } diff --git a/integration-tests/propagation-validation-server/package.json b/integration-tests/propagation-validation-server/package.json index 88846f5d9f..927d8057a3 100644 --- a/integration-tests/propagation-validation-server/package.json +++ b/integration-tests/propagation-validation-server/package.json @@ -1,6 +1,6 @@ { "name": "propagation-validation-server", - "version": "1.13.0", + "version": "1.18.0", "description": "server for w3c tests", "main": "validation_server.js", "private": true, @@ -12,10 +12,10 @@ }, "dependencies": { "@opentelemetry/api": "^1.0.0", - "@opentelemetry/context-async-hooks": "1.13.0", - "@opentelemetry/core": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "axios": "1.4.0", + "@opentelemetry/context-async-hooks": "1.17.1", + "@opentelemetry/core": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "axios": "1.5.1", "body-parser": "1.19.0", "express": "4.17.3" }, diff --git a/karma.base.js b/karma.base.js index 7df76d7b13..2af2869368 100644 --- a/karma.base.js +++ b/karma.base.js @@ -19,12 +19,12 @@ module.exports = { hostname: 'localhost', browsers: ['ChromeHeadless'], frameworks: ['mocha'], - coverageIstanbulReporter: { - reports: ['html', 'json'], - dir: '.nyc_output', - fixWebpackSourcePaths: true + coverageReporter: { + type : 'json', + subdir: '.', + dir : '.nyc_output/' }, - reporters: ['spec', 'coverage-istanbul'], + reporters: ['spec', 'coverage'], files: ['test/index-webpack.ts'], preprocessors: { 'test/index-webpack*.ts': ['webpack'] diff --git a/karma.webpack.js b/karma.webpack.js index 138112547b..b7fa7acb97 100644 --- a/karma.webpack.js +++ b/karma.webpack.js @@ -31,8 +31,10 @@ module.exports = { exclude: /(node_modules|\.test\.[tj]sx?$)/, test: /\.ts$/, use: { - loader: 'istanbul-instrumenter-loader', - options: { esModules: true }, + loader: 'babel-loader', + options: { + plugins: ['babel-plugin-istanbul'], + } }, }, // This setting configures Node polyfills for the browser that will be diff --git a/lerna.json b/lerna.json index 14fb76982e..f0053f3ed7 100644 --- a/lerna.json +++ b/lerna.json @@ -6,7 +6,7 @@ "packages/*", "experimental/packages/*", "experimental/examples/*", - "experimental/backwards-compatability/*", + "experimental/backwards-compatibility/*", "integration-tests/*", "selenium-tests", "examples/otlp-exporter-node", diff --git a/package.json b/package.json index 0d232ef636..6d5460207d 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "test:browser": "lerna run test:browser", "test:webworker": "lerna run test:webworker", "test:backcompat": "lerna run test:backcompat", + "test:bench": "lerna run test:bench", "bootstrap": "lerna bootstrap --hoist --nohoist='zone.js'", "changelog": "lerna-changelog", "codecov": "lerna run codecov", @@ -63,19 +64,21 @@ "author": "OpenTelemetry Authors", "license": "Apache-2.0", "devDependencies": { - "@typescript-eslint/eslint-plugin": "5.3.1", - "@typescript-eslint/parser": "5.3.1", - "eslint": "8.22.0", - "eslint-config-prettier": "8.5.0", + "@typescript-eslint/eslint-plugin": "5.59.11", + "@typescript-eslint/parser": "5.59.11", + "benchmark": "2.1.4", + "eslint": "8.44.0", + "eslint-config-prettier": "9.0.0", "eslint-plugin-header": "3.1.1", "eslint-plugin-node": "11.1.0", - "eslint-plugin-prettier": "4.2.1", - "gh-pages": "5.0.0", - "lerna": "6.0.3", - "linkinator": "4.0.3", - "markdownlint-cli": "0.32.2", - "prettier": "2.8.0", - "semver": "7.3.5", + "eslint-plugin-prettier": "5.0.0", + "gh-pages": "6.0.0", + "lerna": "7.1.5", + "@lerna/legacy-package-management": "7.1.5", + "linkinator": "5.0.2", + "markdownlint-cli": "0.36.0", + "prettier": "3.0.3", + "semver": "7.5.4", "typedoc": "0.22.18", "typedoc-plugin-missing-exports": "1.0.0", "typedoc-plugin-resolve-crossmodule-references": "0.2.2", diff --git a/packages/opentelemetry-context-async-hooks/.eslintrc.js b/packages/opentelemetry-context-async-hooks/.eslintrc.js index f726f3becb..3d9af536bb 100644 --- a/packages/opentelemetry-context-async-hooks/.eslintrc.js +++ b/packages/opentelemetry-context-async-hooks/.eslintrc.js @@ -3,5 +3,5 @@ module.exports = { "mocha": true, "node": true }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/packages/opentelemetry-context-async-hooks/package.json b/packages/opentelemetry-context-async-hooks/package.json index efda2f556d..063ca2ed63 100644 --- a/packages/opentelemetry-context-async-hooks/package.json +++ b/packages/opentelemetry-context-async-hooks/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/context-async-hooks", - "version": "1.13.0", + "version": "1.17.1", "description": "OpenTelemetry AsyncHooks-based Context Manager", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -15,7 +15,7 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../scripts/peer-api-check.js" }, @@ -44,17 +44,19 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0", - "@types/mocha": "10.0.0", + "@opentelemetry/api": ">=1.0.0 <1.7.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", "codecov": "3.8.3", - "mocha": "10.0.0", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", "ts-mocha": "10.0.0", "typescript": "4.4.4" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0" + "@opentelemetry/api": ">=1.0.0 <1.7.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-context-async-hooks", "sideEffects": false diff --git a/packages/opentelemetry-context-zone-peer-dep/.eslintrc.js b/packages/opentelemetry-context-zone-peer-dep/.eslintrc.js index f21c674001..7561e7f833 100644 --- a/packages/opentelemetry-context-zone-peer-dep/.eslintrc.js +++ b/packages/opentelemetry-context-zone-peer-dep/.eslintrc.js @@ -7,5 +7,5 @@ module.exports = { "globals": { "Zone": "readonly" }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/packages/opentelemetry-context-zone-peer-dep/package.json b/packages/opentelemetry-context-zone-peer-dep/package.json index dfcf81d491..6654fe9e03 100644 --- a/packages/opentelemetry-context-zone-peer-dep/package.json +++ b/packages/opentelemetry-context-zone-peer-dep/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/context-zone-peer-dep", - "version": "1.13.0", + "version": "1.17.1", "description": "OpenTelemetry Context Zone with peer dependency for zone.js", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -16,9 +16,9 @@ "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", "version": "node ../../scripts/version-update.js", "tdd": "karma start", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../scripts/peer-api-check.js" }, @@ -53,34 +53,36 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", - "@opentelemetry/api": ">=1.0.0 <1.5.0", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@opentelemetry/api": ">=1.0.0 <1.7.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "@types/webpack-env": "1.16.3", "@types/zone.js": "0.5.12", - "babel-loader": "8.2.3", + "babel-loader": "8.3.0", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", "webpack": "4.46.0", - "webpack-cli": "4.9.1", + "webpack-cli": "4.10.0", "zone.js": "0.11.4" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0", + "@opentelemetry/api": ">=1.0.0 <1.7.0", "zone.js": "^0.10.2 || ^0.11.0" }, "sideEffects": false, diff --git a/packages/opentelemetry-context-zone/.eslintrc.js b/packages/opentelemetry-context-zone/.eslintrc.js index c21aa0e358..a374ccda6a 100644 --- a/packages/opentelemetry-context-zone/.eslintrc.js +++ b/packages/opentelemetry-context-zone/.eslintrc.js @@ -3,5 +3,5 @@ module.exports = { "browser": true, "commonjs": true }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/packages/opentelemetry-context-zone/package.json b/packages/opentelemetry-context-zone/package.json index 57d82fcbbc..38703eb66b 100644 --- a/packages/opentelemetry-context-zone/package.json +++ b/packages/opentelemetry-context-zone/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/context-zone", - "version": "1.13.0", + "version": "1.17.1", "description": "OpenTelemetry Context Zone", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -15,7 +15,7 @@ "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../scripts/peer-api-check.js" }, @@ -50,30 +50,32 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "@types/webpack-env": "1.16.3", - "babel-loader": "8.2.3", + "babel-loader": "8.3.0", "codecov": "3.8.3", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", "webpack": "4.46.0", - "webpack-cli": "4.9.1", - "webpack-merge": "5.8.0" + "webpack-cli": "4.10.0", + "webpack-merge": "5.9.0" }, "dependencies": { - "@opentelemetry/context-zone-peer-dep": "1.13.0", + "@opentelemetry/context-zone-peer-dep": "1.17.1", "zone.js": "^0.11.0" }, "sideEffects": true, diff --git a/packages/opentelemetry-core/.eslintrc.js b/packages/opentelemetry-core/.eslintrc.js index 9dfe62f9b8..36847df9fb 100644 --- a/packages/opentelemetry-core/.eslintrc.js +++ b/packages/opentelemetry-core/.eslintrc.js @@ -5,5 +5,5 @@ module.exports = { "node": true, "browser": true }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json index 5900c8d204..6ab47de028 100644 --- a/packages/opentelemetry-core/package.json +++ b/packages/opentelemetry-core/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/core", - "version": "1.13.0", + "version": "1.17.1", "description": "OpenTelemetry Core provides constants and utilities shared by all OpenTelemetry SDK packages.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -18,7 +18,7 @@ "compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts --exclude 'test/platform/browser/**/*.ts'", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "tdd": "npm run tdd:node", "tdd:node": "npm run test -- --watch-extensions ts --watch", "tdd:browser": "karma start", @@ -28,7 +28,7 @@ "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../scripts/peer-api-check.js" }, @@ -64,33 +64,34 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0", - "@types/mocha": "10.0.0", + "@opentelemetry/api": ">=1.0.0 <1.7.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "@types/webpack-env": "1.16.3", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "lerna": "6.0.3", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", "webpack": "4.46.0" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0" + "@opentelemetry/api": ">=1.0.0 <1.7.0" }, "dependencies": { - "@opentelemetry/semantic-conventions": "1.13.0" + "@opentelemetry/semantic-conventions": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-core", "sideEffects": false diff --git a/packages/opentelemetry-core/src/baggage/utils.ts b/packages/opentelemetry-core/src/baggage/utils.ts index 991b8a89a6..bb8b4b0155 100644 --- a/packages/opentelemetry-core/src/baggage/utils.ts +++ b/packages/opentelemetry-core/src/baggage/utils.ts @@ -61,10 +61,14 @@ export function parsePairKeyValue( if (valueProps.length <= 0) return; const keyPairPart = valueProps.shift(); if (!keyPairPart) return; - const keyPair = keyPairPart.split(BAGGAGE_KEY_PAIR_SEPARATOR); - if (keyPair.length !== 2) return; - const key = decodeURIComponent(keyPair[0].trim()); - const value = decodeURIComponent(keyPair[1].trim()); + const separatorIndex = keyPairPart.indexOf(BAGGAGE_KEY_PAIR_SEPARATOR); + if (separatorIndex <= 0) return; + const key = decodeURIComponent( + keyPairPart.substring(0, separatorIndex).trim() + ); + const value = decodeURIComponent( + keyPairPart.substring(separatorIndex + 1).trim() + ); let metadata; if (valueProps.length > 0) { metadata = baggageEntryMetadataFromString( diff --git a/packages/opentelemetry-core/src/common/time.ts b/packages/opentelemetry-core/src/common/time.ts index 8dd650a992..8d3051b00c 100644 --- a/packages/opentelemetry-core/src/common/time.ts +++ b/packages/opentelemetry-core/src/common/time.ts @@ -129,7 +129,7 @@ export function hrTimeToNanoseconds(time: api.HrTime): number { * @param time */ export function hrTimeToMilliseconds(time: api.HrTime): number { - return Math.round(time[0] * 1e3 + time[1] / 1e6); + return time[0] * 1e3 + time[1] / 1e6; } /** @@ -137,7 +137,7 @@ export function hrTimeToMilliseconds(time: api.HrTime): number { * @param time */ export function hrTimeToMicroseconds(time: api.HrTime): number { - return Math.round(time[0] * 1e6 + time[1] / 1e3); + return time[0] * 1e6 + time[1] / 1e3; } /** diff --git a/packages/opentelemetry-core/src/utils/callback.ts b/packages/opentelemetry-core/src/utils/callback.ts index ebbad5f96b..56c900c2ab 100644 --- a/packages/opentelemetry-core/src/utils/callback.ts +++ b/packages/opentelemetry-core/src/utils/callback.ts @@ -22,11 +22,14 @@ import { Deferred } from './promise'; export class BindOnceFuture< R, This = unknown, - T extends (this: This, ...args: unknown[]) => R = () => R + T extends (this: This, ...args: unknown[]) => R = () => R, > { private _isCalled = false; private _deferred = new Deferred(); - constructor(private _callback: T, private _that: This) {} + constructor( + private _callback: T, + private _that: This + ) {} get isCalled() { return this._isCalled; diff --git a/packages/opentelemetry-core/src/utils/environment.ts b/packages/opentelemetry-core/src/utils/environment.ts index 1ab79176da..fda6e103b7 100644 --- a/packages/opentelemetry-core/src/utils/environment.ts +++ b/packages/opentelemetry-core/src/utils/environment.ts @@ -27,7 +27,7 @@ const DEFAULT_LIST_SEPARATOR = ','; const ENVIRONMENT_BOOLEAN_KEYS = ['OTEL_SDK_DISABLED'] as const; type ENVIRONMENT_BOOLEANS = { - [K in typeof ENVIRONMENT_BOOLEAN_KEYS[number]]?: boolean; + [K in (typeof ENVIRONMENT_BOOLEAN_KEYS)[number]]?: boolean; }; function isEnvVarABoolean(key: unknown): key is keyof ENVIRONMENT_BOOLEANS { @@ -63,7 +63,7 @@ const ENVIRONMENT_NUMBERS_KEYS = [ ] as const; type ENVIRONMENT_NUMBERS = { - [K in typeof ENVIRONMENT_NUMBERS_KEYS[number]]?: number; + [K in (typeof ENVIRONMENT_NUMBERS_KEYS)[number]]?: number; }; function isEnvVarANumber(key: unknown): key is keyof ENVIRONMENT_NUMBERS { @@ -78,7 +78,7 @@ const ENVIRONMENT_LISTS_KEYS = [ ] as const; type ENVIRONMENT_LISTS = { - [K in typeof ENVIRONMENT_LISTS_KEYS[number]]?: string[]; + [K in (typeof ENVIRONMENT_LISTS_KEYS)[number]]?: string[]; }; function isEnvVarAList(key: unknown): key is keyof ENVIRONMENT_LISTS { diff --git a/packages/opentelemetry-core/test/baggage/W3CBaggagePropagator.test.ts b/packages/opentelemetry-core/test/baggage/W3CBaggagePropagator.test.ts index c30bfb3014..801496513f 100644 --- a/packages/opentelemetry-core/test/baggage/W3CBaggagePropagator.test.ts +++ b/packages/opentelemetry-core/test/baggage/W3CBaggagePropagator.test.ts @@ -181,9 +181,9 @@ describe('W3CBaggagePropagator', () => { describe('.extract()', () => { const baggageValue = - 'key1=d4cda95b,key3=c88815a7, keyn = valn, keym =valm'; + 'key1=d4cda95b==,key3=c88815a7, keyn = valn, keym =valm'; const expected = propagation.createBaggage({ - key1: { value: 'd4cda95b' }, + key1: { value: 'd4cda95b==' }, key3: { value: 'c88815a7' }, keyn: { value: 'valn' }, keym: { value: 'valm' }, @@ -217,7 +217,7 @@ describe('W3CBaggagePropagator', () => { it('should extract context of a sampled span when the headerValue comes as array with multiple items', () => { carrier[BAGGAGE_HEADER] = [ - 'key1=d4cda95b,key3=c88815a7, keyn = valn', + 'key1=d4cda95b==,key3=c88815a7, keyn = valn', 'keym =valm', ]; const extractedBaggage = propagation.getBaggage( @@ -282,10 +282,6 @@ describe('W3CBaggagePropagator', () => { header: '289371298nekjh2939299283jbk2b', baggage: undefined, }, - invalidDoubleEqual: { - header: 'key1==value;key2=value2', - baggage: undefined, - }, invalidWrongKeyValueFormat: { header: 'key1:value;key2=value2', baggage: undefined, @@ -295,7 +291,7 @@ describe('W3CBaggagePropagator', () => { baggage: undefined, }, mixInvalidAndValidKeys: { - header: 'key1==value,key2=value2', + header: 'key1:value,key2=value2', baggage: propagation.createBaggage({ key2: { value: 'value2', diff --git a/packages/opentelemetry-core/test/utils/merge.test.ts b/packages/opentelemetry-core/test/utils/merge.test.ts index 76e9ab2fe0..56c08c8321 100644 --- a/packages/opentelemetry-core/test/utils/merge.test.ts +++ b/packages/opentelemetry-core/test/utils/merge.test.ts @@ -272,7 +272,10 @@ class A { } class B extends A { - constructor(name = 'foo', private _ver = 1) { + constructor( + name = 'foo', + private _ver = 1 + ) { super(name); } getVer() { diff --git a/packages/opentelemetry-exporter-jaeger/.eslintrc.js b/packages/opentelemetry-exporter-jaeger/.eslintrc.js index f726f3becb..3d9af536bb 100644 --- a/packages/opentelemetry-exporter-jaeger/.eslintrc.js +++ b/packages/opentelemetry-exporter-jaeger/.eslintrc.js @@ -3,5 +3,5 @@ module.exports = { "mocha": true, "node": true }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json index 6dfc53b45c..b412ade129 100644 --- a/packages/opentelemetry-exporter-jaeger/package.json +++ b/packages/opentelemetry-exporter-jaeger/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-jaeger", - "version": "1.13.0", + "version": "1.17.1", "description": "OpenTelemetry Exporter Jaeger allows user to send collected traces to Jaeger", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -16,7 +16,7 @@ "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../scripts/peer-api-check.js" }, @@ -45,15 +45,17 @@ }, "devDependencies": { "@opentelemetry/api": "^1.0.0", - "@opentelemetry/resources": "1.13.0", - "@types/mocha": "10.0.0", + "@opentelemetry/resources": "1.17.1", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "codecov": "3.8.3", - "mocha": "10.0.0", - "nock": "13.0.11", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", + "nock": "13.3.3", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-mocha": "10.0.0", "typescript": "4.4.4" }, @@ -61,9 +63,9 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "@opentelemetry/semantic-conventions": "1.13.0", + "@opentelemetry/core": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1", "jaeger-client": "^3.15.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-exporter-jaeger", diff --git a/packages/opentelemetry-exporter-jaeger/src/version.js b/packages/opentelemetry-exporter-jaeger/src/version.js new file mode 100644 index 0000000000..2090d63abf --- /dev/null +++ b/packages/opentelemetry-exporter-jaeger/src/version.js @@ -0,0 +1,20 @@ +"use strict"; +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VERSION = void 0; +// this is autogenerated file, see scripts/version-update.js +exports.VERSION = '1.16.0'; diff --git a/packages/opentelemetry-exporter-zipkin/.eslintrc.js b/packages/opentelemetry-exporter-zipkin/.eslintrc.js index 9dfe62f9b8..36847df9fb 100644 --- a/packages/opentelemetry-exporter-zipkin/.eslintrc.js +++ b/packages/opentelemetry-exporter-zipkin/.eslintrc.js @@ -5,5 +5,5 @@ module.exports = { "node": true, "browser": true }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/packages/opentelemetry-exporter-zipkin/package.json b/packages/opentelemetry-exporter-zipkin/package.json index a6c0e26d47..b7e10f8ebc 100644 --- a/packages/opentelemetry-exporter-zipkin/package.json +++ b/packages/opentelemetry-exporter-zipkin/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-zipkin", - "version": "1.13.0", + "version": "1.17.1", "description": "OpenTelemetry Zipkin Exporter allows the user to send collected traces to Zipkin.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -23,10 +23,10 @@ "lint:fix": "eslint . --ext .ts --fix", "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../scripts/peer-api-check.js" }, @@ -60,40 +60,42 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", + "@babel/core": "7.22.20", "@opentelemetry/api": "^1.0.0", - "@types/mocha": "10.0.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "@types/webpack-env": "1.16.3", - "babel-loader": "8.2.3", + "babel-loader": "8.3.0", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", - "nock": "13.0.11", + "lerna": "7.1.5", + "mocha": "10.2.0", + "nock": "13.3.3", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", "webpack": "4.46.0", - "webpack-cli": "4.9.1", - "webpack-merge": "5.8.0" + "webpack-cli": "4.10.0", + "webpack-merge": "5.9.0" }, "peerDependencies": { "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "@opentelemetry/semantic-conventions": "1.13.0" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-exporter-zipkin", "sideEffects": false diff --git a/packages/opentelemetry-exporter-zipkin/src/platform/browser/util.ts b/packages/opentelemetry-exporter-zipkin/src/platform/browser/util.ts index 7c5ace3588..220ff4a526 100644 --- a/packages/opentelemetry-exporter-zipkin/src/platform/browser/util.ts +++ b/packages/opentelemetry-exporter-zipkin/src/platform/browser/util.ts @@ -34,6 +34,7 @@ export function prepareSend( ): zipkinTypes.SendFn { let xhrHeaders: Record; const useBeacon = typeof navigator.sendBeacon === 'function' && !headers; + const xhr = typeof XMLHttpRequest === 'function'; if (headers) { xhrHeaders = { Accept: 'application/json', @@ -56,8 +57,10 @@ export function prepareSend( const payload = JSON.stringify(zipkinSpans); if (useBeacon) { sendWithBeacon(payload, done, urlStr); - } else { + } else if (xhr) { sendWithXhr(payload, done, urlStr, xhrHeaders); + } else { + sendWithFetch(payload, done, urlStr, xhrHeaders); } }; } @@ -130,3 +133,38 @@ function sendWithXhr( diag.debug(`Zipkin request payload: ${data}`); xhr.send(data); } + +/** + * Sends data using fetch + * @param data + * @param done + * @param urlStr + * @param headers + */ +function sendWithFetch( + data: string, + done: (result: ExportResult) => void, + urlStr: string, + headers: Record = {} +) { + diag.debug(`Zipkin request payload: ${data}`); + fetch(urlStr, {method: 'POST', body: data, headers}).then( + (response) => { + diag.debug(`Zipkin response status code: ${response.status}, body: ${data}`); + if (response.status >= 200 && response.status < 400) { + return done({ code: ExportResultCode.SUCCESS }); + } else { + return done({ + code: ExportResultCode.FAILED, + error: new Error( + `Got unexpected status code from zipkin: ${response.status}` + ), + }); + } + }, + (error) => { + globalErrorHandler(new Error(`Zipkin request error: ${error.message}`)); + return done({ code: ExportResultCode.FAILED }); + } + ) +} diff --git a/packages/opentelemetry-exporter-zipkin/src/transform.ts b/packages/opentelemetry-exporter-zipkin/src/transform.ts index 94983057f6..06fbe5973a 100644 --- a/packages/opentelemetry-exporter-zipkin/src/transform.ts +++ b/packages/opentelemetry-exporter-zipkin/src/transform.ts @@ -48,7 +48,7 @@ export function toZipkinSpan( id: span.spanContext().spanId, kind: ZIPKIN_SPAN_KIND_MAPPING[span.kind], timestamp: hrTimeToMicroseconds(span.startTime), - duration: hrTimeToMicroseconds(span.duration), + duration: Math.round(hrTimeToMicroseconds(span.duration)), localEndpoint: { serviceName }, tags: _toZipkinTags(span, statusCodeTagName, statusErrorTagName), annotations: span.events.length @@ -111,7 +111,7 @@ export function _toZipkinAnnotations( events: TimedEvent[] ): zipkinTypes.Annotation[] { return events.map(event => ({ - timestamp: hrTimeToMicroseconds(event.time), + timestamp: Math.round(hrTimeToMicroseconds(event.time)), value: event.name, })); } diff --git a/packages/opentelemetry-exporter-zipkin/src/version.js b/packages/opentelemetry-exporter-zipkin/src/version.js new file mode 100644 index 0000000000..2090d63abf --- /dev/null +++ b/packages/opentelemetry-exporter-zipkin/src/version.js @@ -0,0 +1,20 @@ +"use strict"; +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VERSION = void 0; +// this is autogenerated file, see scripts/version-update.js +exports.VERSION = '1.16.0'; diff --git a/packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts b/packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts index 65a06922af..4df7f73f6c 100644 --- a/packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts +++ b/packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts @@ -82,11 +82,11 @@ describe('transform', () => { annotations: [ { value: 'my-event', - timestamp: hrTimeToMicroseconds(span.events[0].time), + timestamp: Math.round(hrTimeToMicroseconds(span.events[0].time)), }, ], - duration: hrTimeToMicroseconds( - hrTimeDuration(span.startTime, span.endTime) + duration: Math.round( + hrTimeToMicroseconds(hrTimeDuration(span.startTime, span.endTime)) ), id: span.spanContext().spanId, localEndpoint: { @@ -128,8 +128,8 @@ describe('transform', () => { assert.deepStrictEqual(zipkinSpan, { kind: 'SERVER', annotations: undefined, - duration: hrTimeToMicroseconds( - hrTimeDuration(span.startTime, span.endTime) + duration: Math.round( + hrTimeToMicroseconds(hrTimeDuration(span.startTime, span.endTime)) ), id: span.spanContext().spanId, localEndpoint: { @@ -179,8 +179,8 @@ describe('transform', () => { assert.deepStrictEqual(zipkinSpan, { kind: item.zipkin, annotations: undefined, - duration: hrTimeToMicroseconds( - hrTimeDuration(span.startTime, span.endTime) + duration: Math.round( + hrTimeToMicroseconds(hrTimeDuration(span.startTime, span.endTime)) ), id: span.spanContext().spanId, localEndpoint: { @@ -329,11 +329,11 @@ describe('transform', () => { assert.deepStrictEqual(annotations, [ { value: 'my-event1', - timestamp: hrTimeToMicroseconds(span.events[0].time), + timestamp: Math.round(hrTimeToMicroseconds(span.events[0].time)), }, { value: 'my-event2', - timestamp: hrTimeToMicroseconds(span.events[1].time), + timestamp: Math.round(hrTimeToMicroseconds(span.events[1].time)), }, ]); }); diff --git a/packages/opentelemetry-propagator-b3/.eslintrc.js b/packages/opentelemetry-propagator-b3/.eslintrc.js index 9dfe62f9b8..36847df9fb 100644 --- a/packages/opentelemetry-propagator-b3/.eslintrc.js +++ b/packages/opentelemetry-propagator-b3/.eslintrc.js @@ -5,5 +5,5 @@ module.exports = { "node": true, "browser": true }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/packages/opentelemetry-propagator-b3/package.json b/packages/opentelemetry-propagator-b3/package.json index 31fde1399c..d1f04a4453 100644 --- a/packages/opentelemetry-propagator-b3/package.json +++ b/packages/opentelemetry-propagator-b3/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/propagator-b3", - "version": "1.13.0", + "version": "1.17.1", "description": "OpenTelemetry B3 propagator provides context propagation for systems that are using the B3 header format", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -17,7 +17,7 @@ "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../scripts/peer-api-check.js" }, @@ -51,18 +51,19 @@ "access": "public" }, "dependencies": { - "@opentelemetry/core": "1.13.0" + "@opentelemetry/core": "1.17.1" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0" + "@opentelemetry/api": ">=1.0.0 <1.7.0" }, "devDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0", - "@types/mocha": "10.0.0", + "@opentelemetry/api": ">=1.0.0 <1.7.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", "codecov": "3.8.3", - "istanbul-instrumenter-loader": "3.0.1", - "mocha": "10.0.0", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", diff --git a/packages/opentelemetry-propagator-b3/src/version.js b/packages/opentelemetry-propagator-b3/src/version.js new file mode 100644 index 0000000000..2090d63abf --- /dev/null +++ b/packages/opentelemetry-propagator-b3/src/version.js @@ -0,0 +1,20 @@ +"use strict"; +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VERSION = void 0; +// this is autogenerated file, see scripts/version-update.js +exports.VERSION = '1.16.0'; diff --git a/packages/opentelemetry-propagator-jaeger/.eslintrc.js b/packages/opentelemetry-propagator-jaeger/.eslintrc.js index b23ee98fc0..3913d6d94b 100644 --- a/packages/opentelemetry-propagator-jaeger/.eslintrc.js +++ b/packages/opentelemetry-propagator-jaeger/.eslintrc.js @@ -4,5 +4,5 @@ module.exports = { "commonjs": true, "browser": true, }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/packages/opentelemetry-propagator-jaeger/package.json b/packages/opentelemetry-propagator-jaeger/package.json index 30aa851011..ee8455ef1a 100644 --- a/packages/opentelemetry-propagator-jaeger/package.json +++ b/packages/opentelemetry-propagator-jaeger/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/propagator-jaeger", - "version": "1.13.0", + "version": "1.17.1", "description": "OpenTelemetry Jaeger propagator provides HTTP header propagation for systems that are using Jaeger HTTP header format.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -10,7 +10,7 @@ "prepublishOnly": "npm run compile", "compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/index-webpack.ts'", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "tdd": "npm run tdd:node", "tdd:node": "npm run test -- --watch-extensions ts --watch", "tdd:browser": "karma start", @@ -20,7 +20,7 @@ "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../scripts/peer-api-check.js" }, @@ -54,32 +54,34 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0", - "@types/mocha": "10.0.0", + "@opentelemetry/api": ">=1.0.0 <1.7.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "@types/webpack-env": "1.16.3", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", "webpack": "4.46.0" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0" + "@opentelemetry/api": ">=1.0.0 <1.7.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0" + "@opentelemetry/core": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-propagator-jaeger", "sideEffects": false diff --git a/packages/opentelemetry-propagator-jaeger/src/version.js b/packages/opentelemetry-propagator-jaeger/src/version.js new file mode 100644 index 0000000000..2090d63abf --- /dev/null +++ b/packages/opentelemetry-propagator-jaeger/src/version.js @@ -0,0 +1,20 @@ +"use strict"; +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VERSION = void 0; +// this is autogenerated file, see scripts/version-update.js +exports.VERSION = '1.16.0'; diff --git a/packages/opentelemetry-resources/.eslintrc.js b/packages/opentelemetry-resources/.eslintrc.js index 9dfe62f9b8..36847df9fb 100644 --- a/packages/opentelemetry-resources/.eslintrc.js +++ b/packages/opentelemetry-resources/.eslintrc.js @@ -5,5 +5,5 @@ module.exports = { "node": true, "browser": true }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/packages/opentelemetry-resources/package.json b/packages/opentelemetry-resources/package.json index a6bb86ecc5..f4cc67c22a 100644 --- a/packages/opentelemetry-resources/package.json +++ b/packages/opentelemetry-resources/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resources", - "version": "1.13.0", + "version": "1.17.1", "description": "OpenTelemetry SDK resources", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -22,12 +22,12 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", - "test:browser": "nyc karma start --single-run", - "test:webworker": "nyc karma start karma.worker.js --single-run", + "test:browser": "karma start --single-run", + "test:webworker": "karma start karma.worker.js --single-run", "tdd": "npm run test -- --watch-extensions ts --watch", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", "version": "node ../../scripts/version-update.js", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../scripts/peer-api-check.js" }, @@ -61,36 +61,38 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0", + "@opentelemetry/api": ">=1.0.0 <1.7.0", "@opentelemetry/resources_1.9.0": "npm:@opentelemetry/resources@1.9.0", - "@types/mocha": "10.0.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "@types/webpack-env": "1.16.3", "codecov": "3.8.3", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", "karma-mocha-webworker": "1.3.0", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", - "nock": "13.0.11", + "lerna": "7.1.5", + "mocha": "10.2.0", + "nock": "13.3.3", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-mocha": "10.0.0", "typescript": "4.4.4", "webpack": "4.46.0", - "webpack-cli": "4.9.1", - "webpack-merge": "5.8.0" + "webpack-cli": "4.10.0", + "webpack-merge": "5.9.0" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0" + "@opentelemetry/api": ">=1.0.0 <1.7.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/semantic-conventions": "1.13.0" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-resources", "sideEffects": false diff --git a/packages/opentelemetry-resources/src/detect-resources.ts b/packages/opentelemetry-resources/src/detect-resources.ts index be6943f81d..4fa477a4f8 100644 --- a/packages/opentelemetry-resources/src/detect-resources.ts +++ b/packages/opentelemetry-resources/src/detect-resources.ts @@ -26,7 +26,7 @@ import { IResource } from './IResource'; * does not resolve until all the underlying detectors have resolved, unlike * detectResourcesSync. * - * @deprecated use detectResourceSync() instead. + * @deprecated use detectResourcesSync() instead. * @param config Configuration for resource detection */ export const detectResources = async ( diff --git a/packages/opentelemetry-sdk-trace-base/.eslintrc.js b/packages/opentelemetry-sdk-trace-base/.eslintrc.js index 9dfe62f9b8..36847df9fb 100644 --- a/packages/opentelemetry-sdk-trace-base/.eslintrc.js +++ b/packages/opentelemetry-sdk-trace-base/.eslintrc.js @@ -5,5 +5,5 @@ module.exports = { "node": true, "browser": true }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/packages/opentelemetry-sdk-trace-base/package.json b/packages/opentelemetry-sdk-trace-base/package.json index d493500dc1..eca577109a 100644 --- a/packages/opentelemetry-sdk-trace-base/package.json +++ b/packages/opentelemetry-sdk-trace-base/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-trace-base", - "version": "1.13.0", + "version": "1.17.1", "description": "OpenTelemetry Tracing", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -18,8 +18,9 @@ "compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", - "test:browser": "nyc karma start --single-run", - "test:webworker": "nyc karma start karma.worker.js --single-run", + "test:browser": "karma start --single-run", + "test:webworker": "karma start karma.worker.js --single-run", + "test:bench": "node test/performance/benchmark/index.js | tee .benchmark-results.txt", "tdd": "npm run tdd:node", "tdd:node": "npm run test -- --watch-extensions ts --watch", "tdd:browser": "karma start", @@ -29,7 +30,7 @@ "codecov:webworker": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../scripts/peer-api-check.js" }, @@ -64,36 +65,38 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0", + "@opentelemetry/api": ">=1.0.0 <1.7.0", "@opentelemetry/resources_1.9.0": "npm:@opentelemetry/resources@1.9.0", - "@types/mocha": "10.0.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "@types/webpack-env": "1.16.3", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", "karma-mocha-webworker": "1.3.0", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", "webpack": "4.46.0" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0" + "@opentelemetry/api": ">=1.0.0 <1.7.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/semantic-conventions": "1.13.0" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-base", "sideEffects": false diff --git a/packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts b/packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts index d760ff5809..fef5c80dc0 100644 --- a/packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts +++ b/packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts @@ -41,12 +41,16 @@ export abstract class BatchSpanProcessorBase private readonly _scheduledDelayMillis: number; private readonly _exportTimeoutMillis: number; + private _isExporting = false; private _finishedSpans: ReadableSpan[] = []; private _timer: NodeJS.Timeout | undefined; private _shutdownOnce: BindOnceFuture; private _droppedSpansCount: number = 0; - constructor(private readonly _exporter: SpanExporter, config?: T) { + constructor( + private readonly _exporter: SpanExporter, + config?: T + ) { const env = getEnv(); this._maxExportBatchSize = typeof config?.maxExportBatchSize === 'number' @@ -200,8 +204,8 @@ export abstract class BatchSpanProcessorBase doExport(); } else { Promise.all( - pendingResources.map(resource => - resource.waitForAsyncAttributes?.() + pendingResources.map( + resource => resource.waitForAsyncAttributes?.() ) ).then(doExport, err => { globalErrorHandler(err); @@ -213,19 +217,28 @@ export abstract class BatchSpanProcessorBase } private _maybeStartTimer() { - if (this._timer !== undefined) return; - this._timer = setTimeout(() => { + if (this._isExporting) return; + const flush = () => { + this._isExporting = true; this._flushOneBatch() .then(() => { + this._isExporting = false; if (this._finishedSpans.length > 0) { this._clearTimer(); this._maybeStartTimer(); } }) .catch(e => { + this._isExporting = false; globalErrorHandler(e); }); - }, this._scheduledDelayMillis); + }; + // we only wait if the queue doesn't have enough elements yet + if (this._finishedSpans.length >= this._maxExportBatchSize) { + return flush(); + } + if (this._timer !== undefined) return; + this._timer = setTimeout(() => flush(), this._scheduledDelayMillis); unrefTimer(this._timer); } diff --git a/packages/opentelemetry-sdk-trace-base/test/common/export/BatchSpanProcessorBase.test.ts b/packages/opentelemetry-sdk-trace-base/test/common/export/BatchSpanProcessorBase.test.ts index 069287fc59..83fb3ebe44 100644 --- a/packages/opentelemetry-sdk-trace-base/test/common/export/BatchSpanProcessorBase.test.ts +++ b/packages/opentelemetry-sdk-trace-base/test/common/export/BatchSpanProcessorBase.test.ts @@ -16,6 +16,7 @@ import { diag, ROOT_CONTEXT } from '@opentelemetry/api'; import { + ExportResult, ExportResultCode, loggingErrorHandler, setGlobalErrorHandler, @@ -27,7 +28,9 @@ import { BasicTracerProvider, BufferConfig, InMemorySpanExporter, + ReadableSpan, Span, + SpanExporter, } from '../../../src'; import { context } from '@opentelemetry/api'; import { TestRecordOnlySampler } from './TestRecordOnlySampler'; @@ -175,43 +178,35 @@ describe('BatchSpanProcessorBase', () => { assert.strictEqual(spy.args.length, 0); }); - it('should export the sampled spans with buffer size reached', done => { - const clock = sinon.useFakeTimers(); + it('should export the sampled spans with buffer size reached', async () => { const processor = new BatchSpanProcessor(exporter, defaultBufferConfig); - for (let i = 0; i < defaultBufferConfig.maxExportBatchSize; i++) { - const span = createSampledSpan(`${name}_${i}`); + const span = createSampledSpan(name); + for (let i = 1; i < defaultBufferConfig.maxExportBatchSize; i++) { processor.onStart(span, ROOT_CONTEXT); assert.strictEqual(exporter.getFinishedSpans().length, 0); processor.onEnd(span); assert.strictEqual(exporter.getFinishedSpans().length, 0); } - const span = createSampledSpan(`${name}_6`); processor.onStart(span, ROOT_CONTEXT); processor.onEnd(span); - - setTimeout(async () => { - assert.strictEqual(exporter.getFinishedSpans().length, 5); - await processor.shutdown(); - assert.strictEqual(exporter.getFinishedSpans().length, 0); - done(); - }, defaultBufferConfig.scheduledDelayMillis + 1000); - clock.tick(defaultBufferConfig.scheduledDelayMillis + 1000); - clock.restore(); + assert.strictEqual(exporter.getFinishedSpans().length, 5); + await processor.shutdown(); + assert.strictEqual(exporter.getFinishedSpans().length, 0); }); it('should force flush when timeout exceeded', done => { const clock = sinon.useFakeTimers(); const processor = new BatchSpanProcessor(exporter, defaultBufferConfig); - for (let i = 0; i < defaultBufferConfig.maxExportBatchSize; i++) { - const span = createSampledSpan(`${name}_${i}`); + const span = createSampledSpan(name); + for (let i = 1; i < defaultBufferConfig.maxExportBatchSize; i++) { processor.onStart(span, ROOT_CONTEXT); processor.onEnd(span); assert.strictEqual(exporter.getFinishedSpans().length, 0); } setTimeout(() => { - assert.strictEqual(exporter.getFinishedSpans().length, 5); + assert.strictEqual(exporter.getFinishedSpans().length, 4); done(); }, defaultBufferConfig.scheduledDelayMillis + 1000); @@ -222,14 +217,14 @@ describe('BatchSpanProcessorBase', () => { it('should force flush on demand', () => { const processor = new BatchSpanProcessor(exporter, defaultBufferConfig); - for (let i = 0; i < defaultBufferConfig.maxExportBatchSize; i++) { - const span = createSampledSpan(`${name}_${i}`); + const span = createSampledSpan(name); + for (let i = 1; i < defaultBufferConfig.maxExportBatchSize; i++) { processor.onStart(span, ROOT_CONTEXT); processor.onEnd(span); } assert.strictEqual(exporter.getFinishedSpans().length, 0); processor.forceFlush(); - assert.strictEqual(exporter.getFinishedSpans().length, 5); + assert.strictEqual(exporter.getFinishedSpans().length, 4); }); it('should not export empty span lists', done => { @@ -466,17 +461,10 @@ describe('BatchSpanProcessorBase', () => { const debugStub = sinon.spy(diag, 'debug'); const warnStub = sinon.spy(diag, 'warn'); const span = createSampledSpan('test'); - for (let i = 0, j = 6; i < j; i++) { + for (let i = 0, j = 12; i < j; i++) { processor.onStart(span, ROOT_CONTEXT); processor.onEnd(span); } - assert.equal(processor['_finishedSpans'].length, 6); - assert.equal(processor['_droppedSpansCount'], 0); - sinon.assert.notCalled(debugStub); - - processor.onStart(span, ROOT_CONTEXT); - processor.onEnd(span); - assert.equal(processor['_finishedSpans'].length, 6); assert.equal(processor['_droppedSpansCount'], 1); sinon.assert.calledOnce(debugStub); @@ -517,4 +505,45 @@ describe('BatchSpanProcessorBase', () => { }); }); }); + + describe('Concurrency', () => { + it('should only send a single batch at a time', async () => { + const callbacks: ((result: ExportResult) => void)[] = []; + const spans: ReadableSpan[] = []; + const exporter: SpanExporter = { + export: async ( + exportedSpans: ReadableSpan[], + resultCallback: (result: ExportResult) => void + ) => { + callbacks.push(resultCallback); + spans.push(...exportedSpans); + }, + shutdown: async () => {}, + }; + const processor = new BatchSpanProcessor(exporter, { + maxExportBatchSize: 5, + maxQueueSize: 6, + }); + const totalSpans = 50; + for (let i = 0; i < totalSpans; i++) { + const span = createSampledSpan(`${name}_${i}`); + processor.onStart(span, ROOT_CONTEXT); + processor.onEnd(span); + } + assert.equal(callbacks.length, 1); + assert.equal(spans.length, 5); + callbacks[0]({ code: ExportResultCode.SUCCESS }); + await new Promise(resolve => setTimeout(resolve, 0)); + // After the first batch completes we will have dropped a number + // of spans and the next batch will be smaller + assert.equal(callbacks.length, 2); + assert.equal(spans.length, 10); + callbacks[1]({ code: ExportResultCode.SUCCESS }); + + // We expect that all the other spans have been dropped + await new Promise(resolve => setTimeout(resolve, 0)); + assert.equal(callbacks.length, 2); + assert.equal(spans.length, 10); + }); + }); }); diff --git a/packages/opentelemetry-sdk-trace-base/test/performance/benchmark/index.js b/packages/opentelemetry-sdk-trace-base/test/performance/benchmark/index.js new file mode 100644 index 0000000000..83558ea01f --- /dev/null +++ b/packages/opentelemetry-sdk-trace-base/test/performance/benchmark/index.js @@ -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. + */ + +require('./span'); diff --git a/packages/opentelemetry-sdk-trace-base/test/performance/benchmark/span.js b/packages/opentelemetry-sdk-trace-base/test/performance/benchmark/span.js new file mode 100644 index 0000000000..ac978a6140 --- /dev/null +++ b/packages/opentelemetry-sdk-trace-base/test/performance/benchmark/span.js @@ -0,0 +1,43 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const Benchmark = require('benchmark'); +const { BasicTracerProvider } = require('../../../build/src'); + +const tracerProvider = new BasicTracerProvider(); +const tracer = tracerProvider.getTracer('test') + +const suite = new Benchmark.Suite(); + +suite.on('cycle', event => { + console.log(String(event.target)); +}); + +suite.add('create spans (10 attributes)', function() { + const span = tracer.startSpan('span'); + span.setAttribute('aaaaaaaaaaaaaaaaaaaa', 'aaaaaaaaaaaaaaaaaaaa'); + span.setAttribute('bbbbbbbbbbbbbbbbbbbb', 'aaaaaaaaaaaaaaaaaaaa'); + span.setAttribute('cccccccccccccccccccc', 'aaaaaaaaaaaaaaaaaaaa'); + span.setAttribute('dddddddddddddddddddd', 'aaaaaaaaaaaaaaaaaaaa'); + span.setAttribute('eeeeeeeeeeeeeeeeeeee', 'aaaaaaaaaaaaaaaaaaaa'); + span.setAttribute('ffffffffffffffffffff', 'aaaaaaaaaaaaaaaaaaaa'); + span.setAttribute('gggggggggggggggggggg', 'aaaaaaaaaaaaaaaaaaaa'); + span.setAttribute('hhhhhhhhhhhhhhhhhhhh', 'aaaaaaaaaaaaaaaaaaaa'); + span.setAttribute('iiiiiiiiiiiiiiiiiiii', 'aaaaaaaaaaaaaaaaaaaa'); + span.setAttribute('jjjjjjjjjjjjjjjjjjjj', 'aaaaaaaaaaaaaaaaaaaa'); +}); + +suite.run(); diff --git a/packages/opentelemetry-sdk-trace-node/.eslintrc.js b/packages/opentelemetry-sdk-trace-node/.eslintrc.js index f726f3becb..3d9af536bb 100644 --- a/packages/opentelemetry-sdk-trace-node/.eslintrc.js +++ b/packages/opentelemetry-sdk-trace-node/.eslintrc.js @@ -3,5 +3,5 @@ module.exports = { "mocha": true, "node": true }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/packages/opentelemetry-sdk-trace-node/package.json b/packages/opentelemetry-sdk-trace-node/package.json index 60ef5ccba8..666fb058e0 100644 --- a/packages/opentelemetry-sdk-trace-node/package.json +++ b/packages/opentelemetry-sdk-trace-node/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-trace-node", - "version": "1.13.0", + "version": "1.17.1", "description": "OpenTelemetry Node SDK provides automatic telemetry (tracing, metrics, etc) for Node.js applications", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -16,7 +16,7 @@ "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../scripts/peer-api-check.js" }, @@ -45,30 +45,32 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0", - "@opentelemetry/resources": "1.13.0", - "@opentelemetry/semantic-conventions": "1.13.0", - "@types/mocha": "10.0.0", + "@opentelemetry/api": ">=1.0.0 <1.7.0", + "@opentelemetry/resources": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/semver": "7.3.9", - "@types/sinon": "10.0.13", + "@types/semver": "7.5.3", + "@types/sinon": "10.0.18", "codecov": "3.8.3", - "mocha": "10.0.0", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-mocha": "10.0.0", "typescript": "4.4.4" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0" + "@opentelemetry/api": ">=1.0.0 <1.7.0" }, "dependencies": { - "@opentelemetry/context-async-hooks": "1.13.0", - "@opentelemetry/core": "1.13.0", - "@opentelemetry/propagator-b3": "1.13.0", - "@opentelemetry/propagator-jaeger": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "semver": "^7.3.5" + "@opentelemetry/context-async-hooks": "1.17.1", + "@opentelemetry/core": "1.17.1", + "@opentelemetry/propagator-b3": "1.17.1", + "@opentelemetry/propagator-jaeger": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "semver": "^7.5.2" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node", "sideEffects": false diff --git a/packages/opentelemetry-sdk-trace-web/.eslintrc.js b/packages/opentelemetry-sdk-trace-web/.eslintrc.js index 86d794e2f5..359356edd4 100644 --- a/packages/opentelemetry-sdk-trace-web/.eslintrc.js +++ b/packages/opentelemetry-sdk-trace-web/.eslintrc.js @@ -3,5 +3,5 @@ module.exports = { "mocha": true, "browser": true, }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/packages/opentelemetry-sdk-trace-web/package.json b/packages/opentelemetry-sdk-trace-web/package.json index 21110b939c..cc91460b6a 100644 --- a/packages/opentelemetry-sdk-trace-web/package.json +++ b/packages/opentelemetry-sdk-trace-web/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-trace-web", - "version": "1.13.0", + "version": "1.17.1", "description": "OpenTelemetry Web Tracer", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -17,10 +17,10 @@ "codecov:webworker": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", "version": "node ../../scripts/version-update.js", "tdd": "karma start", - "test:browser": "nyc karma start --single-run", - "test:webworker": "nyc karma start karma.worker.js --single-run", + "test:browser": "karma start --single-run", + "test:webworker": "karma start karma.worker.js --single-run", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../scripts/peer-api-check.js" }, @@ -55,44 +55,46 @@ "access": "public" }, "devDependencies": { - "@babel/core": "7.16.0", - "@opentelemetry/api": ">=1.0.0 <1.5.0", - "@opentelemetry/context-zone": "1.13.0", - "@opentelemetry/propagator-b3": "1.13.0", - "@opentelemetry/resources": "1.13.0", - "@types/jquery": "3.5.8", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@opentelemetry/api": ">=1.0.0 <1.7.0", + "@opentelemetry/context-zone": "1.17.1", + "@opentelemetry/propagator-b3": "1.17.1", + "@opentelemetry/resources": "1.17.1", + "@types/jquery": "3.5.21", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "@types/webpack-env": "1.16.3", - "babel-loader": "8.2.3", + "babel-loader": "8.3.0", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-jquery": "0.2.4", "karma-mocha": "2.0.1", "karma-mocha-webworker": "1.3.0", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-loader": "8.4.0", "ts-mocha": "10.0.0", "typescript": "4.4.4", "webpack": "4.46.0", - "webpack-cli": "4.9.1", - "webpack-merge": "5.8.0" + "webpack-cli": "4.10.0", + "webpack-merge": "5.9.0" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0" + "@opentelemetry/api": ">=1.0.0 <1.7.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "@opentelemetry/semantic-conventions": "1.13.0" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-web", "sideEffects": false diff --git a/packages/opentelemetry-sdk-trace-web/src/utils.ts b/packages/opentelemetry-sdk-trace-web/src/utils.ts index 2027abc42f..b3f583676f 100644 --- a/packages/opentelemetry-sdk-trace-web/src/utils.ts +++ b/packages/opentelemetry-sdk-trace-web/src/utils.ts @@ -85,7 +85,12 @@ export function addSpanNetworkEvents( addSpanNetworkEvent(span, PTN.DOMAIN_LOOKUP_START, resource); addSpanNetworkEvent(span, PTN.DOMAIN_LOOKUP_END, resource); addSpanNetworkEvent(span, PTN.CONNECT_START, resource); - addSpanNetworkEvent(span, PTN.SECURE_CONNECTION_START, resource); + if ( + hasKey(resource as PerformanceResourceTiming, 'name') && + (resource as PerformanceResourceTiming)['name'].startsWith('https:') + ) { + addSpanNetworkEvent(span, PTN.SECURE_CONNECTION_START, resource); + } addSpanNetworkEvent(span, PTN.CONNECT_END, resource); addSpanNetworkEvent(span, PTN.REQUEST_START, resource); addSpanNetworkEvent(span, PTN.RESPONSE_START, resource); diff --git a/packages/opentelemetry-sdk-trace-web/test/utils.test.ts b/packages/opentelemetry-sdk-trace-web/test/utils.test.ts index 06e550c1f0..dd00e6b061 100644 --- a/packages/opentelemetry-sdk-trace-web/test/utils.test.ts +++ b/packages/opentelemetry-sdk-trace-web/test/utils.test.ts @@ -116,9 +116,16 @@ describe('utils', () => { assert.strictEqual(addEventSpy.callCount, 0); addSpanNetworkEvents(span, entries); - - assert.strictEqual(addEventSpy.callCount, 9); assert.strictEqual(setAttributeSpy.callCount, 2); + //secure connect start should not be added to non-https resource + assert.strictEqual(addEventSpy.callCount, 8); + //secure connect start should be added to an https resource + addEventSpy.resetHistory(); + addSpanNetworkEvents(span, { + ...entries, + name: 'https://foo', + } as PerformanceResourceTiming); + assert.strictEqual(addEventSpy.callCount, 9); }); it('should only include encoded size when content encoding is being used', () => { const addEventSpy = sinon.spy(); diff --git a/packages/opentelemetry-semantic-conventions/.eslintrc.js b/packages/opentelemetry-semantic-conventions/.eslintrc.js index 9dfe62f9b8..36847df9fb 100644 --- a/packages/opentelemetry-semantic-conventions/.eslintrc.js +++ b/packages/opentelemetry-semantic-conventions/.eslintrc.js @@ -5,5 +5,5 @@ module.exports = { "node": true, "browser": true }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/packages/opentelemetry-semantic-conventions/package.json b/packages/opentelemetry-semantic-conventions/package.json index 9f094c97cd..893356b104 100644 --- a/packages/opentelemetry-semantic-conventions/package.json +++ b/packages/opentelemetry-semantic-conventions/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/semantic-conventions", - "version": "1.13.0", + "version": "1.17.1", "description": "OpenTelemetry semantic conventions", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -15,7 +15,7 @@ "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../scripts/peer-api-check.js" }, @@ -49,14 +49,16 @@ "access": "public" }, "devDependencies": { - "@types/mocha": "10.0.0", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", "codecov": "3.8.3", - "mocha": "10.0.0", - "nock": "13.0.11", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", + "nock": "13.3.3", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", "ts-mocha": "10.0.0", "typescript": "4.4.4" }, diff --git a/packages/opentelemetry-semantic-conventions/src/resource/SemanticResourceAttributes.ts b/packages/opentelemetry-semantic-conventions/src/resource/SemanticResourceAttributes.ts index e57e4d959c..e123c3513e 100644 --- a/packages/opentelemetry-semantic-conventions/src/resource/SemanticResourceAttributes.ts +++ b/packages/opentelemetry-semantic-conventions/src/resource/SemanticResourceAttributes.ts @@ -486,7 +486,7 @@ export const CloudProviderValues = { GCP: 'gcp', } as const; export type CloudProviderValues = - typeof CloudProviderValues[keyof typeof CloudProviderValues]; + (typeof CloudProviderValues)[keyof typeof CloudProviderValues]; export const CloudPlatformValues = { /** Alibaba Cloud Elastic Compute Service. */ @@ -525,7 +525,7 @@ export const CloudPlatformValues = { GCP_APP_ENGINE: 'gcp_app_engine', } as const; export type CloudPlatformValues = - typeof CloudPlatformValues[keyof typeof CloudPlatformValues]; + (typeof CloudPlatformValues)[keyof typeof CloudPlatformValues]; export const AwsEcsLaunchtypeValues = { /** ec2. */ @@ -534,7 +534,7 @@ export const AwsEcsLaunchtypeValues = { FARGATE: 'fargate', } as const; export type AwsEcsLaunchtypeValues = - typeof AwsEcsLaunchtypeValues[keyof typeof AwsEcsLaunchtypeValues]; + (typeof AwsEcsLaunchtypeValues)[keyof typeof AwsEcsLaunchtypeValues]; export const HostArchValues = { /** AMD64. */ @@ -552,7 +552,8 @@ export const HostArchValues = { /** 32-bit x86. */ X86: 'x86', } as const; -export type HostArchValues = typeof HostArchValues[keyof typeof HostArchValues]; +export type HostArchValues = + (typeof HostArchValues)[keyof typeof HostArchValues]; export const OsTypeValues = { /** Microsoft Windows. */ @@ -578,7 +579,7 @@ export const OsTypeValues = { /** IBM z/OS. */ Z_OS: 'z_os', } as const; -export type OsTypeValues = typeof OsTypeValues[keyof typeof OsTypeValues]; +export type OsTypeValues = (typeof OsTypeValues)[keyof typeof OsTypeValues]; export const TelemetrySdkLanguageValues = { /** cpp. */ @@ -603,4 +604,4 @@ export const TelemetrySdkLanguageValues = { WEBJS: 'webjs', } as const; export type TelemetrySdkLanguageValues = - typeof TelemetrySdkLanguageValues[keyof typeof TelemetrySdkLanguageValues]; + (typeof TelemetrySdkLanguageValues)[keyof typeof TelemetrySdkLanguageValues]; diff --git a/packages/opentelemetry-semantic-conventions/src/trace/SemanticAttributes.ts b/packages/opentelemetry-semantic-conventions/src/trace/SemanticAttributes.ts index 8bfc4a141d..6d12b0f89a 100644 --- a/packages/opentelemetry-semantic-conventions/src/trace/SemanticAttributes.ts +++ b/packages/opentelemetry-semantic-conventions/src/trace/SemanticAttributes.ts @@ -826,7 +826,8 @@ export const DbSystemValues = { /** CockroachDB. */ COCKROACHDB: 'cockroachdb', } as const; -export type DbSystemValues = typeof DbSystemValues[keyof typeof DbSystemValues]; +export type DbSystemValues = + (typeof DbSystemValues)[keyof typeof DbSystemValues]; export const DbCassandraConsistencyLevelValues = { /** all. */ @@ -853,7 +854,7 @@ export const DbCassandraConsistencyLevelValues = { LOCAL_SERIAL: 'local_serial', } as const; export type DbCassandraConsistencyLevelValues = - typeof DbCassandraConsistencyLevelValues[keyof typeof DbCassandraConsistencyLevelValues]; + (typeof DbCassandraConsistencyLevelValues)[keyof typeof DbCassandraConsistencyLevelValues]; export const FaasTriggerValues = { /** A response to some data source operation such as a database or filesystem read/write. */ @@ -868,7 +869,7 @@ export const FaasTriggerValues = { OTHER: 'other', } as const; export type FaasTriggerValues = - typeof FaasTriggerValues[keyof typeof FaasTriggerValues]; + (typeof FaasTriggerValues)[keyof typeof FaasTriggerValues]; export const FaasDocumentOperationValues = { /** When a new object is created. */ @@ -879,7 +880,7 @@ export const FaasDocumentOperationValues = { DELETE: 'delete', } as const; export type FaasDocumentOperationValues = - typeof FaasDocumentOperationValues[keyof typeof FaasDocumentOperationValues]; + (typeof FaasDocumentOperationValues)[keyof typeof FaasDocumentOperationValues]; export const FaasInvokedProviderValues = { /** Alibaba Cloud. */ @@ -892,7 +893,7 @@ export const FaasInvokedProviderValues = { GCP: 'gcp', } as const; export type FaasInvokedProviderValues = - typeof FaasInvokedProviderValues[keyof typeof FaasInvokedProviderValues]; + (typeof FaasInvokedProviderValues)[keyof typeof FaasInvokedProviderValues]; export const NetTransportValues = { /** ip_tcp. */ @@ -911,7 +912,7 @@ export const NetTransportValues = { OTHER: 'other', } as const; export type NetTransportValues = - typeof NetTransportValues[keyof typeof NetTransportValues]; + (typeof NetTransportValues)[keyof typeof NetTransportValues]; export const NetHostConnectionTypeValues = { /** wifi. */ @@ -926,7 +927,7 @@ export const NetHostConnectionTypeValues = { UNKNOWN: 'unknown', } as const; export type NetHostConnectionTypeValues = - typeof NetHostConnectionTypeValues[keyof typeof NetHostConnectionTypeValues]; + (typeof NetHostConnectionTypeValues)[keyof typeof NetHostConnectionTypeValues]; export const NetHostConnectionSubtypeValues = { /** GPRS. */ @@ -973,7 +974,7 @@ export const NetHostConnectionSubtypeValues = { LTE_CA: 'lte_ca', } as const; export type NetHostConnectionSubtypeValues = - typeof NetHostConnectionSubtypeValues[keyof typeof NetHostConnectionSubtypeValues]; + (typeof NetHostConnectionSubtypeValues)[keyof typeof NetHostConnectionSubtypeValues]; export const HttpFlavorValues = { /** HTTP 1.0. */ @@ -988,7 +989,7 @@ export const HttpFlavorValues = { QUIC: 'QUIC', } as const; export type HttpFlavorValues = - typeof HttpFlavorValues[keyof typeof HttpFlavorValues]; + (typeof HttpFlavorValues)[keyof typeof HttpFlavorValues]; export const MessagingDestinationKindValues = { /** A message sent to a queue. */ @@ -997,7 +998,7 @@ export const MessagingDestinationKindValues = { TOPIC: 'topic', } as const; export type MessagingDestinationKindValues = - typeof MessagingDestinationKindValues[keyof typeof MessagingDestinationKindValues]; + (typeof MessagingDestinationKindValues)[keyof typeof MessagingDestinationKindValues]; export const MessagingOperationValues = { /** receive. */ @@ -1006,7 +1007,7 @@ export const MessagingOperationValues = { PROCESS: 'process', } as const; export type MessagingOperationValues = - typeof MessagingOperationValues[keyof typeof MessagingOperationValues]; + (typeof MessagingOperationValues)[keyof typeof MessagingOperationValues]; export const RpcGrpcStatusCodeValues = { /** OK. */ @@ -1045,7 +1046,7 @@ export const RpcGrpcStatusCodeValues = { UNAUTHENTICATED: 16, } as const; export type RpcGrpcStatusCodeValues = - typeof RpcGrpcStatusCodeValues[keyof typeof RpcGrpcStatusCodeValues]; + (typeof RpcGrpcStatusCodeValues)[keyof typeof RpcGrpcStatusCodeValues]; export const MessageTypeValues = { /** sent. */ @@ -1054,4 +1055,4 @@ export const MessageTypeValues = { RECEIVED: 'RECEIVED', } as const; export type MessageTypeValues = - typeof MessageTypeValues[keyof typeof MessageTypeValues]; + (typeof MessageTypeValues)[keyof typeof MessageTypeValues]; diff --git a/packages/opentelemetry-shim-opentracing/.eslintrc.js b/packages/opentelemetry-shim-opentracing/.eslintrc.js index f726f3becb..3d9af536bb 100644 --- a/packages/opentelemetry-shim-opentracing/.eslintrc.js +++ b/packages/opentelemetry-shim-opentracing/.eslintrc.js @@ -3,5 +3,5 @@ module.exports = { "mocha": true, "node": true }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/packages/opentelemetry-shim-opentracing/package.json b/packages/opentelemetry-shim-opentracing/package.json index f009398ef2..3e6fa8101c 100644 --- a/packages/opentelemetry-shim-opentracing/package.json +++ b/packages/opentelemetry-shim-opentracing/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/shim-opentracing", - "version": "1.13.0", + "version": "1.17.1", "description": "OpenTracing to OpenTelemetry shim", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -15,7 +15,7 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../scripts/peer-api-check.js" }, @@ -42,24 +42,26 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0", - "@opentelemetry/propagator-b3": "1.13.0", - "@opentelemetry/propagator-jaeger": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "@types/mocha": "10.0.0", + "@opentelemetry/api": ">=1.0.0 <1.7.0", + "@opentelemetry/propagator-b3": "1.17.1", + "@opentelemetry/propagator-jaeger": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", "codecov": "3.8.3", - "mocha": "10.0.0", + "cross-var": "1.1.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", "ts-mocha": "10.0.0", "typescript": "4.4.4" }, "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.5.0" + "@opentelemetry/api": ">=1.0.0 <1.7.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/semantic-conventions": "1.13.0", + "@opentelemetry/core": "1.17.1", + "@opentelemetry/semantic-conventions": "1.17.1", "opentracing": "^0.14.4" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-shim-opentracing", diff --git a/packages/opentelemetry-shim-opentracing/test/Shim.test.ts b/packages/opentelemetry-shim-opentracing/test/Shim.test.ts index cd3749a681..2da2f80003 100644 --- a/packages/opentelemetry-shim-opentracing/test/Shim.test.ts +++ b/packages/opentelemetry-shim-opentracing/test/Shim.test.ts @@ -261,7 +261,7 @@ describe('OpenTracing Shim', () => { assert.strictEqual(otSpan.links.length, 1); assert.deepStrictEqual( hrTimeToMilliseconds(otSpan.startTime), - Math.round(now + adjustment + performance.timeOrigin) + now + adjustment + performance.timeOrigin ); assert.deepStrictEqual(otSpan.attributes, opentracingOptions.tags); }); @@ -495,7 +495,7 @@ describe('OpenTracing Shim', () => { const adjustment = otSpan['_performanceOffset']; assert.deepStrictEqual( hrTimeToMilliseconds(otSpan.endTime), - Math.round(now + adjustment + performance.timeOrigin) + now + adjustment + performance.timeOrigin ); }); diff --git a/packages/sdk-metrics/.eslintrc.js b/packages/sdk-metrics/.eslintrc.js index f726f3becb..3d9af536bb 100644 --- a/packages/sdk-metrics/.eslintrc.js +++ b/packages/sdk-metrics/.eslintrc.js @@ -3,5 +3,5 @@ module.exports = { "mocha": true, "node": true }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/packages/sdk-metrics/package.json b/packages/sdk-metrics/package.json index db230fd6b5..ee69a4d485 100644 --- a/packages/sdk-metrics/package.json +++ b/packages/sdk-metrics/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-metrics", - "version": "1.13.0", + "version": "1.17.1", "description": "OpenTelemetry metrics SDK", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -12,7 +12,7 @@ "compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "tdd": "npm run test -- --watch-extensions ts --watch", "tdd:browser": "karma start", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", @@ -20,7 +20,7 @@ "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "node ../../scripts/version-update.js", "peer-api-check": "node ../../scripts/peer-api-check.js" }, @@ -54,31 +54,39 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": ">=1.3.0 <1.5.0", - "@types/lodash.merge": "4.6.6", - "@types/mocha": "10.0.0", + "@babel/core": "7.22.20", + "@opentelemetry/api": ">=1.3.0 <1.7.0", + "@types/lodash.merge": "4.6.7", + "@types/mocha": "10.0.2", "@types/node": "18.6.5", - "@types/sinon": "10.0.13", + "@types/sinon": "10.0.18", + "babel-plugin-istanbul": "6.1.1", "codecov": "3.8.3", - "karma": "6.3.16", + "cross-var": "1.1.0", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.1", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", + "karma-spec-reporter": "0.0.36", "karma-webpack": "4.0.2", - "mocha": "10.0.0", + "lerna": "7.1.5", + "mocha": "10.2.0", "nyc": "15.1.0", - "sinon": "15.0.0", + "sinon": "15.1.2", + "ts-loader": "8.4.0", "ts-mocha": "10.0.0", - "typescript": "4.4.4" + "typescript": "4.4.4", + "webpack": "4.46.0", + "webpack-cli": "4.10.0", + "webpack-merge": "5.9.0" }, "peerDependencies": { - "@opentelemetry/api": ">=1.3.0 <1.5.0" + "@opentelemetry/api": ">=1.3.0 <1.7.0" }, "dependencies": { - "@opentelemetry/core": "1.13.0", - "@opentelemetry/resources": "1.13.0", - "lodash.merge": "4.6.2" + "@opentelemetry/core": "1.17.1", + "@opentelemetry/resources": "1.17.1", + "lodash.merge": "^4.6.2" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/sdk-metrics", "sideEffects": false diff --git a/packages/sdk-metrics/src/InstrumentDescriptor.ts b/packages/sdk-metrics/src/InstrumentDescriptor.ts index 01eabe2614..ed036eb4db 100644 --- a/packages/sdk-metrics/src/InstrumentDescriptor.ts +++ b/packages/sdk-metrics/src/InstrumentDescriptor.ts @@ -14,8 +14,14 @@ * limitations under the License. */ -import { MetricOptions, ValueType } from '@opentelemetry/api'; +import { + MetricAdvice, + MetricOptions, + ValueType, + diag, +} from '@opentelemetry/api'; import { View } from './view/View'; +import { equalsCaseInsensitive } from './utils'; /** * Supported types of metric instruments. @@ -30,7 +36,10 @@ export enum InstrumentType { } /** - * An interface describing the instrument. + * An internal interface describing the instrument. + * + * This is intentionally distinguished from the public MetricDescriptor (a.k.a. InstrumentDescriptor) + * which may not contains internal fields like metric advice. */ export interface InstrumentDescriptor { readonly name: string; @@ -38,6 +47,10 @@ export interface InstrumentDescriptor { readonly unit: string; readonly type: InstrumentType; readonly valueType: ValueType; + /** + * @experimental + */ + readonly advice: MetricAdvice; } export function createInstrumentDescriptor( @@ -45,12 +58,18 @@ export function createInstrumentDescriptor( type: InstrumentType, options?: MetricOptions ): InstrumentDescriptor { + if (!isValidName(name)) { + diag.warn( + `Invalid metric name: "${name}". The metric name should be a ASCII string with a length no greater than 255 characters.` + ); + } return { name, type, description: options?.description ?? '', unit: options?.unit ?? '', valueType: options?.valueType ?? ValueType.DOUBLE, + advice: options?.advice ?? {}, }; } @@ -64,6 +83,7 @@ export function createInstrumentDescriptorWithView( type: instrument.type, unit: instrument.unit, valueType: instrument.valueType, + advice: instrument.advice, }; } @@ -71,10 +91,18 @@ export function isDescriptorCompatibleWith( descriptor: InstrumentDescriptor, otherDescriptor: InstrumentDescriptor ) { + // Names are case-insensitive strings. return ( - descriptor.name === otherDescriptor.name && + equalsCaseInsensitive(descriptor.name, otherDescriptor.name) && descriptor.unit === otherDescriptor.unit && descriptor.type === otherDescriptor.type && descriptor.valueType === otherDescriptor.valueType ); } + +// ASCII string with a length no greater than 255 characters. +// NB: the first character counted separately from the rest. +const NAME_REGEXP = /^[a-z][a-z0-9_.\-/]{0,254}$/i; +export function isValidName(name: string): boolean { + return name.match(NAME_REGEXP) != null; +} diff --git a/packages/sdk-metrics/src/Instruments.ts b/packages/sdk-metrics/src/Instruments.ts index d99c621c0b..f665952f05 100644 --- a/packages/sdk-metrics/src/Instruments.ts +++ b/packages/sdk-metrics/src/Instruments.ts @@ -48,6 +48,12 @@ export class SyncInstrument { attributes: MetricAttributes = {}, context: Context = contextApi.active() ) { + if (typeof value !== 'number') { + diag.warn( + `non-number value provided to metric ${this._descriptor.name}: ${value}` + ); + return; + } if ( this._descriptor.valueType === ValueType.INT && !Number.isInteger(value) @@ -56,6 +62,10 @@ export class SyncInstrument { `INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.` ); value = Math.trunc(value); + // ignore non-finite values. + if (!Number.isInteger(value)) { + return; + } } this._writableMetricStorage.record( value, diff --git a/packages/sdk-metrics/src/ObservableResult.ts b/packages/sdk-metrics/src/ObservableResult.ts index 31e194290c..c9a7b202ea 100644 --- a/packages/sdk-metrics/src/ObservableResult.ts +++ b/packages/sdk-metrics/src/ObservableResult.ts @@ -24,7 +24,6 @@ import { } from '@opentelemetry/api'; import { AttributeHashMap } from './state/HashMap'; import { isObservableInstrument, ObservableInstrument } from './Instruments'; -import { InstrumentDescriptor } from '.'; /** * The class implements {@link ObservableResult} interface. @@ -35,20 +34,30 @@ export class ObservableResultImpl implements ObservableResult { */ _buffer = new AttributeHashMap(); - constructor(private _descriptor: InstrumentDescriptor) {} + constructor( + private _instrumentName: string, + private _valueType: ValueType + ) {} /** * Observe a measurement of the value associated with the given attributes. */ observe(value: number, attributes: MetricAttributes = {}): void { - if ( - this._descriptor.valueType === ValueType.INT && - !Number.isInteger(value) - ) { + if (typeof value !== 'number') { diag.warn( - `INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.` + `non-number value provided to metric ${this._instrumentName}: ${value}` + ); + return; + } + if (this._valueType === ValueType.INT && !Number.isInteger(value)) { + diag.warn( + `INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.` ); value = Math.trunc(value); + // ignore non-finite values. + if (!Number.isInteger(value)) { + return; + } } this._buffer.set(attributes, value); } @@ -79,6 +88,12 @@ export class BatchObservableResultImpl implements BatchObservableResult { map = new AttributeHashMap(); this._buffer.set(metric, map); } + if (typeof value !== 'number') { + diag.warn( + `non-number value provided to metric ${metric._descriptor.name}: ${value}` + ); + return; + } if ( metric._descriptor.valueType === ValueType.INT && !Number.isInteger(value) @@ -87,6 +102,10 @@ export class BatchObservableResultImpl implements BatchObservableResult { `INT value type cannot accept a floating-point value for ${metric._descriptor.name}, ignoring the fractional digits.` ); value = Math.trunc(value); + // ignore non-finite values. + if (!Number.isInteger(value)) { + return; + } } map.set(attributes, value); } diff --git a/packages/sdk-metrics/src/aggregator/Drop.ts b/packages/sdk-metrics/src/aggregator/Drop.ts index 343c90357c..f968bdf4d6 100644 --- a/packages/sdk-metrics/src/aggregator/Drop.ts +++ b/packages/sdk-metrics/src/aggregator/Drop.ts @@ -16,8 +16,7 @@ import { HrTime } from '@opentelemetry/api'; import { AggregationTemporality } from '../export/AggregationTemporality'; -import { MetricData } from '../export/MetricData'; -import { InstrumentDescriptor } from '../InstrumentDescriptor'; +import { MetricData, MetricDescriptor } from '../export/MetricData'; import { Maybe } from '../utils'; import { AggregatorKind, Aggregator, AccumulationRecord } from './types'; @@ -38,7 +37,7 @@ export class DropAggregator implements Aggregator { } toMetricData( - _descriptor: InstrumentDescriptor, + _descriptor: MetricDescriptor, _aggregationTemporality: AggregationTemporality, _accumulationByAttributes: AccumulationRecord[], _endTime: HrTime diff --git a/packages/sdk-metrics/src/aggregator/ExponentialHistogram.ts b/packages/sdk-metrics/src/aggregator/ExponentialHistogram.ts index 5a70a478a8..9356580205 100644 --- a/packages/sdk-metrics/src/aggregator/ExponentialHistogram.ts +++ b/packages/sdk-metrics/src/aggregator/ExponentialHistogram.ts @@ -24,9 +24,10 @@ import { import { DataPointType, ExponentialHistogramMetricData, + MetricDescriptor, } from '../export/MetricData'; import { diag, HrTime } from '@opentelemetry/api'; -import { InstrumentDescriptor, InstrumentType } from '../InstrumentDescriptor'; +import { InstrumentType } from '../InstrumentDescriptor'; import { Maybe } from '../utils'; import { AggregationTemporality } from '../export/AggregationTemporality'; import { Buckets } from './exponential-histogram/Buckets'; @@ -52,7 +53,10 @@ class HighLow { static combine(h1: HighLow, h2: HighLow): HighLow { return new HighLow(Math.min(h1.low, h2.low), Math.max(h1.high, h2.high)); } - constructor(public low: number, public high: number) {} + constructor( + public low: number, + public high: number + ) {} } const MAX_SCALE = 20; @@ -213,32 +217,33 @@ export class ExponentialHistogramAccumulation implements Accumulation { } /** - * merge combines data from other into self - * @param {ExponentialHistogramAccumulation} other + * merge combines data from previous value into self + * @param {ExponentialHistogramAccumulation} previous */ - merge(other: ExponentialHistogramAccumulation) { + merge(previous: ExponentialHistogramAccumulation) { if (this._count === 0) { - this._min = other.min; - this._max = other.max; - } else if (other.count !== 0) { - if (other.min < this.min) { - this._min = other.min; + this._min = previous.min; + this._max = previous.max; + } else if (previous.count !== 0) { + if (previous.min < this.min) { + this._min = previous.min; } - if (other.max > this.max) { - this._max = other.max; + if (previous.max > this.max) { + this._max = previous.max; } } - this._sum += other.sum; - this._count += other.count; - this._zeroCount += other.zeroCount; + this.startTime = previous.startTime; + this._sum += previous.sum; + this._count += previous.count; + this._zeroCount += previous.zeroCount; - const minScale = this._minScale(other); + const minScale = this._minScale(previous); this._downscale(this.scale - minScale); - this._mergeBuckets(this.positive, other, other.positive, minScale); - this._mergeBuckets(this.negative, other, other.negative, minScale); + this._mergeBuckets(this.positive, previous, previous.positive, minScale); + this._mergeBuckets(this.negative, previous, previous.negative, minScale); } /** @@ -551,7 +556,7 @@ export class ExponentialHistogramAggregator } toMetricData( - descriptor: InstrumentDescriptor, + descriptor: MetricDescriptor, aggregationTemporality: AggregationTemporality, accumulationByAttributes: AccumulationRecord[], endTime: HrTime diff --git a/packages/sdk-metrics/src/aggregator/Histogram.ts b/packages/sdk-metrics/src/aggregator/Histogram.ts index f20784b054..60e5e8df05 100644 --- a/packages/sdk-metrics/src/aggregator/Histogram.ts +++ b/packages/sdk-metrics/src/aggregator/Histogram.ts @@ -20,9 +20,13 @@ import { Aggregator, AggregatorKind, } from './types'; -import { DataPointType, HistogramMetricData } from '../export/MetricData'; +import { + DataPointType, + HistogramMetricData, + MetricDescriptor, +} from '../export/MetricData'; import { HrTime } from '@opentelemetry/api'; -import { InstrumentDescriptor, InstrumentType } from '../InstrumentDescriptor'; +import { InstrumentType } from '../InstrumentDescriptor'; import { binarySearchLB, Maybe } from '../utils'; import { AggregationTemporality } from '../export/AggregationTemporality'; @@ -207,7 +211,7 @@ export class HistogramAggregator implements Aggregator { } toMetricData( - descriptor: InstrumentDescriptor, + descriptor: MetricDescriptor, aggregationTemporality: AggregationTemporality, accumulationByAttributes: AccumulationRecord[], endTime: HrTime diff --git a/packages/sdk-metrics/src/aggregator/LastValue.ts b/packages/sdk-metrics/src/aggregator/LastValue.ts index 9c627130f6..905e45f1de 100644 --- a/packages/sdk-metrics/src/aggregator/LastValue.ts +++ b/packages/sdk-metrics/src/aggregator/LastValue.ts @@ -23,8 +23,11 @@ import { } from './types'; import { HrTime } from '@opentelemetry/api'; import { millisToHrTime, hrTimeToMicroseconds } from '@opentelemetry/core'; -import { DataPointType, GaugeMetricData } from '../export/MetricData'; -import { InstrumentDescriptor } from '../InstrumentDescriptor'; +import { + DataPointType, + GaugeMetricData, + MetricDescriptor, +} from '../export/MetricData'; import { Maybe } from '../utils'; import { AggregationTemporality } from '../export/AggregationTemporality'; @@ -103,7 +106,7 @@ export class LastValueAggregator implements Aggregator { } toMetricData( - descriptor: InstrumentDescriptor, + descriptor: MetricDescriptor, aggregationTemporality: AggregationTemporality, accumulationByAttributes: AccumulationRecord[], endTime: HrTime diff --git a/packages/sdk-metrics/src/aggregator/Sum.ts b/packages/sdk-metrics/src/aggregator/Sum.ts index ba53c389ee..a851e5b9f2 100644 --- a/packages/sdk-metrics/src/aggregator/Sum.ts +++ b/packages/sdk-metrics/src/aggregator/Sum.ts @@ -22,8 +22,11 @@ import { AccumulationRecord, } from './types'; import { HrTime } from '@opentelemetry/api'; -import { DataPointType, SumMetricData } from '../export/MetricData'; -import { InstrumentDescriptor } from '../InstrumentDescriptor'; +import { + DataPointType, + MetricDescriptor, + SumMetricData, +} from '../export/MetricData'; import { Maybe } from '../utils'; import { AggregationTemporality } from '../export/AggregationTemporality'; @@ -109,7 +112,7 @@ export class SumAggregator implements Aggregator { } toMetricData( - descriptor: InstrumentDescriptor, + descriptor: MetricDescriptor, aggregationTemporality: AggregationTemporality, accumulationByAttributes: AccumulationRecord[], endTime: HrTime diff --git a/packages/sdk-metrics/src/aggregator/types.ts b/packages/sdk-metrics/src/aggregator/types.ts index 16888256b2..9be5247702 100644 --- a/packages/sdk-metrics/src/aggregator/types.ts +++ b/packages/sdk-metrics/src/aggregator/types.ts @@ -16,8 +16,7 @@ import { HrTime, MetricAttributes } from '@opentelemetry/api'; import { AggregationTemporality } from '../export/AggregationTemporality'; -import { MetricData } from '../export/MetricData'; -import { InstrumentDescriptor } from '../InstrumentDescriptor'; +import { MetricData, MetricDescriptor } from '../export/MetricData'; import { Maybe } from '../utils'; /** The kind of aggregator. */ @@ -128,14 +127,14 @@ export interface Aggregator { /** * Returns the {@link MetricData} that this {@link Aggregator} will produce. * - * @param descriptor the metric instrument descriptor. + * @param descriptor the metric descriptor. * @param aggregationTemporality the temporality of the resulting {@link MetricData} * @param accumulationByAttributes the array of attributes and accumulation pairs. * @param endTime the end time of the metric data. * @return the {@link MetricData} that this {@link Aggregator} will produce. */ toMetricData( - descriptor: InstrumentDescriptor, + descriptor: MetricDescriptor, aggregationTemporality: AggregationTemporality, accumulationByAttributes: AccumulationRecord[], endTime: HrTime diff --git a/packages/sdk-metrics/src/export/MetricData.ts b/packages/sdk-metrics/src/export/MetricData.ts index 19868dbc62..d4ad0c7ad2 100644 --- a/packages/sdk-metrics/src/export/MetricData.ts +++ b/packages/sdk-metrics/src/export/MetricData.ts @@ -14,18 +14,30 @@ * limitations under the License. */ -import { HrTime, MetricAttributes } from '@opentelemetry/api'; +import { HrTime, MetricAttributes, ValueType } from '@opentelemetry/api'; import { InstrumentationScope } from '@opentelemetry/core'; import { IResource } from '@opentelemetry/resources'; -import { InstrumentDescriptor } from '../InstrumentDescriptor'; +import { InstrumentType } from '../InstrumentDescriptor'; import { AggregationTemporality } from './AggregationTemporality'; import { Histogram, ExponentialHistogram } from '../aggregator/types'; +export interface MetricDescriptor { + readonly name: string; + readonly description: string; + readonly unit: string; + /** + * @deprecated exporter should avoid depending on the type of the instrument + * as their resulting aggregator can be re-mapped with views. + */ + readonly type: InstrumentType; + readonly valueType: ValueType; +} + /** * Basic metric data fields. */ interface BaseMetricData { - readonly descriptor: InstrumentDescriptor; + readonly descriptor: MetricDescriptor; readonly aggregationTemporality: AggregationTemporality; /** * DataPointType of the metric instrument. diff --git a/packages/sdk-metrics/src/export/MetricReader.ts b/packages/sdk-metrics/src/export/MetricReader.ts index 3bc4c63a06..8aad601d70 100644 --- a/packages/sdk-metrics/src/export/MetricReader.ts +++ b/packages/sdk-metrics/src/export/MetricReader.ts @@ -18,7 +18,7 @@ import * as api from '@opentelemetry/api'; import { AggregationTemporality } from './AggregationTemporality'; import { MetricProducer } from './MetricProducer'; import { CollectionResult } from './MetricData'; -import { callWithTimeout } from '../utils'; +import { FlatMap, callWithTimeout } from '../utils'; import { InstrumentType } from '../InstrumentDescriptor'; import { CollectionOptions, @@ -45,6 +45,13 @@ export interface MetricReaderOptions { * not configured, cumulative is used for all instruments. */ aggregationTemporalitySelector?: AggregationTemporalitySelector; + /** + * **Note, this option is experimental**. Additional MetricProducers to use as a source of + * aggregated metric data in addition to the SDK's metric data. The resource returned by + * these MetricProducers is ignored; the SDK's resource will be used instead. + * @experimental + */ + metricProducers?: MetricProducer[]; } /** @@ -55,8 +62,10 @@ export abstract class MetricReader { // Tracks the shutdown state. // TODO: use BindOncePromise here once a new version of @opentelemetry/core is available. private _shutdown = false; - // MetricProducer used by this instance. - private _metricProducer?: MetricProducer; + // Additional MetricProducers which will be combined with the SDK's output + private _metricProducers: MetricProducer[]; + // MetricProducer used by this instance which produces metrics from the SDK + private _sdkMetricProducer?: MetricProducer; private readonly _aggregationTemporalitySelector: AggregationTemporalitySelector; private readonly _aggregationSelector: AggregationSelector; @@ -66,20 +75,26 @@ export abstract class MetricReader { this._aggregationTemporalitySelector = options?.aggregationTemporalitySelector ?? DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR; + this._metricProducers = options?.metricProducers ?? []; } /** - * Set the {@link MetricProducer} used by this instance. + * Set the {@link MetricProducer} used by this instance. **This should only be called by the + * SDK and should be considered internal.** * + * To add additional {@link MetricProducer}s to a {@link MetricReader}, pass them to the + * constructor as {@link MetricReaderOptions.metricProducers}. + * + * @internal * @param metricProducer */ setMetricProducer(metricProducer: MetricProducer) { - if (this._metricProducer) { + if (this._sdkMetricProducer) { throw new Error( 'MetricReader can not be bound to a MeterProvider again.' ); } - this._metricProducer = metricProducer; + this._sdkMetricProducer = metricProducer; this.onInitialized(); } @@ -130,7 +145,7 @@ export abstract class MetricReader { * Collect all metrics from the associated {@link MetricProducer} */ async collect(options?: CollectionOptions): Promise { - if (this._metricProducer === undefined) { + if (this._sdkMetricProducer === undefined) { throw new Error('MetricReader is not bound to a MetricProducer'); } @@ -139,9 +154,37 @@ export abstract class MetricReader { throw new Error('MetricReader is shutdown'); } - return this._metricProducer.collect({ - timeoutMillis: options?.timeoutMillis, - }); + const [sdkCollectionResults, ...additionalCollectionResults] = + await Promise.all([ + this._sdkMetricProducer.collect({ + timeoutMillis: options?.timeoutMillis, + }), + ...this._metricProducers.map(producer => + producer.collect({ + timeoutMillis: options?.timeoutMillis, + }) + ), + ]); + + // Merge the results, keeping the SDK's Resource + const errors = sdkCollectionResults.errors.concat( + FlatMap(additionalCollectionResults, result => result.errors) + ); + const resource = sdkCollectionResults.resourceMetrics.resource; + const scopeMetrics = + sdkCollectionResults.resourceMetrics.scopeMetrics.concat( + FlatMap( + additionalCollectionResults, + result => result.resourceMetrics.scopeMetrics + ) + ); + return { + resourceMetrics: { + resource, + scopeMetrics, + }, + errors, + }; } /** diff --git a/packages/sdk-metrics/src/export/PeriodicExportingMetricReader.ts b/packages/sdk-metrics/src/export/PeriodicExportingMetricReader.ts index 2371ecb67f..5ecafff682 100644 --- a/packages/sdk-metrics/src/export/PeriodicExportingMetricReader.ts +++ b/packages/sdk-metrics/src/export/PeriodicExportingMetricReader.ts @@ -25,6 +25,7 @@ import { MetricReader } from './MetricReader'; import { PushMetricExporter } from './MetricExporter'; import { callWithTimeout, TimeoutError } from '../utils'; import { diag } from '@opentelemetry/api'; +import { MetricProducer } from './MetricProducer'; export type PeriodicExportingMetricReaderOptions = { /** @@ -40,6 +41,13 @@ export type PeriodicExportingMetricReaderOptions = { * Milliseconds for the async observable callback to timeout. */ exportTimeoutMillis?: number; + /** + * **Note, this option is experimental**. Additional MetricProducers to use as a source of + * aggregated metric data in addition to the SDK's metric data. The resource returned by + * these MetricProducers is ignored; the SDK's resource will be used instead. + * @experimental + */ + metricProducers?: MetricProducer[]; }; /** @@ -59,6 +67,7 @@ export class PeriodicExportingMetricReader extends MetricReader { ), aggregationTemporalitySelector: options.exporter.selectAggregationTemporality?.bind(options.exporter), + metricProducers: options.metricProducers, }); if ( diff --git a/packages/sdk-metrics/src/index.ts b/packages/sdk-metrics/src/index.ts index 4760da3ccc..414766c099 100644 --- a/packages/sdk-metrics/src/index.ts +++ b/packages/sdk-metrics/src/index.ts @@ -14,6 +14,8 @@ * limitations under the License. */ +import { MetricDescriptor } from './export/MetricData'; + export { Sum, LastValue, @@ -38,6 +40,7 @@ export { ResourceMetrics, ScopeMetrics, MetricData, + MetricDescriptor, CollectionResult, } from './export/MetricData'; @@ -54,7 +57,13 @@ export { InMemoryMetricExporter } from './export/InMemoryMetricExporter'; export { ConsoleMetricExporter } from './export/ConsoleMetricExporter'; -export { InstrumentDescriptor, InstrumentType } from './InstrumentDescriptor'; +export { MetricCollectOptions, MetricProducer } from './export/MetricProducer'; + +export { InstrumentType } from './InstrumentDescriptor'; +/** + * @deprecated Use {@link MetricDescriptor} instead. + */ +export type InstrumentDescriptor = MetricDescriptor; export { MeterProvider, MeterProviderOptions } from './MeterProvider'; diff --git a/packages/sdk-metrics/src/state/AsyncMetricStorage.ts b/packages/sdk-metrics/src/state/AsyncMetricStorage.ts index 286874987c..6bebafdc1f 100644 --- a/packages/sdk-metrics/src/state/AsyncMetricStorage.ts +++ b/packages/sdk-metrics/src/state/AsyncMetricStorage.ts @@ -42,11 +42,15 @@ export class AsyncMetricStorage> constructor( _instrumentDescriptor: InstrumentDescriptor, aggregator: Aggregator, - private _attributesProcessor: AttributesProcessor + private _attributesProcessor: AttributesProcessor, + collectorHandles: MetricCollectorHandle[] ) { super(_instrumentDescriptor); this._deltaMetricStorage = new DeltaMetricProcessor(aggregator); - this._temporalMetricStorage = new TemporalMetricProcessor(aggregator); + this._temporalMetricStorage = new TemporalMetricProcessor( + aggregator, + collectorHandles + ); } record(measurements: AttributeHashMap, observationTime: HrTime) { @@ -66,14 +70,12 @@ export class AsyncMetricStorage> */ collect( collector: MetricCollectorHandle, - collectors: MetricCollectorHandle[], collectionTime: HrTime ): Maybe { const accumulations = this._deltaMetricStorage.collect(); return this._temporalMetricStorage.buildMetrics( collector, - collectors, this._instrumentDescriptor, accumulations, collectionTime diff --git a/packages/sdk-metrics/src/state/MeterSharedState.ts b/packages/sdk-metrics/src/state/MeterSharedState.ts index 330d293eea..2c0c1a5105 100644 --- a/packages/sdk-metrics/src/state/MeterSharedState.ts +++ b/packages/sdk-metrics/src/state/MeterSharedState.ts @@ -78,7 +78,7 @@ export class MeterSharedState { collector: MetricCollectorHandle, collectionTime: HrTime, options?: MetricCollectOptions - ): Promise { + ): Promise { /** * 1. Call all observable callbacks first. * 2. Collect metric result for the collector. @@ -87,22 +87,28 @@ export class MeterSharedState { collectionTime, options?.timeoutMillis ); - const metricDataList = Array.from( - this.metricStorageRegistry.getStorages(collector) - ) + const storages = this.metricStorageRegistry.getStorages(collector); + + // prevent more allocations if there are no storages. + if (storages.length === 0) { + return null; + } + + const metricDataList = storages .map(metricStorage => { - return metricStorage.collect( - collector, - this._meterProviderSharedState.metricCollectors, - collectionTime - ); + return metricStorage.collect(collector, collectionTime); }) .filter(isNotNullish); + // skip this scope if no data was collected (storage created, but no data observed) + if (metricDataList.length === 0) { + return { errors }; + } + return { scopeMetrics: { scope: this._instrumentationScope, - metrics: metricDataList.filter(isNotNullish), + metrics: metricDataList, }, errors, }; @@ -110,7 +116,7 @@ export class MeterSharedState { private _registerMetricStorage< MetricStorageType extends MetricStorageConstructor, - R extends InstanceType + R extends InstanceType, >( descriptor: InstrumentDescriptor, MetricStorageType: MetricStorageType @@ -135,7 +141,8 @@ export class MeterSharedState { const viewStorage = new MetricStorageType( viewDescriptor, aggregator, - view.attributesProcessor + view.attributesProcessor, + this._meterProviderSharedState.metricCollectors ) as R; this.metricStorageRegistry.register(viewStorage); return viewStorage; @@ -159,7 +166,8 @@ export class MeterSharedState { const storage = new MetricStorageType( descriptor, aggregator, - AttributesProcessor.Noop() + AttributesProcessor.Noop(), + [collector] ) as R; this.metricStorageRegistry.registerForCollector(collector, storage); return storage; @@ -173,7 +181,7 @@ export class MeterSharedState { } interface ScopeMetricsResult { - scopeMetrics: ScopeMetrics; + scopeMetrics?: ScopeMetrics; errors: unknown[]; } @@ -181,6 +189,7 @@ interface MetricStorageConstructor { new ( instrumentDescriptor: InstrumentDescriptor, aggregator: Aggregator>, - attributesProcessor: AttributesProcessor + attributesProcessor: AttributesProcessor, + collectors: MetricCollectorHandle[] ): MetricStorage; } diff --git a/packages/sdk-metrics/src/state/MetricCollector.ts b/packages/sdk-metrics/src/state/MetricCollector.ts index 3f17a0d5b9..f1f1dacdb1 100644 --- a/packages/sdk-metrics/src/state/MetricCollector.ts +++ b/packages/sdk-metrics/src/state/MetricCollector.ts @@ -16,12 +16,11 @@ import { millisToHrTime } from '@opentelemetry/core'; import { AggregationTemporalitySelector } from '../export/AggregationSelector'; -import { CollectionResult } from '../export/MetricData'; +import { CollectionResult, ScopeMetrics } from '../export/MetricData'; import { MetricProducer, MetricCollectOptions } from '../export/MetricProducer'; import { MetricReader } from '../export/MetricReader'; import { InstrumentType } from '../InstrumentDescriptor'; import { ForceFlushOptions, ShutdownOptions } from '../types'; -import { FlatMap } from '../utils'; import { MeterProviderSharedState } from './MeterProviderSharedState'; /** @@ -37,19 +36,36 @@ export class MetricCollector implements MetricProducer { async collect(options?: MetricCollectOptions): Promise { const collectionTime = millisToHrTime(Date.now()); + const scopeMetrics: ScopeMetrics[] = []; + const errors: unknown[] = []; + const meterCollectionPromises = Array.from( this._sharedState.meterSharedStates.values() - ).map(meterSharedState => - meterSharedState.collect(this, collectionTime, options) - ); - const result = await Promise.all(meterCollectionPromises); + ).map(async meterSharedState => { + const current = await meterSharedState.collect( + this, + collectionTime, + options + ); + + // only add scope metrics if available + if (current?.scopeMetrics != null) { + scopeMetrics.push(current.scopeMetrics); + } + + // only add errors if available + if (current?.errors != null) { + errors.push(...current.errors); + } + }); + await Promise.all(meterCollectionPromises); return { resourceMetrics: { resource: this._sharedState.resource, - scopeMetrics: result.map(it => it.scopeMetrics), + scopeMetrics: scopeMetrics, }, - errors: FlatMap(result, it => it.errors), + errors: errors, }; } diff --git a/packages/sdk-metrics/src/state/MetricStorage.ts b/packages/sdk-metrics/src/state/MetricStorage.ts index 5d02437f58..e959ea0329 100644 --- a/packages/sdk-metrics/src/state/MetricStorage.ts +++ b/packages/sdk-metrics/src/state/MetricStorage.ts @@ -39,7 +39,6 @@ export abstract class MetricStorage { */ abstract collect( collector: MetricCollectorHandle, - collectors: MetricCollectorHandle[], collectionTime: HrTime ): Maybe; @@ -55,6 +54,7 @@ export abstract class MetricStorage { description: description, valueType: this._instrumentDescriptor.valueType, unit: this._instrumentDescriptor.unit, + advice: this._instrumentDescriptor.advice, } ); } diff --git a/packages/sdk-metrics/src/state/ObservableRegistry.ts b/packages/sdk-metrics/src/state/ObservableRegistry.ts index 444395bca7..5e25686c6a 100644 --- a/packages/sdk-metrics/src/state/ObservableRegistry.ts +++ b/packages/sdk-metrics/src/state/ObservableRegistry.ts @@ -144,7 +144,10 @@ export class ObservableRegistry { private _observeCallbacks(observationTime: HrTime, timeoutMillis?: number) { return this._callbacks.map(async ({ callback, instrument }) => { - const observableResult = new ObservableResultImpl(instrument._descriptor); + const observableResult = new ObservableResultImpl( + instrument._descriptor.name, + instrument._descriptor.valueType + ); let callPromise: Promise = Promise.resolve( callback(observableResult) ); diff --git a/packages/sdk-metrics/src/state/SyncMetricStorage.ts b/packages/sdk-metrics/src/state/SyncMetricStorage.ts index 0648b12728..bb546e1271 100644 --- a/packages/sdk-metrics/src/state/SyncMetricStorage.ts +++ b/packages/sdk-metrics/src/state/SyncMetricStorage.ts @@ -41,11 +41,15 @@ export class SyncMetricStorage> constructor( instrumentDescriptor: InstrumentDescriptor, aggregator: Aggregator, - private _attributesProcessor: AttributesProcessor + private _attributesProcessor: AttributesProcessor, + collectorHandles: MetricCollectorHandle[] ) { super(instrumentDescriptor); this._deltaMetricStorage = new DeltaMetricProcessor(aggregator); - this._temporalMetricStorage = new TemporalMetricProcessor(aggregator); + this._temporalMetricStorage = new TemporalMetricProcessor( + aggregator, + collectorHandles + ); } record( @@ -66,14 +70,12 @@ export class SyncMetricStorage> */ collect( collector: MetricCollectorHandle, - collectors: MetricCollectorHandle[], collectionTime: HrTime ): Maybe { const accumulations = this._deltaMetricStorage.collect(); return this._temporalMetricStorage.buildMetrics( collector, - collectors, this._instrumentDescriptor, accumulations, collectionTime diff --git a/packages/sdk-metrics/src/state/TemporalMetricProcessor.ts b/packages/sdk-metrics/src/state/TemporalMetricProcessor.ts index 2b9c5dbbaa..967b6f8181 100644 --- a/packages/sdk-metrics/src/state/TemporalMetricProcessor.ts +++ b/packages/sdk-metrics/src/state/TemporalMetricProcessor.ts @@ -61,7 +61,14 @@ export class TemporalMetricProcessor> { LastReportedHistory >(); - constructor(private _aggregator: Aggregator) {} + constructor( + private _aggregator: Aggregator, + collectorHandles: MetricCollectorHandle[] + ) { + collectorHandles.forEach(handle => { + this._unreportedAccumulations.set(handle, []); + }); + } /** * Builds the {@link MetricData} streams to report against a specific MetricCollector. @@ -74,12 +81,11 @@ export class TemporalMetricProcessor> { */ buildMetrics( collector: MetricCollectorHandle, - collectors: MetricCollectorHandle[], instrumentDescriptor: InstrumentDescriptor, currentAccumulations: AttributeHashMap, collectionTime: HrTime ): Maybe { - this._stashAccumulations(collectors, currentAccumulations); + this._stashAccumulations(currentAccumulations); const unreportedAccumulations = this._getMergedUnreportedAccumulations(collector); @@ -133,26 +139,31 @@ export class TemporalMetricProcessor> { aggregationTemporality, }); + const accumulationRecords = AttributesMapToAccumulationRecords(result); + + // do not convert to metric data if there is nothing to convert. + if (accumulationRecords.length === 0) { + return undefined; + } + return this._aggregator.toMetricData( instrumentDescriptor, aggregationTemporality, - AttributesMapToAccumulationRecords(result), + accumulationRecords, /* endTime */ collectionTime ); } - private _stashAccumulations( - collectors: MetricCollectorHandle[], - currentAccumulation: AttributeHashMap - ) { - collectors.forEach(it => { - let stash = this._unreportedAccumulations.get(it); + private _stashAccumulations(currentAccumulation: AttributeHashMap) { + const registeredCollectors = this._unreportedAccumulations.keys(); + for (const collector of registeredCollectors) { + let stash = this._unreportedAccumulations.get(collector); if (stash === undefined) { stash = []; - this._unreportedAccumulations.set(it, stash); + this._unreportedAccumulations.set(collector, stash); } stash.push(currentAccumulation); - }); + } } private _getMergedUnreportedAccumulations(collector: MetricCollectorHandle) { diff --git a/packages/sdk-metrics/src/utils.ts b/packages/sdk-metrics/src/utils.ts index 835de92fe1..9a8f80abde 100644 --- a/packages/sdk-metrics/src/utils.ts +++ b/packages/sdk-metrics/src/utils.ts @@ -190,3 +190,7 @@ export function binarySearchLB(arr: number[], value: number): number { } return -1; } + +export function equalsCaseInsensitive(lhs: string, rhs: string): boolean { + return lhs.toLowerCase() === rhs.toLowerCase(); +} diff --git a/packages/sdk-metrics/src/version.js b/packages/sdk-metrics/src/version.js new file mode 100644 index 0000000000..2090d63abf --- /dev/null +++ b/packages/sdk-metrics/src/version.js @@ -0,0 +1,20 @@ +"use strict"; +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VERSION = void 0; +// this is autogenerated file, see scripts/version-update.js +exports.VERSION = '1.16.0'; diff --git a/packages/sdk-metrics/src/view/Aggregation.ts b/packages/sdk-metrics/src/view/Aggregation.ts index 755cd17531..6edf50c495 100644 --- a/packages/sdk-metrics/src/view/Aggregation.ts +++ b/packages/sdk-metrics/src/view/Aggregation.ts @@ -107,7 +107,7 @@ export class LastValueAggregation extends Aggregation { */ export class HistogramAggregation extends Aggregation { private static DEFAULT_INSTANCE = new HistogramAggregator( - [0, 5, 10, 25, 50, 75, 100, 250, 500, 1000], + [0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000], true ); createAggregator(_instrument: InstrumentDescriptor) { @@ -125,7 +125,10 @@ export class ExplicitBucketHistogramAggregation extends Aggregation { * @param boundaries the bucket boundaries of the histogram aggregation * @param _recordMinMax If set to true, min and max will be recorded. Otherwise, min and max will not be recorded. */ - constructor(boundaries: number[], private readonly _recordMinMax = true) { + constructor( + boundaries: number[], + private readonly _recordMinMax = true + ) { super(); if (boundaries === undefined || boundaries.length === 0) { throw new Error('HistogramAggregator should be created with boundaries.'); @@ -181,6 +184,11 @@ export class DefaultAggregation extends Aggregation { return LAST_VALUE_AGGREGATION; } case InstrumentType.HISTOGRAM: { + if (instrument.advice.explicitBucketBoundaries) { + return new ExplicitBucketHistogramAggregation( + instrument.advice.explicitBucketBoundaries + ); + } return HISTOGRAM_AGGREGATION; } } diff --git a/packages/sdk-metrics/test/InstrumentDescriptor.test.ts b/packages/sdk-metrics/test/InstrumentDescriptor.test.ts index 7d8796cbf1..b33a3e8f3a 100644 --- a/packages/sdk-metrics/test/InstrumentDescriptor.test.ts +++ b/packages/sdk-metrics/test/InstrumentDescriptor.test.ts @@ -17,8 +17,13 @@ import * as assert from 'assert'; import { createInstrumentDescriptor, + InstrumentDescriptor, InstrumentType, + isValidName, + isDescriptorCompatibleWith, } from '../src/InstrumentDescriptor'; +import { invalidNames, validNames } from './util'; +import { ValueType } from '@opentelemetry/api'; describe('InstrumentDescriptor', () => { describe('createInstrumentDescriptor', () => { @@ -35,4 +40,159 @@ describe('InstrumentDescriptor', () => { }); } }); + + describe('isDescriptorCompatibleWith', () => { + const tests: [ + string, + boolean, + InstrumentDescriptor, + InstrumentDescriptor, + ][] = [ + [ + 'Compatible with identical descriptors', + true, + { + name: 'foo', + description: 'any descriptions', + unit: 'kB', + type: InstrumentType.COUNTER, + valueType: ValueType.DOUBLE, + advice: {}, + }, + { + name: 'foo', + description: 'any descriptions', + unit: 'kB', + type: InstrumentType.COUNTER, + valueType: ValueType.DOUBLE, + advice: {}, + }, + ], + [ + 'Compatible with case-insensitive names', + true, + { + name: 'foo', + description: '', + unit: '', + type: InstrumentType.COUNTER, + valueType: ValueType.DOUBLE, + advice: {}, + }, + { + name: 'FoO', + description: '', + unit: '', + type: InstrumentType.COUNTER, + valueType: ValueType.DOUBLE, + advice: {}, + }, + ], + [ + 'Compatible with different advice options', + true, + { + name: 'foo', + description: '', + unit: '', + type: InstrumentType.COUNTER, + valueType: ValueType.DOUBLE, + advice: { + explicitBucketBoundaries: [4, 5, 6], + }, + }, + { + name: 'FoO', + description: '', + unit: '', + type: InstrumentType.COUNTER, + valueType: ValueType.DOUBLE, + advice: { + explicitBucketBoundaries: [1, 2, 3], + }, + }, + ], + [ + 'Compatible with empty advice options', + true, + { + name: 'foo', + description: '', + unit: '', + type: InstrumentType.COUNTER, + valueType: ValueType.DOUBLE, + advice: {}, + }, + { + name: 'FoO', + description: '', + unit: '', + type: InstrumentType.COUNTER, + valueType: ValueType.DOUBLE, + advice: { + explicitBucketBoundaries: [1, 2, 3], + }, + }, + ], + [ + 'Incompatible with different names', + false, + { + name: 'foo', + description: '', + unit: '', + type: InstrumentType.COUNTER, + valueType: ValueType.DOUBLE, + advice: {}, + }, + { + name: 'foobar', + description: '', + unit: '', + type: InstrumentType.COUNTER, + valueType: ValueType.DOUBLE, + advice: {}, + }, + ], + [ + 'Incompatible with case-sensitive units', + false, + { + name: 'foo', + description: '', + unit: 'kB', + type: InstrumentType.COUNTER, + valueType: ValueType.DOUBLE, + advice: {}, + }, + { + name: 'foo', + description: '', + unit: 'kb', + type: InstrumentType.COUNTER, + valueType: ValueType.DOUBLE, + advice: {}, + }, + ], + ]; + for (const test of tests) { + it(test[0], () => { + assert.ok(isDescriptorCompatibleWith(test[2], test[3]) === test[1]); + }); + } + }); + + describe('isValidName', () => { + it('should validate names', () => { + for (const invalidName of invalidNames) { + assert.ok( + !isValidName(invalidName), + `${invalidName} should be invalid` + ); + } + for (const validName of validNames) { + assert.ok(isValidName(validName), `${validName} should be valid`); + } + }); + }); }); diff --git a/packages/sdk-metrics/test/Instruments.test.ts b/packages/sdk-metrics/test/Instruments.test.ts index ba0f86bdd4..56ecf03af6 100644 --- a/packages/sdk-metrics/test/Instruments.test.ts +++ b/packages/sdk-metrics/test/Instruments.test.ts @@ -19,13 +19,13 @@ import * as sinon from 'sinon'; import { InstrumentationScope } from '@opentelemetry/core'; import { Resource } from '@opentelemetry/resources'; import { - InstrumentDescriptor, InstrumentType, MeterProvider, MetricReader, DataPoint, DataPointType, Histogram, + MetricDescriptor, } from '../src'; import { TestDeltaMetricReader, @@ -74,9 +74,14 @@ describe('Instruments', () => { }); counter.add(1); - // floating-point value should be trunc-ed. - counter.add(1.1); counter.add(1, { foo: 'bar' }); + // floating-point values should be trunc-ed. + counter.add(1.1); + // non-finite/non-number values should be ignored. + counter.add(Infinity); + counter.add(-Infinity); + counter.add(NaN); + counter.add('1' as any); await validateExport(cumulativeReader, { descriptor: { name: 'test', @@ -124,10 +129,13 @@ describe('Instruments', () => { }); counter.add(1); - // add floating-point value. - counter.add(1.1); counter.add(1, { foo: 'bar' }); + // add floating-point values. + counter.add(1.1); counter.add(1.2, { foo: 'bar' }); + // non-number values should be ignored. + counter.add('1' as any); + await validateExport(cumulativeReader, { dataPointType: DataPointType.SUM, isMonotonic: true, @@ -197,6 +205,13 @@ describe('Instruments', () => { upDownCounter.add(-1.1); upDownCounter.add(4, { foo: 'bar' }); upDownCounter.add(1.1, { foo: 'bar' }); + + // non-finite/non-number values should be ignored. + upDownCounter.add(Infinity); + upDownCounter.add(-Infinity); + upDownCounter.add(NaN); + upDownCounter.add('1' as any); + await validateExport(deltaReader, { descriptor: { name: 'test', @@ -230,6 +245,8 @@ describe('Instruments', () => { upDownCounter.add(-1.1); upDownCounter.add(4, { foo: 'bar' }); upDownCounter.add(1.1, { foo: 'bar' }); + // non-number values should be ignored. + upDownCounter.add('1' as any); await validateExport(deltaReader, { dataPointType: DataPointType.SUM, isMonotonic: false, @@ -283,6 +300,12 @@ describe('Instruments', () => { histogram.record(0.1); histogram.record(100, { foo: 'bar' }); histogram.record(0.1, { foo: 'bar' }); + // non-finite/non-number values should be ignored. + histogram.record(Infinity); + histogram.record(-Infinity); + histogram.record(NaN); + histogram.record('1' as any); + await validateExport(deltaReader, { descriptor: { name: 'test', @@ -297,8 +320,11 @@ describe('Instruments', () => { attributes: {}, value: { buckets: { - boundaries: [0, 5, 10, 25, 50, 75, 100, 250, 500, 1000], - counts: [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0], + boundaries: [ + 0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, + 7500, 10000, + ], + counts: [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], }, count: 2, sum: 10, @@ -310,8 +336,65 @@ describe('Instruments', () => { attributes: { foo: 'bar' }, value: { buckets: { - boundaries: [0, 5, 10, 25, 50, 75, 100, 250, 500, 1000], - counts: [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], + boundaries: [ + 0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, + 7500, 10000, + ], + counts: [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], + }, + count: 2, + sum: 100, + max: 100, + min: 0, + }, + }, + ], + }); + }); + + it('should recognize metric advice', async () => { + const { meter, deltaReader } = setup(); + const histogram = meter.createHistogram('test', { + valueType: ValueType.INT, + advice: { + // Set explicit boundaries that are different from the default one. + explicitBucketBoundaries: [1, 9, 100], + }, + }); + + histogram.record(10); + histogram.record(0); + histogram.record(100, { foo: 'bar' }); + histogram.record(0, { foo: 'bar' }); + await validateExport(deltaReader, { + descriptor: { + name: 'test', + description: '', + unit: '', + type: InstrumentType.HISTOGRAM, + valueType: ValueType.INT, + }, + dataPointType: DataPointType.HISTOGRAM, + dataPoints: [ + { + attributes: {}, + value: { + buckets: { + boundaries: [1, 9, 100], + counts: [1, 0, 1, 0], + }, + count: 2, + sum: 10, + max: 10, + min: 0, + }, + }, + { + attributes: { foo: 'bar' }, + value: { + buckets: { + boundaries: [1, 9, 100], + counts: [1, 0, 0, 1], }, count: 2, sum: 100, @@ -352,8 +435,11 @@ describe('Instruments', () => { attributes: {}, value: { buckets: { - boundaries: [0, 5, 10, 25, 50, 75, 100, 250, 500, 1000], - counts: [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], + boundaries: [ + 0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, + 7500, 10000, + ], + counts: [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], }, count: 2, sum: 110, @@ -379,8 +465,11 @@ describe('Instruments', () => { attributes: {}, value: { buckets: { - boundaries: [0, 5, 10, 25, 50, 75, 100, 250, 500, 1000], - counts: [0, 0, 0, 2, 0, 0, 1, 1, 0, 0, 0], + boundaries: [ + 0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, + 7500, 10000, + ], + counts: [0, 0, 0, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], }, count: 4, sum: 220, @@ -399,10 +488,10 @@ describe('Instruments', () => { }); histogram.record(-1, { foo: 'bar' }); - await validateExport(deltaReader, { - dataPointType: DataPointType.HISTOGRAM, - dataPoints: [], - }); + const result = await deltaReader.collect(); + + // nothing observed + assert.equal(result.resourceMetrics.scopeMetrics.length, 0); }); it('should record DOUBLE values', async () => { @@ -415,6 +504,9 @@ describe('Instruments', () => { histogram.record(0.1); histogram.record(100, { foo: 'bar' }); histogram.record(0.1, { foo: 'bar' }); + // non-number values should be ignored. + histogram.record('1' as any); + await validateExport(deltaReader, { dataPointType: DataPointType.HISTOGRAM, dataPoints: [ @@ -422,8 +514,11 @@ describe('Instruments', () => { attributes: {}, value: { buckets: { - boundaries: [0, 5, 10, 25, 50, 75, 100, 250, 500, 1000], - counts: [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0], + boundaries: [ + 0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, + 7500, 10000, + ], + counts: [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], }, count: 2, sum: 10.1, @@ -435,8 +530,11 @@ describe('Instruments', () => { attributes: { foo: 'bar' }, value: { buckets: { - boundaries: [0, 5, 10, 25, 50, 75, 100, 250, 500, 1000], - counts: [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], + boundaries: [ + 0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, + 7500, 10000, + ], + counts: [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], }, count: 2, sum: 100.1, @@ -455,10 +553,10 @@ describe('Instruments', () => { }); histogram.record(-0.5, { foo: 'bar' }); - await validateExport(deltaReader, { - dataPointType: DataPointType.HISTOGRAM, - dataPoints: [], - }); + const result = await deltaReader.collect(); + + // nothing observed + assert.equal(result.resourceMetrics.scopeMetrics.length, 0); }); }); @@ -677,7 +775,7 @@ function setup() { interface ValidateMetricData { resource?: Resource; instrumentationScope?: InstrumentationScope; - descriptor?: InstrumentDescriptor; + descriptor?: MetricDescriptor; dataPointType?: DataPointType; dataPoints?: Partial>>[]; isMonotonic?: boolean; diff --git a/packages/sdk-metrics/test/Meter.test.ts b/packages/sdk-metrics/test/Meter.test.ts index 4ffe41607d..e40d6aa507 100644 --- a/packages/sdk-metrics/test/Meter.test.ts +++ b/packages/sdk-metrics/test/Meter.test.ts @@ -14,8 +14,9 @@ * limitations under the License. */ -import { Observable } from '@opentelemetry/api'; +import { Observable, diag } from '@opentelemetry/api'; import * as assert from 'assert'; +import * as sinon from 'sinon'; import { CounterInstrument, HistogramInstrument, @@ -27,78 +28,86 @@ import { import { Meter } from '../src/Meter'; import { MeterProviderSharedState } from '../src/state/MeterProviderSharedState'; import { MeterSharedState } from '../src/state/MeterSharedState'; -import { defaultInstrumentationScope, defaultResource } from './util'; +import { + defaultInstrumentationScope, + defaultResource, + invalidNames, + validNames, +} from './util'; describe('Meter', () => { + afterEach(() => { + sinon.restore(); + }); + describe('createCounter', () => { - it('should create counter', () => { + testWithNames('counter', name => { const meterSharedState = new MeterSharedState( new MeterProviderSharedState(defaultResource), defaultInstrumentationScope ); const meter = new Meter(meterSharedState); - const counter = meter.createCounter('foobar'); + const counter = meter.createCounter(name); assert(counter instanceof CounterInstrument); }); }); describe('createUpDownCounter', () => { - it('should create up down counter', () => { + testWithNames('UpDownCounter', name => { const meterSharedState = new MeterSharedState( new MeterProviderSharedState(defaultResource), defaultInstrumentationScope ); const meter = new Meter(meterSharedState); - const upDownCounter = meter.createUpDownCounter('foobar'); + const upDownCounter = meter.createUpDownCounter(name); assert(upDownCounter instanceof UpDownCounterInstrument); }); }); describe('createHistogram', () => { - it('should create histogram', () => { + testWithNames('Histogram', name => { const meterSharedState = new MeterSharedState( new MeterProviderSharedState(defaultResource), defaultInstrumentationScope ); const meter = new Meter(meterSharedState); - const histogram = meter.createHistogram('foobar'); + const histogram = meter.createHistogram(name); assert(histogram instanceof HistogramInstrument); }); }); describe('createObservableGauge', () => { - it('should create observable gauge', () => { + testWithNames('ObservableGauge', name => { const meterSharedState = new MeterSharedState( new MeterProviderSharedState(defaultResource), defaultInstrumentationScope ); const meter = new Meter(meterSharedState); - const observableGauge = meter.createObservableGauge('foobar'); + const observableGauge = meter.createObservableGauge(name); assert(observableGauge instanceof ObservableGaugeInstrument); }); }); describe('createObservableCounter', () => { - it('should create observable counter', () => { + testWithNames('ObservableCounter', name => { const meterSharedState = new MeterSharedState( new MeterProviderSharedState(defaultResource), defaultInstrumentationScope ); const meter = new Meter(meterSharedState); - const observableCounter = meter.createObservableCounter('foobar'); + const observableCounter = meter.createObservableCounter(name); assert(observableCounter instanceof ObservableCounterInstrument); }); }); describe('createObservableUpDownCounter', () => { - it('should create observable up-down-counter', () => { + testWithNames('ObservableUpDownCounter', name => { const meterSharedState = new MeterSharedState( new MeterProviderSharedState(defaultResource), defaultInstrumentationScope ); const meter = new Meter(meterSharedState); - const observableUpDownCounter = - meter.createObservableUpDownCounter('foobar'); + const observableUpDownCounter = meter.createObservableUpDownCounter(name); assert( observableUpDownCounter instanceof ObservableUpDownCounterInstrument ); @@ -167,3 +176,22 @@ describe('Meter', () => { }); }); }); + +function testWithNames(type: string, tester: (name: string) => void) { + for (const invalidName of invalidNames) { + it(`should warn with invalid name ${invalidName} for ${type}`, () => { + const warnStub = sinon.spy(diag, 'warn'); + tester(invalidName); + assert.strictEqual(warnStub.callCount, 1); + assert.ok(warnStub.calledWithMatch('Invalid metric name')); + }); + } + + for (const validName of validNames) { + it(`should not warn with valid name ${validName} for ${type}`, () => { + const warnStub = sinon.spy(diag, 'warn'); + tester(validName); + assert.strictEqual(warnStub.callCount, 0); + }); + } +} diff --git a/packages/sdk-metrics/test/MeterProvider.test.ts b/packages/sdk-metrics/test/MeterProvider.test.ts index a9f8361b81..be075f0fa6 100644 --- a/packages/sdk-metrics/test/MeterProvider.test.ts +++ b/packages/sdk-metrics/test/MeterProvider.test.ts @@ -77,23 +77,29 @@ describe('MeterProvider', () => { const reader = new TestMetricReader(); meterProvider.addMetricReader(reader); - // Create meter and instrument. + // Create meter and instrument, needs observation on instrument, otherwise the scope will not be reported. // name+version pair 1 - meterProvider.getMeter('meter1', 'v1.0.0'); - meterProvider.getMeter('meter1', 'v1.0.0'); + meterProvider.getMeter('meter1', 'v1.0.0').createCounter('test').add(1); + meterProvider.getMeter('meter1', 'v1.0.0').createCounter('test').add(1); // name+version pair 2 - meterProvider.getMeter('meter2', 'v1.0.0'); - meterProvider.getMeter('meter2', 'v1.0.0'); + meterProvider.getMeter('meter2', 'v1.0.0').createCounter('test').add(1); + meterProvider.getMeter('meter2', 'v1.0.0').createCounter('test').add(1); // name+version pair 3 - meterProvider.getMeter('meter1', 'v1.0.1'); - meterProvider.getMeter('meter1', 'v1.0.1'); + meterProvider.getMeter('meter1', 'v1.0.1').createCounter('test').add(1); + meterProvider.getMeter('meter1', 'v1.0.1').createCounter('test').add(1); // name+version+schemaUrl pair 4 - meterProvider.getMeter('meter1', 'v1.0.1', { - schemaUrl: 'https://opentelemetry.io/schemas/1.4.0', - }); - meterProvider.getMeter('meter1', 'v1.0.1', { - schemaUrl: 'https://opentelemetry.io/schemas/1.4.0', - }); + meterProvider + .getMeter('meter1', 'v1.0.1', { + schemaUrl: 'https://opentelemetry.io/schemas/1.4.0', + }) + .createCounter('test') + .add(1); + meterProvider + .getMeter('meter1', 'v1.0.1', { + schemaUrl: 'https://opentelemetry.io/schemas/1.4.0', + }) + .createCounter('test') + .add(1); // Perform collection. const { resourceMetrics, errors } = await reader.collect(); diff --git a/packages/sdk-metrics/test/ObservableResult.test.ts b/packages/sdk-metrics/test/ObservableResult.test.ts index f07b3f9f21..2dd7be5cad 100644 --- a/packages/sdk-metrics/test/ObservableResult.test.ts +++ b/packages/sdk-metrics/test/ObservableResult.test.ts @@ -33,7 +33,8 @@ describe('ObservableResultImpl', () => { describe('observe', () => { it('should observe common values', () => { const observableResult = new ObservableResultImpl( - defaultInstrumentDescriptor + 'instrument_name', + ValueType.DOUBLE ); for (const value of commonValues) { for (const attributes of commonAttributes) { @@ -44,7 +45,8 @@ describe('ObservableResultImpl', () => { it('should deduplicate observations', () => { const observableResult = new ObservableResultImpl( - defaultInstrumentDescriptor + 'instrument_name', + ValueType.DOUBLE ); observableResult.observe(1, {}); observableResult.observe(2, {}); @@ -55,16 +57,25 @@ describe('ObservableResultImpl', () => { }); it('should trunc value if ValueType is INT', () => { - const observableResult = new ObservableResultImpl({ - name: 'test', - description: '', - type: InstrumentType.COUNTER, - unit: '', - valueType: ValueType.INT, - }); + const observableResult = new ObservableResultImpl( + 'instrument_name', + ValueType.INT + ); observableResult.observe(1.1, {}); + // should ignore non-finite/non-number values. + observableResult.observe(Infinity, {}); + observableResult.observe(-Infinity, {}); + observableResult.observe(NaN, {}); + assert.strictEqual(observableResult._buffer.get({}), 1); }); + + it('should ignore non-number values', () => { + const observableResult = new ObservableResultImpl('test', ValueType.INT); + observableResult.observe('1' as any, {}); + + assert.strictEqual(observableResult._buffer.get({}), undefined); + }); }); }); @@ -120,13 +131,42 @@ describe('BatchObservableResultImpl', () => { type: InstrumentType.COUNTER, unit: '', valueType: ValueType.INT, + advice: {}, }, [], new ObservableRegistry() ); observableResult.observe(observable, 1.1, {}); + // should ignore non-finite/non-number values. + observableResult.observe(observable, Infinity, {}); + observableResult.observe(observable, -Infinity, {}); + observableResult.observe(observable, NaN, {}); assert.strictEqual(observableResult._buffer.get(observable)?.get({}), 1); }); + + it('should ignore invalid values', () => { + const observableResult = new BatchObservableResultImpl(); + const observable = new ObservableInstrument( + { + name: 'test', + description: '', + type: InstrumentType.COUNTER, + unit: '', + valueType: ValueType.INT, + advice: {}, + }, + [], + new ObservableRegistry() + ); + + observableResult.observe(observable, '1' as any, {}); + observableResult.observe(/** invalid observable */ {} as any, 1, {}); + assert.strictEqual( + observableResult._buffer.get(observable)!.get({}), + undefined + ); + assert.strictEqual(observableResult._buffer.size, 1); + }); }); }); diff --git a/packages/sdk-metrics/test/aggregator/ExponentialHistogram.test.ts b/packages/sdk-metrics/test/aggregator/ExponentialHistogram.test.ts index 150eb13e91..2bcbc43307 100644 --- a/packages/sdk-metrics/test/aggregator/ExponentialHistogram.test.ts +++ b/packages/sdk-metrics/test/aggregator/ExponentialHistogram.test.ts @@ -574,6 +574,15 @@ describe('ExponentialHistogramAggregation', () => { assert.deepStrictEqual(acc0.toPointValue(), acc0Snapshot); assert.deepStrictEqual(acc1.toPointValue(), acc1Snapshot); }); + + it("keeps the previous point's startTime", () => { + const agg = new ExponentialHistogramAggregator(4, true); + const acc0 = agg.createAccumulation([0, 0]); + const acc1 = agg.createAccumulation([3, 0]); + + const result = agg.merge(acc0, acc1); + assert.strictEqual(result.startTime, acc0.startTime); + }); }); describe('diff', () => { diff --git a/packages/sdk-metrics/test/export/MetricReader.test.ts b/packages/sdk-metrics/test/export/MetricReader.test.ts index 297622982d..c0643a60da 100644 --- a/packages/sdk-metrics/test/export/MetricReader.test.ts +++ b/packages/sdk-metrics/test/export/MetricReader.test.ts @@ -20,7 +20,13 @@ import { MeterProvider } from '../../src/MeterProvider'; import { assertRejects } from '../test-utils'; import { emptyResourceMetrics, TestMetricProducer } from './TestMetricProducer'; import { TestMetricReader } from './TestMetricReader'; -import { Aggregation, AggregationTemporality } from '../../src'; +import { + Aggregation, + AggregationTemporality, + DataPointType, + InstrumentType, + ScopeMetrics, +} from '../../src'; import { DEFAULT_AGGREGATION_SELECTOR, DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR, @@ -29,6 +35,39 @@ import { assertAggregationSelector, assertAggregationTemporalitySelector, } from './utils'; +import { defaultResource } from '../util'; +import { ValueType } from '@opentelemetry/api'; +import { Resource } from '@opentelemetry/resources'; + +const testScopeMetrics: ScopeMetrics[] = [ + { + scope: { + name: 'additionalMetricProducerMetrics', + }, + metrics: [ + { + aggregationTemporality: AggregationTemporality.CUMULATIVE, + dataPointType: DataPointType.SUM, + dataPoints: [ + { + attributes: {}, + value: 1, + startTime: [0, 0], + endTime: [1, 0], + }, + ], + descriptor: { + name: 'additionalCounter', + unit: '', + type: InstrumentType.COUNTER, + description: '', + valueType: ValueType.INT, + }, + isMonotonic: true, + }, + ], + }, +]; describe('MetricReader', () => { describe('setMetricProducer', () => { @@ -83,20 +122,91 @@ describe('MetricReader', () => { assertRejects(reader.collect(), /MetricReader is shutdown/); }); - it('should call MetricProduce.collect with timeout', async () => { + it('should call MetricProducer.collect with timeout', async () => { const reader = new TestMetricReader(); const producer = new TestMetricProducer(); reader.setMetricProducer(producer); - const collectStub = sinon.stub(producer, 'collect'); + const collectSpy = sinon.spy(producer, 'collect'); await reader.collect({ timeoutMillis: 20 }); - assert(collectStub.calledOnce); - const args = collectStub.args[0]; + assert(collectSpy.calledOnce); + const args = collectSpy.args[0]; assert.deepStrictEqual(args, [{ timeoutMillis: 20 }]); await reader.shutdown(); }); + + it('should collect metrics from the SDK and the additional metricProducers', async () => { + const meterProvider = new MeterProvider({ resource: defaultResource }); + const additionalProducer = new TestMetricProducer({ + resourceMetrics: { + resource: new Resource({ + shouldBeDiscarded: 'should-be-discarded', + }), + scopeMetrics: testScopeMetrics, + }, + }); + const reader = new TestMetricReader({ + metricProducers: [additionalProducer], + }); + meterProvider.addMetricReader(reader); + + // Make a measurement + meterProvider + .getMeter('someSdkMetrics') + .createCounter('sdkCounter') + .add(5, { hello: 'world' }); + const collectionResult = await reader.collect(); + + assert.strictEqual(collectionResult.errors.length, 0); + // Should keep the SDK's Resource only + assert.deepStrictEqual( + collectionResult.resourceMetrics.resource, + defaultResource + ); + assert.strictEqual( + collectionResult.resourceMetrics.scopeMetrics.length, + 2 + ); + const [sdkScopeMetrics, additionalScopeMetrics] = + collectionResult.resourceMetrics.scopeMetrics; + + assert.strictEqual(sdkScopeMetrics.scope.name, 'someSdkMetrics'); + assert.strictEqual( + additionalScopeMetrics.scope.name, + 'additionalMetricProducerMetrics' + ); + + await reader.shutdown(); + }); + + it('should merge the errors from the SDK and all metricProducers', async () => { + const meterProvider = new MeterProvider(); + const reader = new TestMetricReader({ + metricProducers: [ + new TestMetricProducer({ errors: ['err1'] }), + new TestMetricProducer({ errors: ['err2'] }), + ], + }); + meterProvider.addMetricReader(reader); + + // Provide a callback throwing an error too + meterProvider + .getMeter('someSdkMetrics') + .createObservableCounter('sdkCounter') + .addCallback(result => { + throw 'errsdk'; + }); + const collectionResult = await reader.collect(); + + assert.deepStrictEqual(collectionResult.errors, [ + 'errsdk', + 'err1', + 'err2', + ]); + await reader.shutdown(); + }); }); describe('selectAggregation', () => { diff --git a/packages/sdk-metrics/test/export/TestMetricProducer.ts b/packages/sdk-metrics/test/export/TestMetricProducer.ts index 29137d62a4..d4865724c3 100644 --- a/packages/sdk-metrics/test/export/TestMetricProducer.ts +++ b/packages/sdk-metrics/test/export/TestMetricProducer.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { CollectionResult } from '../../src/export/MetricData'; +import { CollectionResult, ResourceMetrics } from '../../src/export/MetricData'; import { MetricProducer } from '../../src/export/MetricProducer'; import { defaultResource } from '../util'; @@ -24,10 +24,21 @@ export const emptyResourceMetrics = { }; export class TestMetricProducer implements MetricProducer { + private resourceMetrics: ResourceMetrics; + private errors: unknown[]; + + constructor(params?: { + resourceMetrics?: ResourceMetrics; + errors?: unknown[]; + }) { + this.resourceMetrics = params?.resourceMetrics ?? emptyResourceMetrics; + this.errors = params?.errors ?? []; + } + async collect(): Promise { return { - resourceMetrics: { resource: defaultResource, scopeMetrics: [] }, - errors: [], + resourceMetrics: this.resourceMetrics, + errors: this.errors, }; } } diff --git a/packages/sdk-metrics/test/export/TestMetricReader.ts b/packages/sdk-metrics/test/export/TestMetricReader.ts index 61727322a4..46fd41c045 100644 --- a/packages/sdk-metrics/test/export/TestMetricReader.ts +++ b/packages/sdk-metrics/test/export/TestMetricReader.ts @@ -31,7 +31,7 @@ export class TestMetricReader extends MetricReader { } getMetricCollector(): MetricCollector { - return this['_metricProducer'] as MetricCollector; + return this['_sdkMetricProducer'] as MetricCollector; } } diff --git a/packages/sdk-metrics/test/regression/cumulative-exponential-histogram.test.ts b/packages/sdk-metrics/test/regression/cumulative-exponential-histogram.test.ts new file mode 100644 index 0000000000..79dcfc434f --- /dev/null +++ b/packages/sdk-metrics/test/regression/cumulative-exponential-histogram.test.ts @@ -0,0 +1,90 @@ +/* + * 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 { + Aggregation, + AggregationTemporality, + InstrumentType, + MeterProvider, + MetricReader, +} from '../../src'; +import { TestMetricReader } from '../export/TestMetricReader'; + +describe('cumulative-exponential-histogram', () => { + let clock: sinon.SinonFakeTimers; + + beforeEach(() => { + clock = sinon.useFakeTimers(); + }); + afterEach(() => { + sinon.restore(); + }); + + it('Cumulative Histogram should have the same startTime every collection', async () => { + // Works fine and passes + await doTest(Aggregation.Histogram()); + }); + + it('Cumulative ExponentialHistogram should have the same startTime every collection', async () => { + // Fails + await doTest(Aggregation.ExponentialHistogram()); + }); + + const doTest = async (histogramAggregation: Aggregation) => { + const meterProvider = new MeterProvider(); + const reader = new TestMetricReader({ + aggregationTemporalitySelector() { + return AggregationTemporality.CUMULATIVE; + }, + aggregationSelector(type) { + return type === InstrumentType.HISTOGRAM + ? histogramAggregation + : Aggregation.Default(); + }, + }); + + meterProvider.addMetricReader(reader); + const meter = meterProvider.getMeter('my-meter'); + const hist = meter.createHistogram('testhist'); + + hist.record(1); + + const resourceMetrics1 = await collectNoErrors(reader); + const dataPoint1 = + resourceMetrics1.scopeMetrics[0].metrics[0].dataPoints[0]; + + clock.tick(1000); + hist.record(2); + + const resourceMetrics2 = await collectNoErrors(reader); + const dataPoint2 = + resourceMetrics2.scopeMetrics[0].metrics[0].dataPoints[0]; + + assert.deepStrictEqual( + dataPoint1.startTime, + dataPoint2.startTime, + 'The start time should be the same across cumulative collections' + ); + }; + + const collectNoErrors = async (reader: MetricReader) => { + const { resourceMetrics, errors } = await reader.collect(); + assert.strictEqual(errors.length, 0); + return resourceMetrics; + }; +}); diff --git a/packages/sdk-metrics/test/state/AsyncMetricStorage.test.ts b/packages/sdk-metrics/test/state/AsyncMetricStorage.test.ts index 9fe742ca02..b4a5df1923 100644 --- a/packages/sdk-metrics/test/state/AsyncMetricStorage.test.ts +++ b/packages/sdk-metrics/test/state/AsyncMetricStorage.test.ts @@ -43,15 +43,16 @@ const cumulativeCollector: MetricCollectorHandle = { describe('AsyncMetricStorage', () => { describe('collect', () => { describe('Delta Collector', () => { - const collectors = [deltaCollector]; it('should collect and reset memos', async () => { const delegate = new ObservableCallbackDelegate(); const observableRegistry = new ObservableRegistry(); const metricStorage = new AsyncMetricStorage( defaultInstrumentDescriptor, new SumAggregator(true), - new NoopAttributesProcessor() + new NoopAttributesProcessor(), + [deltaCollector] ); + const observable = new ObservableInstrument( defaultInstrumentDescriptor, [metricStorage], @@ -68,11 +69,7 @@ describe('AsyncMetricStorage', () => { { const collectionTime: HrTime = [0, 0]; await observableRegistry.observe(collectionTime); - const metric = metricStorage.collect( - deltaCollector, - collectors, - collectionTime - ); + const metric = metricStorage.collect(deltaCollector, collectionTime); assertMetricData(metric, DataPointType.SUM); assert.strictEqual(metric.dataPoints.length, 3); @@ -104,14 +101,9 @@ describe('AsyncMetricStorage', () => { { const collectionTime: HrTime = [1, 1]; await observableRegistry.observe(collectionTime); - const metric = metricStorage.collect( - deltaCollector, - collectors, - collectionTime - ); + const metric = metricStorage.collect(deltaCollector, collectionTime); - assertMetricData(metric, DataPointType.SUM); - assert.strictEqual(metric.dataPoints.length, 0); + assert.equal(metric, undefined); } delegate.setDelegate(observableResult => { @@ -122,11 +114,7 @@ describe('AsyncMetricStorage', () => { { const collectionTime: HrTime = [2, 2]; await observableRegistry.observe(collectionTime); - const metric = metricStorage.collect( - deltaCollector, - collectors, - collectionTime - ); + const metric = metricStorage.collect(deltaCollector, collectionTime); assertMetricData(metric, DataPointType.SUM); assert.strictEqual(metric.dataPoints.length, 3); @@ -161,8 +149,10 @@ describe('AsyncMetricStorage', () => { const metricStorage = new AsyncMetricStorage( defaultInstrumentDescriptor, new SumAggregator(true), - new NoopAttributesProcessor() + new NoopAttributesProcessor(), + [deltaCollector] ); + const observable = new ObservableInstrument( defaultInstrumentDescriptor, [metricStorage], @@ -179,11 +169,7 @@ describe('AsyncMetricStorage', () => { { const collectionTime: HrTime = [0, 0]; await observableRegistry.observe(collectionTime); - const metric = metricStorage.collect( - deltaCollector, - collectors, - collectionTime - ); + const metric = metricStorage.collect(deltaCollector, collectionTime); assertMetricData(metric, DataPointType.SUM); assert.strictEqual(metric.dataPoints.length, 1); @@ -205,11 +191,7 @@ describe('AsyncMetricStorage', () => { { const collectionTime: HrTime = [1, 1]; await observableRegistry.observe(collectionTime); - const metric = metricStorage.collect( - deltaCollector, - collectors, - collectionTime - ); + const metric = metricStorage.collect(deltaCollector, collectionTime); assertMetricData(metric, DataPointType.SUM); assert.strictEqual(metric.dataPoints.length, 1); @@ -231,11 +213,7 @@ describe('AsyncMetricStorage', () => { { const collectionTime: HrTime = [2, 2]; await observableRegistry.observe(collectionTime); - const metric = metricStorage.collect( - deltaCollector, - collectors, - collectionTime - ); + const metric = metricStorage.collect(deltaCollector, collectionTime); assertMetricData(metric, DataPointType.SUM); assert.strictEqual(metric.dataPoints.length, 1); @@ -255,8 +233,10 @@ describe('AsyncMetricStorage', () => { const metricStorage = new AsyncMetricStorage( defaultInstrumentDescriptor, new SumAggregator(false), - new NoopAttributesProcessor() + new NoopAttributesProcessor(), + [deltaCollector] ); + const observable = new ObservableInstrument( defaultInstrumentDescriptor, [metricStorage], @@ -273,11 +253,7 @@ describe('AsyncMetricStorage', () => { { const collectionTime: HrTime = [0, 0]; await observableRegistry.observe(collectionTime); - const metric = metricStorage.collect( - deltaCollector, - collectors, - collectionTime - ); + const metric = metricStorage.collect(deltaCollector, collectionTime); assertMetricData(metric, DataPointType.SUM); assert.strictEqual(metric.dataPoints.length, 1); @@ -299,11 +275,7 @@ describe('AsyncMetricStorage', () => { { const collectionTime: HrTime = [0, 0]; await observableRegistry.observe(collectionTime); - const metric = metricStorage.collect( - deltaCollector, - collectors, - collectionTime - ); + const metric = metricStorage.collect(deltaCollector, collectionTime); assertMetricData(metric, DataPointType.SUM); assert.strictEqual(metric.dataPoints.length, 1); @@ -325,11 +297,7 @@ describe('AsyncMetricStorage', () => { { const collectionTime: HrTime = [2, 2]; await observableRegistry.observe(collectionTime); - const metric = metricStorage.collect( - deltaCollector, - collectors, - collectionTime - ); + const metric = metricStorage.collect(deltaCollector, collectionTime); assertMetricData(metric, DataPointType.SUM); assert.strictEqual(metric.dataPoints.length, 1); @@ -345,15 +313,16 @@ describe('AsyncMetricStorage', () => { }); describe('Cumulative Collector', () => { - const collectors = [cumulativeCollector]; it('should collect cumulative metrics', async () => { const delegate = new ObservableCallbackDelegate(); const observableRegistry = new ObservableRegistry(); const metricStorage = new AsyncMetricStorage( defaultInstrumentDescriptor, new SumAggregator(true), - new NoopAttributesProcessor() + new NoopAttributesProcessor(), + [cumulativeCollector] ); + const observable = new ObservableInstrument( defaultInstrumentDescriptor, [metricStorage], @@ -373,7 +342,6 @@ describe('AsyncMetricStorage', () => { await observableRegistry.observe(collectionTime); const metric = metricStorage.collect( cumulativeCollector, - collectors, collectionTime ); @@ -410,7 +378,6 @@ describe('AsyncMetricStorage', () => { await observableRegistry.observe(collectionTime); const metric = metricStorage.collect( cumulativeCollector, - collectors, collectionTime ); @@ -449,7 +416,6 @@ describe('AsyncMetricStorage', () => { await observableRegistry.observe(collectionTime); const metric = metricStorage.collect( cumulativeCollector, - collectors, collectionTime ); @@ -485,8 +451,10 @@ describe('AsyncMetricStorage', () => { const metricStorage = new AsyncMetricStorage( defaultInstrumentDescriptor, new SumAggregator(true), - new NoopAttributesProcessor() + new NoopAttributesProcessor(), + [cumulativeCollector] ); + const observable = new ObservableInstrument( defaultInstrumentDescriptor, [metricStorage], @@ -505,7 +473,6 @@ describe('AsyncMetricStorage', () => { await observableRegistry.observe(collectionTime); const metric = metricStorage.collect( cumulativeCollector, - collectors, collectionTime ); @@ -531,7 +498,6 @@ describe('AsyncMetricStorage', () => { await observableRegistry.observe(collectionTime); const metric = metricStorage.collect( cumulativeCollector, - collectors, collectionTime ); @@ -558,7 +524,6 @@ describe('AsyncMetricStorage', () => { await observableRegistry.observe(collectionTime); const metric = metricStorage.collect( cumulativeCollector, - collectors, collectionTime ); @@ -580,8 +545,10 @@ describe('AsyncMetricStorage', () => { const metricStorage = new AsyncMetricStorage( defaultInstrumentDescriptor, new SumAggregator(false), - new NoopAttributesProcessor() + new NoopAttributesProcessor(), + [cumulativeCollector] ); + const observable = new ObservableInstrument( defaultInstrumentDescriptor, [metricStorage], @@ -600,7 +567,6 @@ describe('AsyncMetricStorage', () => { await observableRegistry.observe(collectionTime); const metric = metricStorage.collect( cumulativeCollector, - collectors, collectionTime ); @@ -626,7 +592,6 @@ describe('AsyncMetricStorage', () => { await observableRegistry.observe(collectionTime); const metric = metricStorage.collect( cumulativeCollector, - collectors, collectionTime ); @@ -652,7 +617,6 @@ describe('AsyncMetricStorage', () => { await observableRegistry.observe(collectionTime); const metric = metricStorage.collect( cumulativeCollector, - collectors, collectionTime ); diff --git a/packages/sdk-metrics/test/state/MetricCollector.test.ts b/packages/sdk-metrics/test/state/MetricCollector.test.ts index 3c70b35759..8466a5a95c 100644 --- a/packages/sdk-metrics/test/state/MetricCollector.test.ts +++ b/packages/sdk-metrics/test/state/MetricCollector.test.ts @@ -141,7 +141,8 @@ describe('MetricCollector', () => { assert.strictEqual(errors.length, 0); const { scopeMetrics } = resourceMetrics; const { metrics } = scopeMetrics[0]; - assert.strictEqual(metrics.length, 3); + // Should not export observableCounter3, as it was never observed + assert.strictEqual(metrics.length, 2); /** checking batch[0] */ const metricData1 = metrics[0]; @@ -160,13 +161,6 @@ describe('MetricCollector', () => { assert.strictEqual(metricData2.dataPoints.length, 2); assertDataPoint(metricData2.dataPoints[0], {}, 3); assertDataPoint(metricData2.dataPoints[1], { foo: 'bar' }, 4); - - /** checking batch[2] */ - const metricData3 = metrics[2]; - assertMetricData(metricData3, DataPointType.SUM, { - name: 'observable3', - }); - assert.strictEqual(metricData3.dataPoints.length, 0); }); it('should collect observer metrics with timeout', async () => { @@ -205,19 +199,15 @@ describe('MetricCollector', () => { assert(errors[0] instanceof TimeoutError); const { scopeMetrics } = resourceMetrics; const { metrics } = scopeMetrics[0]; - assert.strictEqual(metrics.length, 2); - /** observer1 */ - assertMetricData(metrics[0], DataPointType.SUM, { - name: 'observer1', - }); - assert.strictEqual(metrics[0].dataPoints.length, 0); + // Only observer2 is exported, observer1 never reported a measurement + assert.strictEqual(metrics.length, 1); /** observer2 */ - assertMetricData(metrics[1], DataPointType.SUM, { + assertMetricData(metrics[0], DataPointType.SUM, { name: 'observer2', }); - assert.strictEqual(metrics[1].dataPoints.length, 1); + assert.strictEqual(metrics[0].dataPoints.length, 1); } /** now the observer1 is back to normal */ @@ -272,19 +262,13 @@ describe('MetricCollector', () => { assert.strictEqual(`${errors[0]}`, 'Error: foobar'); const { scopeMetrics } = resourceMetrics; const { metrics } = scopeMetrics[0]; - assert.strictEqual(metrics.length, 2); - /** counter1 data points are collected */ + /** only counter1 data points are collected */ + assert.strictEqual(metrics.length, 1); assertMetricData(metrics[0], DataPointType.SUM, { name: 'counter1', }); assert.strictEqual(metrics[0].dataPoints.length, 1); - - /** observer1 data points are not collected */ - assertMetricData(metrics[1], DataPointType.SUM, { - name: 'observer1', - }); - assert.strictEqual(metrics[1].dataPoints.length, 0); }); it('should collect batch observer metrics with timeout', async () => { @@ -327,19 +311,13 @@ describe('MetricCollector', () => { assert(errors[0] instanceof TimeoutError); const { scopeMetrics } = resourceMetrics; const { metrics } = scopeMetrics[0]; - assert.strictEqual(metrics.length, 2); - /** observer1 */ + /** only observer2 is present; observer1's promise never settled*/ + assert.strictEqual(metrics.length, 1); assertMetricData(metrics[0], DataPointType.SUM, { - name: 'observer1', - }); - assert.strictEqual(metrics[0].dataPoints.length, 0); - - /** observer2 */ - assertMetricData(metrics[1], DataPointType.SUM, { name: 'observer2', }); - assert.strictEqual(metrics[1].dataPoints.length, 1); + assert.strictEqual(metrics[0].dataPoints.length, 1); } /** now the observer1 is back to normal */ @@ -398,19 +376,13 @@ describe('MetricCollector', () => { assert.strictEqual(`${errors[0]}`, 'Error: foobar'); const { scopeMetrics } = resourceMetrics; const { metrics } = scopeMetrics[0]; - assert.strictEqual(metrics.length, 2); - /** counter1 data points are collected */ + /** counter1 data points are collected; observer1's callback did throw, so data points are not collected */ + assert.strictEqual(metrics.length, 1); assertMetricData(metrics[0], DataPointType.SUM, { name: 'counter1', }); assert.strictEqual(metrics[0].dataPoints.length, 1); - - /** observer1 data points are not collected */ - assertMetricData(metrics[1], DataPointType.SUM, { - name: 'observer1', - }); - assert.strictEqual(metrics[1].dataPoints.length, 0); }); }); }); diff --git a/packages/sdk-metrics/test/state/MetricStorageRegistry.test.ts b/packages/sdk-metrics/test/state/MetricStorageRegistry.test.ts index 26a48a0ba3..8a1513e351 100644 --- a/packages/sdk-metrics/test/state/MetricStorageRegistry.test.ts +++ b/packages/sdk-metrics/test/state/MetricStorageRegistry.test.ts @@ -19,7 +19,7 @@ import { diag, ValueType } from '@opentelemetry/api'; import { MetricStorage } from '../../src/state/MetricStorage'; import { HrTime } from '@opentelemetry/api'; import { MetricCollectorHandle } from '../../src/state/MetricCollector'; -import { MetricData, InstrumentDescriptor, InstrumentType } from '../../src'; +import { MetricData, InstrumentType } from '../../src'; import { Maybe } from '../../src/utils'; import * as assert from 'assert'; import * as sinon from 'sinon'; @@ -29,11 +29,11 @@ import { getUnitConflictResolutionRecipe, getValueTypeConflictResolutionRecipe, } from '../../src/view/RegistrationConflicts'; +import { InstrumentDescriptor } from '../../src/InstrumentDescriptor'; class TestMetricStorage extends MetricStorage { collect( collector: MetricCollectorHandle, - collectors: MetricCollectorHandle[], collectionTime: HrTime ): Maybe { return undefined; @@ -74,6 +74,7 @@ describe('MetricStorageRegistry', () => { description: 'description', unit: '1', valueType: ValueType.DOUBLE, + advice: {}, }); registry.register(storage); @@ -93,6 +94,7 @@ describe('MetricStorageRegistry', () => { description: 'description', unit: '1', valueType: ValueType.DOUBLE, + advice: {}, }); const storage2 = new TestMetricStorage({ name: 'instrument2', @@ -100,6 +102,7 @@ describe('MetricStorageRegistry', () => { description: 'description', unit: '1', valueType: ValueType.DOUBLE, + advice: {}, }); registry.registerForCollector(collectorHandle, storage); @@ -153,6 +156,7 @@ describe('MetricStorageRegistry', () => { description: 'description', unit: '1', valueType: ValueType.DOUBLE, + advice: {}, }; const otherDescriptor = { @@ -161,6 +165,7 @@ describe('MetricStorageRegistry', () => { description: 'description', unit: '1', valueType: ValueType.DOUBLE, + advice: {}, }; testConflictingRegistration( @@ -177,6 +182,7 @@ describe('MetricStorageRegistry', () => { description: 'description', unit: '1', valueType: ValueType.DOUBLE, + advice: {}, }; const otherDescriptor = { @@ -185,6 +191,7 @@ describe('MetricStorageRegistry', () => { description: 'description', unit: '1', valueType: ValueType.INT, + advice: {}, }; testConflictingRegistration( @@ -204,6 +211,7 @@ describe('MetricStorageRegistry', () => { description: 'description', unit: '1', valueType: ValueType.DOUBLE, + advice: {}, }; const otherDescriptor = { @@ -212,6 +220,7 @@ describe('MetricStorageRegistry', () => { description: 'description', unit: 'ms', valueType: ValueType.DOUBLE, + advice: {}, }; testConflictingRegistration( @@ -228,6 +237,7 @@ describe('MetricStorageRegistry', () => { description: 'description', unit: '1', valueType: ValueType.DOUBLE, + advice: {}, }; const otherDescriptor = { @@ -236,6 +246,7 @@ describe('MetricStorageRegistry', () => { description: 'longer description', unit: '1', valueType: ValueType.DOUBLE, + advice: {}, }; const registry = new MetricStorageRegistry(); @@ -276,6 +287,7 @@ describe('MetricStorageRegistry', () => { description: 'description', unit: '1', valueType: ValueType.DOUBLE, + advice: {}, }; const storage = new TestMetricStorage(descriptor); @@ -295,6 +307,7 @@ describe('MetricStorageRegistry', () => { description: 'description', unit: '1', valueType: ValueType.DOUBLE, + advice: {}, }; const storage = new TestMetricStorage(descriptor); @@ -330,6 +343,7 @@ describe('MetricStorageRegistry', () => { description: 'description', unit: '1', valueType: ValueType.DOUBLE, + advice: {}, }; const otherDescriptor = { @@ -338,6 +352,7 @@ describe('MetricStorageRegistry', () => { description: 'description', unit: '1', valueType: ValueType.DOUBLE, + advice: {}, }; const registry = new MetricStorageRegistry(); @@ -376,6 +391,7 @@ describe('MetricStorageRegistry', () => { description: 'description', unit: '1', valueType: ValueType.DOUBLE, + advice: {}, }; const registry = new MetricStorageRegistry(); diff --git a/packages/sdk-metrics/test/state/SyncMetricStorage.test.ts b/packages/sdk-metrics/test/state/SyncMetricStorage.test.ts index 8e568be19e..e2e0378a45 100644 --- a/packages/sdk-metrics/test/state/SyncMetricStorage.test.ts +++ b/packages/sdk-metrics/test/state/SyncMetricStorage.test.ts @@ -45,7 +45,8 @@ describe('SyncMetricStorage', () => { const metricStorage = new SyncMetricStorage( defaultInstrumentDescriptor, new SumAggregator(true), - new NoopAttributesProcessor() + new NoopAttributesProcessor(), + [] ); for (const value of commonValues) { @@ -58,22 +59,19 @@ describe('SyncMetricStorage', () => { describe('collect', () => { describe('Delta Collector', () => { - const collectors = [deltaCollector]; it('should collect and reset memos', async () => { const metricStorage = new SyncMetricStorage( defaultInstrumentDescriptor, new SumAggregator(true), - new NoopAttributesProcessor() + new NoopAttributesProcessor(), + [deltaCollector] ); + metricStorage.record(1, {}, api.context.active(), [0, 0]); metricStorage.record(2, {}, api.context.active(), [1, 1]); metricStorage.record(3, {}, api.context.active(), [2, 2]); { - const metric = metricStorage.collect( - deltaCollector, - collectors, - [3, 3] - ); + const metric = metricStorage.collect(deltaCollector, [3, 3]); assertMetricData(metric, DataPointType.SUM); assert.strictEqual(metric.dataPoints.length, 1); @@ -82,23 +80,14 @@ describe('SyncMetricStorage', () => { // The attributes should not be memorized. { - const metric = metricStorage.collect( - deltaCollector, - collectors, - [4, 4] - ); + const metric = metricStorage.collect(deltaCollector, [4, 4]); - assertMetricData(metric, DataPointType.SUM); - assert.strictEqual(metric.dataPoints.length, 0); + assert.strictEqual(metric, undefined); } metricStorage.record(1, {}, api.context.active(), [5, 5]); { - const metric = metricStorage.collect( - deltaCollector, - [deltaCollector], - [6, 6] - ); + const metric = metricStorage.collect(deltaCollector, [6, 6]); assertMetricData(metric, DataPointType.SUM); assert.strictEqual(metric.dataPoints.length, 1); @@ -108,22 +97,18 @@ describe('SyncMetricStorage', () => { }); describe('Cumulative Collector', () => { - const collectors = [cumulativeCollector]; it('should collect cumulative metrics', async () => { const metricStorage = new SyncMetricStorage( defaultInstrumentDescriptor, new SumAggregator(true), - new NoopAttributesProcessor() + new NoopAttributesProcessor(), + [cumulativeCollector] ); metricStorage.record(1, {}, api.context.active(), [0, 0]); metricStorage.record(2, {}, api.context.active(), [1, 1]); metricStorage.record(3, {}, api.context.active(), [2, 2]); { - const metric = metricStorage.collect( - cumulativeCollector, - collectors, - [3, 3] - ); + const metric = metricStorage.collect(cumulativeCollector, [3, 3]); assertMetricData(metric, DataPointType.SUM); assert.strictEqual(metric.dataPoints.length, 1); @@ -132,11 +117,7 @@ describe('SyncMetricStorage', () => { // The attributes should be memorized. { - const metric = metricStorage.collect( - cumulativeCollector, - collectors, - [4, 4] - ); + const metric = metricStorage.collect(cumulativeCollector, [4, 4]); assertMetricData(metric, DataPointType.SUM); assert.strictEqual(metric.dataPoints.length, 1); @@ -145,11 +126,7 @@ describe('SyncMetricStorage', () => { metricStorage.record(1, {}, api.context.active(), [5, 5]); { - const metric = metricStorage.collect( - cumulativeCollector, - collectors, - [6, 6] - ); + const metric = metricStorage.collect(cumulativeCollector, [6, 6]); assertMetricData(metric, DataPointType.SUM); assert.strictEqual(metric.dataPoints.length, 1); diff --git a/packages/sdk-metrics/test/state/TemporalMetricProcessor.test.ts b/packages/sdk-metrics/test/state/TemporalMetricProcessor.test.ts index 8d0f165cd0..77edc36b17 100644 --- a/packages/sdk-metrics/test/state/TemporalMetricProcessor.test.ts +++ b/packages/sdk-metrics/test/state/TemporalMetricProcessor.test.ts @@ -48,20 +48,18 @@ describe('TemporalMetricProcessor', () => { describe('buildMetrics', () => { describe('single delta collector', () => { - const collectors = [deltaCollector1]; - it('should build delta recording metrics', () => { const spy = sinon.spy(deltaCollector1, 'selectAggregationTemporality'); const aggregator = new SumAggregator(true); const deltaMetricStorage = new DeltaMetricProcessor(aggregator); - const temporalMetricStorage = new TemporalMetricProcessor(aggregator); - + const temporalMetricStorage = new TemporalMetricProcessor(aggregator, [ + deltaCollector1, + ]); deltaMetricStorage.record(1, {}, api.context.active(), [1, 1]); { const metric = temporalMetricStorage.buildMetrics( deltaCollector1, - collectors, defaultInstrumentDescriptor, deltaMetricStorage.collect(), [2, 2] @@ -81,7 +79,6 @@ describe('TemporalMetricProcessor', () => { { const metric = temporalMetricStorage.buildMetrics( deltaCollector1, - collectors, defaultInstrumentDescriptor, deltaMetricStorage.collect(), [4, 4] @@ -101,19 +98,13 @@ describe('TemporalMetricProcessor', () => { { const metric = temporalMetricStorage.buildMetrics( deltaCollector1, - collectors, defaultInstrumentDescriptor, deltaMetricStorage.collect(), [5, 5] ); - assertMetricData( - metric, - DataPointType.SUM, - defaultInstrumentDescriptor, - AggregationTemporality.DELTA - ); - assert.strictEqual(metric.dataPoints.length, 0); + // nothing recorded -> nothing collected + assert.equal(metric, undefined); } // selectAggregationTemporality should be called only once. @@ -122,18 +113,18 @@ describe('TemporalMetricProcessor', () => { }); describe('two delta collector', () => { - const collectors = [deltaCollector1, deltaCollector2]; - it('should build delta recording metrics', () => { const aggregator = new SumAggregator(true); const deltaMetricStorage = new DeltaMetricProcessor(aggregator); - const temporalMetricStorage = new TemporalMetricProcessor(aggregator); + const temporalMetricStorage = new TemporalMetricProcessor(aggregator, [ + deltaCollector1, + deltaCollector2, + ]); deltaMetricStorage.record(1, {}, api.context.active(), [1, 1]); { const metric = temporalMetricStorage.buildMetrics( deltaCollector1, - collectors, defaultInstrumentDescriptor, deltaMetricStorage.collect(), [2, 2] @@ -152,7 +143,6 @@ describe('TemporalMetricProcessor', () => { { const metric = temporalMetricStorage.buildMetrics( deltaCollector2, - collectors, defaultInstrumentDescriptor, deltaMetricStorage.collect(), [3, 3] @@ -171,7 +161,6 @@ describe('TemporalMetricProcessor', () => { }); describe('single cumulative collector', () => { - const collectors = [cumulativeCollector1]; it('should build delta recording metrics', () => { const spy = sinon.spy( cumulativeCollector1, @@ -180,13 +169,14 @@ describe('TemporalMetricProcessor', () => { const aggregator = new SumAggregator(true); const deltaMetricStorage = new DeltaMetricProcessor(aggregator); - const temporalMetricStorage = new TemporalMetricProcessor(aggregator); + const temporalMetricStorage = new TemporalMetricProcessor(aggregator, [ + cumulativeCollector1, + ]); deltaMetricStorage.record(1, {}, api.context.active(), [1, 1]); { const metric = temporalMetricStorage.buildMetrics( cumulativeCollector1, - collectors, defaultInstrumentDescriptor, deltaMetricStorage.collect(), [2, 2] @@ -206,7 +196,6 @@ describe('TemporalMetricProcessor', () => { { const metric = temporalMetricStorage.buildMetrics( cumulativeCollector1, - collectors, defaultInstrumentDescriptor, deltaMetricStorage.collect(), [4, 4] @@ -228,17 +217,18 @@ describe('TemporalMetricProcessor', () => { }); describe('cumulative collector with delta collector', () => { - const collectors = [deltaCollector1, cumulativeCollector1]; it('should build delta recording metrics', () => { const aggregator = new SumAggregator(true); const deltaMetricStorage = new DeltaMetricProcessor(aggregator); - const temporalMetricStorage = new TemporalMetricProcessor(aggregator); + const temporalMetricStorage = new TemporalMetricProcessor(aggregator, [ + cumulativeCollector1, + deltaCollector1, + ]); deltaMetricStorage.record(1, {}, api.context.active(), [1, 1]); { const metric = temporalMetricStorage.buildMetrics( cumulativeCollector1, - collectors, defaultInstrumentDescriptor, deltaMetricStorage.collect(), [2, 2] @@ -258,7 +248,6 @@ describe('TemporalMetricProcessor', () => { { const metric = temporalMetricStorage.buildMetrics( deltaCollector1, - collectors, defaultInstrumentDescriptor, deltaMetricStorage.collect(), [4, 4] @@ -276,7 +265,6 @@ describe('TemporalMetricProcessor', () => { { const metric = temporalMetricStorage.buildMetrics( cumulativeCollector1, - collectors, defaultInstrumentDescriptor, deltaMetricStorage.collect(), [5, 5] diff --git a/packages/sdk-metrics/test/util.ts b/packages/sdk-metrics/test/util.ts index fa7a54b07f..75d7e66f03 100644 --- a/packages/sdk-metrics/test/util.ts +++ b/packages/sdk-metrics/test/util.ts @@ -33,6 +33,7 @@ import { DataPoint, DataPointType, ScopeMetrics, + MetricDescriptor, } from '../src/export/MetricData'; import { isNotNullish } from '../src/utils'; import { HrTime } from '@opentelemetry/api'; @@ -58,6 +59,7 @@ export const defaultInstrumentDescriptor: InstrumentDescriptor = { type: InstrumentType.COUNTER, unit: '1', valueType: ValueType.DOUBLE, + advice: {}, }; export const defaultInstrumentationScope: InstrumentationScope = { @@ -66,6 +68,17 @@ export const defaultInstrumentationScope: InstrumentationScope = { schemaUrl: 'https://opentelemetry.io/schemas/1.7.0', }; +export const invalidNames = ['', 'a'.repeat(256), '1a', '-a', '.a', '_a']; +export const validNames = [ + 'a', + 'a'.repeat(255), + 'a1', + 'a-1', + 'a.1', + 'a_1', + 'a/1', +]; + export const commonValues: number[] = [1, -1, 1.0, Infinity, -Infinity, NaN]; export const commonAttributes: MetricAttributes[] = [ {}, @@ -93,12 +106,12 @@ export function assertScopeMetrics( export function assertMetricData( actual: unknown, dataPointType?: DataPointType, - instrumentDescriptor: Partial | null = defaultInstrumentDescriptor, + metricDescriptor: Partial | null = defaultInstrumentDescriptor, aggregationTemporality?: AggregationTemporality ): asserts actual is MetricData { const it = actual as MetricData; - if (instrumentDescriptor != null) { - assertPartialDeepStrictEqual(it.descriptor, instrumentDescriptor); + if (metricDescriptor != null) { + assertPartialDeepStrictEqual(it.descriptor, metricDescriptor); } if (isNotNullish(dataPointType)) { assert.strictEqual(it.dataPointType, dataPointType); diff --git a/packages/sdk-metrics/test/view/Aggregation.test.ts b/packages/sdk-metrics/test/view/Aggregation.test.ts index e4ef18f52c..0da2c09bee 100644 --- a/packages/sdk-metrics/test/view/Aggregation.test.ts +++ b/packages/sdk-metrics/test/view/Aggregation.test.ts @@ -135,7 +135,10 @@ describe('HistogramAggregator', () => { assert(aggregator instanceof HistogramAggregator); assert.deepStrictEqual( aggregator['_boundaries'], - [0, 5, 10, 25, 50, 75, 100, 250, 500, 1000] + [ + 0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, + 10000, + ] ); }); }); diff --git a/packages/template/.eslintrc.js b/packages/template/.eslintrc.js index 9dfe62f9b8..36847df9fb 100644 --- a/packages/template/.eslintrc.js +++ b/packages/template/.eslintrc.js @@ -5,5 +5,5 @@ module.exports = { "node": true, "browser": true }, - ...require('../../eslint.config.js') + ...require('../../eslint.base.js') } diff --git a/packages/template/package.json b/packages/template/package.json index 47b183c625..a5f1e971b0 100644 --- a/packages/template/package.json +++ b/packages/template/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/template", - "version": "1.13.0", + "version": "1.17.1", "private": true, "publishConfig": { "access": "restricted" @@ -30,7 +30,7 @@ "compile": "tsc --build", "version": "node ../../scripts/version-update.js", "clean": "tsc --build --clean", - "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", + "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../scripts/peer-api-check.js" }, @@ -47,7 +47,7 @@ "Add/change these to scripts if browser is supported": { "compile": "tsc --build tsconfig.json", "clean": "tsc --build --clean tsconfig.json", - "test:browser": "nyc karma start --single-run", + "test:browser": "karma start --single-run", "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", "watch": "tsc --build --watch tsconfig.json" }, @@ -79,6 +79,8 @@ ], "devDependencies": { "@types/node": "18.6.5", + "cross-var": "1.1.0", + "lerna": "7.1.5", "typescript": "4.4.4" }, "Add these to devDependencies for testing": { @@ -87,15 +89,15 @@ "codecov": "3.8.3", "mocha": "10.0.0", "nyc": "15.1.0", - "sinon": "14.0.0", + "sinon": "15.0.0", "ts-mocha": "10.0.0" }, "Add these to devDependencies if browser is targeted": { "@types/webpack-env": "1.16.0", - "istanbul-instrumenter-loader": "3.0.1", - "karma": "5.2.3", + "babel-plugin-istanbul": "6.1.1", + "karma": "6.4.2", "karma-chrome-launcher": "3.1.0", - "karma-coverage-istanbul-reporter": "3.0.3", + "karma-coverage": "2.2.0", "karma-mocha": "2.0.1", "karma-spec-reporter": "0.0.32", "karma-webpack": "4.0.2", diff --git a/packages/template/src/version.js b/packages/template/src/version.js new file mode 100644 index 0000000000..2090d63abf --- /dev/null +++ b/packages/template/src/version.js @@ -0,0 +1,20 @@ +"use strict"; +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VERSION = void 0; +// this is autogenerated file, see scripts/version-update.js +exports.VERSION = '1.16.0'; diff --git a/renovate.json b/renovate.json index dab042a79f..c7d143d797 100644 --- a/renovate.json +++ b/renovate.json @@ -2,18 +2,26 @@ "extends": ["config:base"], "packageRules": [ { - "groupName": "all non-major dependencies", - "groupSlug": "all-minor-patch", - "matchUpdateTypes": ["patch", "minor"] + "groupName": "all patch versions", + "groupSlug": "all-patch", + "matchUpdateTypes": ["patch"], + "excludePackageNames": ["prettier"], + "schedule": ["before 3am every weekday"] }, { - "matchPaths": ["backwards-compatibility"], - "matchPackageNames": ["@types/node"], - "enabled": false + "matchUpdateTypes": ["minor"], + "dependencyDashboardApproval": true + }, + { + "matchUpdateTypes": ["major"], + "schedule": ["before 3am on Monday"] + }, + { + "matchPackageNames": ["typescript", "webpack", "webpack-cli"], + "dependencyDashboardApproval": true } ], - "ignoreDeps": ["gcp-metadata", "got", "mocha", "husky", "karma-webpack", "@opentelemetry/api"], - "assignees": ["@blumamir", "@dyladan", "@legendecas"], - "schedule": ["before 3am on Friday"], + "ignoreDeps": ["@opentelemetry/api", "@opentelemetry/resources_1.9.0", "@types/node"], + "assignees": ["@blumamir", "@dyladan", "@legendecas", "@pichlermarc"], "labels": ["dependencies"] } diff --git a/scripts/update-ts-configs.js b/scripts/update-ts-configs.js index 3c4f43273f..d437172181 100644 --- a/scripts/update-ts-configs.js +++ b/scripts/update-ts-configs.js @@ -45,7 +45,7 @@ const tsConfigMergeKeys = [ const tsConfigPriorityKeys = ['extends']; const ignoredLernaProjects = [ 'experimental/examples/*', - 'experimental/backwards-compatability/*', + 'experimental/backwards-compatibility/*', 'integration-tests/*', 'selenium-tests', 'examples/otlp-exporter-node', diff --git a/selenium-tests/babel.config.js b/selenium-tests/babel.config.js index 26b15edca0..31007c1484 100644 --- a/selenium-tests/babel.config.js +++ b/selenium-tests/babel.config.js @@ -22,12 +22,12 @@ module.exports = function (api) { ]; const plugins = [ ['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }], - ['@babel/plugin-proposal-class-properties', { 'loose': true }], - ["@babel/plugin-proposal-private-methods", { "loose": true }], - ["@babel/plugin-proposal-private-property-in-object", { "loose": true }], + ['@babel/plugin-transform-class-properties', { 'loose': true }], + ["@babel/plugin-transform-private-methods", { "loose": true }], + ["@babel/plugin-transform-private-property-in-object", { "loose": true }], ]; return { presets, plugins, }; -}; \ No newline at end of file +}; diff --git a/selenium-tests/package.json b/selenium-tests/package.json index 1bef831b3e..4ddf94829e 100644 --- a/selenium-tests/package.json +++ b/selenium-tests/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/selenium-tests", - "version": "1.13.0", + "version": "1.18.0", "private": true, "description": "OpenTelemetry Selenium Tests", "main": "index.js", @@ -31,41 +31,41 @@ "access": "restricted" }, "devDependencies": { - "@babel/core": "7.16.0", - "@babel/plugin-proposal-class-properties": "7.16.0", - "@babel/plugin-proposal-decorators": "7.16.4", - "@babel/plugin-transform-runtime": "7.16.4", - "@babel/preset-env": "7.16.4", + "@babel/core": "7.22.20", + "@babel/plugin-proposal-class-properties": "7.18.6", + "@babel/plugin-proposal-decorators": "7.22.15", + "@babel/plugin-transform-runtime": "7.22.15", + "@babel/preset-env": "7.22.20", "@opentelemetry/api": "^1.0.0", - "babel-loader": "8.2.3", + "babel-loader": "8.3.0", "babel-polyfill": "6.26.0", "browserstack-local": "1.4.8", - "chromedriver": "113.0.0", + "chromedriver": "116.0.0", "dotenv": "16.0.0", "fast-safe-stringify": "2.1.1", "geckodriver": "3.0.1", - "nightwatch": "2.0.10", + "nightwatch": "3.0.1", "selenium-server": "3.141.59", "terser-webpack-plugin": "4.2.3", "webpack": "4.46.0", - "webpack-cli": "4.9.1", + "webpack-cli": "4.10.0", "webpack-dev-server": "4.5.0", - "webpack-merge": "5.8.0" + "webpack-merge": "5.9.0" }, "peerDependencies": { "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/context-zone-peer-dep": "1.13.0", - "@opentelemetry/core": "1.13.0", - "@opentelemetry/exporter-trace-otlp-http": "0.39.1", - "@opentelemetry/exporter-zipkin": "1.13.0", - "@opentelemetry/instrumentation": "0.39.1", - "@opentelemetry/instrumentation-fetch": "0.39.1", - "@opentelemetry/instrumentation-xml-http-request": "0.39.1", - "@opentelemetry/sdk-metrics": "1.13.0", - "@opentelemetry/sdk-trace-base": "1.13.0", - "@opentelemetry/sdk-trace-web": "1.13.0", + "@opentelemetry/context-zone-peer-dep": "1.17.1", + "@opentelemetry/core": "1.17.1", + "@opentelemetry/exporter-trace-otlp-http": "0.44.0", + "@opentelemetry/exporter-zipkin": "1.17.1", + "@opentelemetry/instrumentation": "0.44.0", + "@opentelemetry/instrumentation-fetch": "0.44.0", + "@opentelemetry/instrumentation-xml-http-request": "0.44.0", + "@opentelemetry/sdk-metrics": "1.17.1", + "@opentelemetry/sdk-trace-base": "1.17.1", + "@opentelemetry/sdk-trace-web": "1.17.1", "zone.js": "0.11.4" } } diff --git a/selenium-tests/pages/fetch/index.js b/selenium-tests/pages/fetch/index.js index dbd2fe1166..4a3b7ae374 100644 --- a/selenium-tests/pages/fetch/index.js +++ b/selenium-tests/pages/fetch/index.js @@ -29,7 +29,7 @@ const getData = (url) => fetch(url, { // example of keeping track of context between async operations const prepareClickEvent = () => { - const url = 'https://httpbin.org/get'; + const url = 'https://httpstat.us/200'; const element = document.getElementById('button1'); diff --git a/selenium-tests/pages/xhr/index.js b/selenium-tests/pages/xhr/index.js index e998c58962..ba03da9c40 100644 --- a/selenium-tests/pages/xhr/index.js +++ b/selenium-tests/pages/xhr/index.js @@ -10,7 +10,7 @@ const provider = loadOtel([ new XMLHttpRequestInstrumentation({ ignoreUrls: [/localhost:8090\/sockjs-node/], propagateTraceHeaderCorsUrls: [ - 'https://httpbin.org/get', + 'https://httpstat.us/200', ], clearTimingResources: true, }), @@ -35,7 +35,7 @@ const getData = (url) => new Promise((resolve, reject) => { // example of keeping track of context between async operations const prepareClickEvent = () => { - const url = 'https://httpbin.org/get'; + const url = 'https://httpstat.us/200'; const element = document.getElementById('button1'); diff --git a/selenium-tests/tests-helpers/constants.js b/selenium-tests/tests-helpers/constants.js index 3362a3585c..2549a7fc27 100644 --- a/selenium-tests/tests-helpers/constants.js +++ b/selenium-tests/tests-helpers/constants.js @@ -2,4 +2,4 @@ const TIMEOUT_ELEMENT_MS = 5000; module.exports = { TIMEOUT_ELEMENT_MS, -}; \ No newline at end of file +}; diff --git a/selenium-tests/webpack.common.js b/selenium-tests/webpack.common.js index 0d00b07c60..3306d91b0d 100644 --- a/selenium-tests/webpack.common.js +++ b/selenium-tests/webpack.common.js @@ -11,7 +11,7 @@ module.exports = { filename: '[name].js', sourceMapFilename: '[file].map', }, - target: ['web', 'es5'], + target: 'web', module: { rules: [ { @@ -35,4 +35,4 @@ module.exports = { ], extensions: ['.ts', '.js', '.jsx', '.json'], }, -}; \ No newline at end of file +}; diff --git a/tsconfig.esm.json b/tsconfig.esm.json index 2fec210b9a..29491b46ef 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -29,6 +29,9 @@ { "path": "experimental/packages/opentelemetry-exporter-metrics-otlp-http/tsconfig.esm.json" }, + { + "path": "experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.esm.json" + }, { "path": "experimental/packages/opentelemetry-instrumentation/tsconfig.esm.json" }, diff --git a/tsconfig.esnext.json b/tsconfig.esnext.json index c5970c9c5c..031a2e5609 100644 --- a/tsconfig.esnext.json +++ b/tsconfig.esnext.json @@ -29,6 +29,9 @@ { "path": "experimental/packages/opentelemetry-exporter-metrics-otlp-http/tsconfig.esnext.json" }, + { + "path": "experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.esnext.json" + }, { "path": "experimental/packages/opentelemetry-instrumentation/tsconfig.esnext.json" }, diff --git a/tsconfig.tsbuildinfo b/tsconfig.tsbuildinfo new file mode 100644 index 0000000000..bd9c8b8eab --- /dev/null +++ b/tsconfig.tsbuildinfo @@ -0,0 +1 @@ +{"version":"4.4.4"} \ No newline at end of file