Skip to content

Commit

Permalink
tracer workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
Tianlin-Zhao committed Jul 30, 2020
1 parent bf134b8 commit 3647d6a
Show file tree
Hide file tree
Showing 2 changed files with 205 additions and 205 deletions.
90 changes: 45 additions & 45 deletions api/include/opentelemetry/trace/tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Tracer
* Attributes will be processed in order, previous attributes with the same
* key will be overwritten.
*/
virtual nostd::unique_ptr<trace::Span> StartSpan(nostd::string_view name,
virtual nostd::unique_ptr<Span> StartSpan(nostd::string_view name,
const KeyValueIterable &attributes,
const StartSpanOptions &options = {}) noexcept = 0;

Expand All @@ -38,50 +38,50 @@ class Tracer
return this->StartSpan(name, {}, options);
}

// template <class T, nostd::enable_if_t<detail::is_key_value_iterable<T>::value> * = nullptr>
// nostd::unique_ptr<Span> StartSpan(nostd::string_view name,
// const T &attributes,
// const StartSpanOptions &options = {}) noexcept
// {
// return this->StartSpan(name, KeyValueIterableView<T>(attributes), options);
// }
//
// nostd::unique_ptr<Span> StartSpan(
// nostd::string_view name,
// std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>> attributes,
// const StartSpanOptions &options = {}) noexcept
// {
// return this->StartSpan(name,
// nostd::span<const std::pair<nostd::string_view, common::AttributeValue>>{
// attributes.begin(), attributes.end()},
// options);
// }
//
// /**
// * Force any buffered spans to flush.
// * @param timeout to complete the flush
// */
// template <class Rep, class Period>
// void ForceFlush(std::chrono::duration<Rep, Period> timeout) noexcept
// {
// this->ForceFlushWithMicroseconds(
// static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::microseconds>(timeout)));
// }
//
// virtual void ForceFlushWithMicroseconds(uint64_t timeout) noexcept = 0;
//
// /**
// * ForceFlush any buffered spans and stop reporting spans.
// * @param timeout to complete the flush
// */
// template <class Rep, class Period>
// void Close(std::chrono::duration<Rep, Period> timeout) noexcept
// {
// this->CloseWithMicroseconds(
// static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::microseconds>(timeout)));
// }
//
// virtual void CloseWithMicroseconds(uint64_t timeout) noexcept = 0;
template <class T, nostd::enable_if_t<detail::is_key_value_iterable<T>::value> * = nullptr>
nostd::unique_ptr<Span> StartSpan(nostd::string_view name,
const T &attributes,
const StartSpanOptions &options = {}) noexcept
{
return this->StartSpan(name, KeyValueIterableView<T>(attributes), options);
}

nostd::unique_ptr<Span> StartSpan(
nostd::string_view name,
std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>> attributes,
const StartSpanOptions &options = {}) noexcept
{
return this->StartSpan(name,
nostd::span<const std::pair<nostd::string_view, common::AttributeValue>>{
attributes.begin(), attributes.end()},
options);
}

/**
* Force any buffered spans to flush.
* @param timeout to complete the flush
*/
template <class Rep, class Period>
void ForceFlush(std::chrono::duration<Rep, Period> timeout) noexcept
{
this->ForceFlushWithMicroseconds(
static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::microseconds>(timeout)));
}

virtual void ForceFlushWithMicroseconds(uint64_t timeout) noexcept = 0;

/**
* ForceFlush any buffered spans and stop reporting spans.
* @param timeout to complete the flush
*/
template <class Rep, class Period>
void Close(std::chrono::duration<Rep, Period> timeout) noexcept
{
this->CloseWithMicroseconds(
static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::microseconds>(timeout)));
}

virtual void CloseWithMicroseconds(uint64_t timeout) noexcept = 0;
};
} // namespace trace
OPENTELEMETRY_END_NAMESPACE
Loading

0 comments on commit 3647d6a

Please sign in to comment.