diff --git a/.clang-tidy b/.clang-tidy index aa6164e27f..fc603f843d 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -65,3 +65,7 @@ Checks: > -modernize-make-unique, -modernize-make-shared, +CheckOptions: + - key: bugprone-exception-escape.TreatFunctionsWithoutSpecificationAsThrowing + value: OnlyUndefined + diff --git a/sdk/include/opentelemetry/sdk/common/atomic_shared_ptr.h b/sdk/include/opentelemetry/sdk/common/atomic_shared_ptr.h index 39c0ce91cc..fa478aa67d 100644 --- a/sdk/include/opentelemetry/sdk/common/atomic_shared_ptr.h +++ b/sdk/include/opentelemetry/sdk/common/atomic_shared_ptr.h @@ -25,15 +25,15 @@ template class AtomicSharedPtr { public: - explicit AtomicSharedPtr(std::shared_ptr ptr) noexcept : ptr_{std::move(ptr)} {} + explicit AtomicSharedPtr(std::shared_ptr ptr) : ptr_{std::move(ptr)} {} - void store(const std::shared_ptr &other) noexcept + void store(const std::shared_ptr &other) { std::lock_guard lock_guard{mu_}; ptr_ = other; } - std::shared_ptr load() const noexcept + std::shared_ptr load() const { std::lock_guard lock_guard{mu_}; return ptr_; @@ -48,11 +48,11 @@ template class AtomicSharedPtr { public: - explicit AtomicSharedPtr(std::shared_ptr ptr) noexcept : ptr_{std::move(ptr)} {} + explicit AtomicSharedPtr(std::shared_ptr ptr) : ptr_{std::move(ptr)} {} - void store(const std::shared_ptr &other) noexcept { std::atomic_store(&ptr_, other); } + void store(const std::shared_ptr &other) { std::atomic_store(&ptr_, other); } - std::shared_ptr load() const noexcept { return std::atomic_load(&ptr_); } + std::shared_ptr load() const { return std::atomic_load(&ptr_); } private: std::shared_ptr ptr_; diff --git a/sdk/include/opentelemetry/sdk/common/atomic_unique_ptr.h b/sdk/include/opentelemetry/sdk/common/atomic_unique_ptr.h index 01b1266330..91e9a338a0 100644 --- a/sdk/include/opentelemetry/sdk/common/atomic_unique_ptr.h +++ b/sdk/include/opentelemetry/sdk/common/atomic_unique_ptr.h @@ -22,37 +22,36 @@ template class AtomicUniquePtr { public: - AtomicUniquePtr() noexcept {} + AtomicUniquePtr() {} AtomicUniquePtr(const AtomicUniquePtr &) = delete; AtomicUniquePtr(AtomicUniquePtr &&) = delete; AtomicUniquePtr &operator=(const AtomicUniquePtr &) = delete; AtomicUniquePtr &operator=(AtomicUniquePtr &&) = delete; - explicit AtomicUniquePtr(std::unique_ptr &&other) noexcept : ptr_(std::move(other).release()) - {} + explicit AtomicUniquePtr(std::unique_ptr &&other) : ptr_(std::move(other).release()) {} - ~AtomicUniquePtr() noexcept { Reset(); } + ~AtomicUniquePtr() { Reset(); } - T &operator*() const noexcept { return *Get(); } + T &operator*() const { return *Get(); } - T *operator->() const noexcept { return Get(); } + T *operator->() const { return Get(); } /** * @return the underly pointer managed. */ - T *Get() const noexcept { return ptr_; } + T *Get() const { return ptr_; } /** * @return true if the pointer is null */ - bool IsNull() const noexcept { return ptr_.load() == nullptr; } + bool IsNull() const { return ptr_.load() == nullptr; } /** * Atomically swap the pointer only if it's null. * @param owner the pointer to swap with * @return true if the swap was successful */ - bool SwapIfNull(std::unique_ptr &owner) noexcept + bool SwapIfNull(std::unique_ptr &owner) { auto ptr = owner.get(); T *expected = nullptr; @@ -69,13 +68,13 @@ class AtomicUniquePtr * Atomically swap the pointer with another. * @param other The pointer to swap with */ - void Swap(std::unique_ptr &other) noexcept { other.reset(ptr_.exchange(other.release())); } + void Swap(std::unique_ptr &other) { other.reset(ptr_.exchange(other.release())); } /** * Set the pointer to a new value and delete the current value if non-null. * @param ptr the new pointer value to set */ - void Reset(T *ptr = nullptr) noexcept + void Reset(T *ptr = nullptr) { ptr = ptr_.exchange(ptr); if (ptr != nullptr) diff --git a/sdk/include/opentelemetry/sdk/common/attribute_utils.h b/sdk/include/opentelemetry/sdk/common/attribute_utils.h index 631d4e9a14..700c360d1b 100644 --- a/sdk/include/opentelemetry/sdk/common/attribute_utils.h +++ b/sdk/include/opentelemetry/sdk/common/attribute_utils.h @@ -93,9 +93,7 @@ enum OwnedAttributeType : std::uint8_t // NOLINT(cppcoreguidelines-use-enum-cla // 0xE0-0xEF 1110xxxx lead of a 3-byte sequence // 0xF0-0xF7 11110xxx lead of a 4-byte sequence // 0xF8-0xFF not a valid lead byte -inline std::size_t Utf8SafePrefixLength(const char *data, - std::size_t size, - std::size_t max_bytes) noexcept +inline std::size_t Utf8SafePrefixLength(const char *data, std::size_t size, std::size_t max_bytes) { // When the whole value fits within the budget (including the common // unbounded case where max_bytes is SIZE_MAX), no truncation is possible, @@ -162,7 +160,7 @@ struct AttributeConverter /// Constructs a converter that truncates string and bytes alternatives to /// at most `max_length` bytes during conversion. Other alternatives are /// unaffected. Used by recordables enforcing attribute_value_length_limit. - explicit AttributeConverter(std::size_t max_length) noexcept : max_length_(max_length) {} + explicit AttributeConverter(std::size_t max_length) : max_length_(max_length) {} OwnedAttributeValue operator()(bool v) { return OwnedAttributeValue(v); } OwnedAttributeValue operator()(int32_t v) { return OwnedAttributeValue(v); } @@ -236,33 +234,33 @@ struct AttributeEqualToVisitor { // Different types are not equal including containers of different element types template - bool operator()(const T &, const U &) const noexcept + bool operator()(const T &, const U &) const { return false; } // Compare the same arithmetic types template - bool operator()(const T &owned_value, const T &value) const noexcept + bool operator()(const T &owned_value, const T &value) const { return owned_value == value; } // Compare std::string and const char* - bool operator()(const std::string &owned_value, const char *value) const noexcept + bool operator()(const std::string &owned_value, const char *value) const { return owned_value == value; } // Compare std::string and nostd::string_view - bool operator()(const std::string &owned_value, nostd::string_view value) const noexcept + bool operator()(const std::string &owned_value, nostd::string_view value) const { return owned_value == value; } // Compare std::vector and nostd::span bool operator()(const std::vector &owned_value, - const nostd::span &value) const noexcept + const nostd::span &value) const { return owned_value.size() == value.size() && std::equal(owned_value.begin(), owned_value.end(), value.begin(), @@ -273,8 +271,7 @@ struct AttributeEqualToVisitor // Compare nostd::span and std::vector for arithmetic types template - bool operator()(const std::vector &owned_value, - const nostd::span &value) const noexcept + bool operator()(const std::vector &owned_value, const nostd::span &value) const { return owned_value.size() == value.size() && std::equal(owned_value.begin(), owned_value.end(), value.begin()); @@ -291,7 +288,7 @@ struct AttributeEqualToVisitor */ template inline std::pair -AttributeInsertOrAssign(Map &map, opentelemetry::nostd::string_view key, Value &&value) noexcept +AttributeInsertOrAssign(Map &map, opentelemetry::nostd::string_view key, Value &&value) { #if __cplusplus >= 201703L // Use insert_or_assign if C++17 is available @@ -352,7 +349,7 @@ inline std::pair VisitVariantImpl(Visitor &&visitor, * */ template -inline auto VisitVariant(Visitor &&visitor, const Variant &value) noexcept +inline auto VisitVariant(Visitor &&visitor, const Variant &value) { using VisitorReturnType = decltype(opentelemetry::nostd::visit(std::forward(visitor), value)); @@ -421,14 +418,14 @@ class AttributeMap : public std::unordered_map void ConstructFrom(const opentelemetry::common::KeyValueIterable &attributes) { attributes.ForEachKeyValue( - [&](nostd::string_view key, const opentelemetry::common::AttributeValue &value) noexcept { + [&](nostd::string_view key, const opentelemetry::common::AttributeValue &value) { SetAttribute(key, value); return true; }); } // Returns a reference to this map - const std::unordered_map &GetAttributes() const noexcept + const std::unordered_map &GetAttributes() const { return (*this); } @@ -436,7 +433,7 @@ class AttributeMap : public std::unordered_map // Convert non-owning key-value to owning std::string(key) and OwnedAttributeValue(value) bool SetAttribute(nostd::string_view key, const opentelemetry::common::AttributeValue &value, - std::size_t max_length = (std::numeric_limits::max)()) noexcept + std::size_t max_length = (std::numeric_limits::max)()) { std::pair result = VisitVariant(AttributeConverter(max_length), value); @@ -449,7 +446,7 @@ class AttributeMap : public std::unordered_map } // Compare the attributes of this map with another KeyValueIterable - bool EqualTo(const opentelemetry::common::KeyValueIterable &attributes) const noexcept + bool EqualTo(const opentelemetry::common::KeyValueIterable &attributes) const { if (attributes.size() != this->size()) { @@ -457,8 +454,7 @@ class AttributeMap : public std::unordered_map } const bool is_equal = attributes.ForEachKeyValue( - [this](nostd::string_view key, - const opentelemetry::common::AttributeValue &value) noexcept { + [this](nostd::string_view key, const opentelemetry::common::AttributeValue &value) { // Perform a linear search to find the key assuming the map is small // This avoids temporary string creation from this->find(std::string(key)) for (const auto &kv : *this) @@ -491,7 +487,7 @@ class OrderedAttributeMap : public std::map : OrderedAttributeMap() { attributes.ForEachKeyValue( - [&](nostd::string_view key, opentelemetry::common::AttributeValue value) noexcept { + [&](nostd::string_view key, opentelemetry::common::AttributeValue value) { SetAttribute(key, value); return true; }); @@ -510,15 +506,12 @@ class OrderedAttributeMap : public std::map } // Returns a reference to this map - const std::map &GetAttributes() const noexcept - { - return (*this); - } + const std::map &GetAttributes() const { return (*this); } // Convert non-owning key-value to owning std::string(key) and OwnedAttributeValue(value) void SetAttribute(nostd::string_view key, const opentelemetry::common::AttributeValue &value, - std::size_t max_length = (std::numeric_limits::max)()) noexcept + std::size_t max_length = (std::numeric_limits::max)()) { std::pair result = VisitVariant(AttributeConverter(max_length), value); diff --git a/sdk/include/opentelemetry/sdk/common/circular_buffer.h b/sdk/include/opentelemetry/sdk/common/circular_buffer.h index cf85745abd..8a46335c8f 100644 --- a/sdk/include/opentelemetry/sdk/common/circular_buffer.h +++ b/sdk/include/opentelemetry/sdk/common/circular_buffer.h @@ -38,7 +38,7 @@ class CircularBuffer * * Note: This method must only be called from the consumer thread. */ - CircularBufferRange> Peek() const noexcept { return PeekImpl(); } + CircularBufferRange> Peek() const { return PeekImpl(); } /** * Consume elements from the circular buffer's tail. @@ -51,7 +51,7 @@ class CircularBuffer * Note: This method must only be called from the consumer thread. */ template - void Consume(size_t n, Callback callback) noexcept + void Consume(size_t n, Callback callback) { assert(n <= static_cast(head_ - tail_)); auto range = PeekImpl().Take(n); @@ -66,7 +66,7 @@ class CircularBuffer * * Note: This method must only be called from the consumer thread. */ - void Consume(size_t n) noexcept + void Consume(size_t n) { Consume(n, [](CircularBufferRange> &range) noexcept { range.ForEach([](AtomicUniquePtr &ptr) noexcept { @@ -81,7 +81,7 @@ class CircularBuffer * @param ptr a pointer to the element to add * @return true if the element was successfully added; false, otherwise. */ - bool Add(std::unique_ptr &ptr) noexcept + bool Add(std::unique_ptr &ptr) { while (true) { @@ -116,7 +116,7 @@ class CircularBuffer } } - bool Add(std::unique_ptr &&ptr) noexcept + bool Add(std::unique_ptr &&ptr) { std::unique_ptr owner = std::move(ptr); return Add(owner); @@ -127,17 +127,17 @@ class CircularBuffer * * Note: This method must only be called from the consumer thread. */ - void Clear() noexcept { Consume(size()); } + void Clear() { Consume(size()); } /** * @return the maximum number of bytes that can be stored in the buffer. */ - size_t max_size() const noexcept { return capacity_ - 1; } + size_t max_size() const { return capacity_ - 1; } /** * @return true if the buffer is empty. */ - bool empty() const noexcept { return head_ == tail_; } + bool empty() const { return head_ == tail_; } /** * @return the number of bytes stored in the circular buffer. @@ -145,7 +145,7 @@ class CircularBuffer * Note: this method will only return a correct snapshot of the size if called * from the consumer thread. */ - size_t size() const noexcept + size_t size() const { uint64_t tail = tail_; uint64_t head = head_; @@ -156,12 +156,12 @@ class CircularBuffer /** * @return the number of elements consumed from the circular buffer. */ - uint64_t consumption_count() const noexcept { return tail_; } + uint64_t consumption_count() const { return tail_; } /** * @return the number of elements added to the circular buffer. */ - uint64_t production_count() const noexcept { return head_; } + uint64_t production_count() const { return head_; } private: std::unique_ptr[]> data_; @@ -169,7 +169,7 @@ class CircularBuffer std::atomic head_{0}; std::atomic tail_{0}; - CircularBufferRange> PeekImpl() const noexcept + CircularBufferRange> PeekImpl() const { uint64_t tail_index = tail_ % capacity_; uint64_t head_index = head_ % capacity_; diff --git a/sdk/include/opentelemetry/sdk/common/circular_buffer_range.h b/sdk/include/opentelemetry/sdk/common/circular_buffer_range.h index 0b77f32b65..fccbf9e84a 100644 --- a/sdk/include/opentelemetry/sdk/common/circular_buffer_range.h +++ b/sdk/include/opentelemetry/sdk/common/circular_buffer_range.h @@ -22,15 +22,14 @@ template class CircularBufferRange { public: - CircularBufferRange() noexcept = default; + CircularBufferRange() = default; - explicit CircularBufferRange(nostd::span first) noexcept : first_{first} {} + explicit CircularBufferRange(nostd::span first) : first_{first} {} - CircularBufferRange(nostd::span first, nostd::span second) noexcept - : first_{first}, second_{second} + CircularBufferRange(nostd::span first, nostd::span second) : first_{first}, second_{second} {} - operator CircularBufferRange() const noexcept { return {first_, second_}; } + operator CircularBufferRange() const { return {first_, second_}; } /** * Iterate over the elements in the range. @@ -61,19 +60,19 @@ class CircularBufferRange /** * @return the number of elements in the range */ - size_t size() const noexcept { return first_.size() + second_.size(); } + size_t size() const { return first_.size() + second_.size(); } /** * @return true if the range is empty */ - bool empty() const noexcept { return first_.empty(); } + bool empty() const { return first_.empty(); } /** * Return a subrange taken from the start of this range. * @param n the number of element to take in the subrange * @return a subrange of the first n elements in this range */ - CircularBufferRange Take(size_t n) const noexcept + CircularBufferRange Take(size_t n) const { assert(n <= size()); if (first_.size() >= n) diff --git a/sdk/include/opentelemetry/sdk/common/custom_hash_equality.h b/sdk/include/opentelemetry/sdk/common/custom_hash_equality.h index 3d45c30c2d..58b2b152e0 100644 --- a/sdk/include/opentelemetry/sdk/common/custom_hash_equality.h +++ b/sdk/include/opentelemetry/sdk/common/custom_hash_equality.h @@ -55,7 +55,7 @@ struct FnvOffset // 32-bit offset basis static constexpr Ty value = static_cast(0x811C9DC5U); - static constexpr Ty Fix(Ty hval) noexcept { return hval; } + static constexpr Ty Fix(Ty hval) { return hval; } }; // Specialization for 64-bit @@ -66,7 +66,7 @@ struct FnvOffset static constexpr Ty value = static_cast(0xCBF29CE484222325ULL); // Fix function: mix upper and lower bits for better distribution - static constexpr Ty Fix(Ty hval) noexcept { return hval ^ (hval >> 32); } + static constexpr Ty Fix(Ty hval) { return hval ^ (hval >> 32); } }; /** @@ -79,7 +79,7 @@ struct FnvOffset * @return Computed hash */ template -inline Ty Fnv1a(const void *buf, size_t len, Ty hval = FnvOffset::value) noexcept +inline Ty Fnv1a(const void *buf, size_t len, Ty hval = FnvOffset::value) { const unsigned char *bp = reinterpret_cast(buf); const unsigned char *be = bp + len; @@ -106,12 +106,12 @@ struct StringViewHash # endif #endif - std::size_t operator()(const std::string &s) const noexcept + std::size_t operator()(const std::string &s) const { return Fnv1a(s.data(), s.size()); } - std::size_t operator()(opentelemetry::nostd::string_view sv) const noexcept + std::size_t operator()(opentelemetry::nostd::string_view sv) const { return Fnv1a(sv.data(), sv.size()); } @@ -126,7 +126,7 @@ struct StringViewEqual #endif template - bool operator()(const Lhs &lhs, const Rhs &rhs) const noexcept + bool operator()(const Lhs &lhs, const Rhs &rhs) const { opentelemetry::nostd::string_view lsv(lhs); opentelemetry::nostd::string_view rsv(rhs); diff --git a/sdk/include/opentelemetry/sdk/common/empty_attributes.h b/sdk/include/opentelemetry/sdk/common/empty_attributes.h index 73c704f795..f96352015e 100644 --- a/sdk/include/opentelemetry/sdk/common/empty_attributes.h +++ b/sdk/include/opentelemetry/sdk/common/empty_attributes.h @@ -21,7 +21,7 @@ namespace sdk * with default attributes. */ const opentelemetry::common::KeyValueIterableView, 0>> & -GetEmptyAttributes() noexcept; +GetEmptyAttributes(); } // namespace sdk OPENTELEMETRY_END_NAMESPACE diff --git a/sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h b/sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h index a5e9018772..09351fccb8 100644 --- a/sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h +++ b/sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h @@ -90,14 +90,14 @@ class InstrumentationScope return result; } - std::size_t HashCode() const noexcept; + std::size_t HashCode() const; /** * Compare 2 instrumentation libraries. * @param other the instrumentation scope to compare to. * @returns true if the 2 instrumentation libraries are equal, false otherwise. */ - bool operator==(const InstrumentationScope &other) const noexcept; + bool operator==(const InstrumentationScope &other) const; /** * Check whether the instrumentation scope has given name and version. @@ -112,15 +112,14 @@ class InstrumentationScope bool equal(const nostd::string_view name, const nostd::string_view version, const nostd::string_view schema_url = "", - const opentelemetry::common::KeyValueIterable *attributes = nullptr) const noexcept; + const opentelemetry::common::KeyValueIterable *attributes = nullptr) const; - const std::string &GetName() const noexcept; - const std::string &GetVersion() const noexcept; - const std::string &GetSchemaURL() const noexcept; - const InstrumentationScopeAttributes &GetAttributes() const noexcept; + const std::string &GetName() const; + const std::string &GetVersion() const; + const std::string &GetSchemaURL() const; + const InstrumentationScopeAttributes &GetAttributes() const; - void SetAttribute(nostd::string_view key, - const opentelemetry::common::AttributeValue &value) noexcept; + void SetAttribute(nostd::string_view key, const opentelemetry::common::AttributeValue &value); private: InstrumentationScope(nostd::string_view name, diff --git a/sdk/include/opentelemetry/sdk/instrumentationscope/scope_configurator.h b/sdk/include/opentelemetry/sdk/instrumentationscope/scope_configurator.h index 170924b57e..9b3370a9ce 100644 --- a/sdk/include/opentelemetry/sdk/instrumentationscope/scope_configurator.h +++ b/sdk/include/opentelemetry/sdk/instrumentationscope/scope_configurator.h @@ -36,8 +36,7 @@ class ScopeConfigurator * @param default_scope_config The default scope config that the built configurator should fall * back on. */ - explicit Builder(T default_scope_config) noexcept : default_scope_config_(default_scope_config) - {} + explicit Builder(T default_scope_config) : default_scope_config_(default_scope_config) {} /** * Allows the user to pass a generic function that evaluates an instrumentation scope through a diff --git a/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor.h b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor.h index 0d71515c7a..b40e3a4648 100644 --- a/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor.h +++ b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor.h @@ -124,8 +124,7 @@ class BatchLogRecordProcessor : public LogRecordProcessor * Shuts down the processor and does any cleanup required. Completely drains the buffer/queue of * all its logs and passes them to the exporter. */ - bool InternalShutdown( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool InternalShutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); /** * The background routine performed by the worker thread. diff --git a/sdk/include/opentelemetry/sdk/logs/event_logger.h b/sdk/include/opentelemetry/sdk/logs/event_logger.h index fa66addc41..bfb6133351 100644 --- a/sdk/include/opentelemetry/sdk/logs/event_logger.h +++ b/sdk/include/opentelemetry/sdk/logs/event_logger.h @@ -32,7 +32,7 @@ class EventLogger final : public opentelemetry::logs::EventLogger * @param event_domain Event domain */ explicit EventLogger(nostd::shared_ptr delegate_logger, - nostd::string_view event_domain) noexcept; + nostd::string_view event_domain); /** * Returns the name of this logger. diff --git a/sdk/include/opentelemetry/sdk/logs/event_logger_provider.h b/sdk/include/opentelemetry/sdk/logs/event_logger_provider.h index 2075a448ae..eff78e35d9 100644 --- a/sdk/include/opentelemetry/sdk/logs/event_logger_provider.h +++ b/sdk/include/opentelemetry/sdk/logs/event_logger_provider.h @@ -24,7 +24,7 @@ class OPENTELEMETRY_EXPORT EventLoggerProvider final : public opentelemetry::logs::EventLoggerProvider { public: - EventLoggerProvider() noexcept; + EventLoggerProvider(); EventLoggerProvider(const EventLoggerProvider &) = delete; EventLoggerProvider(EventLoggerProvider &&) = delete; diff --git a/sdk/include/opentelemetry/sdk/logs/exporter.h b/sdk/include/opentelemetry/sdk/logs/exporter.h index 1fae5cb85c..f303f9f9f4 100644 --- a/sdk/include/opentelemetry/sdk/logs/exporter.h +++ b/sdk/include/opentelemetry/sdk/logs/exporter.h @@ -40,7 +40,7 @@ class OPENTELEMETRY_EXPORT LogRecordExporter * * Note: This method must be callable from multiple threads. */ - virtual std::unique_ptr MakeRecordable() noexcept = 0; + virtual std::unique_ptr MakeRecordable() = 0; /** * Exports the batch of log records to their export destination. @@ -51,13 +51,13 @@ class OPENTELEMETRY_EXPORT LogRecordExporter * @returns an ExportResult code (whether export was success or failure) */ virtual sdk::common::ExportResult Export( - const nostd::span> &records) noexcept = 0; + const nostd::span> &records) = 0; /** * Force flush the log records pushed into this log exporter. */ virtual bool ForceFlush( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0; + std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) = 0; /** * Marks the exporter as ShutDown and cleans up any resources as required. @@ -66,8 +66,7 @@ class OPENTELEMETRY_EXPORT LogRecordExporter * returning failure. * @return true if the exporter shutdown succeeded, false otherwise */ - virtual bool Shutdown( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0; + virtual bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) = 0; /** * Returns true when the recordable produced by MakeRecordable() enforces @@ -76,7 +75,7 @@ class OPENTELEMETRY_EXPORT LogRecordExporter * recordables that ignore limits. Exporters whose recordable applies the * limits (OTLP, ostream) override this to return true. */ - virtual bool RecordableEnforcesLogRecordLimits() const noexcept { return false; } + virtual bool RecordableEnforcesLogRecordLimits() const { return false; } }; } // namespace logs } // namespace sdk diff --git a/sdk/include/opentelemetry/sdk/logs/log_record_limits.h b/sdk/include/opentelemetry/sdk/logs/log_record_limits.h index 0d16bf3ccd..427d61c100 100644 --- a/sdk/include/opentelemetry/sdk/logs/log_record_limits.h +++ b/sdk/include/opentelemetry/sdk/logs/log_record_limits.h @@ -36,7 +36,7 @@ struct LogRecordLimits * injects the configured limits, so a recordable created outside a provider * does not enforce any limit on its own. */ - static constexpr LogRecordLimits NoLimits() noexcept + static constexpr LogRecordLimits NoLimits() { return LogRecordLimits{(std::numeric_limits::max)(), (std::numeric_limits::max)()}; diff --git a/sdk/include/opentelemetry/sdk/logs/logger.h b/sdk/include/opentelemetry/sdk/logs/logger.h index 7ad7a7cd62..9581a16f7f 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger.h +++ b/sdk/include/opentelemetry/sdk/logs/logger.h @@ -64,11 +64,11 @@ class Logger final : public opentelemetry::logs::Logger /** Returns the associated instrumentation scope */ const opentelemetry::sdk::instrumentationscope::InstrumentationScope &GetInstrumentationScope() - const noexcept; + const; OPENTELEMETRY_DEPRECATED_MESSAGE("Please use GetInstrumentationScope instead") const opentelemetry::sdk::instrumentationscope::InstrumentationScope &GetInstrumentationLibrary() - const noexcept + const { return GetInstrumentationScope(); } @@ -101,7 +101,7 @@ class Logger final : public opentelemetry::logs::Logger * LoggerProvider::UpdateLoggerConfigurator when the provider-level * LoggerConfigurator is replaced at runtime. */ - void UpdateLoggerConfig(LoggerConfig config) noexcept; + void UpdateLoggerConfig(LoggerConfig config); // The name of this logger std::string logger_name_; diff --git a/sdk/include/opentelemetry/sdk/logs/logger_config.h b/sdk/include/opentelemetry/sdk/logs/logger_config.h index 563ee33b9b..d6591d0bca 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger_config.h +++ b/sdk/include/opentelemetry/sdk/logs/logger_config.h @@ -20,25 +20,25 @@ namespace logs class OPENTELEMETRY_EXPORT LoggerConfig { public: - bool operator==(const LoggerConfig &other) const noexcept; + bool operator==(const LoggerConfig &other) const; /** * Returns if the Logger is enabled or disabled. Loggers are enabled by default. * @return a boolean indicating if the Logger is enabled. Defaults to true. */ - bool IsEnabled() const noexcept; + bool IsEnabled() const; /** * Returns the configured minimum severity for the Logger. * @return the minimum severity. Defaults to Severity::kInvalid. */ - opentelemetry::logs::Severity GetMinimumSeverity() const noexcept; + opentelemetry::logs::Severity GetMinimumSeverity() const; /** * Returns if trace-based filtering is enabled for the Logger. * @return a boolean indicating if trace-based filtering is enabled. Defaults to false. */ - bool IsTraceBased() const noexcept; + bool IsTraceBased() const; /** * Returns a LoggerConfig with the provided settings. @@ -49,7 +49,7 @@ class OPENTELEMETRY_EXPORT LoggerConfig */ static LoggerConfig Create(bool enabled, opentelemetry::logs::Severity minimum_severity, - bool trace_based) noexcept; + bool trace_based); /** * Returns a LoggerConfig that represents an enabled Logger. @@ -76,7 +76,7 @@ class OPENTELEMETRY_EXPORT LoggerConfig explicit LoggerConfig( bool enabled = true, opentelemetry::logs::Severity minimum_severity = opentelemetry::logs::Severity::kInvalid, - bool trace_based = false) noexcept + bool trace_based = false) : enabled_(enabled), minimum_severity_(minimum_severity), trace_based_(trace_based) {} diff --git a/sdk/include/opentelemetry/sdk/logs/logger_context.h b/sdk/include/opentelemetry/sdk/logs/logger_context.h index 5c13ef04dc..5c9f7c71e8 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger_context.h +++ b/sdk/include/opentelemetry/sdk/logs/logger_context.h @@ -55,7 +55,7 @@ class LoggerContext * * Note: This method is not thread safe. */ - void AddProcessor(std::unique_ptr processor) noexcept; + void AddProcessor(std::unique_ptr processor); /** * Obtain the configured (composite) processor. @@ -63,26 +63,25 @@ class LoggerContext * Note: When more than one processor is active, this will * return an "aggregate" processor */ - LogRecordProcessor &GetProcessor() const noexcept; + LogRecordProcessor &GetProcessor() const; /** * Obtain the resource associated with this tracer context. * @return The resource for this tracer context. */ - const opentelemetry::sdk::resource::Resource &GetResource() const noexcept; + const opentelemetry::sdk::resource::Resource &GetResource() const; /** * Obtain the ScopeConfigurator with this logger context. * @return The ScopeConfigurator for this logger context. */ - const instrumentationscope::ScopeConfigurator &GetLoggerConfigurator() - const noexcept; + const instrumentationscope::ScopeConfigurator &GetLoggerConfigurator() const; /** * Obtain the LogRecord limits applied by this context. * @return The LogRecordLimits for this logger context. */ - const LogRecordLimits &GetLogRecordLimits() const noexcept; + const LogRecordLimits &GetLogRecordLimits() const; /** * Whether any configured processor produces a recordable that enforces the @@ -91,25 +90,25 @@ class LoggerContext * SetLogRecordLimits() virtual call when no processor needs it. * @return true if at least one processor enforces limits. */ - bool RecordableEnforcesLogRecordLimits() const noexcept; + bool RecordableEnforcesLogRecordLimits() const; /** * Replace the ScopeConfigurator for this logger context. * @param logger_configurator The new configurator. */ - void SetLoggerConfigurator(std::unique_ptr> - logger_configurator) noexcept; + void SetLoggerConfigurator( + std::unique_ptr> logger_configurator); /** * Force all active LogProcessors to flush any buffered logs * within the given timeout. */ - bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); /** * Shutdown the log processor associated with this tracer provider. */ - bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); private: // order of declaration is important here - resource object should be destroyed after processor. diff --git a/sdk/include/opentelemetry/sdk/logs/logger_provider.h b/sdk/include/opentelemetry/sdk/logs/logger_provider.h index 2e14fdd7a0..4f697521c5 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger_provider.h +++ b/sdk/include/opentelemetry/sdk/logs/logger_provider.h @@ -107,7 +107,7 @@ class OPENTELEMETRY_EXPORT LoggerProvider final : public opentelemetry::logs::Lo * @param processor The processor to be stored inside the logger provider. * This must not be a nullptr. */ - void AddProcessor(std::unique_ptr processor) noexcept; + void AddProcessor(std::unique_ptr processor); /** * Update the LoggerConfigurator for this provider. Updates the LoggerConfig for all existing @@ -120,24 +120,23 @@ class OPENTELEMETRY_EXPORT LoggerProvider final : public opentelemetry::logs::Lo * ScopeConfigurator::AddCondition) is not supported and will result in a deadlock. */ void UpdateLoggerConfigurator( - std::unique_ptr> - logger_configurator) noexcept; + std::unique_ptr> logger_configurator); /** * Obtain the resource associated with this logger provider. * @return The resource for this logger provider. */ - const opentelemetry::sdk::resource::Resource &GetResource() const noexcept; + const opentelemetry::sdk::resource::Resource &GetResource() const; /** * Shutdown the log processor associated with this log provider. */ - bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); /** * Force flush the log processor associated with this log provider. */ - bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); private: // order of declaration is important here - loggers should destroy only after context. diff --git a/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor.h b/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor.h index b7f73ec0c1..1da3715dfa 100644 --- a/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor.h +++ b/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor.h @@ -72,8 +72,7 @@ class MultiLogRecordProcessor : public LogRecordProcessor * @param timeout that the forceflush is required to finish within. * @return a result code indicating whether it succeeded, failed or timed out */ - bool InternalForceFlush( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool InternalForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); /** * Shuts down the processor and does any cleanup required. @@ -82,8 +81,7 @@ class MultiLogRecordProcessor : public LogRecordProcessor * returning failure. * @return true if the shutdown succeeded, false otherwise */ - bool InternalShutdown( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool InternalShutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); bool EnabledImplementation( const opentelemetry::nostd::variant recordable) noexcept; + void AddRecordable(const LogRecordProcessor &processor, std::unique_ptr recordable); - const std::unique_ptr &GetRecordable( - const LogRecordProcessor &processor) const noexcept; + const std::unique_ptr &GetRecordable(const LogRecordProcessor &processor) const; - std::unique_ptr ReleaseRecordable(const LogRecordProcessor &processor) noexcept; + std::unique_ptr ReleaseRecordable(const LogRecordProcessor &processor); /** * Set the timestamp for this log. diff --git a/sdk/include/opentelemetry/sdk/logs/processor.h b/sdk/include/opentelemetry/sdk/logs/processor.h index 41e47d1a27..9cd6904403 100644 --- a/sdk/include/opentelemetry/sdk/logs/processor.h +++ b/sdk/include/opentelemetry/sdk/logs/processor.h @@ -52,13 +52,13 @@ class LogRecordProcessor * * Note: This method must be callable from multiple threads. */ - virtual std::unique_ptr MakeRecordable() noexcept = 0; + virtual std::unique_ptr MakeRecordable() = 0; /** * OnEmit is called by the SDK once a log record has been successfully created. * @param record the log recordable object */ - virtual void OnEmit(std::unique_ptr &&record) noexcept = 0; + virtual void OnEmit(std::unique_ptr &&record) = 0; /** * Enabled returns whether this processor is interested in a log with the given inputs. @@ -69,7 +69,7 @@ class LogRecordProcessor opentelemetry::context::Context> &context_or_span, const opentelemetry::sdk::instrumentationscope::InstrumentationScope &instrumentation_scope, opentelemetry::logs::Severity severity, - opentelemetry::nostd::string_view event_name = {}) const noexcept + opentelemetry::nostd::string_view event_name = {}) const { return EnabledImplementation(context_or_span, instrumentation_scope, severity, event_name); } @@ -80,7 +80,7 @@ class LogRecordProcessor * @return a result code indicating whether it succeeded, failed or timed out */ virtual bool ForceFlush( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0; + std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) = 0; /** * Shuts down the processor and does any cleanup required. @@ -89,8 +89,7 @@ class LogRecordProcessor * shutdown before giving up and returning failure. * @return true if the shutdown succeeded, false otherwise */ - virtual bool Shutdown( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0; + virtual bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) = 0; /** * Returns true if this processor's EnabledImplementation does any custom @@ -98,7 +97,7 @@ class LogRecordProcessor * might filter), so the SDK Logger consults the full Enabled chain by * default. */ - virtual bool HasEnabledFilter() const noexcept { return true; } + virtual bool HasEnabledFilter() const { return true; } protected: virtual bool EnabledImplementation( @@ -107,7 +106,7 @@ class LogRecordProcessor const opentelemetry::sdk::instrumentationscope::InstrumentationScope & /*instrumentation_scope*/, opentelemetry::logs::Severity /*severity*/, - opentelemetry::nostd::string_view /*event_name*/) const noexcept + opentelemetry::nostd::string_view /*event_name*/) const { return true; } @@ -120,7 +119,7 @@ class LogRecordProcessor * processors return true if any child does. The SDK Logger consults this once * per context to decide whether to push limits onto each recordable. */ - virtual bool RecordableEnforcesLogRecordLimits() const noexcept { return false; } + virtual bool RecordableEnforcesLogRecordLimits() const { return false; } }; } // namespace logs } // namespace sdk diff --git a/sdk/include/opentelemetry/sdk/logs/provider.h b/sdk/include/opentelemetry/sdk/logs/provider.h index aa637e6998..b4047126fb 100644 --- a/sdk/include/opentelemetry/sdk/logs/provider.h +++ b/sdk/include/opentelemetry/sdk/logs/provider.h @@ -24,8 +24,7 @@ class Provider /** * Changes the singleton LoggerProvider. */ - static void SetLoggerProvider( - const nostd::shared_ptr &lp) noexcept; + static void SetLoggerProvider(const nostd::shared_ptr &lp); }; } // namespace logs diff --git a/sdk/include/opentelemetry/sdk/logs/readable_log_record.h b/sdk/include/opentelemetry/sdk/logs/readable_log_record.h index fb56a2e884..5126aaa460 100644 --- a/sdk/include/opentelemetry/sdk/logs/readable_log_record.h +++ b/sdk/include/opentelemetry/sdk/logs/readable_log_record.h @@ -51,68 +51,68 @@ class ReadableLogRecord : public Recordable * Get the timestamp of this log. * @return the timestamp of this log */ - virtual opentelemetry::common::SystemTimestamp GetTimestamp() const noexcept = 0; + virtual opentelemetry::common::SystemTimestamp GetTimestamp() const = 0; /** * Get the observed timestamp of this log. * @return the observed timestamp of this log */ - virtual opentelemetry::common::SystemTimestamp GetObservedTimestamp() const noexcept = 0; + virtual opentelemetry::common::SystemTimestamp GetObservedTimestamp() const = 0; /** * Get the severity of this log. * @return the severity of this log */ - virtual opentelemetry::logs::Severity GetSeverity() const noexcept = 0; + virtual opentelemetry::logs::Severity GetSeverity() const = 0; /** * Get the severity text of this log. * @return the severity text for this log */ - virtual nostd::string_view GetSeverityText() const noexcept; + virtual nostd::string_view GetSeverityText() const; /** * Get body field of this log. * @return the body field for this log. */ - virtual const opentelemetry::sdk::common::OwnedAttributeValue &GetBody() const noexcept = 0; + virtual const opentelemetry::sdk::common::OwnedAttributeValue &GetBody() const = 0; /** * Get the Event id. * @return the event id */ - virtual int64_t GetEventId() const noexcept = 0; + virtual int64_t GetEventId() const = 0; /** * Get the Event Name. * @return the event name */ - virtual nostd::string_view GetEventName() const noexcept = 0; + virtual nostd::string_view GetEventName() const = 0; /** * Get the trace id of this log. * @return the trace id of this log */ - virtual const opentelemetry::trace::TraceId &GetTraceId() const noexcept = 0; + virtual const opentelemetry::trace::TraceId &GetTraceId() const = 0; /** * Get the span id of this log. * @return the span id of this log */ - virtual const opentelemetry::trace::SpanId &GetSpanId() const noexcept = 0; + virtual const opentelemetry::trace::SpanId &GetSpanId() const = 0; /** * Inject trace_flags of this log. * @return trace_flags of this log */ - virtual const opentelemetry::trace::TraceFlags &GetTraceFlags() const noexcept = 0; + virtual const opentelemetry::trace::TraceFlags &GetTraceFlags() const = 0; /** * Get attributes of this log. * @return the body field of this log */ virtual const std::unordered_map & - GetAttributes() const noexcept = 0; + GetAttributes() const = 0; /** * Get the number of attributes dropped because the attribute count limit @@ -120,33 +120,33 @@ class ReadableLogRecord : public Recordable * recordables that do not enforce limits compile without changes. * @return the number of dropped attributes */ - virtual uint32_t GetDroppedAttributesCount() const noexcept { return 0; } + virtual uint32_t GetDroppedAttributesCount() const { return 0; } /** * Get resource of this log * @return the resource of this log */ - virtual const opentelemetry::sdk::resource::Resource &GetResource() const noexcept = 0; + virtual const opentelemetry::sdk::resource::Resource &GetResource() const = 0; /** * Get instrumentation scope of this log. * @return the instrumentation scope of this log */ virtual const opentelemetry::sdk::instrumentationscope::InstrumentationScope & - GetInstrumentationScope() const noexcept = 0; + GetInstrumentationScope() const = 0; /** * Get default instrumentation scope of logs. * @return the default instrumentation scope of logs */ static const opentelemetry::sdk::instrumentationscope::InstrumentationScope & - GetDefaultInstrumentationScope() noexcept; + GetDefaultInstrumentationScope(); /** * Get default resource of logs. * @return the default resource of logs */ - static const opentelemetry::sdk::resource::Resource &GetDefaultResource() noexcept; + static const opentelemetry::sdk::resource::Resource &GetDefaultResource(); }; } // namespace logs } // namespace sdk diff --git a/sdk/include/opentelemetry/sdk/logs/recordable.h b/sdk/include/opentelemetry/sdk/logs/recordable.h index d7ddb3b34a..7d5fe84f44 100644 --- a/sdk/include/opentelemetry/sdk/logs/recordable.h +++ b/sdk/include/opentelemetry/sdk/logs/recordable.h @@ -37,7 +37,7 @@ class Recordable : public opentelemetry::logs::LogRecord * Set Resource of this log * @param resource the resource to set */ - virtual void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept = 0; + virtual void SetResource(const opentelemetry::sdk::resource::Resource &resource) = 0; /** * Set instrumentation_scope for this log. @@ -45,7 +45,7 @@ class Recordable : public opentelemetry::logs::LogRecord */ virtual void SetInstrumentationScope( const opentelemetry::sdk::instrumentationscope::InstrumentationScope - &instrumentation_scope) noexcept = 0; + &instrumentation_scope) = 0; /** * Apply attribute count and value length limits to this log. The default @@ -54,7 +54,7 @@ class Recordable : public opentelemetry::logs::LogRecord * SetAttribute call is observed, so the caller does not need to keep the * supplied object alive. */ - virtual void SetLogRecordLimits(const LogRecordLimits & /* limits */) noexcept {} + virtual void SetLogRecordLimits(const LogRecordLimits & /* limits */) {} }; } // namespace logs diff --git a/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h b/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h index 8399cbdf7e..0006ba5a4a 100644 --- a/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h +++ b/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h @@ -55,7 +55,7 @@ class SimpleLogRecordProcessor : public LogRecordProcessor return exporter_ != nullptr && exporter_->RecordableEnforcesLogRecordLimits(); } - bool IsShutdown() const noexcept; + bool IsShutdown() const; private: // The configured exporter diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation.h b/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation.h index 1f4f3f0458..f5c2decb80 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation.h +++ b/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation.h @@ -16,9 +16,9 @@ namespace metrics class Aggregation { public: - virtual void Aggregate(int64_t value, const PointAttributes &attributes = {}) noexcept = 0; + virtual void Aggregate(int64_t value, const PointAttributes &attributes = {}) = 0; - virtual void Aggregate(double value, const PointAttributes &attributes = {}) noexcept = 0; + virtual void Aggregate(double value, const PointAttributes &attributes = {}) = 0; /** * Returns the result of the merge of the two aggregations. @@ -30,7 +30,7 @@ class Aggregation * @return the result of the merge of the given aggregation. */ - virtual std::unique_ptr Merge(const Aggregation &delta) const noexcept = 0; + virtual std::unique_ptr Merge(const Aggregation &delta) const = 0; /** * Returns a new delta aggregation by comparing two cumulative measurements. @@ -38,7 +38,7 @@ class Aggregation * @param next the newly captured (cumulative) aggregation. * @return The resulting delta aggregation. */ - virtual std::unique_ptr Diff(const Aggregation &next) const noexcept = 0; + virtual std::unique_ptr Diff(const Aggregation &next) const = 0; /** * Returns the point data that the aggregation will produce. @@ -46,7 +46,7 @@ class Aggregation * @return PointType */ - virtual PointType ToPoint() const noexcept = 0; + virtual PointType ToPoint() const = 0; Aggregation() = default; diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation_config.h b/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation_config.h index f9143cf8e3..8a8447bc35 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation_config.h +++ b/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation_config.h @@ -28,7 +28,7 @@ class AggregationConfig AggregationConfig &operator=(const AggregationConfig &) = default; AggregationConfig &operator=(AggregationConfig &&) = default; - virtual AggregationType GetType() const noexcept { return AggregationType::kDefault; } + virtual AggregationType GetType() const { return AggregationType::kDefault; } static const AggregationConfig *GetOrDefault(const AggregationConfig *config) { @@ -51,7 +51,7 @@ class HistogramAggregationConfig : public AggregationConfig : AggregationConfig(cardinality_limit) {} - AggregationType GetType() const noexcept override { return AggregationType::kHistogram; } + AggregationType GetType() const override { return AggregationType::kHistogram; } // The SDK-specified default bucket boundaries, used when no boundaries are configured. static const std::vector &DefaultBoundaries() @@ -87,10 +87,7 @@ class Base2ExponentialHistogramAggregationConfig : public AggregationConfig : AggregationConfig(cardinality_limit) {} - AggregationType GetType() const noexcept override - { - return AggregationType::kBase2ExponentialHistogram; - } + AggregationType GetType() const override { return AggregationType::kBase2ExponentialHistogram; } size_t max_size_ = 160; int32_t max_scale_ = 20; diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregation/base2_exponential_histogram_aggregation.h b/sdk/include/opentelemetry/sdk/metrics/aggregation/base2_exponential_histogram_aggregation.h index 631050f3db..9f9da3acdc 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregation/base2_exponential_histogram_aggregation.h +++ b/sdk/include/opentelemetry/sdk/metrics/aggregation/base2_exponential_histogram_aggregation.h @@ -28,29 +28,28 @@ class Base2ExponentialHistogramAggregation : public Aggregation Base2ExponentialHistogramAggregation(const Base2ExponentialHistogramPointData &point_data); Base2ExponentialHistogramAggregation(Base2ExponentialHistogramPointData &&point_data); - void Aggregate(int64_t value, const PointAttributes &attributes = {}) noexcept override; - void Aggregate(double value, const PointAttributes &attributes = {}) noexcept override; + void Aggregate(int64_t value, const PointAttributes &attributes = {}) override; + void Aggregate(double value, const PointAttributes &attributes = {}) override; /* Returns the result of merge of the existing aggregation with delta * aggregation with same boundaries */ - std::unique_ptr Merge(const Aggregation &delta) const noexcept override; + std::unique_ptr Merge(const Aggregation &delta) const override; /* Returns the new delta aggregation by comparing existing aggregation with * next aggregation with same boundaries. Data points for `next` aggregation * (sum , bucket-counts) should be more than the current aggregation - which * is the normal scenario as measurements values are monotonic increasing. */ - std::unique_ptr Diff(const Aggregation &next) const noexcept override; + std::unique_ptr Diff(const Aggregation &next) const override; - PointType ToPoint() const noexcept override; + PointType ToPoint() const override; private: - void AggregateIntoBuckets(std::unique_ptr &buckets, - double value) noexcept; + void AggregateIntoBuckets(std::unique_ptr &buckets, double value); /* Reduces the scale by up to `by`, stopping at kMinRuntimeScale. Returns the reduction that was * actually applied, which callers must use to shift bucket indices. */ - uint32_t Downscale(uint32_t by) noexcept; + uint32_t Downscale(uint32_t by); mutable opentelemetry::common::SpinLockMutex lock_; Base2ExponentialHistogramPointData point_data_; diff --git a/sdk/include/opentelemetry/sdk/metrics/data/exemplar_data.h b/sdk/include/opentelemetry/sdk/metrics/data/exemplar_data.h index 929e56b541..df19e5626a 100644 --- a/sdk/include/opentelemetry/sdk/metrics/data/exemplar_data.h +++ b/sdk/include/opentelemetry/sdk/metrics/data/exemplar_data.h @@ -45,7 +45,7 @@ class ExemplarData * Returns the SpanContext associated with this exemplar. If the exemplar was not recorded * inside a sampled trace, the Context will be invalid. */ - const opentelemetry::trace::SpanContext &GetSpanContext() const noexcept { return context_; } + const opentelemetry::trace::SpanContext &GetSpanContext() const { return context_; } static PointType CreateSumPointData(ValueType value) { diff --git a/sdk/include/opentelemetry/sdk/metrics/data/point_data.h b/sdk/include/opentelemetry/sdk/metrics/data/point_data.h index 2f64df81df..e3c2e3d1d9 100644 --- a/sdk/include/opentelemetry/sdk/metrics/data/point_data.h +++ b/sdk/include/opentelemetry/sdk/metrics/data/point_data.h @@ -76,9 +76,8 @@ class HistogramPointData class Base2ExponentialHistogramPointData { public: - Base2ExponentialHistogramPointData(Base2ExponentialHistogramPointData &&) noexcept = default; - Base2ExponentialHistogramPointData &operator=(Base2ExponentialHistogramPointData &&) noexcept = - default; + Base2ExponentialHistogramPointData(Base2ExponentialHistogramPointData &&) = default; + Base2ExponentialHistogramPointData &operator=(Base2ExponentialHistogramPointData &&) = default; Base2ExponentialHistogramPointData(const Base2ExponentialHistogramPointData &other) : sum_(other.sum_), diff --git a/sdk/include/opentelemetry/sdk/metrics/exemplar/filter_predicate.h b/sdk/include/opentelemetry/sdk/metrics/exemplar/filter_predicate.h index 6c30f5787f..5d0fea3d09 100644 --- a/sdk/include/opentelemetry/sdk/metrics/exemplar/filter_predicate.h +++ b/sdk/include/opentelemetry/sdk/metrics/exemplar/filter_predicate.h @@ -25,7 +25,7 @@ namespace metrics * - kTraceBased : eligible only when recorded inside a valid, sampled span. */ inline bool ExemplarFilterEnabled(ExemplarFilterType filter_type, - const opentelemetry::context::Context &context) noexcept + const opentelemetry::context::Context &context) { switch (filter_type) { diff --git a/sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir.h b/sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir.h index 23b6d67770..0b48313bcb 100644 --- a/sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir.h +++ b/sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir.h @@ -48,12 +48,12 @@ class ExemplarReservoir /** Offers a long measurement to be sampled. */ virtual void OfferMeasurement(int64_t value, const MetricAttributes &attributes, - const opentelemetry::context::Context &context) noexcept = 0; + const opentelemetry::context::Context &context) = 0; /** Offers a double measurement to be sampled. */ virtual void OfferMeasurement(double value, const MetricAttributes &attributes, - const opentelemetry::context::Context &context) noexcept = 0; + const opentelemetry::context::Context &context) = 0; /** * Builds vector of Exemplars for exporting from the current reservoir. @@ -66,7 +66,7 @@ class ExemplarReservoir * filter out pointAttributes from the original recorded attributes. */ virtual std::vector> CollectAndReset( - const MetricAttributes &pointAttributes) noexcept = 0; + const MetricAttributes &pointAttributes) = 0; static nostd::shared_ptr GetSimpleFixedSizeExemplarReservoir( size_t size, diff --git a/sdk/include/opentelemetry/sdk/metrics/export/metric_producer.h b/sdk/include/opentelemetry/sdk/metrics/export/metric_producer.h index 887f5067e5..b6e2fdf35d 100644 --- a/sdk/include/opentelemetry/sdk/metrics/export/metric_producer.h +++ b/sdk/include/opentelemetry/sdk/metrics/export/metric_producer.h @@ -113,7 +113,7 @@ class MetricProducer * the MetricProducer. Implementations may return successfully collected points even if there is a * partial failure. */ - virtual Result Produce() noexcept = 0; + virtual Result Produce() = 0; }; } // namespace metrics diff --git a/sdk/include/opentelemetry/sdk/metrics/instruments.h b/sdk/include/opentelemetry/sdk/metrics/instruments.h index a41ffa5d77..a2cb7ab496 100644 --- a/sdk/include/opentelemetry/sdk/metrics/instruments.h +++ b/sdk/include/opentelemetry/sdk/metrics/instruments.h @@ -71,7 +71,7 @@ struct InstrumentDescriptor struct InstrumentDescriptorUtil { // Case-insensitive comparison of two ASCII strings used to evaluate equality of instrument names - static bool CaseInsensitiveAsciiEquals(const std::string &lhs, const std::string &rhs) noexcept + static bool CaseInsensitiveAsciiEquals(const std::string &lhs, const std::string &rhs) { return lhs.size() == rhs.size() && std::equal(lhs.begin(), lhs.end(), rhs.begin(), [](char a, char b) { @@ -84,7 +84,7 @@ struct InstrumentDescriptorUtil // An instrument is a duplicate if it has the same name (case-insensitive) as another instrument, // but different instrument kind, unit, or description. // https://github.com/open-telemetry/opentelemetry-specification/blob/9c8c30631b0e288de93df7452f91ed47f6fba330/specification/metrics/sdk.md?plain=1#L869 - static bool IsDuplicate(const InstrumentDescriptor &lhs, const InstrumentDescriptor &rhs) noexcept + static bool IsDuplicate(const InstrumentDescriptor &lhs, const InstrumentDescriptor &rhs) { // Not a duplicate if case-insensitive names are not equal if (!InstrumentDescriptorUtil::CaseInsensitiveAsciiEquals(lhs.name_, rhs.name_)) @@ -115,7 +115,7 @@ struct InstrumentDescriptorUtil return false; } - static opentelemetry::nostd::string_view GetInstrumentTypeString(InstrumentType type) noexcept + static opentelemetry::nostd::string_view GetInstrumentTypeString(InstrumentType type) { switch (type) { @@ -139,7 +139,7 @@ struct InstrumentDescriptorUtil } static opentelemetry::nostd::string_view GetInstrumentValueTypeString( - InstrumentValueType value_type) noexcept + InstrumentValueType value_type) { switch (value_type) { @@ -160,7 +160,7 @@ struct InstrumentDescriptorUtil struct AggregationUtil { static opentelemetry::nostd::string_view GetAggregationTypeString( - AggregationType aggregation_type) noexcept + AggregationType aggregation_type) { switch (aggregation_type) { @@ -184,7 +184,7 @@ struct AggregationUtil struct InstrumentEqualNameCaseInsensitive { - bool operator()(const InstrumentDescriptor &lhs, const InstrumentDescriptor &rhs) const noexcept + bool operator()(const InstrumentDescriptor &lhs, const InstrumentDescriptor &rhs) const { // Names (case-insensitive) if (!InstrumentDescriptorUtil::CaseInsensitiveAsciiEquals(lhs.name_, rhs.name_)) @@ -221,7 +221,7 @@ struct InstrumentEqualNameCaseInsensitive // description, unit) are equal. struct InstrumentDescriptorHash { - std::size_t operator()(const InstrumentDescriptor &instrument_descriptor) const noexcept + std::size_t operator()(const InstrumentDescriptor &instrument_descriptor) const { std::size_t hashcode{}; diff --git a/sdk/include/opentelemetry/sdk/metrics/meter.h b/sdk/include/opentelemetry/sdk/metrics/meter.h index be1ea3d95d..3e33818af8 100644 --- a/sdk/include/opentelemetry/sdk/metrics/meter.h +++ b/sdk/include/opentelemetry/sdk/metrics/meter.h @@ -121,17 +121,17 @@ class Meter final : public opentelemetry::metrics::Meter nostd::string_view unit = "") noexcept override; /** Returns the associated instrumentation scope */ - const sdk::instrumentationscope::InstrumentationScope *GetInstrumentationScope() const noexcept; + const sdk::instrumentationscope::InstrumentationScope *GetInstrumentationScope() const; OPENTELEMETRY_DEPRECATED_MESSAGE("Please use GetInstrumentationScope instead") - const sdk::instrumentationscope::InstrumentationScope *GetInstrumentationLibrary() const noexcept + const sdk::instrumentationscope::InstrumentationScope *GetInstrumentationLibrary() const { return GetInstrumentationScope(); } /** collect metrics across all the instruments configured for the meter **/ std::vector Collect(CollectorHandle *collector, - opentelemetry::common::SystemTimestamp collect_ts) noexcept; + opentelemetry::common::SystemTimestamp collect_ts); #if OPENTELEMETRY_ABI_VERSION_NO >= 2 uintptr_t RegisterCallback( diff --git a/sdk/include/opentelemetry/sdk/metrics/meter_config.h b/sdk/include/opentelemetry/sdk/metrics/meter_config.h index e02fdd21b4..f30f037615 100644 --- a/sdk/include/opentelemetry/sdk/metrics/meter_config.h +++ b/sdk/include/opentelemetry/sdk/metrics/meter_config.h @@ -19,13 +19,13 @@ namespace metrics class OPENTELEMETRY_EXPORT MeterConfig { public: - bool operator==(const MeterConfig &other) const noexcept; + bool operator==(const MeterConfig &other) const; /** * Returns if the Meter is enabled or disabled. Meters are enabled by default. * @return a boolean indicating if the Meter is enabled. Defaults to true. */ - bool IsEnabled() const noexcept; + bool IsEnabled() const; /** * Returns a MeterConfig that represents a disabled Meter. A disabled meter behaves like a diff --git a/sdk/include/opentelemetry/sdk/metrics/meter_context.h b/sdk/include/opentelemetry/sdk/metrics/meter_context.h index 0318d68f32..12649dfcd0 100644 --- a/sdk/include/opentelemetry/sdk/metrics/meter_context.h +++ b/sdk/include/opentelemetry/sdk/metrics/meter_context.h @@ -92,19 +92,19 @@ class MeterContext : public std::enable_shared_from_this * Obtain the resource associated with this meter context. * @return The resource for this meter context */ - const opentelemetry::sdk::resource::Resource &GetResource() const noexcept; + const opentelemetry::sdk::resource::Resource &GetResource() const; /** * Obtain the View Registry configured * @return The reference to view registry */ - ViewRegistry *GetViewRegistry() const noexcept; + ViewRegistry *GetViewRegistry() const; /** * Obtain the ScopeConfigurator with this meter context. * @return The ScopeConfigurator for this meter context. */ - const instrumentationscope::ScopeConfigurator &GetMeterConfigurator() const noexcept; + const instrumentationscope::ScopeConfigurator &GetMeterConfigurator() const; /** * Replace the ScopeConfigurator for this meter context. @@ -119,7 +119,7 @@ class MeterContext : public std::enable_shared_from_this * NOTE - INTERNAL method, can change in the future. * Process callback for each meter in thread-safe manner */ - bool ForEachMeter(nostd::function_ref &meter)> callback) noexcept; + bool ForEachMeter(nostd::function_ref &meter)> callback); /** * NOTE - INTERNAL method, can change in the future. @@ -127,19 +127,19 @@ class MeterContext : public std::enable_shared_from_this * This method is NOT thread safe, and only called through MeterProvider * */ - nostd::span> GetMeters() noexcept; + nostd::span> GetMeters(); /** * Obtain the configured collectors. * */ - nostd::span> GetCollectors() noexcept; + nostd::span> GetCollectors(); /** * GET SDK Start time * */ - opentelemetry::common::SystemTimestamp GetSDKStartTime() noexcept; + opentelemetry::common::SystemTimestamp GetSDKStartTime(); /** * Create a MetricCollector from a MetricReader using this MeterContext and add it to the list of @@ -153,7 +153,7 @@ class MeterContext : public std::enable_shared_from_this * Note: This method is not thread safe, and should ideally be called from main thread. */ void AddMetricReader(std::shared_ptr reader, - std::unique_ptr metric_filter = nullptr) noexcept; + std::unique_ptr metric_filter = nullptr); /** * Attaches a View to list of configured Views for this Meter context. @@ -167,13 +167,13 @@ class MeterContext : public std::enable_shared_from_this */ void AddView(std::unique_ptr instrument_selector, std::unique_ptr meter_selector, - std::unique_ptr view) noexcept; + std::unique_ptr view); #ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW - void SetExemplarFilter(ExemplarFilterType exemplar_filter_type) noexcept; + void SetExemplarFilter(ExemplarFilterType exemplar_filter_type); - ExemplarFilterType GetExemplarFilter() const noexcept; + ExemplarFilterType GetExemplarFilter() const; #endif @@ -194,12 +194,12 @@ class MeterContext : public std::enable_shared_from_this * within the given timeout. */ - bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); /** * Shutdown the Collectors associated with this meter provider. */ - bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); private: friend class ::testing::MetricCollectorTest; diff --git a/sdk/include/opentelemetry/sdk/metrics/meter_provider.h b/sdk/include/opentelemetry/sdk/metrics/meter_provider.h index a43c58a6fa..dd54478d98 100644 --- a/sdk/include/opentelemetry/sdk/metrics/meter_provider.h +++ b/sdk/include/opentelemetry/sdk/metrics/meter_provider.h @@ -100,7 +100,7 @@ class OPENTELEMETRY_EXPORT MeterProvider final : public opentelemetry::metrics:: * Obtain the resource associated with this meter provider. * @return The resource for this meter provider. */ - const sdk::resource::Resource &GetResource() const noexcept; + const sdk::resource::Resource &GetResource() const; /** * Create a MetricCollector from a MetricReader using the MeterContext of this MeterProvider and @@ -114,7 +114,7 @@ class OPENTELEMETRY_EXPORT MeterProvider final : public opentelemetry::metrics:: * Note: This method is not thread safe, and should ideally be called from main thread. */ void AddMetricReader(std::shared_ptr reader, - std::unique_ptr metric_filter = nullptr) noexcept; + std::unique_ptr metric_filter = nullptr); /** * Attaches a View to list of configured Views for this Meter provider. @@ -128,7 +128,7 @@ class OPENTELEMETRY_EXPORT MeterProvider final : public opentelemetry::metrics:: */ void AddView(std::unique_ptr instrument_selector, std::unique_ptr meter_selector, - std::unique_ptr view) noexcept; + std::unique_ptr view); /** * Update the MeterConfigurator for this provider, recreate and propagate the resulting @@ -145,20 +145,20 @@ class OPENTELEMETRY_EXPORT MeterProvider final : public opentelemetry::metrics:: #ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW - void SetExemplarFilter(metrics::ExemplarFilterType exemplar_filter_type = - metrics::ExemplarFilterType::kTraceBased) noexcept; + void SetExemplarFilter( + metrics::ExemplarFilterType exemplar_filter_type = metrics::ExemplarFilterType::kTraceBased); #endif /** * Shutdown the meter provider. */ - bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); /** * Force flush the meter provider. */ - bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); ~MeterProvider() override; diff --git a/sdk/include/opentelemetry/sdk/metrics/metric_reader.h b/sdk/include/opentelemetry/sdk/metrics/metric_reader.h index 64bf62e245..46cb195bf6 100644 --- a/sdk/include/opentelemetry/sdk/metrics/metric_reader.h +++ b/sdk/include/opentelemetry/sdk/metrics/metric_reader.h @@ -38,7 +38,7 @@ class MetricReader * Collect the metrics from SDK. * @return return the status of the operation. */ - bool Collect(nostd::function_ref callback) noexcept; + bool Collect(nostd::function_ref callback); /** * Get the AggregationTemporality for given Instrument Type for this reader. @@ -47,7 +47,7 @@ class MetricReader */ virtual AggregationTemporality GetAggregationTemporality( - InstrumentType instrument_type) const noexcept = 0; + InstrumentType instrument_type) const = 0; /** * Get the cardinality limit for a given instrument type. @@ -57,7 +57,7 @@ class MetricReader * @param instrument_type The instrument type to get the limit for * @return The cardinality limit for the requested instrument type */ - std::size_t GetCardinalityLimit(InstrumentType instrument_type) const noexcept; + std::size_t GetCardinalityLimit(InstrumentType instrument_type) const; /** * Set per-instrument-type cardinality limits for this reader. @@ -68,7 +68,7 @@ class MetricReader * * @param limits The cardinality limits to apply */ - void SetCardinalityLimits(const CardinalityLimits &limits) noexcept; + void SetCardinalityLimits(const CardinalityLimits &limits); /** * Shutdown the metric reader. @@ -78,7 +78,7 @@ class MetricReader * * @return the result of OnShutDown() for the first call, true for any subsequent call. */ - bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); /** * Force flush the metric read by the reader. @@ -86,21 +86,21 @@ class MetricReader * @return false without invoking OnForceFlush() if the reader is already shut down, otherwise * the result of OnForceFlush(). */ - bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); /** * Return the status of Metric reader. */ - bool IsShutdown() const noexcept; + bool IsShutdown() const; virtual ~MetricReader() = default; private: - virtual bool OnForceFlush(std::chrono::microseconds timeout) noexcept = 0; + virtual bool OnForceFlush(std::chrono::microseconds timeout) = 0; - virtual bool OnShutDown(std::chrono::microseconds timeout) noexcept = 0; + virtual bool OnShutDown(std::chrono::microseconds timeout) = 0; - virtual void OnInitialized() noexcept {} + virtual void OnInitialized() {} protected: private: diff --git a/sdk/include/opentelemetry/sdk/metrics/provider.h b/sdk/include/opentelemetry/sdk/metrics/provider.h index facce08522..60ce787b55 100644 --- a/sdk/include/opentelemetry/sdk/metrics/provider.h +++ b/sdk/include/opentelemetry/sdk/metrics/provider.h @@ -24,8 +24,7 @@ class Provider /** * Changes the singleton MeterProvider. */ - static void SetMeterProvider( - const nostd::shared_ptr &mp) noexcept; + static void SetMeterProvider(const nostd::shared_ptr &mp); }; } // namespace metrics diff --git a/sdk/include/opentelemetry/sdk/metrics/push_metric_exporter.h b/sdk/include/opentelemetry/sdk/metrics/push_metric_exporter.h index 92220db48e..5ce7945d0d 100644 --- a/sdk/include/opentelemetry/sdk/metrics/push_metric_exporter.h +++ b/sdk/include/opentelemetry/sdk/metrics/push_metric_exporter.h @@ -38,7 +38,7 @@ class PushMetricExporter * concurrently for the same exporter instance. * @param data metrics data */ - virtual opentelemetry::sdk::common::ExportResult Export(const ResourceMetrics &data) noexcept = 0; + virtual opentelemetry::sdk::common::ExportResult Export(const ResourceMetrics &data) = 0; /** * Get the AggregationTemporality for given Instrument Type for this exporter. @@ -46,21 +46,20 @@ class PushMetricExporter * @return AggregationTemporality */ virtual AggregationTemporality GetAggregationTemporality( - InstrumentType instrument_type) const noexcept = 0; + InstrumentType instrument_type) const = 0; /** * Force flush the exporter. */ virtual bool ForceFlush( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0; + std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) = 0; /** * Shut down the metric exporter. * @param timeout an optional timeout. * @return return the status of the operation. */ - virtual bool Shutdown( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0; + virtual bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) = 0; }; } // namespace metrics } // namespace sdk diff --git a/sdk/include/opentelemetry/sdk/metrics/state/async_metric_storage.h b/sdk/include/opentelemetry/sdk/metrics/state/async_metric_storage.h index 72d14f378e..c9c8b7e8d8 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/async_metric_storage.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/async_metric_storage.h @@ -75,7 +75,7 @@ class AsyncMetricStorage : public MetricStorage, public AsyncWritableMetricStora */ template void Record(const std::unordered_map &measurements, - opentelemetry::common::SystemTimestamp /* observation_time */) noexcept + opentelemetry::common::SystemTimestamp /* observation_time */) { std::lock_guard guard(hashmap_lock_); #ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW @@ -105,7 +105,7 @@ class AsyncMetricStorage : public MetricStorage, public AsyncWritableMetricStora void RecordLong( const std::unordered_map &measurements, - opentelemetry::common::SystemTimestamp observation_time) noexcept override + opentelemetry::common::SystemTimestamp observation_time) override { if (instrument_descriptor_.value_type_ != InstrumentValueType::kLong) { @@ -116,7 +116,7 @@ class AsyncMetricStorage : public MetricStorage, public AsyncWritableMetricStora void RecordDouble( const std::unordered_map &measurements, - opentelemetry::common::SystemTimestamp observation_time) noexcept override + opentelemetry::common::SystemTimestamp observation_time) override { if (instrument_descriptor_.value_type_ != InstrumentValueType::kDouble) { @@ -196,7 +196,7 @@ class AsyncMetricStorage : public MetricStorage, public AsyncWritableMetricStora * monotonic sums. An attribute set missing from this round keeps its baseline and contributes * no delta; suppressing the stale output is the temporal storage's job. */ - void BuildDeltaFromRound() noexcept + void BuildDeltaFromRound() { round_hash_map_->GetAllEntries([this](const MetricAttributes &attributes, Aggregation &aggregation) { @@ -256,7 +256,7 @@ class AsyncMetricStorage : public MetricStorage, public AsyncWritableMetricStora * DefaultAggregation::CreateAggregation() would create. */ static bool IsMonotonicSum(AggregationType aggregation_type, - const InstrumentDescriptor &instrument_descriptor) noexcept + const InstrumentDescriptor &instrument_descriptor) { bool is_monotonic = true; if (aggregation_type == AggregationType::kDefault) diff --git a/sdk/include/opentelemetry/sdk/metrics/state/metric_collector.h b/sdk/include/opentelemetry/sdk/metrics/state/metric_collector.h index e4e9c32259..f8b13b8807 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/metric_collector.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/metric_collector.h @@ -36,8 +36,7 @@ class CollectorHandle virtual ~CollectorHandle() = default; - virtual AggregationTemporality GetAggregationTemporality( - InstrumentType instrument_type) noexcept = 0; + virtual AggregationTemporality GetAggregationTemporality(InstrumentType instrument_type) = 0; /** * Get the cardinality limit for a given instrument type. @@ -45,7 +44,7 @@ class CollectorHandle * @param instrument_type The instrument type to get the limit for * @return The cardinality limit for the requested instrument type */ - virtual std::size_t GetCardinalityLimit(InstrumentType instrument_type) const noexcept = 0; + virtual std::size_t GetCardinalityLimit(InstrumentType instrument_type) const = 0; }; /** @@ -68,10 +67,9 @@ class MetricCollector : public MetricProducer, public CollectorHandle ~MetricCollector() override = default; - AggregationTemporality GetAggregationTemporality( - InstrumentType instrument_type) noexcept override; + AggregationTemporality GetAggregationTemporality(InstrumentType instrument_type) override; - std::size_t GetCardinalityLimit(InstrumentType instrument_type) const noexcept override; + std::size_t GetCardinalityLimit(InstrumentType instrument_type) const override; /** * The callback to be called for each metric exporter. This will only be those @@ -79,11 +77,11 @@ class MetricCollector : public MetricProducer, public CollectorHandle * * @return a status of completion of method. */ - Result Produce() noexcept override; + Result Produce() override; - bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); - bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); private: MeterContext *meter_context_; diff --git a/sdk/include/opentelemetry/sdk/metrics/state/metric_storage.h b/sdk/include/opentelemetry/sdk/metrics/state/metric_storage.h index 7f7a89edec..5203da9a50 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/metric_storage.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/metric_storage.h @@ -46,8 +46,8 @@ class BoundSyncWritableMetricStorage BoundSyncWritableMetricStorage &operator=(BoundSyncWritableMetricStorage &&) = delete; virtual ~BoundSyncWritableMetricStorage() = default; - virtual void RecordLong(int64_t value) noexcept = 0; - virtual void RecordDouble(double value) noexcept = 0; + virtual void RecordLong(int64_t value) = 0; + virtual void RecordDouble(double value) = 0; }; #endif @@ -68,7 +68,7 @@ class MetricStorage nostd::span> collectors, opentelemetry::common::SystemTimestamp sdk_start_ts, opentelemetry::common::SystemTimestamp collection_ts, - nostd::function_ref callback) noexcept = 0; + nostd::function_ref callback) = 0; }; /* Represents the sync metric storage */ @@ -84,19 +84,17 @@ class SyncWritableMetricStorage virtual ~SyncWritableMetricStorage() = default; - virtual void RecordLong(int64_t value, - const opentelemetry::context::Context &context) noexcept = 0; + virtual void RecordLong(int64_t value, const opentelemetry::context::Context &context) = 0; virtual void RecordLong(int64_t value, const opentelemetry::common::KeyValueIterable &attributes, - const opentelemetry::context::Context &context) noexcept = 0; + const opentelemetry::context::Context &context) = 0; - virtual void RecordDouble(double value, - const opentelemetry::context::Context &context) noexcept = 0; + virtual void RecordDouble(double value, const opentelemetry::context::Context &context) = 0; virtual void RecordDouble(double value, const opentelemetry::common::KeyValueIterable &attributes, - const opentelemetry::context::Context &context) noexcept = 0; + const opentelemetry::context::Context &context) = 0; #ifdef OPENTELEMETRY_HAVE_METRICS_BOUND_INSTRUMENTS_PREVIEW /** @@ -105,7 +103,7 @@ class SyncWritableMetricStorage * the storage does not support binding. Default returns nullptr. */ virtual std::shared_ptr Bind( - const opentelemetry::common::KeyValueIterable & /* attributes */) noexcept + const opentelemetry::common::KeyValueIterable & /* attributes */) { return nullptr; } @@ -128,11 +126,11 @@ class AsyncWritableMetricStorage /* Records a batch of measurements */ virtual void RecordLong( const std::unordered_map &measurements, - opentelemetry::common::SystemTimestamp observation_time) noexcept = 0; + opentelemetry::common::SystemTimestamp observation_time) = 0; virtual void RecordDouble( const std::unordered_map &measurements, - opentelemetry::common::SystemTimestamp observation_time) noexcept = 0; + opentelemetry::common::SystemTimestamp observation_time) = 0; }; class NoopMetricStorage : public MetricStorage @@ -142,7 +140,7 @@ class NoopMetricStorage : public MetricStorage nostd::span> /* collectors */, opentelemetry::common::SystemTimestamp /* sdk_start_ts */, opentelemetry::common::SystemTimestamp /* collection_ts */, - nostd::function_ref callback) noexcept override + nostd::function_ref callback) override { MetricData metric_data{}; return callback(std::move(metric_data)); @@ -152,21 +150,20 @@ class NoopMetricStorage : public MetricStorage class NoopWritableMetricStorage : public SyncWritableMetricStorage { public: - void RecordLong(int64_t value, - const opentelemetry::context::Context &context) noexcept override = 0; + void RecordLong(int64_t value, const opentelemetry::context::Context &context) override = 0; void RecordLong(int64_t /* value */, const opentelemetry::common::KeyValueIterable & /* attributes */, - const opentelemetry::context::Context & /* context */) noexcept override + const opentelemetry::context::Context & /* context */) override {} void RecordDouble(double /* value */, - const opentelemetry::context::Context & /* context */) noexcept override + const opentelemetry::context::Context & /* context */) override {} void RecordDouble(double /* value */, const opentelemetry::common::KeyValueIterable & /* attributes */, - const opentelemetry::context::Context & /* context */) noexcept override + const opentelemetry::context::Context & /* context */) override {} }; @@ -175,12 +172,12 @@ class NoopAsyncWritableMetricStorage : public AsyncWritableMetricStorage public: void RecordLong(const std::unordered_map & /* measurements */, - opentelemetry::common::SystemTimestamp /* observation_time */) noexcept override + opentelemetry::common::SystemTimestamp /* observation_time */) override {} void RecordDouble(const std::unordered_map & /* measurements */, - opentelemetry::common::SystemTimestamp /* observation_time */) noexcept override + opentelemetry::common::SystemTimestamp /* observation_time */) override {} }; diff --git a/sdk/include/opentelemetry/sdk/metrics/state/multi_metric_storage.h b/sdk/include/opentelemetry/sdk/metrics/state/multi_metric_storage.h index 2b5798a7f6..4d7619b367 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/multi_metric_storage.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/multi_metric_storage.h @@ -40,7 +40,7 @@ class SyncMultiMetricStorage : public SyncWritableMetricStorage return true; } - void RecordLong(int64_t value, const opentelemetry::context::Context &context) noexcept override + void RecordLong(int64_t value, const opentelemetry::context::Context &context) override { for (auto &s : storages_) { @@ -50,7 +50,7 @@ class SyncMultiMetricStorage : public SyncWritableMetricStorage void RecordLong(int64_t value, const opentelemetry::common::KeyValueIterable &attributes, - const opentelemetry::context::Context &context) noexcept override + const opentelemetry::context::Context &context) override { for (auto &s : storages_) { @@ -58,7 +58,7 @@ class SyncMultiMetricStorage : public SyncWritableMetricStorage } } - void RecordDouble(double value, const opentelemetry::context::Context &context) noexcept override + void RecordDouble(double value, const opentelemetry::context::Context &context) override { for (auto &s : storages_) { @@ -68,7 +68,7 @@ class SyncMultiMetricStorage : public SyncWritableMetricStorage void RecordDouble(double value, const opentelemetry::common::KeyValueIterable &attributes, - const opentelemetry::context::Context &context) noexcept override + const opentelemetry::context::Context &context) override { for (auto &s : storages_) { @@ -78,7 +78,7 @@ class SyncMultiMetricStorage : public SyncWritableMetricStorage #ifdef OPENTELEMETRY_HAVE_METRICS_BOUND_INSTRUMENTS_PREVIEW std::shared_ptr Bind( - const opentelemetry::common::KeyValueIterable &attributes) noexcept override; + const opentelemetry::common::KeyValueIterable &attributes) override; #endif private: @@ -105,7 +105,7 @@ class AsyncMultiMetricStorage : public AsyncWritableMetricStorage void RecordLong( const std::unordered_map &measurements, - opentelemetry::common::SystemTimestamp observation_time) noexcept override + opentelemetry::common::SystemTimestamp observation_time) override { for (auto &s : storages_) { @@ -115,7 +115,7 @@ class AsyncMultiMetricStorage : public AsyncWritableMetricStorage void RecordDouble( const std::unordered_map &measurements, - opentelemetry::common::SystemTimestamp observation_time) noexcept override + opentelemetry::common::SystemTimestamp observation_time) override { for (auto &s : storages_) { @@ -139,12 +139,11 @@ class AsyncMultiMetricStorage : public AsyncWritableMetricStorage class MultiBoundEntry : public BoundSyncWritableMetricStorage { public: - explicit MultiBoundEntry( - std::vector> children) noexcept + explicit MultiBoundEntry(std::vector> children) : children_(std::move(children)) {} - void RecordLong(int64_t value) noexcept override + void RecordLong(int64_t value) override { for (auto &c : children_) { @@ -152,7 +151,7 @@ class MultiBoundEntry : public BoundSyncWritableMetricStorage } } - void RecordDouble(double value) noexcept override + void RecordDouble(double value) override { for (auto &c : children_) { @@ -165,7 +164,7 @@ class MultiBoundEntry : public BoundSyncWritableMetricStorage }; inline std::shared_ptr SyncMultiMetricStorage::Bind( - const opentelemetry::common::KeyValueIterable &attributes) noexcept + const opentelemetry::common::KeyValueIterable &attributes) { std::vector> children; children.reserve(storages_.size()); diff --git a/sdk/include/opentelemetry/sdk/metrics/state/sync_metric_storage.h b/sdk/include/opentelemetry/sdk/metrics/state/sync_metric_storage.h index c657215695..4787f65ce1 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/sync_metric_storage.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/sync_metric_storage.h @@ -77,7 +77,7 @@ class SyncMetricStorage : public MetricStorage, public SyncWritableMetricStorage void RecordLong(int64_t value, const opentelemetry::context::Context &context - OPENTELEMETRY_MAYBE_UNUSED) noexcept override + OPENTELEMETRY_MAYBE_UNUSED) override { if (instrument_descriptor_.value_type_ != InstrumentValueType::kLong) { @@ -103,7 +103,7 @@ class SyncMetricStorage : public MetricStorage, public SyncWritableMetricStorage void RecordLong(int64_t value, const opentelemetry::common::KeyValueIterable &attributes, const opentelemetry::context::Context &context - OPENTELEMETRY_MAYBE_UNUSED) noexcept override + OPENTELEMETRY_MAYBE_UNUSED) override { if (instrument_descriptor_.value_type_ != InstrumentValueType::kLong) { @@ -134,7 +134,7 @@ class SyncMetricStorage : public MetricStorage, public SyncWritableMetricStorage void RecordDouble(double value, const opentelemetry::context::Context &context - OPENTELEMETRY_MAYBE_UNUSED) noexcept override + OPENTELEMETRY_MAYBE_UNUSED) override { if (instrument_descriptor_.value_type_ != InstrumentValueType::kDouble) { @@ -160,7 +160,7 @@ class SyncMetricStorage : public MetricStorage, public SyncWritableMetricStorage void RecordDouble(double value, const opentelemetry::common::KeyValueIterable &attributes, const opentelemetry::context::Context &context - OPENTELEMETRY_MAYBE_UNUSED) noexcept override + OPENTELEMETRY_MAYBE_UNUSED) override { if (instrument_descriptor_.value_type_ != InstrumentValueType::kDouble) { @@ -190,11 +190,11 @@ class SyncMetricStorage : public MetricStorage, public SyncWritableMetricStorage nostd::span> collectors, opentelemetry::common::SystemTimestamp sdk_start_ts, opentelemetry::common::SystemTimestamp collection_ts, - nostd::function_ref callback) noexcept override; + nostd::function_ref callback) override; #ifdef OPENTELEMETRY_HAVE_METRICS_BOUND_INSTRUMENTS_PREVIEW std::shared_ptr Bind( - const opentelemetry::common::KeyValueIterable &attributes) noexcept override; + const opentelemetry::common::KeyValueIterable &attributes) override; // Internal: stable bound entry. Self-contained: owns its own mutex and // aggregation so the user-held handle stays safe to call even if the parent @@ -211,14 +211,14 @@ class SyncMetricStorage : public MetricStorage, public SyncWritableMetricStorage public: BoundEntry(InstrumentValueType value_type, MetricAttributes attributes, - std::unique_ptr initial_aggregation) noexcept + std::unique_ptr initial_aggregation) : value_type_(value_type), attributes_(std::move(attributes)), current_(std::move(initial_aggregation)) {} - void RecordLong(int64_t value) noexcept override; - void RecordDouble(double value) noexcept override; + void RecordLong(int64_t value) override; + void RecordDouble(double value) override; private: friend class SyncMetricStorage; @@ -247,7 +247,7 @@ class SyncMetricStorage : public MetricStorage, public SyncWritableMetricStorage // It is reset to bound entry keys at every Collect(). // // Must be called with attribute_hashmap_lock_ held. - MetricAttributes ResolveCardinality(const MetricAttributes &filtered) noexcept + MetricAttributes ResolveCardinality(const MetricAttributes &filtered) { if (filtered == GetOverflowAttributes()) { diff --git a/sdk/include/opentelemetry/sdk/metrics/state/temporal_metric_storage.h b/sdk/include/opentelemetry/sdk/metrics/state/temporal_metric_storage.h index 50fa1a2240..a23611ab55 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/temporal_metric_storage.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/temporal_metric_storage.h @@ -41,7 +41,7 @@ class TemporalMetricStorage opentelemetry::common::SystemTimestamp sdk_start_ts, opentelemetry::common::SystemTimestamp collection_ts, const std::shared_ptr &delta_metrics, - nostd::function_ref callback) noexcept; + nostd::function_ref callback); private: InstrumentDescriptor instrument_descriptor_; diff --git a/sdk/include/opentelemetry/sdk/metrics/view/attributes_processor.h b/sdk/include/opentelemetry/sdk/metrics/view/attributes_processor.h index 50383c7f1b..b81db3c16c 100644 --- a/sdk/include/opentelemetry/sdk/metrics/view/attributes_processor.h +++ b/sdk/include/opentelemetry/sdk/metrics/view/attributes_processor.h @@ -48,9 +48,9 @@ class AttributesProcessor // @returns integer with individual bits set if they are to be filtered. virtual MetricAttributes process( - const opentelemetry::common::KeyValueIterable &attributes) const noexcept = 0; + const opentelemetry::common::KeyValueIterable &attributes) const = 0; - virtual bool isPresent(nostd::string_view key) const noexcept = 0; + virtual bool isPresent(nostd::string_view key) const = 0; virtual ~AttributesProcessor() = default; }; @@ -63,14 +63,13 @@ class AttributesProcessor class DefaultAttributesProcessor : public AttributesProcessor { public: - MetricAttributes process( - const opentelemetry::common::KeyValueIterable &attributes) const noexcept override + MetricAttributes process(const opentelemetry::common::KeyValueIterable &attributes) const override { MetricAttributes result(attributes); return result; } - bool isPresent(nostd::string_view /*key*/) const noexcept override { return true; } + bool isPresent(nostd::string_view /*key*/) const override { return true; } }; /** @@ -89,12 +88,11 @@ class FilteringAttributesProcessor : public AttributesProcessor : allowed_attribute_keys_(allowed_attribute_keys) {} - MetricAttributes process( - const opentelemetry::common::KeyValueIterable &attributes) const noexcept override + MetricAttributes process(const opentelemetry::common::KeyValueIterable &attributes) const override { MetricAttributes result; attributes.ForEachKeyValue( - [&](nostd::string_view key, opentelemetry::common::AttributeValue value) noexcept { + [&](nostd::string_view key, opentelemetry::common::AttributeValue value) { if (opentelemetry::sdk::common::find_heterogeneous(allowed_attribute_keys_, key) != allowed_attribute_keys_.end()) { @@ -108,7 +106,7 @@ class FilteringAttributesProcessor : public AttributesProcessor return result; } - bool isPresent(nostd::string_view key) const noexcept override + bool isPresent(nostd::string_view key) const override { return (opentelemetry::sdk::common::find_heterogeneous(allowed_attribute_keys_, key) != allowed_attribute_keys_.end()); @@ -134,12 +132,11 @@ class FilteringExcludeAttributesProcessor : public AttributesProcessor : exclude_list_(exclude_list) {} - MetricAttributes process( - const opentelemetry::common::KeyValueIterable &attributes) const noexcept override + MetricAttributes process(const opentelemetry::common::KeyValueIterable &attributes) const override { MetricAttributes result; attributes.ForEachKeyValue([&](nostd::string_view key, - opentelemetry::common::AttributeValue value) noexcept { + opentelemetry::common::AttributeValue value) { if (opentelemetry::sdk::common::find_heterogeneous(exclude_list_, key) == exclude_list_.end()) { result.SetAttribute(key, value); @@ -152,7 +149,7 @@ class FilteringExcludeAttributesProcessor : public AttributesProcessor return result; } - bool isPresent(nostd::string_view key) const noexcept override + bool isPresent(nostd::string_view key) const override { return (opentelemetry::sdk::common::find_heterogeneous(exclude_list_, key) == exclude_list_.end()); @@ -174,12 +171,12 @@ class OPENTELEMETRY_EXPORT IncludeExcludeAttributesProcessor final : public Attr std::vector excluded_patterns); MetricAttributes process( - const opentelemetry::common::KeyValueIterable &attributes) const noexcept override; + const opentelemetry::common::KeyValueIterable &attributes) const override; - bool isPresent(nostd::string_view key) const noexcept override; + bool isPresent(nostd::string_view key) const override; private: - static bool MatchesAny(const std::vector &patterns, nostd::string_view key) noexcept; + static bool MatchesAny(const std::vector &patterns, nostd::string_view key); bool include_all_{true}; std::vector included_patterns_; diff --git a/sdk/include/opentelemetry/sdk/metrics/view/predicate.h b/sdk/include/opentelemetry/sdk/metrics/view/predicate.h index 06528a53cd..9b33bd69dc 100644 --- a/sdk/include/opentelemetry/sdk/metrics/view/predicate.h +++ b/sdk/include/opentelemetry/sdk/metrics/view/predicate.h @@ -26,7 +26,7 @@ class Predicate virtual ~Predicate() = default; - virtual bool Match(opentelemetry::nostd::string_view string) const noexcept = 0; + virtual bool Match(opentelemetry::nostd::string_view string) const = 0; }; class PatternPredicate : public Predicate @@ -41,7 +41,7 @@ class PatternPredicate : public Predicate ~PatternPredicate() override; - bool Match(opentelemetry::nostd::string_view str) const noexcept override; + bool Match(opentelemetry::nostd::string_view str) const override; private: class Impl; @@ -53,7 +53,7 @@ class WildcardPredicate : public Predicate public: explicit WildcardPredicate(opentelemetry::nostd::string_view pattern); - bool Match(opentelemetry::nostd::string_view str) const noexcept override; + bool Match(opentelemetry::nostd::string_view str) const override; private: std::string pattern_; @@ -64,7 +64,7 @@ class ExactPredicate : public Predicate public: explicit ExactPredicate(opentelemetry::nostd::string_view pattern); - bool Match(opentelemetry::nostd::string_view str) const noexcept override; + bool Match(opentelemetry::nostd::string_view str) const override; private: std::string pattern_; @@ -73,13 +73,13 @@ class ExactPredicate : public Predicate class MatchEverythingPattern : public Predicate { public: - bool Match(opentelemetry::nostd::string_view str) const noexcept override; + bool Match(opentelemetry::nostd::string_view str) const override; }; class MatchNothingPattern : public Predicate { public: - bool Match(opentelemetry::nostd::string_view str) const noexcept override; + bool Match(opentelemetry::nostd::string_view str) const override; }; } // namespace metrics } // namespace sdk diff --git a/sdk/include/opentelemetry/sdk/metrics/view/view.h b/sdk/include/opentelemetry/sdk/metrics/view/view.h index e00faaed3f..2df28dd504 100644 --- a/sdk/include/opentelemetry/sdk/metrics/view/view.h +++ b/sdk/include/opentelemetry/sdk/metrics/view/view.h @@ -45,19 +45,16 @@ class View virtual ~View() = default; - virtual std::string GetName() const noexcept { return name_; } + virtual std::string GetName() const { return name_; } - virtual std::string GetDescription() const noexcept { return description_; } + virtual std::string GetDescription() const { return description_; } - virtual AggregationType GetAggregationType() const noexcept { return aggregation_type_; } + virtual AggregationType GetAggregationType() const { return aggregation_type_; } - virtual AggregationConfig *GetAggregationConfig() const noexcept - { - return aggregation_config_.get(); - } + virtual AggregationConfig *GetAggregationConfig() const { return aggregation_config_.get(); } virtual std::shared_ptr - GetAttributesProcessor() const noexcept + GetAttributesProcessor() const { return attributes_processor_; } diff --git a/sdk/include/opentelemetry/sdk/resource/resource.h b/sdk/include/opentelemetry/sdk/resource/resource.h index 2e462122f5..813245d448 100644 --- a/sdk/include/opentelemetry/sdk/resource/resource.h +++ b/sdk/include/opentelemetry/sdk/resource/resource.h @@ -19,11 +19,11 @@ using ResourceAttributes = opentelemetry::sdk::common::AttributeMap; class Resource { public: - Resource() noexcept; + Resource(); - Resource(const ResourceAttributes &attributes) noexcept; + Resource(const ResourceAttributes &attributes); - Resource(const ResourceAttributes &attributes, const std::string &schema_url) noexcept; + Resource(const ResourceAttributes &attributes, const std::string &schema_url); Resource(const Resource &) = default; Resource(Resource &&) = default; @@ -32,8 +32,8 @@ class Resource ~Resource() = default; - const ResourceAttributes &GetAttributes() const noexcept; - const std::string &GetSchemaURL() const noexcept; + const ResourceAttributes &GetAttributes() const; + const std::string &GetSchemaURL() const; /** * Returns a new, merged {@link Resource} by merging the current Resource @@ -48,7 +48,7 @@ class Resource * @returns the newly merged Resource. */ - Resource Merge(const Resource &other) const noexcept; + Resource Merge(const Resource &other) const; /** * Returns a newly created Resource with the specified attributes. diff --git a/sdk/include/opentelemetry/sdk/trace/batch_span_processor.h b/sdk/include/opentelemetry/sdk/trace/batch_span_processor.h index a4a69a57d2..890bd3ceaa 100644 --- a/sdk/include/opentelemetry/sdk/trace/batch_span_processor.h +++ b/sdk/include/opentelemetry/sdk/trace/batch_span_processor.h @@ -66,7 +66,7 @@ class BatchSpanProcessor : public SpanProcessor * * @return A recordable generated by the backend exporter */ - std::unique_ptr MakeRecordable() noexcept override; + std::unique_ptr MakeRecordable() override; /** * Called when a span is started. @@ -76,23 +76,21 @@ class BatchSpanProcessor : public SpanProcessor * @param span - The span that just started * @param parent_context - The parent context of the span that just started */ - void OnStart(Recordable &span, - const opentelemetry::trace::SpanContext &parent_context) noexcept override; + void OnStart(Recordable &span, const opentelemetry::trace::SpanContext &parent_context) override; /** * Called when a span ends. * * @param span - A recordable for a span that just ended */ - void OnEnd(std::unique_ptr &&span) noexcept override; + void OnEnd(std::unique_ptr &&span) override; /** * Export all ended spans that have not been exported yet. * * NOTE: Timeout functionality not supported yet. */ - bool ForceFlush( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override; + bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) override; /** * Shuts down the processor and does any cleanup required. Completely drains the buffer/queue of @@ -102,8 +100,7 @@ class BatchSpanProcessor : public SpanProcessor * returning failure. * @return true if the shutdown succeeded, false otherwise */ - bool Shutdown( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override; + bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) override; /** * Class destructor which invokes the Shutdown() method. The Shutdown() method is supposed to be @@ -122,8 +119,7 @@ class BatchSpanProcessor : public SpanProcessor * returning failure. * @return true if the shutdown succeeded, false otherwise */ - bool InternalShutdown( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool InternalShutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); /** * The background routine performed by the worker thread. diff --git a/sdk/include/opentelemetry/sdk/trace/exporter.h b/sdk/include/opentelemetry/sdk/trace/exporter.h index ffd3785b87..35336eeede 100644 --- a/sdk/include/opentelemetry/sdk/trace/exporter.h +++ b/sdk/include/opentelemetry/sdk/trace/exporter.h @@ -42,7 +42,7 @@ class OPENTELEMETRY_EXPORT SpanExporter * * Note: This method must be callable from multiple threads. */ - virtual std::unique_ptr MakeRecordable() noexcept = 0; + virtual std::unique_ptr MakeRecordable() = 0; /** * Exports a batch of span recordables. This method must not be called @@ -50,7 +50,7 @@ class OPENTELEMETRY_EXPORT SpanExporter * @param spans a span of unique pointers to span recordables */ virtual sdk::common::ExportResult Export( - const nostd::span> &spans) noexcept = 0; + const nostd::span> &spans) = 0; /** * Export all spans that have been exported. @@ -59,15 +59,14 @@ class OPENTELEMETRY_EXPORT SpanExporter * @return return true when all data are exported, and false when timeout */ virtual bool ForceFlush( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0; + std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) = 0; /** * Shut down the exporter. * @param timeout an optional timeout. * @return return the status of the operation. */ - virtual bool Shutdown( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0; + virtual bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) = 0; }; } // namespace trace } // namespace sdk diff --git a/sdk/include/opentelemetry/sdk/trace/id_generator.h b/sdk/include/opentelemetry/sdk/trace/id_generator.h index 28c80fc067..1210d078ee 100644 --- a/sdk/include/opentelemetry/sdk/trace/id_generator.h +++ b/sdk/include/opentelemetry/sdk/trace/id_generator.h @@ -27,10 +27,10 @@ class IdGenerator virtual ~IdGenerator() = default; /** Returns a SpanId represented by opaque 128-bit trace identifier */ - virtual opentelemetry::trace::SpanId GenerateSpanId() noexcept = 0; + virtual opentelemetry::trace::SpanId GenerateSpanId() = 0; /** Returns a TraceId represented by opaque 64-bit trace identifier */ - virtual opentelemetry::trace::TraceId GenerateTraceId() noexcept = 0; + virtual opentelemetry::trace::TraceId GenerateTraceId() = 0; bool IsRandom() const { return is_random_; } diff --git a/sdk/include/opentelemetry/sdk/trace/multi_recordable.h b/sdk/include/opentelemetry/sdk/trace/multi_recordable.h index 84c4e6be81..a03f50901a 100644 --- a/sdk/include/opentelemetry/sdk/trace/multi_recordable.h +++ b/sdk/include/opentelemetry/sdk/trace/multi_recordable.h @@ -20,47 +20,45 @@ namespace trace class MultiRecordable : public Recordable { - static std::size_t MakeKey(const SpanProcessor &processor) noexcept; + static std::size_t MakeKey(const SpanProcessor &processor); public: - void AddRecordable(const SpanProcessor &processor, - std::unique_ptr recordable) noexcept; + void AddRecordable(const SpanProcessor &processor, std::unique_ptr recordable); - const std::unique_ptr &GetRecordable(const SpanProcessor &processor) const noexcept; + const std::unique_ptr &GetRecordable(const SpanProcessor &processor) const; - std::unique_ptr ReleaseRecordable(const SpanProcessor &processor) noexcept; + std::unique_ptr ReleaseRecordable(const SpanProcessor &processor); void SetIdentity(const opentelemetry::trace::SpanContext &span_context, - opentelemetry::trace::SpanId parent_span_id) noexcept override; + opentelemetry::trace::SpanId parent_span_id) override; void SetAttribute(nostd::string_view key, - const opentelemetry::common::AttributeValue &value) noexcept override; + const opentelemetry::common::AttributeValue &value) override; void AddEvent(nostd::string_view name, opentelemetry::common::SystemTimestamp timestamp, - const opentelemetry::common::KeyValueIterable &attributes) noexcept override; + const opentelemetry::common::KeyValueIterable &attributes) override; void AddLink(const opentelemetry::trace::SpanContext &span_context, - const opentelemetry::common::KeyValueIterable &attributes) noexcept override; + const opentelemetry::common::KeyValueIterable &attributes) override; - void SetStatus(opentelemetry::trace::StatusCode code, - nostd::string_view description) noexcept override; + void SetStatus(opentelemetry::trace::StatusCode code, nostd::string_view description) override; - void SetName(nostd::string_view name) noexcept override; + void SetName(nostd::string_view name) override; - void SetTraceFlags(opentelemetry::trace::TraceFlags flags) noexcept override; + void SetTraceFlags(opentelemetry::trace::TraceFlags flags) override; - void SetSpanKind(opentelemetry::trace::SpanKind span_kind) noexcept override; + void SetSpanKind(opentelemetry::trace::SpanKind span_kind) override; - void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept override; + void SetResource(const opentelemetry::sdk::resource::Resource &resource) override; - void SetStartTime(opentelemetry::common::SystemTimestamp start_time) noexcept override; + void SetStartTime(opentelemetry::common::SystemTimestamp start_time) override; - void SetDuration(std::chrono::nanoseconds duration) noexcept override; + void SetDuration(std::chrono::nanoseconds duration) override; - void SetSpanLimits(const SpanLimits &limits) noexcept override; + void SetSpanLimits(const SpanLimits &limits) override; - void SetInstrumentationScope(const InstrumentationScope &instrumentation_scope) noexcept override; + void SetInstrumentationScope(const InstrumentationScope &instrumentation_scope) override; private: std::map> recordables_; diff --git a/sdk/include/opentelemetry/sdk/trace/multi_span_processor.h b/sdk/include/opentelemetry/sdk/trace/multi_span_processor.h index 6d7e6ffbc4..f469983a9a 100644 --- a/sdk/include/opentelemetry/sdk/trace/multi_span_processor.h +++ b/sdk/include/opentelemetry/sdk/trace/multi_span_processor.h @@ -63,7 +63,7 @@ class MultiSpanProcessor : public SpanProcessor } } - std::unique_ptr MakeRecordable() noexcept override + std::unique_ptr MakeRecordable() override { auto recordable = std::unique_ptr(new MultiRecordable); auto multi_recordable = static_cast(recordable.get()); @@ -77,8 +77,7 @@ class MultiSpanProcessor : public SpanProcessor return recordable; } - void OnStart(Recordable &span, - const opentelemetry::trace::SpanContext &parent_context) noexcept override + void OnStart(Recordable &span, const opentelemetry::trace::SpanContext &parent_context) override { auto multi_recordable = static_cast(&span); ProcessorNode *node = head_; @@ -94,7 +93,7 @@ class MultiSpanProcessor : public SpanProcessor } } - void OnEnd(std::unique_ptr &&span) noexcept override + void OnEnd(std::unique_ptr &&span) override { auto multi_recordable = static_cast(std::move(span).release()); ProcessorNode *node = head_; @@ -111,8 +110,7 @@ class MultiSpanProcessor : public SpanProcessor delete multi_recordable; } - bool ForceFlush( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override + bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) override { bool result = true; ProcessorNode *node = head_; @@ -128,8 +126,7 @@ class MultiSpanProcessor : public SpanProcessor return result; } - bool Shutdown( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override + bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) override { return InternalShutdown(timeout); } @@ -141,8 +138,7 @@ class MultiSpanProcessor : public SpanProcessor } protected: - bool InternalShutdown( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept + bool InternalShutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) { bool result = true; ProcessorNode *node = head_; diff --git a/sdk/include/opentelemetry/sdk/trace/processor.h b/sdk/include/opentelemetry/sdk/trace/processor.h index 5c4a6a2d54..d5c2683fac 100644 --- a/sdk/include/opentelemetry/sdk/trace/processor.h +++ b/sdk/include/opentelemetry/sdk/trace/processor.h @@ -45,7 +45,7 @@ class OPENTELEMETRY_EXPORT SpanProcessor * * Note: This method must be callable from multiple threads. */ - virtual std::unique_ptr MakeRecordable() noexcept = 0; + virtual std::unique_ptr MakeRecordable() = 0; /** * OnStart is called when a span is started. @@ -53,13 +53,13 @@ class OPENTELEMETRY_EXPORT SpanProcessor * @param parent_context The parent context of the span that just started */ virtual void OnStart(Recordable &span, - const opentelemetry::trace::SpanContext &parent_context) noexcept = 0; + const opentelemetry::trace::SpanContext &parent_context) = 0; /** * OnEnd is called when a span is ended. * @param span a recordable for a span that was ended */ - virtual void OnEnd(std::unique_ptr &&span) noexcept = 0; + virtual void OnEnd(std::unique_ptr &&span) = 0; /** * Export all ended spans that have not yet been exported. @@ -67,7 +67,7 @@ class OPENTELEMETRY_EXPORT SpanProcessor * timeout is applied. */ virtual bool ForceFlush( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0; + std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) = 0; /** * Shut down the processor and do any cleanup required. Ended spans are @@ -77,8 +77,7 @@ class OPENTELEMETRY_EXPORT SpanProcessor * @param timeout an optional timeout, the default timeout means that no * timeout is applied. */ - virtual bool Shutdown( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0; + virtual bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) = 0; }; } // namespace trace } // namespace sdk diff --git a/sdk/include/opentelemetry/sdk/trace/provider.h b/sdk/include/opentelemetry/sdk/trace/provider.h index 98d3ca3a08..5fc1459daa 100644 --- a/sdk/include/opentelemetry/sdk/trace/provider.h +++ b/sdk/include/opentelemetry/sdk/trace/provider.h @@ -22,8 +22,7 @@ class OPENTELEMETRY_EXPORT Provider /** * Changes the singleton TracerProvider. */ - static void SetTracerProvider( - const nostd::shared_ptr &tp) noexcept; + static void SetTracerProvider(const nostd::shared_ptr &tp); }; } // namespace trace diff --git a/sdk/include/opentelemetry/sdk/trace/recordable.h b/sdk/include/opentelemetry/sdk/trace/recordable.h index e12d069f80..b303ec5b4e 100644 --- a/sdk/include/opentelemetry/sdk/trace/recordable.h +++ b/sdk/include/opentelemetry/sdk/trace/recordable.h @@ -60,7 +60,7 @@ class Recordable * @param parent_span_id the parent span id to set */ virtual void SetIdentity(const opentelemetry::trace::SpanContext &span_context, - opentelemetry::trace::SpanId parent_span_id) noexcept = 0; + opentelemetry::trace::SpanId parent_span_id) = 0; /** * Set an attribute of a span. @@ -68,7 +68,7 @@ class Recordable * @param value the attribute value */ virtual void SetAttribute(nostd::string_view key, - const opentelemetry::common::AttributeValue &value) noexcept = 0; + const opentelemetry::common::AttributeValue &value) = 0; /** * Add an event to a span. @@ -78,7 +78,7 @@ class Recordable */ virtual void AddEvent(nostd::string_view name, opentelemetry::common::SystemTimestamp timestamp, - const opentelemetry::common::KeyValueIterable &attributes) noexcept = 0; + const opentelemetry::common::KeyValueIterable &attributes) = 0; /** * Add an event to a span with default timestamp and attributes. @@ -105,8 +105,7 @@ class Recordable * @param name the name of the event * @param attributes the attributes associated with the event */ - void AddEvent(nostd::string_view name, - const opentelemetry::common::KeyValueIterable &attributes) noexcept + void AddEvent(nostd::string_view name, const opentelemetry::common::KeyValueIterable &attributes) { AddEvent(name, opentelemetry::common::SystemTimestamp(std::chrono::system_clock::now()), attributes); @@ -118,7 +117,7 @@ class Recordable * @param attributes the attributes associated with the link */ virtual void AddLink(const opentelemetry::trace::SpanContext &span_context, - const opentelemetry::common::KeyValueIterable &attributes) noexcept = 0; + const opentelemetry::common::KeyValueIterable &attributes) = 0; /** * Add a link to a span with default (empty) attributes. @@ -134,49 +133,48 @@ class Recordable * @param code the status code * @param description a description of the status */ - virtual void SetStatus(opentelemetry::trace::StatusCode code, - nostd::string_view description) noexcept = 0; + virtual void SetStatus(opentelemetry::trace::StatusCode code, nostd::string_view description) = 0; /** * Set the name of the span. * @param name the name to set */ - virtual void SetName(nostd::string_view name) noexcept = 0; + virtual void SetName(nostd::string_view name) = 0; /** * Set the trace flags of the span. */ - virtual void SetTraceFlags(opentelemetry::trace::TraceFlags /* flags */) noexcept {} + virtual void SetTraceFlags(opentelemetry::trace::TraceFlags /* flags */) {} /** * Set the spankind of the span. * @param span_kind the spankind to set */ - virtual void SetSpanKind(opentelemetry::trace::SpanKind span_kind) noexcept = 0; + virtual void SetSpanKind(opentelemetry::trace::SpanKind span_kind) = 0; /** * Set Resource of the span * @param resource the resource to set */ - virtual void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept = 0; + virtual void SetResource(const opentelemetry::sdk::resource::Resource &resource) = 0; /** * Set the start time of the span. * @param start_time the start time to set */ - virtual void SetStartTime(opentelemetry::common::SystemTimestamp start_time) noexcept = 0; + virtual void SetStartTime(opentelemetry::common::SystemTimestamp start_time) = 0; /** * Set the duration of the span. * @param duration the duration to set */ - virtual void SetDuration(std::chrono::nanoseconds duration) noexcept = 0; + virtual void SetDuration(std::chrono::nanoseconds duration) = 0; /** * Set the span limits for the span. * This method must be called before any SetAttribute / AddEvent / AddLink call. */ - virtual void SetSpanLimits(const SpanLimits & /* limits */) noexcept {} + virtual void SetSpanLimits(const SpanLimits & /* limits */) {} /** * Get the SpanData object for this Recordable. @@ -190,11 +188,10 @@ class Recordable * Set the instrumentation scope of the span. * @param instrumentation_scope the instrumentation scope to set */ - virtual void SetInstrumentationScope( - const InstrumentationScope &instrumentation_scope) noexcept = 0; + virtual void SetInstrumentationScope(const InstrumentationScope &instrumentation_scope) = 0; OPENTELEMETRY_DEPRECATED_MESSAGE("Please use SetInstrumentationScope instead") - void SetInstrumentationLibrary(const InstrumentationScope &instrumentation_scope) noexcept + void SetInstrumentationLibrary(const InstrumentationScope &instrumentation_scope) { SetInstrumentationScope(instrumentation_scope); } diff --git a/sdk/include/opentelemetry/sdk/trace/sampler.h b/sdk/include/opentelemetry/sdk/trace/sampler.h index 9aec4bcde8..17da28de99 100644 --- a/sdk/include/opentelemetry/sdk/trace/sampler.h +++ b/sdk/include/opentelemetry/sdk/trace/sampler.h @@ -58,11 +58,11 @@ struct SamplingResult // The tracestate used by the span. nostd::shared_ptr trace_state; - inline bool IsRecording() const noexcept + inline bool IsRecording() const { return decision == Decision::RECORD_ONLY || decision == Decision::RECORD_AND_SAMPLE; } - inline bool IsSampled() const noexcept { return decision == Decision::RECORD_AND_SAMPLE; } + inline bool IsSampled() const { return decision == Decision::RECORD_AND_SAMPLE; } }; /** @@ -101,7 +101,7 @@ class Sampler nostd::string_view name, opentelemetry::trace::SpanKind span_kind, const opentelemetry::common::KeyValueIterable &attributes, - const opentelemetry::trace::SpanContextKeyValueIterable &links) noexcept = 0; + const opentelemetry::trace::SpanContextKeyValueIterable &links) = 0; /** * Returns the sampler name or short description with the configuration. @@ -109,7 +109,7 @@ class Sampler * * @return the description of this Sampler. */ - virtual nostd::string_view GetDescription() const noexcept = 0; + virtual nostd::string_view GetDescription() const = 0; }; } // namespace trace } // namespace sdk diff --git a/sdk/include/opentelemetry/sdk/trace/samplers/composable_sampler.h b/sdk/include/opentelemetry/sdk/trace/samplers/composable_sampler.h index bc7014f668..847ff2bb78 100644 --- a/sdk/include/opentelemetry/sdk/trace/samplers/composable_sampler.h +++ b/sdk/include/opentelemetry/sdk/trace/samplers/composable_sampler.h @@ -104,12 +104,12 @@ class ComposableSampler nostd::string_view name, opentelemetry::trace::SpanKind span_kind, const opentelemetry::common::KeyValueIterable &attributes, - const opentelemetry::trace::SpanContextKeyValueIterable &links) noexcept = 0; + const opentelemetry::trace::SpanContextKeyValueIterable &links) = 0; /** * Short description with configuration, for debug pages and logs. */ - virtual nostd::string_view GetDescription() const noexcept = 0; + virtual nostd::string_view GetDescription() const = 0; }; } // namespace trace diff --git a/sdk/include/opentelemetry/sdk/trace/samplers/parent.h b/sdk/include/opentelemetry/sdk/trace/samplers/parent.h index 5917273df6..07b5d766e5 100644 --- a/sdk/include/opentelemetry/sdk/trace/samplers/parent.h +++ b/sdk/include/opentelemetry/sdk/trace/samplers/parent.h @@ -48,7 +48,7 @@ class ParentBasedSampler : public Sampler const std::shared_ptr &local_parent_sampled_sampler = std::make_shared(), const std::shared_ptr &local_parent_nonsampled_sampler = - std::make_shared()) noexcept; + std::make_shared()); /** Implements the decision logic by checking the parent context and delegating to the appropriate * configured sampler @@ -60,12 +60,12 @@ class ParentBasedSampler : public Sampler nostd::string_view name, opentelemetry::trace::SpanKind span_kind, const opentelemetry::common::KeyValueIterable &attributes, - const opentelemetry::trace::SpanContextKeyValueIterable &links) noexcept override; + const opentelemetry::trace::SpanContextKeyValueIterable &links) override; /** * @return Description MUST be ParentBased{delegate_sampler_.getDescription()} */ - nostd::string_view GetDescription() const noexcept override; + nostd::string_view GetDescription() const override; private: const std::shared_ptr root_sampler_; diff --git a/sdk/include/opentelemetry/sdk/trace/samplers/predicate.h b/sdk/include/opentelemetry/sdk/trace/samplers/predicate.h index a81e30e6b9..f5a8814c89 100644 --- a/sdk/include/opentelemetry/sdk/trace/samplers/predicate.h +++ b/sdk/include/opentelemetry/sdk/trace/samplers/predicate.h @@ -36,9 +36,9 @@ class Predicate nostd::string_view name, opentelemetry::trace::SpanKind span_kind, const opentelemetry::common::KeyValueIterable &attributes, - const opentelemetry::trace::SpanContextKeyValueIterable &links) const noexcept = 0; + const opentelemetry::trace::SpanContextKeyValueIterable &links) const = 0; - virtual nostd::string_view GetDescription() const noexcept = 0; + virtual nostd::string_view GetDescription() const = 0; }; } // namespace trace diff --git a/sdk/include/opentelemetry/sdk/trace/samplers/rule_based_predicate.h b/sdk/include/opentelemetry/sdk/trace/samplers/rule_based_predicate.h index abe9747ef4..52792c2a94 100644 --- a/sdk/include/opentelemetry/sdk/trace/samplers/rule_based_predicate.h +++ b/sdk/include/opentelemetry/sdk/trace/samplers/rule_based_predicate.h @@ -60,18 +60,17 @@ class RuleBasedPredicate : public Predicate public: explicit RuleBasedPredicate(RuleBasedPredicateOptions options); - bool SpanMatches( - const opentelemetry::trace::SpanContext &parent_context, - nostd::string_view name, - opentelemetry::trace::SpanKind span_kind, - const opentelemetry::common::KeyValueIterable &attributes, - const opentelemetry::trace::SpanContextKeyValueIterable &links) const noexcept override; + bool SpanMatches(const opentelemetry::trace::SpanContext &parent_context, + nostd::string_view name, + opentelemetry::trace::SpanKind span_kind, + const opentelemetry::common::KeyValueIterable &attributes, + const opentelemetry::trace::SpanContextKeyValueIterable &links) const override; - nostd::string_view GetDescription() const noexcept override; + nostd::string_view GetDescription() const override; private: - bool ParentMatches(const opentelemetry::trace::SpanContext &parent_context) const noexcept; - bool SpanKindMatches(opentelemetry::trace::SpanKind span_kind) const noexcept; + bool ParentMatches(const opentelemetry::trace::SpanContext &parent_context) const; + bool SpanKindMatches(opentelemetry::trace::SpanKind span_kind) const; RuleBasedPredicateOptions options_; }; diff --git a/sdk/include/opentelemetry/sdk/trace/simple_processor.h b/sdk/include/opentelemetry/sdk/trace/simple_processor.h index 3cc2b1639a..a41b4dcedb 100644 --- a/sdk/include/opentelemetry/sdk/trace/simple_processor.h +++ b/sdk/include/opentelemetry/sdk/trace/simple_processor.h @@ -38,7 +38,7 @@ class SimpleSpanProcessor : public SpanProcessor * Initialize a simple span processor. * @param exporter the exporter used by the span processor */ - explicit SimpleSpanProcessor(std::unique_ptr &&exporter) noexcept + explicit SimpleSpanProcessor(std::unique_ptr &&exporter) : exporter_(std::move(exporter)) {} @@ -88,8 +88,7 @@ class SimpleSpanProcessor : public SpanProcessor ~SimpleSpanProcessor() override { InternalShutdown(); } protected: - bool InternalShutdown( - std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept + bool InternalShutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) { // We only call shutdown ONCE. if (exporter_ != nullptr && !shutdown_latch_.test_and_set(std::memory_order_acquire)) diff --git a/sdk/include/opentelemetry/sdk/trace/span_data.h b/sdk/include/opentelemetry/sdk/trace/span_data.h index 2c85ffa166..4f330befaa 100644 --- a/sdk/include/opentelemetry/sdk/trace/span_data.h +++ b/sdk/include/opentelemetry/sdk/trace/span_data.h @@ -51,26 +51,26 @@ class SpanDataEvent * Get the name for this event * @return the name for this event */ - std::string GetName() const noexcept { return name_; } + std::string GetName() const { return name_; } /** * Get the timestamp for this event * @return the timestamp for this event */ - opentelemetry::common::SystemTimestamp GetTimestamp() const noexcept { return timestamp_; } + opentelemetry::common::SystemTimestamp GetTimestamp() const { return timestamp_; } /** * Get the attributes for this event * @return the attributes for this event */ const std::unordered_map & - GetAttributes() const noexcept; + GetAttributes() const; /** * Get the number of attributes dropped due to the per-event attribute count limit. * @return the number of attributes dropped */ - std::uint32_t GetDroppedAttributesCount() const noexcept { return dropped_attributes_count_; } + std::uint32_t GetDroppedAttributesCount() const { return dropped_attributes_count_; } private: std::string name_; @@ -96,20 +96,20 @@ class SpanDataLink * @return the attributes for this link */ const std::unordered_map & - GetAttributes() const noexcept; + GetAttributes() const; /** * Get the span context for this link * @return the span context for this link */ - const opentelemetry::trace::SpanContext &GetSpanContext() const noexcept { return span_context_; } + const opentelemetry::trace::SpanContext &GetSpanContext() const { return span_context_; } /** * Get the number of attributes dropped due to the per-link * attribute count limit. * @return the number of attributes dropped */ - std::uint32_t GetDroppedAttributesCount() const noexcept { return dropped_attributes_count_; } + std::uint32_t GetDroppedAttributesCount() const { return dropped_attributes_count_; } private: opentelemetry::trace::SpanContext span_context_; @@ -128,70 +128,70 @@ class SpanData final : public Recordable * Get the trace id for this span * @return the trace id for this span */ - opentelemetry::trace::TraceId GetTraceId() const noexcept { return span_context_.trace_id(); } + opentelemetry::trace::TraceId GetTraceId() const { return span_context_.trace_id(); } /** * Get the span id for this span * @return the span id for this span */ - opentelemetry::trace::SpanId GetSpanId() const noexcept { return span_context_.span_id(); } + opentelemetry::trace::SpanId GetSpanId() const { return span_context_.span_id(); } /** * Get the span context for this span * @return the span context for this span */ - const opentelemetry::trace::SpanContext &GetSpanContext() const noexcept { return span_context_; } + const opentelemetry::trace::SpanContext &GetSpanContext() const { return span_context_; } /** * Get the parent span id for this span * @return the span id for this span's parent */ - opentelemetry::trace::SpanId GetParentSpanId() const noexcept { return parent_span_id_; } + opentelemetry::trace::SpanId GetParentSpanId() const { return parent_span_id_; } /** * Get the name for this span * @return the name for this span */ - opentelemetry::nostd::string_view GetName() const noexcept { return name_; } + opentelemetry::nostd::string_view GetName() const { return name_; } /** * Get the trace flags for this span * @return the trace flags for this span */ - opentelemetry::trace::TraceFlags GetFlags() const noexcept { return flags_; } + opentelemetry::trace::TraceFlags GetFlags() const { return flags_; } /** * Get the kind of this span * @return the kind of this span */ - opentelemetry::trace::SpanKind GetSpanKind() const noexcept { return span_kind_; } + opentelemetry::trace::SpanKind GetSpanKind() const { return span_kind_; } /** * Get the status for this span * @return the status for this span */ - opentelemetry::trace::StatusCode GetStatus() const noexcept { return status_code_; } + opentelemetry::trace::StatusCode GetStatus() const { return status_code_; } /** * Get the status description for this span * @return the description of the status of this span */ - opentelemetry::nostd::string_view GetDescription() const noexcept { return status_desc_; } + opentelemetry::nostd::string_view GetDescription() const { return status_desc_; } /** * Get the attributes associated with the resource * @returns the attributes associated with the resource configured for TracerProvider */ - const opentelemetry::sdk::resource::Resource &GetResource() const noexcept; + const opentelemetry::sdk::resource::Resource &GetResource() const; /** * Get the attributes associated with the resource * @returns the attributes associated with the resource configured for TracerProvider */ - const opentelemetry::sdk::trace::InstrumentationScope &GetInstrumentationScope() const noexcept; + const opentelemetry::sdk::trace::InstrumentationScope &GetInstrumentationScope() const; OPENTELEMETRY_DEPRECATED_MESSAGE("Please use GetInstrumentationScope instead") - const opentelemetry::sdk::trace::InstrumentationScope &GetInstrumentationLibrary() const noexcept + const opentelemetry::sdk::trace::InstrumentationScope &GetInstrumentationLibrary() const { return GetInstrumentationScope(); } @@ -200,32 +200,32 @@ class SpanData final : public Recordable * Get the start time for this span * @return the start time for this span */ - opentelemetry::common::SystemTimestamp GetStartTime() const noexcept { return start_time_; } + opentelemetry::common::SystemTimestamp GetStartTime() const { return start_time_; } /** * Get the duration for this span * @return the duration for this span */ - std::chrono::nanoseconds GetDuration() const noexcept { return duration_; } + std::chrono::nanoseconds GetDuration() const { return duration_; } /** * Get the attributes for this span * @return the attributes for this span */ const std::unordered_map & - GetAttributes() const noexcept; + GetAttributes() const; /** * Get the events associated with this span * @return the events associated with this span */ - const std::vector &GetEvents() const noexcept { return events_; } + const std::vector &GetEvents() const { return events_; } /** * Get the links associated with this span * @return the links associated with this span */ - const std::vector &GetLinks() const noexcept { return links_; } + const std::vector &GetLinks() const { return links_; } void SetIdentity(const opentelemetry::trace::SpanContext &span_context, opentelemetry::trace::SpanId parent_span_id) noexcept override; @@ -262,11 +262,11 @@ class SpanData final : public Recordable void SetInstrumentationScope(const InstrumentationScope &instrumentation_scope) noexcept override; - std::uint32_t GetDroppedAttributesCount() const noexcept { return dropped_attributes_count_; } + std::uint32_t GetDroppedAttributesCount() const { return dropped_attributes_count_; } - std::uint32_t GetDroppedEventsCount() const noexcept { return dropped_events_count_; } + std::uint32_t GetDroppedEventsCount() const { return dropped_events_count_; } - std::uint32_t GetDroppedLinksCount() const noexcept { return dropped_links_count_; } + std::uint32_t GetDroppedLinksCount() const { return dropped_links_count_; } private: opentelemetry::trace::SpanContext span_context_{false, false}; diff --git a/sdk/include/opentelemetry/sdk/trace/span_limits.h b/sdk/include/opentelemetry/sdk/trace/span_limits.h index bbadcedc6e..b2a2e92636 100644 --- a/sdk/include/opentelemetry/sdk/trace/span_limits.h +++ b/sdk/include/opentelemetry/sdk/trace/span_limits.h @@ -50,7 +50,7 @@ struct SpanLimits /** * Limit values that impose no cap on any field */ - static constexpr SpanLimits NoLimits() noexcept + static constexpr SpanLimits NoLimits() { SpanLimits limits; limits.attribute_count_limit = (std::numeric_limits::max)(); diff --git a/sdk/include/opentelemetry/sdk/trace/span_status.h b/sdk/include/opentelemetry/sdk/trace/span_status.h index 3c1c975722..bd5f2580ad 100644 --- a/sdk/include/opentelemetry/sdk/trace/span_status.h +++ b/sdk/include/opentelemetry/sdk/trace/span_status.h @@ -39,7 +39,7 @@ struct StatusTransition */ inline StatusTransition ApplyStatusTransition(opentelemetry::trace::StatusCode current, opentelemetry::trace::StatusCode code, - nostd::string_view description) noexcept + nostd::string_view description) { const auto is_already_ok{current == opentelemetry::trace::StatusCode::kOk}; const auto is_unset{code == opentelemetry::trace::StatusCode::kUnset}; diff --git a/sdk/include/opentelemetry/sdk/trace/tracer.h b/sdk/include/opentelemetry/sdk/trace/tracer.h index 5641c6bfe1..838f706a45 100644 --- a/sdk/include/opentelemetry/sdk/trace/tracer.h +++ b/sdk/include/opentelemetry/sdk/trace/tracer.h @@ -54,26 +54,26 @@ class Tracer final : public opentelemetry::trace::Tracer, * @param timeout to complete the flush */ template - void ForceFlush(std::chrono::duration timeout) noexcept + void ForceFlush(std::chrono::duration timeout) { this->ForceFlushWithMicroseconds(static_cast( std::chrono::duration_cast(timeout).count())); } - void ForceFlushWithMicroseconds(uint64_t timeout) noexcept; + void ForceFlushWithMicroseconds(uint64_t timeout); /** * ForceFlush any buffered spans and stop reporting spans. * @param timeout to complete the flush */ template - void Close(std::chrono::duration timeout) noexcept + void Close(std::chrono::duration timeout) { this->CloseWithMicroseconds(static_cast( std::chrono::duration_cast(timeout).count())); } - void CloseWithMicroseconds(uint64_t timeout) noexcept; + void CloseWithMicroseconds(uint64_t timeout); #else /* Exposed in the API in ABI version 1, but does not belong to the API */ void ForceFlushWithMicroseconds(uint64_t timeout) noexcept override; @@ -82,22 +82,19 @@ class Tracer final : public opentelemetry::trace::Tracer, #endif /** Returns the configured span processor. */ - SpanProcessor &GetProcessor() noexcept { return context_->GetProcessor(); } + SpanProcessor &GetProcessor() { return context_->GetProcessor(); } /** Returns the configured span limits. */ - const SpanLimits &GetSpanLimits() const noexcept { return context_->GetSpanLimits(); } + const SpanLimits &GetSpanLimits() const { return context_->GetSpanLimits(); } /** Returns the configured Id generator */ - IdGenerator &GetIdGenerator() const noexcept { return context_->GetIdGenerator(); } + IdGenerator &GetIdGenerator() const { return context_->GetIdGenerator(); } /** Returns the associated instrumentation scope */ - const InstrumentationScope &GetInstrumentationScope() const noexcept - { - return *instrumentation_scope_; - } + const InstrumentationScope &GetInstrumentationScope() const { return *instrumentation_scope_; } OPENTELEMETRY_DEPRECATED_MESSAGE("Please use GetInstrumentationScope instead") - const InstrumentationScope &GetInstrumentationLibrary() const noexcept + const InstrumentationScope &GetInstrumentationLibrary() const { return GetInstrumentationScope(); } @@ -110,14 +107,11 @@ class Tracer final : public opentelemetry::trace::Tracer, #if OPENTELEMETRY_ABI_VERSION_NO < 2 /** Returns whether the tracer is enabled. ABIv1 only.*/ - bool Enabled() const noexcept { return is_enabled_.load(std::memory_order_relaxed); } + bool Enabled() const { return is_enabled_.load(std::memory_order_relaxed); } protected: /** Updates the enabled state of the tracer. ABIv1 only. */ - void UpdateEnabled(const bool enabled) noexcept - { - is_enabled_.store(enabled, std::memory_order_relaxed); - } + void UpdateEnabled(const bool enabled) { is_enabled_.store(enabled, std::memory_order_relaxed); } #endif private: @@ -130,7 +124,7 @@ class Tracer final : public opentelemetry::trace::Tracer, * TracerProvider::UpdateTracerConfigurator when the provider-level * TracerConfigurator is replaced at runtime. */ - void UpdateTracerConfig(TracerConfig config) noexcept; + void UpdateTracerConfig(TracerConfig config); // order of declaration is important here - instrumentation scope should destroy after // tracer-context. diff --git a/sdk/include/opentelemetry/sdk/trace/tracer_config.h b/sdk/include/opentelemetry/sdk/trace/tracer_config.h index 9f67687dc8..aa0c42ba55 100644 --- a/sdk/include/opentelemetry/sdk/trace/tracer_config.h +++ b/sdk/include/opentelemetry/sdk/trace/tracer_config.h @@ -19,13 +19,13 @@ namespace trace class OPENTELEMETRY_EXPORT TracerConfig { public: - bool operator==(const TracerConfig &other) const noexcept; + bool operator==(const TracerConfig &other) const; /** * Returns if the Tracer is enabled or disabled. Tracers are enabled by default. * @return a boolean indicating if the Tracer is enabled. Defaults to true. */ - bool IsEnabled() const noexcept; + bool IsEnabled() const; /** * Returns a TracerConfig that represents a disabled Tracer. A disabled tracer behaves like a diff --git a/sdk/include/opentelemetry/sdk/trace/tracer_context.h b/sdk/include/opentelemetry/sdk/trace/tracer_context.h index 3631f1ace3..cb2a1749cd 100644 --- a/sdk/include/opentelemetry/sdk/trace/tracer_context.h +++ b/sdk/include/opentelemetry/sdk/trace/tracer_context.h @@ -69,13 +69,13 @@ class TracerContext * * Note: This method is not thread safe. */ - void AddProcessor(std::unique_ptr processor) noexcept; + void AddProcessor(std::unique_ptr processor); /** * Obtain the sampler associated with this tracer. * @return The sampler for this tracer. */ - Sampler &GetSampler() const noexcept; + Sampler &GetSampler() const; /** * Obtain the configured (composite) processor. @@ -83,32 +83,31 @@ class TracerContext * Note: When more than one processor is active, this will * return an "aggregate" processor */ - SpanProcessor &GetProcessor() const noexcept; + SpanProcessor &GetProcessor() const; /** * Obtain the resource associated with this tracer context. * @return The resource for this tracer context. */ - const opentelemetry::sdk::resource::Resource &GetResource() const noexcept; + const opentelemetry::sdk::resource::Resource &GetResource() const; /** * Obtain the ScopeConfigurator with this tracer context. * @return The ScopeConfigurator for this tracer context. */ - const instrumentationscope::ScopeConfigurator &GetTracerConfigurator() - const noexcept; + const instrumentationscope::ScopeConfigurator &GetTracerConfigurator() const; /** * Obtain the Id Generator associated with this tracer context. * @return The ID Generator for this tracer context. */ - opentelemetry::sdk::trace::IdGenerator &GetIdGenerator() const noexcept; + opentelemetry::sdk::trace::IdGenerator &GetIdGenerator() const; /** * Obtain the SpanLimits associated with this tracer context. * @return The SpanLimits for this tracer context. */ - const SpanLimits &GetSpanLimits() const noexcept; + const SpanLimits &GetSpanLimits() const; /** * Replace the TracerConfigurator for this context. @@ -116,19 +115,19 @@ class TracerContext * Note: This method is not thread safe. * @param tracer_configurator The new configurator. */ - void SetTracerConfigurator(std::unique_ptr> - tracer_configurator) noexcept; + void SetTracerConfigurator( + std::unique_ptr> tracer_configurator); /** * Force all active SpanProcessors to flush any buffered spans * within the given timeout. */ - bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); /** * Shutdown the span processor associated with this tracer provider. */ - bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); private: // order of declaration is important here - resource object should be destroyed after processor. diff --git a/sdk/include/opentelemetry/sdk/trace/tracer_provider.h b/sdk/include/opentelemetry/sdk/trace/tracer_provider.h index 2cf00024f8..2cdc76125f 100644 --- a/sdk/include/opentelemetry/sdk/trace/tracer_provider.h +++ b/sdk/include/opentelemetry/sdk/trace/tracer_provider.h @@ -111,7 +111,7 @@ class OPENTELEMETRY_EXPORT TracerProvider final : public opentelemetry::trace::T * Note: This process may not receive any in-flight spans, but will get newly created spans. * Note: This method is not thread safe, and should ideally be called from main thread. */ - void AddProcessor(std::unique_ptr processor) noexcept; + void AddProcessor(std::unique_ptr processor); /** * Update the TracerConfigurator for this provider, recreate and propagate the resulting @@ -125,30 +125,29 @@ class OPENTELEMETRY_EXPORT TracerProvider final : public opentelemetry::trace::T * is not supported and will result in a deadlock. */ void UpdateTracerConfigurator( - std::unique_ptr> - tracer_configurator) noexcept; + std::unique_ptr> tracer_configurator); /** * Obtain the resource associated with this tracer provider. * @return The resource for this tracer provider. */ - const opentelemetry::sdk::resource::Resource &GetResource() const noexcept; + const opentelemetry::sdk::resource::Resource &GetResource() const; /** * Obtain the span limits configured for this tracer provider. * @return The SpanLimits for this tracer provider. */ - const opentelemetry::sdk::trace::SpanLimits &GetSpanLimits() const noexcept; + const opentelemetry::sdk::trace::SpanLimits &GetSpanLimits() const; /** * Shutdown the span processor associated with this tracer provider. */ - bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); /** * Force flush the span processor associated with this tracer provider. */ - bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()); private: // order of declaration is important here - tracers should destroy only after context. diff --git a/sdk/src/common/empty_attributes.cc b/sdk/src/common/empty_attributes.cc index 42a142727b..fd3b8fcf38 100644 --- a/sdk/src/common/empty_attributes.cc +++ b/sdk/src/common/empty_attributes.cc @@ -16,7 +16,7 @@ namespace sdk { const opentelemetry::common::KeyValueIterableView, 0>> & -GetEmptyAttributes() noexcept +GetEmptyAttributes() { static const std::array, 0> array{}; static const opentelemetry::common::KeyValueIterableView< diff --git a/sdk/src/instrumentationscope/instrumentation_scope.cc b/sdk/src/instrumentationscope/instrumentation_scope.cc index ab201eef66..2e8351cebe 100644 --- a/sdk/src/instrumentationscope/instrumentation_scope.cc +++ b/sdk/src/instrumentationscope/instrumentation_scope.cc @@ -34,22 +34,21 @@ nostd::unique_ptr InstrumentationScope::Create( name, version, schema_url, InstrumentationScopeAttributes(attributes)}); } -std::size_t InstrumentationScope::HashCode() const noexcept +std::size_t InstrumentationScope::HashCode() const { return hash_code_; } -bool InstrumentationScope::operator==(const InstrumentationScope &other) const noexcept +bool InstrumentationScope::operator==(const InstrumentationScope &other) const { return this->name_ == other.name_ && this->version_ == other.version_ && this->schema_url_ == other.schema_url_ && this->attributes_ == other.attributes_; } -bool InstrumentationScope::equal( - const nostd::string_view name, - const nostd::string_view version, - const nostd::string_view schema_url, - const opentelemetry::common::KeyValueIterable *attributes) const noexcept +bool InstrumentationScope::equal(const nostd::string_view name, + const nostd::string_view version, + const nostd::string_view schema_url, + const opentelemetry::common::KeyValueIterable *attributes) const { if (this->name_ != name || this->version_ != version || this->schema_url_ != schema_url) @@ -69,25 +68,25 @@ bool InstrumentationScope::equal( return attributes_.EqualTo(*attributes); } -const std::string &InstrumentationScope::GetName() const noexcept +const std::string &InstrumentationScope::GetName() const { return name_; } -const std::string &InstrumentationScope::GetVersion() const noexcept +const std::string &InstrumentationScope::GetVersion() const { return version_; } -const std::string &InstrumentationScope::GetSchemaURL() const noexcept +const std::string &InstrumentationScope::GetSchemaURL() const { return schema_url_; } -const InstrumentationScopeAttributes &InstrumentationScope::GetAttributes() const noexcept +const InstrumentationScopeAttributes &InstrumentationScope::GetAttributes() const { return attributes_; } void InstrumentationScope::SetAttribute(nostd::string_view key, - const opentelemetry::common::AttributeValue &value) noexcept + const opentelemetry::common::AttributeValue &value) { attributes_[std::string(key)] = nostd::visit(opentelemetry::sdk::common::AttributeConverter(), value); diff --git a/sdk/src/logs/batch_log_record_processor.cc b/sdk/src/logs/batch_log_record_processor.cc index f5e01671ba..1be4793a37 100644 --- a/sdk/src/logs/batch_log_record_processor.cc +++ b/sdk/src/logs/batch_log_record_processor.cc @@ -393,7 +393,7 @@ BatchLogRecordProcessor::~BatchLogRecordProcessor() } } -bool BatchLogRecordProcessor::InternalShutdown(std::chrono::microseconds timeout) noexcept +bool BatchLogRecordProcessor::InternalShutdown(std::chrono::microseconds timeout) { auto start_time = std::chrono::system_clock::now(); diff --git a/sdk/src/logs/event_logger.cc b/sdk/src/logs/event_logger.cc index a95624f2cf..9c77d3658d 100644 --- a/sdk/src/logs/event_logger.cc +++ b/sdk/src/logs/event_logger.cc @@ -23,7 +23,7 @@ namespace logs #if OPENTELEMETRY_ABI_VERSION_NO < 2 EventLogger::EventLogger( opentelemetry::nostd::shared_ptr delegate_logger, - opentelemetry::nostd::string_view event_domain) noexcept + opentelemetry::nostd::string_view event_domain) : delegate_logger_(std::move(delegate_logger)), event_domain_(event_domain) {} diff --git a/sdk/src/logs/event_logger_provider.cc b/sdk/src/logs/event_logger_provider.cc index 18f8f6e78b..e0cfd66bdb 100644 --- a/sdk/src/logs/event_logger_provider.cc +++ b/sdk/src/logs/event_logger_provider.cc @@ -18,7 +18,7 @@ namespace sdk namespace logs { #if OPENTELEMETRY_ABI_VERSION_NO < 2 -EventLoggerProvider::EventLoggerProvider() noexcept +EventLoggerProvider::EventLoggerProvider() { OTEL_INTERNAL_LOG_DEBUG("[EventLoggerProvider] EventLoggerProvider created."); } diff --git a/sdk/src/logs/exporter.cc b/sdk/src/logs/exporter.cc index e57363ff25..f468ce940d 100644 --- a/sdk/src/logs/exporter.cc +++ b/sdk/src/logs/exporter.cc @@ -13,8 +13,7 @@ OPENTELEMETRY_EXPORT LogRecordExporter::LogRecordExporter() {} OPENTELEMETRY_EXPORT LogRecordExporter::~LogRecordExporter() {} -OPENTELEMETRY_EXPORT bool LogRecordExporter::ForceFlush( - std::chrono::microseconds /*timeout*/) noexcept +OPENTELEMETRY_EXPORT bool LogRecordExporter::ForceFlush(std::chrono::microseconds /*timeout*/) { return true; } diff --git a/sdk/src/logs/logger.cc b/sdk/src/logs/logger.cc index 2508ab1ef7..91e0e27aa0 100644 --- a/sdk/src/logs/logger.cc +++ b/sdk/src/logs/logger.cc @@ -108,7 +108,7 @@ Logger::Logger(opentelemetry::nostd::string_view name, UpdateLoggerConfig(config); } -void Logger::UpdateLoggerConfig(LoggerConfig config) noexcept +void Logger::UpdateLoggerConfig(LoggerConfig config) { logger_enabled_.store(config.IsEnabled(), std::memory_order_relaxed); trace_based_.store(config.IsTraceBased(), std::memory_order_relaxed); @@ -265,7 +265,7 @@ bool Logger::EnabledImplementation( #endif // OPENTELEMETRY_ABI_VERSION_NO >= 2 const opentelemetry::sdk::instrumentationscope::InstrumentationScope & -Logger::GetInstrumentationScope() const noexcept +Logger::GetInstrumentationScope() const { return *instrumentation_scope_; } diff --git a/sdk/src/logs/logger_config.cc b/sdk/src/logs/logger_config.cc index dd76f09e71..8066149d84 100644 --- a/sdk/src/logs/logger_config.cc +++ b/sdk/src/logs/logger_config.cc @@ -9,31 +9,29 @@ namespace sdk namespace logs { -OPENTELEMETRY_EXPORT bool LoggerConfig::operator==(const LoggerConfig &other) const noexcept +OPENTELEMETRY_EXPORT bool LoggerConfig::operator==(const LoggerConfig &other) const { return enabled_ == other.enabled_ && minimum_severity_ == other.minimum_severity_ && trace_based_ == other.trace_based_; } -OPENTELEMETRY_EXPORT bool LoggerConfig::IsEnabled() const noexcept +OPENTELEMETRY_EXPORT bool LoggerConfig::IsEnabled() const { return enabled_; } -OPENTELEMETRY_EXPORT opentelemetry::logs::Severity LoggerConfig::GetMinimumSeverity() const noexcept +OPENTELEMETRY_EXPORT opentelemetry::logs::Severity LoggerConfig::GetMinimumSeverity() const { return minimum_severity_; } -OPENTELEMETRY_EXPORT bool LoggerConfig::IsTraceBased() const noexcept +OPENTELEMETRY_EXPORT bool LoggerConfig::IsTraceBased() const { return trace_based_; } OPENTELEMETRY_EXPORT LoggerConfig -LoggerConfig::Create(bool enabled, - opentelemetry::logs::Severity minimum_severity, - bool trace_based) noexcept +LoggerConfig::Create(bool enabled, opentelemetry::logs::Severity minimum_severity, bool trace_based) { return LoggerConfig(enabled, minimum_severity, trace_based); } diff --git a/sdk/src/logs/logger_context.cc b/sdk/src/logs/logger_context.cc index d637c8217e..c72d97879d 100644 --- a/sdk/src/logs/logger_context.cc +++ b/sdk/src/logs/logger_context.cc @@ -36,42 +36,41 @@ LoggerContext::LoggerContext( recordable_enforces_limits_(processor_->RecordableEnforcesLogRecordLimits()) {} -void LoggerContext::AddProcessor(std::unique_ptr processor) noexcept +void LoggerContext::AddProcessor(std::unique_ptr processor) { auto multi_processor = static_cast(processor_.get()); multi_processor->AddProcessor(std::move(processor)); recordable_enforces_limits_ = processor_->RecordableEnforcesLogRecordLimits(); } -LogRecordProcessor &LoggerContext::GetProcessor() const noexcept +LogRecordProcessor &LoggerContext::GetProcessor() const { return *processor_; } -const opentelemetry::sdk::resource::Resource &LoggerContext::GetResource() const noexcept +const opentelemetry::sdk::resource::Resource &LoggerContext::GetResource() const { return resource_; } const instrumentationscope::ScopeConfigurator &LoggerContext::GetLoggerConfigurator() - const noexcept + const { return *logger_configurator_; } -const LogRecordLimits &LoggerContext::GetLogRecordLimits() const noexcept +const LogRecordLimits &LoggerContext::GetLogRecordLimits() const { return log_record_limits_; } -bool LoggerContext::RecordableEnforcesLogRecordLimits() const noexcept +bool LoggerContext::RecordableEnforcesLogRecordLimits() const { return recordable_enforces_limits_; } void LoggerContext::SetLoggerConfigurator( - std::unique_ptr> - logger_configurator) noexcept + std::unique_ptr> logger_configurator) { if (!logger_configurator) { @@ -82,12 +81,12 @@ void LoggerContext::SetLoggerConfigurator( logger_configurator_ = std::move(logger_configurator); } -bool LoggerContext::ForceFlush(std::chrono::microseconds timeout) noexcept +bool LoggerContext::ForceFlush(std::chrono::microseconds timeout) { return processor_->ForceFlush(timeout); } -bool LoggerContext::Shutdown(std::chrono::microseconds timeout) noexcept +bool LoggerContext::Shutdown(std::chrono::microseconds timeout) { return processor_->Shutdown(timeout); } diff --git a/sdk/src/logs/logger_provider.cc b/sdk/src/logs/logger_provider.cc index e9afa9b8a2..5361c83e71 100644 --- a/sdk/src/logs/logger_provider.cc +++ b/sdk/src/logs/logger_provider.cc @@ -170,14 +170,13 @@ opentelemetry::nostd::shared_ptr LoggerProvider::Ge #endif } -void LoggerProvider::AddProcessor(std::unique_ptr processor) noexcept +void LoggerProvider::AddProcessor(std::unique_ptr processor) { context_->AddProcessor(std::move(processor)); } void LoggerProvider::UpdateLoggerConfigurator( - std::unique_ptr> - logger_configurator) noexcept + std::unique_ptr> logger_configurator) { if (!logger_configurator) { @@ -205,17 +204,17 @@ void LoggerProvider::UpdateLoggerConfigurator( } } -const opentelemetry::sdk::resource::Resource &LoggerProvider::GetResource() const noexcept +const opentelemetry::sdk::resource::Resource &LoggerProvider::GetResource() const { return context_->GetResource(); } -bool LoggerProvider::Shutdown(std::chrono::microseconds timeout) noexcept +bool LoggerProvider::Shutdown(std::chrono::microseconds timeout) { return context_->Shutdown(timeout); } -bool LoggerProvider::ForceFlush(std::chrono::microseconds timeout) noexcept +bool LoggerProvider::ForceFlush(std::chrono::microseconds timeout) { return context_->ForceFlush(timeout); } diff --git a/sdk/src/logs/multi_log_record_processor.cc b/sdk/src/logs/multi_log_record_processor.cc index 398df9828f..f1fdb57457 100644 --- a/sdk/src/logs/multi_log_record_processor.cc +++ b/sdk/src/logs/multi_log_record_processor.cc @@ -132,7 +132,7 @@ bool MultiLogRecordProcessor::Shutdown(std::chrono::microseconds timeout) noexce return InternalShutdown(timeout); } -bool MultiLogRecordProcessor::InternalForceFlush(std::chrono::microseconds timeout) noexcept +bool MultiLogRecordProcessor::InternalForceFlush(std::chrono::microseconds timeout) { bool result = true; auto start_time = std::chrono::system_clock::now(); @@ -167,7 +167,7 @@ bool MultiLogRecordProcessor::InternalForceFlush(std::chrono::microseconds timeo return result; } -bool MultiLogRecordProcessor::InternalShutdown(std::chrono::microseconds timeout) noexcept +bool MultiLogRecordProcessor::InternalShutdown(std::chrono::microseconds timeout) { bool result = true; bool has_unlimited_timeout = timeout == (std::chrono::microseconds::max)(); diff --git a/sdk/src/logs/multi_recordable.cc b/sdk/src/logs/multi_recordable.cc index 04da5553c2..c4ca144061 100644 --- a/sdk/src/logs/multi_recordable.cc +++ b/sdk/src/logs/multi_recordable.cc @@ -21,20 +21,19 @@ namespace sdk namespace logs { -std::size_t MultiRecordable::MakeKey( - const opentelemetry::sdk::logs::LogRecordProcessor &processor) noexcept +std::size_t MultiRecordable::MakeKey(const opentelemetry::sdk::logs::LogRecordProcessor &processor) { return reinterpret_cast(&processor); } void MultiRecordable::AddRecordable(const LogRecordProcessor &processor, - std::unique_ptr recordable) noexcept + std::unique_ptr recordable) { recordables_[MakeKey(processor)] = std::move(recordable); } const std::unique_ptr &MultiRecordable::GetRecordable( - const LogRecordProcessor &processor) const noexcept + const LogRecordProcessor &processor) const { // TODO - return nullptr ref on failed lookup? auto i = recordables_.find(MakeKey(processor)); @@ -46,8 +45,7 @@ const std::unique_ptr &MultiRecordable::GetRecordable( return empty; } -std::unique_ptr MultiRecordable::ReleaseRecordable( - const LogRecordProcessor &processor) noexcept +std::unique_ptr MultiRecordable::ReleaseRecordable(const LogRecordProcessor &processor) { auto i = recordables_.find(MakeKey(processor)); if (i != recordables_.end()) diff --git a/sdk/src/logs/provider.cc b/sdk/src/logs/provider.cc index 224bc8c39d..17cb0f8702 100644 --- a/sdk/src/logs/provider.cc +++ b/sdk/src/logs/provider.cc @@ -15,8 +15,7 @@ namespace sdk namespace logs { -void Provider::SetLoggerProvider( - const nostd::shared_ptr &lp) noexcept +void Provider::SetLoggerProvider(const nostd::shared_ptr &lp) { bool disabled = opentelemetry::sdk::common::GetSdkDisabled(); diff --git a/sdk/src/logs/readable_log_record.cc b/sdk/src/logs/readable_log_record.cc index 8d35c1eb2e..fd3eb8fa8b 100644 --- a/sdk/src/logs/readable_log_record.cc +++ b/sdk/src/logs/readable_log_record.cc @@ -19,7 +19,7 @@ namespace sdk namespace logs { -nostd::string_view ReadableLogRecord::GetSeverityText() const noexcept +nostd::string_view ReadableLogRecord::GetSeverityText() const { std::size_t severity_index = static_cast(GetSeverity()); if (severity_index >= std::extent::value) @@ -31,7 +31,7 @@ nostd::string_view ReadableLogRecord::GetSeverityText() const noexcept } const opentelemetry::sdk::instrumentationscope::InstrumentationScope & -ReadableLogRecord::GetDefaultInstrumentationScope() noexcept +ReadableLogRecord::GetDefaultInstrumentationScope() { // FIXME: Use shared default instrumentation scope? static std::unique_ptr @@ -40,7 +40,7 @@ ReadableLogRecord::GetDefaultInstrumentationScope() noexcept return *default_scope; } -const opentelemetry::sdk::resource::Resource &ReadableLogRecord::GetDefaultResource() noexcept +const opentelemetry::sdk::resource::Resource &ReadableLogRecord::GetDefaultResource() { static opentelemetry::sdk::resource::Resource default_resource = opentelemetry::sdk::resource::Resource::Create( diff --git a/sdk/src/logs/simple_log_record_processor.cc b/sdk/src/logs/simple_log_record_processor.cc index 446c8f04ff..c3fbf321ec 100644 --- a/sdk/src/logs/simple_log_record_processor.cc +++ b/sdk/src/logs/simple_log_record_processor.cc @@ -73,7 +73,7 @@ bool SimpleLogRecordProcessor::Shutdown(std::chrono::microseconds timeout) noexc return true; } -bool SimpleLogRecordProcessor::IsShutdown() const noexcept +bool SimpleLogRecordProcessor::IsShutdown() const { return is_shutdown_.load(std::memory_order_acquire); } diff --git a/sdk/src/metrics/aggregation/base2_exponential_histogram_aggregation.cc b/sdk/src/metrics/aggregation/base2_exponential_histogram_aggregation.cc index 5068d52f98..043c8617ef 100644 --- a/sdk/src/metrics/aggregation/base2_exponential_histogram_aggregation.cc +++ b/sdk/src/metrics/aggregation/base2_exponential_histogram_aggregation.cc @@ -32,7 +32,7 @@ namespace metrics namespace { -uint32_t GetScaleReduction(int32_t start_index, int32_t end_index, size_t max_buckets) noexcept +uint32_t GetScaleReduction(int32_t start_index, int32_t end_index, size_t max_buckets) { uint32_t scale_reduction = 0; // Both indices have collapsed to -1 or 0 after 31 shifts, so further iterations cannot narrow @@ -49,7 +49,7 @@ uint32_t GetScaleReduction(int32_t start_index, int32_t end_index, size_t max_bu uint32_t GetScaleReductionForUnion(const AdaptingCircularBufferCounter &low, const AdaptingCircularBufferCounter &high, - size_t max_buckets) noexcept + size_t max_buckets) { if (low.Empty() && high.Empty()) { @@ -67,7 +67,7 @@ uint32_t GetScaleReductionForUnion(const AdaptingCircularBufferCounter &low, void DiffBuckets(const AdaptingCircularBufferCounter &left, const AdaptingCircularBufferCounter &right, - AdaptingCircularBufferCounter &out) noexcept + AdaptingCircularBufferCounter &out) { if (left.Empty() && right.Empty()) { @@ -96,7 +96,7 @@ void DiffBuckets(const AdaptingCircularBufferCounter &left, } } -void DownscaleBuckets(std::unique_ptr &buckets, uint32_t by) noexcept +void DownscaleBuckets(std::unique_ptr &buckets, uint32_t by) { // Downscaling is done in place, which preserves the existing bucket size // optimisation (integer width) and avoids allocating a replacement buffer. @@ -106,7 +106,7 @@ void DownscaleBuckets(std::unique_ptr &buckets, u // Folds `high_res` onto `target_scale`. The bucket shift has to match the scale delta exactly, so // the runtime floor is deliberately not applied here: it bounds the reductions the SDK chooses, // not the alignment of an operand that already sits lower. -void AlignToScale(Base2ExponentialHistogramPointData &high_res, int32_t target_scale) noexcept +void AlignToScale(Base2ExponentialHistogramPointData &high_res, int32_t target_scale) { if (high_res.scale_ <= target_scale) { @@ -132,15 +132,14 @@ void AlignToScale(Base2ExponentialHistogramPointData &high_res, int32_t target_s // Guards point data that arrives through the public constructors with a smaller budget than the // configuration validator would ever produce. A configured max_size is at least kMaxSizeMin, so // this never allocates more buckets than the user asked for. -size_t BucketCapacity(size_t max_buckets) noexcept +size_t BucketCapacity(size_t max_buckets) { return (std::max)(max_buckets, kMaxSizeMin); } // Point data handed to the public constructors carries buffers the caller sized, which can be // narrower than the capacity this class guarantees; move the counts into a wide enough buffer. -void EnsureBucketCapacity(std::unique_ptr &buckets, - size_t capacity) noexcept +void EnsureBucketCapacity(std::unique_ptr &buckets, size_t capacity) { if (!buckets) { @@ -173,13 +172,13 @@ void EnsureBucketCapacity(std::unique_ptr &bucket bool BucketIndicesMatchScale(const AdaptingCircularBufferCounter *buckets, int32_t min_index, - int32_t max_index) noexcept + int32_t max_index) { return buckets == nullptr || buckets->Empty() || (buckets->StartIndex() >= min_index && buckets->EndIndex() <= max_index); } -void NormalizeSuppliedPointData(Base2ExponentialHistogramPointData &point_data) noexcept +void NormalizeSuppliedPointData(Base2ExponentialHistogramPointData &point_data) { // Index bounds above kMaxScaleMax overflow int32_t; folding keeps every supplied count. AlignToScale(point_data, kMaxScaleMax); @@ -211,7 +210,7 @@ void NormalizeSuppliedPointData(Base2ExponentialHistogramPointData &point_data) // Truncates `requested` to the reduction that can be applied without pushing `current_scale` below // kMinRuntimeScale. Returns 0 once the floor is reached. -uint32_t ClampScaleReduction(int32_t current_scale, uint32_t requested) noexcept +uint32_t ClampScaleReduction(int32_t current_scale, uint32_t requested) { const int64_t headroom = static_cast(current_scale) - kMinRuntimeScale; if (headroom <= 0) @@ -223,7 +222,7 @@ uint32_t ClampScaleReduction(int32_t current_scale, uint32_t requested) noexcept // Single entry point for scale reduction: clamps to the runtime floor, folds both bucket arrays by // the clamped amount and moves scale_ by exactly that amount. Returns the reduction applied. -uint32_t ApplyDownscale(Base2ExponentialHistogramPointData &point_data, uint32_t requested) noexcept +uint32_t ApplyDownscale(Base2ExponentialHistogramPointData &point_data, uint32_t requested) { const uint32_t applied = ClampScaleReduction(point_data.scale_, requested); if (applied == 0) @@ -330,16 +329,14 @@ Base2ExponentialHistogramAggregation::Base2ExponentialHistogramAggregation( indexer_ = Base2ExponentialHistogramIndexer(point_data_.scale_); } -void Base2ExponentialHistogramAggregation::Aggregate( - int64_t value, - const PointAttributes & /* attributes */) noexcept +void Base2ExponentialHistogramAggregation::Aggregate(int64_t value, + const PointAttributes & /* attributes */) { Aggregate(static_cast(value)); } -void Base2ExponentialHistogramAggregation::Aggregate( - double value, - const PointAttributes & /* attributes */) noexcept +void Base2ExponentialHistogramAggregation::Aggregate(double value, + const PointAttributes & /* attributes */) { const std::lock_guard locked(lock_); point_data_.sum_ += value; @@ -374,7 +371,7 @@ void Base2ExponentialHistogramAggregation::Aggregate( void Base2ExponentialHistogramAggregation::AggregateIntoBuckets( std::unique_ptr &buckets, - double value) noexcept + double value) { if (!buckets) { @@ -412,7 +409,7 @@ void Base2ExponentialHistogramAggregation::AggregateIntoBuckets( } } -uint32_t Base2ExponentialHistogramAggregation::Downscale(uint32_t by) noexcept +uint32_t Base2ExponentialHistogramAggregation::Downscale(uint32_t by) { if (by == 0) { @@ -483,7 +480,7 @@ static AdaptingCircularBufferCounter MergeBuckets(size_t max_buckets, } std::unique_ptr Base2ExponentialHistogramAggregation::Merge( - const Aggregation &delta) const noexcept + const Aggregation &delta) const { auto left = nostd::get(ToPoint()); auto right = nostd::get( @@ -544,7 +541,7 @@ std::unique_ptr Base2ExponentialHistogramAggregation::Merge( } std::unique_ptr Base2ExponentialHistogramAggregation::Diff( - const Aggregation &next) const noexcept + const Aggregation &next) const { auto left = nostd::get(ToPoint()); auto right = nostd::get( @@ -596,7 +593,7 @@ std::unique_ptr Base2ExponentialHistogramAggregation::Diff( new Base2ExponentialHistogramAggregation(std::move(result_value))}; } -PointType Base2ExponentialHistogramAggregation::ToPoint() const noexcept +PointType Base2ExponentialHistogramAggregation::ToPoint() const { const std::lock_guard locked(lock_); diff --git a/sdk/src/metrics/meter.cc b/sdk/src/metrics/meter.cc index f9bf08742d..a260ff5254 100644 --- a/sdk/src/metrics/meter.cc +++ b/sdk/src/metrics/meter.cc @@ -456,8 +456,7 @@ Meter::CreateDoubleObservableUpDownCounter(opentelemetry::nostd::string_view nam new ObservableInstrument(instrument_descriptor, std::move(storage), observable_registry_)}; } -const sdk::instrumentationscope::InstrumentationScope *Meter::GetInstrumentationScope() - const noexcept +const sdk::instrumentationscope::InstrumentationScope *Meter::GetInstrumentationScope() const { return scope_.get(); } @@ -642,7 +641,7 @@ std::unique_ptr Meter::RegisterAsyncMetricStorage( /** collect metrics across all the meters **/ std::vector Meter::Collect(CollectorHandle *collector, - opentelemetry::common::SystemTimestamp collect_ts) noexcept + opentelemetry::common::SystemTimestamp collect_ts) { // A disabled meter still exports what its sync instruments recorded before it was disabled. // Async callbacks are skipped, and so are async storages, which would otherwise re-export diff --git a/sdk/src/metrics/meter_config.cc b/sdk/src/metrics/meter_config.cc index 3def638f57..51d2ca3355 100644 --- a/sdk/src/metrics/meter_config.cc +++ b/sdk/src/metrics/meter_config.cc @@ -8,12 +8,12 @@ namespace sdk namespace metrics { -OPENTELEMETRY_EXPORT bool MeterConfig::operator==(const MeterConfig &other) const noexcept +OPENTELEMETRY_EXPORT bool MeterConfig::operator==(const MeterConfig &other) const { return enabled_ == other.enabled_; } -OPENTELEMETRY_EXPORT bool MeterConfig::IsEnabled() const noexcept +OPENTELEMETRY_EXPORT bool MeterConfig::IsEnabled() const { return enabled_; } diff --git a/sdk/src/metrics/meter_context.cc b/sdk/src/metrics/meter_context.cc index 8af909fa8e..352b5eb519 100644 --- a/sdk/src/metrics/meter_context.cc +++ b/sdk/src/metrics/meter_context.cc @@ -105,18 +105,18 @@ MeterContext::MeterContext( #endif {} -const resource::Resource &MeterContext::GetResource() const noexcept +const resource::Resource &MeterContext::GetResource() const { return resource_; } -ViewRegistry *MeterContext::GetViewRegistry() const noexcept +ViewRegistry *MeterContext::GetViewRegistry() const { return views_.get(); } const instrumentationscope::ScopeConfigurator &MeterContext::GetMeterConfigurator() - const noexcept + const { return *meter_configurator_; } @@ -134,8 +134,7 @@ void MeterContext::SetMeterConfigurator( meter_configurator_ = std::move(meter_configurator); } -bool MeterContext::ForEachMeter( - nostd::function_ref &meter)> callback) noexcept +bool MeterContext::ForEachMeter(nostd::function_ref &meter)> callback) { std::lock_guard guard(meter_lock_); for (auto &meter : meters_) @@ -148,24 +147,24 @@ bool MeterContext::ForEachMeter( return true; } -nostd::span> MeterContext::GetMeters() noexcept +nostd::span> MeterContext::GetMeters() { // no lock required, as this is called by MeterProvider in thread-safe manner. return nostd::span>{meters_.data(), meters_.size()}; } -nostd::span> MeterContext::GetCollectors() noexcept +nostd::span> MeterContext::GetCollectors() { return nostd::span>(collectors_.data(), collectors_.size()); } -opentelemetry::common::SystemTimestamp MeterContext::GetSDKStartTime() noexcept +opentelemetry::common::SystemTimestamp MeterContext::GetSDKStartTime() { return sdk_start_ts_; } void MeterContext::AddMetricReader(std::shared_ptr reader, - std::unique_ptr metric_filter) noexcept + std::unique_ptr metric_filter) { auto collector = std::shared_ptr{ new MetricCollector(this, std::move(reader), std::move(metric_filter))}; @@ -174,19 +173,19 @@ void MeterContext::AddMetricReader(std::shared_ptr reader, void MeterContext::AddView(std::unique_ptr instrument_selector, std::unique_ptr meter_selector, - std::unique_ptr view) noexcept + std::unique_ptr view) { views_->AddView(std::move(instrument_selector), std::move(meter_selector), std::move(view)); } #ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW -void MeterContext::SetExemplarFilter(metrics::ExemplarFilterType exemplar_filter_type) noexcept +void MeterContext::SetExemplarFilter(metrics::ExemplarFilterType exemplar_filter_type) { exemplar_filter_type_ = exemplar_filter_type; } -ExemplarFilterType MeterContext::GetExemplarFilter() const noexcept +ExemplarFilterType MeterContext::GetExemplarFilter() const { return exemplar_filter_type_; } @@ -225,7 +224,7 @@ void MeterContext::RemoveMeter(nostd::string_view name, meters_.swap(filtered_meters); } -bool MeterContext::Shutdown(std::chrono::microseconds timeout) noexcept +bool MeterContext::Shutdown(std::chrono::microseconds timeout) { bool result = true; // Shutdown only once. @@ -248,7 +247,7 @@ bool MeterContext::Shutdown(std::chrono::microseconds timeout) noexcept return result; } -bool MeterContext::ForceFlush(std::chrono::microseconds timeout) noexcept +bool MeterContext::ForceFlush(std::chrono::microseconds timeout) { bool result = true; // Simultaneous flush not allowed. diff --git a/sdk/src/metrics/meter_provider.cc b/sdk/src/metrics/meter_provider.cc index cd81a112c2..35183351e1 100644 --- a/sdk/src/metrics/meter_provider.cc +++ b/sdk/src/metrics/meter_provider.cc @@ -191,20 +191,20 @@ void MeterProvider::RemoveMeter(nostd::string_view name, } #endif -const resource::Resource &MeterProvider::GetResource() const noexcept +const resource::Resource &MeterProvider::GetResource() const { return context_->GetResource(); } void MeterProvider::AddMetricReader(std::shared_ptr reader, - std::unique_ptr metric_filter) noexcept + std::unique_ptr metric_filter) { context_->AddMetricReader(std::move(reader), std::move(metric_filter)); } void MeterProvider::AddView(std::unique_ptr instrument_selector, std::unique_ptr meter_selector, - std::unique_ptr view) noexcept + std::unique_ptr view) { context_->AddView(std::move(instrument_selector), std::move(meter_selector), std::move(view)); } @@ -236,7 +236,7 @@ void MeterProvider::UpdateMeterConfigurator( #ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW -void MeterProvider::SetExemplarFilter(metrics::ExemplarFilterType exemplar_filter_type) noexcept +void MeterProvider::SetExemplarFilter(metrics::ExemplarFilterType exemplar_filter_type) { context_->SetExemplarFilter(exemplar_filter_type); } @@ -246,7 +246,7 @@ void MeterProvider::SetExemplarFilter(metrics::ExemplarFilterType exemplar_filte /** * Shutdown the meter provider. */ -bool MeterProvider::Shutdown(std::chrono::microseconds timeout) noexcept +bool MeterProvider::Shutdown(std::chrono::microseconds timeout) { // Shutdown only once if (shutdown_latch_.test_and_set(std::memory_order_acquire)) @@ -259,7 +259,7 @@ bool MeterProvider::Shutdown(std::chrono::microseconds timeout) noexcept /** * Force flush the meter provider. */ -bool MeterProvider::ForceFlush(std::chrono::microseconds timeout) noexcept +bool MeterProvider::ForceFlush(std::chrono::microseconds timeout) { return context_->ForceFlush(timeout); } diff --git a/sdk/src/metrics/metric_reader.cc b/sdk/src/metrics/metric_reader.cc index b81e781f5b..57058b74ca 100644 --- a/sdk/src/metrics/metric_reader.cc +++ b/sdk/src/metrics/metric_reader.cc @@ -20,8 +20,7 @@ void MetricReader::SetMetricProducer(MetricProducer *metric_producer) OnInitialized(); } -bool MetricReader::Collect( - nostd::function_ref callback) noexcept +bool MetricReader::Collect(nostd::function_ref callback) { if (!metric_producer_) { @@ -42,7 +41,7 @@ bool MetricReader::Collect( return (result.status_ == MetricProducer::Status::kSuccess) && success; } -bool MetricReader::Shutdown(std::chrono::microseconds timeout) noexcept +bool MetricReader::Shutdown(std::chrono::microseconds timeout) { // Serialize so concurrent calls block until the first call's shutdown has completed. std::lock_guard shutdown_guard{shutdown_m_}; @@ -62,7 +61,7 @@ bool MetricReader::Shutdown(std::chrono::microseconds timeout) noexcept } /** Flush metric read by this reader **/ -bool MetricReader::ForceFlush(std::chrono::microseconds timeout) noexcept +bool MetricReader::ForceFlush(std::chrono::microseconds timeout) { if (IsShutdown()) { @@ -80,12 +79,12 @@ bool MetricReader::ForceFlush(std::chrono::microseconds timeout) noexcept return status; } -bool MetricReader::IsShutdown() const noexcept +bool MetricReader::IsShutdown() const { return shutdown_.load(std::memory_order_acquire); } -std::size_t MetricReader::GetCardinalityLimit(InstrumentType instrument_type) const noexcept +std::size_t MetricReader::GetCardinalityLimit(InstrumentType instrument_type) const { switch (instrument_type) { @@ -108,7 +107,7 @@ std::size_t MetricReader::GetCardinalityLimit(InstrumentType instrument_type) co } } -void MetricReader::SetCardinalityLimits(const CardinalityLimits &limits) noexcept +void MetricReader::SetCardinalityLimits(const CardinalityLimits &limits) { cardinality_limits_ = limits; // TODO: Reader-level limits are stored but not yet enforced as a per-collector diff --git a/sdk/src/metrics/provider.cc b/sdk/src/metrics/provider.cc index 798f6f9749..5dbc4f7ae5 100644 --- a/sdk/src/metrics/provider.cc +++ b/sdk/src/metrics/provider.cc @@ -14,8 +14,7 @@ namespace sdk namespace metrics { -void Provider::SetMeterProvider( - const nostd::shared_ptr &mp) noexcept +void Provider::SetMeterProvider(const nostd::shared_ptr &mp) { bool disabled = opentelemetry::sdk::common::GetSdkDisabled(); diff --git a/sdk/src/metrics/state/metric_collector.cc b/sdk/src/metrics/state/metric_collector.cc index 034868075d..60f5ea06b8 100644 --- a/sdk/src/metrics/state/metric_collector.cc +++ b/sdk/src/metrics/state/metric_collector.cc @@ -39,19 +39,18 @@ MetricCollector::MetricCollector(opentelemetry::sdk::metrics::MeterContext *cont metric_reader_->SetMetricProducer(this); } -AggregationTemporality MetricCollector::GetAggregationTemporality( - InstrumentType instrument_type) noexcept +AggregationTemporality MetricCollector::GetAggregationTemporality(InstrumentType instrument_type) { auto aggregation_temporality = metric_reader_->GetAggregationTemporality(instrument_type); return aggregation_temporality; } -std::size_t MetricCollector::GetCardinalityLimit(InstrumentType instrument_type) const noexcept +std::size_t MetricCollector::GetCardinalityLimit(InstrumentType instrument_type) const { return metric_reader_->GetCardinalityLimit(instrument_type); } -MetricProducer::Result MetricCollector::Produce() noexcept +MetricProducer::Result MetricCollector::Produce() { if (!meter_context_) { @@ -60,7 +59,7 @@ MetricProducer::Result MetricCollector::Produce() noexcept return {{}, MetricProducer::Status::kFailure}; } ResourceMetrics resource_metrics; - meter_context_->ForEachMeter([&](const std::shared_ptr &meter) noexcept { + meter_context_->ForEachMeter([&](const std::shared_ptr &meter) { auto collection_ts = std::chrono::system_clock::now(); auto metric_data = meter->Collect(this, collection_ts); if (metric_data.empty()) @@ -125,12 +124,12 @@ MetricProducer::Result MetricCollector::Produce() noexcept return {resource_metrics, MetricProducer::Status::kSuccess}; } -bool MetricCollector::ForceFlush(std::chrono::microseconds timeout) noexcept +bool MetricCollector::ForceFlush(std::chrono::microseconds timeout) { return metric_reader_->ForceFlush(timeout); } -bool MetricCollector::Shutdown(std::chrono::microseconds timeout) noexcept +bool MetricCollector::Shutdown(std::chrono::microseconds timeout) { return metric_reader_->Shutdown(timeout); } diff --git a/sdk/src/metrics/state/sync_metric_storage.cc b/sdk/src/metrics/state/sync_metric_storage.cc index 92d1262e74..bafe07dcce 100644 --- a/sdk/src/metrics/state/sync_metric_storage.cc +++ b/sdk/src/metrics/state/sync_metric_storage.cc @@ -38,7 +38,7 @@ bool SyncMetricStorage::Collect(CollectorHandle *collector, nostd::span> collectors, opentelemetry::common::SystemTimestamp sdk_start_ts, opentelemetry::common::SystemTimestamp collection_ts, - nostd::function_ref callback) noexcept + nostd::function_ref callback) { // Add the current delta metrics to `unreported metrics stash` for all the collectors, // this will also empty the delta metrics hashmap, and make it available for @@ -183,7 +183,7 @@ bool SyncMetricStorage::Collect(CollectorHandle *collector, #ifdef OPENTELEMETRY_HAVE_METRICS_BOUND_INSTRUMENTS_PREVIEW std::shared_ptr SyncMetricStorage::Bind( - const opentelemetry::common::KeyValueIterable &attributes) noexcept + const opentelemetry::common::KeyValueIterable &attributes) { // Filter attributes once, at bind time. MetricAttributes filtered{attributes, attributes_processor_.get()}; @@ -218,7 +218,7 @@ std::shared_ptr SyncMetricStorage::Bind( return entry; } -void SyncMetricStorage::BoundEntry::RecordLong(int64_t value) noexcept +void SyncMetricStorage::BoundEntry::RecordLong(int64_t value) { if (value_type_ != InstrumentValueType::kLong) { @@ -232,7 +232,7 @@ void SyncMetricStorage::BoundEntry::RecordLong(int64_t value) noexcept dirty_ = true; } -void SyncMetricStorage::BoundEntry::RecordDouble(double value) noexcept +void SyncMetricStorage::BoundEntry::RecordDouble(double value) { if (value_type_ != InstrumentValueType::kDouble) { diff --git a/sdk/src/metrics/state/temporal_metric_storage.cc b/sdk/src/metrics/state/temporal_metric_storage.cc index 71af45ab0b..3b2bd04fb4 100644 --- a/sdk/src/metrics/state/temporal_metric_storage.cc +++ b/sdk/src/metrics/state/temporal_metric_storage.cc @@ -43,7 +43,7 @@ bool TemporalMetricStorage::buildMetrics(CollectorHandle *collector, opentelemetry::common::SystemTimestamp sdk_start_ts, opentelemetry::common::SystemTimestamp collection_ts, const std::shared_ptr &delta_metrics, - nostd::function_ref callback) noexcept + nostd::function_ref callback) { std::lock_guard guard(lock_); AggregationTemporality aggregation_temporarily = diff --git a/sdk/src/metrics/view/attributes_processor.cc b/sdk/src/metrics/view/attributes_processor.cc index fa60b0d691..b0a57c0065 100644 --- a/sdk/src/metrics/view/attributes_processor.cc +++ b/sdk/src/metrics/view/attributes_processor.cc @@ -28,7 +28,7 @@ IncludeExcludeAttributesProcessor::IncludeExcludeAttributesProcessor( {} MetricAttributes IncludeExcludeAttributesProcessor::process( - const opentelemetry::common::KeyValueIterable &attributes) const noexcept + const opentelemetry::common::KeyValueIterable &attributes) const { MetricAttributes result; attributes.ForEachKeyValue( @@ -44,14 +44,14 @@ MetricAttributes IncludeExcludeAttributesProcessor::process( return result; } -bool IncludeExcludeAttributesProcessor::isPresent(nostd::string_view key) const noexcept +bool IncludeExcludeAttributesProcessor::isPresent(nostd::string_view key) const { return (include_all_ || MatchesAny(included_patterns_, key)) && !MatchesAny(excluded_patterns_, key); } bool IncludeExcludeAttributesProcessor::MatchesAny(const std::vector &patterns, - nostd::string_view key) noexcept + nostd::string_view key) { for (const auto &pattern : patterns) { diff --git a/sdk/src/metrics/view/predicate.cc b/sdk/src/metrics/view/predicate.cc index 136d60c5bb..54db16a92e 100644 --- a/sdk/src/metrics/view/predicate.cc +++ b/sdk/src/metrics/view/predicate.cc @@ -45,7 +45,7 @@ PatternPredicate::PatternPredicate(opentelemetry::nostd::string_view pattern) PatternPredicate::~PatternPredicate() = default; -bool PatternPredicate::Match(opentelemetry::nostd::string_view str) const noexcept +bool PatternPredicate::Match(opentelemetry::nostd::string_view str) const { #if OPENTELEMETRY_HAVE_WORKING_REGEX return std::regex_match(str.data(), str.data() + str.size(), impl_->reg_key_); @@ -60,7 +60,7 @@ WildcardPredicate::WildcardPredicate(opentelemetry::nostd::string_view pattern) : pattern_{pattern.data(), pattern.size()} {} -bool WildcardPredicate::Match(opentelemetry::nostd::string_view str) const noexcept +bool WildcardPredicate::Match(opentelemetry::nostd::string_view str) const { return opentelemetry::sdk::common::WildcardMatch(pattern_, str); } @@ -69,17 +69,17 @@ ExactPredicate::ExactPredicate(opentelemetry::nostd::string_view pattern) : pattern_{pattern.data(), pattern.size()} {} -bool ExactPredicate::Match(opentelemetry::nostd::string_view str) const noexcept +bool ExactPredicate::Match(opentelemetry::nostd::string_view str) const { return pattern_ == str; } -bool MatchEverythingPattern::Match(opentelemetry::nostd::string_view /* str */) const noexcept +bool MatchEverythingPattern::Match(opentelemetry::nostd::string_view /* str */) const { return true; } -bool MatchNothingPattern::Match(opentelemetry::nostd::string_view /* str */) const noexcept +bool MatchNothingPattern::Match(opentelemetry::nostd::string_view /* str */) const { return false; } diff --git a/sdk/src/resource/resource.cc b/sdk/src/resource/resource.cc index 95b41498f8..789ece05a1 100644 --- a/sdk/src/resource/resource.cc +++ b/sdk/src/resource/resource.cc @@ -20,17 +20,15 @@ namespace sdk namespace resource { -Resource::Resource() noexcept : attributes_(), schema_url_() {} +Resource::Resource() : attributes_(), schema_url_() {} -Resource::Resource(const ResourceAttributes &attributes) noexcept - : attributes_(attributes), schema_url_() -{} +Resource::Resource(const ResourceAttributes &attributes) : attributes_(attributes), schema_url_() {} -Resource::Resource(const ResourceAttributes &attributes, const std::string &schema_url) noexcept +Resource::Resource(const ResourceAttributes &attributes, const std::string &schema_url) : attributes_(attributes), schema_url_(schema_url) {} -Resource Resource::Merge(const Resource &other) const noexcept +Resource Resource::Merge(const Resource &other) const { ResourceAttributes merged_resource_attributes(other.attributes_); merged_resource_attributes.insert(attributes_.begin(), attributes_.end()); @@ -74,12 +72,12 @@ Resource &Resource::GetDefault() return default_resource; } -const ResourceAttributes &Resource::GetAttributes() const noexcept +const ResourceAttributes &Resource::GetAttributes() const { return attributes_; } -const std::string &Resource::GetSchemaURL() const noexcept +const std::string &Resource::GetSchemaURL() const { return schema_url_; } diff --git a/sdk/src/trace/batch_span_processor.cc b/sdk/src/trace/batch_span_processor.cc index a8fb51394d..f9d171f590 100644 --- a/sdk/src/trace/batch_span_processor.cc +++ b/sdk/src/trace/batch_span_processor.cc @@ -71,17 +71,17 @@ BatchSpanProcessor::BatchSpanProcessor(std::unique_ptr &&exporter, worker_thread_ = std::thread(&BatchSpanProcessor::DoBackgroundWork, this); } -std::unique_ptr BatchSpanProcessor::MakeRecordable() noexcept +std::unique_ptr BatchSpanProcessor::MakeRecordable() { return exporter_->MakeRecordable(); } -void BatchSpanProcessor::OnStart(Recordable &, const SpanContext &) noexcept +void BatchSpanProcessor::OnStart(Recordable &, const SpanContext &) { // no-op } -void BatchSpanProcessor::OnEnd(std::unique_ptr &&span) noexcept +void BatchSpanProcessor::OnEnd(std::unique_ptr &&span) { if (synchronization_data_->is_shutdown.load() == true) { @@ -105,7 +105,7 @@ void BatchSpanProcessor::OnEnd(std::unique_ptr &&span) noexcept } } -bool BatchSpanProcessor::ForceFlush(std::chrono::microseconds timeout) noexcept +bool BatchSpanProcessor::ForceFlush(std::chrono::microseconds timeout) { if (synchronization_data_->is_shutdown.load() == true) { @@ -366,7 +366,7 @@ void BatchSpanProcessor::GetWaitAdjustedTime( } } -bool BatchSpanProcessor::Shutdown(std::chrono::microseconds timeout) noexcept +bool BatchSpanProcessor::Shutdown(std::chrono::microseconds timeout) { return InternalShutdown(timeout); } @@ -379,7 +379,7 @@ BatchSpanProcessor::~BatchSpanProcessor() } } -bool BatchSpanProcessor::InternalShutdown(std::chrono::microseconds timeout) noexcept +bool BatchSpanProcessor::InternalShutdown(std::chrono::microseconds timeout) { auto start_time = std::chrono::system_clock::now(); std::lock_guard shutdown_guard{synchronization_data_->shutdown_m}; diff --git a/sdk/src/trace/exporter.cc b/sdk/src/trace/exporter.cc index 5984583ba5..b0ba7c311e 100644 --- a/sdk/src/trace/exporter.cc +++ b/sdk/src/trace/exporter.cc @@ -13,7 +13,7 @@ OPENTELEMETRY_EXPORT SpanExporter::SpanExporter() {} OPENTELEMETRY_EXPORT SpanExporter::~SpanExporter() {} -OPENTELEMETRY_EXPORT bool SpanExporter::ForceFlush(std::chrono::microseconds /*timeout*/) noexcept +OPENTELEMETRY_EXPORT bool SpanExporter::ForceFlush(std::chrono::microseconds /*timeout*/) { return true; } diff --git a/sdk/src/trace/multi_recordable.cc b/sdk/src/trace/multi_recordable.cc index 37959a8e1f..254376ab58 100644 --- a/sdk/src/trace/multi_recordable.cc +++ b/sdk/src/trace/multi_recordable.cc @@ -23,19 +23,19 @@ namespace sdk namespace trace { -std::size_t MultiRecordable::MakeKey(const SpanProcessor &processor) noexcept +std::size_t MultiRecordable::MakeKey(const SpanProcessor &processor) { return reinterpret_cast(&processor); } void MultiRecordable::AddRecordable(const SpanProcessor &processor, - std::unique_ptr recordable) noexcept + std::unique_ptr recordable) { recordables_[MakeKey(processor)] = std::move(recordable); } const std::unique_ptr &MultiRecordable::GetRecordable( - const SpanProcessor &processor) const noexcept + const SpanProcessor &processor) const { // TODO - return nullptr ref on failed lookup? auto i = recordables_.find(MakeKey(processor)); @@ -47,8 +47,7 @@ const std::unique_ptr &MultiRecordable::GetRecordable( return empty; } -std::unique_ptr MultiRecordable::ReleaseRecordable( - const SpanProcessor &processor) noexcept +std::unique_ptr MultiRecordable::ReleaseRecordable(const SpanProcessor &processor) { auto i = recordables_.find(MakeKey(processor)); if (i != recordables_.end()) @@ -61,7 +60,7 @@ std::unique_ptr MultiRecordable::ReleaseRecordable( } void MultiRecordable::SetIdentity(const opentelemetry::trace::SpanContext &span_context, - opentelemetry::trace::SpanId parent_span_id) noexcept + opentelemetry::trace::SpanId parent_span_id) { for (auto &recordable : recordables_) { @@ -69,7 +68,7 @@ void MultiRecordable::SetIdentity(const opentelemetry::trace::SpanContext &span_ } } -void MultiRecordable::SetSpanLimits(const SpanLimits &limits) noexcept +void MultiRecordable::SetSpanLimits(const SpanLimits &limits) { for (auto &recordable : recordables_) { @@ -78,7 +77,7 @@ void MultiRecordable::SetSpanLimits(const SpanLimits &limits) noexcept } void MultiRecordable::SetAttribute(nostd::string_view key, - const opentelemetry::common::AttributeValue &value) noexcept + const opentelemetry::common::AttributeValue &value) { for (auto &recordable : recordables_) { @@ -88,7 +87,7 @@ void MultiRecordable::SetAttribute(nostd::string_view key, void MultiRecordable::AddEvent(nostd::string_view name, opentelemetry::common::SystemTimestamp timestamp, - const opentelemetry::common::KeyValueIterable &attributes) noexcept + const opentelemetry::common::KeyValueIterable &attributes) { for (auto &recordable : recordables_) { @@ -97,7 +96,7 @@ void MultiRecordable::AddEvent(nostd::string_view name, } void MultiRecordable::AddLink(const opentelemetry::trace::SpanContext &span_context, - const opentelemetry::common::KeyValueIterable &attributes) noexcept + const opentelemetry::common::KeyValueIterable &attributes) { for (auto &recordable : recordables_) { @@ -106,7 +105,7 @@ void MultiRecordable::AddLink(const opentelemetry::trace::SpanContext &span_cont } void MultiRecordable::SetStatus(opentelemetry::trace::StatusCode code, - nostd::string_view description) noexcept + nostd::string_view description) { for (auto &recordable : recordables_) { @@ -114,7 +113,7 @@ void MultiRecordable::SetStatus(opentelemetry::trace::StatusCode code, } } -void MultiRecordable::SetName(nostd::string_view name) noexcept +void MultiRecordable::SetName(nostd::string_view name) { for (auto &recordable : recordables_) { @@ -122,7 +121,7 @@ void MultiRecordable::SetName(nostd::string_view name) noexcept } } -void MultiRecordable::SetTraceFlags(opentelemetry::trace::TraceFlags flags) noexcept +void MultiRecordable::SetTraceFlags(opentelemetry::trace::TraceFlags flags) { for (auto &recordable : recordables_) { @@ -130,7 +129,7 @@ void MultiRecordable::SetTraceFlags(opentelemetry::trace::TraceFlags flags) noex } } -void MultiRecordable::SetSpanKind(opentelemetry::trace::SpanKind span_kind) noexcept +void MultiRecordable::SetSpanKind(opentelemetry::trace::SpanKind span_kind) { for (auto &recordable : recordables_) { @@ -138,7 +137,7 @@ void MultiRecordable::SetSpanKind(opentelemetry::trace::SpanKind span_kind) noex } } -void MultiRecordable::SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept +void MultiRecordable::SetResource(const opentelemetry::sdk::resource::Resource &resource) { for (auto &recordable : recordables_) { @@ -146,7 +145,7 @@ void MultiRecordable::SetResource(const opentelemetry::sdk::resource::Resource & } } -void MultiRecordable::SetStartTime(opentelemetry::common::SystemTimestamp start_time) noexcept +void MultiRecordable::SetStartTime(opentelemetry::common::SystemTimestamp start_time) { for (auto &recordable : recordables_) { @@ -154,7 +153,7 @@ void MultiRecordable::SetStartTime(opentelemetry::common::SystemTimestamp start_ } } -void MultiRecordable::SetDuration(std::chrono::nanoseconds duration) noexcept +void MultiRecordable::SetDuration(std::chrono::nanoseconds duration) { for (auto &recordable : recordables_) { @@ -162,8 +161,7 @@ void MultiRecordable::SetDuration(std::chrono::nanoseconds duration) noexcept } } -void MultiRecordable::SetInstrumentationScope( - const InstrumentationScope &instrumentation_scope) noexcept +void MultiRecordable::SetInstrumentationScope(const InstrumentationScope &instrumentation_scope) { for (auto &recordable : recordables_) { diff --git a/sdk/src/trace/provider.cc b/sdk/src/trace/provider.cc index ff27c40961..4269c41668 100644 --- a/sdk/src/trace/provider.cc +++ b/sdk/src/trace/provider.cc @@ -14,8 +14,7 @@ namespace sdk namespace trace { -void Provider::SetTracerProvider( - const nostd::shared_ptr &tp) noexcept +void Provider::SetTracerProvider(const nostd::shared_ptr &tp) { bool disabled = opentelemetry::sdk::common::GetSdkDisabled(); diff --git a/sdk/src/trace/samplers/parent.cc b/sdk/src/trace/samplers/parent.cc index 442d2362cb..8d1b309c1e 100644 --- a/sdk/src/trace/samplers/parent.cc +++ b/sdk/src/trace/samplers/parent.cc @@ -23,7 +23,7 @@ ParentBasedSampler::ParentBasedSampler( const std::shared_ptr &remote_parent_sampled_sampler, const std::shared_ptr &remote_parent_nonsampled_sampler, const std::shared_ptr &local_parent_sampled_sampler, - const std::shared_ptr &local_parent_nonsampled_sampler) noexcept + const std::shared_ptr &local_parent_nonsampled_sampler) : root_sampler_(root_sampler), remote_parent_sampled_sampler_(remote_parent_sampled_sampler), remote_parent_nonsampled_sampler_(remote_parent_nonsampled_sampler), @@ -38,7 +38,7 @@ SamplingResult ParentBasedSampler::ShouldSample( nostd::string_view name, trace_api::SpanKind span_kind, const opentelemetry::common::KeyValueIterable &attributes, - const trace_api::SpanContextKeyValueIterable &links) noexcept + const trace_api::SpanContextKeyValueIterable &links) { if (!parent_context.IsValid()) { @@ -69,7 +69,7 @@ SamplingResult ParentBasedSampler::ShouldSample( attributes, links); } -nostd::string_view ParentBasedSampler::GetDescription() const noexcept +nostd::string_view ParentBasedSampler::GetDescription() const { return description_; } diff --git a/sdk/src/trace/samplers/rule_based_predicate.cc b/sdk/src/trace/samplers/rule_based_predicate.cc index d57be8ef96..952ab306bd 100644 --- a/sdk/src/trace/samplers/rule_based_predicate.cc +++ b/sdk/src/trace/samplers/rule_based_predicate.cc @@ -118,7 +118,7 @@ class ValueMatcher bool AttributeMatches(const opentelemetry::common::KeyValueIterable &attributes, const std::string &key, std::uint32_t double_precision, - function_ref check) noexcept + function_ref check) { bool matched = false; attributes.ForEachKeyValue( @@ -152,7 +152,7 @@ bool RuleBasedPredicate::SpanMatches( nostd::string_view /* name */, opentelemetry::trace::SpanKind span_kind, const opentelemetry::common::KeyValueIterable &attributes, - const opentelemetry::trace::SpanContextKeyValueIterable & /* links */) const noexcept + const opentelemetry::trace::SpanContextKeyValueIterable & /* links */) const { if (!ParentMatches(parent_context)) { @@ -200,13 +200,13 @@ bool RuleBasedPredicate::SpanMatches( return true; } -nostd::string_view RuleBasedPredicate::GetDescription() const noexcept +nostd::string_view RuleBasedPredicate::GetDescription() const { return "RuleBasedPredicate"; } bool RuleBasedPredicate::ParentMatches( - const opentelemetry::trace::SpanContext &parent_context) const noexcept + const opentelemetry::trace::SpanContext &parent_context) const { if (!(options_.match_parent_none || options_.match_parent_remote || options_.match_parent_local)) { @@ -219,7 +219,7 @@ bool RuleBasedPredicate::ParentMatches( return parent_context.IsRemote() ? options_.match_parent_remote : options_.match_parent_local; } -bool RuleBasedPredicate::SpanKindMatches(opentelemetry::trace::SpanKind span_kind) const noexcept +bool RuleBasedPredicate::SpanKindMatches(opentelemetry::trace::SpanKind span_kind) const { if (!(options_.match_span_kind_internal || options_.match_span_kind_server || options_.match_span_kind_client || options_.match_span_kind_producer || diff --git a/sdk/src/trace/span_data.cc b/sdk/src/trace/span_data.cc index e4d42fae4f..3ea232e292 100644 --- a/sdk/src/trace/span_data.cc +++ b/sdk/src/trace/span_data.cc @@ -40,7 +40,7 @@ bool SetAttributeImpl(opentelemetry::sdk::common::AttributeMap &attribute_map, nostd::string_view key, const opentelemetry::common::AttributeValue &value, std::uint32_t attribute_count_limit, - std::size_t attribute_value_length_limit) noexcept + std::size_t attribute_value_length_limit) { if (attribute_map.size() >= attribute_count_limit) { @@ -103,7 +103,7 @@ SpanDataEvent::SpanDataEvent(std::string name, } const std::unordered_map & -SpanDataEvent::GetAttributes() const noexcept +SpanDataEvent::GetAttributes() const { return attribute_map_.GetAttributes(); } @@ -119,12 +119,12 @@ SpanDataLink::SpanDataLink(opentelemetry::trace::SpanContext span_context, } const std::unordered_map & -SpanDataLink::GetAttributes() const noexcept +SpanDataLink::GetAttributes() const { return attribute_map_.GetAttributes(); } -const opentelemetry::sdk::resource::Resource &SpanData::GetResource() const noexcept +const opentelemetry::sdk::resource::Resource &SpanData::GetResource() const { if (resource_ == nullptr) { @@ -136,8 +136,7 @@ const opentelemetry::sdk::resource::Resource &SpanData::GetResource() const noex return *resource_; } -const opentelemetry::sdk::trace::InstrumentationScope &SpanData::GetInstrumentationScope() - const noexcept +const opentelemetry::sdk::trace::InstrumentationScope &SpanData::GetInstrumentationScope() const { if (instrumentation_scope_ == nullptr) { @@ -152,7 +151,7 @@ const opentelemetry::sdk::trace::InstrumentationScope &SpanData::GetInstrumentat } const std::unordered_map & -SpanData::GetAttributes() const noexcept +SpanData::GetAttributes() const { return attribute_map_.GetAttributes(); } diff --git a/sdk/src/trace/tracer.cc b/sdk/src/trace/tracer.cc index ffa329dfb0..42c92a3d87 100644 --- a/sdk/src/trace/tracer.cc +++ b/sdk/src/trace/tracer.cc @@ -56,7 +56,7 @@ nostd::shared_ptr Tracer::StartSpan( { #endif // Resolve parent span context from options or fall back to the current runtime context. - const auto parent_context = [&options]() noexcept -> opentelemetry::trace::SpanContext { + const auto parent_context = [&options]() -> opentelemetry::trace::SpanContext { // 1. If the parent is a valid SpanContext, use it directly. // 2. If the parent is a Context with a span, extract the SpanContext. // 3. If the parent is a Context with the `is_root_span` flag set, return an invalid @@ -104,8 +104,7 @@ nostd::shared_ptr Tracer::StartSpan( const auto sampling_result = context_->GetSampler().ShouldSample( parent_context, trace_id, name, options.kind, attributes, links); - const opentelemetry::trace::TraceFlags trace_flags = - [&]() noexcept -> opentelemetry::trace::TraceFlags { + const opentelemetry::trace::TraceFlags trace_flags = [&]() -> opentelemetry::trace::TraceFlags { std::uint8_t flags = 0; if (parent_context.IsValid()) { @@ -172,7 +171,11 @@ nostd::shared_ptr Tracer::StartSpan( #endif } +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 +void Tracer::ForceFlushWithMicroseconds(uint64_t timeout) +#else void Tracer::ForceFlushWithMicroseconds(uint64_t timeout) noexcept +#endif { if (context_) { @@ -181,7 +184,11 @@ void Tracer::ForceFlushWithMicroseconds(uint64_t timeout) noexcept } } +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 +void Tracer::CloseWithMicroseconds(uint64_t timeout) +#else void Tracer::CloseWithMicroseconds(uint64_t timeout) noexcept +#endif { // Trace context is shared by many tracers.So we just call ForceFlush to flush all pending spans // and do not shutdown it. @@ -192,7 +199,7 @@ void Tracer::CloseWithMicroseconds(uint64_t timeout) noexcept } } -void Tracer::UpdateTracerConfig(TracerConfig config) noexcept +void Tracer::UpdateTracerConfig(TracerConfig config) { UpdateEnabled(config.IsEnabled()); } diff --git a/sdk/src/trace/tracer_config.cc b/sdk/src/trace/tracer_config.cc index 26f0b21fec..c657736a8e 100644 --- a/sdk/src/trace/tracer_config.cc +++ b/sdk/src/trace/tracer_config.cc @@ -26,12 +26,12 @@ OPENTELEMETRY_EXPORT TracerConfig TracerConfig::Default() return kDefaultConfig; } -OPENTELEMETRY_EXPORT bool TracerConfig::IsEnabled() const noexcept +OPENTELEMETRY_EXPORT bool TracerConfig::IsEnabled() const { return enabled_; } -OPENTELEMETRY_EXPORT bool TracerConfig::operator==(const TracerConfig &other) const noexcept +OPENTELEMETRY_EXPORT bool TracerConfig::operator==(const TracerConfig &other) const { return enabled_ == other.enabled_; } diff --git a/sdk/src/trace/tracer_context.cc b/sdk/src/trace/tracer_context.cc index e9472fff83..0766ff79f2 100644 --- a/sdk/src/trace/tracer_context.cc +++ b/sdk/src/trace/tracer_context.cc @@ -40,41 +40,40 @@ TracerContext::TracerContext( span_limits_(span_limits) {} -Sampler &TracerContext::GetSampler() const noexcept +Sampler &TracerContext::GetSampler() const { return *sampler_; } -const resource::Resource &TracerContext::GetResource() const noexcept +const resource::Resource &TracerContext::GetResource() const { return resource_; } const instrumentationscope::ScopeConfigurator &TracerContext::GetTracerConfigurator() - const noexcept + const { return *tracer_configurator_; } -opentelemetry::sdk::trace::IdGenerator &TracerContext::GetIdGenerator() const noexcept +opentelemetry::sdk::trace::IdGenerator &TracerContext::GetIdGenerator() const { return *id_generator_; } -const SpanLimits &TracerContext::GetSpanLimits() const noexcept +const SpanLimits &TracerContext::GetSpanLimits() const { return span_limits_; } -void TracerContext::AddProcessor(std::unique_ptr processor) noexcept +void TracerContext::AddProcessor(std::unique_ptr processor) { auto multi_processor = static_cast(processor_.get()); multi_processor->AddProcessor(std::move(processor)); } void TracerContext::SetTracerConfigurator( - std::unique_ptr> - tracer_configurator) noexcept + std::unique_ptr> tracer_configurator) { if (!tracer_configurator) { @@ -85,17 +84,17 @@ void TracerContext::SetTracerConfigurator( tracer_configurator_ = std::move(tracer_configurator); } -SpanProcessor &TracerContext::GetProcessor() const noexcept +SpanProcessor &TracerContext::GetProcessor() const { return *processor_; } -bool TracerContext::ForceFlush(std::chrono::microseconds timeout) noexcept +bool TracerContext::ForceFlush(std::chrono::microseconds timeout) { return processor_->ForceFlush(timeout); } -bool TracerContext::Shutdown(std::chrono::microseconds timeout) noexcept +bool TracerContext::Shutdown(std::chrono::microseconds timeout) { return processor_->Shutdown(timeout); } diff --git a/sdk/src/trace/tracer_provider.cc b/sdk/src/trace/tracer_provider.cc index ac11b97045..0dad26feaf 100644 --- a/sdk/src/trace/tracer_provider.cc +++ b/sdk/src/trace/tracer_provider.cc @@ -198,14 +198,13 @@ nostd::shared_ptr TracerProvider::GetTracer( #endif } -void TracerProvider::AddProcessor(std::unique_ptr processor) noexcept +void TracerProvider::AddProcessor(std::unique_ptr processor) { context_->AddProcessor(std::move(processor)); } void TracerProvider::UpdateTracerConfigurator( - std::unique_ptr> - tracer_configurator) noexcept + std::unique_ptr> tracer_configurator) { if (!tracer_configurator) { @@ -233,22 +232,22 @@ void TracerProvider::UpdateTracerConfigurator( } } -const resource::Resource &TracerProvider::GetResource() const noexcept +const resource::Resource &TracerProvider::GetResource() const { return context_->GetResource(); } -const opentelemetry::sdk::trace::SpanLimits &TracerProvider::GetSpanLimits() const noexcept +const opentelemetry::sdk::trace::SpanLimits &TracerProvider::GetSpanLimits() const { return context_->GetSpanLimits(); } -bool TracerProvider::Shutdown(std::chrono::microseconds timeout) noexcept +bool TracerProvider::Shutdown(std::chrono::microseconds timeout) { return context_->Shutdown(timeout); } -bool TracerProvider::ForceFlush(std::chrono::microseconds timeout) noexcept +bool TracerProvider::ForceFlush(std::chrono::microseconds timeout) { return context_->ForceFlush(timeout); }