|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Distributed tracer for managing spans and traces. More...
#include <distributed_tracer.h>

Public Member Functions | |
| distributed_tracer () | |
| ~distributed_tracer () | |
| distributed_tracer (const distributed_tracer &)=delete | |
| distributed_tracer & | operator= (const distributed_tracer &)=delete |
| distributed_tracer (distributed_tracer &&) noexcept | |
| distributed_tracer & | operator= (distributed_tracer &&) noexcept |
| common::Result< std::shared_ptr< trace_span > > | start_span (const std::string &operation_name, const std::string &service_name="monitoring_system") |
| Start a new root span. | |
| common::Result< std::shared_ptr< trace_span > > | start_child_span (const trace_span &parent, const std::string &operation_name) |
| Start a child span. | |
| common::Result< std::shared_ptr< trace_span > > | start_span_from_context (const trace_context &context, const std::string &operation_name) |
| Start a span from trace context (for incoming requests) | |
| common::Result< bool > | finish_span (std::shared_ptr< trace_span > span) |
| Finish a span. | |
| std::shared_ptr< trace_span > | get_current_span () const |
| Get current active span for this thread. | |
| void | set_current_span (std::shared_ptr< trace_span > span) |
| Set current active span for this thread. | |
| trace_context | extract_context (const trace_span &span) const |
| Extract trace context for propagation. | |
| template<typename Carrier > | |
| void | inject_context (const trace_context &context, Carrier &carrier) |
| Inject trace context into carrier (e.g., HTTP headers) | |
| template<typename Carrier > | |
| common::Result< trace_context > | extract_context_from_carrier (const Carrier &carrier) |
| Extract trace context from carrier. | |
| common::Result< std::vector< trace_span > > | get_trace (const std::string &trace_id) const |
| Get all spans for a trace. | |
| common::Result< bool > | export_spans (std::vector< trace_span > spans) |
| Export spans to external system. | |
| void | set_exporter (std::shared_ptr< trace_exporter_interface > exporter) |
| Set the trace exporter for span export. | |
| std::shared_ptr< trace_exporter_interface > | get_exporter () const |
| Get the current trace exporter. | |
| void | configure_export (const trace_export_settings &settings) |
| Configure export settings. | |
| trace_export_settings | get_export_settings () const |
| Get current export settings. | |
| common::VoidResult | flush () |
| Manually flush all pending spans to exporter. | |
| std::unordered_map< std::string, std::size_t > | get_export_stats () const |
| Get export statistics. | |
Private Attributes | |
| std::unique_ptr< tracer_impl > | impl_ |
Distributed tracer for managing spans and traces.
Definition at line 195 of file distributed_tracer.h.
| kcenon::monitoring::distributed_tracer::distributed_tracer | ( | ) |
| kcenon::monitoring::distributed_tracer::~distributed_tracer | ( | ) |
|
delete |
|
noexcept |
| void kcenon::monitoring::distributed_tracer::configure_export | ( | const trace_export_settings & | settings | ) |
Configure export settings.
| settings | Export configuration settings |
| common::Result< bool > kcenon::monitoring::distributed_tracer::export_spans | ( | std::vector< trace_span > | spans | ) |
Export spans to external system.
| trace_context kcenon::monitoring::distributed_tracer::extract_context | ( | const trace_span & | span | ) | const |
Extract trace context for propagation.
Referenced by WebService::call_downstream_service(), and main().

|
inline |
Extract trace context from carrier.
Definition at line 275 of file distributed_tracer.h.
References kcenon::monitoring::trace_context::from_w3c_traceparent(), and kcenon::monitoring::not_found.
Referenced by WebService::handle_request(), and main().


| common::Result< bool > kcenon::monitoring::distributed_tracer::finish_span | ( | std::shared_ptr< trace_span > | span | ) |
Finish a span.
Referenced by analyze_traces(), WebService::call_downstream_service(), WebService::handle_request(), main(), kcenon::monitoring::scoped_span::operator=(), WebService::process_business_logic(), WebService::query_database(), TEST_F(), TEST_F(), TEST_F(), and kcenon::monitoring::scoped_span::~scoped_span().

| common::VoidResult kcenon::monitoring::distributed_tracer::flush | ( | ) |
Manually flush all pending spans to exporter.
| std::shared_ptr< trace_span > kcenon::monitoring::distributed_tracer::get_current_span | ( | ) | const |
Get current active span for this thread.
Referenced by TEST_F().

| trace_export_settings kcenon::monitoring::distributed_tracer::get_export_settings | ( | ) | const |
Get current export settings.
| std::unordered_map< std::string, std::size_t > kcenon::monitoring::distributed_tracer::get_export_stats | ( | ) | const |
Get export statistics.
| std::shared_ptr< trace_exporter_interface > kcenon::monitoring::distributed_tracer::get_exporter | ( | ) | const |
Get the current trace exporter.
| common::Result< std::vector< trace_span > > kcenon::monitoring::distributed_tracer::get_trace | ( | const std::string & | trace_id | ) | const |
Get all spans for a trace.
Referenced by analyze_traces().

|
inline |
Inject trace context into carrier (e.g., HTTP headers)
Definition at line 260 of file distributed_tracer.h.
References kcenon::monitoring::trace_context::to_w3c_traceparent().
Referenced by WebService::call_downstream_service(), and main().


|
delete |
|
noexcept |
| void kcenon::monitoring::distributed_tracer::set_current_span | ( | std::shared_ptr< trace_span > | span | ) |
Set current active span for this thread.
Referenced by kcenon::monitoring::scoped_span::scoped_span().

| void kcenon::monitoring::distributed_tracer::set_exporter | ( | std::shared_ptr< trace_exporter_interface > | exporter | ) |
Set the trace exporter for span export.
| exporter | Shared pointer to trace exporter implementation |
Referenced by ExporterIntegrationTest::TearDown().

| common::Result< std::shared_ptr< trace_span > > kcenon::monitoring::distributed_tracer::start_child_span | ( | const trace_span & | parent, |
| const std::string & | operation_name ) |
Start a child span.
Referenced by analyze_traces(), WebService::call_downstream_service(), main(), WebService::process_business_logic(), WebService::query_database(), and TEST_F().

| common::Result< std::shared_ptr< trace_span > > kcenon::monitoring::distributed_tracer::start_span | ( | const std::string & | operation_name, |
| const std::string & | service_name = "monitoring_system" ) |
Start a new root span.
Referenced by analyze_traces(), WebService::handle_request(), main(), TEST_F(), TEST_F(), and TEST_F().

| common::Result< std::shared_ptr< trace_span > > kcenon::monitoring::distributed_tracer::start_span_from_context | ( | const trace_context & | context, |
| const std::string & | operation_name ) |
Start a span from trace context (for incoming requests)
Referenced by WebService::handle_request(), and main().

|
private |
Definition at line 198 of file distributed_tracer.h.