diff --git a/.github/ISSUE_TEMPLATE/boost_log.md b/.github/ISSUE_TEMPLATE/boost_log.md index e8a0ce83e..34ee26f89 100644 --- a/.github/ISSUE_TEMPLATE/boost_log.md +++ b/.github/ISSUE_TEMPLATE/boost_log.md @@ -18,3 +18,4 @@ What did you see instead? **Additional context** Add any other context about the problem here. +**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/). diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 032c3fef8..a64d9ed5e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -17,3 +17,5 @@ What did you see instead? **Additional context** Add any other context about the problem here. + +**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/). diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 973549ab2..95ec00965 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -17,3 +17,5 @@ Which alternative solutions or features have you considered? **Additional context** Add any other context about the feature request here. + +**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/). diff --git a/.github/ISSUE_TEMPLATE/fluentd.md b/.github/ISSUE_TEMPLATE/fluentd.md index 503def4eb..510148c86 100644 --- a/.github/ISSUE_TEMPLATE/fluentd.md +++ b/.github/ISSUE_TEMPLATE/fluentd.md @@ -18,3 +18,5 @@ What did you see instead? **Additional context** Add any other context about the problem here. +**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/). + diff --git a/.github/ISSUE_TEMPLATE/geneva-trace.md b/.github/ISSUE_TEMPLATE/geneva-trace.md index d580c29e7..03d094259 100644 --- a/.github/ISSUE_TEMPLATE/geneva-trace.md +++ b/.github/ISSUE_TEMPLATE/geneva-trace.md @@ -18,3 +18,5 @@ What did you see instead? **Additional context** Add any other context about the problem here. +**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/). + diff --git a/.github/ISSUE_TEMPLATE/geneva.md b/.github/ISSUE_TEMPLATE/geneva.md index 8efb16a0c..c51d89769 100644 --- a/.github/ISSUE_TEMPLATE/geneva.md +++ b/.github/ISSUE_TEMPLATE/geneva.md @@ -18,3 +18,5 @@ What did you see instead? **Additional context** Add any other context about the problem here. +**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/). + diff --git a/.github/ISSUE_TEMPLATE/glog.md b/.github/ISSUE_TEMPLATE/glog.md index cf28c5bbc..524a6a486 100644 --- a/.github/ISSUE_TEMPLATE/glog.md +++ b/.github/ISSUE_TEMPLATE/glog.md @@ -18,3 +18,5 @@ What did you see instead? **Additional context** Add any other context about the problem here. +**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/). + diff --git a/.github/ISSUE_TEMPLATE/httpd.md b/.github/ISSUE_TEMPLATE/httpd.md index bf2fb537e..17b97140f 100644 --- a/.github/ISSUE_TEMPLATE/httpd.md +++ b/.github/ISSUE_TEMPLATE/httpd.md @@ -18,3 +18,5 @@ What did you see instead? **Additional context** Add any other context about the problem here. +**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/). + diff --git a/.github/ISSUE_TEMPLATE/log4cxx.md b/.github/ISSUE_TEMPLATE/log4cxx.md index f3b3ad762..bff7fc1aa 100644 --- a/.github/ISSUE_TEMPLATE/log4cxx.md +++ b/.github/ISSUE_TEMPLATE/log4cxx.md @@ -18,3 +18,5 @@ What did you see instead? **Additional context** Add any other context about the problem here. +**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/). + diff --git a/.github/ISSUE_TEMPLATE/nginx.md b/.github/ISSUE_TEMPLATE/nginx.md index 623ba2557..93ed8d99d 100644 --- a/.github/ISSUE_TEMPLATE/nginx.md +++ b/.github/ISSUE_TEMPLATE/nginx.md @@ -18,3 +18,5 @@ What did you see instead? **Additional context** Add any other context about the problem here. +**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/). + diff --git a/.github/ISSUE_TEMPLATE/otel-webserver-module.md b/.github/ISSUE_TEMPLATE/otel-webserver-module.md index 65a6c0972..99dfa403b 100644 --- a/.github/ISSUE_TEMPLATE/otel-webserver-module.md +++ b/.github/ISSUE_TEMPLATE/otel-webserver-module.md @@ -18,3 +18,5 @@ What did you see instead? **Additional context** Add any other context about the problem here. +**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/). + diff --git a/.github/ISSUE_TEMPLATE/prometheus.md b/.github/ISSUE_TEMPLATE/prometheus.md index 084ae2b4e..91eee8305 100644 --- a/.github/ISSUE_TEMPLATE/prometheus.md +++ b/.github/ISSUE_TEMPLATE/prometheus.md @@ -18,3 +18,5 @@ What did you see instead? **Additional context** Add any other context about the problem here. +**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/). + diff --git a/.github/ISSUE_TEMPLATE/spdlog.md b/.github/ISSUE_TEMPLATE/spdlog.md index fe2b0f733..93177e210 100644 --- a/.github/ISSUE_TEMPLATE/spdlog.md +++ b/.github/ISSUE_TEMPLATE/spdlog.md @@ -18,3 +18,5 @@ What did you see instead? **Additional context** Add any other context about the problem here. +**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/). + diff --git a/.github/ISSUE_TEMPLATE/user_events.md b/.github/ISSUE_TEMPLATE/user_events.md index 9ba3a8bd4..55a98d671 100644 --- a/.github/ISSUE_TEMPLATE/user_events.md +++ b/.github/ISSUE_TEMPLATE/user_events.md @@ -18,3 +18,5 @@ What did you see instead? **Additional context** Add any other context about the problem here. +**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/). + diff --git a/.github/repository-settings.md b/.github/repository-settings.md deleted file mode 100644 index 9737122b8..000000000 --- a/.github/repository-settings.md +++ /dev/null @@ -1,42 +0,0 @@ -# Repository settings (opentelemetry-cpp-contrib) - -## Process - -This file documents local admin changes for opentelemetry-cpp-contrib, -per the community process: https://github.com/open-telemetry/community/blob/main/docs/how-to-configure-new-repository.md - -Please note that the EasyCLA check **MUST** stay **REQUIRED**, -it should never be disabled or bypassed, -at the risk of tainting the repository. - -## Guidelines - -The best is to open a PR first that describes the change, -so it can be discussed during review (maybe it is not needed, -maybe there is an alternate solution, ...). - -The PR must add a log entry in this file, detailing: - -* the date the change is implemented -* what is changed exactly (which setting) -* a short rationale - -Admin changes are then applied only when the PR is merged. - -If for some reason a change is implemented in emergency, -before a PR can be discussed and merged, -a PR should still be prepared and pushed after the fact to -describe the settings changed. - -## Log of local changes - -### 2024-04-04 - -Created log file `.github/repository-settings.md`, -since admin permissions are now granted to maintainers. - -See https://github.com/open-telemetry/community/issues/1951 - -No setting changed. - - diff --git a/.github/workflows/boost_log.yml b/.github/workflows/boost_log.yml index c6abcd5a9..ac1b469f0 100644 --- a/.github/workflows/boost_log.yml +++ b/.github/workflows/boost_log.yml @@ -13,6 +13,9 @@ on: - 'instrumentation/boost_log/**' - '.github/workflows/boost_log.yml' +permissions: + contents: read + jobs: cmake_linux: name: CMake Linux @@ -34,7 +37,7 @@ jobs: uses: actions/checkout@v3 with: repository: "open-telemetry/opentelemetry-cpp" - ref: "v1.15.0" + ref: "v1.19.0" path: "opentelemetry-cpp" submodules: "recursive" - name: setup dependencies diff --git a/.github/workflows/fluentd.yml b/.github/workflows/fluentd.yml index 2a4a0bad5..f898ae04e 100644 --- a/.github/workflows/fluentd.yml +++ b/.github/workflows/fluentd.yml @@ -12,9 +12,12 @@ on: pull_request: branches: [main] paths: - - "exporters/fluentd/**" - - ".github/workflows/fluentd.yml" - + - "exporters/fluentd/**" + - ".github/workflows/fluentd.yml" + +permissions: + contents: read + jobs: cmake_linux: name: CMake Linux @@ -29,7 +32,7 @@ jobs: uses: actions/checkout@v3 with: repository: "open-telemetry/opentelemetry-cpp" - ref: "v1.15.0" + ref: "v1.21.0" path: "opentelemetry-cpp" submodules: "recursive" - name: setup dependencies diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml new file mode 100644 index 000000000..3beaa09b7 --- /dev/null +++ b/.github/workflows/fossa.yml @@ -0,0 +1,20 @@ +name: FOSSA scanning + +on: + push: + branches: + - main + +permissions: + contents: read + +jobs: + fossa: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - uses: fossas/fossa-action@93a52ecf7c3ac7eb40f5de77fd69b1a19524de94 # v1.5.0 + with: + api-key: ${{secrets.FOSSA_API_KEY}} + team: OpenTelemetry diff --git a/.github/workflows/geneva_metrics.yml b/.github/workflows/geneva_metrics.yml index 5b6ac03f0..bca96b5f3 100644 --- a/.github/workflows/geneva_metrics.yml +++ b/.github/workflows/geneva_metrics.yml @@ -9,8 +9,10 @@ on: pull_request: branches: [main] paths: - - "exporters/geneva/**" - - ".github/workflows/geneva_metrics.yml" + - "exporters/geneva/**" + - ".github/workflows/geneva_metrics.yml" +permissions: + contents: read jobs: cmake_linux: name: CMake on Linux @@ -24,7 +26,7 @@ jobs: uses: actions/checkout@v3 with: repository: "open-telemetry/opentelemetry-cpp" - ref: "v1.15.0" + ref: "v1.21.0" path: "otel_cpp" submodules: "recursive" - name: setup diff --git a/.github/workflows/geneva_trace.yml b/.github/workflows/geneva_trace.yml index 65bbc184b..e939b44c0 100644 --- a/.github/workflows/geneva_trace.yml +++ b/.github/workflows/geneva_trace.yml @@ -14,6 +14,9 @@ on: paths: - "exporters/geneva-trace/**" - ".github/workflows/geneva_trace.yml" + +permissions: + contents: read jobs: geneva-trace-nuget-generation: diff --git a/.github/workflows/glog.yml b/.github/workflows/glog.yml index 750cee487..efd763a9c 100644 --- a/.github/workflows/glog.yml +++ b/.github/workflows/glog.yml @@ -13,6 +13,9 @@ on: - 'instrumentation/glog/**' - '.github/workflows/glog.yml' +permissions: + contents: read + jobs: cmake_linux: name: CMake Linux @@ -38,7 +41,7 @@ jobs: uses: actions/checkout@v3 with: repository: "open-telemetry/opentelemetry-cpp" - ref: "v1.15.0" + ref: "v1.19.0" path: "opentelemetry-cpp" submodules: "recursive" - name: setup dependencies diff --git a/.github/workflows/httpd.yml b/.github/workflows/httpd.yml index 0049da21e..73cb050a0 100644 --- a/.github/workflows/httpd.yml +++ b/.github/workflows/httpd.yml @@ -12,6 +12,9 @@ on: - 'instrumentation/httpd/**' - '.github/workflows/httpd.yml' +permissions: + contents: read + jobs: build: name: Build module diff --git a/.github/workflows/log4cxx.yml b/.github/workflows/log4cxx.yml index 67ade4519..ca132e59a 100644 --- a/.github/workflows/log4cxx.yml +++ b/.github/workflows/log4cxx.yml @@ -13,6 +13,9 @@ on: - 'instrumentation/log4cxx/**' - '.github/workflows/log4cxx.yml' +permissions: + contents: read + jobs: cmake_linux: name: CMake Linux @@ -38,7 +41,7 @@ jobs: uses: actions/checkout@v3 with: repository: "open-telemetry/opentelemetry-cpp" - ref: "v1.15.0" + ref: "v1.19.0" path: "opentelemetry-cpp" submodules: "recursive" - name: setup dependencies diff --git a/.github/workflows/nginx.yml b/.github/workflows/nginx.yml index 3cc41b906..5627f8638 100644 --- a/.github/workflows/nginx.yml +++ b/.github/workflows/nginx.yml @@ -14,9 +14,13 @@ on: paths: - 'instrumentation/nginx/**' - '.github/workflows/nginx.yml' +permissions: + contents: read jobs: create-release: if: startsWith(github.ref, 'refs/tags/nginx') + permissions: + contents: write # required for creating releases runs-on: ubuntu-latest steps: - name: Release @@ -25,6 +29,8 @@ jobs: if: startsWith(github.ref, 'refs/tags/nginx') runs-on: ubuntu-latest needs: [nginx-build-test, create-release] + permissions: + contents: write # required for uploading release artifacts steps: - name: Create directory run: | diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml new file mode 100644 index 000000000..096d7b035 --- /dev/null +++ b/.github/workflows/ossf-scorecard.yml @@ -0,0 +1,47 @@ +name: OSSF Scorecard + +on: + push: + branches: + - main + schedule: + - cron: "37 0 * * 4" # once a week + workflow_dispatch: + +permissions: read-all + +jobs: + analysis: + runs-on: ubuntu-latest + permissions: + # Needed for Code scanning upload + security-events: write + # Needed for GitHub OIDC token if publish_results is true + id-token: write + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1 + with: + results_file: results.sarif + results_format: sarif + publish_results: true + + # Upload the results as artifacts (optional). Commenting out will disable + # uploads of run results in SARIF format to the repository Actions tab. + # https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts + - name: "Upload artifact" + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard (optional). + # Commenting out will disable upload of results to your repo's Code Scanning dashboard + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@5f8171a638ada777af81d42b55959a643bb29017 # v3.28.12 + with: + sarif_file: results.sarif \ No newline at end of file diff --git a/.github/workflows/prometheus.yml b/.github/workflows/prometheus.yml index df15c8d36..27249f201 100644 --- a/.github/workflows/prometheus.yml +++ b/.github/workflows/prometheus.yml @@ -12,6 +12,9 @@ on: - "exporters/prometheus/**" - ".github/workflows/prometheus.yml" +permissions: + contents: read + jobs: prometheus_bazel_linux: name: Bazel on Linux @@ -65,7 +68,7 @@ jobs: uses: actions/checkout@v3 with: repository: "open-telemetry/opentelemetry-cpp" - ref: "v1.15.0" + ref: "v1.19.0" path: "otel_cpp" submodules: "recursive" - name: run tests @@ -103,7 +106,7 @@ jobs: uses: actions/checkout@v3 with: repository: "open-telemetry/opentelemetry-cpp" - ref: "v1.15.0" + ref: "v1.19.0" path: "otel_cpp" submodules: "recursive" - name: setup diff --git a/.github/workflows/spdlog.yml b/.github/workflows/spdlog.yml index 8ce0f4f49..992af96ff 100644 --- a/.github/workflows/spdlog.yml +++ b/.github/workflows/spdlog.yml @@ -13,6 +13,9 @@ on: - 'instrumentation/spdlog/**' - '.github/workflows/spdlog.yml' +permissions: + contents: read + jobs: cmake_linux: name: CMake Linux @@ -32,7 +35,7 @@ jobs: uses: actions/checkout@v3 with: repository: "open-telemetry/opentelemetry-cpp" - ref: "v1.15.0" + ref: "v1.19.0" path: "opentelemetry-cpp" submodules: "recursive" - name: setup dependencies diff --git a/.github/workflows/user_events.yml b/.github/workflows/user_events.yml index 9925e8e69..f809ef141 100644 --- a/.github/workflows/user_events.yml +++ b/.github/workflows/user_events.yml @@ -10,9 +10,12 @@ on: pull_request: branches: [main] paths: - - 'exporters/user_events/**' - - '.github/workflows/user_events.yml' - + - 'exporters/user_events/**' + - '.github/workflows/user_events.yml' + +permissions: + contents: read + jobs: cmake_linux: name: CMake Linux @@ -27,7 +30,7 @@ jobs: uses: actions/checkout@v3 with: repository: "open-telemetry/opentelemetry-cpp" - ref: "v1.18.0" + ref: "v1.21.0" path: "opentelemetry-cpp" submodules: "recursive" - name: setup dependencies diff --git a/.github/workflows/webserver.yml b/.github/workflows/webserver.yml index b48f5d5ec..9bebbd5ee 100644 --- a/.github/workflows/webserver.yml +++ b/.github/workflows/webserver.yml @@ -12,6 +12,9 @@ on: - 'instrumentation/otel-webserver-module/**' - '.github/workflows/webserver.yml' +permissions: + contents: read + jobs: webserver-build-test-ubuntu: name: webserver-ubuntu-build @@ -196,6 +199,8 @@ jobs: Codeql-build: + permissions: + security-events: write # for github/codeql-action/analyze to upload SARIF results name: static-analysis runs-on: ubuntu-20.04 steps: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 95261fa2c..69d19469d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,27 +1,28 @@ # Contributing to opentelemetry-cpp-contrib -The OpenTelemetry C/C++ special interest group (SIG) meets regularly. See the -OpenTelemetry [community](https://github.com/open-telemetry/community#cc-sdk) -repo for information on this and other language SIGs. +## Introduction -See the [public meeting notes](https://docs.google.com/document/d/1i1E4-_y4uJ083lCutKGDhkpi3n4_e774SBLi9hPLocw/edit) -for a summary description of past meetings. To request edit access, join the -meeting or get in touch on [Gitter](https://gitter.im/open-telemetry/opentelemetry-cpp). +Welcome to the opentelemetry-cpp-contrib repository! This project is an integral part of the broader OpenTelemetry ecosystem, providing additional instrumentation and tools to enhance C/C++ observability. -## Development +We greatly appreciate any contributions, no matter the size or scope. Please feel free to reach out to the OpenTelemetry C/C++ community on [slack](https://cloud-native.slack.com/archives/C01N3AT62SJ) with questions or for assistance. -TBD +## Prerequisites -### Build and Run Code Examples +[C++14](https://github.com/open-telemetry/opentelemetry-cpp/?tab=readme-ov-file#supported-c-versions) or higher -TBD +CMake 3.18 or higher + +Git -## Pull Requests +## Workflow -### How to Send Pull Requests +-Use forked repo when contributing -Everyone is welcome to contribute code to `opentelemetry-cpp-contrib` via GitHub pull -requests (PRs). +-Follow the OpenTelemetry C++ SDK contributing guidelines + +-Write clear, concise commit messages + +## Local Run/Build To create a new PR, fork the project in GitHub and clone the upstream repo: @@ -46,16 +47,49 @@ git push fork feature Open a pull request against the main `opentelemetry-cpp-contrib` repo. -### How to Receive Comments +### Build and Run Code Examples + +TBD + +## Testing + +TBD + +## Contributing Rules + +Follow the OpenTelemetry [C++ SDK coding standards](https://github.com/open-telemetry/opentelemetry-cpp?tab=readme-ov-file#supported-c-versions) + +Include tests for new features or bug fixes + + +## How to Receive Comments * If the PR is not ready for review, please put `[WIP]` in the title, tag it as `work-in-progress`, or mark it as [`draft`](https://github.blog/2019-02-14-introducing-draft-pull-requests/). * Make sure [CLA](https://identity.linuxfoundation.org/projects/cncf) is signed and CI is clear. + +## How to Get PRs Merged + +Address any reviewer + +Ensure all tests pass + +The maintainers will squash and merge your commit when approved + + + +## Further Help + +The OpenTelemetry C/C++ special interest group (SIG) meets regularly. + +See the public meeting notes via the [README](https://github.com/open-telemetry/opentelemetry-cpp?tab=readme-ov-file#contributing) by following the link to the google doc. + +Link to join SIG meets also available in the README + +For more info and help, join the meeting or get in touch on the [CNCF Slack channel for opentelemetry-cpp](https://cloud-native.slack.com/archives/C01N3AT62SJ). -### How to Get PRs Merged -This section needs to be written. ## Useful Resources diff --git a/README.md b/README.md index f1fdb9d27..28503796c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # OpenTelemetry C++ Contrib +[![FOSSA License Status](https://app.fossa.com/api/projects/custom%2B162%2Fgithub.com%2Fopen-telemetry%2Fopentelemetry-cpp-contrib.svg?type=shield&issueType=license)](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Fopen-telemetry%2Fopentelemetry-cpp-contrib?ref=badge_shield&issueType=license) +[![FOSSA Security Status](https://app.fossa.com/api/projects/custom%2B162%2Fgithub.com%2Fopen-telemetry%2Fopentelemetry-cpp-contrib.svg?type=shield&issueType=security)](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Fopen-telemetry%2Fopentelemetry-cpp-contrib?ref=badge_shield&issueType=security) + This repository contains set of components extending functionality of the OpenTelemetry SDK. Instrumentation libraries, exporters, and other components can find their home here. @@ -19,17 +22,18 @@ doc](https://docs.google.com/document/d/1i1E4-_y4uJ083lCutKGDhkpi3n4_e774SBLi9hP For edit access, get in touch on [Slack](https://cloud-native.slack.com/archives/C01N3AT62SJ). -[Maintainers](https://github.com/open-telemetry/community/blob/main/community-membership.md#maintainer) -([@open-telemetry/cpp-contrib-maintainers](https://github.com/orgs/open-telemetry/teams/cpp-contrib-maintainers)): +### Maintainers * [Ehsan Saei](https://github.com/esigo) * [Lalit Kumar Bhasin](https://github.com/lalitb), Microsoft * [Marc Alff](https://github.com/marcalff), Oracle * [Tom Tan](https://github.com/ThomsonTan), Microsoft -[Approvers](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver) -([@open-telemetry/cpp-contrib-approvers](https://github.com/orgs/open-telemetry/teams/cpp-contrib-approvers)): +For more information about the maintainer role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer). + +### Approvers +* [Aryan Ishan](https://github.com/aryanishan1001), Cisco * [DEBAJIT DAS](https://github.com/DebajitDas), Cisco * [Johannes Tax](https://github.com/pyohannes), Grafana Labs * [Josh Suereth](https://github.com/jsuereth), Google @@ -38,12 +42,8 @@ For edit access, get in touch on * [Siim Kallas](https://github.com/seemk), Splunk * [Tobias Stadler](https://github.com/tobiasstadler) * [Tomasz Rojek](https://github.com/TomRoSystems) -* [Aryan Ishan](https://github.com/aryanishan1001), Cisco - -[Emeritus -Maintainer/Approver/Triager](https://github.com/open-telemetry/community/blob/main/community-membership.md#emeritus-maintainerapprovertriager): -* None +For more information about the approver role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver). ### Thanks to all the people who have contributed diff --git a/exporters/fluentd/CMakeLists.txt b/exporters/fluentd/CMakeLists.txt index f869fda09..ca0d389c0 100644 --- a/exporters/fluentd/CMakeLists.txt +++ b/exporters/fluentd/CMakeLists.txt @@ -19,7 +19,7 @@ cmake_minimum_required(VERSION 3.12) ## set(MAIN_PROJECT OFF) if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) - project(opentelemetry-fluentd) + project(opentelemetry-cpp-fluentd) set(MAIN_PROJECT ON) endif() @@ -41,12 +41,16 @@ set(nlohmann_json_clone FALSE) if(nlohmann_json_FOUND) message("Using external nlohmann::json") else() - include(cmake/nlohmann-json.cmake) - set(nlohmann_json_clone TRUE) - set(nlohmann_json_SOURCE_DIR - "${CMAKE_SOURCE_DIR}/nlohmann_json/single_include") - include_directories(${nlohmann_json_SOURCE_DIR}) - message("nlohmann_json package was not found. Cloning from github") + if (MAIN_PROJECT) + include(cmake/nlohmann-json.cmake) + set(nlohmann_json_clone TRUE) + set(nlohmann_json_SOURCE_DIR + "${CMAKE_SOURCE_DIR}/nlohmann_json/single_include") + include_directories(${nlohmann_json_SOURCE_DIR}) + message("nlohmann_json package was not found. Cloning from github") + else() + message(FATAL_ERROR "nlohmann_json package was not found which is required for opentelemetry-cpp-fluentd. Please install it") + endif() endif() if(MAIN_PROJECT) @@ -63,6 +67,10 @@ endif() # create fluentd trace exporter add_library(opentelemetry_exporter_geneva_trace src/trace/fluentd_exporter.cc src/trace/recordable.cc) +set_target_properties( + opentelemetry_exporter_geneva_trace + PROPERTIES EXPORT_NAME opentelemetry_exporter_geneva_trace) + if(MAIN_PROJECT) target_include_directories(opentelemetry_exporter_geneva_trace PRIVATE ${OPENTELEMETRY_CPP_INCLUDE_DIRS}) @@ -76,13 +84,17 @@ else() target_link_libraries( opentelemetry_exporter_geneva_trace PUBLIC opentelemetry_trace opentelemetry_resources opentelemetry_common - nlohmann_json::nlohmann_json) + opentelemetry_ext nlohmann_json::nlohmann_json) endif() # create fluentd logs exporter add_library(opentelemetry_exporter_geneva_logs src/log/fluentd_exporter.cc src/log/recordable.cc) +set_target_properties( + opentelemetry_exporter_geneva_logs + PROPERTIES EXPORT_NAME opentelemetry_exporter_geneva_logs) + if(MAIN_PROJECT) target_include_directories(opentelemetry_exporter_geneva_logs PRIVATE ${OPENTELEMETRY_CPP_INCLUDE_DIRS}) @@ -97,7 +109,7 @@ else() target_link_libraries( opentelemetry_exporter_geneva_logs PUBLIC opentelemetry_logs opentelemetry_resources opentelemetry_common - nlohmann_json::nlohmann_json) + opentelemetry_ext nlohmann_json::nlohmann_json) endif() if(nlohmann_json_clone) @@ -117,23 +129,45 @@ if (WITH_EXAMPLES) endif() if(OPENTELEMETRY_INSTALL) - install( - TARGETS opentelemetry_exporter_geneva_logs - opentelemetry_exporter_geneva_trace - EXPORT "${PROJECT_NAME}-target" - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + if(MAIN_PROJECT) + install( + TARGETS opentelemetry_exporter_geneva_logs + opentelemetry_exporter_geneva_trace + EXPORT "${PROJECT_NAME}-target" + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - install( - DIRECTORY include/opentelemetry/exporters/ - DESTINATION include/opentelemetry/exporters/ - FILES_MATCHING - PATTERN "*.h") + install( + DIRECTORY include/opentelemetry/exporters/ + DESTINATION include/opentelemetry/exporters/ + FILES_MATCHING + PATTERN "*.h") + else() + otel_add_component( + COMPONENT + exporters_geneva_fluentd + TARGETS + opentelemetry_exporter_geneva_logs + opentelemetry_exporter_geneva_trace + FILES_DIRECTORY + "include/opentelemetry/exporters/" + FILES_DESTINATION + "include/opentelemetry/exporters" + FILES_MATCHING + PATTERN "*.h") + endif() endif() if(BUILD_TESTING) - include(GoogleTest) + if(MAIN_PROJECT) + find_package(GTest CONFIG REQUIRED) + else() + if (NOT DEFINED GTEST_BOTH_LIBRARIES) + message(STATUS_FATAL, "Test is not enable.") + endif() + endif() + # include(GoogleTest) # build trace exporter tests add_executable( fluentd_recordable_trace_test test/trace/fluentd_recordable_test.cc @@ -141,8 +175,7 @@ if(BUILD_TESTING) target_link_libraries( fluentd_recordable_trace_test - gtest - gtest_main + ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} opentelemetry_common opentelemetry_trace @@ -164,8 +197,7 @@ if(BUILD_TESTING) target_link_libraries( fluentd_recordable_logs_test - gtest - gtest_main + ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} opentelemetry_common opentelemetry_logs diff --git a/exporters/fluentd/README.md b/exporters/fluentd/README.md index b250b9fc6..0193da0d7 100644 --- a/exporters/fluentd/README.md +++ b/exporters/fluentd/README.md @@ -43,7 +43,7 @@ To use the library from a CMake project, you can locate it directly with ```cmake # CMakeLists.txt find_package(opentelemetry-cpp CONFIG REQUIRED) -find_package(opentelemetry-fluentd CONFIG REQUIRED) +find_package(opentelemetry-cpp-fluentd CONFIG REQUIRED) ... target_include_directories(foo PRIVATE ${OPENTELEMETRY_CPP_FLUENTD_INCLUDE_DIRS}) target_link_libraries(foo PRIVATE ${OPENTELEMETRY_CPP_LIBRARIES} ${OPENTELEMETRY_CPP_FLUENTD_LIBRARY_DIRS}) diff --git a/exporters/fluentd/cmake/opentelemetry-cpp-fluentd-config.cmake.in b/exporters/fluentd/cmake/opentelemetry-cpp-fluentd-config.cmake.in index 9cc50c976..7d0779b02 100644 --- a/exporters/fluentd/cmake/opentelemetry-cpp-fluentd-config.cmake.in +++ b/exporters/fluentd/cmake/opentelemetry-cpp-fluentd-config.cmake.in @@ -19,8 +19,8 @@ # OPENTELEMETRY_CPP_FLUENTD_VERSION - Version of opentelemetry-cpp-fluentd. # # :: -# opentelemetry-cpp-fluentd::trace - Imported target of opentelemetry-fluentd::trace -# opentelemetry-cpp::logs - Imported target of opentelemetry-fluentd::logs +# opentelemetry-cpp-fluentd::trace - Imported target of oopentelemetry-cpp-fluentd::trace +# opentelemetry-cpp::logs - Imported target of opentelemetry-cpp-fluentd::logs # ============================================================================= # Copyright 2020 opentelemetry. @@ -49,8 +49,8 @@ set(_OPENTELEMETRY_CPP_FLUENTD_LIBRARIES_TEST_TARGETS logs) foreach(_TEST_TARGET IN LISTS _OPENTELEMETRY_CPP_FLUENTD_LIBRARIES_TEST_TARGETS) - if(TARGET opentelemetry-fluentd::${_TEST_TARGET}) - list(APPEND OPENTELEMETRY_CPP_FLUENTD_LIBRARIES opentelemetry-fluentd::${_TEST_TARGET}) + if(TARGET opentelemetry-cpp-fluentd::${_TEST_TARGET}) + list(APPEND OPENTELEMETRY_CPP_FLUENTD_LIBRARIES opentelemetry-cpp-fluentd::${_TEST_TARGET}) else() message("Target not found: " ${_TEST_TARGET}) endif() diff --git a/exporters/fluentd/include/opentelemetry/exporters/fluentd/common/socket_tools.h b/exporters/fluentd/include/opentelemetry/exporters/fluentd/common/socket_tools.h index a8e1d3fbe..f33d1a352 100644 --- a/exporters/fluentd/include/opentelemetry/exporters/fluentd/common/socket_tools.h +++ b/exporters/fluentd/include/opentelemetry/exporters/fluentd/common/socket_tools.h @@ -585,8 +585,14 @@ struct Socket { assert(m_sock != Invalid); if ((m_sock == Invalid) || (buffer == nullptr) || (size == 0)) return 0; + int flags = +#ifdef _WIN32 + 0; +#else + MSG_NOSIGNAL; +#endif return static_cast( - ::send(m_sock, reinterpret_cast(buffer), size, 0)); + ::send(m_sock, reinterpret_cast(buffer), size, flags)); } int sendto(void const *buffer, size_t size, int flags, SocketAddr &destAddr) { diff --git a/exporters/fluentd/include/opentelemetry/exporters/fluentd/log/fluentd_exporter.h b/exporters/fluentd/include/opentelemetry/exporters/fluentd/log/fluentd_exporter.h index 05f661404..2d201376c 100644 --- a/exporters/fluentd/include/opentelemetry/exporters/fluentd/log/fluentd_exporter.h +++ b/exporters/fluentd/include/opentelemetry/exporters/fluentd/log/fluentd_exporter.h @@ -50,6 +50,12 @@ class FluentdExporter final : public logs_sdk::LogRecordExporter { Export(const nostd::span> &logs) noexcept override; + bool ForceFlush( + std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override + { + return true; + } + /** * Shut down the exporter. * @param timeout an optional timeout, default to max. diff --git a/exporters/fluentd/include/opentelemetry/exporters/fluentd/trace/fluentd_exporter.h b/exporters/fluentd/include/opentelemetry/exporters/fluentd/trace/fluentd_exporter.h index 6e71a0299..d3478710e 100644 --- a/exporters/fluentd/include/opentelemetry/exporters/fluentd/trace/fluentd_exporter.h +++ b/exporters/fluentd/include/opentelemetry/exporters/fluentd/trace/fluentd_exporter.h @@ -55,6 +55,12 @@ class FluentdExporter final : public trace_sdk::SpanExporter { Export(const nostd::span> &spans) noexcept override; + bool ForceFlush( + std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override + { + return true; + } + /** * Shut down the exporter. * @param timeout an optional timeout, default to max. diff --git a/exporters/fluentd/vcpkg.json b/exporters/fluentd/vcpkg.json index 7371ca786..546db3d6a 100644 --- a/exporters/fluentd/vcpkg.json +++ b/exporters/fluentd/vcpkg.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", - "name": "opentelemetry-fluentd", + "name": "opentelemetry-cpp-fluentd", "version-semver": "2.0.0", "description": "mdsd/fluentd exporter for OpenTelemetry C++", "homepage": "https://github.com/niande-xbox/opentelemetry-cpp-contrib/tree/main/exporters/fluentd", diff --git a/exporters/geneva-trace/CMakeLists.txt b/exporters/geneva-trace/CMakeLists.txt index 3196bb611..48b4c9ae6 100644 --- a/exporters/geneva-trace/CMakeLists.txt +++ b/exporters/geneva-trace/CMakeLists.txt @@ -17,12 +17,19 @@ target_include_directories( opentelemetry_exporter_geneva_trace INTERFACE $ $) +set_target_properties( + opentelemetry_exporter_geneva_trace + PROPERTIES EXPORT_NAME opentelemetry_exporter_geneva_trace) add_library(opentelemetry_exporter_geneva_logs INTERFACE) target_include_directories( opentelemetry_exporter_geneva_logs INTERFACE $ $) +set_target_properties( + opentelemetry_exporter_geneva_logs + PROPERTIES EXPORT_NAME opentelemetry_exporter_geneva_logs) + if(WITH_EXAMPLES) include_directories(include) @@ -30,16 +37,32 @@ if(WITH_EXAMPLES) endif() if(OPENTELEMETRY_INSTALL) - install(DIRECTORY include/ DESTINATION include) - - install( - TARGETS opentelemetry_exporter_geneva_trace opentelemetry_exporter_geneva_logs - EXPORT "${PROJECT_NAME}-target") + if(MAIN_PROJECT) + install(DIRECTORY include/ DESTINATION include) - if(NOT MAIN_PROJECT) install( - EXPORT "${PROJECT_NAME}-target" - NAMESPACE "${PROJECT_NAME}::" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") + TARGETS opentelemetry_exporter_geneva_trace opentelemetry_exporter_geneva_logs + EXPORT "${PROJECT_NAME}-target") + + if(NOT MAIN_PROJECT) + install( + EXPORT "${PROJECT_NAME}-target" + NAMESPACE "${PROJECT_NAME}::" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") + endif() + else() + otel_add_component( + COMPONENT + exporters_geneva_trace_logs + TARGETS + opentelemetry_exporter_geneva_trace + opentelemetry_exporter_geneva_logs + FILES_DIRECTORY + "include/opentelemetry/exporters/geneva" + FILES_DESTINATION + "include/opentelemetry/exporters" + FILES_MATCHING + PATTERN + "*.h") endif() endif() \ No newline at end of file diff --git a/exporters/geneva-trace/third_party/opentelemetry-cpp b/exporters/geneva-trace/third_party/opentelemetry-cpp index 3efd3ce8f..b9cf499ff 160000 --- a/exporters/geneva-trace/third_party/opentelemetry-cpp +++ b/exporters/geneva-trace/third_party/opentelemetry-cpp @@ -1 +1 @@ -Subproject commit 3efd3ce8f4d9b2753751208c717da47c652ea27e +Subproject commit b9cf499ff5715433848b316059714b5c59af1f2c diff --git a/exporters/geneva/CMakeLists.txt b/exporters/geneva/CMakeLists.txt index 2bca758e3..b01130c13 100644 --- a/exporters/geneva/CMakeLists.txt +++ b/exporters/geneva/CMakeLists.txt @@ -44,6 +44,10 @@ else() src/exporter.cc src/unix_domain_socket_data_transport.cc) endif() +set_target_properties( + opentelemetry_exporter_geneva_metrics + PROPERTIES EXPORT_NAME opentelemetry_exporter_geneva_metrics) + if(MAIN_PROJECT) target_include_directories(opentelemetry_exporter_geneva_metrics PRIVATE ${OPENTELEMETRY_CPP_INCLUDE_DIRS}) @@ -91,18 +95,33 @@ if(BUILD_TESTING) endif() if(OPENTELEMETRY_INSTALL) - install( - TARGETS opentelemetry_exporter_geneva_metrics - EXPORT "${PROJECT_NAME}-target" - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + if(MAIN_PROJECT) + install( + TARGETS opentelemetry_exporter_geneva_metrics + EXPORT "${PROJECT_NAME}-target" + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - install( - DIRECTORY include/opentelemetry/exporters/geneva - DESTINATION include/opentelemetry/exporters - FILES_MATCHING - PATTERN "*.h") + install( + DIRECTORY include/opentelemetry/exporters/geneva + DESTINATION include/opentelemetry/exporters + FILES_MATCHING + PATTERN "*.h") + else() + otel_add_component( + COMPONENT + exporters_geneva_metrics + TARGETS + opentelemetry_exporter_geneva_metrics + FILES_DIRECTORY + "include/opentelemetry/exporters/geneva" + FILES_DESTINATION + "include/opentelemetry/exporters" + FILES_MATCHING + PATTERN + "*.h") + endif() endif() if(WITH_EXAMPLES) diff --git a/exporters/geneva/include/opentelemetry/exporters/geneva/metrics/socket_tools.h b/exporters/geneva/include/opentelemetry/exporters/geneva/metrics/socket_tools.h index e8fddb5fc..64a541e73 100644 --- a/exporters/geneva/include/opentelemetry/exporters/geneva/metrics/socket_tools.h +++ b/exporters/geneva/include/opentelemetry/exporters/geneva/metrics/socket_tools.h @@ -570,8 +570,14 @@ struct Socket { assert(m_sock != Invalid); if ((m_sock == Invalid) || (buffer == nullptr) || (size == 0)) return 0; + int flags = +#ifdef _WIN32 + 0; +#else + MSG_NOSIGNAL; +#endif return static_cast( - ::send(m_sock, reinterpret_cast(buffer), size, 0)); + ::send(m_sock, reinterpret_cast(buffer), size, flags)); } int sendto(void const *buffer, size_t size, int flags, SocketAddr &destAddr) { diff --git a/exporters/geneva/src/exporter.cc b/exporters/geneva/src/exporter.cc index 562a586e3..cb7d569ea 100644 --- a/exporters/geneva/src/exporter.cc +++ b/exporters/geneva/src/exporter.cc @@ -22,25 +22,25 @@ Exporter::Exporter(const ExporterOptions &options) : options_(options), connection_string_parser_(options_.connection_string), data_transport_{nullptr} { if (connection_string_parser_.IsValid()) { +#ifdef _WIN32 + if (connection_string_parser_.transport_protocol_ == + TransportProtocol::kETW) { + data_transport_ = std::unique_ptr( + new ETWDataTransport(kBinaryHeaderSize)); + } +#else if (connection_string_parser_.transport_protocol_ == TransportProtocol::kUNIX) { data_transport_ = std::unique_ptr(new UnixDomainSocketDataTransport( connection_string_parser_.connection_string_)); } -#ifdef _WIN32 - else if (connection_string_parser_.transport_protocol_ == - TransportProtocol::kETW) { - data_transport_ = std::unique_ptr( - new ETWDataTransport(kBinaryHeaderSize)); - } #endif } // Connect transport at initialization auto status = data_transport_->Connect(); if (!status) { LOG_ERROR("[Geneva Exporter] Connect failed. No data would be sent."); - is_shutdown_ = true; return; } } diff --git a/exporters/geneva/src/unix_domain_socket_data_transport.cc b/exporters/geneva/src/unix_domain_socket_data_transport.cc index 9fe347e8e..d68d0cd85 100644 --- a/exporters/geneva/src/unix_domain_socket_data_transport.cc +++ b/exporters/geneva/src/unix_domain_socket_data_transport.cc @@ -20,11 +20,11 @@ bool UnixDomainSocketDataTransport::Connect() noexcept { socket_ = SocketTools::Socket(socketparams_); connected_ = socket_.connect(*addr_); if (!connected_) { + socket_.close(); LOG_ERROR("Geneva Exporter: UDS::Connect failed"); - return false; } } - return true; + return connected_; } bool UnixDomainSocketDataTransport::Send(MetricsEventType event_type, @@ -42,26 +42,26 @@ bool UnixDomainSocketDataTransport::Send(MetricsEventType event_type, "Geneva Exporter: UDS::Send Socket reconnect failed. Send failed"); } } - if (error_code != 0) { + if (!connected_ || error_code != 0 ) { LOG_ERROR("Geneva Exporter: UDS::Send failed - not connected"); connected_ = false; + return false; } // try to write size_t sent_size = socket_.writeall(data, length); - if (length == sent_size) { - // Disconnect(); - return true; - } else { + if (length != sent_size) { + Disconnect(); LOG_ERROR("Geneva Exporter: UDS::Send failed"); + return false; } - return false; + return true; } bool UnixDomainSocketDataTransport::Disconnect() noexcept { if (connected_) { connected_ = false; - if (socket_.invalid()) { + if (!socket_.invalid()) { socket_.close(); return true; } diff --git a/exporters/prometheus/CMakeLists.txt b/exporters/prometheus/CMakeLists.txt index 8b9439d3d..c8e8e0a2e 100644 --- a/exporters/prometheus/CMakeLists.txt +++ b/exporters/prometheus/CMakeLists.txt @@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.12) project( opentelemetry-cpp-contrib - VERSION "1.11.0" # opentelemetry-cpp-contrib 1.11.0 + VERSION "1.19.0" # opentelemetry-cpp-contrib 1.19.0 HOMEPAGE_URL "https://github.com/open-telemetry/opentelemetry-cpp-contrib" LANGUAGES CXX) diff --git a/exporters/prometheus/MODULE.bazel b/exporters/prometheus/MODULE.bazel new file mode 100644 index 000000000..aa89798a5 --- /dev/null +++ b/exporters/prometheus/MODULE.bazel @@ -0,0 +1,15 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +module( + name = "opentelemetry-cpp-contrib-prometheus", + version = "1.19.0", + compatibility_level = 0, + repo_name = "io_opentelemetry_cpp_contrib", +) + +bazel_dep(name = "abseil-cpp", version = "20240116.1", repo_name = "com_google_absl") +bazel_dep(name = "opentelemetry-cpp", version = "1.19.0", repo_name = "io_opentelemetry_cpp") +bazel_dep(name = "prometheus-cpp", version = "1.3.0", repo_name = "com_github_jupp0r_prometheus_cpp") + +bazel_dep(name = "googletest", version = "1.14.0.bcr.1", dev_dependency = True, repo_name = "com_google_googletest") diff --git a/exporters/user_events/CMakeLists.txt b/exporters/user_events/CMakeLists.txt index 9d553c3a3..b30ee0e37 100644 --- a/exporters/user_events/CMakeLists.txt +++ b/exporters/user_events/CMakeLists.txt @@ -36,6 +36,8 @@ if(BUILD_TRACEPOINTS) # Restore original values set(BUILD_SAMPLES ${ORIGINAL_BUILD_SAMPLES}) set(BUILD_TOOLS ${ORIGINAL_BUILD_TOOLS}) +else() + find_package(eventheader-headers REQUIRED CONFIG) endif() include_directories(include) @@ -61,7 +63,7 @@ else() endif() target_link_libraries(opentelemetry_exporter_user_events_logs - PUBLIC eventheader-tracepoint tracepoint) + PUBLIC eventheader-tracepoint eventheader-headers tracepoint) set_target_properties(opentelemetry_exporter_user_events_logs PROPERTIES EXPORT_NAME logs) @@ -136,15 +138,40 @@ if(WITH_BENCHMARK) opentelemetry_exporter_user_events_logs) endif() -install( - TARGETS opentelemetry_exporter_user_events_logs - EXPORT "${PROJECT_NAME}-target" - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - -install( - DIRECTORY include/opentelemetry/exporters/user_events - DESTINATION include/opentelemetry/exporters - FILES_MATCHING - PATTERN "*.h") +set_target_properties( + opentelemetry_exporter_user_events_logs + PROPERTIES + EXPORT_NAME opentelemetry_exporter_user_events_logs) +set_target_properties( + opentelemetry_exporter_user_events_metrics + PROPERTIES + EXPORT_NAME opentelemetry_exporter_user_events_metrics) + +if(MAIN_PROJECT) + install( + TARGETS opentelemetry_exporter_user_events_logs + EXPORT "${PROJECT_NAME}-target" + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + install( + DIRECTORY include/opentelemetry/exporters/user_events + DESTINATION include/opentelemetry/exporters + FILES_MATCHING + PATTERN "*.h") +else() + otel_add_component( + COMPONENT + exporters_user_events + TARGETS + opentelemetry_exporter_user_events_logs + opentelemetry_exporter_user_events_metrics + FILES_DIRECTORY + "include/opentelemetry/exporters/user_events" + FILES_DESTINATION + "include/opentelemetry/exporters" + FILES_MATCHING + PATTERN + "*.h") +endif() \ No newline at end of file diff --git a/exporters/user_events/include/opentelemetry/exporters/user_events/logs/exporter.h b/exporters/user_events/include/opentelemetry/exporters/user_events/logs/exporter.h index 526be2297..b5c8e01b0 100644 --- a/exporters/user_events/include/opentelemetry/exporters/user_events/logs/exporter.h +++ b/exporters/user_events/include/opentelemetry/exporters/user_events/logs/exporter.h @@ -42,6 +42,12 @@ class Exporter final : public opentelemetry::sdk::logs::LogRecordExporter bool Shutdown( std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override; + bool ForceFlush( + std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override { + // TODO: implement forceflush + return true; + } + bool isShutdown() const noexcept; private: diff --git a/exporters/user_events/include/opentelemetry/exporters/user_events/logs/recordable.h b/exporters/user_events/include/opentelemetry/exporters/user_events/logs/recordable.h index bc8cae79c..53a81805b 100644 --- a/exporters/user_events/include/opentelemetry/exporters/user_events/logs/recordable.h +++ b/exporters/user_events/include/opentelemetry/exporters/user_events/logs/recordable.h @@ -4,8 +4,8 @@ #pragma once #include -#include "opentelemetry/nostd/string_view.h" #include "opentelemetry/logs/severity.h" +#include "opentelemetry/nostd/string_view.h" #include "opentelemetry/sdk/common/attribute_utils.h" #include "opentelemetry/sdk/logs/recordable.h" #include "opentelemetry/version.h" @@ -117,11 +117,15 @@ class Recordable final : public opentelemetry::sdk::logs::Recordable private: ehd::EventBuilder event_builder_; - int level_index_; + int64_t event_id_ = 0; + nostd::string_view event_name_; + int level_index_ = 0; size_t cs_part_b_bookmark_ = 0; size_t cs_part_b_bookmark_size_ = 0; size_t cs_part_c_bookmark_ = 0; size_t cs_part_c_bookmark_size_ = 0; + uint8_t severity_ = 0; + bool has_event_id_ = false; }; } // namespace logs diff --git a/exporters/user_events/src/logs_exporter.cc b/exporters/user_events/src/logs_exporter.cc index 5b23412bf..a7589d8f4 100644 --- a/exporters/user_events/src/logs_exporter.cc +++ b/exporters/user_events/src/logs_exporter.cc @@ -19,10 +19,11 @@ namespace logs /*********************** Constructor ***********************/ -Exporter::Exporter(const ExporterOptions &options) noexcept : options_(options), provider_(options.provider_name) +Exporter::Exporter(const ExporterOptions &options) noexcept + : options_(options), provider_(options.provider_name) { // Initialize the event sets - for (int i = 0; i < sizeof(event_levels_map)/sizeof(event_levels_map[0]); i++) + for (int i = 0; i < sizeof(event_levels_map) / sizeof(event_levels_map[0]); i++) { event_set_levels_[i] = provider_.RegisterSet(event_levels_map[i], 1); } @@ -52,9 +53,10 @@ sdk::common::ExportResult Exporter::Export( auto user_events_record = std::unique_ptr(static_cast(record.release())); - user_events_record->PrepareExport(); - - // assert(user_events_record != nullptr, "Recordable is null"); + if (!user_events_record->PrepareExport()) + { + continue; + } int level_index = user_events_record->GetLevelIndex(); diff --git a/exporters/user_events/src/recordable.cc b/exporters/user_events/src/recordable.cc index 41b2031b3..49282d6a5 100644 --- a/exporters/user_events/src/recordable.cc +++ b/exporters/user_events/src/recordable.cc @@ -17,50 +17,57 @@ namespace logs namespace api_logs = opentelemetry::logs; -Recordable::Recordable() noexcept -{ - event_builder_.Reset("OpenTelemetry-Logs"); - - utils::PopulateAttribute("__csver__", static_cast(0x400), event_builder_); -} +Recordable::Recordable() noexcept {} void Recordable::SetSeverity(api_logs::Severity severity) noexcept { uint8_t severity_value = static_cast(severity); - if (severity_value == 0 || severity_value > 24) + if (severity_value > 24) { OTEL_INTERNAL_LOG_ERROR( "[user_events Log Exporter] Recordable: invalid severity value: " << severity_value); - severity_value = 1; + severity_value = 0; } + severity_ = severity_value; level_index_ = (severity_value - 1) >> 2; - - cs_part_b_bookmark_size_ += 2; - event_builder_.AddValue("severityNumber", static_cast(severity_value), - event_field_format_default); - auto severity_text = api_logs::SeverityNumToText[static_cast(severity_value)].data(); - event_builder_.AddString("severityText", severity_text, event_field_format_default); } void Recordable::SetBody(const opentelemetry::common::AttributeValue &message) noexcept { - // Set intial bookmark size to 1 for body below. - cs_part_b_bookmark_size_++; + if (severity_ == 0) + { + OTEL_INTERNAL_LOG_ERROR("[user_events Log Exporter] Recordable: severity is not set."); + return; + } + + auto event_name = !event_name_.empty() ? event_name_.data() : "Logs"; + + event_builder_.Reset(event_name); + event_builder_.AddValue("__csver__", static_cast(0x400), event_field_format_unsigned_int); + event_builder_.AddStruct("PartB", 1, 0, &cs_part_b_bookmark_); - utils::PopulateAttribute("_typeName", "Log", event_builder_); + event_builder_.AddString("_typeName", "Log", event_field_format_default); + event_builder_.AddValue("severityNumber", static_cast(severity_), + event_field_format_default); + auto severity_text = api_logs::SeverityNumToText[static_cast(severity_)].data(); + event_builder_.AddString("severityText", severity_text, event_field_format_default); + cs_part_b_bookmark_size_ = 4; // with the below body counted because it is available. + + if (has_event_id_) + { + utils::PopulateAttribute("eventId", event_id_, event_builder_); + cs_part_b_bookmark_size_++; + } + utils::PopulateAttribute("body", message, event_builder_); } void Recordable::SetEventId(int64_t id, nostd::string_view name) noexcept { - cs_part_b_bookmark_size_++; - utils::PopulateAttribute("eventId", id, event_builder_); - if (!name.empty()) - { - cs_part_b_bookmark_size_++; - utils::PopulateAttribute("name", name, event_builder_); - } + has_event_id_ = true; + event_id_ = id; + event_name_ = name; } void Recordable::SetTraceId(const opentelemetry::trace::TraceId &trace_id) noexcept @@ -96,10 +103,17 @@ void Recordable::SetTimestamp(opentelemetry::common::SystemTimestamp timestamp) bool Recordable::PrepareExport() noexcept { - if (cs_part_b_bookmark_size_ > 0) + if (cs_part_b_bookmark_size_ == 0) + { + // Part B is mandatory for exporting to user_events. + OTEL_INTERNAL_LOG_ERROR("[user_events Log Exporter] Recordable: no data to export."); + return false; + } + else { event_builder_.SetStructFieldCount(cs_part_b_bookmark_, cs_part_b_bookmark_size_); } + if (cs_part_c_bookmark_size_ > 0) { event_builder_.SetStructFieldCount(cs_part_c_bookmark_, cs_part_c_bookmark_size_); diff --git a/exporters/user_events/src/utils.cc b/exporters/user_events/src/utils.cc index cbe539e78..cea5ee4a6 100644 --- a/exporters/user_events/src/utils.cc +++ b/exporters/user_events/src/utils.cc @@ -69,7 +69,7 @@ void PopulateAttribute(nostd::string_view key, { event_builder.AddValue(key_name, nostd::get(value), event_field_format_default); } - else if (nostd::holds_alternative(value), event_field_format_default) + else if (nostd::holds_alternative(value)) { event_builder.AddValue(key_name, nostd::get(value), event_field_format_float); } diff --git a/instrumentation/nginx/README.md b/instrumentation/nginx/README.md index 8c2a7b30d..3ba37d761 100644 --- a/instrumentation/nginx/README.md +++ b/instrumentation/nginx/README.md @@ -136,7 +136,7 @@ Chooses the traces sampler. (default: `parentbased_always_on`). - **syntax**: `opentelemetry_traces_sampler always_on|always_off|traceidratio|parentbased_always_on|parentbased_always_off|parentbased_traceidratio` - **block**: `http` -### `opentelemetry_traces_sampler` +### `opentelemetry_traces_sampler_ratio` Chooses the trace sampling ratio between `0.0` and `1.0` when a ratio based sampler is active. (default: `1.0`). diff --git a/instrumentation/nginx/test/docker-compose.yml b/instrumentation/nginx/test/docker-compose.yml index 57a9bff05..674479758 100644 --- a/instrumentation/nginx/test/docker-compose.yml +++ b/instrumentation/nginx/test/docker-compose.yml @@ -1,6 +1,6 @@ services: collector: - image: otel/opentelemetry-collector:0.113.0 + image: otel/opentelemetry-collector:latest command: ["--config=/etc/otel/config.yml"] volumes: - ${TEST_ROOT:-.}/conf/collector.yml:/etc/otel/config.yml diff --git a/instrumentation/otel-webserver-module/Dockerfile b/instrumentation/otel-webserver-module/Dockerfile index 6deb7207a..a5cc894f9 100644 --- a/instrumentation/otel-webserver-module/Dockerfile +++ b/instrumentation/otel-webserver-module/Dockerfile @@ -108,7 +108,7 @@ RUN git clone https://github.com/grpc/grpc \ RUN mkdir -p dependencies # install boost version -RUN wget https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/${BOOST_FILENAME}_rc1.tar.gz \ +RUN wget https://archives.boost.io/release/${BOOST_VERSION}/source/${BOOST_FILENAME}_rc1.tar.gz \ && tar -xvf ${BOOST_FILENAME}_rc1.tar.gz \ && cd ${BOOST_FILENAME} \ && ./bootstrap.sh --with-libraries=filesystem,system --prefix=/dependencies/boost/${BOOST_VERSION}/ \ diff --git a/instrumentation/otel-webserver-module/codeql-env.sh b/instrumentation/otel-webserver-module/codeql-env.sh index 622816644..6c96a31c2 100755 --- a/instrumentation/otel-webserver-module/codeql-env.sh +++ b/instrumentation/otel-webserver-module/codeql-env.sh @@ -157,7 +157,7 @@ apt-get install apache2 -y && a2enmod proxy && a2enmod proxy_http \ && a2enmod proxy_balancer && a2enmod dav #Build and install boost -wget https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/${BOOST_FILENAME}.tar.gz \ +wget https://archives.boost.io/release/${BOOST_VERSION}/source/${BOOST_FILENAME}.tar.gz \ && tar -xvf ${BOOST_FILENAME}.tar.gz \ && cd ${BOOST_FILENAME} \ && ./bootstrap.sh --with-libraries=filesystem,system --prefix=/dependencies/boost/${BOOST_VERSION}/ \ diff --git a/instrumentation/otel-webserver-module/docker/almalinux8/Dockerfile b/instrumentation/otel-webserver-module/docker/almalinux8/Dockerfile index 6a864201b..2e3d01d33 100644 --- a/instrumentation/otel-webserver-module/docker/almalinux8/Dockerfile +++ b/instrumentation/otel-webserver-module/docker/almalinux8/Dockerfile @@ -89,7 +89,7 @@ RUN git clone https://github.com/grpc/grpc \ RUN mkdir -p dependencies # install boost version 1.75.0 -RUN wget https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/${BOOST_FILENAME}_rc1.tar.gz \ +RUN wget https://archives.boost.io/release/${BOOST_VERSION}/source/${BOOST_FILENAME}_rc1.tar.gz \ && tar -xvf ${BOOST_FILENAME}_rc1.tar.gz \ && cd ${BOOST_FILENAME} \ && ./bootstrap.sh --with-libraries=filesystem,system --prefix=/dependencies/boost/${BOOST_VERSION}/ \ diff --git a/instrumentation/otel-webserver-module/docker/centos7/Dockerfile b/instrumentation/otel-webserver-module/docker/centos7/Dockerfile index 4efe31583..b8571d35d 100644 --- a/instrumentation/otel-webserver-module/docker/centos7/Dockerfile +++ b/instrumentation/otel-webserver-module/docker/centos7/Dockerfile @@ -116,7 +116,7 @@ RUN git clone https://github.com/grpc/grpc \ RUN mkdir -p dependencies # install boost version 1.75.0 -RUN wget https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/${BOOST_FILENAME}_rc1.tar.gz \ +RUN wget https://archives.boost.io/release/${BOOST_VERSION}/source/${BOOST_FILENAME}_rc1.tar.gz \ && tar -xvf ${BOOST_FILENAME}_rc1.tar.gz \ && cd ${BOOST_FILENAME} \ && ./bootstrap.sh --with-libraries=filesystem,system --prefix=/dependencies/boost/${BOOST_VERSION}/ \ diff --git a/instrumentation/otel-webserver-module/docker/ubuntu20.04/Dockerfile b/instrumentation/otel-webserver-module/docker/ubuntu20.04/Dockerfile index 0df295570..34e524c45 100644 --- a/instrumentation/otel-webserver-module/docker/ubuntu20.04/Dockerfile +++ b/instrumentation/otel-webserver-module/docker/ubuntu20.04/Dockerfile @@ -159,7 +159,7 @@ RUN apt-get install apache2 -y && a2enmod proxy && a2enmod proxy_http \ && a2enmod proxy_balancer && a2enmod dav #Build and install boost -RUN wget https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/${BOOST_FILENAME}.tar.gz \ +RUN wget https://archives.boost.io/release/${BOOST_VERSION}/source/${BOOST_FILENAME}.tar.gz \ && tar -xvf ${BOOST_FILENAME}.tar.gz \ && cd ${BOOST_FILENAME} \ && ./bootstrap.sh --with-libraries=filesystem,system --prefix=/dependencies/boost/${BOOST_VERSION}/ \ diff --git a/instrumentation/otel-webserver-module/otel-config.yml b/instrumentation/otel-webserver-module/otel-config.yml index 450cdfdd2..4a6ca91e7 100644 --- a/instrumentation/otel-webserver-module/otel-config.yml +++ b/instrumentation/otel-webserver-module/otel-config.yml @@ -20,8 +20,8 @@ receivers: http: zipkin: exporters: - logging: - loglevel: debug + debug: + verbosity: detailed zipkin: endpoint: "http://zipkin:9411/api/v2/spans" format: proto @@ -30,5 +30,5 @@ service: pipelines: traces: receivers: [otlp, zipkin] - exporters: [logging, zipkin] + exporters: [debug, zipkin] processors: [resource]