From afa530382849f2424c6f6f401e586f871412e3f0 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Mon, 16 Nov 2020 09:47:33 +0530 Subject: [PATCH 01/18] add changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000..ec96f785bb --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] +### Added From 285b50cd86b29b3b613236af87696da1fc717dc7 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Mon, 16 Nov 2020 12:25:28 +0530 Subject: [PATCH 02/18] modify README.md --- README.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2c17a0cd9c..619c573915 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,36 @@ Any exceptions to this are noted in the individual `README.md` files. ## Installation -TBD +The repository layout structure is as defined by [the specification](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/library-layout.md). The `api` +directory includes header-only abstract classes and no-op implementations that comprise the OpenTelemetry API following +[the +specification](https://github.com/open-telemetry/opentelemetry-specification). +The `sdk` folder is the reference implementation of the API. + +This library would be distributed in source-only format. No shared/static library or distribution package (rpm, deb etc) would be made available as part of Release. See [CHANGELOG.md](CHANGELOG.md). + +This project supports `Bazel` and `CMake` builds. + +### Using CMake +On most platforms with all dependencies installed, the following command will compile the source files, and install the header files: -## Quick Start +```sh +cmake -Bcmake-out +cmake --build cmake-out +sudo cmake --build cmake-out --target install +#To run the tests +cd cmake-out && ctest +``` + +### Using Bazel TBD + +## QuickStart +The `examples/simple` directory contains a minimal program demonstrating +how to instrument a small library using a simple `processor` and console `exporter`, along with minimal build files - CMake and Bazel. + ## Contributing See [CONTRIBUTING.md](CONTRIBUTING.md) From 56a692f6460cdb8e1c221fe1c02507a73b362518 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Mon, 16 Nov 2020 13:31:36 +0530 Subject: [PATCH 03/18] format --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 619c573915..a4c50798d2 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ The repository layout structure is as defined by [the specification](https://git directory includes header-only abstract classes and no-op implementations that comprise the OpenTelemetry API following [the specification](https://github.com/open-telemetry/opentelemetry-specification). -The `sdk` folder is the reference implementation of the API. +The `sdk` folder is the reference implementation of the API. This library would be distributed in source-only format. No shared/static library or distribution package (rpm, deb etc) would be made available as part of Release. See [CHANGELOG.md](CHANGELOG.md). From adf97994187c82917d4f12aac822cfefb8fa9e87 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Mon, 16 Nov 2020 23:58:40 +0530 Subject: [PATCH 04/18] add pre-release script --- pre_release.sh | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 pre_release.sh diff --git a/pre_release.sh b/pre_release.sh new file mode 100644 index 0000000000..175c479aa4 --- /dev/null +++ b/pre_release.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +usage() { echo "Usage: $0 -t " 1>&2; exit 1; } + +while getopts ":t:" o; do + case "${o}" in + t) + tag=${OPTARG} + ;; + *) + usage + ;; + esac +done +if [ ! -z "${t}" ]; then + usage +fi + +#validate tag +semver_regex="^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$" +if [[ ${tag} =~ ${semver_regex} ]]; then + echo "${tag} is valid semver tag" +else + echo "Error: ${tag} is not a valid semver tag. Exiting" + exit -1 +fi + +#ensure tag doesn't exits +if [[ $(git tag --list ${tag}) ]]; then + echo "Error: Tag ${tag} already exists. Exiting" + exit -1 +fi + +if ! git diff --quiet; then \ + printf "Working tree is not clean, can't proceed with the release process\n" + #git status + #git diff + exit 1 +fi + +# check changelog exists +changelog_file="./CHANGELOG.md" +if [ ! -f $changelog_file ]; then + echo "Error: $changelog_file doesn't exist. Ensure that you are running this script from repo root directory " + exit 1 +fi + +if [ ! grep -q "## [Unreleased]" $ ]; then + echo "Error: $changelog_file doesn't contain Unreleased information. Please update the file with changes and run this script again." + exit 1 +fi + +git checkout -b pre_release_${tag} master + +sed -i "/\#\# \[Unreleased\]/a\\ \n\#\# \[${tag}\] ${date}" $changelog_file +if [ $? -ne 0 ]; then + echo "Error: Cannot update CHANGELOG.md file. Update it manually, create the ${tag} and push changes to upstream" + exit 1 +fi + +git add . +git commit -m "Prepare for releasing ${tag}" + +echo "Now validate the chages using git diff master, create the ${tag} and push changes to upstream" +echo From 8e3e0317628558c4bb6813b1828fd1c96cec8c96 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 17 Nov 2020 00:01:55 +0530 Subject: [PATCH 05/18] format script --- pre_release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre_release.sh b/pre_release.sh index 175c479aa4..a740dc809c 100644 --- a/pre_release.sh +++ b/pre_release.sh @@ -62,4 +62,4 @@ git add . git commit -m "Prepare for releasing ${tag}" echo "Now validate the chages using git diff master, create the ${tag} and push changes to upstream" -echo +echo From e5cc673a6cc39287663a5770d8208de7a941d832 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 17 Nov 2020 00:04:14 +0530 Subject: [PATCH 06/18] add error check --- pre_release.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pre_release.sh b/pre_release.sh index a740dc809c..ad8f0c0d99 100644 --- a/pre_release.sh +++ b/pre_release.sh @@ -51,6 +51,10 @@ if [ ! grep -q "## [Unreleased]" $ ]; then fi git checkout -b pre_release_${tag} master +if [ $? -ne 0]; then + echo "Error: Cannot create release branch. Ensure you have sufficient permissions to repo and try again." + exit 1 +fi sed -i "/\#\# \[Unreleased\]/a\\ \n\#\# \[${tag}\] ${date}" $changelog_file if [ $? -ne 0 ]; then From a1c70e22c637dc0438f318e7834a4c0e71a4497a Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 17 Nov 2020 00:34:26 +0530 Subject: [PATCH 07/18] add release steps --- RELEASING.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 RELEASING.md diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 0000000000..dbd8015c7a --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,44 @@ +# Release Process + +## Pre Release + +1. Make sure all relevant changes for this release are included under `Unreleased` section in `CHANGELOG.md` and are in language that non-contributors to the project can understand. + +2. Run the pre-release script. It creates a branch `pre_release_` and updates `CHANGELOG.md` with the ``: + ``` + ./pre_release.sh -t + ``` + +3. Verify that CHANGELOG.md is updated properly: + ``` + git diff master + ``` + +4. Push the changes to upstream and create a Pull Request on GitHub. + Be sure to include the curated changes from the [Changelog](./CHANGELOG.md) in the description. + + +## Tag + +Once the above Pull Request has been approved and merged it is time to tag the merged commit. + +***IMPORTANT***: It is critical you use the same tag that you used in the Pre-Release step! +Failure to do so will leave things in a broken state. + +1. Note down the commit hash of the master branch after above PR request is merged : + ``` + git show -s --format=%H + ``` + +2. Create a github tag on this commit hash: + ``` + git tag -a "" -s -m "Version " "" + ``` + +3. Push tag to upstream remote + ``` + git push upstream + ``` + +## Release +Finally create a Release for the new on GitHub. The release body should include all the release notes from the Changelog for this release. \ No newline at end of file From 254ffe7cb4ff86d79cc1b2f3c512353aac22204b Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 17 Nov 2020 00:55:29 +0530 Subject: [PATCH 08/18] fix script --- README.md | 2 +- pre_release.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a4c50798d2..6ac44393b9 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ directory includes header-only abstract classes and no-op implementations that c specification](https://github.com/open-telemetry/opentelemetry-specification). The `sdk` folder is the reference implementation of the API. -This library would be distributed in source-only format. No shared/static library or distribution package (rpm, deb etc) would be made available as part of Release. See [CHANGELOG.md](CHANGELOG.md). +This library would be distributed in source-only format. No shared/static library or distribution package (rpm, deb etc) would be made available as part of Release. See [RELEASING.md](./RELEASING.md). This project supports `Bazel` and `CMake` builds. diff --git a/pre_release.sh b/pre_release.sh index ad8f0c0d99..bd6d988e3d 100644 --- a/pre_release.sh +++ b/pre_release.sh @@ -45,13 +45,13 @@ if [ ! -f $changelog_file ]; then exit 1 fi -if [ ! grep -q "## [Unreleased]" $ ]; then +if [ ! grep -q "## [Unreleased]" $changelog_file ]; then echo "Error: $changelog_file doesn't contain Unreleased information. Please update the file with changes and run this script again." exit 1 fi git checkout -b pre_release_${tag} master -if [ $? -ne 0]; then +if [ $? -ne 0 ]; then echo "Error: Cannot create release branch. Ensure you have sufficient permissions to repo and try again." exit 1 fi From f95ce0812664db4010bd428701f75c87235ee904 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 17 Nov 2020 01:02:43 +0530 Subject: [PATCH 09/18] fix changelog format --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec96f785bb..726419a4c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,3 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added + * Trace API and SDK + * OTLP Exporter +### Changed +### Removed \ No newline at end of file From 843c52df8b4f9275a82e971b6427a956930a9792 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 17 Nov 2020 01:15:09 +0530 Subject: [PATCH 10/18] fix readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6ac44393b9..b66e633008 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ directory includes header-only abstract classes and no-op implementations that c specification](https://github.com/open-telemetry/opentelemetry-specification). The `sdk` folder is the reference implementation of the API. -This library would be distributed in source-only format. No shared/static library or distribution package (rpm, deb etc) would be made available as part of Release. See [RELEASING.md](./RELEASING.md). +The library would be distributed in source-only format. No shared/static library or distribution package (rpm, deb etc) would be made available as part of Release. See [RELEASING.md](./RELEASING.md). This project supports `Bazel` and `CMake` builds. @@ -48,7 +48,7 @@ TBD ## QuickStart The `examples/simple` directory contains a minimal program demonstrating -how to instrument a small library using a simple `processor` and console `exporter`, along with minimal build files - CMake and Bazel. +how to instrument a small library using a simple `processor` and console `exporter`, along with build files for CMake and Bazel. ## Contributing From 5cf3ebe038c3dfa7583b7d31780612dbdfb0d2b4 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 17 Nov 2020 01:26:33 +0530 Subject: [PATCH 11/18] remove new line --- RELEASING.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/RELEASING.md b/RELEASING.md index dbd8015c7a..c4a111fdbf 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -8,16 +8,13 @@ ``` ./pre_release.sh -t ``` - 3. Verify that CHANGELOG.md is updated properly: ``` git diff master ``` - 4. Push the changes to upstream and create a Pull Request on GitHub. Be sure to include the curated changes from the [Changelog](./CHANGELOG.md) in the description. - ## Tag Once the above Pull Request has been approved and merged it is time to tag the merged commit. @@ -29,11 +26,9 @@ Failure to do so will leave things in a broken state. ``` git show -s --format=%H ``` - 2. Create a github tag on this commit hash: ``` git tag -a "" -s -m "Version " "" - ``` 3. Push tag to upstream remote ``` @@ -41,4 +36,4 @@ Failure to do so will leave things in a broken state. ``` ## Release -Finally create a Release for the new on GitHub. The release body should include all the release notes from the Changelog for this release. \ No newline at end of file +Finally create a Release for the new on GitHub. The release body should include all the release notes from the Changelog for this release. From c0ea1fd587e1be0d99a97d639a1f82994515000c Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 17 Nov 2020 01:40:32 +0530 Subject: [PATCH 12/18] fix script --- pre_release.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pre_release.sh b/pre_release.sh index bd6d988e3d..0d1966ea82 100644 --- a/pre_release.sh +++ b/pre_release.sh @@ -33,8 +33,8 @@ fi if ! git diff --quiet; then \ printf "Working tree is not clean, can't proceed with the release process\n" - #git status - #git diff + git status + git diff exit 1 fi @@ -56,8 +56,10 @@ if [ $? -ne 0 ]; then exit 1 fi +#update CHANGELOG.md +date=$(date '+%Y-%m-%d') sed -i "/\#\# \[Unreleased\]/a\\ \n\#\# \[${tag}\] ${date}" $changelog_file -if [ $? -ne 0 ]; then +if [$? -ne 0]; then echo "Error: Cannot update CHANGELOG.md file. Update it manually, create the ${tag} and push changes to upstream" exit 1 fi From 6b229eb4814616566861742714219daa20f78c3a Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 17 Nov 2020 22:28:52 +0530 Subject: [PATCH 13/18] Update pre_release.sh Co-authored-by: Reiley Yang --- pre_release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre_release.sh b/pre_release.sh index 0d1966ea82..81fd872ec0 100644 --- a/pre_release.sh +++ b/pre_release.sh @@ -56,7 +56,7 @@ if [ $? -ne 0 ]; then exit 1 fi -#update CHANGELOG.md +# update CHANGELOG.md date=$(date '+%Y-%m-%d') sed -i "/\#\# \[Unreleased\]/a\\ \n\#\# \[${tag}\] ${date}" $changelog_file if [$? -ne 0]; then From a1dc924764e785aa658764fc8c559a57e818ef8d Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 17 Nov 2020 23:25:45 +0530 Subject: [PATCH 14/18] add install.md template --- INSTALL.md | 1 + README.md | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 INSTALL.md diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000000..802ac1f6af --- /dev/null +++ b/INSTALL.md @@ -0,0 +1 @@ +## TODO diff --git a/README.md b/README.md index b66e633008..6cdc9801af 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,8 @@ sudo cmake --build cmake-out --target install cd cmake-out && ctest ``` +For more details on configuration and installation steps, please refer to [INSTALL.md](./INSTALL.md). + ### Using Bazel TBD From 9c109693808414df45d5a12e2d010b3370bb077b Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 17 Nov 2020 23:36:33 +0530 Subject: [PATCH 15/18] update README with deployment structore --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6cdc9801af..57fdaf307f 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,18 @@ sudo cmake --build cmake-out --target install cd cmake-out && ctest ``` -For more details on configuration and installation steps, please refer to [INSTALL.md](./INSTALL.md). +In case the library is distributed through package manager, below is the recommended deployment directory structure for header and librarie(s) on Linux and MacOS platforms. + +``` +/usr/local/lib: For shared or static opentelemetry-cpp library +/usr/local/include/opentelemetry: For api headers +/usr/local/include/opentelemetry/sdk: For sdk headers +/usr/local/src: For installing source package ( say libopentelemetry-dev ) + +``` + +For more details on configuration and installation, please refer to [INSTALL.md](./INSTALL.md). + ### Using Bazel TBD From 66f1b429af2e66c0f665be81d5566177233f5e4c Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 17 Nov 2020 23:53:48 +0530 Subject: [PATCH 16/18] fix script --- pre_release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre_release.sh b/pre_release.sh index 81fd872ec0..5765fb5ef9 100644 --- a/pre_release.sh +++ b/pre_release.sh @@ -32,7 +32,7 @@ if [[ $(git tag --list ${tag}) ]]; then fi if ! git diff --quiet; then \ - printf "Working tree is not clean, can't proceed with the release process\n" + echo "Error: Working tree is not clean, can't proceed with the release process\n" git status git diff exit 1 From 2fcd4b3068a5374f6958842c11878106429abb10 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Wed, 18 Nov 2020 00:26:08 +0530 Subject: [PATCH 17/18] Update README.md Co-authored-by: Johannes Tax --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 57fdaf307f..85defaf85f 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ directory includes header-only abstract classes and no-op implementations that c specification](https://github.com/open-telemetry/opentelemetry-specification). The `sdk` folder is the reference implementation of the API. -The library would be distributed in source-only format. No shared/static library or distribution package (rpm, deb etc) would be made available as part of Release. See [RELEASING.md](./RELEASING.md). +The library is distributed in source-only format. No shared/static library or distribution packages (rpm, deb, etc.) are made available as part of Release. See [RELEASING.md](./RELEASING.md). This project supports `Bazel` and `CMake` builds. From fdb7122aa2ddedeea0a8e53cb8e2dad6d7fccb4d Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Wed, 18 Nov 2020 19:37:01 +0530 Subject: [PATCH 18/18] remove install info --- README.md | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/README.md b/README.md index 85defaf85f..ef6f18135a 100644 --- a/README.md +++ b/README.md @@ -20,44 +20,7 @@ Any exceptions to this are noted in the individual `README.md` files. ## Installation -The repository layout structure is as defined by [the specification](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/library-layout.md). The `api` -directory includes header-only abstract classes and no-op implementations that comprise the OpenTelemetry API following -[the -specification](https://github.com/open-telemetry/opentelemetry-specification). -The `sdk` folder is the reference implementation of the API. - -The library is distributed in source-only format. No shared/static library or distribution packages (rpm, deb, etc.) are made available as part of Release. See [RELEASING.md](./RELEASING.md). - -This project supports `Bazel` and `CMake` builds. - -### Using CMake -On most platforms with all dependencies installed, the following command will compile the source files, and install the header files: - -```sh -cmake -Bcmake-out -cmake --build cmake-out -sudo cmake --build cmake-out --target install - -#To run the tests -cd cmake-out && ctest -``` - -In case the library is distributed through package manager, below is the recommended deployment directory structure for header and librarie(s) on Linux and MacOS platforms. - -``` -/usr/local/lib: For shared or static opentelemetry-cpp library -/usr/local/include/opentelemetry: For api headers -/usr/local/include/opentelemetry/sdk: For sdk headers -/usr/local/src: For installing source package ( say libopentelemetry-dev ) - -``` - -For more details on configuration and installation, please refer to [INSTALL.md](./INSTALL.md). - - -### Using Bazel -TBD - +Please refer to [INSTALL.md](./INSTALL.md). ## QuickStart The `examples/simple` directory contains a minimal program demonstrating