Skip to content

Commit

Permalink
Merge branch 'main' into gh-action-add-npm-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
trentm authored Nov 30, 2023
2 parents 49b33f4 + 593d220 commit a085295
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 29 deletions.
12 changes: 3 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,16 +365,8 @@ There are no changes between 1.0.0 and the previous 0.33.0 version.

* fix(sdk-web): parse url with relative url string [#2972](https://github.com/open-telemetry/opentelemetry-js/pull/2972) @legendecas

### :books: (Refine Doc)

### :house: (Internal)

## 1.2.0

### :boom: Breaking Change

### :rocket: (Enhancement)

### :bug: (Bug Fix)

* fix: sanitize attributes inputs [#2881](https://github.com/open-telemetry/opentelemetry-js/pull/2881) @legendecas
Expand Down Expand Up @@ -2290,7 +2282,9 @@ Released 2020-03-19

Released 2020-03-16

### This is a first official beta release, which provides almost fully complete metrics, tracing, and context propagation functionality but makes no promises around breaking changes
### First official beta release

* provides almost fully complete metrics, tracing, and context propagation functionality but makes **no promises** around breaking changes

### :boom: Breaking Change

Expand Down
15 changes: 1 addition & 14 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ All notable changes to experimental packages in this project will be documented
* fix(sdk-logs): avoid map attribute set when count limit exceeded
* fix(instrumentation-fetch): only access navigator if it is defined [#4063](https://github.com/open-telemetry/opentelemetry-js/pull/4063)
* allows for experimental usage of this instrumentation with non-browser runtimes

### :books: (Refine Doc)

### :house: (Internal)
* fix(instrumentation-http): memory leak when responses are not resumed

## 0.45.1

Expand Down Expand Up @@ -183,8 +180,6 @@ All notable changes to experimental packages in this project will be documented

* doc(instrumentation): add limitiations section to readme [#3786](https://github.com/open-telemetry/opentelemetry-js/pull/3786) @flarna

### :house: (Internal)

## 0.38.0

### :boom: Breaking Change
Expand Down Expand Up @@ -401,10 +396,6 @@ All notable changes to experimental packages in this project will be documented
* fix(histogram): fix maximum when only values < -1 are provided [#3086](https://github.com/open-telemetry/opentelemetry-js/pull/3086) @pichlermarc
* fix(instrumentation-grpc): always set grpc semcov status code attribute with numeric value [#3076](https://github.com/open-telemetry/opentelemetry-js/pull/3076) @blumamir

### :books: (Refine Doc)

### :house: (Internal)

## 0.30.0

### :boom: Breaking Change
Expand Down Expand Up @@ -479,10 +470,6 @@ All notable changes to experimental packages in this project will be documented
* fix(metrics): specification compliant default metric unit [#2983](https://github.com/open-telemetry/opentelemetry-js/pull/2983) @andyfleming
* fix(opentelemetry-instrumentation): use all provided patches for the same file [#2963](https://github.com/open-telemetry/opentelemetry-js/pull/2963) @Ugzuzg

### :books: (Refine Doc)

### :house: (Internal)

## 0.28.0

### :boom: Breaking Change
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ export class HttpInstrumentation extends InstrumentationBase<Http> {
'response',
(response: http.IncomingMessage & { aborted?: boolean }) => {
this._diag.debug('outgoingRequest on response()');
if (request.listenerCount('response') <= 1) {
response.resume();
}
const responseAttributes =
utils.getOutgoingRequestAttributesOnResponse(response);
span.setAttributes(responseAttributes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function sendRequestTwice(
port: number
): Promise<Buffer> {
return new Promise((resolve, reject) => {
const request = 'GET /raw HTTP/1.1\n\n';
const request = `GET /raw HTTP/1.1\r\nHost: ${host}:${port}\r\n\r\n`;
const socket = net.createConnection({ host, port }, () => {
socket.write(`${request}${request}`, err => {
if (err) reject(err);
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@

"comment_prepare_1": "echo scripts in this section automatically prepare releases. Intended for use by maintainers only.",
"comment_prepare_2": "echo experimental preparation scripts only prepare experimental packages",
"prepare_release:experimental:patch": "npm run _check:no_changes && npm run _backup:package-json && npm run _lerna:remove_api && npm run _lerna:remove_stable && npm run _lerna:version_patch && npm run _restore:package-json",
"prepare_release:experimental:minor": "npm run _check:no_changes && npm run _backup:package-json && npm run _lerna:remove_api && npm run _lerna:remove_stable && npm run _lerna:version_minor && npm run _restore:package-json",
"prepare_release:experimental:patch": "npm run _check:no_changes && npm run _backup:package-json && npm run _lerna:remove_api && npm run _lerna:remove_stable && npm run _lerna:version_patch && npm run _restore:package-json && npm run _changelog:prepare_experimental",
"prepare_release:experimental:minor": "npm run _check:no_changes && npm run _backup:package-json && npm run _lerna:remove_api && npm run _lerna:remove_stable && npm run _lerna:version_minor && npm run _restore:package-json && npm run _changelog:prepare_experimental",
"comment_prepare_3": "echo sdk preparation scripts prepare all stable and experimental packages",
"prepare_release:sdk:patch": "npm run _check:no_changes && npm run _backup:package-json && npm run _lerna:remove_api && npm run _lerna:version_patch && npm run _restore:package-json",
"prepare_release:sdk:minor": "npm run _check:no_changes && npm run _backup:package-json && npm run _lerna:remove_api && npm run _lerna:version_minor && npm run _restore:package-json",
"prepare_release:sdk:patch": "npm run _check:no_changes && npm run _backup:package-json && npm run _lerna:remove_api && npm run _lerna:version_patch && npm run _restore:package-json && npm run _changelog:prepare_experimental && npm run _changelog:prepare_stable",
"prepare_release:sdk:minor": "npm run _check:no_changes && npm run _backup:package-json && npm run _lerna:remove_api && npm run _lerna:version_minor && npm run _restore:package-json && npm run _changelog:prepare_experimental && npm run _changelog:prepare_stable",
"release:publish": "lerna publish from-package --no-push --no-private --no-git-tag-version --no-verify-access",

"comment_internal": "echo scripts below this line are for internal use",
Expand All @@ -51,7 +51,9 @@
"_lerna:remove_api": "node -e 'var fs=require(\"fs\");var p=require(\"./package.json\");p.workspaces=p.workspaces.filter(p=>p!==\"api\");fs.writeFileSync(\"package.json\",JSON.stringify(p,null,2))'",
"_lerna:remove_stable": "node -e 'var fs=require(\"fs\");var p=require(\"./package.json\");p.workspaces=p.workspaces.filter(p=>p!==\"packages/*\");fs.writeFileSync(\"package.json\",JSON.stringify(p,null,2))'",
"_lerna:version_patch": "npx lerna version patch --exact --no-git-tag-version --no-push --yes",
"_lerna:version_minor": "npx lerna version minor --exact --no-git-tag-version --no-push --yes"
"_lerna:version_minor": "npx lerna version minor --exact --no-git-tag-version --no-push --yes",
"_changelog:prepare_experimental": "node scripts/update-changelog.js ./experimental/CHANGELOG.md ./experimental/packages/",
"_changelog:prepare_stable": "node scripts/update-changelog.js ./CHANGELOG.md ./packages/"
},
"repository": "open-telemetry/opentelemetry-js",
"keywords": [
Expand Down
65 changes: 65 additions & 0 deletions scripts/update-changelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* This script updates changelogs after lerna has updated versions in the respective areas (packages/*, experimental/packages/*)
* - removes all empty subsections (bugs, enhancements, etc.) in the changelog.
* - replaces the "Unreleased"-header with the version from the first non-private package in the directory (versions are expected to be uniform across a changelog)
* - adds a new "Unreleased"-header with empty subsections at the top
*
* Usage (from project root):
* - node scripts/update-changelog.js [PATH TO CHANGELOG] [DIRECTORY CONTAINING ASSOCIATED PACKAGES]
* Examples:
* - node scripts/update-changelog.js ./CHANGELOG.md ./packages
* - node scripts/update-changelog.js ./experimental/CHANGELOG.md ./experimental/packages
*/

const fs = require('fs');
const path = require("path");

const EMPTY_UNRELEASED_SECTION = `## Unreleased
### :boom: Breaking Change
### :rocket: (Enhancement)
### :bug: (Bug Fix)
### :books: (Refine Doc)
### :house: (Internal)
`

function findFirstPackageVersion(basePath){
const packageDirs = fs.readdirSync(basePath);
for(const packageDir of packageDirs){
const packageJsonPath = path.join(basePath, packageDir, 'package.json');
try {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));

if(packageJson.private === true || packageJson.private === 'true'){
console.log('Skipping version from private package at', packageJsonPath);
continue;
}

if(packageJson.version != null){
return packageJson.version;
}

console.log('Version in', packageJsonPath, 'was null or undefined, skipping');
} catch (err) {
console.log('Could not get package JSON', packageJsonPath, err);
}
}
throw new Error('Unable to extract version from packages in ' + basePath);
}

// no special handling for bad args as this is only intended for use via predefined npm scripts.
const changelogPath = path.resolve(process.argv[2]);
const version = findFirstPackageVersion(path.resolve(process.argv[3]));

const changelog = fs.readFileSync(changelogPath, 'utf8').toString()
// replace all empty sections
.replace(new RegExp('^###.*\n*(?=^##)', 'gm'), '')
// replace unreleased header with new unreleased section and a version header for the former unreleased section
.replace(RegExp('## Unreleased'), EMPTY_UNRELEASED_SECTION + '## ' + version);

fs.writeFileSync(changelogPath, changelog);

0 comments on commit a085295

Please sign in to comment.