Network System 0.1.1
High-performance modular networking library for scalable client-server applications
Loading...
Searching...
No Matches
kcenon::network::tracing::span::impl Struct Reference

Internal implementation structure for span. More...

Collaboration diagram for kcenon::network::tracing::span::impl:
Collaboration graph

Public Member Functions

 impl (std::string_view span_name, trace_context ctx, span_kind span_kind_value)
 
 ~impl ()
 
void do_end ()
 

Public Attributes

std::string name
 
trace_context context
 
span_kind kind
 
span_status status {span_status::unset}
 
std::string status_description
 
std::map< std::string, attribute_valueattributes
 
std::vector< span_eventevents
 
std::chrono::steady_clock::time_point start_time
 
std::chrono::steady_clock::time_point end_time
 
bool ended {false}
 
trace_context previous_context
 
spanowner {nullptr}
 

Detailed Description

Internal implementation structure for span.

Definition at line 20 of file span.cpp.

Constructor & Destructor Documentation

◆ impl()

kcenon::network::tracing::span::impl::impl ( std::string_view span_name,
trace_context ctx,
span_kind span_kind_value )
inline

Definition at line 35 of file span.cpp.

36 : name(span_name)
37 , context(std::move(ctx))
38 , kind(span_kind_value)
39 , start_time(std::chrono::steady_clock::now())
42 {
43 // Set this span's context as the current context
45 }
static auto current() -> trace_context
Get the current trace context from thread-local storage.
static void set_current(const trace_context &ctx)
Set the current thread-local trace context.
std::chrono::steady_clock::time_point end_time
Definition span.cpp:30
std::chrono::steady_clock::time_point start_time
Definition span.cpp:29

References context, and kcenon::network::tracing::trace_context::set_current().

Here is the call graph for this function:

◆ ~impl()

kcenon::network::tracing::span::impl::~impl ( )
inline

Definition at line 47 of file span.cpp.

48 {
49 // Note: do_end() is now called from span::~span() before impl_ destruction
50 // to ensure owner->impl_ is still valid when export_span is called.
51 // This is necessary because libc++'s unique_ptr sets its internal pointer
52 // to null before calling the deleter, which would cause owner->impl_ to
53 // be null when export_span tries to access span data.
54 }

Member Function Documentation

◆ do_end()

void kcenon::network::tracing::span::impl::do_end ( )
inline

Definition at line 56 of file span.cpp.

57 {
58 if (ended)
59 {
60 return;
61 }
62
63 ended = true;
64 end_time = std::chrono::steady_clock::now();
65
66 // Restore previous context
68 {
70 }
71 else
72 {
74 }
75
76 // Export the span
77 if (owner)
78 {
80 }
81 }
static void clear_current()
Clear the current thread-local trace context.
auto is_valid() const noexcept -> bool
Check if this context is valid.
void export_span(const span &s)
Export a completed span.

References kcenon::network::tracing::trace_context::clear_current(), end_time, ended, kcenon::network::tracing::export_span(), kcenon::network::tracing::trace_context::is_valid(), owner, previous_context, and kcenon::network::tracing::trace_context::set_current().

Referenced by kcenon::network::tracing::span::end(), and kcenon::network::tracing::span::~span().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ attributes

std::map<std::string, attribute_value> kcenon::network::tracing::span::impl::attributes

Definition at line 27 of file span.cpp.

Referenced by kcenon::network::tracing::span::attributes().

◆ context

trace_context kcenon::network::tracing::span::impl::context

Definition at line 23 of file span.cpp.

Referenced by kcenon::network::tracing::span::context(), and impl().

◆ end_time

std::chrono::steady_clock::time_point kcenon::network::tracing::span::impl::end_time

◆ ended

bool kcenon::network::tracing::span::impl::ended {false}

◆ events

std::vector<span_event> kcenon::network::tracing::span::impl::events

Definition at line 28 of file span.cpp.

Referenced by kcenon::network::tracing::span::events().

◆ kind

span_kind kcenon::network::tracing::span::impl::kind

Definition at line 24 of file span.cpp.

Referenced by kcenon::network::tracing::span::kind().

◆ name

std::string kcenon::network::tracing::span::impl::name

Definition at line 22 of file span.cpp.

Referenced by kcenon::network::tracing::span::name().

◆ owner

span* kcenon::network::tracing::span::impl::owner {nullptr}

Definition at line 33 of file span.cpp.

33{nullptr};

Referenced by do_end(), and kcenon::network::tracing::span::span().

◆ previous_context

trace_context kcenon::network::tracing::span::impl::previous_context

Definition at line 32 of file span.cpp.

Referenced by do_end().

◆ start_time

std::chrono::steady_clock::time_point kcenon::network::tracing::span::impl::start_time

◆ status

span_status kcenon::network::tracing::span::impl::status {span_status::unset}

Definition at line 25 of file span.cpp.

@ unset
Default status, span completed without explicit status.

Referenced by kcenon::network::tracing::span::status().

◆ status_description

std::string kcenon::network::tracing::span::impl::status_description

Definition at line 26 of file span.cpp.

Referenced by kcenon::network::tracing::span::status_description().


The documentation for this struct was generated from the following file: