Skip to content

Commit

Permalink
Merge branch 'main' into hectorhdzg/delmetprov
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorhdzg authored Aug 8, 2024
2 parents 55fe566 + 01cea7c commit 21f75c1
Show file tree
Hide file tree
Showing 111 changed files with 12,722 additions and 1,912 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/create-or-update-release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Create or Update Release PR

on:
workflow_dispatch:
inputs:
release_type:
type: choice
description: Release type
options:
- patch
- minor
release_scope:
type: choice
description: Release Scope
options:
- experimental
- sdk
- all

jobs:
create-or-update-release-pr:
runs-on: ubuntu-latest
steps:
- name: Fork
run: gh repo fork open-telemetry/opentelemetry-js
env:
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v4
with:
repository: opentelemetrybot/opentelemetry-js
ref: main
token: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
- name: Sync with upstream
run: |
git remote show origin
git remote add upstream https://github.com/open-telemetry/opentelemetry-js.git
git fetch upstream
git reset --hard upstream/main
git push origin main --force
- uses: actions/setup-node@v4
with:
cache: 'npm'
cache-dependency-path: package-lock.json
node-version: 22
- run: npm install -g npm@latest

- run: npm ci

- name: Create/Update Release PR
run: |
git config user.name opentelemetrybot
git config user.email 107717825+opentelemetrybot@users.noreply.github.com
npm run github:create_or_update_release_pr
env:
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
RELEASE_SCOPE: ${{ github.event.inputs.release_scope }}
RELEASE_KIND: ${{ github.event.inputs.release_scope }}:${{ github.event.inputs.release_type }}
RELEASE_PR_REMOTE: origin
RELEASE_PR_OWNER: opentelemetrybot
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/

### :rocket: (Enhancement)

* feat: include instrumentation scope info in console span and log record exporters [#4848](https://github.com/open-telemetry/opentelemetry-js/pull/4848) @blumamir
* feat(semconv): update semantic conventions to 1.27 (from 1.7.0) [#4690](https://github.com/open-telemetry/opentelemetry-js/pull/4690) @dyladan
* Exported names have changed to `ATTR_{name}` for attributes (e.g. `ATTR_HTTP_REQUEST_METHOD`), `{name}_VALUE_{value}` for enumeration values (e.g. `HTTP_REQUEST_METHOD_VALUE_POST`), and `METRIC_{name}` for metrics. Exported names from previous versions are deprecated.
* Import `@opentelemetry/semantic-conventions` for *stable* semantic conventions. Import `@opentelemetry/semantic-conventions/incubating` for all semantic conventions, stable and unstable.

### :bug: (Bug Fix)

* fix(sdk-node): avoid spurious diag errors for unknown OTEL_NODE_RESOURCE_DETECTORS values [#4879](https://github.com/open-telemetry/opentelemetry-js/pull/4879) @trentm
* deps(opentelemetry-instrumentation): Bump `shimmer` types to 1.2.0 [#4865](https://github.com/open-telemetry/opentelemetry-js/pull/4865) @lforst

### :books: (Refine Doc)

### :house: (Internal)
Expand Down
4 changes: 2 additions & 2 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@
"@types/sinon": "17.0.3",
"@types/webpack": "5.28.5",
"@types/webpack-env": "1.16.3",
"babel-plugin-istanbul": "6.1.1",
"babel-plugin-istanbul": "7.0.0",
"codecov": "3.8.3",
"cross-var": "1.1.0",
"dpdm": "3.13.1",
"karma": "6.4.3",
"karma": "6.4.4",
"karma-chrome-launcher": "3.1.0",
"karma-coverage": "2.2.1",
"karma-mocha": "2.0.1",
Expand Down
184 changes: 61 additions & 123 deletions doc/contributing/releasing.md
Original file line number Diff line number Diff line change
@@ -1,123 +1,61 @@
# Releasing OpenTelemetry Packages

This document explains how to publish all OT modules at version x.y.z. Ensure that you’re following semver when choosing a version number.

Release Process:

- [Release Process (Maintainers only)](#release-process)
- [Update to latest locally](#update-to-latest-locally)
- [Create a new branch](#create-a-new-branch)
- [Prepare each package for release](#prepare-each-package-for-release)
- [Use the Changelog to create a GitHub Release](#use-the-changelog-to-create-a-github-release)
- [Generate the changelog with lerna](#generate-the-changelog-with-lerna)
- [How to use](#how-to-use)
- [Update Changelog file](#update-changelog-file)
- [Create a new PR](#create-a-new-pr)
- [Merge and pull](#merge-and-pull)
- [Publish all packages](#publish-all-packages)
- [Publish the GitHub Release](#publish-the-github-release)
- [Update CHANGELOG](#update-changelog)
- [Known Issues](#known-issues)

## Release Process

### Update to latest locally

Use `git fetch` and `git checkout origin/main` to ensure you’re on the latest commit. Make sure you have no unstaged changes. Ideally, also use `git clean -dfx` to remove all ignored and untracked files.

### Create a new branch

Create a new branch called `x.y.z-proposal` from the current commit.

### Prepare each package for release

Decide on the next `major.minor.patch` release number based on [semver](http://semver.org/) guidelines.

- Use `npm install` command to initialize all package directories
- Use `lerna publish --skip-npm --no-git-tag-version --no-push` to bump the version in all `package.json`
- Use `npm run bootstrap` to generate latest `version.ts` files

### Use the Changelog to create a GitHub Release

#### Generate the changelog with lerna

Since we use `lerna`, we can use [lerna-changelog](https://github.com/lerna/lerna-changelog#lerna-changelog)

##### How to use

Pass your [github token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) to generate the changelog automatically.
For security reasons, when you create a Github token, select the permissions: under **repo**, select **Access public repositories**, **Access commit status**.

In your terminal, execute the following command:

```bash
GITHUB_AUTH=<your token> lerna-changelog
```

It will print something like:

```md
### Unreleased (2018-05-24)

##### :bug: Bug Fix
* [#198](https://github.com/my-org/my-repo/pull/198) Avoid an infinite loop ([@helpful-hacker](https://github.com/helpful-hacker))

##### :house: Internal
* [#183](https://github.com/my-org/my-repo/pull/183) Standardize error messages ([@careful-coder](https://github.com/careful-coder))

##### Commiters: 2
- Helpful Hacker ([@helpful-hacker](https://github.com/helpful-hacker))
- [@careful-coder](https://github.com/careful-coder)
```

By default lerna-changelog will show all pull requests that have been merged since the latest tagged commit in the repository. That is however only true for pull requests **with certain labels applied** (see [lerna.json](lerna.json) for authorized labels).

You can also use the `--from` and `--to` options to view a different range of pull requests:

```sh
GITHUB_AUTH=xxxxx lerna-changelog --from=v1.0.0 --to=v2.0.0
```

##### Update Changelog file

From what `lerna-changelog` has generated, starts new Unreleased label. Follow the example set by recent Released label.

On [GitHub Releases](https://github.com/open-telemetry/opentelemetry-js/releases), follow the example set by recent releases to populate a summary of changes, as well as a list of commits that were applied since the last release. Save it as a draft, don’t publish it. Don’t forget the tag -- call it `vx.y.z` and leave it pointing at `main` for now (this can be changed as long as the GitHub release isn’t published).

### Create a new PR

Create a pull request titled `chore: x.y.z release proposal`. The commit body should just be a link to the draft notes. Someone who can access draft notes should approve it, looking in particular for test passing, and whether the draft notes are satisfactory.

### Merge and pull

Merge the PR, and pull the changes locally (using the commands in the first step). Ensure that `chore: x.y.z release proposal` is the most recent commit.

### Publish all packages

Go into each directory and use `npm publish` (requires permissions) to publish the package. You can use the following script to automate this.

```bash
#!/bin/bash

for dir in $(ls packages); do
pushd packages/$dir
npm publish
popd
done
```

Check your e-mail and make sure the number of “you’ve published this module” emails matches the number you expect.

### Publish the GitHub Release

Publish the GitHub release, ensuring that the tag points to the newly landed commit corresponding to release proposal `x.y.z`.

### Update CHANGELOG

- After releasing is done, update the [CHANGELOG.md](https://github.com/open-telemetry/opentelemetry-js/blob/main/CHANGELOG.md) and start new Unreleased label.
- Create a new commit with the exact title: `Post Release: update CHANGELOG.md`.
- Go through PR review and merge it to GitHub main branch.

### Known Issues

- The `examples/` and `getting-started/` folders are not part of lerna packages, we need to manually bump the version in `package.json`.
# Releasing

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. Go to the [Release PR Workflow](https://github.com/open-telemetry/opentelemetry-js/actions/workflows/create-or-update-release.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
- `experimental` (all packages under `./experimental/packages`)
- `sdk` (all packages under `./packages/` and `./experimental/packages`)
- `all` (all packages under `./api/`, `./packages/` and `./experimental/packages`)

> [!TIP]
> 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

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`

> [!IMPORTANT]
> Delete the token once you're done publishing
## Create GitHub Releases

1. Check out the commit created by merging the release PR
2. Run
- `npm run _github:draft_release:experimental`, if you published an `all`, `sdk` or `experimental` release
- `npm run _github:draft_release:stable`, if you published an `all` or `sdk` release
- `npm run _github:draft_release:api` if you published an `all` release
3. Verify that the contents of the created draft releases (title, changelog, selected commit)
4. Publish the releases
- uncheck `Set as a pre-release` for all releases
- uncheck `Set as the latest release` for all releases except for the `stable` SDK release. This will ensure that the
`stable` SDK release consistently shows up as latest under `Releases` when navigating to the project page.
15 changes: 14 additions & 1 deletion experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,24 @@ All notable changes to experimental packages in this project will be documented
### :boom: Breaking Change

* fix(instrumentation)!:remove unused description property from interface [#4847](https://github.com/open-telemetry/opentelemetry-js/pull/4847) @blumamir
* feat(exporter-*-otlp-*)!: use transport interface in node.js exporters [#4743](https://github.com/open-telemetry/opentelemetry-js/pull/4743) @pichlermarc
* (user-facing) `headers` was intended for internal use has been removed from all exporters
* (user-facing) `compression` was intended for internal use and has been removed from all exporters
* (user-facing) `hostname` was intended for use in tests and is not used by any exporters, it will be removed in a future release
* fix(exporter-*-otlp-*)!: ensure `User-Agent` header cannot be overwritten by the user [#4743](https://github.com/open-telemetry/opentelemetry-js/pull/4743) @pichlermarc
* allowing overrides of the `User-Agent` header was not specification compliant.
* feat(exporter-*-otlp*)!: remove environment-variable specific code from browser exporters
* (user-facing) removes the ability to configure browser exporters by using `process.env` polyfills

### :rocket: (Enhancement)

* feat(otlp-transformer): Do not limit @opentelemetry/api upper range peerDependency [#4816](https://github.com/open-telemetry/opentelemetry-js/pull/4816) @mydea
* feat(instrumentation-http): Allow to opt-out of instrumenting incoming/outgoing requests [#4643](https://github.com/open-telemetry/opentelemetry-js/pull/4643) @mydea

### :bug: (Bug Fix)

* fix(instrumentation-http): Ensure instrumentation of `http.get` and `https.get` work when used in ESM code [#4857](https://github.com/open-telemetry/opentelemetry-js/issues/4857) @trentm

### :books: (Refine Doc)

### :house: (Internal)
Expand Down Expand Up @@ -75,7 +88,7 @@ All notable changes to experimental packages in this project will be documented

### :bug: (Bug Fix)

* fix(instrumentation): Update `import-in-the-middle` to fix [numerous bugs](https://github.com/DataDog/import-in-the-middle/releases/tag/v1.8.0) [#4745](https://github.com/open-telemetry/opentelemetry-js/pull/4745) @timfish
* fix(instrumentation): Update `import-in-the-middle` to fix [numerous bugs](https://github.com/DataDog/import-in-the-middle/pull/91) [#4745](https://github.com/open-telemetry/opentelemetry-js/pull/4745) @timfish

### :books: (Refine Doc)

Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/api-events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
"@types/mocha": "10.0.7",
"@types/node": "18.6.5",
"@types/webpack-env": "1.16.3",
"babel-plugin-istanbul": "6.1.1",
"babel-plugin-istanbul": "7.0.0",
"codecov": "3.8.3",
"cross-var": "1.1.0",
"karma": "6.4.3",
"karma": "6.4.4",
"karma-chrome-launcher": "3.1.0",
"karma-coverage": "2.2.1",
"karma-mocha": "2.0.1",
Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/api-logs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@
"@types/mocha": "10.0.7",
"@types/node": "18.6.5",
"@types/webpack-env": "1.16.3",
"babel-plugin-istanbul": "6.1.1",
"babel-plugin-istanbul": "7.0.0",
"codecov": "3.8.3",
"cross-var": "1.1.0",
"karma": "6.4.3",
"karma": "6.4.4",
"karma-chrome-launcher": "3.1.0",
"karma-coverage": "2.2.1",
"karma-mocha": "2.0.1",
Expand Down
6 changes: 3 additions & 3 deletions experimental/packages/exporter-logs-otlp-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
],
"sideEffects": false,
"devDependencies": {
"@babel/core": "7.24.7",
"@babel/core": "7.24.9",
"@babel/preset-env": "7.24.7",
"@opentelemetry/api": "1.9.0",
"@opentelemetry/resources": "1.25.1",
Expand All @@ -81,10 +81,10 @@
"@types/sinon": "17.0.3",
"@types/webpack-env": "1.16.3",
"babel-loader": "8.3.0",
"babel-plugin-istanbul": "6.1.1",
"babel-plugin-istanbul": "7.0.0",
"codecov": "3.8.3",
"cross-var": "1.1.0",
"karma": "6.4.3",
"karma": "6.4.4",
"karma-chrome-launcher": "3.1.0",
"karma-coverage": "2.2.1",
"karma-mocha": "2.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import type {
import type { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';
import type { IExportLogsServiceResponse } from '@opentelemetry/otlp-transformer';
import { OTLPExporterBrowserBase } from '@opentelemetry/otlp-exporter-base';
import { baggageUtils, getEnv } from '@opentelemetry/core';
import { JsonLogsSerializer } from '@opentelemetry/otlp-transformer';

import { getDefaultUrl } from '../config';
Expand All @@ -34,21 +33,13 @@ export class OTLPLogExporter
implements LogRecordExporter
{
constructor(config: OTLPExporterConfigBase = {}) {
// load OTEL_EXPORTER_OTLP_LOGS_TIMEOUT env var
super(
{
timeoutMillis: getEnv().OTEL_EXPORTER_OTLP_LOGS_TIMEOUT,
...config,
},
JsonLogsSerializer,
'application/json'
);
this._headers = {
...this._headers,
...baggageUtils.parseKeyPairsIntoRecord(
getEnv().OTEL_EXPORTER_OTLP_LOGS_HEADERS
),
};
}

getDefaultUrl(config: OTLPExporterConfigBase): string {
Expand Down
Loading

0 comments on commit 21f75c1

Please sign in to comment.