Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
Loading...
Searching...
No Matches
kcenon::monitoring::trace_span Struct Reference

Trace span representing a unit of work in distributed tracing. More...

#include <distributed_tracer.h>

Collaboration diagram for kcenon::monitoring::trace_span:
Collaboration graph

Public Types

enum class  status_code { unset , ok , error }
 

Public Member Functions

bool is_finished () const
 Check if span has finished.
 
void calculate_duration ()
 Calculate duration if span is finished.
 

Public Attributes

std::string trace_id
 
std::string span_id
 
std::string parent_span_id
 
std::string operation_name
 
std::string service_name
 
std::chrono::system_clock::time_point start_time
 
std::chrono::system_clock::time_point end_time
 
std::chrono::microseconds duration {0}
 
std::unordered_map< std::string, std::string > tags
 
std::unordered_map< std::string, std::string > baggage
 
status_code status {status_code::unset}
 
std::string status_message
 

Detailed Description

Trace span representing a unit of work in distributed tracing.

Examples
multi_service_tracing_example.cpp, and otlp_export_example.cpp.

Definition at line 48 of file distributed_tracer.h.

Member Enumeration Documentation

◆ status_code

Member Function Documentation

◆ calculate_duration()

void kcenon::monitoring::trace_span::calculate_duration ( )
inline

Calculate duration if span is finished.

Examples
multi_service_tracing_example.cpp, and otlp_export_example.cpp.

Definition at line 83 of file distributed_tracer.h.

83 {
84 if (is_finished()) {
85 duration = std::chrono::duration_cast<std::chrono::microseconds>(
87 );
88 }
89 }
std::chrono::system_clock::time_point end_time
std::chrono::microseconds duration
bool is_finished() const
Check if span has finished.
std::chrono::system_clock::time_point start_time

References duration, end_time, is_finished(), and start_time.

Referenced by CacheService::cache_lookup(), create_sample_spans(), demonstrate_batch_export(), UserService::get_user_profile(), and AuthService::verify_token().

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

◆ is_finished()

bool kcenon::monitoring::trace_span::is_finished ( ) const
inline

Check if span has finished.

Definition at line 76 of file distributed_tracer.h.

76 {
77 return end_time != std::chrono::system_clock::time_point{};
78 }

References end_time.

Referenced by calculate_duration(), and TEST_F().

Here is the caller graph for this function:

Member Data Documentation

◆ baggage

◆ duration

std::chrono::microseconds kcenon::monitoring::trace_span::duration {0}

◆ end_time

◆ operation_name

◆ parent_span_id

◆ service_name

◆ span_id

◆ start_time

◆ status

◆ status_message

std::string kcenon::monitoring::trace_span::status_message

Definition at line 71 of file distributed_tracer.h.

◆ tags

◆ trace_id


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