Skip to content

Commit 40da6ba

Browse files
authored
Merge branch 'main' into refactor-urlparser
2 parents e59a4b1 + 8e7a192 commit 40da6ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1326
-549
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,9 +876,9 @@ jobs:
876876
CXX: /usr/bin/g++-10
877877
run: ./ci/do_ci.sh code.coverage
878878
- name: upload report
879-
uses: codecov/codecov-action@v4
879+
uses: codecov/codecov-action@v5
880880
with:
881-
file: /home/runner/build/coverage.info
881+
files: /home/runner/build/coverage.info
882882

883883
markdown-lint:
884884
runs-on: ubuntu-latest

.github/workflows/clang-tidy.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ jobs:
4646
CC: clang
4747
CXX: clang++
4848
run: |
49-
mkdir -p build && cd build
5049
echo "Running cmake..."
51-
cmake .. \
50+
cmake -B build \
5251
-DCMAKE_CXX_STANDARD=14 \
5352
-DWITH_STL=CXX14 \
5453
-DWITH_OTLP_HTTP=ON \
@@ -62,23 +61,21 @@ jobs:
6261
-DBUILD_W3CTRACECONTEXT_TEST=ON \
6362
-DWITH_METRICS_EXEMPLAR_PREVIEW=ON \
6463
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
65-
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
66-
-DCMAKE_CXX_CLANG_TIDY="clang-tidy"
64+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
6765
6866
- name: Run clang-tidy
6967
run: |
70-
cd build
71-
make 2>&1 | tee -a clang-tidy.log || exit 1
68+
cmake --build build --target opentelemetry_proto
69+
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
7270
7371
- uses: actions/upload-artifact@v4
7472
with:
7573
name: Logs (clang-tidy)
76-
path: ./build/clang-tidy.log
74+
path: ./clang-tidy.log
7775

7876
- name: Count warnings
7977
run: |
80-
cd build
8178
COUNT=$(grep -c "warning:" clang-tidy.log)
8279
echo "clang-tidy reported ${COUNT} warning(s)"
8380
84-
# TODO: include WITH_OTLP_GRPC and WITH_ABSEIL flags.
81+
# TODO: include WITH_OTLP_GRPC and WITH_ABSEIL flags.

.github/workflows/cppcheck.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
2+
name: cppcheck
3+
4+
on:
5+
push:
6+
branches: [ main ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
jobs:
11+
cppcheck:
12+
runs-on: ubuntu-24.04
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
submodules: 'recursive'
17+
18+
- name: Set up dependencies
19+
run: |
20+
sudo apt update -y
21+
sudo apt install -y cppcheck
22+
23+
- name: Run cppcheck
24+
run: |
25+
cppcheck --version | tee cppcheck.log
26+
cppcheck \
27+
--force \
28+
--enable=warning,performance,portability \
29+
--inline-suppr \
30+
--suppress=unknownMacro:exporters/etw/include/opentelemetry/exporters/etw/TraceLoggingDynamic.h \
31+
--language=c++ \
32+
--std=c++14 \
33+
-I api/include \
34+
-I exporters/elasticsearch/include \
35+
-I exporters/etw/include \
36+
-I exporters/memory/include \
37+
-I exporters/ostream/include \
38+
-I exporters/otlp/include \
39+
-I exporters/prometheus/include \
40+
-I exporters/zipkin/include \
41+
-I ext/include \
42+
-I opentracing-shim/include \
43+
-I sdk/include \
44+
-i build \
45+
-i test \
46+
-i third_party \
47+
-j $(nproc) \
48+
. 2>&1 | tee --append cppcheck.log
49+
50+
- uses: actions/upload-artifact@v4
51+
if: success() || failure()
52+
with:
53+
name: Logs (cppcheck)
54+
path: ./cppcheck.log
55+
56+
- name: Count warnings
57+
run: |
58+
set +e
59+
COUNT=`grep -c -E "\[.+\]" cppcheck.log`
60+
echo "cppcheck reported ${COUNT} warning(s)"
61+
# TODO: uncomment to enforce failing the build
62+
# if [ $COUNT -ne 0 ] ; then exit 1 ; fi

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ Increment the:
2727
* [SEMANTIC CONVENTIONS] Migration to weaver
2828
[#3105](https://github.com/open-telemetry/opentelemetry-cpp/pull/3105)
2929

30+
* [EXPORTER] Allow to share gRPC clients between OTLP exporters.
31+
[#3041](https://github.com/open-telemetry/opentelemetry-cpp/pull/3041)
32+
3033
Important changes:
3134

3235
* [API] Jaeger Propagator should not be deprecated

CMakeLists.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -389,14 +389,8 @@ if(WITH_OTLP_GRPC
389389
OR WITH_OTLP_HTTP
390390
OR WITH_OTLP_FILE)
391391
find_package(Protobuf)
392-
if(Protobuf_VERSION AND Protobuf_VERSION VERSION_GREATER_EQUAL "3.22.0")
393-
if(NOT WITH_ABSEIL)
394-
message(
395-
FATAL_ERROR
396-
"Protobuf 3.22 or upper require abseil-cpp(Recommended version: 20230125 or upper)"
397-
)
398-
endif()
399-
endif()
392+
# Protobuf 3.22 or upper require abseil-cpp, we can find it in
393+
# opentelemetry-cpp-config.cmake
400394

401395
if(WITH_OTLP_GRPC)
402396
find_package(gRPC)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Notes on Abseil Variant implementation
22

3-
This is a snapshot of Abseil Variant `absl::variant` from Abseil
4-
`v2020-03-03#8`.
3+
This is a snapshot of Abseil Variant
4+
`absl::OTABSL_OPTION_NAMESPACE_NAME::variant` from Abseil `v2020-03-03#8`.

api/include/opentelemetry/nostd/internal/absl/base/config.h

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
// namespace absl {
8585
// OTABSL_NAMESPACE_BEGIN
8686
//
87-
// void Foo(); // absl::Foo().
87+
// void Foo(); // absl::OTABSL_OPTION_NAMESPACE_NAME::Foo().
8888
//
8989
// OTABSL_NAMESPACE_END
9090
// } // namespace absl
@@ -94,40 +94,32 @@
9494
// not support forward declarations of its own types, nor does it support
9595
// user-provided specialization of Abseil templates. Code that violates these
9696
// rules may be broken without warning.)
97-
#if !defined(OTABSL_OPTION_USE_INLINE_NAMESPACE) || \
98-
!defined(OTABSL_OPTION_INLINE_NAMESPACE_NAME)
97+
#if !defined(OTABSL_OPTION_NAMESPACE_NAME)
9998
#error options.h is misconfigured.
10099
#endif
101100

102-
// Check that OTABSL_OPTION_INLINE_NAMESPACE_NAME is neither "head" nor ""
103-
#if defined(__cplusplus) && OTABSL_OPTION_USE_INLINE_NAMESPACE == 1
101+
// Check that OTABSL_OPTION_NAMESPACE_NAME is neither "head" nor ""
102+
#if defined(__cplusplus)
104103

105104
#define OTABSL_INTERNAL_INLINE_NAMESPACE_STR \
106-
OTABSL_INTERNAL_TOKEN_STR(OTABSL_OPTION_INLINE_NAMESPACE_NAME)
105+
OTABSL_INTERNAL_TOKEN_STR(OTABSL_OPTION_NAMESPACE_NAME)
107106

108107
static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != '\0',
109-
"options.h misconfigured: OTABSL_OPTION_INLINE_NAMESPACE_NAME must "
108+
"options.h misconfigured: OTABSL_OPTION_NAMESPACE_NAME must "
110109
"not be empty.");
111110
static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
112111
OTABSL_INTERNAL_INLINE_NAMESPACE_STR[1] != 'e' ||
113112
OTABSL_INTERNAL_INLINE_NAMESPACE_STR[2] != 'a' ||
114113
OTABSL_INTERNAL_INLINE_NAMESPACE_STR[3] != 'd' ||
115114
OTABSL_INTERNAL_INLINE_NAMESPACE_STR[4] != '\0',
116-
"options.h misconfigured: OTABSL_OPTION_INLINE_NAMESPACE_NAME must "
115+
"options.h misconfigured: OTABSL_OPTION_NAMESPACE_NAME must "
117116
"be changed to a new, unique identifier name.");
118117

119118
#endif
120119

121-
#if OTABSL_OPTION_USE_INLINE_NAMESPACE == 0
122-
#define OTABSL_NAMESPACE_BEGIN
123-
#define OTABSL_NAMESPACE_END
124-
#elif OTABSL_OPTION_USE_INLINE_NAMESPACE == 1
125-
#define OTABSL_NAMESPACE_BEGIN \
126-
inline namespace OTABSL_OPTION_INLINE_NAMESPACE_NAME {
120+
121+
#define OTABSL_NAMESPACE_BEGIN namespace OTABSL_OPTION_NAMESPACE_NAME {
127122
#define OTABSL_NAMESPACE_END }
128-
#else
129-
#error options.h is misconfigured.
130-
#endif
131123

132124
// -----------------------------------------------------------------------------
133125
// Compiler Feature Checks
@@ -217,7 +209,7 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
217209

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

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

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

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

616608
// OTABSL_USES_STD_STRING_VIEW
617609
//
618-
// Indicates whether absl::string_view is an alias for std::string_view.
610+
// Indicates whether absl::OTABSL_OPTION_NAMESPACE_NAME::string_view is an alias for std::string_view.
619611
#if !defined(OTABSL_OPTION_USE_STD_STRING_VIEW)
620612
#error options.h is misconfigured.
621613
#elif OTABSL_OPTION_USE_STD_STRING_VIEW == 0 || \
@@ -650,15 +642,10 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
650642
// the proper count to skip past the CCTZ fork namespace names. (This number
651643
// is one larger when there is an inline namespace name to skip.)
652644
#if defined(_MSC_VER)
653-
#if OTABSL_OPTION_USE_INLINE_NAMESPACE == 0
654-
#define OTABSL_INTERNAL_MANGLED_NS "absl"
655-
#define OTABSL_INTERNAL_MANGLED_BACKREFERENCE "5"
656-
#else
657645
#define OTABSL_INTERNAL_MANGLED_NS \
658-
OTABSL_INTERNAL_TOKEN_STR(OTABSL_OPTION_INLINE_NAMESPACE_NAME) "@absl"
646+
OTABSL_INTERNAL_TOKEN_STR(OTABSL_OPTION_NAMESPACE_NAME) "@absl"
659647
#define OTABSL_INTERNAL_MANGLED_BACKREFERENCE "6"
660648
#endif
661-
#endif
662649

663650
#undef OTABSL_INTERNAL_HAS_KEYWORD
664651

api/include/opentelemetry/nostd/internal/absl/base/internal/inline_variable.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@
6868
// types, etc..
6969
#if defined(__clang__)
7070
#define OTABSL_INTERNAL_EXTERN_DECL(type, name) \
71-
extern const ::absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::internal::identity_t<type> name;
71+
extern const ::absl::OTABSL_OPTION_NAMESPACE_NAME::internal::identity_t<type> name;
7272
#else // Otherwise, just define the macro to do nothing.
7373
#define OTABSL_INTERNAL_EXTERN_DECL(type, name)
7474
#endif // defined(__clang__)
7575

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

8181
#else
8282

@@ -89,14 +89,14 @@
8989
#define OTABSL_INTERNAL_INLINE_CONSTEXPR(var_type, name, init) \
9090
template <class /*AbslInternalDummy*/ = void> \
9191
struct AbslInternalInlineVariableHolder##name { \
92-
static constexpr ::absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::internal::identity_t<var_type> kInstance = init; \
92+
static constexpr ::absl::OTABSL_OPTION_NAMESPACE_NAME::internal::identity_t<var_type> kInstance = init; \
9393
}; \
9494
\
9595
template <class AbslInternalDummy> \
96-
constexpr ::absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::internal::identity_t<var_type> \
96+
constexpr ::absl::OTABSL_OPTION_NAMESPACE_NAME::internal::identity_t<var_type> \
9797
AbslInternalInlineVariableHolder##name<AbslInternalDummy>::kInstance; \
9898
\
99-
static constexpr const ::absl::OTABSL_OPTION_INLINE_NAMESPACE_NAME::internal::identity_t<var_type>& \
99+
static constexpr const ::absl::OTABSL_OPTION_NAMESPACE_NAME::internal::identity_t<var_type>& \
100100
name = /* NOLINT */ \
101101
AbslInternalInlineVariableHolder##name<>::kInstance; \
102102
static_assert(sizeof(void (*)(decltype(name))) != 0, \

api/include/opentelemetry/nostd/internal/absl/base/internal/invoke.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414
//
15-
// absl::base_internal::Invoke(f, args...) is an implementation of
15+
// absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal::Invoke(f, args...) is an implementation of
1616
// INVOKE(f, args...) from section [func.require] of the C++ standard.
1717
//
1818
// [func.require]
@@ -73,7 +73,7 @@ struct MemFunAndRef : StrippedAccept<MemFunAndRef> {
7373
template <typename MemFunType, typename C, typename Obj, typename... Args>
7474
struct AcceptImpl<MemFunType C::*, Obj, Args...>
7575
: std::integral_constant<bool, std::is_base_of<C, Obj>::value &&
76-
absl::is_function<MemFunType>::value> {
76+
absl::OTABSL_OPTION_NAMESPACE_NAME::is_function<MemFunType>::value> {
7777
};
7878

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

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

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

139139
template <typename DataMem, typename Ptr>
140140
static decltype((*std::declval<Ptr>()).*std::declval<DataMem>()) Invoke(

api/include/opentelemetry/nostd/internal/absl/base/macros.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
// can be used in defining new arrays. If you use this macro on a pointer by
4242
// mistake, you will get a compile-time error.
4343
#define OTABSL_ARRAYSIZE(array) \
44-
(sizeof(::absl::macros_internal::ArraySizeHelper(array)))
44+
(sizeof(::absl::OTABSL_OPTION_NAMESPACE_NAME::macros_internal::ArraySizeHelper(array)))
4545

4646
namespace absl {
4747
OTABSL_NAMESPACE_BEGIN
@@ -60,7 +60,7 @@ OTABSL_NAMESPACE_END
6060
// static storage duration, and that the constructor should do nothing to its
6161
// state. Use of this macro indicates to the reader that it is legal to
6262
// declare a static instance of the class, provided the constructor is given
63-
// the absl::base_internal::kLinkerInitialized argument.
63+
// the absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal::kLinkerInitialized argument.
6464
//
6565
// Normally, it is unsafe to declare a static variable that has a constructor or
6666
// a destructor because invocation order is undefined. However, if the type can
@@ -70,10 +70,10 @@ OTABSL_NAMESPACE_END
7070
//
7171
// Example:
7272
// // Declaration
73-
// explicit MyClass(absl::base_internal:LinkerInitialized x) {}
73+
// explicit MyClass(absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal:LinkerInitialized x) {}
7474
//
7575
// // Invocation
76-
// static MyClass my_global(absl::base_internal::kLinkerInitialized);
76+
// static MyClass my_global(absl::OTABSL_OPTION_NAMESPACE_NAME::base_internal::kLinkerInitialized);
7777
namespace absl {
7878
OTABSL_NAMESPACE_BEGIN
7979
namespace base_internal {

0 commit comments

Comments
 (0)