Skip to content

Commit 7006fbd

Browse files
authored
Merge branch 'main' into span-add-links-after-creation
2 parents a3758aa + 9400e72 commit 7006fbd

File tree

55 files changed

+21904
-26772
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+21904
-26772
lines changed

.github/workflows/unit-test.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
- "16"
1717
- "18"
1818
- "20"
19+
- "22"
1920
runs-on: ubuntu-latest
2021
env:
2122
NPM_CONFIG_UNSAFE_PERM: true
@@ -31,7 +32,7 @@ jobs:
3132
node-version: ${{ matrix.node_version }}
3233

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

3637
# [email protected] drops support for Node.js v14 and v16
3738
- run: npm install -g npm@"<10.0.0"
@@ -46,7 +47,7 @@ jobs:
4647
- name: Unit tests
4748
run: |
4849
# TODO(legendecas): webpack https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported
49-
if [ "${{ matrix.node_version }}" = "18" ] || [ "${{ matrix.node_version }}" == "20" ]; then
50+
if [ "${{ matrix.node_version }}" = "18" ] || [ "${{ matrix.node_version }}" == "20" ] || [ "${{ matrix.node_version }}" == "22" ]; then
5051
export NODE_OPTIONS=--openssl-legacy-provider
5152
fi
5253
npm run test

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/
1111

1212
### :rocket: (Enhancement)
1313

14+
* feat(instrumentation): generic config type in instrumentation base [#4659](https://github.com/open-telemetry/opentelemetry-js/pull/4659) @blumamir
15+
* feat: support node 22 [#4666](https://github.com/open-telemetry/opentelemetry-js/pull/4666) @dyladan
16+
1417
### :bug: (Bug Fix)
1518

1619
* fix(core): align inconsistent behavior of `getEnv()` and `getEnvWithoutDefaults()` when a `process` polyfill is used [#4648](https://github.com/open-telemetry/opentelemetry-js/pull/4648) @pichlermarc
@@ -34,6 +37,8 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/
3437

3538
* fix(sdk-trace-web): fix invalid timings in span events [#4486](https://github.com/open-telemetry/opentelemetry-js/pull/4486) @Abinet18
3639
* fix(resources): ensure BrowserDetector does not think Node.js v21 is a browser [#4561](https://github.com/open-telemetry/opentelemetry-js/issues/4561) @trentm
40+
* fix(core): align inconsistent behavior of `getEnv()` and `getEnvWithoutDefaults()` when a `process` polyfill is used [#4648](https://github.com/open-telemetry/opentelemetry-js/pull/4648) @pichlermarc
41+
* `getEnvWithoutDefaults()` would use `process.env` if it was defined when running in a browser, while `getEnv()` would always use `_globalThis`. Now both use `_globalThis` when running in a browser.
3742

3843
## 1.23.0
3944

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ If you are a library author looking to build OpenTelemetry into your library, pl
111111

112112
| Platform Version | Supported |
113113
|---------------------|-----------------------------------------------|
114+
| Node.JS `v22` | :heavy_check_mark: |
114115
| Node.JS `v20` | :heavy_check_mark: |
115116
| Node.JS `v18` | :heavy_check_mark: |
116117
| Node.JS `v16` | :heavy_check_mark: |

api/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
1010

1111
* feat(api): allow adding span links after span creation [#4536](https://github.com/open-telemetry/opentelemetry-js/pull/4536) @seemk
1212
* This change is non-breaking for end-users, but breaking for Trace SDK implmentations in accordance with the [specification](https://github.com/open-telemetry/opentelemetry-specification/blob/a03382ada8afa9415266a84dafac0510ec8c160f/specification/upgrading.md?plain=1#L97-L122) as new features need to be implemented.
13+
* feat: support node 22 [#4666](https://github.com/open-telemetry/opentelemetry-js/pull/4666) @dyladan
1314

1415
### :bug: (Bug Fix)
1516

api/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"karma-mocha": "2.0.1",
9696
"karma-mocha-webworker": "1.3.0",
9797
"karma-spec-reporter": "0.0.36",
98-
"karma-webpack": "4.0.2",
98+
"karma-webpack": "5.0.1",
9999
"lerna": "6.6.2",
100100
"memfs": "3.5.3",
101101
"mocha": "10.2.0",

api/test/common/internal/version.test.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,18 @@
1717
import * as assert from 'assert';
1818
import { VERSION } from '../../../src/version';
1919

20-
describe('version', () => {
21-
it('should have generated VERSION.ts', () => {
20+
describe('version', function () {
21+
it('should have generated VERSION.ts', function () {
22+
// Skip in case we're not running in Node.js
23+
if (global.process?.versions?.node === undefined) {
24+
this.skip();
25+
}
26+
2227
const pjson = require('../../../package.json');
2328
assert.strictEqual(pjson.version, VERSION);
2429
});
2530

26-
it('prerelease tag versions are banned', () => {
31+
it('prerelease tag versions are banned', function () {
2732
// see https://github.com/open-telemetry/opentelemetry-js-api/issues/74
2833
assert.ok(VERSION.match(/^\d+\.\d+\.\d+$/));
2934
});

experimental/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ All notable changes to experimental packages in this project will be documented
1414

1515
### :rocket: (Enhancement)
1616

17+
* feat: support node 22 [#4666](https://github.com/open-telemetry/opentelemetry-js/pull/4666) @dyladan
18+
1719
### :bug: (Bug Fix)
1820

1921
### :books: (Refine Doc)

experimental/packages/api-events/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"karma-coverage": "2.2.1",
7777
"karma-mocha": "2.0.1",
7878
"karma-spec-reporter": "0.0.36",
79-
"karma-webpack": "4.0.2",
79+
"karma-webpack": "5.0.1",
8080
"lerna": "6.6.2",
8181
"mocha": "10.2.0",
8282
"nyc": "15.1.0",

experimental/packages/api-logs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"karma-coverage": "2.2.1",
7676
"karma-mocha": "2.0.1",
7777
"karma-spec-reporter": "0.0.36",
78-
"karma-webpack": "4.0.2",
78+
"karma-webpack": "5.0.1",
7979
"lerna": "6.6.2",
8080
"mocha": "10.2.0",
8181
"nyc": "15.1.0",

experimental/packages/exporter-logs-otlp-http/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"karma-coverage": "2.2.1",
9090
"karma-mocha": "2.0.1",
9191
"karma-spec-reporter": "0.0.36",
92-
"karma-webpack": "4.0.2",
92+
"karma-webpack": "5.0.1",
9393
"lerna": "6.6.2",
9494
"mocha": "10.2.0",
9595
"nyc": "15.1.0",

experimental/packages/exporter-logs-otlp-http/test/browser/OTLPLogExporter.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('OTLPLogExporter', () => {
3232
sinon.restore();
3333
});
3434

35-
if (typeof process === 'undefined') {
35+
if (global.process?.versions?.node === undefined) {
3636
envSource = globalThis as unknown as Record<string, any>;
3737
} else {
3838
envSource = process.env as Record<string, any>;

experimental/packages/exporter-logs-otlp-http/test/config.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { getDefaultUrl } from '../src/platform/config';
2121
describe('getDefaultUrl', () => {
2222
let envSource: Record<string, any>;
2323

24-
if (typeof process === 'undefined') {
24+
if (global.process?.versions?.node === undefined) {
2525
envSource = globalThis as unknown as Record<string, any>;
2626
} else {
2727
envSource = process.env as Record<string, any>;

experimental/packages/exporter-logs-otlp-http/test/node/OTLPLogExporter.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe('OTLPLogExporter', () => {
6868
sinon.restore();
6969
});
7070

71-
if (typeof process === 'undefined') {
71+
if (global.process?.versions?.node === undefined) {
7272
envSource = globalThis as unknown as Record<string, any>;
7373
} else {
7474
envSource = process.env as Record<string, any>;

experimental/packages/exporter-logs-otlp-proto/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"karma-coverage": "2.2.1",
7979
"karma-mocha": "2.0.1",
8080
"karma-spec-reporter": "0.0.36",
81-
"karma-webpack": "4.0.2",
81+
"karma-webpack": "5.0.1",
8282
"lerna": "6.6.2",
8383
"mocha": "10.2.0",
8484
"nyc": "15.1.0",

experimental/packages/exporter-trace-otlp-http/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"karma-coverage": "2.2.1",
8181
"karma-mocha": "2.0.1",
8282
"karma-spec-reporter": "0.0.36",
83-
"karma-webpack": "4.0.2",
83+
"karma-webpack": "5.0.1",
8484
"lerna": "6.6.2",
8585
"mocha": "10.2.0",
8686
"nyc": "15.1.0",

experimental/packages/exporter-trace-otlp-proto/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"karma-coverage": "2.2.1",
7878
"karma-mocha": "2.0.1",
7979
"karma-spec-reporter": "0.0.36",
80-
"karma-webpack": "4.0.2",
80+
"karma-webpack": "5.0.1",
8181
"lerna": "6.6.2",
8282
"mocha": "10.2.0",
8383
"nyc": "15.1.0",

experimental/packages/opentelemetry-browser-detector/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"karma-coverage": "2.2.1",
6868
"karma-mocha": "2.0.1",
6969
"karma-spec-reporter": "0.0.36",
70-
"karma-webpack": "4.0.2",
70+
"karma-webpack": "5.0.1",
7171
"lerna": "6.6.2",
7272
"mocha": "10.2.0",
7373
"nyc": "15.1.0",

experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"karma-coverage": "2.2.1",
8181
"karma-mocha": "2.0.1",
8282
"karma-spec-reporter": "0.0.36",
83-
"karma-webpack": "4.0.2",
83+
"karma-webpack": "5.0.1",
8484
"lerna": "6.6.2",
8585
"mocha": "10.2.0",
8686
"nyc": "15.1.0",

experimental/packages/opentelemetry-instrumentation-fetch/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"karma-coverage": "2.2.1",
7474
"karma-mocha": "2.0.1",
7575
"karma-spec-reporter": "0.0.36",
76-
"karma-webpack": "4.0.2",
76+
"karma-webpack": "5.0.1",
7777
"lerna": "6.6.2",
7878
"mocha": "10.2.0",
7979
"nyc": "15.1.0",

experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts

+7-11
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export interface FetchInstrumentationConfig extends InstrumentationConfig {
7272
/**
7373
* This class represents a fetch plugin for auto instrumentation
7474
*/
75-
export class FetchInstrumentation extends InstrumentationBase {
75+
export class FetchInstrumentation extends InstrumentationBase<FetchInstrumentationConfig> {
7676
readonly component: string = 'fetch';
7777
readonly version: string = VERSION;
7878
moduleName = this.component;
@@ -85,10 +85,6 @@ export class FetchInstrumentation extends InstrumentationBase {
8585

8686
init(): void {}
8787

88-
private _getConfig(): FetchInstrumentationConfig {
89-
return this._config;
90-
}
91-
9288
/**
9389
* Add cors pre flight child span
9490
* @param span
@@ -105,7 +101,7 @@ export class FetchInstrumentation extends InstrumentationBase {
105101
},
106102
api.trace.setSpan(api.context.active(), span)
107103
);
108-
if (!this._getConfig().ignoreNetworkEvents) {
104+
if (!this.getConfig().ignoreNetworkEvents) {
109105
web.addSpanNetworkEvents(childSpan, corsPreFlightRequest);
110106
}
111107
childSpan.end(
@@ -149,7 +145,7 @@ export class FetchInstrumentation extends InstrumentationBase {
149145
if (
150146
!web.shouldPropagateTraceHeaders(
151147
spanUrl,
152-
this._getConfig().propagateTraceHeaderCorsUrls
148+
this.getConfig().propagateTraceHeaderCorsUrls
153149
)
154150
) {
155151
const headers: Partial<Record<string, unknown>> = {};
@@ -186,7 +182,7 @@ export class FetchInstrumentation extends InstrumentationBase {
186182
* @private
187183
*/
188184
private _clearResources() {
189-
if (this._tasksCount === 0 && this._getConfig().clearTimingResources) {
185+
if (this._tasksCount === 0 && this.getConfig().clearTimingResources) {
190186
performance.clearResourceTimings();
191187
this._usedResources = new WeakSet<PerformanceResourceTiming>();
192188
}
@@ -201,7 +197,7 @@ export class FetchInstrumentation extends InstrumentationBase {
201197
url: string,
202198
options: Partial<Request | RequestInit> = {}
203199
): api.Span | undefined {
204-
if (core.isUrlIgnored(url, this._getConfig().ignoreUrls)) {
200+
if (core.isUrlIgnored(url, this.getConfig().ignoreUrls)) {
205201
this._diag.debug('ignoring span as url matches ignored url');
206202
return;
207203
}
@@ -258,7 +254,7 @@ export class FetchInstrumentation extends InstrumentationBase {
258254
this._addChildSpan(span, corsPreFlightRequest);
259255
this._markResourceAsUsed(corsPreFlightRequest);
260256
}
261-
if (!this._getConfig().ignoreNetworkEvents) {
257+
if (!this.getConfig().ignoreNetworkEvents) {
262258
web.addSpanNetworkEvents(span, mainRequest);
263259
}
264260
}
@@ -419,7 +415,7 @@ export class FetchInstrumentation extends InstrumentationBase {
419415
result: Response | FetchError
420416
) {
421417
const applyCustomAttributesOnSpan =
422-
this._getConfig().applyCustomAttributesOnSpan;
418+
this.getConfig().applyCustomAttributesOnSpan;
423419
if (applyCustomAttributesOnSpan) {
424420
safeExecuteInTheMiddle(
425421
() => applyCustomAttributesOnSpan(span, request, result),

experimental/packages/opentelemetry-instrumentation-grpc/src/instrumentation.ts

+2-11
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ import {
8888
import { AttributeValues } from './enums/AttributeValues';
8989
import { VERSION } from './version';
9090

91-
export class GrpcInstrumentation extends InstrumentationBase {
91+
export class GrpcInstrumentation extends InstrumentationBase<GrpcInstrumentationConfig> {
9292
private _metadataCapture: metadataCaptureType;
9393

9494
constructor(config?: GrpcInstrumentationConfig) {
@@ -195,16 +195,7 @@ export class GrpcInstrumentation extends InstrumentationBase {
195195
];
196196
}
197197

198-
/**
199-
* @internal
200-
* Public reference to the protected BaseInstrumentation `_config` instance to be used by this
201-
* plugin's external helper functions
202-
*/
203-
override getConfig(): GrpcInstrumentationConfig {
204-
return super.getConfig();
205-
}
206-
207-
override setConfig(config?: GrpcInstrumentationConfig): void {
198+
override setConfig(config: GrpcInstrumentationConfig = {}): void {
208199
super.setConfig(config);
209200
this._metadataCapture = this._createMetadataCapture();
210201
}

experimental/packages/opentelemetry-instrumentation-http/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"request": "2.88.2",
6767
"request-promise-native": "1.0.9",
6868
"sinon": "15.1.2",
69-
"superagent": "8.0.9",
69+
"superagent": "9.0.1",
7070
"ts-mocha": "10.0.0",
7171
"typescript": "4.4.4"
7272
},

0 commit comments

Comments
 (0)