diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 055b8cfe60..32a3f784fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -726,7 +726,7 @@ jobs: format: name: Format - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - name: setup diff --git a/CHANGELOG.md b/CHANGELOG.md index 9381363300..27c379349f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,9 @@ Increment the: * [SDK] Update ExemplarFilter and ExemplarReservoir for spec [#2372](https://github.com/open-telemetry/opentelemetry-cpp/pull/2372) +* [CI] Upgrade to clang-format 18 + [#2684](https://github.com/open-telemetry/opentelemetry-cpp/pull/2684) + Notes on experimental features: * [#2372](https://github.com/open-telemetry/opentelemetry-cpp/issues/2372) diff --git a/api/include/opentelemetry/common/kv_properties.h b/api/include/opentelemetry/common/kv_properties.h index 00fa2571c2..b5accab403 100644 --- a/api/include/opentelemetry/common/kv_properties.h +++ b/api/include/opentelemetry/common/kv_properties.h @@ -158,7 +158,7 @@ class KeyValueProperties } // Move contructor and assignment operator - Entry(Entry &&other) = default; + Entry(Entry &&other) = default; Entry &operator=(Entry &&other) = default; // Creates an Entry for a given key-value pair. diff --git a/api/include/opentelemetry/common/spin_lock_mutex.h b/api/include/opentelemetry/common/spin_lock_mutex.h index 8cec8dfea3..369183b953 100644 --- a/api/include/opentelemetry/common/spin_lock_mutex.h +++ b/api/include/opentelemetry/common/spin_lock_mutex.h @@ -53,8 +53,8 @@ class SpinLockMutex { public: SpinLockMutex() noexcept {} - ~SpinLockMutex() noexcept = default; - SpinLockMutex(const SpinLockMutex &) = delete; + ~SpinLockMutex() noexcept = default; + SpinLockMutex(const SpinLockMutex &) = delete; SpinLockMutex &operator=(const SpinLockMutex &) = delete; static inline void fast_yield() noexcept diff --git a/api/include/opentelemetry/logs/event_logger.h b/api/include/opentelemetry/logs/event_logger.h index 988142fbe2..b5c94a7067 100644 --- a/api/include/opentelemetry/logs/event_logger.h +++ b/api/include/opentelemetry/logs/event_logger.h @@ -56,7 +56,7 @@ class EventLogger * span> -> attributes(return type of MakeAttributes) */ template - void EmitEvent(nostd::string_view event_name, ArgumentType &&... args) + void EmitEvent(nostd::string_view event_name, ArgumentType &&...args) { nostd::shared_ptr delegate_logger = GetDelegateLogger(); if (!delegate_logger) diff --git a/api/include/opentelemetry/logs/logger.h b/api/include/opentelemetry/logs/logger.h index 6448ff6901..46fd8bca72 100644 --- a/api/include/opentelemetry/logs/logger.h +++ b/api/include/opentelemetry/logs/logger.h @@ -65,7 +65,7 @@ class Logger * span> -> attributes(return type of MakeAttributes) */ template - void EmitLogRecord(nostd::unique_ptr &&log_record, ArgumentType &&... args) + void EmitLogRecord(nostd::unique_ptr &&log_record, ArgumentType &&...args) { if (!log_record) { @@ -97,7 +97,7 @@ class Logger * span> -> attributes(return type of MakeAttributes) */ template - void EmitLogRecord(ArgumentType &&... args) + void EmitLogRecord(ArgumentType &&...args) { nostd::unique_ptr log_record = CreateLogRecord(); @@ -120,7 +120,7 @@ class Logger * span> -> attributes(return type of MakeAttributes) */ template - void Trace(ArgumentType &&... args) noexcept + void Trace(ArgumentType &&...args) noexcept { static_assert( !detail::LogRecordHasType::type...>::value, @@ -144,7 +144,7 @@ class Logger * span> -> attributes(return type of MakeAttributes) */ template - void Debug(ArgumentType &&... args) noexcept + void Debug(ArgumentType &&...args) noexcept { static_assert( !detail::LogRecordHasType::type...>::value, @@ -168,7 +168,7 @@ class Logger * span> -> attributes(return type of MakeAttributes) */ template - void Info(ArgumentType &&... args) noexcept + void Info(ArgumentType &&...args) noexcept { static_assert( !detail::LogRecordHasType::type...>::value, @@ -192,7 +192,7 @@ class Logger * span> -> attributes(return type of MakeAttributes) */ template - void Warn(ArgumentType &&... args) noexcept + void Warn(ArgumentType &&...args) noexcept { static_assert( !detail::LogRecordHasType::type...>::value, @@ -216,7 +216,7 @@ class Logger * span> -> attributes(return type of MakeAttributes) */ template - void Error(ArgumentType &&... args) noexcept + void Error(ArgumentType &&...args) noexcept { static_assert( !detail::LogRecordHasType::type...>::value, @@ -240,7 +240,7 @@ class Logger * span> -> attributes(return type of MakeAttributes) */ template - void Fatal(ArgumentType &&... args) noexcept + void Fatal(ArgumentType &&...args) noexcept { static_assert( !detail::LogRecordHasType::type...>::value, diff --git a/api/include/opentelemetry/logs/provider.h b/api/include/opentelemetry/logs/provider.h index bced5c97ea..8f65a1139d 100644 --- a/api/include/opentelemetry/logs/provider.h +++ b/api/include/opentelemetry/logs/provider.h @@ -73,8 +73,8 @@ class OPENTELEMETRY_EXPORT Provider return provider; } - OPENTELEMETRY_API_SINGLETON static nostd::shared_ptr - &GetEventProvider() noexcept + OPENTELEMETRY_API_SINGLETON static nostd::shared_ptr & + GetEventProvider() noexcept { static nostd::shared_ptr provider(new NoopEventLoggerProvider); return provider; diff --git a/api/include/opentelemetry/nostd/detail/functional.h b/api/include/opentelemetry/nostd/detail/functional.h index 437f92f0ad..0da58dd186 100644 --- a/api/include/opentelemetry/nostd/detail/functional.h +++ b/api/include/opentelemetry/nostd/detail/functional.h @@ -7,8 +7,11 @@ #include "opentelemetry/version.h" -#define OPENTELEMETRY_RETURN(...) \ - noexcept(noexcept(__VA_ARGS__))->decltype(__VA_ARGS__) { return __VA_ARGS__; } +#define OPENTELEMETRY_RETURN(...) \ + noexcept(noexcept(__VA_ARGS__))->decltype(__VA_ARGS__) \ + { \ + return __VA_ARGS__; \ + } OPENTELEMETRY_BEGIN_NAMESPACE namespace nostd diff --git a/api/include/opentelemetry/nostd/detail/invoke.h b/api/include/opentelemetry/nostd/detail/invoke.h index a0c010a8f9..55a943ed12 100644 --- a/api/include/opentelemetry/nostd/detail/invoke.h +++ b/api/include/opentelemetry/nostd/detail/invoke.h @@ -10,8 +10,11 @@ #include "opentelemetry/nostd/detail/void.h" #include "opentelemetry/version.h" -#define OPENTELEMETRY_RETURN(...) \ - noexcept(noexcept(__VA_ARGS__))->decltype(__VA_ARGS__) { return __VA_ARGS__; } +#define OPENTELEMETRY_RETURN(...) \ + noexcept(noexcept(__VA_ARGS__))->decltype(__VA_ARGS__) \ + { \ + return __VA_ARGS__; \ + } OPENTELEMETRY_BEGIN_NAMESPACE namespace nostd @@ -34,7 +37,7 @@ template <> struct Invoke { template - inline static constexpr auto invoke(R T::*pmf, Arg &&arg, Args &&... args) + inline static constexpr auto invoke(R T::*pmf, Arg &&arg, Args &&...args) OPENTELEMETRY_RETURN((std::forward(arg).*pmf)(std::forward(args)...)) }; @@ -42,7 +45,7 @@ template <> struct Invoke { template - inline static constexpr auto invoke(R T::*pmf, Arg &&arg, Args &&... args) + inline static constexpr auto invoke(R T::*pmf, Arg &&arg, Args &&...args) OPENTELEMETRY_RETURN((std::forward(arg).get().*pmf)(std::forward(args)...)) }; @@ -50,7 +53,7 @@ template <> struct Invoke { template - inline static constexpr auto invoke(R T::*pmf, Arg &&arg, Args &&... args) + inline static constexpr auto invoke(R T::*pmf, Arg &&arg, Args &&...args) OPENTELEMETRY_RETURN(((*std::forward(arg)).*pmf)(std::forward(args)...)) }; @@ -79,20 +82,21 @@ struct Invoke }; template -inline constexpr auto invoke_impl(R T::*f, Arg &&arg, Args &&... args) - OPENTELEMETRY_RETURN(Invoke::value, - (std::is_base_of>::value - ? 0 - : is_reference_wrapper>::value ? 1 : 2)>:: - invoke(f, std::forward(arg), std::forward(args)...)) +inline constexpr auto invoke_impl(R T::*f, Arg &&arg, Args &&...args) OPENTELEMETRY_RETURN( + Invoke::value, + (std::is_base_of>::value ? 0 + : is_reference_wrapper>::value ? 1 + : 2)>::invoke(f, + std::forward(arg), + std::forward(args)...)) #ifdef _MSC_VER # pragma warning(push) # pragma warning(disable : 4100) #endif - template - inline constexpr auto invoke_impl(F &&f, Args &&... args) - OPENTELEMETRY_RETURN(std::forward(f)(std::forward(args)...)) + template + inline constexpr auto invoke_impl(F &&f, Args &&...args) + OPENTELEMETRY_RETURN(std::forward(f)(std::forward(args)...)) #ifdef _MSC_VER # pragma warning(pop) #endif diff --git a/api/include/opentelemetry/nostd/detail/trait.h b/api/include/opentelemetry/nostd/detail/trait.h index 90a568c4f4..8f76fdec8b 100644 --- a/api/include/opentelemetry/nostd/detail/trait.h +++ b/api/include/opentelemetry/nostd/detail/trait.h @@ -27,9 +27,9 @@ template inline constexpr Trait trait() { - return IsTriviallyAvailable::value - ? Trait::TriviallyAvailable - : IsAvailable::value ? Trait::Available : Trait::Unavailable; + return IsTriviallyAvailable::value ? Trait::TriviallyAvailable + : IsAvailable::value ? Trait::Available + : Trait::Unavailable; } inline constexpr Trait common_trait_impl(Trait result) diff --git a/api/include/opentelemetry/nostd/unique_ptr.h b/api/include/opentelemetry/nostd/unique_ptr.h index f864eb4f04..b3f5e61998 100644 --- a/api/include/opentelemetry/nostd/unique_ptr.h +++ b/api/include/opentelemetry/nostd/unique_ptr.h @@ -96,7 +96,7 @@ class unique_ptr return *this; } - operator std::unique_ptr() &&noexcept { return std::unique_ptr{release()}; } + operator std::unique_ptr() && noexcept { return std::unique_ptr{release()}; } operator bool() const noexcept { return ptr_ != nullptr; } diff --git a/api/include/opentelemetry/nostd/utility.h b/api/include/opentelemetry/nostd/utility.h index e7ad2d77f0..3238b0328d 100644 --- a/api/include/opentelemetry/nostd/utility.h +++ b/api/include/opentelemetry/nostd/utility.h @@ -63,7 +63,7 @@ auto size(const C &c) noexcept(noexcept(c.size())) -> decltype(c.size()) } template -size_t size(T (&/* array */)[N]) noexcept +size_t size(T (& /* array */)[N]) noexcept { return N; } diff --git a/api/include/opentelemetry/plugin/hook.h b/api/include/opentelemetry/plugin/hook.h index c9597e06a0..9b18e2a6a8 100644 --- a/api/include/opentelemetry/plugin/hook.h +++ b/api/include/opentelemetry/plugin/hook.h @@ -16,13 +16,13 @@ * library and a dynamically loaded plugin. The weak linkage allows for multiple implementations to * be linked in without getting multiple definition errors. */ -# define OPENTELEMETRY_DEFINE_PLUGIN_HOOK(X) \ - extern "C" { \ - extern __declspec(dllexport) \ - opentelemetry::plugin::OpenTelemetryHook const OpenTelemetryMakeFactoryImpl; \ - \ - __declspec(selectany) \ - opentelemetry::plugin::OpenTelemetryHook const OpenTelemetryMakeFactoryImpl = X; \ +# define OPENTELEMETRY_DEFINE_PLUGIN_HOOK(X) \ + extern "C" { \ + extern __declspec(dllexport) opentelemetry::plugin::OpenTelemetryHook const \ + OpenTelemetryMakeFactoryImpl; \ + \ + __declspec(selectany) opentelemetry::plugin::OpenTelemetryHook const \ + OpenTelemetryMakeFactoryImpl = X; \ } // extern "C" #else diff --git a/api/include/opentelemetry/std/utility.h b/api/include/opentelemetry/std/utility.h index 9a1c76540b..be0f1e5f46 100644 --- a/api/include/opentelemetry/std/utility.h +++ b/api/include/opentelemetry/std/utility.h @@ -54,7 +54,7 @@ auto size(const C &c) noexcept(noexcept(c.size())) -> decltype(c.size()) } template -std::size_t size(T (&/* array */)[N]) noexcept +std::size_t size(T (& /* array */)[N]) noexcept { return N; } diff --git a/api/include/opentelemetry/std/variant.h b/api/include/opentelemetry/std/variant.h index 30d38d9c63..6acdb81e9a 100644 --- a/api/include/opentelemetry/std/variant.h +++ b/api/include/opentelemetry/std/variant.h @@ -56,8 +56,7 @@ class bad_variant_access : public std::exception // nostd::get<...> for Apple Clang // template -constexpr auto get_type = [](auto &&t) constexpr -> decltype(auto) -{ +constexpr auto get_type = [](auto &&t) constexpr -> decltype(auto) { auto v = t; auto result = std::get_if(&v); // TODO: optimize with std::forward(t) if t is not rvalue if (result) @@ -69,8 +68,7 @@ constexpr auto get_type = [](auto &&t) constexpr -> decltype(auto) }; template -constexpr auto get_index = [](auto &&t) constexpr -> decltype(auto) -{ +constexpr auto get_index = [](auto &&t) constexpr -> decltype(auto) { auto v = t; auto result = std::get_if(&v); // TODO: optimize with std::forward(t) if t is not rvalue if (result) @@ -132,7 +130,7 @@ constexpr const T &&get(const std::variant &&v) }; template -constexpr auto visit(_Callable &&_Obj, _Variants &&... _Args) +constexpr auto visit(_Callable &&_Obj, _Variants &&..._Args) { // Ref: // https://stackoverflow.com/questions/52310835/xcode-10-call-to-unavailable-function-stdvisit @@ -193,7 +191,7 @@ constexpr const T &&get(const std::variant &&v) } template -constexpr auto visit(_Callable &&_Obj, _Variants &&... _Args) +constexpr auto visit(_Callable &&_Obj, _Variants &&..._Args) { return std::visit<_Callable, _Variants...>(static_cast<_Callable &&>(_Obj), static_cast<_Variants &&>(_Args)...); diff --git a/api/include/opentelemetry/trace/span.h b/api/include/opentelemetry/trace/span.h index 27e91ceec4..f26e38e4ee 100644 --- a/api/include/opentelemetry/trace/span.h +++ b/api/include/opentelemetry/trace/span.h @@ -62,10 +62,10 @@ class Span virtual ~Span() = default; // Not copiable or movable. - Span(const Span &) = delete; - Span(Span &&) = delete; + Span(const Span &) = delete; + Span(Span &&) = delete; Span &operator=(const Span &) = delete; - Span &operator=(Span &&) = delete; + Span &operator=(Span &&) = delete; /** * Sets an attribute on the Span (ABI). diff --git a/api/include/opentelemetry/trace/tracer.h b/api/include/opentelemetry/trace/tracer.h index 82b4d0ea02..7fc758511f 100644 --- a/api/include/opentelemetry/trace/tracer.h +++ b/api/include/opentelemetry/trace/tracer.h @@ -66,7 +66,7 @@ class Tracer template ::value> * = nullptr, - nostd::enable_if_t::value> * = nullptr> + nostd::enable_if_t::value> * = nullptr> nostd::shared_ptr StartSpan(nostd::string_view name, const T &attributes, const U &links, diff --git a/api/test/common/spinlock_benchmark.cc b/api/test/common/spinlock_benchmark.cc index 214644cdae..d0fef2c41b 100644 --- a/api/test/common/spinlock_benchmark.cc +++ b/api/test/common/spinlock_benchmark.cc @@ -56,8 +56,7 @@ inline void SpinThrash(benchmark::State &s, SpinLockType &spinlock, LockF lock, static void BM_SpinLockThrashing(benchmark::State &s) { SpinLockMutex spinlock; - SpinThrash( - s, spinlock, [](SpinLockMutex &m) { m.lock(); }, [](SpinLockMutex &m) { m.unlock(); }); + SpinThrash(s, spinlock, [](SpinLockMutex &m) { m.lock(); }, [](SpinLockMutex &m) { m.unlock(); }); } // Naive `while(try_lock()) {}` implementation of lock. diff --git a/api/test/nostd/shared_ptr_test.cc b/api/test/nostd/shared_ptr_test.cc index 6f3d43a771..0c79c7efd2 100644 --- a/api/test/nostd/shared_ptr_test.cc +++ b/api/test/nostd/shared_ptr_test.cc @@ -129,8 +129,7 @@ TEST(SharedPtrTest, PointerOperators) shared_ptr ptr1{value}; EXPECT_EQ(&*ptr1, value); - EXPECT_EQ( - shared_ptr { new B }->f(), 123); + EXPECT_EQ(shared_ptr { new B } -> f(), 123); } TEST(SharedPtrTest, Swap) diff --git a/api/test/nostd/unique_ptr_test.cc b/api/test/nostd/unique_ptr_test.cc index aa49d387b7..f3684be0b8 100644 --- a/api/test/nostd/unique_ptr_test.cc +++ b/api/test/nostd/unique_ptr_test.cc @@ -114,8 +114,7 @@ TEST(UniquePtrTest, PointerOperators) unique_ptr ptr1{value}; EXPECT_EQ(&*ptr1, value); - EXPECT_EQ( - unique_ptr { new B }->f(), 123); + EXPECT_EQ(unique_ptr { new B } -> f(), 123); } TEST(UniquePtrTest, Reset) diff --git a/api/test/singleton/component_g.cc b/api/test/singleton/component_g.cc index 49732d9b1f..50de03ee98 100644 --- a/api/test/singleton/component_g.cc +++ b/api/test/singleton/component_g.cc @@ -34,7 +34,8 @@ extern "C" __declspec(dllexport) #endif - void do_something_in_g() + void + do_something_in_g() { auto scoped_span = trace::Scope(get_tracer()->StartSpan("G::library")); diff --git a/api/test/singleton/component_h.cc b/api/test/singleton/component_h.cc index b486536fc2..3ff6e0cc5a 100644 --- a/api/test/singleton/component_h.cc +++ b/api/test/singleton/component_h.cc @@ -35,12 +35,13 @@ extern "C" __declspec(dllexport) #else -// component_h is a shared library (*.so) -// component_h is compiled with visibility("hidden"), -__attribute__((visibility("default"))) + // component_h is a shared library (*.so) + // component_h is compiled with visibility("hidden"), + __attribute__((visibility("default"))) #endif - void do_something_in_h() + void + do_something_in_h() { auto scoped_span = trace::Scope(get_tracer()->StartSpan("H::library")); diff --git a/api/test/trace/propagation/b3_propagation_test.cc b/api/test/trace/propagation/b3_propagation_test.cc index 9791c54378..5546916abc 100644 --- a/api/test/trace/propagation/b3_propagation_test.cc +++ b/api/test/trace/propagation/b3_propagation_test.cc @@ -155,8 +155,8 @@ TEST(B3PropagationTest, SetRemoteSpanMultiHeader) { TextMapCarrierTest carrier; carrier.headers_ = {{"X-B3-TraceId", "80f198ee56343ba864fe8b2a57d3eff7"}, - {"X-B3-SpanId", "e457b5a2e4d86bd1"}, - {"X-B3-Sampled", "1"}}; + {"X-B3-SpanId", "e457b5a2e4d86bd1"}, + {"X-B3-Sampled", "1"}}; context::Context ctx1 = context::Context{}; context::Context ctx2 = format.Extract(carrier, ctx1); diff --git a/api/test/trace/trace_state_test.cc b/api/test/trace/trace_state_test.cc index ed6c7e8274..7f5a05cfe6 100644 --- a/api/test/trace/trace_state_test.cc +++ b/api/test/trace/trace_state_test.cc @@ -177,7 +177,7 @@ TEST(TraceStateTest, MemorySafe) nostd::string_view key_string = "test_key_1test_key_2test_key_3"; nostd::string_view val_string = "test_val_1test_val_2test_val_3"; nostd::string_view keys[kNumPairs] = {key_string.substr(0, 10), key_string.substr(10, 10), - key_string.substr(20, 10)}; + key_string.substr(20, 10)}; nostd::string_view values[kNumPairs] = {val_string.substr(0, 10), val_string.substr(10, 10), val_string.substr(20, 10)}; diff --git a/ci/Dockerfile b/ci/Dockerfile deleted file mode 100644 index 21473fce96..0000000000 --- a/ci/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -FROM ubuntu:18.04 - -WORKDIR /setup-ci - -ADD setup_ci_environment.sh /setup-ci -ADD setup_cmake.sh /setup-ci -ADD install_gcc48.sh /setup-ci -ADD install_bazelisk.sh /setup-ci -ADD install_protobuf.sh /setup-ci -ADD install_format_tools.sh /setup-ci - -RUN /setup-ci/setup_ci_environment.sh \ - && /setup-ci/setup_cmake.sh \ - && /setup-ci/install_gcc48.sh \ - && /setup-ci/install_bazelisk.sh \ - && /setup-ci/install_protobuf.sh \ - && /setup-ci/install_format_tools.sh diff --git a/ci/install_format_tools.sh b/ci/install_format_tools.sh index fc6960f9dd..3ede569da1 100755 --- a/ci/install_format_tools.sh +++ b/ci/install_format_tools.sh @@ -5,7 +5,23 @@ set -e -apt-get install -y clang-format-10 python3-pip git curl -pip3 install cmake_format==0.6.13 -curl -L -o /usr/local/bin/buildifier https://github.com/bazelbuild/buildtools/releases/download/2.2.1/buildifier +CLANG_VERSION=18 +CMAKE_FORMAT_VERSION=0.6.13 +BUILDIFIER_VERSION=3.5.0 + +# +# This script expects ubuntu:24.04 +# + +apt update + +# Install clang-format +apt install -y clang-format-${CLANG_VERSION} python3 python3-pip git curl +# ln /usr/bin/clang-format-${CLANG_VERSION} /usr/bin/clang-format + +# Install cmake_format +pip3 install --break-system-packages cmake_format==${CMAKE_FORMAT_VERSION} + +# Install buildifier +curl -L -o /usr/local/bin/buildifier https://github.com/bazelbuild/buildtools/releases/download/${BUILDIFIER_VERSION}/buildifier chmod +x /usr/local/bin/buildifier diff --git a/examples/grpc/client.cc b/examples/grpc/client.cc index 3163b38986..b8f233dcc7 100644 --- a/examples/grpc/client.cc +++ b/examples/grpc/client.cc @@ -51,10 +51,10 @@ class GreeterClient auto span = get_tracer("grpc")->StartSpan( span_name, {{SemanticConventions::kRpcSystem, "grpc"}, - {SemanticConventions::kRpcService, "grpc-example.GreetService"}, - {SemanticConventions::kRpcMethod, "Greet"}, - {SemanticConventions::kNetworkPeerAddress, ip}, - {SemanticConventions::kNetworkPeerPort, port}}, + {SemanticConventions::kRpcService, "grpc-example.GreetService"}, + {SemanticConventions::kRpcMethod, "Greet"}, + {SemanticConventions::kNetworkPeerAddress, ip}, + {SemanticConventions::kNetworkPeerPort, port}}, options); auto scope = get_tracer("grpc-client")->WithActiveSpan(span); diff --git a/examples/grpc/server.cc b/examples/grpc/server.cc index 6ba96a009e..a8fac8b5f0 100644 --- a/examples/grpc/server.cc +++ b/examples/grpc/server.cc @@ -68,11 +68,11 @@ class GreeterServer final : public Greeter::Service std::string span_name = "GreeterService/Greet"; auto span = get_tracer("grpc")->StartSpan(span_name, - {{SemanticConventions::kRpcSystem, "grpc"}, - {SemanticConventions::kRpcService, "GreeterService"}, - {SemanticConventions::kRpcMethod, "Greet"}, - {SemanticConventions::kRpcGrpcStatusCode, 0}}, - options); + {{SemanticConventions::kRpcSystem, "grpc"}, + {SemanticConventions::kRpcService, "GreeterService"}, + {SemanticConventions::kRpcMethod, "Greet"}, + {SemanticConventions::kRpcGrpcStatusCode, 0}}, + options); auto scope = get_tracer("grpc")->WithActiveSpan(span); // Fetch and parse whatever HTTP headers we can from the gRPC request. diff --git a/exporters/elasticsearch/src/es_log_record_exporter.cc b/exporters/elasticsearch/src/es_log_record_exporter.cc index 196474ba77..e58fb1dda4 100644 --- a/exporters/elasticsearch/src/es_log_record_exporter.cc +++ b/exporters/elasticsearch/src/es_log_record_exporter.cc @@ -288,12 +288,11 @@ class AsyncResponseHandler : public http_client::EventHandler #endif ElasticsearchLogRecordExporter::ElasticsearchLogRecordExporter() - : options_{ElasticsearchExporterOptions()}, http_client_ -{ - ext::http::client::HttpClientFactory::Create() -} + : options_{ElasticsearchExporterOptions()}, + http_client_{ext::http::client::HttpClientFactory::Create()} #ifdef ENABLE_ASYNC_EXPORT -, synchronization_data_(new SynchronizationData()) + , + synchronization_data_(new SynchronizationData()) #endif { #ifdef ENABLE_ASYNC_EXPORT @@ -360,13 +359,13 @@ sdk::common::ExportResult ElasticsearchLogRecordExporter::Export( if (result != opentelemetry::sdk::common::ExportResult::kSuccess) { OTEL_INTERNAL_LOG_ERROR("[ES Log Exporter] ERROR: Export " - << span_count - << " trace span(s) error: " << static_cast(result)); + << span_count + << " trace span(s) error: " << static_cast(result)); } else { OTEL_INTERNAL_LOG_DEBUG("[ES Log Exporter] Export " << span_count - << " trace span(s) success"); + << " trace span(s) success"); } synchronization_data->finished_session_counter_.fetch_add(1, std::memory_order_release); diff --git a/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h b/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h index b2de664d12..3a14780d8c 100644 --- a/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h +++ b/exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h @@ -223,8 +223,8 @@ class PropertyValue : public PropertyVariant break; } case opentelemetry::common::AttributeType::kTypeString: { - PropertyVariant::operator= - (std::string{nostd::string_view(nostd::get(v)).data()}); + PropertyVariant::operator=( + std::string{nostd::string_view(nostd::get(v)).data()}); break; } diff --git a/exporters/etw/include/opentelemetry/exporters/etw/etw_tracer.h b/exporters/etw/include/opentelemetry/exporters/etw/etw_tracer.h index 454f6cff5a..9071fd47d4 100644 --- a/exporters/etw/include/opentelemetry/exporters/etw/etw_tracer.h +++ b/exporters/etw/include/opentelemetry/exporters/etw/etw_tracer.h @@ -485,10 +485,9 @@ class Tracer : public opentelemetry::trace::Tracer, auto spanContext = std::unique_ptr(new opentelemetry::trace::SpanContext( traceId, GetIdGenerator(tracerProvider_).GenerateSpanId(), traceFlags, false, - sampling_result.trace_state - ? sampling_result.trace_state - : parentContext.IsValid() ? parentContext.trace_state() - : opentelemetry::trace::TraceState::GetDefault())); + sampling_result.trace_state ? sampling_result.trace_state + : parentContext.IsValid() ? parentContext.trace_state() + : opentelemetry::trace::TraceState::GetDefault())); if (sampling_result.decision == sdk::trace::Decision::DROP) { diff --git a/exporters/etw/include/opentelemetry/exporters/etw/uuid.h b/exporters/etw/include/opentelemetry/exporters/etw/uuid.h index a004aec9e3..dfe749d831 100644 --- a/exporters/etw/include/opentelemetry/exporters/etw/uuid.h +++ b/exporters/etw/include/opentelemetry/exporters/etw/uuid.h @@ -257,15 +257,15 @@ struct UUID void to_bytes(uint8_t (&guid_bytes)[16]) const { // Part 1 - guid_bytes[0] = (uint8_t)((Data1)&0xFF); + guid_bytes[0] = (uint8_t)((Data1) & 0xFF); guid_bytes[1] = (uint8_t)((Data1 >> 8) & 0xFF); guid_bytes[2] = (uint8_t)((Data1 >> 16) & 0xFF); guid_bytes[3] = (uint8_t)((Data1 >> 24) & 0xFF); // Part 2 - guid_bytes[4] = (uint8_t)((Data2)&0xFF); + guid_bytes[4] = (uint8_t)((Data2) & 0xFF); guid_bytes[5] = (uint8_t)((Data2 >> 8) & 0xFF); // Part 3 - guid_bytes[6] = (uint8_t)((Data3)&0xFF); + guid_bytes[6] = (uint8_t)((Data3) & 0xFF); guid_bytes[7] = (uint8_t)((Data3 >> 8) & 0xFF); // Part 4 for (size_t i = 0; i < 8; i++) diff --git a/exporters/etw/test/etw_perf_test.cc b/exporters/etw/test/etw_perf_test.cc index 79052464e8..06af94a5af 100644 --- a/exporters/etw/test/etw_perf_test.cc +++ b/exporters/etw/test/etw_perf_test.cc @@ -62,8 +62,8 @@ class ETWProviderStressTest { std::string eventName = "MyEvent"; Properties event = {{"uint32Key", (uint32_t)1234}, - {"uint64Key", (uint64_t)1234567890}, - {"strKey", "someValue"}}; + {"uint64Key", (uint64_t)1234567890}, + {"strKey", "someValue"}}; span_->AddEvent(eventName, event); return true; } diff --git a/exporters/ostream/src/span_exporter.cc b/exporters/ostream/src/span_exporter.cc index 2e6186b6f7..4faa6854be 100644 --- a/exporters/ostream/src/span_exporter.cc +++ b/exporters/ostream/src/span_exporter.cc @@ -70,8 +70,7 @@ sdk::common::ExportResult OStreamSpanExporter::Export( span->GetSpanId().ToLowerBase16(span_id); span->GetParentSpanId().ToLowerBase16(parent_span_id); - sout_ << "{" - << "\n name : " << span->GetName() + sout_ << "{" << "\n name : " << span->GetName() << "\n trace_id : " << std::string(trace_id, 32) << "\n span_id : " << std::string(span_id, 16) << "\n tracestate : " << span->GetSpanContext().trace_state()->ToHeader() @@ -130,8 +129,7 @@ void OStreamSpanExporter::printEvents(const std::vector char span_id[16] = {0}; link.GetSpanContext().trace_id().ToLowerBase16(trace_id); link.GetSpanContext().span_id().ToLowerBase16(span_id); - sout_ << "\n\t{" - << "\n\t trace_id : " << std::string(trace_id, 32) + sout_ << "\n\t{" << "\n\t trace_id : " << std::string(trace_id, 32) << "\n\t span_id : " << std::string(span_id, 16) << "\n\t tracestate : " << link.GetSpanContext().trace_state()->ToHeader() << "\n\t attributes : "; diff --git a/exporters/otlp/src/otlp_grpc_client.cc b/exporters/otlp/src/otlp_grpc_client.cc index 90bbd41938..3410726cf8 100644 --- a/exporters/otlp/src/otlp_grpc_client.cc +++ b/exporters/otlp/src/otlp_grpc_client.cc @@ -311,7 +311,7 @@ std::shared_ptr OtlpGrpcClient::MakeChannel(const OtlpGrpcClientO ssl_opts.pem_private_key = GetFileContentsOrInMemoryContents(options.ssl_client_key_path, options.ssl_client_key_string); ssl_opts.pem_cert_chain = GetFileContentsOrInMemoryContents(options.ssl_client_cert_path, - options.ssl_client_cert_string); + options.ssl_client_cert_string); #endif channel = diff --git a/exporters/otlp/test/otlp_grpc_exporter_benchmark.cc b/exporters/otlp/test/otlp_grpc_exporter_benchmark.cc index e03985e3ae..53ea48800f 100644 --- a/exporters/otlp/test/otlp_grpc_exporter_benchmark.cc +++ b/exporters/otlp/test/otlp_grpc_exporter_benchmark.cc @@ -40,7 +40,7 @@ const trace::SpanId kSpanId(std::array({0, 2})); const trace::SpanId kParentSpanId(std::array({0, 0, 0, 0, 0, 0, 0, 3})); -const auto kTraceState = trace_api::TraceState::GetDefault() -> Set("key1", "value"); +const auto kTraceState = trace_api::TraceState::GetDefault()->Set("key1", "value"); const trace_api::SpanContext kSpanContext{ kTraceId, kSpanId, trace_api::TraceFlags{trace_api::TraceFlags::kIsSampled}, true, kTraceState}; @@ -109,18 +109,20 @@ class FakeServiceStub : public proto::collector::trace::v1::TraceService::StubIn return grpc::Status::OK; } - grpc::ClientAsyncResponseReaderInterface - *AsyncExportRaw(grpc::ClientContext *, - const proto::collector::trace::v1::ExportTraceServiceRequest &, - grpc::CompletionQueue *) override + grpc::ClientAsyncResponseReaderInterface< + proto::collector::trace::v1::ExportTraceServiceResponse> * + AsyncExportRaw(grpc::ClientContext *, + const proto::collector::trace::v1::ExportTraceServiceRequest &, + grpc::CompletionQueue *) override { return nullptr; } - grpc::ClientAsyncResponseReaderInterface - *PrepareAsyncExportRaw(grpc::ClientContext *, - const proto::collector::trace::v1::ExportTraceServiceRequest &, - grpc::CompletionQueue *) override + grpc::ClientAsyncResponseReaderInterface< + proto::collector::trace::v1::ExportTraceServiceResponse> * + PrepareAsyncExportRaw(grpc::ClientContext *, + const proto::collector::trace::v1::ExportTraceServiceRequest &, + grpc::CompletionQueue *) override { return nullptr; } diff --git a/exporters/otlp/test/otlp_http_log_record_exporter_test.cc b/exporters/otlp/test/otlp_http_log_record_exporter_test.cc index 8f2c2409eb..5fbf95798f 100644 --- a/exporters/otlp/test/otlp_http_log_record_exporter_test.cc +++ b/exporters/otlp/test/otlp_http_log_record_exporter_test.cc @@ -133,7 +133,7 @@ class OtlpHttpLogRecordExporterTestPeer : public ::testing::Test char trace_id_hex[2 * opentelemetry::trace::TraceId::kSize] = {0}; opentelemetry::trace::TraceId trace_id{trace_id_bin}; uint8_t span_id_bin[opentelemetry::trace::SpanId::kSize] = {'7', '6', '5', '4', - '3', '2', '1', '0'}; + '3', '2', '1', '0'}; char span_id_hex[2 * opentelemetry::trace::SpanId::kSize] = {0}; opentelemetry::trace::SpanId span_id{span_id_bin}; @@ -250,7 +250,7 @@ class OtlpHttpLogRecordExporterTestPeer : public ::testing::Test char trace_id_hex[2 * opentelemetry::trace::TraceId::kSize] = {0}; opentelemetry::trace::TraceId trace_id{trace_id_bin}; uint8_t span_id_bin[opentelemetry::trace::SpanId::kSize] = {'7', '6', '5', '4', - '3', '2', '1', '0'}; + '3', '2', '1', '0'}; char span_id_hex[2 * opentelemetry::trace::SpanId::kSize] = {0}; opentelemetry::trace::SpanId span_id{span_id_bin}; diff --git a/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h b/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h index e32d590bdb..58dd154bb7 100644 --- a/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h +++ b/ext/include/opentelemetry/ext/http/client/curl/http_operation_curl.h @@ -70,7 +70,7 @@ struct HttpCurlEasyResource return *this; } - HttpCurlEasyResource(const HttpCurlEasyResource &other) = delete; + HttpCurlEasyResource(const HttpCurlEasyResource &other) = delete; HttpCurlEasyResource &operator=(const HttpCurlEasyResource &other) = delete; }; diff --git a/ext/include/opentelemetry/ext/http/client/http_client.h b/ext/include/opentelemetry/ext/http/client/http_client.h index 0615284836..b3cf7365eb 100644 --- a/ext/include/opentelemetry/ext/http/client/http_client.h +++ b/ext/include/opentelemetry/ext/http/client/http_client.h @@ -379,13 +379,13 @@ class HttpClientSync virtual Result Get(const nostd::string_view &url, const HttpSslOptions &ssl_options, - const Headers & = {{}}, + const Headers & = {{}}, const Compression &compression = Compression::kNone) noexcept = 0; virtual Result Post(const nostd::string_view &url, const HttpSslOptions &ssl_options, const Body &body, - const Headers & = {{"content-type", "application/json"}}, + const Headers & = {{"content-type", "application/json"}}, const Compression &compression = Compression::kNone) noexcept = 0; virtual ~HttpClientSync() = default; diff --git a/ext/include/opentelemetry/ext/http/server/socket_tools.h b/ext/include/opentelemetry/ext/http/server/socket_tools.h index bb6302bac8..bad76e640a 100644 --- a/ext/include/opentelemetry/ext/http/server/socket_tools.h +++ b/ext/include/opentelemetry/ext/http/server/socket_tools.h @@ -16,7 +16,7 @@ #ifdef _WIN32 -//# include +// # include # include diff --git a/opentracing-shim/test/shim_utils_test.cc b/opentracing-shim/test/shim_utils_test.cc index aa2316f2d2..d053273984 100644 --- a/opentracing-shim/test/shim_utils_test.cc +++ b/opentracing-shim/test/shim_utils_test.cc @@ -141,8 +141,8 @@ TEST(ShimUtilsTest, MakeOptionsShim_FirstChildOf) options.start_system_timestamp = opentracing::SystemTime::time_point::clock::now(); options.start_steady_timestamp = opentracing::SteadyTime::time_point::clock::now(); options.references = {{opentracing::SpanReferenceType::FollowsFromRef, nullptr}, - {opentracing::SpanReferenceType::ChildOfRef, span_context}, - {opentracing::SpanReferenceType::ChildOfRef, nullptr}}; + {opentracing::SpanReferenceType::ChildOfRef, span_context}, + {opentracing::SpanReferenceType::ChildOfRef, nullptr}}; auto options_shim = shim::utils::makeOptionsShim(options); ASSERT_EQ(options_shim.start_system_time, @@ -162,7 +162,7 @@ TEST(ShimUtilsTest, MakeOptionsShim_FirstInList) options.start_system_timestamp = opentracing::SystemTime::time_point::clock::now(); options.start_steady_timestamp = opentracing::SteadyTime::time_point::clock::now(); options.references = {{opentracing::SpanReferenceType::FollowsFromRef, span_context}, - {opentracing::SpanReferenceType::FollowsFromRef, nullptr}}; + {opentracing::SpanReferenceType::FollowsFromRef, nullptr}}; auto options_shim = shim::utils::makeOptionsShim(options); ASSERT_EQ(options_shim.start_system_time, diff --git a/sdk/include/opentelemetry/sdk/common/empty_attributes.h b/sdk/include/opentelemetry/sdk/common/empty_attributes.h index 1e0a6393bd..0afe439ee6 100644 --- a/sdk/include/opentelemetry/sdk/common/empty_attributes.h +++ b/sdk/include/opentelemetry/sdk/common/empty_attributes.h @@ -20,8 +20,9 @@ namespace sdk * This helps to avoid constructing a new empty container every time a call is made * with default attributes. */ -static const opentelemetry::common::KeyValueIterableView, 0>> - &GetEmptyAttributes() noexcept +static const opentelemetry::common::KeyValueIterableView< + std::array, 0>> & +GetEmptyAttributes() noexcept { static const std::array, 0> array{}; static const opentelemetry::common::KeyValueIterableView< diff --git a/sdk/include/opentelemetry/sdk/logs/readable_log_record.h b/sdk/include/opentelemetry/sdk/logs/readable_log_record.h index acec5b88f9..a8f366b5b7 100644 --- a/sdk/include/opentelemetry/sdk/logs/readable_log_record.h +++ b/sdk/include/opentelemetry/sdk/logs/readable_log_record.h @@ -107,8 +107,8 @@ class ReadableLogRecord : public Recordable * Get attributes of this log. * @return the body field of this log */ - virtual const std::unordered_map - &GetAttributes() const noexcept = 0; + virtual const std::unordered_map & + GetAttributes() const noexcept = 0; /** * Get resource of this log diff --git a/sdk/include/opentelemetry/sdk/metrics/data/circular_buffer.h b/sdk/include/opentelemetry/sdk/metrics/data/circular_buffer.h index 26f272f837..32605dfd68 100644 --- a/sdk/include/opentelemetry/sdk/metrics/data/circular_buffer.h +++ b/sdk/include/opentelemetry/sdk/metrics/data/circular_buffer.h @@ -31,10 +31,10 @@ class AdaptingIntegerArray public: // Construct an adapting integer array of a given size. explicit AdaptingIntegerArray(size_t size) : backing_(std::vector(size, 0)) {} - AdaptingIntegerArray(const AdaptingIntegerArray &other) = default; - AdaptingIntegerArray(AdaptingIntegerArray &&other) = default; + AdaptingIntegerArray(const AdaptingIntegerArray &other) = default; + AdaptingIntegerArray(AdaptingIntegerArray &&other) = default; AdaptingIntegerArray &operator=(const AdaptingIntegerArray &other) = default; - AdaptingIntegerArray &operator=(AdaptingIntegerArray &&other) = default; + AdaptingIntegerArray &operator=(AdaptingIntegerArray &&other) = default; /** * Increments the value at the specified index by the given count in the array. @@ -87,10 +87,10 @@ class AdaptingCircularBufferCounter { public: explicit AdaptingCircularBufferCounter(size_t max_size) : backing_(max_size) {} - AdaptingCircularBufferCounter(const AdaptingCircularBufferCounter &other) = default; - AdaptingCircularBufferCounter(AdaptingCircularBufferCounter &&other) = default; + AdaptingCircularBufferCounter(const AdaptingCircularBufferCounter &other) = default; + AdaptingCircularBufferCounter(AdaptingCircularBufferCounter &&other) = default; AdaptingCircularBufferCounter &operator=(const AdaptingCircularBufferCounter &other) = default; - AdaptingCircularBufferCounter &operator=(AdaptingCircularBufferCounter &&other) = default; + AdaptingCircularBufferCounter &operator=(AdaptingCircularBufferCounter &&other) = default; /** * The first index with a recording. May be negative. diff --git a/sdk/include/opentelemetry/sdk/metrics/data/point_data.h b/sdk/include/opentelemetry/sdk/metrics/data/point_data.h index 9bf82e040a..32853316a5 100644 --- a/sdk/include/opentelemetry/sdk/metrics/data/point_data.h +++ b/sdk/include/opentelemetry/sdk/metrics/data/point_data.h @@ -23,8 +23,8 @@ class SumPointData { public: // TODO: remove ctors and initializers when GCC<5 stops shipping on Ubuntu - SumPointData(SumPointData &&) = default; - SumPointData(const SumPointData &) = default; + SumPointData(SumPointData &&) = default; + SumPointData(const SumPointData &) = default; SumPointData &operator=(SumPointData &&) = default; SumPointData() = default; @@ -36,8 +36,8 @@ class LastValuePointData { public: // TODO: remove ctors and initializers when GCC<5 stops shipping on Ubuntu - LastValuePointData(LastValuePointData &&) = default; - LastValuePointData(const LastValuePointData &) = default; + LastValuePointData(LastValuePointData &&) = default; + LastValuePointData(const LastValuePointData &) = default; LastValuePointData &operator=(LastValuePointData &&) = default; LastValuePointData() = default; @@ -50,7 +50,7 @@ class HistogramPointData { public: // TODO: remove ctors and initializers when GCC<5 stops shipping on Ubuntu - HistogramPointData(HistogramPointData &&) = default; + HistogramPointData(HistogramPointData &&) = default; HistogramPointData &operator=(HistogramPointData &&) = default; HistogramPointData(const HistogramPointData &) = default; HistogramPointData() = default; @@ -68,9 +68,9 @@ class DropPointData { public: // TODO: remove ctors and initializers when GCC<5 stops shipping on Ubuntu - DropPointData(DropPointData &&) = default; - DropPointData(const DropPointData &) = default; - DropPointData() = default; + DropPointData(DropPointData &&) = default; + DropPointData(const DropPointData &) = default; + DropPointData() = default; DropPointData &operator=(DropPointData &&) = default; }; diff --git a/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h b/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h index 43c67cb804..a509080318 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h @@ -28,7 +28,7 @@ const std::string kAttributesLimitOverflowKey = "otel.metrics.overflow"; const bool kAttributesLimitOverflowValue = true; const size_t kOverflowAttributesHash = opentelemetry::sdk::common::GetHashForAttributeMap( {{kAttributesLimitOverflowKey, - kAttributesLimitOverflowValue}}); // precalculated for optimization + kAttributesLimitOverflowValue}}); // precalculated for optimization class AttributeHashGenerator { diff --git a/sdk/include/opentelemetry/sdk/trace/span_data.h b/sdk/include/opentelemetry/sdk/trace/span_data.h index a7f8ccc4be..8e301c1a01 100644 --- a/sdk/include/opentelemetry/sdk/trace/span_data.h +++ b/sdk/include/opentelemetry/sdk/trace/span_data.h @@ -55,8 +55,8 @@ class SpanDataEvent * Get the attributes for this event * @return the attributes for this event */ - const std::unordered_map - &GetAttributes() const noexcept + const std::unordered_map & + GetAttributes() const noexcept { return attribute_map_.GetAttributes(); } @@ -82,8 +82,8 @@ class SpanDataLink * Get the attributes for this link * @return the attributes for this link */ - const std::unordered_map - &GetAttributes() const noexcept + const std::unordered_map & + GetAttributes() const noexcept { return attribute_map_.GetAttributes(); } @@ -218,8 +218,8 @@ class SpanData final : public Recordable * Get the attributes for this span * @return the attributes for this span */ - const std::unordered_map - &GetAttributes() const noexcept + const std::unordered_map & + GetAttributes() const noexcept { return attribute_map_.GetAttributes(); } diff --git a/sdk/src/logs/read_write_log_record.cc b/sdk/src/logs/read_write_log_record.cc index 1c2aabffe7..27dd8f7d5f 100644 --- a/sdk/src/logs/read_write_log_record.cc +++ b/sdk/src/logs/read_write_log_record.cc @@ -150,8 +150,8 @@ void ReadWriteLogRecord::SetAttribute(nostd::string_view key, attributes_map_[static_cast(key)] = value; } -const std::unordered_map - &ReadWriteLogRecord::GetAttributes() const noexcept +const std::unordered_map & +ReadWriteLogRecord::GetAttributes() const noexcept { return attributes_map_; } diff --git a/sdk/src/trace/tracer.cc b/sdk/src/trace/tracer.cc index 2b38c5d3ca..f23ce5f628 100644 --- a/sdk/src/trace/tracer.cc +++ b/sdk/src/trace/tracer.cc @@ -122,10 +122,9 @@ nostd::shared_ptr Tracer::StartSpan( auto span_context = std::unique_ptr(new opentelemetry::trace::SpanContext( trace_id, span_id, trace_flags, false, - sampling_result.trace_state - ? sampling_result.trace_state - : is_parent_span_valid ? parent_context.trace_state() - : opentelemetry::trace::TraceState::GetDefault())); + sampling_result.trace_state ? sampling_result.trace_state + : is_parent_span_valid ? parent_context.trace_state() + : opentelemetry::trace::TraceState::GetDefault())); if (!sampling_result.IsRecording()) { diff --git a/sdk/test/instrumentationscope/instrumentationscope_test.cc b/sdk/test/instrumentationscope/instrumentationscope_test.cc index 50800fd136..2f376d5d6b 100644 --- a/sdk/test/instrumentationscope/instrumentationscope_test.cc +++ b/sdk/test/instrumentationscope/instrumentationscope_test.cc @@ -22,8 +22,8 @@ TEST(InstrumentationScope, CreateInstrumentationScope) auto instrumentation_scope = InstrumentationScope::Create( library_name, library_version, schema_url, {{"attribute-key1", "attribute-value"}, - {"attribute-key2", static_cast(123)}, - {"attribute-key3", opentelemetry::nostd::span(attrubite_value3)}}); + {"attribute-key2", static_cast(123)}, + {"attribute-key3", opentelemetry::nostd::span(attrubite_value3)}}); EXPECT_EQ(instrumentation_scope->GetName(), library_name); EXPECT_EQ(instrumentation_scope->GetVersion(), library_version); diff --git a/sdk/test/metrics/sync_metric_storage_counter_test.cc b/sdk/test/metrics/sync_metric_storage_counter_test.cc index 220abe6b94..2593b69719 100644 --- a/sdk/test/metrics/sync_metric_storage_counter_test.cc +++ b/sdk/test/metrics/sync_metric_storage_counter_test.cc @@ -35,7 +35,7 @@ TEST_P(WritableMetricStorageTestFixture, LongCounterSumAggregation) int64_t expected_total_get_requests = 0; int64_t expected_total_put_requests = 0; InstrumentDescriptor instr_desc = {"name", "desc", "1unit", InstrumentType::kCounter, - InstrumentValueType::kLong}; + InstrumentValueType::kLong}; std::map attributes_get = {{"RequestType", "GET"}}; std::map attributes_put = {{"RequestType", "PUT"}}; @@ -175,7 +175,7 @@ TEST_P(WritableMetricStorageTestFixture, DoubleCounterSumAggregation) double expected_total_get_requests = 0; double expected_total_put_requests = 0; InstrumentDescriptor instr_desc = {"name", "desc", "1unit", InstrumentType::kCounter, - InstrumentValueType::kDouble}; + InstrumentValueType::kDouble}; std::map attributes_get = {{"RequestType", "GET"}}; std::map attributes_put = {{"RequestType", "PUT"}}; diff --git a/sdk/test/metrics/sync_metric_storage_histogram_test.cc b/sdk/test/metrics/sync_metric_storage_histogram_test.cc index 5ded7f3b46..71a16b85c6 100644 --- a/sdk/test/metrics/sync_metric_storage_histogram_test.cc +++ b/sdk/test/metrics/sync_metric_storage_histogram_test.cc @@ -35,7 +35,7 @@ TEST_P(WritableMetricStorageHistogramTestFixture, LongHistogram) int64_t expected_total_get_requests = 0; int64_t expected_total_put_requests = 0; InstrumentDescriptor instr_desc = {"name", "desc", "1unit", InstrumentType::kHistogram, - InstrumentValueType::kLong}; + InstrumentValueType::kLong}; std::map attributes_get = {{"RequestType", "GET"}}; std::map attributes_put = {{"RequestType", "PUT"}}; @@ -176,7 +176,7 @@ TEST_P(WritableMetricStorageHistogramTestFixture, DoubleHistogram) double expected_total_get_requests = 0; double expected_total_put_requests = 0; InstrumentDescriptor instr_desc = {"name", "desc", "1unit", InstrumentType::kHistogram, - InstrumentValueType::kDouble}; + InstrumentValueType::kDouble}; std::map attributes_get = {{"RequestType", "GET"}}; std::map attributes_put = {{"RequestType", "PUT"}}; diff --git a/sdk/test/trace/parent_sampler_test.cc b/sdk/test/trace/parent_sampler_test.cc index 124287598d..7d2ef7f107 100644 --- a/sdk/test/trace/parent_sampler_test.cc +++ b/sdk/test/trace/parent_sampler_test.cc @@ -42,7 +42,7 @@ TEST(ParentBasedSampler, ShouldSample) // Case 1: Parent doesn't exist. Return result of delegateSampler() auto sampling_result = sampler_off.ShouldSample(trace_api::SpanContext::GetInvalid(), trace_id, - "", span_kind, view, links); + "", span_kind, view, links); auto sampling_result2 = sampler_on.ShouldSample(trace_api::SpanContext::GetInvalid(), trace_id, "", span_kind, view, links); diff --git a/sdk/test/trace/tracer_test.cc b/sdk/test/trace/tracer_test.cc index a84a0125c1..99bab95b0f 100644 --- a/sdk/test/trace/tracer_test.cc +++ b/sdk/test/trace/tracer_test.cc @@ -109,8 +109,8 @@ std::shared_ptr initTracer( processors.push_back(std::move(processor)); auto resource = Resource::Create({}); auto context = std::make_shared(std::move(processors), resource, - std::unique_ptr(sampler), - std::unique_ptr(id_generator)); + std::unique_ptr(sampler), + std::unique_ptr(id_generator)); return std::shared_ptr(new Tracer(context)); } diff --git a/tools/format.sh b/tools/format.sh index 5b4e91277d..65728b385f 100755 --- a/tools/format.sh +++ b/tools/format.sh @@ -26,11 +26,11 @@ fi # No trailing spaces. "${SED[@]}" 's/ \+$//' $($FIND -type f -print) -# If not overridden, try to use clang-format-10 or clang-format. +# If not overridden, try to use clang-format-18 or clang-format. if [[ -z "$CLANG_FORMAT" ]]; then CLANG_FORMAT=clang-format - if which clang-format-10 >/dev/null; then - CLANG_FORMAT=clang-format-10 + if which clang-format-18 >/dev/null; then + CLANG_FORMAT=clang-format-18 fi fi