Skip to content

Commit a833d9c

Browse files
authored
Merge pull request #5144 from dynatrace-oss-contrib/next-main-
[next] merge changes from main
2 parents 508946c + 4a394cc commit a833d9c

File tree

177 files changed

+4297
-6151
lines changed

Some content is hidden

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

177 files changed

+4297
-6151
lines changed

.github/workflows/lint.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ jobs:
2828
run: |
2929
npm run lint
3030
npm run lint:examples
31-
npm run lint:markdown
3231
3332
- name: Lint doc files
3433
run: |

.github/workflows/peer-api.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
peer-api-check:
1212
runs-on: ubuntu-latest
1313
container:
14-
image: node:20
14+
image: node:22
1515
steps:
1616
- name: Checkout
1717
uses: actions/checkout@v4
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish packages to NPM
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release-to-npm:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
# needed for NPM provenance
11+
id-token: write
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 18
22+
registry-url: 'https://registry.npmjs.org'
23+
24+
- run: npm ci
25+
26+
# NOTE: in the past, we've had situations where the compiled files were missing as the `prepublishOnly` script was
27+
# missing in some packages. `npx lerna publish` *should* also run compile, but this is intended as a safeguard
28+
# when that does not happen for whatever reason.
29+
- run: npm run compile
30+
31+
- name: Publish to npm
32+
env:
33+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
34+
NPM_CONFIG_PROVENANCE: true
35+
# NOTE: using --concurrency 1 to reduce the likelihood of a race when publishing,
36+
# which happens when the npm registry is not fully consistent yet. This can cause the publishing of a package to be
37+
# rejected because dependencies are not available yet. `lerna` does ensure that this is not the case locally
38+
# (packages are in-fact published in the correct order), but the race on the registry still applies.
39+
# If this happens, run the workflow again - there should be enough time for everything to settle until this workflow
40+
# attempts to publish again.
41+
run: npx lerna publish --concurrency 1 from-package --no-push --no-private --no-git-tag-version --no-verify-access --yes

.github/workflows/unit-test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141
run: npm run test
4242
- name: Report Coverage
4343
uses: codecov/codecov-action@v4
44+
env:
45+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4446
with:
4547
verbose: true
4648
node-windows-tests:
@@ -95,6 +97,8 @@ jobs:
9597
run: npm run test:browser
9698
- name: Report Coverage
9799
uses: codecov/codecov-action@v4
100+
env:
101+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
98102
with:
99103
verbose: true
100104
webworker-tests:
@@ -121,6 +125,8 @@ jobs:
121125
run: npm run test:webworker
122126
- name: Report Coverage
123127
uses: codecov/codecov-action@v4
128+
env:
129+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
124130
with:
125131
verbose: true
126132
api-eol-node-test:

CHANGELOG.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,35 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se
1313

1414
### :rocket: (Enhancement)
1515

16+
* feat(sdk-metrics, sdk-trace): add `mergeResourceWithDefaults` flag, which allows opting-out of resources getting merged with the default resource [#4617](https://github.com/open-telemetry/opentelemetry-js/pull/4617)
17+
* default: `true` (no change in behavior)
18+
* note: `false` will become the default behavior in the next major version in order to comply with [specification requirements](https://github.com/open-telemetry/opentelemetry-specification/blob/f3511a5ccda376dfd1de76dfa086fc9b35b54757/specification/resource/sdk.md?plain=1#L31-L36)
19+
20+
* feat(sdk-trace-base): add `spanProcessors` property in `TracerConfig` interface. [#5138](https://github.com/open-telemetry/opentelemetry-js/pull/5138) @david-luna
21+
22+
### :bug: (Bug Fix)
23+
24+
* fix(sdk-metrics): await exports in `PeriodicExportingMetricReader` when async resource attributes have not yet settled [#5119](https://github.com/open-telemetry/opentelemetry-js/pull/5119/) @pichlermarc
25+
26+
### :books: (Refine Doc)
27+
28+
### :house: (Internal)
29+
30+
## 1.27.0
31+
32+
### :rocket: (Enhancement)
33+
1634
* feat: add processors for adding session.id attribute to spans and logs [#4972](https://github.com/open-telemetry/opentelemetry-js/pull/4972)
1735

1836
### :bug: (Bug Fix)
1937

2038
* fix(sdk-trace-base): avoid keeping non-string `status.message` on `Span#setStatus()` [#4999](https://github.com/open-telemetry/opentelemetry-js/pull/4999) @pichlermarc
2139
* fix(sdk-metrics): Add missing catch and handle error in promise of `PeriodicExportingMetricReader` [#5006](https://github.com/open-telemetry/opentelemetry-js/pull/5006) @jj22ee
2240
* fix(opentelemetry-core): confusing log extract of composite propagator [#5017](https://github.com/open-telemetry/opentelemetry-js/pull/5017) @rv2673
23-
24-
### :books: (Refine Doc)
41+
* fix(propagator-aws-xray-*): move propagators back to contrib repository [#4966](https://github.com/open-telemetry/opentelemetry-js/pull/4966) @pichlermarc
42+
* The [specification](https://github.com/open-telemetry/opentelemetry-specification/blob/6672dbc97ddeb34f36c020a0f0a30323c8bc4d95/specification/context/api-propagators.md?plain=1#L354-L356) prohibits hosting these packages in the core repository
43+
* `@opentelemetry/propagator-aws-xray` is now located in [open-telemetry/opentelemetry-js-contrib](https://github.com/open-telemetry/opentelemetry-js-contrib)
44+
* `@opentelemetry/propagator-aws-xray-lambda` is now located in [open-telemetry/opentelemetry-js-contrib](https://github.com/open-telemetry/opentelemetry-js-contrib)
2545

2646
* 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
2747

@@ -112,6 +132,7 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se
112132
* fix(resources): prevent circular import (resource -> detector -> resource -> ...) [#4653](https://github.com/open-telemetry/opentelemetry-js/pull/4653) @pichlermarc
113133
* fixes a circular import warning which would appear in rollup when bundling `@opentelemetry/resources`
114134
* fix(exporter-metrics-otlp-grpc): add explicit otlp-exporter-base dependency to exporter-metrics-otlp-grpc [#4678](https://github.com/open-telemetry/opentelemetry-js/pull/4678) @AkselAllas
135+
* fix(resources) wait for async attributes for detecting resources [#4687](https://github.com/open-telemetry/opentelemetry-js/pull/4687) @ziolekjj
115136

116137
## 1.24.0
117138

CONTRIBUTING.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,16 @@ To run the unit tests continuously in watch mode while developing, use:
223223
npm run tdd
224224
```
225225

226+
Packages that are expected to run in the browser have browser specific tests:
227+
228+
```sh
229+
# Run browser-specific test
230+
npm run test:browser
231+
232+
# Run web worker test
233+
npm run test:webworker
234+
```
235+
226236
### Linting
227237

228238
This project uses `eslint` to lint source code. Just like tests and compilation, linting can be done for all packages or only a single package.
@@ -247,13 +257,21 @@ cd packages/opentelemetry-module-name
247257
npm run lint:fix
248258
```
249259

250-
Similarly, Markdown files (such as README.md files) can be linted:
260+
The default lint command will check majority of files, including Markdown files (such as README.md files), but you
261+
also have the option to check just the Markdown files with:
251262

252263
```sh
253264
npm run lint:markdown
254265
npm run lint:markdown:fix # can automatically fix some Markdown rules
255266
```
256267

268+
The default command doesn't check the examples folder. To lint just the examples, use the script:
269+
270+
```sh
271+
npm run lint:examples
272+
npm run lint:examples:fix # can automatically fix some errors
273+
```
274+
257275
### Generating docs
258276

259277
We use [typedoc](https://www.npmjs.com/package/typedoc) to generate the api documentation.

api/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ const { trace } = require("@opentelemetry/api");
4545
const { BasicTracerProvider, ConsoleSpanExporter, SimpleSpanProcessor } = require("@opentelemetry/sdk-trace-base");
4646

4747
// Create and register an SDK
48-
const provider = new BasicTracerProvider();
49-
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
48+
const provider = new BasicTracerProvider({
49+
spanProcessors: [new SimpleSpanProcessor(new ConsoleSpanExporter())]
50+
});
5051
trace.setGlobalTracerProvider(provider);
5152

5253
// Acquire a tracer from the global tracer provider which will be used to trace the application

doc/contributing/releasing.md

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
This document is aimed at Maintainers and describes how to release a new version of the packages contained in this repository.
44
We aim to eventually automate this process as much as possible.
55

6-
## Create a release PR
6+
## 1. Create a release PR
77

8-
1. Go to the [Release PR Workflow](https://github.com/open-telemetry/opentelemetry-js/actions/workflows/create-or-update-release.yml)
8+
1. Go to the [Release PR Workflow](https://github.com/open-telemetry/opentelemetry-js/actions/workflows/create-or-update-release-pr.yml)
99
2. Click "Run workflow"
1010
3. For `Release Type`, select if you want to create a release PR for a new `minor` or `patch` version.
1111
4. For `Release Scope`, select if you want to release
@@ -18,37 +18,23 @@ We aim to eventually automate this process as much as possible.
1818
> If there was a commit to `main`, after PR creation simply run the workflow again before merging it.
1919
> Re-running it will update the PR with the contents from `main` and will update the PR body too.
2020
21-
## Review and merge the release PR
21+
## 2. Review and merge the release PR
2222

2323
1. Review the PR generated via the workflow (it will be titled `chore: prepare next release` and opened by the @opentelemetrybot user)
2424
2. Once approved, merge the PR
2525

26-
## Publish to NPM
27-
28-
### Prerequisites
29-
30-
1. Ensure you have access to the [`opentelemetry` npm organization](https://www.npmjs.com/org/opentelemetry)
31-
2. Go to your npm user's `Access Tokens` page
32-
3. Click `Generate New Token` -> `Granular Access Token` (2FA prompt will pop up)
33-
4. Input all required fields
34-
- recommended: set the expiry date on the token to 1 day
35-
- recommended: set a CIDR range to only allow your IP
36-
5. Under `Packages and Scopes`
37-
- set `Permissions` to `Read and Write`
38-
- Select `Only Select packages and scopes`, choose `@opentelemetry`
39-
40-
### Publishing
41-
42-
1. Check out the commit created by merging the release PR
43-
2. run `git clean -fdx --exclude <whatever you want to keep, e.g. .idea, .vscode>`
44-
3. run `npm ci`
45-
4. run `npm run compile`
46-
5. run `NODE_AUTH_TOKEN=<token generated earlier> npm run release:publish`
26+
## 3. Publish to NPM
4727

4828
> [!IMPORTANT]
49-
> Delete the token once you're done publishing
29+
> This step will publish anything that's on `main` IF AND ONLY IF the version has been bumped. If the version for a package
30+
> has not been bumped, it will not publish a new version of the package.
31+
32+
1. Go to the [NPM publish workflow](https://github.com/open-telemetry/opentelemetry-js/actions/workflows/publish-to-npm.yml)
33+
2. Click "Run workflow" (from main)
34+
1. In rare cases not all packages are published due to a race when publishing, if you suspect this to
35+
be the case, re-run the workflow: there should be enough time from 1.
5036

51-
## Create GitHub Releases
37+
## 4. Create GitHub Releases
5238

5339
1. Check out the commit created by merging the release PR
5440
2. Run

examples/basic-tracer-node/index.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@ const { SEMRESATTRS_SERVICE_NAME } = require('@opentelemetry/semantic-convention
66
const { BasicTracerProvider, ConsoleSpanExporter, SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');
77
const { JaegerExporter } = require('@opentelemetry/exporter-jaeger');
88

9+
// Configure span processor to send spans to the exporter
10+
const exporter = new JaegerExporter({
11+
endpoint: 'http://localhost:14268/api/traces',
12+
});
913
const provider = new BasicTracerProvider({
1014
resource: new Resource({
1115
[SEMRESATTRS_SERVICE_NAME]: 'basic-service',
1216
}),
17+
spanProcessors: [
18+
new SimpleSpanProcessor(exporter),
19+
new SimpleSpanProcessor(new ConsoleSpanExporter()),
20+
]
1321
});
1422

15-
// Configure span processor to send spans to the exporter
16-
const exporter = new JaegerExporter({
17-
endpoint: 'http://localhost:14268/api/traces',
18-
});
19-
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
20-
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
21-
2223
/**
2324
* Initialize the OpenTelemetry APIs to use the BasicTracerProvider bindings.
2425
*

examples/esm-http-ts/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "esm-http-ts",
33
"private": true,
4-
"version": "0.53.0",
4+
"version": "0.54.2",
55
"description": "Example of HTTP integration with OpenTelemetry using ESM and TypeScript",
66
"main": "build/index.js",
77
"type": "module",
@@ -32,12 +32,12 @@
3232
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/",
3333
"dependencies": {
3434
"@opentelemetry/api": "1.9.0",
35-
"@opentelemetry/exporter-trace-otlp-proto": "0.53.0",
36-
"@opentelemetry/instrumentation": "0.53.0",
37-
"@opentelemetry/instrumentation-http": "0.53.0",
38-
"@opentelemetry/resources": "1.26.0",
39-
"@opentelemetry/sdk-trace-base": "1.26.0",
40-
"@opentelemetry/sdk-trace-node": "1.26.0",
35+
"@opentelemetry/exporter-trace-otlp-proto": "0.54.2",
36+
"@opentelemetry/instrumentation": "0.54.2",
37+
"@opentelemetry/instrumentation-http": "0.54.2",
38+
"@opentelemetry/resources": "1.27.0",
39+
"@opentelemetry/sdk-trace-base": "1.27.0",
40+
"@opentelemetry/sdk-trace-node": "1.27.0",
4141
"@opentelemetry/semantic-conventions": "1.27.0"
4242
}
4343
}

0 commit comments

Comments
 (0)