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 77abce8 commit d3a1931
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 60 deletions.
2 changes: 1 addition & 1 deletion api/include/opentelemetry/trace/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

#include <cstdint>

#include "opentelemetry/trace/tracer.h"
#include "opentelemetry/common/attribute_value.h"
#include "opentelemetry/core/timestamp.h"
#include "opentelemetry/nostd/span.h"
#include "opentelemetry/trace/span_context.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/trace/canonical_code.h"
#include "opentelemetry/trace/key_value_iterable_view.h"
#include "opentelemetry/trace/tracer.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
Expand Down
5 changes: 0 additions & 5 deletions api/include/opentelemetry/trace/span_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "opentelemetry/trace/trace_flags.h"
#include "opentelemetry/trace/trace_id.h"
#include "opentelemetry/trace/trace_state.h"
#include "opentelemetry/trace/span.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace trace
Expand Down Expand Up @@ -72,10 +71,6 @@ class SpanContext final

static SpanContext GetInvalid() { return SpanContext(); }

nostd::unique_ptr<Span> test() {
return nostd::unique_ptr<Span>(new Span());
}

private:
TraceId trace_id_;
SpanId span_id_;
Expand Down
108 changes: 54 additions & 54 deletions api/include/opentelemetry/trace/tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,60 +28,60 @@ class Tracer
* Attributes will be processed in order, previous attributes with the same
* key will be overwritten.
*/
// virtual nostd::unique_ptr<Span> StartSpan(nostd::string_view name,
// const KeyValueIterable &attributes,
// const StartSpanOptions &options = {}) noexcept = 0;
//
// nostd::unique_ptr<Span> StartSpan(nostd::string_view name,
// const StartSpanOptions &options = {}) noexcept
// {
// 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;
virtual nostd::unique_ptr<Span> StartSpan(nostd::string_view name,
const KeyValueIterable &attributes,
const StartSpanOptions &options = {}) noexcept = 0;

nostd::unique_ptr<Span> StartSpan(nostd::string_view name,
const StartSpanOptions &options = {}) noexcept
{
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;
};
} // namespace trace
OPENTELEMETRY_END_NAMESPACE

0 comments on commit d3a1931

Please sign in to comment.