Skip to content

Commit

Permalink
deps: update opentelemetry-cpp to 1.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
santigimeno committed Dec 18, 2024
1 parent fcf0865 commit a369b9e
Show file tree
Hide file tree
Showing 206 changed files with 16,890 additions and 1,555 deletions.
3 changes: 3 additions & 0 deletions deps/opentelemetry-cpp/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
# Enable automatic configs based on platform
common --enable_platform_specific_config

# Make globs that don't match anything fail
common --incompatible_disallow_empty_glob

# Needed by gRPC to build on some platforms.
build --copt -DGRPC_BAZEL_BUILD

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ class SpinLockMutex
# else
__builtin_ia32_pause();
# endif
#elif defined(__arm__)
__asm__ volatile("yield" ::: "memory");
#elif defined(__armel__) || defined(__ARMEL__)
asm volatile("nop" ::: "memory");
#elif defined(__arm__) || defined(__aarch64__) // arm big endian / arm64
__asm__ __volatile__("yield" ::: "memory");
#else
// TODO: Issue PAGE/YIELD on other architectures.
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class StringUtil
public:
static nostd::string_view Trim(nostd::string_view str, size_t left, size_t right) noexcept
{
while (left <= right && str[static_cast<std::size_t>(left)] == ' ')
while (left <= right && isspace(str[left]))
{
left++;
}
while (left <= right && str[static_cast<std::size_t>(right)] == ' ')
while (left <= right && isspace(str[right]))
{
right--;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ class EventLogger
}
nostd::unique_ptr<LogRecord> log_record = delegate_logger->CreateLogRecord();

IgnoreTraitResult(
detail::LogRecordSetterTrait<typename std::decay<ArgumentType>::type>::template Set(
log_record.get(), std::forward<ArgumentType>(args))...);
IgnoreTraitResult(detail::LogRecordSetterTrait<typename std::decay<ArgumentType>::type>::Set(
log_record.get(), std::forward<ArgumentType>(args))...);

EmitEvent(event_name, std::move(log_record));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ class Logger
return;
}

IgnoreTraitResult(
detail::LogRecordSetterTrait<typename std::decay<ArgumentType>::type>::template Set(
log_record.get(), std::forward<ArgumentType>(args))...);
IgnoreTraitResult(detail::LogRecordSetterTrait<typename std::decay<ArgumentType>::type>::Set(
log_record.get(), std::forward<ArgumentType>(args))...);

EmitLogRecord(std::move(log_record));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ struct LogRecordSetterTrait
* = nullptr>
inline static LogRecord *Set(LogRecord *log_record, ArgumentType &&arg) noexcept
{
return LogRecordSetterTrait<common::KeyValueIterable>::template Set(
log_record, std::forward<ArgumentType>(arg));
return LogRecordSetterTrait<common::KeyValueIterable>::Set(log_record,
std::forward<ArgumentType>(arg));
}

template <class ArgumentType,
Expand Down
24 changes: 24 additions & 0 deletions deps/opentelemetry-cpp/api/include/opentelemetry/metrics/meter.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class Histogram;
template <typename T>
class UpDownCounter;

template <typename T>
class Gauge;

class ObservableInstrument;

/**
Expand Down Expand Up @@ -91,6 +94,27 @@ class Meter
nostd::string_view description = "",
nostd::string_view unit = "") noexcept = 0;

#if OPENTELEMETRY_ABI_VERSION_NO >= 2
/**
* Creates a Gauge with the passed characteristics and returns a unique_ptr to that Gauge.
*
* @param name the name of the new Gauge.
* @param description a brief description of what the Gauge is used for.
* @param unit the unit of metric values following https://unitsofmeasure.org/ucum.html.
* @return a unique pointer to the created Gauge.
*/

virtual nostd::unique_ptr<Gauge<int64_t>> CreateInt64Gauge(
nostd::string_view name,
nostd::string_view description = "",
nostd::string_view unit = "") noexcept = 0;

virtual nostd::unique_ptr<Gauge<double>> CreateDoubleGauge(
nostd::string_view name,
nostd::string_view description = "",
nostd::string_view unit = "") noexcept = 0;
#endif

/**
* Creates a Asynchronous (Observable) Gauge with the passed characteristics and returns a
* shared_ptr to that Observable Gauge
Expand Down
36 changes: 36 additions & 0 deletions deps/opentelemetry-cpp/api/include/opentelemetry/metrics/noop.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,26 @@ class NoopUpDownCounter : public UpDownCounter<T>
{}
};

#if OPENTELEMETRY_ABI_VERSION_NO >= 2
template <class T>
class NoopGauge : public Gauge<T>
{
public:
NoopGauge(nostd::string_view /* name */,
nostd::string_view /* description */,
nostd::string_view /* unit */) noexcept
{}
~NoopGauge() override = default;
void Record(T /* value */) noexcept override {}
void Record(T /* value */, const context::Context & /* context */) noexcept override {}
void Record(T /* value */, const common::KeyValueIterable & /* attributes */) noexcept override {}
void Record(T /* value */,
const common::KeyValueIterable & /* attributes */,
const context::Context & /* context */) noexcept override
{}
};
#endif

class NoopObservableInstrument : public ObservableInstrument
{
public:
Expand Down Expand Up @@ -140,6 +160,22 @@ class NoopMeter final : public Meter
return nostd::unique_ptr<Histogram<double>>{new NoopHistogram<double>(name, description, unit)};
}

#if OPENTELEMETRY_ABI_VERSION_NO >= 2
nostd::unique_ptr<Gauge<int64_t>> CreateInt64Gauge(nostd::string_view name,
nostd::string_view description = "",
nostd::string_view unit = "") noexcept override
{
return nostd::unique_ptr<Gauge<int64_t>>{new NoopGauge<int64_t>(name, description, unit)};
}

nostd::unique_ptr<Gauge<double>> CreateDoubleGauge(nostd::string_view name,
nostd::string_view description = "",
nostd::string_view unit = "") noexcept override
{
return nostd::unique_ptr<Gauge<double>>{new NoopGauge<double>(name, description, unit)};
}
#endif

nostd::shared_ptr<ObservableInstrument> CreateInt64ObservableGauge(
nostd::string_view name,
nostd::string_view description = "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,82 @@ class UpDownCounter : public SynchronousInstrument
}
};

#if OPENTELEMETRY_ABI_VERSION_NO >= 2
/* A Gauge instrument that records values. */
template <class T>
class Gauge : public SynchronousInstrument
{

public:
/**
* Record a value
*
* @param value The measurement value. May be positive, negative or zero.
*/
virtual void Record(T value) noexcept = 0;

/**
* Record a value
*
* @param value The measurement value. May be positive, negative or zero.
* @param context The explicit context to associate with this measurement.
*/
virtual void Record(T value, const context::Context &context) noexcept = 0;

/**
* Record a value with a set of attributes.
*
* @param value The measurement value. May be positive, negative or zero.
* @param attributes A set of attributes to associate with the value.
*/

virtual void Record(T value, const common::KeyValueIterable &attributes) noexcept = 0;

/**
* Record a value with a set of attributes.
*
* @param value The measurement value. May be positive, negative or zero.
* @param attributes A set of attributes to associate with the value.
* @param context The explicit context to associate with this measurement.
*/
virtual void Record(T value,
const common::KeyValueIterable &attributes,
const context::Context &context) noexcept = 0;

template <class U,
nostd::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});
}

template <class U,
nostd::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);
}

void Record(T value,
std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>>
attributes) noexcept
{
this->Record(value, nostd::span<const std::pair<nostd::string_view, common::AttributeValue>>{
attributes.begin(), attributes.end()});
}

void Record(
T value,
std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>> attributes,
const context::Context &context) noexcept
{
this->Record(value,
nostd::span<const std::pair<nostd::string_view, common::AttributeValue>>{
attributes.begin(), attributes.end()},
context);
}
};
#endif

} // namespace metrics
OPENTELEMETRY_END_NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Notes on Abseil Variant implementation

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

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

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

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

#endif

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

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

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

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

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

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

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

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

#undef OTABSL_INTERNAL_HAS_KEYWORD

Expand Down
Loading

0 comments on commit a369b9e

Please sign in to comment.