Skip to content

Commit

Permalink
Merge branch 'main' into version_proto
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Jul 29, 2024
2 parents e47bac6 + deed1e3 commit 5405302
Show file tree
Hide file tree
Showing 207 changed files with 2,387 additions and 1,595 deletions.
3 changes: 0 additions & 3 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
# bazel configurations for running tests under sanitizers.
# Based on https:/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

Expand Down
39 changes: 39 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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-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.
9 changes: 8 additions & 1 deletion .github/workflows/iwyu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,17 @@ jobs:
TOPDIR=`pwd`
mkdir build && cd build
CC="clang" CXX="clang++" cmake \
-DCMAKE_CXX_STANDARD=14 \
-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 \
-DWITH_OTLP_FILE=ON \
-DWITH_OTLP_HTTP_COMPRESSION=ON \
-DWITH_ZIPKIN=ON \
-DWITH_PROMETHEUS=OFF \
..
- name: iwyu_tool
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:/open-telemetry/opentelemetry-cpp/pull/3001)

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

Breaking changes:

* [REMOVAL] Remove build option `WITH_DEPRECATED_SDK_FACTORY`
[#2717](https:/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:/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:/open-telemetry/opentelemetry-cpp/pull/2720)

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

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

* [DOC] Remove comment for unused LoggerProvider initialization params
[#2972](https:/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:/open-telemetry/opentelemetry-cpp/pull/2721)
[#2722](https:/open-telemetry/opentelemetry-cpp/pull/2722)

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

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

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

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

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

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

* [Metrics SDK] Fix hash calculation for nostd::string
[#2999](https:/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:/open-telemetry/opentelemetry-cpp/pull/2721)
[#2722](https:/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 5405302

Please sign in to comment.