Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions api/include/opentelemetry/common/key_value_iterable_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

#include <iterator>
#include <utility>
#include <type_traits>

#include "opentelemetry/common/key_value_iterable.h"
#include "opentelemetry/nostd/function_ref.h"
#include "opentelemetry/nostd/span.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/type_traits.h"
#include "opentelemetry/nostd/utility.h"
#include "opentelemetry/version.h"

Expand Down Expand Up @@ -77,7 +77,7 @@ class KeyValueIterableView final : public KeyValueIterable
const T *container_;
};

template <class T, nostd::enable_if_t<detail::is_key_value_iterable<T>::value> * = nullptr>
template <class T, std::enable_if_t<detail::is_key_value_iterable<T>::value> * = nullptr>
KeyValueIterableView<T> MakeKeyValueIterableView(const T &container) noexcept
{
return KeyValueIterableView<T>(container);
Expand Down Expand Up @@ -130,7 +130,7 @@ inline static const common::KeyValueIterable &MakeAttributes(
*/
template <
class ArgumentType,
nostd::enable_if_t<common::detail::is_key_value_iterable<ArgumentType>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<ArgumentType>::value> * = nullptr>
inline static common::KeyValueIterableView<ArgumentType> MakeAttributes(
const ArgumentType &arg) noexcept
{
Expand Down
5 changes: 3 additions & 2 deletions api/include/opentelemetry/logs/logger_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

#pragma once

#include <type_traits>

#include "opentelemetry/common/key_value_iterable.h"
#include "opentelemetry/common/key_value_iterable_view.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/span.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/type_traits.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
Expand Down Expand Up @@ -56,7 +57,7 @@ class OPENTELEMETRY_EXPORT LoggerProvider
}

template <class T,
nostd::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
nostd::shared_ptr<Logger> GetLogger(nostd::string_view logger_name,
nostd::string_view library_name,
nostd::string_view library_version,
Expand Down
7 changes: 3 additions & 4 deletions api/include/opentelemetry/logs/logger_type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "opentelemetry/logs/log_record.h"
#include "opentelemetry/logs/severity.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/type_traits.h"
#include "opentelemetry/trace/span_context.h"
#include "opentelemetry/trace/span_id.h"
#include "opentelemetry/trace/trace_flags.h"
Expand Down Expand Up @@ -146,7 +145,7 @@ template <class ValueType>
struct LogRecordSetterTrait
{
template <class ArgumentType,
nostd::enable_if_t<std::is_convertible<ArgumentType, nostd::string_view>::value ||
std::enable_if_t<std::is_convertible<ArgumentType, nostd::string_view>::value ||
std::is_convertible<ArgumentType, common::AttributeValue>::value,
void> * = nullptr>
inline static LogRecord *Set(LogRecord *log_record, ArgumentType &&arg) noexcept
Expand All @@ -157,7 +156,7 @@ struct LogRecordSetterTrait
}

template <class ArgumentType,
nostd::enable_if_t<std::is_base_of<common::KeyValueIterable, ArgumentType>::value, bool>
std::enable_if_t<std::is_base_of<common::KeyValueIterable, ArgumentType>::value, bool>
* = nullptr>
inline static LogRecord *Set(LogRecord *log_record, ArgumentType &&arg) noexcept
{
Expand All @@ -166,7 +165,7 @@ struct LogRecordSetterTrait
}

template <class ArgumentType,
nostd::enable_if_t<common::detail::is_key_value_iterable<ArgumentType>::value, int> * =
std::enable_if_t<common::detail::is_key_value_iterable<ArgumentType>::value, int> * =
nullptr>
inline static LogRecord *Set(LogRecord *log_record, ArgumentType &&arg) noexcept
{
Expand Down
5 changes: 3 additions & 2 deletions api/include/opentelemetry/metrics/meter_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

#pragma once

#include <type_traits>

#include "opentelemetry/common/key_value_iterable.h"
#include "opentelemetry/common/key_value_iterable_view.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/type_traits.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
Expand Down Expand Up @@ -98,7 +99,7 @@ class MeterProvider
* @param[in] attributes Instrumentation scope attributes container
*/
template <class T,
nostd::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
nostd::shared_ptr<Meter> GetMeter(nostd::string_view name,
nostd::string_view version,
nostd::string_view schema_url,
Expand Down
5 changes: 3 additions & 2 deletions api/include/opentelemetry/metrics/observer_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

#pragma once

#include <type_traits>

#include "opentelemetry/common/attribute_value.h"
#include "opentelemetry/common/key_value_iterable_view.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/span.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/type_traits.h"
#include "opentelemetry/nostd/variant.h"
#include "opentelemetry/version.h"

Expand All @@ -32,7 +33,7 @@ class ObserverResultT
virtual void Observe(T value, const common::KeyValueIterable &attributes) noexcept = 0;

template <class U,
nostd::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
void Observe(T value, const U &attributes) noexcept
{
this->Observe(value, common::KeyValueIterableView<U>{attributes});
Expand Down
15 changes: 8 additions & 7 deletions api/include/opentelemetry/metrics/sync_instruments.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

#pragma once

#include <type_traits>

#include "opentelemetry/common/attribute_value.h"
#include "opentelemetry/common/key_value_iterable_view.h"
#include "opentelemetry/context/context.h"
#include "opentelemetry/nostd/span.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/type_traits.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
Expand Down Expand Up @@ -64,14 +65,14 @@ class Counter : public SynchronousInstrument
const context::Context &context) noexcept = 0;

template <class U,
nostd::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
void Add(T value, const U &attributes) noexcept
{
this->Add(value, common::KeyValueIterableView<U>{attributes});
}

template <class U,
nostd::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
void Add(T value, const U &attributes, const context::Context &context) noexcept
{
this->Add(value, common::KeyValueIterableView<U>{attributes}, context);
Expand Down Expand Up @@ -121,7 +122,7 @@ class Histogram : public SynchronousInstrument
virtual void Record(T value, const common::KeyValueIterable &attribute) noexcept = 0;

template <class U,
nostd::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
void Record(T value, const U &attributes) noexcept
{
this->Record(value, common::KeyValueIterableView<U>{attributes});
Expand Down Expand Up @@ -156,7 +157,7 @@ class Histogram : public SynchronousInstrument
const context::Context &context) noexcept = 0;

template <class U,
nostd::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
void Record(T value, const U &attributes, const context::Context &context) noexcept
{
this->Record(value, common::KeyValueIterableView<U>{attributes}, context);
Expand Down Expand Up @@ -215,14 +216,14 @@ class UpDownCounter : public SynchronousInstrument
const context::Context &context) noexcept = 0;

template <class U,
nostd::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
void Add(T value, const U &attributes) noexcept
{
this->Add(value, common::KeyValueIterableView<U>{attributes});
}

template <class U,
nostd::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
void Add(T value, const U &attributes, const context::Context &context) noexcept
{
this->Add(value, common::KeyValueIterableView<U>{attributes}, context);
Expand Down
1 change: 0 additions & 1 deletion api/include/opentelemetry/nostd/detail/trait.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include <type_traits>

#include "opentelemetry/nostd/type_traits.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
Expand Down
10 changes: 5 additions & 5 deletions api/include/opentelemetry/trace/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#pragma once

#include <cstdint>
#include <type_traits>

#include "opentelemetry/common/attribute_value.h"
#include "opentelemetry/common/key_value_iterable_view.h"
#include "opentelemetry/nostd/span.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/type_traits.h"
#include "opentelemetry/trace/span_context.h"
#include "opentelemetry/trace/span_context_kv_iterable.h"
#include "opentelemetry/trace/span_context_kv_iterable_view.h"
Expand Down Expand Up @@ -96,7 +96,7 @@ class Span
}

template <class T,
nostd::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
void AddEvent(nostd::string_view name,
common::SystemTimestamp timestamp,
const T &attributes) noexcept
Expand All @@ -105,7 +105,7 @@ class Span
}

template <class T,
nostd::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
void AddEvent(nostd::string_view name, const T &attributes) noexcept
{
this->AddEvent(name, common::KeyValueIterableView<T>{attributes});
Expand Down Expand Up @@ -159,7 +159,7 @@ class Span
* @since ABI_VERSION 2
*/
template <class U,
nostd::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
void AddLink(const SpanContext &target, const U &attrs)
{
common::KeyValueIterableView<U> view(attrs);
Expand Down Expand Up @@ -195,7 +195,7 @@ class Span
*
* @since ABI_VERSION 2
*/
template <class U, nostd::enable_if_t<detail::is_span_context_kv_iterable<U>::value> * = nullptr>
template <class U, std::enable_if_t<detail::is_span_context_kv_iterable<U>::value> * = nullptr>
void AddLinks(const U &links)
{
SpanContextKeyValueIterableView<U> view(links);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ template <class T>
inline void take_span_context_kv(SpanContext, opentelemetry::common::KeyValueIterableView<T>)
{}

template <class T, nostd::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
template <class T, std::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
inline void take_span_context_kv(SpanContext, T &)
{}

Expand Down Expand Up @@ -94,7 +94,7 @@ class SpanContextKeyValueIterableView final : public SpanContextKeyValueIterable
}

template <class U,
nostd::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<U>::value> * = nullptr>
bool do_callback(SpanContext span_context,
const U &attributes,
nostd::function_ref<bool(SpanContext, const common::KeyValueIterable &)>
Expand Down
10 changes: 5 additions & 5 deletions api/include/opentelemetry/trace/tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Tracer
}

template <class T,
nostd::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
nostd::shared_ptr<Span> StartSpan(nostd::string_view name,
const T &attributes,
const StartSpanOptions &options = {}) noexcept
Expand All @@ -65,8 +65,8 @@ class Tracer

template <class T,
class U,
nostd::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr,
nostd::enable_if_t<detail::is_span_context_kv_iterable<U>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr,
std::enable_if_t<detail::is_span_context_kv_iterable<U>::value> * = nullptr>
nostd::shared_ptr<Span> StartSpan(nostd::string_view name,
const T &attributes,
const U &links,
Expand All @@ -86,7 +86,7 @@ class Tracer
}

template <class T,
nostd::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
nostd::shared_ptr<Span> StartSpan(
nostd::string_view name,
const T &attributes,
Expand All @@ -105,7 +105,7 @@ class Tracer
}

template <class T,
nostd::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
nostd::shared_ptr<Span> StartSpan(
nostd::string_view name,
std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>> attributes,
Expand Down
2 changes: 1 addition & 1 deletion api/include/opentelemetry/trace/tracer_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class OPENTELEMETRY_EXPORT TracerProvider
* @param[in] attributes Instrumentation scope attributes container
*/
template <class T,
nostd::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
std::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
nostd::shared_ptr<Tracer> GetTracer(nostd::string_view name,
nostd::string_view version,
nostd::string_view schema_url,
Expand Down
4 changes: 2 additions & 2 deletions api/test/trace/key_value_iterable_view_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <gtest/gtest.h>
#include <map>
#include "opentelemetry/nostd/type_traits.h"
#include <type_traits>

using namespace opentelemetry;

Expand All @@ -21,7 +21,7 @@ static int TakeKeyValues(const common::KeyValueIterable &iterable)
return count;
}

template <class T, nostd::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
template <class T, std::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>
static int TakeKeyValues(const T &iterable)
{
return TakeKeyValues(common::KeyValueIterableView<T>{iterable});
Expand Down