Skip to content

Commit ce7c5a3

Browse files
authored
Merge branch 'main' into feat/add-transformer-entrypoints
2 parents f6492d1 + 9f5ae79 commit ce7c5a3

File tree

198 files changed

+9157
-5203
lines changed

Some content is hidden

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

198 files changed

+9157
-5203
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ body:
6868
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
6969
const { ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-base');
7070
const { resourceFromAttributes } = require('@opentelemetry/resources');
71-
const { SEMRESATTRS_SERVICE_NAME } = require('@opentelemetry/semantic-conventions');
71+
const { ATTR_SERVICE_NAME } = require('@opentelemetry/semantic-conventions');
7272
7373
// configure the SDK to export telemetry data to the console
7474
// enable all auto-instrumentations from the meta package
7575
const traceExporter = new ConsoleSpanExporter();
7676
const sdk = new opentelemetry.NodeSDK({
7777
resource: resourceFromAttributes({
78-
[SEMRESATTRS_SERVICE_NAME]: 'my-service',
78+
[ATTR_SERVICE_NAME]: 'my-service',
7979
}),
8080
traceExporter,
8181
instrumentations: [getNodeAutoInstrumentations()]

.github/workflows/docs.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
name: Deploy API Documentation
22

3-
# Disable API doc updates from "main" while "main" is frozen for https://github.com/open-telemetry/opentelemetry-js/milestone/17
4-
# TODO: renable this once ready for releases from "main" again.
5-
# on:
6-
# release:
7-
# types: [published]
8-
on: []
3+
on:
4+
release:
5+
types: [published]
96

107
jobs:
118
build-and-deploy:
@@ -19,7 +16,7 @@ jobs:
1916
cache: 'npm'
2017
cache-dependency-path: |
2118
package-lock.json
22-
node-version: '20'
19+
node-version: '22'
2320

2421
- name: Install and Build 🔧
2522
run: |

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
cache: 'npm'
2020
cache-dependency-path: |
2121
package-lock.json
22-
node-version: '20'
22+
node-version: '22'
2323

2424
- name: Bootstrap
2525
run: npm ci
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: OSSF Scorecard
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
schedule:
8+
- cron: "44 18 * * 6" # once a week
9+
workflow_dispatch:
10+
11+
permissions: read-all
12+
13+
jobs:
14+
analysis:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
# Needed for Code scanning upload
18+
security-events: write
19+
# Needed for GitHub OIDC token if publish_results is true
20+
id-token: write
21+
steps:
22+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
with:
24+
persist-credentials: false
25+
26+
- uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
27+
with:
28+
results_file: results.sarif
29+
results_format: sarif
30+
publish_results: true
31+
32+
# Upload the results as artifacts (optional). Commenting out will disable
33+
# uploads of run results in SARIF format to the repository Actions tab.
34+
# https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts
35+
- name: "Upload artifact"
36+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
37+
with:
38+
name: SARIF file
39+
path: results.sarif
40+
retention-days: 5
41+
42+
# Upload the results to GitHub's code scanning dashboard (optional).
43+
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
44+
- name: "Upload to code-scanning"
45+
uses: github/codeql-action/upload-sarif@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
46+
with:
47+
sarif_file: results.sarif

.github/workflows/publish-to-npm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
# (packages are in-fact published in the correct order), but the race on the registry still applies.
3939
# If this happens, run the workflow again - there should be enough time for everything to settle until this workflow
4040
# attempts to publish again.
41-
run: npx lerna publish --concurrency 1 from-package --no-push --no-private --no-git-tag-version --no-verify-access --dist-tag=canary --yes
41+
run: npx lerna publish --concurrency 1 from-package --no-push --no-private --no-git-tag-version --no-verify-access --dist-tag=latest --yes

.github/workflows/unit-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
cache: 'npm'
8383
cache-dependency-path: |
8484
package-lock.json
85-
node-version: '20'
85+
node-version: '22'
8686

8787
- run: npm install -g npm@latest
8888

CHANGELOG.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,39 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2
1010

1111
## Unreleased
1212

13+
### :boom: Breaking Changes
14+
15+
### :rocket: Features
16+
17+
### :bug: Bug Fixes
18+
19+
* fix(resources): guard asynchronous resource attribute rejections from causing unhandled promise rejection [#5544](https://github.com/open-telemetry/opentelemetry-js/pull/5544) @dyladan
20+
* fix(resource): do not trigger `Accessing resource attributes before async attributes settled` warning when detecting resources [#5546](https://github.com/open-telemetry/opentelemetry-js/pull/5546) @dyladan
21+
* verbose logging of detected resource removed
22+
* fix(resource): use dynamic import over require to improve ESM compliance [#5298](https://github.com/open-telemetry/opentelemetry-js/pull/5298) @xiaoxiangmoe
23+
* fix(sdk-metrics): improve PeriodicExportingMetricReader() constructor input validation [#5621](https://github.com/open-telemetry/opentelemetry-js/pull/5621) @cjihrig
24+
25+
### :books: Documentation
26+
27+
* refactor(metrics): Updated metrics samples to no longer treat `sdk.start()` as async [#5617](https://github.com/open-telemetry/opentelemetry-js/pull/5617) @JacksonWeber
28+
29+
### :house: Internal
30+
31+
* test(sdk-metrics): fix multiple problematic assertRejects() calls [#5611](https://github.com/open-telemetry/opentelemetry-js/pull/5611) @cjihrig
32+
* refactor: replace assertRejects() with assert.rejects() [#5614](https://github.com/open-telemetry/opentelemetry-js/pull/5614) @cjihrig
33+
* refactor(core): migrate from deprecated semconv constants [#5575](https://github.com/open-telemetry/opentelemetry-js/pull/5575) @alumni55748
34+
35+
## 2.0.0
36+
37+
### Summary
38+
39+
- The **minimum supported Node.js has been raised to `^18.19.0 || >=20.6.0`**. This means that support for Node.js 14 and 16 has been dropped.
40+
- The **minimum supported TypeScript version has been raised to 5.0.4**.
41+
- The **compilation target for transpiled TypeScript has been raised to ES2022** (from ES2017).
42+
- The **public interface has changed**
43+
- for notes on migrating to 2.x / 0.200.x see [the upgrade guide](https://github.com/open-telemetry/opentelemetry-js/tree/main/doc/upgrade-to-2.x.md)
44+
- Only experimental versions `0.200.0` are compatible with this release
45+
1346
### :boom: Breaking Change
1447

1548
* feat(sdk-trace-base)!: Add `parentSpanContext` and remove `parentSpanId` from `Span` and `ReadableSpan` [#5450](https://github.com/open-telemetry/opentelemetry-js/pull/5450) @JacksonWeber
@@ -151,8 +184,7 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2
151184
* fix(exporter-zipkin): remove usages of deprecated `url.parse` from `node:url` [#5390](https://github.com/open-telemetry/opentelemetry-js/pull/5390) @chancancode
152185
* 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
153186
* fix(sdk-trace-base): always wait on pending export in SimpleSpanProcessor. [#5303](https://github.com/open-telemetry/opentelemetry-js/pull/5303) @anuraaga
154-
155-
### :books: (Refine Doc)
187+
* fix(core): avoid using util in configuration.ts for browser compatibility [#5524](https://github.com/open-telemetry/opentelemetry-js/pull/5524) @sriraamas
156188

157189
### :house: (Internal)
158190

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@
3535

3636
---
3737

38-
> [!WARNING]
39-
> 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.
40-
> 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.
41-
4238
## About this project
4339

4440
This is the JavaScript version of [OpenTelemetry](https://opentelemetry.io/), a framework for collecting traces, metrics, and logs from applications.
@@ -76,14 +72,14 @@ const opentelemetry = require('@opentelemetry/sdk-node');
7672
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
7773
const { ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-base');
7874
const { resourceFromAttributes } = require('@opentelemetry/resources');
79-
const { SEMRESATTRS_SERVICE_NAME } = require('@opentelemetry/semantic-conventions');
75+
const { ATTR_SERVICE_NAME } = require('@opentelemetry/semantic-conventions');
8076

8177
// configure the SDK to export telemetry data to the console
8278
// enable all auto-instrumentations from the meta package
8379
const traceExporter = new ConsoleSpanExporter();
8480
const sdk = new opentelemetry.NodeSDK({
8581
resource: resourceFromAttributes({
86-
[SEMRESATTRS_SERVICE_NAME]: 'my-service',
82+
[ATTR_SERVICE_NAME]: 'my-service',
8783
}),
8884
traceExporter,
8985
instrumentations: [getNodeAutoInstrumentations()]
@@ -164,6 +160,7 @@ The below table describes which versions of each set of packages are expected to
164160

165161
| Stable Packages | Experimental Packages |
166162
|-----------------|-----------------------|
163+
| 2.0.x | 0.200.x |
167164
| 1.30.x | 0.57.x |
168165
| 1.29.x | 0.56.x |
169166
| 1.28.x | 0.55.x |

api/test/common/api/api.test.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ const diagLoggerFunctions = [
4848
'error',
4949
] as const;
5050

51-
describe('API', () => {
52-
it('should expose a tracer provider via getTracerProvider', () => {
51+
describe('API', function () {
52+
it('should expose a tracer provider via getTracerProvider', function () {
5353
const tracer = api.trace.getTracerProvider();
5454
assert.ok(tracer);
5555
assert.strictEqual(typeof tracer, 'object');
5656
});
5757

58-
it('getActiveSpan should get the current span', () => {
58+
it('getActiveSpan should get the current span', function () {
5959
const span = new NonRecordingSpan();
6060
const ctx = trace.setSpan(ROOT_CONTEXT, span);
6161
context.setGlobalContextManager({
@@ -69,8 +69,8 @@ describe('API', () => {
6969
context.disable();
7070
});
7171

72-
describe('Context', () => {
73-
it('with should forward this, arguments and return value', () => {
72+
describe('Context', function () {
73+
it('with should forward this, arguments and return value', function () {
7474
function fnWithThis(this: string, a: string, b: number): string {
7575
assert.strictEqual(this, 'that');
7676
assert.strictEqual(arguments.length, 2);
@@ -89,7 +89,7 @@ describe('API', () => {
8989
});
9090
});
9191

92-
describe('GlobalTracerProvider', () => {
92+
describe('GlobalTracerProvider', function () {
9393
const spanContext = {
9494
traceId: 'd4cda95b652f4a1592b449d5929fda1b',
9595
spanId: '6e0c63257de34c92',
@@ -103,14 +103,14 @@ describe('API', () => {
103103
propagation.disable();
104104
});
105105

106-
it('should use the global tracer provider', () => {
106+
it('should use the global tracer provider', function () {
107107
api.trace.setGlobalTracerProvider(new TestTracerProvider());
108108
const tracer = api.trace.getTracerProvider().getTracer('name');
109109
const span = tracer.startSpan('test');
110110
assert.deepStrictEqual(span, dummySpan);
111111
});
112112

113-
it('should set delegate only on success', () => {
113+
it('should set delegate only on success', function () {
114114
assert.strictEqual(
115115
api.trace.setGlobalTracerProvider(new TestTracerProvider()),
116116
true
@@ -134,7 +134,7 @@ describe('API', () => {
134134
}
135135
}
136136

137-
describe('should use the global propagation', () => {
137+
describe('should use the global propagation', function () {
138138
const testKey = Symbol('kTestKey');
139139

140140
interface Carrier {
@@ -169,7 +169,7 @@ describe('API', () => {
169169
}
170170
}
171171

172-
it('inject', () => {
172+
it('inject', function () {
173173
api.propagation.setGlobalPropagator(new TestTextMapPropagation());
174174

175175
const context = ROOT_CONTEXT.setValue(testKey, 15);
@@ -186,7 +186,7 @@ describe('API', () => {
186186
assert.strictEqual(carrier.setter, setter);
187187
});
188188

189-
it('extract', () => {
189+
it('extract', function () {
190190
api.propagation.setGlobalPropagator(new TestTextMapPropagation());
191191

192192
const carrier: Carrier = {};
@@ -209,7 +209,7 @@ describe('API', () => {
209209
assert.strictEqual(data.getter, getter);
210210
});
211211

212-
it('fields', () => {
212+
it('fields', function () {
213213
api.propagation.setGlobalPropagator(new TestTextMapPropagation());
214214

215215
const fields = api.propagation.fields();
@@ -218,37 +218,37 @@ describe('API', () => {
218218
});
219219
});
220220

221-
describe('Global diag', () => {
222-
it('initialization', () => {
221+
describe('Global diag', function () {
222+
it('initialization', function () {
223223
const inst = DiagAPI.instance();
224224

225225
assert.deepStrictEqual(diag, inst);
226226
});
227227

228228
diagLoggerFunctions.forEach(fName => {
229-
it(`no argument logger ${fName} message doesn't throw`, () => {
229+
it(`no argument logger ${fName} message doesn't throw`, function () {
230230
//@ts-expect-error an undefined logger is not allowed
231231
diag.setLogger();
232232
assert.doesNotThrow(() => {
233233
diag[fName](`${fName} message`);
234234
});
235235
});
236236

237-
it(`null logger ${fName} message doesn't throw`, () => {
237+
it(`null logger ${fName} message doesn't throw`, function () {
238238
diag.setLogger(null as any);
239239
assert.doesNotThrow(() => {
240240
diag[fName](`${fName} message`);
241241
});
242242
});
243243

244-
it(`undefined logger ${fName} message doesn't throw`, () => {
244+
it(`undefined logger ${fName} message doesn't throw`, function () {
245245
diag.setLogger(undefined as any);
246246
assert.doesNotThrow(() => {
247247
diag[fName](`${fName} message`);
248248
});
249249
});
250250

251-
it(`empty logger ${fName} message doesn't throw`, () => {
251+
it(`empty logger ${fName} message doesn't throw`, function () {
252252
diag.setLogger({} as any);
253253
assert.doesNotThrow(() => {
254254
diag[fName](`${fName} message`);
@@ -257,21 +257,21 @@ describe('API', () => {
257257
});
258258
});
259259

260-
describe('Global metrics', () => {
261-
it('should expose a meter provider via getMeterProvider', () => {
260+
describe('Global metrics', function () {
261+
it('should expose a meter provider via getMeterProvider', function () {
262262
const meter = metrics.getMeterProvider();
263263
assert.ok(meter);
264264
assert.strictEqual(typeof meter, 'object');
265265
});
266266

267-
describe('GlobalMeterProvider', () => {
267+
describe('GlobalMeterProvider', function () {
268268
const dummyMeter = new NoopMeter();
269269

270270
beforeEach(() => {
271271
metrics.disable();
272272
});
273273

274-
it('should use the global meter provider', () => {
274+
it('should use the global meter provider', function () {
275275
metrics.setGlobalMeterProvider(new TestMeterProvider());
276276
const meter = metrics.getMeterProvider().getMeter('name');
277277
assert.deepStrictEqual(meter, dummyMeter);

0 commit comments

Comments
 (0)