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

Span builder for creating new spans. More...

#include <distributed_tracer.h>

Collaboration diagram for kcenon::monitoring::span_builder:
Collaboration graph

Public Member Functions

span_builderwith_trace_id (const std::string &id)
 
span_builderwith_parent (const std::string &parent_id)
 
span_builderwith_operation (const std::string &name)
 
span_builderwith_service (const std::string &name)
 
span_builderwith_tag (const std::string &key, const std::string &value)
 
span_builderwith_baggage (const std::string &key, const std::string &value)
 
trace_span build ()
 

Private Attributes

trace_span span_
 

Detailed Description

Span builder for creating new spans.

Definition at line 145 of file distributed_tracer.h.

Member Function Documentation

◆ build()

trace_span kcenon::monitoring::span_builder::build ( )
inline

Definition at line 180 of file distributed_tracer.h.

180 {
181 if (span_.span_id.empty()) {
183 }
184 if (span_.trace_id.empty()) {
186 }
187 span_.start_time = std::chrono::system_clock::now();
188 return span_;
189 }
static std::string generate_correlation_id()
Generate a unique correlation ID.
static std::string generate_request_id()
Generate a unique request ID.
std::chrono::system_clock::time_point start_time

References kcenon::monitoring::thread_context::generate_correlation_id(), kcenon::monitoring::thread_context::generate_request_id(), span_, kcenon::monitoring::trace_span::span_id, kcenon::monitoring::trace_span::start_time, and kcenon::monitoring::trace_span::trace_id.

Here is the call graph for this function:

◆ with_baggage()

span_builder & kcenon::monitoring::span_builder::with_baggage ( const std::string & key,
const std::string & value )
inline

Definition at line 175 of file distributed_tracer.h.

175 {
176 span_.baggage[key] = value;
177 return *this;
178 }
std::unordered_map< std::string, std::string > baggage

References kcenon::monitoring::trace_span::baggage, and span_.

◆ with_operation()

span_builder & kcenon::monitoring::span_builder::with_operation ( const std::string & name)
inline

Definition at line 160 of file distributed_tracer.h.

160 {
161 span_.operation_name = name;
162 return *this;
163 }

References kcenon::monitoring::trace_span::operation_name, and span_.

◆ with_parent()

span_builder & kcenon::monitoring::span_builder::with_parent ( const std::string & parent_id)
inline

Definition at line 155 of file distributed_tracer.h.

155 {
156 span_.parent_span_id = parent_id;
157 return *this;
158 }

References kcenon::monitoring::trace_span::parent_span_id, and span_.

◆ with_service()

span_builder & kcenon::monitoring::span_builder::with_service ( const std::string & name)
inline

Definition at line 165 of file distributed_tracer.h.

165 {
166 span_.service_name = name;
167 return *this;
168 }

References kcenon::monitoring::trace_span::service_name, and span_.

◆ with_tag()

span_builder & kcenon::monitoring::span_builder::with_tag ( const std::string & key,
const std::string & value )
inline

Definition at line 170 of file distributed_tracer.h.

170 {
171 span_.tags[key] = value;
172 return *this;
173 }
std::unordered_map< std::string, std::string > tags

References span_, and kcenon::monitoring::trace_span::tags.

◆ with_trace_id()

span_builder & kcenon::monitoring::span_builder::with_trace_id ( const std::string & id)
inline

Definition at line 150 of file distributed_tracer.h.

150 {
151 span_.trace_id = id;
152 return *this;
153 }

References span_, and kcenon::monitoring::trace_span::trace_id.

Member Data Documentation

◆ span_

trace_span kcenon::monitoring::span_builder::span_
private

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