Skip to content

Commit 67f20d4

Browse files
authored
Merge branch 'main' into feat/add-transformer-entrypoints
2 parents ce7c5a3 + d4d3732 commit 67f20d4

File tree

115 files changed

+13681
-7279
lines changed

Some content is hidden

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

115 files changed

+13681
-7279
lines changed

.github/workflows/ossf-scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ jobs:
4242
# Upload the results to GitHub's code scanning dashboard (optional).
4343
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
4444
- name: "Upload to code-scanning"
45-
uses: github/codeql-action/upload-sarif@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
45+
uses: github/codeql-action/upload-sarif@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
4646
with:
4747
sarif_file: results.sarif

.github/workflows/unit-test.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- "20"
1919
- "22"
2020
- "23"
21+
- "24"
2122
runs-on: ubuntu-latest
2223
env:
2324
NPM_CONFIG_UNSAFE_PERM: true
@@ -45,7 +46,8 @@ jobs:
4546
if: ${{
4647
matrix.node_version == '20' ||
4748
matrix.node_version == '22' ||
48-
matrix.node_version == '23'
49+
matrix.node_version == '23' ||
50+
matrix.node_version == '24'
4951
}}
5052

5153
- name: Bootstrap
@@ -55,13 +57,13 @@ jobs:
5557
run: npm run compile
5658

5759
- run: npm test
58-
if: ${{ matrix.node_version != '23' }}
59-
# Node.js 23 type stripping conflicts with mocha usage of ts-node.
60+
if: ${{ matrix.node_version != '23' && matrix.node_version != '24' }}
61+
# Node.js >= 23 type stripping conflicts with mocha usage of ts-node.
6062
# See https://github.com/open-telemetry/opentelemetry-js/issues/5415
6163
- run: npm test
6264
env:
6365
NODE_OPTIONS: '--no-experimental-strip-types'
64-
if: ${{ matrix.node_version == '23' }}
66+
if: ${{ matrix.node_version == '23' || matrix.node_version == '24' }}
6567

6668
- name: Report Coverage
6769
uses: codecov/codecov-action@v5

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,20 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2
2020
* 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
2121
* verbose logging of detected resource removed
2222
* 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
2423

2524
### :books: Documentation
2625

2726
* refactor(metrics): Updated metrics samples to no longer treat `sdk.start()` as async [#5617](https://github.com/open-telemetry/opentelemetry-js/pull/5617) @JacksonWeber
2827

2928
### :house: Internal
3029

30+
* refactor(sdk-trace-base): update semconv usage to ATTR_ exports [#5669](https://github.com/open-telemetry/opentelemetry-js/pull/5669) @trentm
31+
* refactor(sdk-trace-web): update semconv usage to ATTR_ exports [#5672](https://github.com/open-telemetry/opentelemetry-js/pull/5672) @trentm
32+
* refactor(resources): update semconv usage to ATTR_ exports [#5666](https://github.com/open-telemetry/opentelemetry-js/pull/5666) @trentm
3133
* test(sdk-metrics): fix multiple problematic assertRejects() calls [#5611](https://github.com/open-telemetry/opentelemetry-js/pull/5611) @cjihrig
3234
* refactor: replace assertRejects() with assert.rejects() [#5614](https://github.com/open-telemetry/opentelemetry-js/pull/5614) @cjihrig
3335
* refactor(core): migrate from deprecated semconv constants [#5575](https://github.com/open-telemetry/opentelemetry-js/pull/5575) @alumni55748
36+
* refactor(opentelemetry-core): simplify `parseKeyPairsIntoRecord()` [#5610](https://github.com/open-telemetry/opentelemetry-js/pull/5610) @cjihrig
3437

3538
## 2.0.0
3639

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ We have a weekly SIG meeting! See the [community page](https://github.com/open-t
256256

257257
Members of this team have triager permissions for opentelemetry-js.git and opentelemetry-js-contrib.git.
258258

259-
- (none currently)
259+
- [Jackson Weber](https://github.com/JacksonWeber), Microsoft
260260

261261
*Find more about the triager role in the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager).*
262262

api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
"ts-loader": "9.5.2",
9797
"typescript": "5.0.4",
9898
"unionfs": "4.5.4",
99-
"webpack": "5.96.1"
99+
"webpack": "5.99.7"
100100
},
101101
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/api",
102102
"sideEffects": false

doc/frequently-asked-questions.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Frequently Asked Questions
2+
3+
This FAQ has bits of advice and workarounds for common problems.
4+
5+
## I'm using Jest and get import errors when I run my test suite
6+
7+
Test suite failures of the form:
8+
9+
``` text
10+
Cannot find module @opentelemetry/foo/bar from @opentelemetry/...
11+
```
12+
13+
but package `@opentelemetry/foo` is installed may occur with Jest < v29.4.
14+
This is because older versions of `jest-resolve` cannot find the nested module
15+
imports used by some OpenTelemetry packages since version 0.56 and higher.
16+
See [#5618](https://github.com/open-telemetry/opentelemetry-js/issues/5618)
17+
18+
Either upgrade to a newer version of Jest to resolve the issue, or use this
19+
workaround for older versions of Jest by adding a `moduleNameMapper` rule.
20+
Add this line to your `jest.config.js`:
21+
22+
``` javascript
23+
module.exports = {
24+
moduleNameMapper: {
25+
'^@opentelemetry/([^/]+)/(.+)$': '<rootDir>/node_modules/@opentelemetry/$1/build/src/index-$2',
26+
}
27+
}
28+
```

doc/metrics.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,10 @@ can be used to information about the record measurement itself.
293293

294294
```typescript
295295
async function myTask() {
296-
const httpServerDuration = meter.createHistogram("http.server.duration", {
297-
description: 'A http server duration',
298-
unit: 'milliseconds',
299-
valueType: ValueType.INT
296+
const httpServerDuration = meter.createHistogram("my.http.server.request.duration", {
297+
description: 'HTTP server request duration',
298+
unit: 's',
299+
valueType: ValueType.DOUBLE
300300
});
301301
const startTime = new Date().getTime()
302302
try {
@@ -305,12 +305,12 @@ async function myTask() {
305305
} catch (err) {
306306
} finally {
307307
const endTime = new Date().getTime()
308-
const executionTime = endTime - startTime
308+
const executionTime = (endTime - startTime) / 1000
309309

310310
httpServerDuration.record(executionTime, {
311-
[SemanticAttributes.HTTP_METHOD]: 'POST',
312-
[SemanticAttributes.HTTP_STATUS_CODE]: '200',
313-
[SemanticAttributes.HTTP_SCHEME]: 'https',
311+
[ATTR_HTTP_REQUEST_METHOD]: 'POST',
312+
[ATTR_HTTP_RESPONSE_STATUS_CODE]: '200',
313+
[ATTR_URL_SCHEME]: 'https',
314314
})
315315
}
316316
}
@@ -416,17 +416,17 @@ const meterProvider = new MeterProvider({
416416
});
417417

418418
// Create histogram metric
419-
const httpServerDuration = meter.createHistogram("http.server.duration", {
420-
description: 'A http server duration',
421-
unit: 'milliseconds',
422-
valueType: ValueType.INT
419+
const httpServerDuration = meter.createHistogram('my.http.server.request.duration', {
420+
description: 'HTTP server request duration',
421+
unit: 's',
422+
valueType: ValueType.DOUBLE
423423
});
424424

425425
// Record measurement for histogram
426426
httpServerDuration.record(50, {
427-
[SemanticAttributes.HTTP_METHOD]: 'POST',
428-
[SemanticAttributes.HTTP_STATUS_CODE]: '200',
429-
[SemanticAttributes.HTTP_SCHEME]: 'https',
427+
[ATTR_HTTP_REQUEST_METHOD]: 'POST',
428+
[ATTR_HTTP_RESPONSE_STATUS_CODE]: '200',
429+
[ATTR_URL_SCHEME]: 'https',
430430
});
431431
```
432432

doc/tracing.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,31 @@ server.on("GET", "/user/:id", onGet);
7979
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.
8080

8181
```typescript
82-
import { NetTransportValues, SemanticAttributes } from '@opentelemetry/semantic-conventions';
8382
import { trace, context, SpanKind, SpanStatusCode } from '@opentelemetry/api';
83+
import {
84+
ATTR_HTTP_REQUEST_METHOD,
85+
ATTR_URL_PATH,
86+
ATTR_URL_SCHEME,
87+
ATTR_HTTP_RESPONSE_STATUS_CODE,
88+
ATTR_NETWORK_PEER_ADDRESS,
89+
ATTR_DB_SYSTEM_NAME,
90+
ATTR_DB_NAMESPACE,
91+
ATTR_DB_OPERATION_NAME,
92+
ATTR_DB_QUERY_TEXT,
93+
} from '@opentelemetry/semantic-conventions';
8494

8595
async function onGet(request, response) {
8696
// HTTP semantic conventions determine the span name and attributes for this span
87-
const span = tracer.startSpan(`GET /user/:id`, {
97+
const span = tracer.startSpan('GET /user/:id', {
8898
// attributes can be added when the span is started
8999
attributes: {
90100
// Attributes from the HTTP trace semantic conventions
91-
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md
92-
[SemanticAttributes.HTTP_METHOD]: "GET",
93-
[SemanticAttributes.HTTP_FLAVOR]: "1.1",
94-
[SemanticAttributes.HTTP_URL]: request.url,
95-
[SemanticAttributes.NET_PEER_IP]: "192.0.2.5",
101+
// https://opentelemetry.io/docs/specs/semconv/http/http-spans/#http-server-span
102+
[ATTR_HTTP_REQUEST_METHOD]: 'POST',
103+
[ATTR_URL_PATH]: request.url,
104+
[ATTR_URL_SCHEME]: 'https',
105+
[ATTR_HTTP_RESPONSE_STATUS_CODE]: '200',
106+
[ATTR_NETWORK_PEER_ADDRESS]: '192.0.2.5',
96107
},
97108
// This span represents a remote incoming synchronous request
98109
kind: SpanKind.SERVER
@@ -142,26 +153,16 @@ async function getUser(userId) {
142153
const span = tracer.startSpan("SELECT ShopDb.Users", {
143154
attributes: {
144155
// Attributes from the database trace semantic conventions
145-
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/database.md
146-
[SemanticAttributes.DB_SYSTEM]: "mysql",
147-
[SemanticAttributes.DB_CONNECTION_STRING]: "Server=shopdb.example.com;Database=ShopDb;Uid=billing_user;TableCache=true;UseCompression=True;MinimumPoolSize=10;MaximumPoolSize=50;",
148-
[SemanticAttributes.DB_USER]: "app_user",
149-
[SemanticAttributes.NET_PEER_NAME]: "shopdb.example.com",
150-
[SemanticAttributes.NET_PEER_IP]: "192.0.2.12",
151-
[SemanticAttributes.NET_PEER_PORT]: 3306,
152-
[SemanticAttributes.NET_TRANSPORT]: NetTransportValues.IP_TCP,
153-
[SemanticAttributes.DB_NAME]: "ShopDb",
154-
[SemanticAttributes.DB_STATEMENT]: `Select * from Users WHERE user_id = ${userId}`,
155-
[SemanticAttributes.DB_OPERATION]: "SELECT",
156-
[SemanticAttributes.DB_SQL_TABLE]: "Users",
156+
// https://opentelemetry.io/docs/specs/semconv/database/database-spans/#span-definition
157+
[ATTR_DB_SYSTEM_NAME]: "mysql",
158+
[ATTR_DB_NAMESPACE]: "ShopDb",
159+
[ATTR_DB_OPERATION_NAME]: "SELECT",
160+
[ATTR_DB_QUERY_TEXT]: `SELECT * from Users WHERE id = ?`,
157161
},
158162
kind: SpanKind.CLIENT,
159163
});
160164
const user = await db.select("Users", { id: userId });
161165

162-
span.setStatus({
163-
code: SpanStatusCode.OK,
164-
});
165166
span.end();
166167
return user;
167168
}

experimental/CHANGELOG.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,34 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2
88

99
### :boom: Breaking Changes
1010

11-
* feat(instrumentation-http)!: Remove legacy http span attributes and metrics [#5552](https://github.com/open-telemetry/opentelemetry-js/pull/5552) @svetlanabrennan
12-
1311
### :rocket: Features
1412

13+
* feat(instrumentation-xml-http-request): support migration to stable HTTP semconv, v1.23.1 [#5662](https://github.com/open-telemetry/opentelemetry-js/pull/5662) @trentm
14+
* Configure the instrumentation with `semconvStabilityOptIn: 'http'` to use the new, stable semconv v1.23.1 semantics or `'http/dup'` for both old (v1.7.0) and stable semantics. When `semconvStabilityOptIn` is not specified (or does not contain these values), it uses the old semconv v1.7.0. I.e. the default behavior is unchanged.
15+
* feat(instrumentation-fetch): support migration to stable HTTP semconv, v1.23.1 [#5651](https://github.com/open-telemetry/opentelemetry-js/pull/5651) @trentm
16+
* Configure the instrumentation with `semconvStabilityOptIn: 'http'` to use the new, stable semconv v1.23.1 semantics or `'http/dup'` for both old (v1.7.0) and stable semantics. When `semconvStabilityOptIn` is not specified (or does not contain these values), it uses the old semconv v1.7.0. I.e. the default behavior is unchanged.
17+
* feat(instrumentation): New `semconvStabilityFromStr()` utility for semconv stability migration in instrumentations. [#5684](https://github.com/open-telemetry/opentelemetry-js/pull/5684) @trentm
18+
* See [the utility comment](https://github.com/trentm/opentelemetry-js/blob/main/experimental/packages/opentelemetry-instrumentation/src/semconvStability.ts).
19+
* feat(instrumentation-grpc): support migration to stable HTTP semconv [#5653](https://github.com/open-telemetry/opentelemetry-js/pull/5653) @JamieDanielson
20+
* feat(instrumentation-http): capture synthetic source type on requests [#5488](https://github.com/open-telemetry/opentelemetry-js/pull/5488) @JacksonWeber
21+
1522
### :bug: Bug Fixes
1623

17-
fix(otlp-transformer): do not throw when deserializing empty JSON response [#5551](https://github.com/open-telemetry/opentelemetry-js/pull/5551) @pichlermarc
24+
* fix(otlp-transformer): do not throw when deserializing empty JSON response [#5551](https://github.com/open-telemetry/opentelemetry-js/pull/5551) @pichlermarc
25+
* fix(instrumentation-http): report stable client metrics response code [#9586](https://github.com/open-telemetry/opentelemetry-js/pull/9586) @jtescher
26+
* fix(sdk-node): instantiate baggage processor when env var is set [#5634](https://github.com/open-telemetry/opentelemetry-js/pull/5634) @pichlermarc
1827

1928
### :books: Documentation
2029

2130
### :house: Internal
2231

32+
* refactor(instrumentation-http): Remove legacy http span attributes and metrics [#5552](https://github.com/open-telemetry/opentelemetry-js/pull/5552) @svetlanabrennan
33+
* refactor(instrumentation-http): Add back support for http semconv [#5665](https://github.com/open-telemetry/opentelemetry-js/pull/5665) @JamieDanielson
34+
* Note: We initially removed support for legacy http attributes and metrics, but then added back for an additional 6 months to ensure all instrumentations could be updated and kept consistent. There should be no net new change in this instrumentation related to these semantic conventions. See [#5646](https://github.com/open-telemetry/opentelemetry-js/issues/5646) for details.
35+
* refactor(sdk-node): update semconv usage to `ATTR_` exports [#5668](https://github.com/open-telemetry/opentelemetry-js/pull/5668) @trentm
2336
* chore(sdk-node): Refactored using `get*FromEnv` utility function instead of `process.env` for NodeSDK's resource detector setup. [#5582](https://github.com/open-telemetry/opentelemetry-js/pull/5582) @beeme1mr
2437
* chore(sdk-node): Refactored using `get*FromEnv` utility function instead of `process.env` for NodeSDK's logging setup. [#5563](https://github.com/open-telemetry/opentelemetry-js/issues/5563) @weyert
38+
* test: test Node.js 24 in CI [#5661](https://github.com/open-telemetry/opentelemetry-js/pull/5661) @cjihrig
2539

2640
## 0.200.0
2741

experimental/packages/api-events/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"nyc": "17.1.0",
8181
"ts-loader": "9.5.2",
8282
"typescript": "5.0.4",
83-
"webpack": "5.96.1"
83+
"webpack": "5.99.7"
8484
},
8585
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/api-events",
8686
"sideEffects": false

0 commit comments

Comments
 (0)