userver: userver/tracing/span_builder.hpp Source File
Loading...
Searching...
No Matches
span_builder.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/tracing/span_builder.hpp
4/// @brief @copybrief tracing::SpanBuilder
5
6#include <string>
7
8#include <userver/tracing/span.hpp>
9#include <userver/utils/impl/source_location.hpp>
10
11USERVER_NAMESPACE_BEGIN
12
13namespace tracing {
14
15/// @brief Provides interface for editing Span, before final building.
16class SpanBuilder final {
17public:
18 explicit SpanBuilder(
19 std::string name,
20 const utils::impl::SourceLocation& location = utils::impl::SourceLocation::Current()
21 );
22
23 void SetTraceId(std::string trace_id);
24 const std::string& GetTraceId() const noexcept;
25 void SetSpanId(std::string span_id);
26 void SetParentSpanId(std::string parent_span_id);
27 void SetParentLink(std::string parent_link);
28 void AddTagFrozen(std::string key, logging::LogExtra::Value value);
29 void AddNonInheritableTag(std::string key, logging::LogExtra::Value value);
30 Span Build() &&;
31
32private:
33 std::unique_ptr<Span::Impl, Span::OptionalDeleter> pimpl_;
34};
35
36} // namespace tracing
37
38USERVER_NAMESPACE_END