|
Network System 0.1.1
High-performance modular networking library for scalable client-server applications
|
Classes | |
| struct | batch_config |
| Batch export configuration. More... | |
| struct | otlp_config |
| OTLP exporter configuration. More... | |
| class | span |
| RAII span for distributed tracing. More... | |
| struct | span_event |
| Span event (timestamped annotation) More... | |
| class | trace_context |
| Immutable trace context for distributed tracing. More... | |
| struct | tracing_config |
| Main configuration structure for tracing. More... | |
Typedefs | |
| using | attribute_value = std::variant<std::string, int64_t, double, bool> |
| Attribute value type (supports string, int64, double, bool) | |
| using | trace_id_t = std::array<uint8_t, 16> |
| Trace ID type (128-bit identifier) | |
| using | span_id_t = std::array<uint8_t, 8> |
| Span ID type (64-bit identifier) | |
| using | span_processor_callback = std::function<void(const span&)> |
| Span processor callback type. | |
Enumerations | |
| enum class | span_status { unset = 0 , ok = 1 , error = 2 } |
| Span status codes following OpenTelemetry conventions. More... | |
| enum class | span_kind { internal = 0 , server = 1 , client = 2 , producer = 3 , consumer = 4 } |
| Span kind following OpenTelemetry conventions. More... | |
| enum class | trace_flags : uint8_t { none = 0x00 , sampled = 0x01 } |
| Trace flags (8-bit) More... | |
| enum class | exporter_type { none , console , otlp_grpc , otlp_http , jaeger , zipkin } |
| Exporter types for trace data. More... | |
| enum class | sampler_type { always_on , always_off , trace_id , parent_based } |
| Sampler types for trace sampling decisions. More... | |
Functions | |
| auto | generate_trace_id () -> trace_id_t |
| Generate a random trace ID. | |
| auto | generate_span_id () -> span_id_t |
| Generate a random span ID. | |
| auto | bytes_to_hex (const uint8_t *data, size_t size) -> std::string |
| Convert bytes to lowercase hex string. | |
| auto | hex_to_bytes (std::string_view hex, uint8_t *out, size_t size) -> bool |
| Parse hex string to bytes. | |
| void | configure_tracing (const tracing_config &config) |
| Initialize the tracing system with configuration. | |
| void | shutdown_tracing () |
| Shutdown the tracing system. | |
| void | flush_tracing () |
| Force flush all pending spans. | |
| auto | is_tracing_enabled () -> bool |
| Check if tracing is enabled. | |
| void | register_span_processor (span_processor_callback callback) |
| Register a custom span processor. | |
| void | export_span (const span &s) |
| Export a completed span. | |
| using kcenon::network::tracing::attribute_value = std::variant<std::string, int64_t, double, bool> |
| using kcenon::network::tracing::span_id_t = std::array<uint8_t, 8> |
Span ID type (64-bit identifier)
Definition at line 39 of file trace_context.h.
| using kcenon::network::tracing::span_processor_callback = std::function<void(const span&)> |
Span processor callback type.
Called when a span ends. Can be used for custom export or processing.
Definition at line 283 of file tracing_config.h.
| using kcenon::network::tracing::trace_id_t = std::array<uint8_t, 16> |
Trace ID type (128-bit identifier)
Definition at line 34 of file trace_context.h.
|
strong |
Exporter types for trace data.
Definition at line 32 of file tracing_config.h.
|
strong |
Sampler types for trace sampling decisions.
| Enumerator | |
|---|---|
| always_on | Sample all traces. |
| always_off | Sample no traces. |
| trace_id | Sample based on trace ID ratio. |
| parent_based | Sample based on parent span's sampling decision. |
Definition at line 45 of file tracing_config.h.
|
strong |
Span kind following OpenTelemetry conventions.
|
strong |
Span status codes following OpenTelemetry conventions.
| Enumerator | |
|---|---|
| unset | Default status, span completed without explicit status. |
| ok | Operation completed successfully. |
| error | Operation failed. |
Definition at line 33 of file span.h.
|
strong |
|
nodiscard |
Convert bytes to lowercase hex string.
| data | Byte array |
| size | Number of bytes |
Definition at line 315 of file trace_context.cpp.
Referenced by kcenon::network::tracing::trace_context::span_id_hex(), and kcenon::network::tracing::trace_context::trace_id_hex().

| void kcenon::network::tracing::configure_tracing | ( | const tracing_config & | config | ) |
Initialize the tracing system with configuration.
| config | Tracing configuration |
This function must be called before creating any spans. It initializes the tracing system with the specified configuration.
Definition at line 599 of file exporters.cpp.
References config, console, kcenon::network::tracing::tracing_config::debug, kcenon::network::tracing::otlp_config::endpoint, kcenon::network::tracing::tracing_config::exporter, jaeger, kcenon::network::tracing::tracing_config::jaeger_endpoint, none, kcenon::network::tracing::tracing_config::otlp, otlp_grpc, otlp_http, kcenon::network::tracing::tracing_config::sample_rate, kcenon::network::tracing::tracing_config::service_name, zipkin, and kcenon::network::tracing::tracing_config::zipkin_endpoint.
| void kcenon::network::tracing::export_span | ( | const span & | s | ) |
Export a completed span.
| s | The span to export |
This function is called automatically when a span ends. It exports the span according to the configured exporter.
Definition at line 701 of file exporters.cpp.
Referenced by kcenon::network::tracing::span::impl::do_end().

| void kcenon::network::tracing::flush_tracing | ( | ) |
Force flush all pending spans.
Blocks until all pending spans are exported.
Definition at line 660 of file exporters.cpp.
Referenced by shutdown_tracing().

|
nodiscard |
Generate a random span ID.
Definition at line 308 of file trace_context.cpp.
Referenced by kcenon::network::tracing::trace_context::create_child_span(), and kcenon::network::tracing::trace_context::create_span().

|
nodiscard |
Generate a random trace ID.
Definition at line 301 of file trace_context.cpp.
Referenced by kcenon::network::tracing::trace_context::create_child_span(), and kcenon::network::tracing::trace_context::create_span().

|
nodiscard |
Parse hex string to bytes.
| hex | Hex string |
| out | Output byte array |
| size | Expected number of bytes |
Definition at line 329 of file trace_context.cpp.
Referenced by kcenon::network::tracing::trace_context::from_traceparent().

|
nodiscard |
Check if tracing is enabled.
Definition at line 685 of file exporters.cpp.
Referenced by kcenon::network::protocols::grpc::grpc_client::impl::call_raw(), kcenon::network::protocols::quic::connection::close(), kcenon::network::protocols::quic::connection::close_application(), kcenon::network::protocols::grpc::grpc_client::impl::connect(), kcenon::network::protocols::http2::http2_client::connect(), kcenon::network::protocols::quic::connection::init_server_handshake(), kcenon::network::core::messaging_server::on_accept(), kcenon::network::protocols::quic::connection::receive_packet(), kcenon::network::core::messaging_quic_client::send_on_stream(), kcenon::network::core::messaging_client::send_packet(), kcenon::network::core::messaging_quic_client::send_packet(), kcenon::network::protocols::http2::http2_client::send_request(), kcenon::network::protocols::grpc::grpc_server::impl::start(), kcenon::network::core::messaging_client::start_client(), kcenon::network::core::messaging_quic_client::start_client(), kcenon::network::protocols::quic::connection::start_handshake(), and kcenon::network::core::messaging_server::start_server().

| void kcenon::network::tracing::register_span_processor | ( | span_processor_callback | callback | ) |
Register a custom span processor.
| callback | Callback function called when spans end |
Can be used to implement custom export logic or additional processing.
Definition at line 690 of file exporters.cpp.
| void kcenon::network::tracing::shutdown_tracing | ( | ) |
Shutdown the tracing system.
Flushes any pending spans and releases resources. Should be called before application exit.
Definition at line 641 of file exporters.cpp.
References flush_tracing().
