Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[next] merge changes from main #5144

Merged
merged 32 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
859c0ef
ci: use codecov token when uploading reports (#5053)
pichlermarc Oct 9, 2024
039db0b
fix(exporter-logs-otlp-proto): Use correct config type in constructor…
raphael-theriault-swi Oct 10, 2024
6be903a
fix(resources): wait for async attributes for detecting resources (#4…
ziolekjj Oct 11, 2024
7293e69
Added custom test instructions for browser-specific tests (#5056)
Annosha Oct 14, 2024
a1442fe
ci: add workflow to publish packages to npm (#5067)
pichlermarc Oct 14, 2024
7ed67f9
test(otlp-grpc-exporter-base): do not use hard-coded version in tests…
pichlermarc Oct 15, 2024
c208991
test: use venv in w3c trace context test script (#5071)
pichlermarc Oct 17, 2024
be1737f
chore: add markdown lint check to default lint command (#5074)
maryliag Oct 17, 2024
5e17361
chore(deps): update dependency chromedriver to v130 (#5080)
renovate-bot Oct 21, 2024
55a1fc8
fix(instrumentation-http): fix http/https ESM instr for 'import defau…
trentm Oct 22, 2024
330172c
fix(instrumentation-http): add server attributes after they become av…
pichlermarc Oct 23, 2024
006fe44
chore: move xray and xray-lambda propagators to contrib (#4966)
pichlermarc Oct 23, 2024
4497ee3
Added limitation in ot-shim readme (#5072)
mercybassey Oct 23, 2024
50d59ca
feat(instrumentation-http)!: remove deprecated ignore options (#5085)
pichlermarc Oct 23, 2024
6fee82d
chore: add @maryliag to approvers (#5083)
pichlermarc Oct 23, 2024
eb3ca4f
chore: prepare next release (#5068)
opentelemetrybot Oct 23, 2024
2b73d37
[Fixes # 4533] Replaced cpx2 with local test module (#5077)
Annosha Nov 4, 2024
4c0921e
docs: update releasing.md to mention npm publish workflow, fix a link…
pichlermarc Nov 4, 2024
ce5bbfb
chore(deps): update node.js to v22 (#5109)
renovate-bot Nov 4, 2024
67d7718
fix(instrumentation-http): skip malformed forwarded headers (#5099)
pmlanger Nov 5, 2024
33dbde1
add reset function test for InMemorySpanExporter (#5107)
paper2 Nov 5, 2024
6f4f3fc
chore: prepare next release (#5115)
opentelemetrybot Nov 5, 2024
fe4d368
Fix wrapping ESM files with absolute path (#5094)
serkan-ozal Nov 6, 2024
72c9af9
chore: prepare next release (#5120)
opentelemetrybot Nov 7, 2024
030aff3
feat(instrumentation-http)!: reduce public API surface by removing ex…
pichlermarc Nov 8, 2024
87bd98e
fix(instrumentation-http)!: drop url.parse in favor of URL constructo…
pichlermarc Nov 8, 2024
4b5c21c
chore(semantic-conventions): bump weaver; use comment filter rather t…
trentm Nov 8, 2024
012dc9e
feat(sdk-*): add option to opt-out from merging the resource with Res…
pichlermarc Nov 11, 2024
8483b68
fix(sdk-metrics): await export when async attributes are pending (#5126)
pichlermarc Nov 11, 2024
f1ef596
fix(instrumentation-http): iterating through the OTEL_SEMCONV_STABILI…
omarHassane Nov 12, 2024
db14633
feat(sdk-trace-base): add `spanProcessors` property in `TracerConfig`…
david-luna Nov 12, 2024
4a394cc
Merge branch 'main' into next-main-
pichlermarc Nov 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
run: |
npm run lint
npm run lint:examples
npm run lint:markdown

- name: Lint doc files
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/peer-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
peer-api-check:
runs-on: ubuntu-latest
container:
image: node:20
image: node:22
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/publish-to-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish packages to NPM

on:
workflow_dispatch:

jobs:
release-to-npm:
runs-on: ubuntu-latest
permissions:
# needed for NPM provenance
id-token: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'

- run: npm ci

# NOTE: in the past, we've had situations where the compiled files were missing as the `prepublishOnly` script was
# missing in some packages. `npx lerna publish` *should* also run compile, but this is intended as a safeguard
# when that does not happen for whatever reason.
- run: npm run compile

- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_CONFIG_PROVENANCE: true
# NOTE: using --concurrency 1 to reduce the likelihood of a race when publishing,
# which happens when the npm registry is not fully consistent yet. This can cause the publishing of a package to be
# rejected because dependencies are not available yet. `lerna` does ensure that this is not the case locally
# (packages are in-fact published in the correct order), but the race on the registry still applies.
# If this happens, run the workflow again - there should be enough time for everything to settle until this workflow
# attempts to publish again.
run: npx lerna publish --concurrency 1 from-package --no-push --no-private --no-git-tag-version --no-verify-access --yes
6 changes: 6 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
run: npm run test
- name: Report Coverage
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
verbose: true
node-windows-tests:
Expand Down Expand Up @@ -95,6 +97,8 @@ jobs:
run: npm run test:browser
- name: Report Coverage
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
verbose: true
webworker-tests:
Expand All @@ -121,6 +125,8 @@ jobs:
run: npm run test:webworker
- name: Report Coverage
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
verbose: true
api-eol-node-test:
Expand Down
25 changes: 23 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,35 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se

### :rocket: (Enhancement)

* 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)
* default: `true` (no change in behavior)
* 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)

* feat(sdk-trace-base): add `spanProcessors` property in `TracerConfig` interface. [#5138](https://github.com/open-telemetry/opentelemetry-js/pull/5138) @david-luna

### :bug: (Bug Fix)

* 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

### :books: (Refine Doc)

### :house: (Internal)

## 1.27.0

### :rocket: (Enhancement)

* feat: add processors for adding session.id attribute to spans and logs [#4972](https://github.com/open-telemetry/opentelemetry-js/pull/4972)

### :bug: (Bug Fix)

* fix(sdk-trace-base): avoid keeping non-string `status.message` on `Span#setStatus()` [#4999](https://github.com/open-telemetry/opentelemetry-js/pull/4999) @pichlermarc
* fix(sdk-metrics): Add missing catch and handle error in promise of `PeriodicExportingMetricReader` [#5006](https://github.com/open-telemetry/opentelemetry-js/pull/5006) @jj22ee
* fix(opentelemetry-core): confusing log extract of composite propagator [#5017](https://github.com/open-telemetry/opentelemetry-js/pull/5017) @rv2673

### :books: (Refine Doc)
* fix(propagator-aws-xray-*): move propagators back to contrib repository [#4966](https://github.com/open-telemetry/opentelemetry-js/pull/4966) @pichlermarc
* 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
* `@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

Expand Down Expand Up @@ -112,6 +132,7 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se
* fix(resources): prevent circular import (resource -> detector -> resource -> ...) [#4653](https://github.com/open-telemetry/opentelemetry-js/pull/4653) @pichlermarc
* fixes a circular import warning which would appear in rollup when bundling `@opentelemetry/resources`
* 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
* fix(resources) wait for async attributes for detecting resources [#4687](https://github.com/open-telemetry/opentelemetry-js/pull/4687) @ziolekjj

## 1.24.0

Expand Down
20 changes: 19 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,16 @@ To run the unit tests continuously in watch mode while developing, use:
npm run tdd
```

Packages that are expected to run in the browser have browser specific tests:

```sh
# Run browser-specific test
npm run test:browser

# Run web worker test
npm run test:webworker
```

### Linting

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.
Expand All @@ -247,13 +257,21 @@ cd packages/opentelemetry-module-name
npm run lint:fix
```

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

```sh
npm run lint:markdown
npm run lint:markdown:fix # can automatically fix some Markdown rules
```

The default command doesn't check the examples folder. To lint just the examples, use the script:

```sh
npm run lint:examples
npm run lint:examples:fix # can automatically fix some errors
```

### Generating docs

We use [typedoc](https://www.npmjs.com/package/typedoc) to generate the api documentation.
Expand Down
5 changes: 3 additions & 2 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ const { trace } = require("@opentelemetry/api");
const { BasicTracerProvider, ConsoleSpanExporter, SimpleSpanProcessor } = require("@opentelemetry/sdk-trace-base");

// Create and register an SDK
const provider = new BasicTracerProvider();
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
const provider = new BasicTracerProvider({
spanProcessors: [new SimpleSpanProcessor(new ConsoleSpanExporter())]
});
trace.setGlobalTracerProvider(provider);

// Acquire a tracer from the global tracer provider which will be used to trace the application
Expand Down
38 changes: 12 additions & 26 deletions doc/contributing/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
This document is aimed at Maintainers and describes how to release a new version of the packages contained in this repository.
We aim to eventually automate this process as much as possible.

## Create a release PR
## 1. Create a release PR

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

## Review and merge the release PR
## 2. Review and merge the release PR

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

## Publish to NPM

### Prerequisites

1. Ensure you have access to the [`opentelemetry` npm organization](https://www.npmjs.com/org/opentelemetry)
2. Go to your npm user's `Access Tokens` page
3. Click `Generate New Token` -> `Granular Access Token` (2FA prompt will pop up)
4. Input all required fields
- recommended: set the expiry date on the token to 1 day
- recommended: set a CIDR range to only allow your IP
5. Under `Packages and Scopes`
- set `Permissions` to `Read and Write`
- Select `Only Select packages and scopes`, choose `@opentelemetry`

### Publishing

1. Check out the commit created by merging the release PR
2. run `git clean -fdx --exclude <whatever you want to keep, e.g. .idea, .vscode>`
3. run `npm ci`
4. run `npm run compile`
5. run `NODE_AUTH_TOKEN=<token generated earlier> npm run release:publish`
## 3. Publish to NPM

> [!IMPORTANT]
> Delete the token once you're done publishing
> This step will publish anything that's on `main` IF AND ONLY IF the version has been bumped. If the version for a package
> has not been bumped, it will not publish a new version of the package.

1. Go to the [NPM publish workflow](https://github.com/open-telemetry/opentelemetry-js/actions/workflows/publish-to-npm.yml)
2. Click "Run workflow" (from main)
1. In rare cases not all packages are published due to a race when publishing, if you suspect this to
be the case, re-run the workflow: there should be enough time from 1.

## Create GitHub Releases
## 4. Create GitHub Releases

1. Check out the commit created by merging the release PR
2. Run
Expand Down
15 changes: 8 additions & 7 deletions examples/basic-tracer-node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ const { SEMRESATTRS_SERVICE_NAME } = require('@opentelemetry/semantic-convention
const { BasicTracerProvider, ConsoleSpanExporter, SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');
const { JaegerExporter } = require('@opentelemetry/exporter-jaeger');

// Configure span processor to send spans to the exporter
const exporter = new JaegerExporter({
endpoint: 'http://localhost:14268/api/traces',
});
const provider = new BasicTracerProvider({
resource: new Resource({
[SEMRESATTRS_SERVICE_NAME]: 'basic-service',
}),
spanProcessors: [
new SimpleSpanProcessor(exporter),
new SimpleSpanProcessor(new ConsoleSpanExporter()),
]
});

// Configure span processor to send spans to the exporter
const exporter = new JaegerExporter({
endpoint: 'http://localhost:14268/api/traces',
});
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));

/**
* Initialize the OpenTelemetry APIs to use the BasicTracerProvider bindings.
*
Expand Down
14 changes: 7 additions & 7 deletions examples/esm-http-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "esm-http-ts",
"private": true,
"version": "0.53.0",
"version": "0.54.2",
"description": "Example of HTTP integration with OpenTelemetry using ESM and TypeScript",
"main": "build/index.js",
"type": "module",
Expand Down Expand Up @@ -32,12 +32,12 @@
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/",
"dependencies": {
"@opentelemetry/api": "1.9.0",
"@opentelemetry/exporter-trace-otlp-proto": "0.53.0",
"@opentelemetry/instrumentation": "0.53.0",
"@opentelemetry/instrumentation-http": "0.53.0",
"@opentelemetry/resources": "1.26.0",
"@opentelemetry/sdk-trace-base": "1.26.0",
"@opentelemetry/sdk-trace-node": "1.26.0",
"@opentelemetry/exporter-trace-otlp-proto": "0.54.2",
"@opentelemetry/instrumentation": "0.54.2",
"@opentelemetry/instrumentation-http": "0.54.2",
"@opentelemetry/resources": "1.27.0",
"@opentelemetry/sdk-trace-base": "1.27.0",
"@opentelemetry/sdk-trace-node": "1.27.0",
"@opentelemetry/semantic-conventions": "1.27.0"
}
}
12 changes: 3 additions & 9 deletions examples/grpc-js/tracer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,15 @@ const { GrpcInstrumentation } = require('@opentelemetry/instrumentation-grpc');
const EXPORTER = process.env.EXPORTER || '';

module.exports = (serviceName) => {
const useZipkin = EXPORTER.toLowerCase().startsWith('z');
const exporter = useZipkin ? new ZipkinExporter() : new JaegerExporter();
const provider = new NodeTracerProvider({
resource: new Resource({
[SEMRESATTRS_SERVICE_NAME]: serviceName,
}),
spanProcessors: [new SimpleSpanProcessor(exporter)]
});

let exporter;
if (EXPORTER.toLowerCase().startsWith('z')) {
exporter = new ZipkinExporter();
} else {
exporter = new JaegerExporter();
}

provider.addSpanProcessor(new SimpleSpanProcessor(exporter));

// Initialize the OpenTelemetry APIs to use the NodeTracerProvider bindings
provider.register();

Expand Down
16 changes: 8 additions & 8 deletions examples/http/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "http-example",
"private": true,
"version": "0.53.0",
"version": "0.54.2",
"description": "Example of HTTP integration with OpenTelemetry",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -30,13 +30,13 @@
},
"dependencies": {
"@opentelemetry/api": "^1.3.0",
"@opentelemetry/exporter-jaeger": "1.26.0",
"@opentelemetry/exporter-zipkin": "1.26.0",
"@opentelemetry/instrumentation": "0.53.0",
"@opentelemetry/instrumentation-http": "0.53.0",
"@opentelemetry/resources": "1.26.0",
"@opentelemetry/sdk-trace-base": "1.26.0",
"@opentelemetry/sdk-trace-node": "1.26.0",
"@opentelemetry/exporter-jaeger": "1.27.0",
"@opentelemetry/exporter-zipkin": "1.27.0",
"@opentelemetry/instrumentation": "0.54.2",
"@opentelemetry/instrumentation-http": "0.54.2",
"@opentelemetry/resources": "1.27.0",
"@opentelemetry/sdk-trace-base": "1.27.0",
"@opentelemetry/sdk-trace-node": "1.27.0",
"@opentelemetry/semantic-conventions": "1.27.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/http",
Expand Down
14 changes: 4 additions & 10 deletions examples/http/tracer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,15 @@ const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http');
const EXPORTER = process.env.EXPORTER || '';

module.exports = (serviceName) => {
const useZipkin = EXPORTER.toLowerCase().startsWith('z');
const exporter = useZipkin ? new ZipkinExporter() : new JaegerExporter();
const provider = new NodeTracerProvider({
resource: new Resource({
[SEMRESATTRS_SERVICE_NAME]: serviceName,
}),
spanProcessors: [new SimpleSpanProcessor(exporter)]
});

let exporter;
if (EXPORTER.toLowerCase().startsWith('z')) {
exporter = new ZipkinExporter();
} else {
exporter = new JaegerExporter();
}

provider.addSpanProcessor(new SimpleSpanProcessor(exporter));


// Initialize the OpenTelemetry APIs to use the NodeTracerProvider bindings
provider.register();

Expand Down
Loading
Loading