Skip to content

Commit

Permalink
Merge pull request #308 from open-telemetry/main
Browse files Browse the repository at this point in the history
[pull] main from open-telemetry:main
  • Loading branch information
lalitb authored Dec 18, 2024
2 parents 6dbfdb5 + 902ee88 commit 2564cc6
Show file tree
Hide file tree
Showing 522 changed files with 26,443 additions and 5,018 deletions.
6 changes: 3 additions & 3 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
# bazel configurations for running tests under sanitizers.
# Based on https://github.com/bazelment/trunk/blob/master/tools/bazel.rc

# TODO: Remove once support is added, avoid MODULE.bazel creation for now
common --enable_bzlmod=false

# Enable automatic configs based on platform
common --enable_platform_specific_config

# Make globs that don't match anything fail
common --incompatible_disallow_empty_glob

# Needed by gRPC to build on some platforms.
build --copt -DGRPC_BAZEL_BUILD

Expand Down
42 changes: 42 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

Checks: >
-*,
performance-*,
portability-*,
abseil-*,
-abseil-string-find-str-contains,
bugprone-*,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-inc-dec-in-conditions,
-bugprone-narrowing-conversions,
-bugprone-unchecked-optional-access,
-bugprone-unhandled-exception-at-new,
-bugprone-unused-local-non-trivial-variable,
google-*,
-google-build-using-namespace,
-google-default-arguments,
-google-explicit-constructor,
-google-readability-avoid-underscore-in-googletest-name,
-google-readability-braces-around-statements,
-google-readability-namespace-comments,
-google-readability-todo,
-google-runtime-references,
misc-*,
-misc-const-correctness,
-misc-include-cleaner,
-misc-non-private-member-variables-in-classes,
-misc-unused-alias-decls,
-misc-use-anonymous-namespace,
cppcoreguidelines-*,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-avoid-do-while,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-init-variables,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-pro-*
135 changes: 88 additions & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,38 @@ on:
branches: [ main ]

jobs:
arm64_test:
name: CMake test arm64 (with modern protobuf,grpc and abseil)
runs-on: actuated-arm64-4cpu-16gb
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup
env:
PROTOBUF_VERSION: '23.3'
ABSEIL_CPP_VERSION: '20230125.3'
CXX_STANDARD: '14'
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
run: |
sudo -E ./ci/setup_gcc10.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_googletest.sh
sudo -E ./ci/install_abseil.sh
sudo -E ./ci/install_protobuf.sh
- name: run otlp exporter tests
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
WITH_ABSEIL: 'ON'
CXX_STANDARD: '14'
run: |
sudo -E ./ci/setup_grpc.sh -m -p protobuf -p abseil-cpp
./ci/do_ci.sh cmake.exporter.otprotocol.test

# Commented 2024-11-06, lack of workers in github causes CI failures
# arm64_test:
# name: CMake test arm64 (with modern protobuf,grpc and abseil)
# runs-on: actuated-arm64-4cpu-16gb
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: 'recursive'
# - name: setup
# env:
# PROTOBUF_VERSION: '23.3'
# ABSEIL_CPP_VERSION: '20230125.3'
# CXX_STANDARD: '14'
# CC: /usr/bin/gcc-10
# CXX: /usr/bin/g++-10
# run: |
# sudo -E ./ci/setup_gcc10.sh
# sudo -E ./ci/setup_cmake.sh
# sudo -E ./ci/setup_ci_environment.sh
# sudo -E ./ci/setup_googletest.sh
# sudo -E ./ci/install_abseil.sh
# sudo -E ./ci/install_protobuf.sh
# - name: run otlp exporter tests
# env:
# CC: /usr/bin/gcc-10
# CXX: /usr/bin/g++-10
# WITH_ABSEIL: 'ON'
# CXX_STANDARD: '14'
# run: |
# sudo -E ./ci/setup_grpc.sh -m -p protobuf -p abseil-cpp
# ./ci/do_ci.sh cmake.exporter.otprotocol.test

cmake_test:
name: CMake test (without otlp-exporter)
Expand All @@ -47,15 +49,15 @@ jobs:
submodules: 'recursive'
- name: setup
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
run: |
sudo -E ./ci/setup_googletest.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run cmake tests (without otlp-exporter)
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
run: |
./ci/do_ci.sh cmake.test
Expand Down Expand Up @@ -261,15 +263,15 @@ jobs:
submodules: 'recursive'
- name: setup
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
run: |
sudo -E ./ci/setup_googletest.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run cmake tests (without otlp-exporter)
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
run: |
./ci/do_ci.sh cmake.with_async_export.test
Expand Down Expand Up @@ -357,7 +359,7 @@ jobs:

cmake_test_cxx20_clang:
name: CMake C++20 test(Clang with libc++)
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -407,7 +409,7 @@ jobs:

cmake_test_cxx23_clang:
name: CMake C++23 test(Clang with libc++)
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -536,15 +538,15 @@ jobs:
submodules: 'recursive'
- name: setup
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
run: |
sudo -E ./ci/setup_googletest.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run tests
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
run: ./ci/do_ci.sh cmake.test_example_plugin

bazel_test:
Expand Down Expand Up @@ -856,7 +858,7 @@ jobs:

code_coverage:
name: Code coverage
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -874,9 +876,9 @@ jobs:
CXX: /usr/bin/g++-10
run: ./ci/do_ci.sh code.coverage
- name: upload report
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
file: /home/runner/build/coverage.info
files: /home/runner/build/coverage.info

markdown-lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -923,3 +925,42 @@ jobs:
- name: run ./ci/docfx.cmd
shell: cmd
run: ./ci/docfx.cmd

w3c_trace_context_compliance_v1:
name: W3C Distributed Tracing Validation V1
runs-on: ubuntu-latest
steps:
- name: Checkout open-telemetry/opentelemetry-cpp
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
run: |
sudo -E ./ci/setup_googletest.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run w3c trace-context test server (background)
env:
CXX_STANDARD: '14'
run: |
./ci/do_ci.sh cmake.w3c.trace-context.build-server
cd $HOME/build/ext/test/w3c_tracecontext_http_test_server
./w3c_tracecontext_http_test_server &
- name: Checkout w3c/trace-context repo
uses: actions/checkout@v4
with:
repository: w3c/trace-context
path: trace-context
- name: install dependencies
run: |
sudo apt update && sudo apt install python3-pip
sudo pip3 install aiohttp
- name: run w3c trace-context test suite
env:
SPEC_LEVEL: 1
run:
|
python ${GITHUB_WORKSPACE}/trace-context/test/test.py http://localhost:30000/test TraceContextTest AdvancedTest
curl http://localhost:30000/stop
81 changes: 81 additions & 0 deletions .github/workflows/clang-tidy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: clang-tidy

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
clang-tidy:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Environment
env:
PROTOBUF_VERSION: '23.3'
ABSEIL_CPP_VERSION: '20230125.3'
CXX_STANDARD: '14'
run: |
sudo apt update -y
sudo apt install -y --no-install-recommends --no-install-suggests \
build-essential \
iwyu \
cmake \
libssl-dev \
libcurl4-openssl-dev \
libprotobuf-dev \
protobuf-compiler \
libgmock-dev \
libgtest-dev \
libbenchmark-dev
if ! command -v clang-tidy &> /dev/null; then
echo "clang-tidy could not be found"
exit 1
fi
echo "Using clang-tidy version: $(clang-tidy --version)"
echo "clang-tidy installed at: $(which clang-tidy)"
- name: Prepare CMake
env:
CC: clang
CXX: clang++
run: |
echo "Running cmake..."
cmake -B build \
-DCMAKE_CXX_STANDARD=14 \
-DWITH_STL=CXX14 \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_FILE=ON \
-DWITH_PROMETHEUS=ON \
-DWITH_ZIPKIN=ON \
-DWITH_ELASTICSEARCH=ON \
-DWITH_OTLP_HTTP_COMPRESSION=ON \
-DWITH_EXAMPLES=ON \
-DWITH_EXAMPLES_HTTP=ON \
-DBUILD_W3CTRACECONTEXT_TEST=ON \
-DWITH_METRICS_EXEMPLAR_PREVIEW=ON \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Run clang-tidy
run: |
cmake --build build --target opentelemetry_proto
jq -r .[].file build/compile_commands.json | grep -vE '/(generated|third_party)/' | xargs -P $(nproc) -n 1 clang-tidy --quiet -p build 2>&1 | tee -a clang-tidy.log
- uses: actions/upload-artifact@v4
with:
name: Logs (clang-tidy)
path: ./clang-tidy.log

- name: Count warnings
run: |
COUNT=$(grep -c "warning:" clang-tidy.log)
echo "clang-tidy reported ${COUNT} warning(s)"
# TODO: include WITH_OTLP_GRPC and WITH_ABSEIL flags.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
rm -rf third_party
- name: Setup
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
GOOGLETEST_VERSION: 1.12.1
run: |
sudo -E ./ci/setup_googletest.sh
Expand Down
Loading

0 comments on commit 2564cc6

Please sign in to comment.