|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
OTLP gRPC trace exporter. More...
#include <otlp_grpc_exporter.h>


Public Member Functions | |
| otlp_grpc_exporter (const otlp_grpc_config &config) | |
| Construct with configuration. | |
| otlp_grpc_exporter (const otlp_grpc_config &config, std::unique_ptr< grpc_transport > transport) | |
| Construct with configuration and custom transport. | |
| common::VoidResult | start () |
| Start the exporter. | |
| common::VoidResult | export_spans (const std::vector< trace_span > &spans) override |
| Export a batch of spans. | |
| common::VoidResult | flush () override |
| Flush pending exports. | |
| common::VoidResult | shutdown () override |
| Shutdown the exporter. | |
| std::unordered_map< std::string, std::size_t > | get_stats () const override |
| Get exporter statistics. | |
| otlp_exporter_stats | get_detailed_stats () const |
| Get detailed statistics. | |
| bool | is_running () const |
| Check if exporter is running. | |
| const otlp_grpc_config & | config () const |
| Get configuration. | |
Public Member Functions inherited from kcenon::monitoring::trace_exporter_interface | |
| virtual | ~trace_exporter_interface ()=default |
Private Member Functions | |
| common::Result< grpc_response > | send_with_retry (const grpc_request &request) |
Static Private Member Functions | |
| static bool | is_retryable_error (int status_code) |
| static std::pair< std::string, uint16_t > | parse_endpoint (const std::string &endpoint) |
Private Attributes | |
| otlp_grpc_config | config_ |
| std::unique_ptr< grpc_transport > | transport_ |
| std::atomic< bool > | running_ {false} |
| std::atomic< std::size_t > | exported_spans_ {0} |
| std::atomic< std::size_t > | dropped_spans_ {0} |
| std::atomic< std::size_t > | failed_exports_ {0} |
| std::atomic< std::size_t > | retries_ {0} |
| std::mutex | stats_mutex_ |
| std::chrono::microseconds | total_export_time_ {0} |
OTLP gRPC trace exporter.
Exports trace spans to an OpenTelemetry-compatible backend via gRPC. Implements batching, retry with exponential backoff, and async export.
Definition at line 380 of file otlp_grpc_exporter.h.
|
inlineexplicit |
Construct with configuration.
| config | Exporter configuration |
Definition at line 397 of file otlp_grpc_exporter.h.
|
inline |
Construct with configuration and custom transport.
| config | Exporter configuration |
| transport | Custom gRPC transport (for testing) |
Definition at line 405 of file otlp_grpc_exporter.h.
|
inline |
|
inlineoverridevirtual |
Export a batch of spans.
| spans | Spans to export |
Implements kcenon::monitoring::trace_exporter_interface.
Definition at line 438 of file otlp_grpc_exporter.h.
References kcenon::monitoring::grpc_request::body, config_, kcenon::monitoring::otlp_span_converter::convert_to_otlp(), dropped_spans_, exported_spans_, failed_exports_, kcenon::monitoring::otlp_grpc_config::headers, kcenon::monitoring::grpc_request::metadata, kcenon::monitoring::grpc_request::method, kcenon::monitoring::network_error, kcenon::monitoring::operation_failed, kcenon::monitoring::otlp_grpc_config::resource_attributes, send_with_retry(), kcenon::monitoring::grpc_request::service, kcenon::monitoring::otlp_grpc_config::service_name, kcenon::monitoring::otlp_grpc_config::service_version, stats_mutex_, kcenon::monitoring::grpc_request::timeout, kcenon::monitoring::otlp_grpc_config::timeout, kcenon::monitoring::error_info::to_common_error(), total_export_time_, and transport_.
Referenced by TEST_F(), TEST_F(), TEST_F(), and TEST_F().


|
inlineoverridevirtual |
Flush pending exports.
Implements kcenon::monitoring::trace_exporter_interface.
Definition at line 499 of file otlp_grpc_exporter.h.
|
inline |
Get detailed statistics.
Definition at line 528 of file otlp_grpc_exporter.h.
References dropped_spans_, kcenon::monitoring::otlp_exporter_stats::export_failures, exported_spans_, failed_exports_, kcenon::monitoring::otlp_exporter_stats::retries, retries_, kcenon::monitoring::otlp_exporter_stats::spans_dropped, kcenon::monitoring::otlp_exporter_stats::spans_exported, stats_mutex_, kcenon::monitoring::otlp_exporter_stats::total_export_time, and total_export_time_.
Referenced by TEST_F().

|
inlineoverridevirtual |
Get exporter statistics.
Implements kcenon::monitoring::trace_exporter_interface.
Definition at line 516 of file otlp_grpc_exporter.h.
References dropped_spans_, exported_spans_, failed_exports_, and retries_.
Referenced by TEST_F(), TEST_F(), and TEST_F().

|
inlinestaticprivate |
Definition at line 601 of file otlp_grpc_exporter.h.
Referenced by send_with_retry().

|
inline |
Check if exporter is running.
Definition at line 543 of file otlp_grpc_exporter.h.
References running_.
Referenced by TEST_F().

|
inlinestaticprivate |
Definition at line 609 of file otlp_grpc_exporter.h.
References kcenon::monitoring::host.
Referenced by start().

|
inlineprivate |
Definition at line 555 of file otlp_grpc_exporter.h.
References config_, kcenon::monitoring::otlp_grpc_config::initial_backoff, is_retryable_error(), kcenon::monitoring::otlp_grpc_config::max_backoff, kcenon::monitoring::otlp_grpc_config::max_retry_attempts, kcenon::monitoring::operation_failed, retries_, and transport_.
Referenced by export_spans().


|
inlineoverridevirtual |
Shutdown the exporter.
Implements kcenon::monitoring::trace_exporter_interface.
Definition at line 507 of file otlp_grpc_exporter.h.
References running_, and transport_.
Referenced by TEST_F().

|
inline |
Start the exporter.
Definition at line 414 of file otlp_grpc_exporter.h.
References config_, kcenon::monitoring::otlp_grpc_config::endpoint, kcenon::monitoring::host, parse_endpoint(), running_, transport_, and kcenon::monitoring::otlp_grpc_config::validate().
Referenced by TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().


|
private |
Definition at line 382 of file otlp_grpc_exporter.h.
Referenced by config(), export_spans(), send_with_retry(), and start().
|
private |
Definition at line 386 of file otlp_grpc_exporter.h.
Referenced by export_spans(), get_detailed_stats(), and get_stats().
|
private |
Definition at line 385 of file otlp_grpc_exporter.h.
Referenced by export_spans(), get_detailed_stats(), and get_stats().
|
private |
Definition at line 387 of file otlp_grpc_exporter.h.
Referenced by export_spans(), get_detailed_stats(), and get_stats().
|
private |
Definition at line 388 of file otlp_grpc_exporter.h.
Referenced by get_detailed_stats(), get_stats(), and send_with_retry().
|
private |
Definition at line 384 of file otlp_grpc_exporter.h.
Referenced by is_running(), shutdown(), and start().
|
private |
Definition at line 389 of file otlp_grpc_exporter.h.
Referenced by export_spans(), and get_detailed_stats().
|
private |
Definition at line 390 of file otlp_grpc_exporter.h.
Referenced by export_spans(), and get_detailed_stats().
|
private |
Definition at line 383 of file otlp_grpc_exporter.h.
Referenced by export_spans(), send_with_retry(), shutdown(), and start().