Skip to content

Commit

Permalink
Merge branch 'main' into fix/http-dynamic-import-workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
pichlermarc authored Jan 15, 2025
2 parents 0199730 + fc0edd8 commit 09b78c1
Show file tree
Hide file tree
Showing 296 changed files with 18,089 additions and 16,159 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
node_version:
- "18"
- "22"
runs-on: self-hosted
timeout-minutes: 10
env:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This action requires that any PR targeting the main branch should touch at
# This action requires that any PR targeting the main and next branch should touch at
# least one CHANGELOG file. If a CHANGELOG entry is not required, add the "Skip
# Changelog" label to disable this action.

Expand All @@ -9,6 +9,7 @@ on:
types: [opened, synchronize, reopened, labeled, unlabeled]
branches:
- main
- next
jobs:
changelog:
runs-on: ubuntu-latest
Expand Down
48 changes: 5 additions & 43 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ jobs:
fail-fast: false
matrix:
node_version:
- "14"
- "16"
- "18"
- "20"
- "22"
Expand All @@ -32,11 +30,11 @@ jobs:
node-version: ${{ matrix.node_version }}

- run: npm install -g npm@latest
if: ${{ matrix.node_version == '18' || matrix.node_version == '20' || matrix.node_version == '22' }}
if: ${{ matrix.node_version == '20' || matrix.node_version == '22' }}

# 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' }}
# npm@11.0.0 drops support for Node.js v18
- run: npm install -g npm@"<11.0.0"
if: ${{ matrix.node_version == '18'}}

- name: Bootstrap
run: npm ci
Expand Down Expand Up @@ -65,7 +63,7 @@ jobs:
cache: 'npm'
cache-dependency-path: |
package-lock.json
node-version: '18'
node-version: '20'

- run: npm install -g npm@latest

Expand Down Expand Up @@ -136,39 +134,3 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
verbose: true
api-eol-node-test:
strategy:
fail-fast: false
matrix:
node_version:
- "8"
- "10"
- "12"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
cache: 'npm'
cache-dependency-path: |
package-lock.json
node-version: ${{ matrix.node_version }}

- name: Build
working-directory: ./api
run: |
npm install --ignore-scripts
npm install @types/mocha@^7 mocha@^7 ts-loader@^8
node ../scripts/version-update.js
npx tsc --build tsconfig.json tsconfig.esm.json
- name: Test
working-directory: ./api
# 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
2 changes: 1 addition & 1 deletion .github/workflows/w3c-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
cache: 'npm'
cache-dependency-path: |
package-lock.json
node-version: '16'
node-version: 18

- name: Install and Bootstrap 🔧
run: npm ci
Expand Down
59 changes: 56 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,72 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se

### :boom: Breaking Change

* feat(sdk-metrics)!: drop deprecated `type` field on `MetricDescriptor` [#5291](https://github.com/open-telemetry/opentelemetry-js/pull/5291) @chancancode
* feat(sdk-metrics)!: drop deprecated `InstrumentDescriptor` type; use `MetricDescriptor` instead [#5277](https://github.com/open-telemetry/opentelemetry-js/pull/5266) @chancancode
* feat(sdk-metrics)!: bump minimum version of `@opentelemetry/api` peer dependency to 1.9.0 [#5254](https://github.com/open-telemetry/opentelemetry-js/pull/5254) @chancancode
* chore(shim-opentracing): replace deprecated SpanAttributes [#4430](https://github.com/open-telemetry/opentelemetry-js/pull/4430) @JamieDanielson
* chore(otel-core): replace deprecated SpanAttributes [#4408](https://github.com/open-telemetry/opentelemetry-js/pull/4408) @JamieDanielson
* feat(sdk-metrics)!: remove MeterProvider.addMetricReader() in favor of constructor option [#4419](https://github.com/open-telemetry/opentelemetry-js/pull/4419) @pichlermarc
* chore(otel-resources): replace deprecated SpanAttributes [#4428](https://github.com/open-telemetry/opentelemetry-js/pull/4428) @JamieDanielson
* feat(sdk-metrics)!: remove MeterProvider.addMetricReader() in favor of constructor option [#4419](https://github.com/open-telemetry/opentelemetry-js/pull/4419) @pichlermarc
* feat(sdk-metrics)!: replace attributeKeys with custom processors option [#4532](https://github.com/open-telemetry/opentelemetry-js/pull/4532) @pichlermarc
* refactor(sdk-trace-base)!: replace `SpanAttributes` with `Attributes` [#5009](https://github.com/open-telemetry/opentelemetry-js/pull/5009) @david-luna
* refactor(resources)!: replace `ResourceAttributes` with `Attributes` [#5016](https://github.com/open-telemetry/opentelemetry-js/pull/5016) @david-luna
* feat(sdk-metrics)!: drop `View` and `Aggregation` in favor of `ViewOptions` and `AggregationOption` [#4931](https://github.com/open-telemetry/opentelemetry-js/pull/4931) @pichlermarc
* refactor(sdk-trace-base)!: remove `new Span` constructor in favor of `Tracer.startSpan` API [#5048](https://github.com/open-telemetry/opentelemetry-js/pull/5048) @david-luna
* refactor(sdk-trace-base)!: remove `BasicTracerProvider.addSpanProcessor` API in favor of constructor options. [#5134](https://github.com/open-telemetry/opentelemetry-js/pull/5134) @david-luna
* refactor(sdk-trace-base)!: make `resource` property private in `BasicTracerProvider` and remove `getActiveSpanProcessor` API. [#5192](https://github.com/open-telemetry/opentelemetry-js/pull/5192) @david-luna
* feat(core)!: remove deprecated `IdGenerator` and `RandomIdGenerator` [#5309](https://github.com/open-telemetry/opentelemetry-js/pull/5309) @pichlermarc
* feat(core)!: remove deprecated type `InstrumentationLibrary` [#5308](https://github.com/open-telemetry/opentelemetry-js/pull/5308) @pichlermarc
* (user-facing): please use equivalent type `InstrumentationScope` instead
* feat(sdk-trace-base)!: replace usages fo `InstrumentationLibrary` with `InstrumentationScope` [#5308](https://github.com/open-telemetry/opentelemetry-js/pull/5308) @pichlermarc
* (user-facing) rename `Tracer.instrumentationLibrary` -> `Tracer.instrumentationScope`
* (user-facing) rename `ReadableSpan.instrumentationLibrary` -> `ReadableSpan.instrumentationScope`
* also renames the property in implementations of `ReadableSpan`
* feat(exporter-jaeger): use `ReadableSpan.instrumentationScope` over `ReadableSpan.instrumentationLibrary` [#5308](https://github.com/open-telemetry/opentelemetry-js/pull/5308) @pichlermarc
* feat(exporter-zipkin): use `ReadableSpan.instrumentationScope` over `ReadableSpan.instrumentationLibrary` [#5308](https://github.com/open-telemetry/opentelemetry-js/pull/5308) @pichlermarc
* chore!: update typescript to version `5.0.4` [#5145](https://github.com/open-telemetry/opentelemetry-js/pull/5145) @david-luna
* (user-facing) dropped support for `typescript@<5.0.4`
* (user-facing) all packages published from this repository will from now on drop support for old versions of `typescript` in minor releases. We will only drop support for versions that are older than 2 years.
* feat(core)!: remove deprecated samplers [#5316](https://github.com/open-telemetry/opentelemetry-js/pull/5316) @pichlermarc
* (user-facing): deprecated `AlwaysOnSampler` has moved to `@opentelemetry/sdk-trace-base`
* (user-facing): deprecated `AlwaysOffSampler` has moved to `@opentelemetry/sdk-trace-base`
* (user-facing): deprecated `TraceIdRatioSampler` has moved to `@opentelemetry/sdk-trace-base`
* (user-facing): deprecated `TraceIdRatioSampler` has moved to `@opentelemetry/sdk-trace-base`

### :rocket: (Enhancement)

### :bug: (Bug Fix)

* fix(sdk-trace-base): do not load OTEL_ env vars on module load, but when needed [#5224](https://github.com/open-telemetry/opentelemetry-js/pull/5224)
* fix(sdk-metrics): do not export from `PeriodicExportingMetricReader` when there are no metrics to export. [#5288](https://github.com/open-telemetry/opentelemetry-js/pull/5288) @jacksonweber

### :books: (Refine Doc)

### :house: (Internal)

* refactor(sdk-metrics): the internal `InstrumentDescriptor` type now extends `MetricDescriptor`; moved public `InstrumentType` type enum into `./src/export/MetricData.ts` [#5277](https://github.com/open-telemetry/opentelemetry-js/pull/5266)
* refactor(sdk-metrics): remove `Gauge` and `MetricAdvice` workaround types in favor of the upstream `@opentelemetry/api` types [#5254](https://github.com/open-telemetry/opentelemetry-js/pull/5254) @chancancode
* chore: remove checks for unsupported node versions [#4341](https://github.com/open-telemetry/opentelemetry-js/pull/4341) @dyladan
* refactor(sdk-trace-base): remove `BasicTracerProvider._registeredSpanProcessors` private property. [#5134](https://github.com/open-telemetry/opentelemetry-js/pull/5134) @david-luna
* refactor(sdk-trace-base): rename `BasicTracerProvider.activeSpanProcessor` private property. [#5211](https://github.com/open-telemetry/opentelemetry-js/pull/5211) @david-luna
* chore(selenium-tests): remove internal selenium-tests/ package, it wasn't being used @trentm

## 1.30.0

### :rocket: (Enhancement)

* feat(sdk-metrics): PeriodicExportingMetricReader now flushes pending tasks at shutdown [#5242](https://github.com/open-telemetry/opentelemetry-js/pull/5242)

### :bug: (Bug Fix)

* fix(sdk-trace-base): do not load OTEL_ env vars on module load, but when needed [#5233](https://github.com/open-telemetry/opentelemetry-js/pull/5233)
* fix(instrumentation-xhr, instrumentation-fetch): content length attributes no longer get removed with `ignoreNetworkEvents: true` being set [#5229](https://github.com/open-telemetry/opentelemetry-js/issues/5229)

## 1.29.0

### :boom: Breaking Change
### :rocket: (Enhancement)

* feat(sdk-metrics): Add support for aggregation cardinality limit with a default limit of 2000. This limit can be customized via views [#5182](https://github.com/open-telemetry/opentelemetry-js/pull/5128)
* feat(sdk-metrics): Add support for aggregation cardinality limit with a default limit of 2000. This limit can be customized via views [#5128](https://github.com/open-telemetry/opentelemetry-js/pull/5128)

## 1.28.0

Expand Down Expand Up @@ -60,6 +111,8 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se
* `@opentelemetry/propagator-aws-xray` is now located in [open-telemetry/opentelemetry-js-contrib](https://github.com/open-telemetry/opentelemetry-js-contrib)
* `@opentelemetry/propagator-aws-xray-lambda` is now located in [open-telemetry/opentelemetry-js-contrib](https://github.com/open-telemetry/opentelemetry-js-contrib)

* docs: [Browser] Define the supported browser runtimes [Issue #4168](https://github.com/open-telemetry/opentelemetry-js/issues/4168) PR:[#5059](https://github.com/open-telemetry/opentelemetry-js/pull/5059) @MSNev

### :house: (Internal)

* deps: set `@opentelemetry/api` dependency min version to 1.3.0 in `examples`, `experimental/packages`, `integration-tests` and `selenium-tests`
Expand Down
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,15 @@ cd packages/opentelemetry-module-name
npm run watch
```

#### TypeScript version & update policy

TypeScript version used to compile the pacakges is `v5.0.4`. If you plan to use any of the packages from this
repository to make your own application or package instrumentation make sure to use same version or higher.

<!-- Ref: https://github.com/open-telemetry/opentelemetry-js/pull/5145#issuecomment-2518263890 -->
As update policy OpenTelemetry JS will follow DefinitelyType's [support policy for TypeScript](https://github.com/DefinitelyTyped/DefinitelyTyped#support-window)
which sets a support window of 2 years.

### Running tests

Similar to compilations, tests can be run from the root to run all tests or from a single module to run only the tests for that module.
Expand Down
48 changes: 36 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@

---

> [!WARNING]
> This is the working branch for the work in progress 2.0 SDK, see [this tracking issue](https://github.com/open-telemetry/opentelemetry-js/issues/5148) for details.
> If you are a user looking for the current released state, you are probably looking for the [1.x SDK](https://github.com/open-telemetry/opentelemetry-js/tree/v1.x) on the v1.x branch.
## About this project

This is the JavaScript version of [OpenTelemetry](https://opentelemetry.io/), a framework for collecting traces, metrics, and logs from applications.
Expand Down Expand Up @@ -117,26 +121,38 @@ If you are a library author looking to build OpenTelemetry into your library, pl
| Node.JS `v22` | :heavy_check_mark: |
| Node.JS `v20` | :heavy_check_mark: |
| 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.
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

> [!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.
Rather than define versions of specific browsers / runtimes, OpenTelemetry sets the minimum supported version based on the
underlying language features used.

The current minumum language feature support is set as [ECMAScript 2020](https://262.ecma-international.org/11.0/) that are available
in all modern browsers / runtimes.

This means that if you are targeting or your end-users are using a browser / runtime that does not support ES2020, you will need
to transpile the code and provide any necessary polyfills for the missing features to ensure compatibility with your target
environments. Any support issues that arise from using a browser or runtime that does not support ES2020 will be closed as "won't fix".

This minimum support level is subject to change as the project evolves and as the underlying language features evolve.

## TypeScript Support

OpenTelemetry JavaScript is built with TypeScript `v5.0.4`. If you have a TypeScript project (app, library, instrumentation, etc.)
that depends on it we recomed using same or higher version to compile the project.

OpenTelemetry JavaScript will follows DefinitelyType's [support policy for TypeScript](https://github.com/DefinitelyTyped/DefinitelyTyped#support-window) which sets a support window of 2 years. Support for TypeScript versions older than 2 years will be dropped in minor releases of OpenTelemetry JavaScript.

## Package Version Compatibility

Expand All @@ -147,18 +163,26 @@ All stable packages are released with the same version, and all experimental pac
The below table describes which versions of each set of packages are expected to work together.

| Stable Packages | Experimental Packages |
| --------------- | --------------------- |
| 1.21.x | 0.48.x |
| 1.20.x | 0.47.x |
| 1.19.x | 0.46.x |
| 1.18.x | 0.45.x |
| 1.17.x | 0.44.x |
|-----------------|-----------------------|
| 1.30.x | 0.57.x |
| 1.29.x | 0.56.x |
| 1.28.x | 0.55.x |
| 1.27.x | 0.54.x |
| 1.25.x | 0.52.x |

<details>
<summary>Older version compatibility matrix</summary>

<table>
<tr><th>Stable Packages</th> <th>Experimental Packages</th></tr>
<tr><td>1.24.x</td> <td>0.51.x</td></tr>
<tr><td>1.23.x</td> <td>0.50.x</td></tr>
<tr><td>1.22.x</td> <td>0.49.x</td></tr>
<tr><td>1.21.x</td> <td>0.48.x</td></tr>
<tr><td>1.20.x</td> <td>0.47.x</td></tr>
<tr><td>1.19.x</td> <td>0.46.x</td></tr>
<tr><td>1.18.x</td> <td>0.45.x</td></tr>
<tr><td>1.17.x</td> <td>0.43.x, 0.44.x</td></tr>
<tr><td>1.16.x</td> <td>0.42.x</td></tr>
<tr><td>1.15.x</td> <td>0.41.x</td></tr>
<tr><td>1.14.x</td> <td>0.40.x</td></tr>
Expand Down
7 changes: 3 additions & 4 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"lint": "eslint . --ext .ts",
"test:browser": "karma start --single-run",
"test": "nyc mocha 'test/**/*.test.ts'",
"test:eol": "mocha '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",
Expand Down Expand Up @@ -95,10 +94,10 @@
"lerna": "6.6.2",
"memfs": "3.5.3",
"mocha": "10.8.2",
"nyc": "15.1.0",
"nyc": "17.1.0",
"sinon": "15.1.2",
"ts-loader": "9.5.1",
"typescript": "4.4.4",
"ts-loader": "9.5.2",
"typescript": "5.0.4",
"unionfs": "4.5.4",
"webpack": "5.96.1"
},
Expand Down
2 changes: 1 addition & 1 deletion api/test/common/diag/logLevel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('LogLevelFilter DiagLogger', () => {

const levelMap: Array<{
message: string;
level: DiagLogLevel;
level: number;
ignoreFuncs: Array<keyof DiagLogger>;
}> = [
{ message: 'ALL', level: DiagLogLevel.ALL, ignoreFuncs: [] },
Expand Down
2 changes: 1 addition & 1 deletion api/test/common/diag/logger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import * as assert from 'assert';
import sinon = require('sinon');
import * as sinon from 'sinon';
import { diag, DiagLogLevel } from '../../../src';
import { createNoopDiagLogger } from '../../../src/diag/internal/noopLogger';
import { DiagLogger } from '../../../src/diag/types';
Expand Down
2 changes: 1 addition & 1 deletion api/test/common/internal/global.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/

import * as assert from 'assert';
import * as sinon from 'sinon';
import { getGlobal } from '../../../src/internal/global-utils';
import { _globalThis } from '../../../src/platform';
import { NoopContextManager } from '../../../src/context/NoopContextManager';
import { DiagLogLevel } from '../../../src/diag/types';
import sinon = require('sinon');

const api1 = require('../../../src') as typeof import('../../../src');

Expand Down
Loading

0 comments on commit 09b78c1

Please sign in to comment.