From cb3eac9a11523933fe51b4fe6c678259c53e4878 Mon Sep 17 00:00:00 2001 From: lakshankarunathilake Date: Wed, 27 Apr 2022 13:53:10 +0530 Subject: [PATCH 1/8] Add readme file --- README.md | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 102 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 372d33b..0cbf605 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,102 @@ -# module-ballerina-observe -Ballerina observability components exposed for users + +Ballerina Observe Internal Library +=================== + +[![Build](https://github.com/ballerina-platform/module-ballerina-http/actions/workflows/build-timestamped-master.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinai-observe/actions/workflows/build-timestamped-master.yml) +[![Trivy](https://github.com/ballerina-platform/module-ballerina-http/actions/workflows/trivy-scan.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinai-observe/actions/workflows/trivy-scan.yml) +[![GitHub Last Commit](https://img.shields.io/github/last-commit/ballerina-platform/module-ballerina-http.svg)](https://github.com/ballerina-platform/module-ballerinai-observe/commits/master) +[![Github issues](https://img.shields.io/github/issues/ballerina-platform/ballerina-standard-library/module/http.svg?label=Open%20Issues)](https://github.com/ballerina-platform/ballerina-standard-library/labels/module%2Fhttp) +[![codecov](https://codecov.io/gh/ballerina-platform/module-ballerina-observe/branch/master/graph/badge.svg)](https://codecov.io/gh/ballerina-platform/module-ballerina-observe) + +This module contains internal configurations and initializations for Ballerina Observability. Ballerina supports Observability out of the box. You can user [module-ballerina-observe](https://github.com/ballerina-platform/module-ballerina-observe) in your ballerina project and enable observability features. + +By default, observability is not included in the executable created by Ballerina. It can be added by using the `--observability-included` build flag or by adding the following section to the `Ballerina.toml` file. + + + +## Issues and projects + +Issues and Projects tabs are disabled for this repository as this is part of the Ballerina Standard Library. To report bugs, request new features, start new discussions, view project boards, etc. please visit Ballerina Standard Library [parent repository](https://github.com/ballerina-platform/ballerina-standard-library). + +This repository only contains the source code for the package. + +## Build from the source + +### Set Up the prerequisites + +1. Download and install Java SE Development Kit (JDK) version 11 (from one of the following locations). + + * [Oracle](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html) + + * [OpenJDK](https://adoptopenjdk.net/) + + > **Note:** Set the JAVA_HOME environment variable to the path name of the directory into which you installed JDK. + +2. Export GitHub Personal access token with read package permissions as follows, + + export packageUser= + export packagePAT= + +3. Download and install [Docker](https://www.docker.com/). + +### Build the source + +Execute the commands below to build from source. + +1. To build the library: + ``` + ./gradlew clean build + ``` + +2. To run the integration tests: + ``` + ./gradlew clean test + ``` + +3. To run a group of tests + ``` + ./gradlew clean test -Pgroups= + ``` + +4. To build the package without the tests: + ``` + ./gradlew clean build -x test + ``` + +5. To debug the tests: + ``` + ./gradlew clean test -Pdebug= + ``` + +6. To debug with Ballerina language: + ``` + ./gradlew clean build -PbalJavaDebug= + ``` + +7. Publish the generated artifacts to the local Ballerina central repository: + ``` + ./gradlew clean build -PpublishToLocalCentral=true + ``` + +8. Publish the generated artifacts to the Ballerina central repository: + ``` + ./gradlew clean build -PpublishToCentral=true + ``` + +## Contribute to Ballerina + +As an open source project, Ballerina welcomes contributions from the community. + +For more information, go to the [contribution guidelines](https://github.com/ballerina-platform/ballerina-lang/blob/master/CONTRIBUTING.md). + +## Code of conduct + +All contributors are encouraged to read the [Ballerina Code of Conduct](https://ballerina.io/code-of-conduct). + +## Useful links + +* For more information go to the [`Observe` library](https://lib.ballerina.io/ballerina/observe/latest). +* For example demonstrations of the usage, go to [Ballerina By Examples](https://ballerina.io/learn/by-example/). +* Chat live with us via our [Slack channel](https://ballerina.io/community/slack/). +* Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag. +* View the [Ballerina performance test results](https://github.com/ballerina-platform/ballerina-lang/blob/master/performance/benchmarks/summary.md). From f82ec7e242717659b8668750507701a8d41a1f0f Mon Sep 17 00:00:00 2001 From: lakshankarunathilake Date: Wed, 27 Apr 2022 13:53:26 +0530 Subject: [PATCH 2/8] Update codecov action --- .github/workflows/build-timestamped-master.yml | 2 +- .github/workflows/pull-request.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-timestamped-master.yml b/.github/workflows/build-timestamped-master.yml index 590d180..9a512e4 100644 --- a/.github/workflows/build-timestamped-master.yml +++ b/.github/workflows/build-timestamped-master.yml @@ -37,4 +37,4 @@ jobs: run: | ./gradlew publish --scan --no-daemon --stacktrace --console=plain - name: Generate CodeCov Report - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v2 diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index dec0125..a8f858e 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -21,7 +21,7 @@ jobs: run: | ./gradlew build --stacktrace --console=plain - name: Generate Codecov Report - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v2 windows-build: name: Build on Windows From cacb29ee57e0268b3e8261e60e0f187c2667fe9b Mon Sep 17 00:00:00 2001 From: lakshankarunathilake Date: Wed, 27 Apr 2022 13:53:39 +0530 Subject: [PATCH 3/8] Generate report in jacoco --- ballerina-tests/build.gradle | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ballerina-tests/build.gradle b/ballerina-tests/build.gradle index 09d8070..ed8820f 100644 --- a/ballerina-tests/build.gradle +++ b/ballerina-tests/build.gradle @@ -55,8 +55,16 @@ task copyObserveStdlib { } } +jacocoTestReport { + dependsOn test + reports { + xml.enabled true + } +} + test { dependsOn(copyObserveStdlib) + finalizedBy jacocoTestReport useTestNG() { suites 'src/test/resources/testng.xml' } From 7829caea376556e16a68823ed47ef2e865c40d95 Mon Sep 17 00:00:00 2001 From: lakshankarunathilake Date: Thu, 5 May 2022 11:58:45 +0530 Subject: [PATCH 4/8] Add codevoc configurations --- .github/workflows/pull-request.yml | 2 +- README.md | 4 +--- ballerina-tests/build.gradle | 15 +++++++++++++++ codecov.yml | 6 ++++++ 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index a8f858e..8a20b47 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -19,7 +19,7 @@ jobs: packageUser: ${{ github.actor }} packagePAT: ${{ secrets.GITHUB_TOKEN }} run: | - ./gradlew build --stacktrace --console=plain + ./gradlew build test --stacktrace --console=plain - name: Generate Codecov Report uses: codecov/codecov-action@v2 diff --git a/README.md b/README.md index 0cbf605..534ffca 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Ballerina Observe Internal Library [![Build](https://github.com/ballerina-platform/module-ballerina-http/actions/workflows/build-timestamped-master.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinai-observe/actions/workflows/build-timestamped-master.yml) [![Trivy](https://github.com/ballerina-platform/module-ballerina-http/actions/workflows/trivy-scan.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinai-observe/actions/workflows/trivy-scan.yml) [![GitHub Last Commit](https://img.shields.io/github/last-commit/ballerina-platform/module-ballerina-http.svg)](https://github.com/ballerina-platform/module-ballerinai-observe/commits/master) -[![Github issues](https://img.shields.io/github/issues/ballerina-platform/ballerina-standard-library/module/http.svg?label=Open%20Issues)](https://github.com/ballerina-platform/ballerina-standard-library/labels/module%2Fhttp) +[![Github issues](https://img.shields.io/github/issues/ballerina-platform/ballerina-standard-library/module/http.svg?label=Open%20Issues)](https://github.com/ballerina-platform/ballerina-standard-library/labels/module%2Fobserve) [![codecov](https://codecov.io/gh/ballerina-platform/module-ballerina-observe/branch/master/graph/badge.svg)](https://codecov.io/gh/ballerina-platform/module-ballerina-observe) This module contains internal configurations and initializations for Ballerina Observability. Ballerina supports Observability out of the box. You can user [module-ballerina-observe](https://github.com/ballerina-platform/module-ballerina-observe) in your ballerina project and enable observability features. @@ -37,8 +37,6 @@ This repository only contains the source code for the package. export packageUser= export packagePAT= -3. Download and install [Docker](https://www.docker.com/). - ### Build the source Execute the commands below to build from source. diff --git a/ballerina-tests/build.gradle b/ballerina-tests/build.gradle index ed8820f..46768d8 100644 --- a/ballerina-tests/build.gradle +++ b/ballerina-tests/build.gradle @@ -55,10 +55,25 @@ task copyObserveStdlib { } } +def classFilesArray = [] + +task copyBallerinaClassFiles { + doFirst { + fileTree("$project.rootDir/ballerina/build/bal_build_target").include("**/*.jar").forEach { jar -> + zipTree(jar).matching { + include '**/*.class' + }.each { file -> classFilesArray.push(file) } + } + } +} + jacocoTestReport { dependsOn test + dependsOn copyBallerinaClassFiles + additionalClassDirs files(classFilesArray) reports { xml.enabled true + html.enabled true } } diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..72c6c8c --- /dev/null +++ b/codecov.yml @@ -0,0 +1,6 @@ +fixes: +- "ballerina/observe/*/::ballerina/" +- "ballerina/observe$0046mockextension/*/::ballerina/modules/mockextension" + +ignore: + - "**/tests" From d7cfc3e5ea097bb47a72f0e4add225478fb80216 Mon Sep 17 00:00:00 2001 From: lakshankarunathilake Date: Thu, 5 May 2022 15:15:18 +0530 Subject: [PATCH 5/8] Exclude ballerina internal classes from codecov --- ballerina-tests/build.gradle | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ballerina-tests/build.gradle b/ballerina-tests/build.gradle index 46768d8..4ba0353 100644 --- a/ballerina-tests/build.gradle +++ b/ballerina-tests/build.gradle @@ -61,6 +61,15 @@ task copyBallerinaClassFiles { doFirst { fileTree("$project.rootDir/ballerina/build/bal_build_target").include("**/*.jar").forEach { jar -> zipTree(jar).matching { + exclude '**/tests/*' + exclude '**/$_init.class' + exclude '**/$value$Caller.class' + exclude '**/$value$Detail.class' + exclude '**/$value$DetailType.class' + exclude '**/$value$EmptyIterator.class' + exclude '**/$value$$anonType$_6.class' + exclude '**/$value$$anonType$_*.class' + exclude '**/$value$_Frame.class' include '**/*.class' }.each { file -> classFilesArray.push(file) } } From 8b532ec0aac2e9d9090fd63e8561913503562dfe Mon Sep 17 00:00:00 2001 From: lakshankarunathilake Date: Fri, 6 May 2022 11:20:59 +0530 Subject: [PATCH 6/8] Update readme file --- README.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/README.md b/README.md index 534ffca..63f029e 100644 --- a/README.md +++ b/README.md @@ -5,21 +5,12 @@ Ballerina Observe Internal Library [![Build](https://github.com/ballerina-platform/module-ballerina-http/actions/workflows/build-timestamped-master.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinai-observe/actions/workflows/build-timestamped-master.yml) [![Trivy](https://github.com/ballerina-platform/module-ballerina-http/actions/workflows/trivy-scan.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinai-observe/actions/workflows/trivy-scan.yml) [![GitHub Last Commit](https://img.shields.io/github/last-commit/ballerina-platform/module-ballerina-http.svg)](https://github.com/ballerina-platform/module-ballerinai-observe/commits/master) -[![Github issues](https://img.shields.io/github/issues/ballerina-platform/ballerina-standard-library/module/http.svg?label=Open%20Issues)](https://github.com/ballerina-platform/ballerina-standard-library/labels/module%2Fobserve) [![codecov](https://codecov.io/gh/ballerina-platform/module-ballerina-observe/branch/master/graph/badge.svg)](https://codecov.io/gh/ballerina-platform/module-ballerina-observe) This module contains internal configurations and initializations for Ballerina Observability. Ballerina supports Observability out of the box. You can user [module-ballerina-observe](https://github.com/ballerina-platform/module-ballerina-observe) in your ballerina project and enable observability features. By default, observability is not included in the executable created by Ballerina. It can be added by using the `--observability-included` build flag or by adding the following section to the `Ballerina.toml` file. - - -## Issues and projects - -Issues and Projects tabs are disabled for this repository as this is part of the Ballerina Standard Library. To report bugs, request new features, start new discussions, view project boards, etc. please visit Ballerina Standard Library [parent repository](https://github.com/ballerina-platform/ballerina-standard-library). - -This repository only contains the source code for the package. - ## Build from the source ### Set Up the prerequisites From e3193646cbbdf04f7a013782ff845c0126c164d0 Mon Sep 17 00:00:00 2001 From: lakshankarunathilake Date: Fri, 6 May 2022 13:03:23 +0530 Subject: [PATCH 7/8] Fix code-review suggestions --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 63f029e..f44ae97 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,8 @@ Ballerina Observe Internal Library [![GitHub Last Commit](https://img.shields.io/github/last-commit/ballerina-platform/module-ballerina-http.svg)](https://github.com/ballerina-platform/module-ballerinai-observe/commits/master) [![codecov](https://codecov.io/gh/ballerina-platform/module-ballerina-observe/branch/master/graph/badge.svg)](https://codecov.io/gh/ballerina-platform/module-ballerina-observe) -This module contains internal configurations and initializations for Ballerina Observability. Ballerina supports Observability out of the box. You can user [module-ballerina-observe](https://github.com/ballerina-platform/module-ballerina-observe) in your ballerina project and enable observability features. +lerina project and enable observability features. +This module contains internal configurations and initializations for Ballerina observability. Ballerina supports observability out of the box. You can use the [module-ballerina-observe](https://github.com/ballerina-platform/module-ballerina-observe) in your Ballerina project and enable observability features. By default, observability is not included in the executable created by Ballerina. It can be added by using the `--observability-included` build flag or by adding the following section to the `Ballerina.toml` file. @@ -23,7 +24,7 @@ By default, observability is not included in the executable created by Ballerina > **Note:** Set the JAVA_HOME environment variable to the path name of the directory into which you installed JDK. -2. Export GitHub Personal access token with read package permissions as follows, +2. Export your GitHub Personal access token with read package permissions as follows. export packageUser= export packagePAT= From f1ac7a646e1fbb9c4d5546f7755da6069af062ea Mon Sep 17 00:00:00 2001 From: lakshankarunathilake Date: Fri, 6 May 2022 13:57:12 +0530 Subject: [PATCH 8/8] Fix typo correction --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index f44ae97..95c498a 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,6 @@ Ballerina Observe Internal Library [![GitHub Last Commit](https://img.shields.io/github/last-commit/ballerina-platform/module-ballerina-http.svg)](https://github.com/ballerina-platform/module-ballerinai-observe/commits/master) [![codecov](https://codecov.io/gh/ballerina-platform/module-ballerina-observe/branch/master/graph/badge.svg)](https://codecov.io/gh/ballerina-platform/module-ballerina-observe) -lerina project and enable observability features. This module contains internal configurations and initializations for Ballerina observability. Ballerina supports observability out of the box. You can use the [module-ballerina-observe](https://github.com/ballerina-platform/module-ballerina-observe) in your Ballerina project and enable observability features. By default, observability is not included in the executable created by Ballerina. It can be added by using the `--observability-included` build flag or by adding the following section to the `Ballerina.toml` file.