8 #include "opentelemetry/common/attribute_value.h"
9 #include "opentelemetry/common/key_value_iterable_view.h"
10 #include "opentelemetry/nostd/span.h"
11 #include "opentelemetry/nostd/string_view.h"
12 #include "opentelemetry/nostd/type_traits.h"
13 #include "opentelemetry/trace/span_context.h"
14 #include "opentelemetry/trace/span_context_kv_iterable.h"
15 #include "opentelemetry/trace/span_context_kv_iterable_view.h"
16 #include "opentelemetry/trace/span_metadata.h"
18 #include "opentelemetry/version.h"
62 virtual ~Span() =
default;
95 this->
AddEvent(name, std::chrono::system_clock::now(), attributes);
102 const T &attributes) noexcept
116 std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>>
120 nostd::span<
const std::pair<nostd::string_view, common::AttributeValue>>{
121 attributes.begin(), attributes.end()});
125 std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>>
128 this->
AddEvent(name, std::chrono::system_clock::now(),
129 nostd::span<
const std::pair<nostd::string_view, common::AttributeValue>>{
130 attributes.begin(), attributes.end()});
133 #if OPENTELEMETRY_ABI_VERSION_NO >= 2
163 void AddLink(
const SpanContext &target,
const U &attrs)
166 this->AddLink(target, view);
176 void AddLink(
const SpanContext &target,
177 std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>> attrs)
181 attrs.
begin(), attrs.end()};
188 return this->AddLink(target, view);
198 template <class U, nostd::enable_if_t<detail::is_span_context_kv_iterable<U>::value> * =
nullptr>
199 void AddLinks(
const U &links)
201 SpanContextKeyValueIterableView<U> view(links);
202 this->AddLinks(view);
213 std::initializer_list<
214 std::pair<SpanContext,
215 std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>>>>
220 SpanContext, std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>>>>
221 container{links.
begin(), links.end()};
224 SpanContextKeyValueIterableView<
nostd::span<
const std::pair<
225 SpanContext, std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>>>>>
228 return this->AddLinks(view);
249 virtual
void End(const
trace::EndSpanOptions &options = {}) noexcept = 0;