@@ -55,27 +55,30 @@ opentelemetry::nostd::shared_ptr<opentelemetry::trace::Tracer> GetTracer(
5555/* *
5656 * Start a [span] using the current [tracer].
5757 *
58- * The current tracer is determined by the prevailing `CurrentOptions()`.
58+ * The current tracer is determined by the prevailing `CurrentOptions()`. Each
59+ * span is set as a client span.
5960 *
6061 * @see https://opentelemetry.io/docs/instrumentation/cpp/manual/#start-a-span
6162 *
6263 * [span]:
6364 * https://opentelemetry.io/docs/concepts/signals/traces/#spans-in-opentelemetry
6465 * [tracer]: https://opentelemetry.io/docs/concepts/signals/traces/#tracer
6566 */
67+ opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span> MakeSpanImpl (
68+ opentelemetry::nostd::string_view name,
69+ opentelemetry::common::KeyValueIterable const & attributes =
70+ opentelemetry::common::NoopKeyValueIterable (),
71+ opentelemetry::trace::SpanContextKeyValueIterable const & links =
72+ opentelemetry::trace::NullSpanContext());
73+
74+ /* *
75+ * Start a span with a @p name.
76+ */
6677opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span> MakeSpan (
6778 opentelemetry::nostd::string_view name);
6879
6980/* *
70- * Start a [span] using the current [tracer] with the specified attributes.
71- *
72- * The current tracer is determined by the prevailing `CurrentOptions()`.
73- *
74- * @see https://opentelemetry.io/docs/instrumentation/cpp/manual/#start-a-span
75- *
76- * [span]:
77- * https://opentelemetry.io/docs/concepts/signals/traces/#spans-in-opentelemetry
78- * [tracer]: https://opentelemetry.io/docs/concepts/signals/traces/#tracer
81+ * Start a span with a @p name and @p attributes using an initializer list.
7982 */
8083opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span> MakeSpan (
8184 opentelemetry::nostd::string_view name,
@@ -84,9 +87,57 @@ opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span> MakeSpan(
8487 attributes);
8588
8689/* *
87- * Extracts information from a `Status` and adds it to a span.
90+ * Start a span with a @p name, @p attributes using an initializer list, and @p
91+ * links using an initializer lists.
92+ */
93+ opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span> MakeSpan (
94+ opentelemetry::nostd::string_view name,
95+ std::initializer_list<std::pair<opentelemetry::nostd::string_view,
96+ opentelemetry::common::AttributeValue>>
97+ attributes,
98+ std::initializer_list<
99+ std::pair<opentelemetry::trace::SpanContext,
100+ std::initializer_list<
101+ std::pair<opentelemetry::nostd::string_view,
102+ opentelemetry::common::AttributeValue>>>>
103+ links);
104+
105+ /* *
106+ * Start a span with a @p name, @p attributes, and @p links.
107+ */
108+ template <class T , class U >
109+ opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span> MakeSpan (
110+ opentelemetry::nostd::string_view name, T const & attributes,
111+ U const & links) {
112+ return MakeSpanImpl (
113+ name, opentelemetry::common::KeyValueIterableView<T>(attributes),
114+ opentelemetry::trace::SpanContextKeyValueIterableView<U>(links));
115+ }
116+
117+ /* *
118+ * Start a span with a @p name, @p attributes, and @p links where attributes
119+ * uses an initializer list.
120+ */
121+ template <class T >
122+ opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span> MakeSpan (
123+ opentelemetry::nostd::string_view name,
124+ std::initializer_list<std::pair<opentelemetry::nostd::string_view,
125+ opentelemetry::common::AttributeValue>>
126+ attributes,
127+ T const & links) {
128+ return MakeSpan (
129+ name,
130+ opentelemetry::nostd::span<
131+ std::pair<opentelemetry::nostd::string_view,
132+ opentelemetry::common::AttributeValue> const >{
133+ attributes.begin (), attributes.end ()},
134+ opentelemetry::trace::SpanContextKeyValueIterableView<T>(links));
135+ }
136+
137+ /* *
138+ * Extracts information from a `status` and adds it to a span.
88139 *
89- * This method will end the span, and set its [span status], accordingly. Other
140+ * This method will end the span, and set its [span status], accordingly. other
90141 * details, such as error information, will be set as [attributes] on the span.
91142 *
92143 * @see https://opentelemetry.io/docs/concepts/signals/traces/#spans-in-opentelemetry
0 commit comments