Skip to content

Commit

Permalink
Merge branch 'main' into refactor-urlparser
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Nov 19, 2024
2 parents e59a4b1 + 8e7a192 commit 40da6ba
Show file tree
Hide file tree
Showing 44 changed files with 1,326 additions and 549 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -876,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
15 changes: 6 additions & 9 deletions .github/workflows/clang-tidy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ jobs:
CC: clang
CXX: clang++
run: |
mkdir -p build && cd build
echo "Running cmake..."
cmake .. \
cmake -B build \
-DCMAKE_CXX_STANDARD=14 \
-DWITH_STL=CXX14 \
-DWITH_OTLP_HTTP=ON \
Expand All @@ -62,23 +61,21 @@ jobs:
-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"
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Run clang-tidy
run: |
cd build
make 2>&1 | tee -a clang-tidy.log || exit 1
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: ./build/clang-tidy.log
path: ./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.
# TODO: include WITH_OTLP_GRPC and WITH_ABSEIL flags.
62 changes: 62 additions & 0 deletions .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

name: cppcheck

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

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

- name: Set up dependencies
run: |
sudo apt update -y
sudo apt install -y cppcheck
- name: Run cppcheck
run: |
cppcheck --version | tee cppcheck.log
cppcheck \
--force \
--enable=warning,performance,portability \
--inline-suppr \
--suppress=unknownMacro:exporters/etw/include/opentelemetry/exporters/etw/TraceLoggingDynamic.h \
--language=c++ \
--std=c++14 \
-I api/include \
-I exporters/elasticsearch/include \
-I exporters/etw/include \
-I exporters/memory/include \
-I exporters/ostream/include \
-I exporters/otlp/include \
-I exporters/prometheus/include \
-I exporters/zipkin/include \
-I ext/include \
-I opentracing-shim/include \
-I sdk/include \
-i build \
-i test \
-i third_party \
-j $(nproc) \
. 2>&1 | tee --append cppcheck.log
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Logs (cppcheck)
path: ./cppcheck.log

- name: Count warnings
run: |
set +e
COUNT=`grep -c -E "\[.+\]" cppcheck.log`
echo "cppcheck reported ${COUNT} warning(s)"
# TODO: uncomment to enforce failing the build
# if [ $COUNT -ne 0 ] ; then exit 1 ; fi
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ Increment the:
* [SEMANTIC CONVENTIONS] Migration to weaver
[#3105](https://github.com/open-telemetry/opentelemetry-cpp/pull/3105)

* [EXPORTER] Allow to share gRPC clients between OTLP exporters.
[#3041](https://github.com/open-telemetry/opentelemetry-cpp/pull/3041)

Important changes:

* [API] Jaeger Propagator should not be deprecated
Expand Down
10 changes: 2 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,8 @@ if(WITH_OTLP_GRPC
OR WITH_OTLP_HTTP
OR WITH_OTLP_FILE)
find_package(Protobuf)
if(Protobuf_VERSION AND Protobuf_VERSION VERSION_GREATER_EQUAL "3.22.0")
if(NOT WITH_ABSEIL)
message(
FATAL_ERROR
"Protobuf 3.22 or upper require abseil-cpp(Recommended version: 20230125 or upper)"
)
endif()
endif()
# Protobuf 3.22 or upper require abseil-cpp, we can find it in
# opentelemetry-cpp-config.cmake

if(WITH_OTLP_GRPC)
find_package(gRPC)
Expand Down
4 changes: 2 additions & 2 deletions api/include/opentelemetry/nostd/internal/absl/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Notes on Abseil Variant implementation

This is a snapshot of Abseil Variant `absl::variant` from Abseil
`v2020-03-03#8`.
This is a snapshot of Abseil Variant
`absl::OTABSL_OPTION_NAMESPACE_NAME::variant` from Abseil `v2020-03-03#8`.
43 changes: 15 additions & 28 deletions api/include/opentelemetry/nostd/internal/absl/base/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
// namespace absl {
// OTABSL_NAMESPACE_BEGIN
//
// void Foo(); // absl::Foo().
// void Foo(); // absl::OTABSL_OPTION_NAMESPACE_NAME::Foo().
//
// OTABSL_NAMESPACE_END
// } // namespace absl
Expand All @@ -94,40 +94,32 @@
// not support forward declarations of its own types, nor does it support
// user-provided specialization of Abseil templates. Code that violates these
// rules may be broken without warning.)
#if !defined(OTABSL_OPTION_USE_INLINE_NAMESPACE) || \
!defined(OTABSL_OPTION_INLINE_NAMESPACE_NAME)
#if !defined(OTABSL_OPTION_NAMESPACE_NAME)
#error options.h is misconfigured.
#endif

// Check that OTABSL_OPTION_INLINE_NAMESPACE_NAME is neither "head" nor ""
#if defined(__cplusplus) && OTABSL_OPTION_USE_INLINE_NAMESPACE == 1
// Check that OTABSL_OPTION_NAMESPACE_NAME is neither "head" nor ""
#if defined(__cplusplus)

#define OTABSL_INTERNAL_INLINE_NAMESPACE_STR \
OTABSL_INTERNAL_TOKEN_STR(OTABSL_OPTION_INLINE_NAMESPACE_NAME)
OTABSL_INTERNAL_TOKEN_STR(OTABSL_OPTION_NAMESPACE_NAME)

static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != '\0',
"options.h misconfigured: OTABSL_OPTION_INLINE_NAMESPACE_NAME must "
"options.h misconfigured: OTABSL_OPTION_NAMESPACE_NAME must "
"not be empty.");
static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
OTABSL_INTERNAL_INLINE_NAMESPACE_STR[1] != 'e' ||
OTABSL_INTERNAL_INLINE_NAMESPACE_STR[2] != 'a' ||
OTABSL_INTERNAL_INLINE_NAMESPACE_STR[3] != 'd' ||
OTABSL_INTERNAL_INLINE_NAMESPACE_STR[4] != '\0',
"options.h misconfigured: OTABSL_OPTION_INLINE_NAMESPACE_NAME must "
"options.h misconfigured: OTABSL_OPTION_NAMESPACE_NAME must "
"be changed to a new, unique identifier name.");

#endif

#if OTABSL_OPTION_USE_INLINE_NAMESPACE == 0
#define OTABSL_NAMESPACE_BEGIN
#define OTABSL_NAMESPACE_END
#elif OTABSL_OPTION_USE_INLINE_NAMESPACE == 1
#define OTABSL_NAMESPACE_BEGIN \
inline namespace OTABSL_OPTION_INLINE_NAMESPACE_NAME {

#define OTABSL_NAMESPACE_BEGIN namespace OTABSL_OPTION_NAMESPACE_NAME {
#define OTABSL_NAMESPACE_END }
#else
#error options.h is misconfigured.
#endif

// -----------------------------------------------------------------------------
// Compiler Feature Checks
Expand Down Expand Up @@ -217,7 +209,7 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||

// OTABSL_HAVE_SOURCE_LOCATION_CURRENT
//
// Indicates whether `absl::SourceLocation::current()` will return useful
// Indicates whether `absl::OTABSL_OPTION_NAMESPACE_NAME::SourceLocation::current()` will return useful
// information in some contexts.
#ifndef OTABSL_HAVE_SOURCE_LOCATION_CURRENT
#if OTABSL_INTERNAL_HAS_KEYWORD(__builtin_LINE) && \
Expand Down Expand Up @@ -570,7 +562,7 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||

// OTABSL_USES_STD_ANY
//
// Indicates whether absl::any is an alias for std::any.
// Indicates whether absl::OTABSL_OPTION_NAMESPACE_NAME::any is an alias for std::any.
#if !defined(OTABSL_OPTION_USE_STD_ANY)
#error options.h is misconfigured.
#elif OTABSL_OPTION_USE_STD_ANY == 0 || \
Expand All @@ -585,7 +577,7 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||

// OTABSL_USES_STD_OPTIONAL
//
// Indicates whether absl::optional is an alias for std::optional.
// Indicates whether absl::OTABSL_OPTION_NAMESPACE_NAME::optional is an alias for std::optional.
#if !defined(OTABSL_OPTION_USE_STD_OPTIONAL)
#error options.h is misconfigured.
#elif OTABSL_OPTION_USE_STD_OPTIONAL == 0 || \
Expand All @@ -600,7 +592,7 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||

// OTABSL_USES_STD_VARIANT
//
// Indicates whether absl::variant is an alias for std::variant.
// Indicates whether absl::OTABSL_OPTION_NAMESPACE_NAME::variant is an alias for std::variant.
#if !defined(OTABSL_OPTION_USE_STD_VARIANT)
#error options.h is misconfigured.
#elif OTABSL_OPTION_USE_STD_VARIANT == 0 || \
Expand All @@ -615,7 +607,7 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||

// OTABSL_USES_STD_STRING_VIEW
//
// Indicates whether absl::string_view is an alias for std::string_view.
// Indicates whether absl::OTABSL_OPTION_NAMESPACE_NAME::string_view is an alias for std::string_view.
#if !defined(OTABSL_OPTION_USE_STD_STRING_VIEW)
#error options.h is misconfigured.
#elif OTABSL_OPTION_USE_STD_STRING_VIEW == 0 || \
Expand Down Expand Up @@ -650,15 +642,10 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
// the proper count to skip past the CCTZ fork namespace names. (This number
// is one larger when there is an inline namespace name to skip.)
#if defined(_MSC_VER)
#if OTABSL_OPTION_USE_INLINE_NAMESPACE == 0
#define OTABSL_INTERNAL_MANGLED_NS "absl"
#define OTABSL_INTERNAL_MANGLED_BACKREFERENCE "5"
#else
#define OTABSL_INTERNAL_MANGLED_NS \
OTABSL_INTERNAL_TOKEN_STR(OTABSL_OPTION_INLINE_NAMESPACE_NAME) "@absl"
OTABSL_INTERNAL_TOKEN_STR(OTABSL_OPTION_NAMESPACE_NAME) "@absl"
#define OTABSL_INTERNAL_MANGLED_BACKREFERENCE "6"
#endif
#endif

#undef OTABSL_INTERNAL_HAS_KEYWORD

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@
// types, etc..
#if defined(__clang__)
#define OTABSL_INTERNAL_EXTERN_DECL(type, name) \
extern const ::absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::internal::identity_t<type> name;
extern const ::absl::OTABSL_OPTION_NAMESPACE_NAME::internal::identity_t<type> name;
#else // Otherwise, just define the macro to do nothing.
#define OTABSL_INTERNAL_EXTERN_DECL(type, name)
#endif // defined(__clang__)

// See above comment at top of file for details.
#define OTABSL_INTERNAL_INLINE_CONSTEXPR(type, name, init) \
OTABSL_INTERNAL_EXTERN_DECL(type, name) \
inline constexpr ::absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::internal::identity_t<type> name = init
inline constexpr ::absl::OTABSL_OPTION_NAMESPACE_NAME::internal::identity_t<type> name = init

#else

Expand All @@ -89,14 +89,14 @@
#define OTABSL_INTERNAL_INLINE_CONSTEXPR(var_type, name, init) \
template <class /*AbslInternalDummy*/ = void> \
struct AbslInternalInlineVariableHolder##name { \
static constexpr ::absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::internal::identity_t<var_type> kInstance = init; \
static constexpr ::absl::OTABSL_OPTION_NAMESPACE_NAME::internal::identity_t<var_type> kInstance = init; \
}; \
\
template <class AbslInternalDummy> \
constexpr ::absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::internal::identity_t<var_type> \
constexpr ::absl::OTABSL_OPTION_NAMESPACE_NAME::internal::identity_t<var_type> \
AbslInternalInlineVariableHolder##name<AbslInternalDummy>::kInstance; \
\
static constexpr const ::absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::internal::identity_t<var_type>& \
static constexpr const ::absl::OTABSL_OPTION_NAMESPACE_NAME::internal::identity_t<var_type>& \
name = /* NOLINT */ \
AbslInternalInlineVariableHolder##name<>::kInstance; \
static_assert(sizeof(void (*)(decltype(name))) != 0, \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
// absl::base_internal::Invoke(f, args...) is an implementation of
// absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal::Invoke(f, args...) is an implementation of
// INVOKE(f, args...) from section [func.require] of the C++ standard.
//
// [func.require]
Expand Down Expand Up @@ -73,7 +73,7 @@ struct MemFunAndRef : StrippedAccept<MemFunAndRef> {
template <typename MemFunType, typename C, typename Obj, typename... Args>
struct AcceptImpl<MemFunType C::*, Obj, Args...>
: std::integral_constant<bool, std::is_base_of<C, Obj>::value &&
absl::is_function<MemFunType>::value> {
absl::OTABSL_OPTION_NAMESPACE_NAME::is_function<MemFunType>::value> {
};

template <typename MemFun, typename Obj, typename... Args>
Expand All @@ -94,7 +94,7 @@ struct MemFunAndPtr : StrippedAccept<MemFunAndPtr> {
template <typename MemFunType, typename C, typename Ptr, typename... Args>
struct AcceptImpl<MemFunType C::*, Ptr, Args...>
: std::integral_constant<bool, !std::is_base_of<C, Ptr>::value &&
absl::is_function<MemFunType>::value> {
absl::OTABSL_OPTION_NAMESPACE_NAME::is_function<MemFunType>::value> {
};

template <typename MemFun, typename Ptr, typename... Args>
Expand All @@ -116,7 +116,7 @@ struct DataMemAndRef : StrippedAccept<DataMemAndRef> {
template <typename R, typename C, typename Obj>
struct AcceptImpl<R C::*, Obj>
: std::integral_constant<bool, std::is_base_of<C, Obj>::value &&
!absl::is_function<R>::value> {};
!absl::OTABSL_OPTION_NAMESPACE_NAME::is_function<R>::value> {};

template <typename DataMem, typename Ref>
static decltype(std::declval<Ref>().*std::declval<DataMem>()) Invoke(
Expand All @@ -134,7 +134,7 @@ struct DataMemAndPtr : StrippedAccept<DataMemAndPtr> {
template <typename R, typename C, typename Ptr>
struct AcceptImpl<R C::*, Ptr>
: std::integral_constant<bool, !std::is_base_of<C, Ptr>::value &&
!absl::is_function<R>::value> {};
!absl::OTABSL_OPTION_NAMESPACE_NAME::is_function<R>::value> {};

template <typename DataMem, typename Ptr>
static decltype((*std::declval<Ptr>()).*std::declval<DataMem>()) Invoke(
Expand Down
8 changes: 4 additions & 4 deletions api/include/opentelemetry/nostd/internal/absl/base/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
// can be used in defining new arrays. If you use this macro on a pointer by
// mistake, you will get a compile-time error.
#define OTABSL_ARRAYSIZE(array) \
(sizeof(::absl::macros_internal::ArraySizeHelper(array)))
(sizeof(::absl::OTABSL_OPTION_NAMESPACE_NAME::macros_internal::ArraySizeHelper(array)))

namespace absl {
OTABSL_NAMESPACE_BEGIN
Expand All @@ -60,7 +60,7 @@ OTABSL_NAMESPACE_END
// static storage duration, and that the constructor should do nothing to its
// state. Use of this macro indicates to the reader that it is legal to
// declare a static instance of the class, provided the constructor is given
// the absl::base_internal::kLinkerInitialized argument.
// the absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal::kLinkerInitialized argument.
//
// Normally, it is unsafe to declare a static variable that has a constructor or
// a destructor because invocation order is undefined. However, if the type can
Expand All @@ -70,10 +70,10 @@ OTABSL_NAMESPACE_END
//
// Example:
// // Declaration
// explicit MyClass(absl::base_internal:LinkerInitialized x) {}
// explicit MyClass(absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal:LinkerInitialized x) {}
//
// // Invocation
// static MyClass my_global(absl::base_internal::kLinkerInitialized);
// static MyClass my_global(absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal::kLinkerInitialized);
namespace absl {
OTABSL_NAMESPACE_BEGIN
namespace base_internal {
Expand Down
Loading

0 comments on commit 40da6ba

Please sign in to comment.