Skip to content

Commit

Permalink
Merged from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
malkia committed Jul 20, 2024
2 parents d7d53d2 + deed1e3 commit 7521f1a
Show file tree
Hide file tree
Showing 53 changed files with 919 additions and 735 deletions.
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ common --noexperimental_merged_skyframe_analysis_execution

common --nolegacy_external_runfiles
common --skip_incompatible_explicit_targets

# Enable automatic configs based on platform
common --enable_platform_specific_config
common --enable_runfiles

Expand Down
48 changes: 9 additions & 39 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

Checks: >
-*,
performance-*,
portability-*,
abseil-*,
-abseil-string-find-str-contains,
bugprone-*,
Expand All @@ -13,7 +15,6 @@ Checks: >
-bugprone-unchecked-optional-access,
-bugprone-unhandled-exception-at-new,
-bugprone-unused-local-non-trivial-variable,
-bugprone-unused-return-value,
google-*,
-google-build-using-namespace,
-google-default-arguments,
Expand All @@ -29,41 +30,10 @@ Checks: >
-misc-non-private-member-variables-in-classes,
-misc-unused-alias-decls,
-misc-use-anonymous-namespace,
performance-*,
-performance-move-const-arg,
portability-*
# readability-*,
# -readability-convert-member-functions-to-static,
# -readability-else-after-return,
# -readability-function-cognitive-complexity,
# -readability-identifier-length,
# -readability-implicit-bool-conversion,
# -readability-isolate-declaration,
# -readability-magic-numbers,
# -readability-named-parameter,
# -readability-redundant-*,
# -readability-string-compare,
# cppcoreguidelines-*,
# -cppcoreguidelines-avoid-c-arrays,
# -cppcoreguidelines-avoid-magic-numbers,
# -cppcoreguidelines-init-variables,
# -cppcoreguidelines-macro-usage,
# -cppcoreguidelines-non-private-member-variables-in-classes,
# -cppcoreguidelines-pro-*,
# modernize-*,
# -modernize-use-default-member-init,
# -modernize-use-nodiscard,
# -modernize-use-trailing-return-type,
# -modernize-avoid-c-arrays,
# -modernize-use-using

# Use existing clang-format for formatting the code
# FormatStyle: 'file'

# TODO: include checks: readability, cppcoreguidelines, modernize , google-readability-namespace-comments, google-readability-avoid-underscore-in-googletest-name, performance-move-const-arg






cppcoreguidelines-*,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-init-variables,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-pro-*
84 changes: 84 additions & 0 deletions .github/workflows/clang-tidy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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: |
mkdir -p build && cd build
echo "Running cmake..."
cmake .. \
-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 \
-DCMAKE_CXX_CLANG_TIDY="clang-tidy"
- name: Run clang-tidy
run: |
cd build
make -j$(nproc) 2>&1 | tee -a clang-tidy.log || exit 1
- uses: actions/upload-artifact@v4
with:
name: Logs (clang-tidy)
path: ./build/clang-tidy.log

- name: Count warnings
run: |
cd build
COUNT=$(grep -c "warning:" clang-tidy.log)
echo "clang-tidy reported ${COUNT} warning(s)"
# TODO: include WITH_OTLP_GRPC and WITH_ABSEIL flags.
1 change: 0 additions & 1 deletion .github/workflows/iwyu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
-DWITH_STL=CXX14 \
-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-w;-Xiwyu;--mapping_file=${TOPDIR}/.iwyu.imp;" \
-DBUILD_TESTING=OFF \
-DWITH_DEPRECATED_SDK_FACTORY=OFF \
-DBUILD_W3CTRACECONTEXT_TEST=OFF \
-DWITH_OTLP_GRPC=OFF \
-DWITH_OTLP_HTTP=ON \
Expand Down
80 changes: 78 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,91 @@ Increment the:

## [Unreleased]

* [CI] Add a clang-tidy build
[#3001](https://github.com/open-telemetry/opentelemetry-cpp/pull/3001)

* [REMOVAL] Remove build option `WITH_DEPRECATED_SDK_FACTORY`
[#2717](https://github.com/open-telemetry/opentelemetry-cpp/pull/2717)

Breaking changes:

* [REMOVAL] Remove build option `WITH_DEPRECATED_SDK_FACTORY`
[#2717](https://github.com/open-telemetry/opentelemetry-cpp/pull/2717)

* As announced in opentelemetry-cpp previous release 1.16.0,
CMake option `WITH_DEPRECATED_SDK_FACTORY` was temporary,
and to be removed by the next release.
* This option is now removed.
* Code configuring the SDK must be adjusted, as previously described:

* [API/SDK] Provider cleanup
[#2664](https://github.com/open-telemetry/opentelemetry-cpp/pull/2664)

* Before this fix:
* SDK factory methods such as:
* opentelemetry::sdk::trace::TracerProviderFactory::Create()
* opentelemetry::sdk::metrics::MeterProviderFactory::Create()
* opentelemetry::sdk::logs::LoggerProviderFactory::Create()
* opentelemetry::sdk::logs::EventLoggerProviderFactory::Create()

returned an API object (opentelemetry::trace::TracerProvider)
to the caller.

* After this fix, these methods return an SDK level object
(opentelemetry::sdk::trace::TracerProvider) to the caller.
* Returning an SDK object is necessary for the application to
cleanup and invoke SDK level methods, such as ForceFlush(),
on a provider.
* The application code that configures the SDK, by calling
the various provider factories, may need adjustment.
* All the examples have been updated, and in particular no
longer perform static_cast do convert an API object to an SDK object.
Please refer to examples for guidance on how to adjust.

## [1.16.1 2024-07-17]

* [BUILD] Add bazel missing BUILD file
[#2720](https://github.com/open-telemetry/opentelemetry-cpp/pull/2720)

* [SDK] Added reserve for spans array in BatchSpanProcessor.
[#2724](https://github.com/open-telemetry/opentelemetry-cpp/pull/2724)

* [DOC] Update "Using triplets" section in building-with-vcpkg documentation.
[#2726](https://github.com/open-telemetry/opentelemetry-cpp/pull/2726)

* [DOC] Remove comment for unused LoggerProvider initialization params
[#2972](https://github.com/open-telemetry/opentelemetry-cpp/pull/2972)

* [SECURITY] Remove OTLP HTTP support for TLS 1.0 and TLS 1.1,
require TLS 1.2 or better
[#2721](https://github.com/open-telemetry/opentelemetry-cpp/pull/2721)
[#2722](https://github.com/open-telemetry/opentelemetry-cpp/pull/2722)

* [TEST] Fix opentelemetry-collector bind address
[#2989](https://github.com/open-telemetry/opentelemetry-cpp/pull/2989)

* [EXPORTER] Fix references in AttributeValueVisitor
[#2985](https://github.com/open-telemetry/opentelemetry-cpp/pull/2985)

* [Code health] include-what-you-use cleanup, part 2
[#2704](https://github.com/open-telemetry/opentelemetry-cpp/pull/2704)

* [Code Health] clang-tidy cleanup, part 1
[#2990](https://github.com/open-telemetry/opentelemetry-cpp/pull/2990)

* [CI] Build failures with ABSEIL 20240116 and CMAKE 3.30
[#3002](https://github.com/open-telemetry/opentelemetry-cpp/pull/3002)

* [CI] Enable bzlmod
[#2995](https://github.com/open-telemetry/opentelemetry-cpp/pull/2995)

* [Metrics SDK] Fix hash calculation for nostd::string
[#2999](https://github.com/open-telemetry/opentelemetry-cpp/pull/2999)

Breaking changes:

* [SECURITY] Remove OTLP HTTP support for TLS 1.0 and TLS 1.1,
require TLS 1.2 or better
[#2721](https://github.com/open-telemetry/opentelemetry-cpp/pull/2721)
[#2722](https://github.com/open-telemetry/opentelemetry-cpp/pull/2722)
* The OTLP HTTP exporter no longer accept options like:
* min_TLS = 1.0
* min_TLS = 1.1
Expand Down
25 changes: 6 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,6 @@ message(STATUS "OPENTELEMETRY_VERSION=${OPENTELEMETRY_VERSION}")

option(WITH_NO_DEPRECATED_CODE "Do not include deprecated code" OFF)

# This option is temporary, and will be removed. Set
# WITH_DEPRECATED_SDK_FACTORY=OFF to migrate to the new SDK code.
option(WITH_DEPRECATED_SDK_FACTORY "Use deprecated SDK provider factory" ON)

if(WITH_DEPRECATED_SDK_FACTORY)
message(WARNING "WITH_DEPRECATED_SDK_FACTORY=ON is temporary and deprecated")
endif()

set(WITH_STL
"OFF"
CACHE STRING "Which version of the Standard Library for C++ to use")
Expand Down Expand Up @@ -204,13 +196,6 @@ if(NOT WITH_STL STREQUAL "OFF")
endif()
endif()

if(DEFINED WITH_OTLP)
message(
FATAL_ERROR
"WITH_OTLP is deprecated. Please set either WITH_OTLP_GRPC=ON, WITH_OTLP_HTTP=ON, or both to ON."
)
endif()

option(WITH_OTLP_GRPC_SSL_MTLS_PREVIEW
"Whether to enable mTLS support fro gRPC" OFF)

Expand Down Expand Up @@ -294,10 +279,6 @@ option(

option(WITH_FUNC_TESTS "Whether to build functional tests" ON)

if(DEFINED WITH_LOGS_PREVIEW)
message(WARNING "WITH_LOGS_PREVIEW is removed because logs signal is stable")
endif()

option(WITH_ASYNC_EXPORT_PREVIEW "Whether to enable async export" OFF)

# Exemplar specs status is experimental, so behind feature flag by default
Expand Down Expand Up @@ -364,9 +345,12 @@ if(WITH_PROMETHEUS)
message(STATUS "Trying to use local prometheus-cpp from submodule")
if(EXISTS ${PROJECT_SOURCE_DIR}/third_party/prometheus-cpp/.git)
set(SAVED_ENABLE_TESTING ${ENABLE_TESTING})
set(SAVED_CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY})
set(ENABLE_TESTING OFF)
set(CMAKE_CXX_CLANG_TIDY "")
add_subdirectory(third_party/prometheus-cpp)
set(ENABLE_TESTING ${SAVED_ENABLE_TESTING})
set(CMAKE_CXX_CLANG_TIDY ${SAVED_CMAKE_CXX_CLANG_TIDY})
else()
message(
FATAL_ERROR
Expand Down Expand Up @@ -444,7 +428,10 @@ if(WITH_OTLP_GRPC
include(CMakeDependentOption)

message(STATUS "PROTOBUF_PROTOC_EXECUTABLE=${PROTOBUF_PROTOC_EXECUTABLE}")
set(SAVED_CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY})
set(CMAKE_CXX_CLANG_TIDY "")
include(cmake/opentelemetry-proto.cmake)
set(CMAKE_CXX_CLANG_TIDY ${SAVED_CMAKE_CXX_CLANG_TIDY})
endif()

#
Expand Down
Loading

0 comments on commit 7521f1a

Please sign in to comment.