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

Configuration for OTLP gRPC exporter. More...

#include <otlp_grpc_exporter.h>

Collaboration diagram for kcenon::monitoring::otlp_grpc_config:
Collaboration graph

Public Member Functions

common::VoidResult validate () const
 Validate configuration.
 

Public Attributes

std::string endpoint = "localhost:4317"
 OTLP receiver endpoint.
 
std::chrono::milliseconds timeout {10000}
 Request timeout.
 
std::chrono::milliseconds batch_timeout {5000}
 Batch export timeout.
 
std::size_t max_batch_size = 512
 Maximum spans per batch.
 
std::size_t max_queue_size = 2048
 Maximum queued spans.
 
std::size_t max_retry_attempts = 3
 Maximum retry attempts.
 
std::chrono::milliseconds initial_backoff {100}
 Initial retry backoff.
 
std::chrono::milliseconds max_backoff {10000}
 Maximum retry backoff.
 
bool use_tls = false
 Enable TLS.
 
std::string certificate_path
 TLS certificate path.
 
std::string service_name = "monitoring_system"
 Service name.
 
std::string service_version = "2.0.0"
 Service version.
 
std::unordered_map< std::string, std::string > headers
 Custom headers.
 
std::unordered_map< std::string, std::string > resource_attributes
 Resource attributes.
 

Detailed Description

Configuration for OTLP gRPC exporter.

Examples
otlp_export_example.cpp.

Definition at line 41 of file otlp_grpc_exporter.h.

Member Function Documentation

◆ validate()

common::VoidResult kcenon::monitoring::otlp_grpc_config::validate ( ) const
inline

Validate configuration.

Definition at line 60 of file otlp_grpc_exporter.h.

60 {
61 if (endpoint.empty()) {
62 return common::VoidResult::err(error_info(
64 "OTLP endpoint cannot be empty",
65 "otlp_grpc_config"
66 ).to_common_error());
67 }
68 if (timeout.count() <= 0) {
69 return common::VoidResult::err(error_info(
71 "Timeout must be positive",
72 "otlp_grpc_config"
73 ).to_common_error());
74 }
75 if (max_batch_size == 0) {
76 return common::VoidResult::err(error_info(
78 "Batch size must be greater than 0",
79 "otlp_grpc_config"
80 ).to_common_error());
81 }
82 return common::ok();
83 }
std::string endpoint
OTLP receiver endpoint.
std::size_t max_batch_size
Maximum spans per batch.
std::chrono::milliseconds timeout
Request timeout.

References endpoint, kcenon::monitoring::invalid_configuration, max_batch_size, and timeout.

Referenced by kcenon::monitoring::otlp_grpc_exporter::start(), and TEST_F().

Here is the caller graph for this function:

Member Data Documentation

◆ batch_timeout

std::chrono::milliseconds kcenon::monitoring::otlp_grpc_config::batch_timeout {5000}

Batch export timeout.

Examples
otlp_export_example.cpp.

Definition at line 44 of file otlp_grpc_exporter.h.

44{5000};

Referenced by create_otlp_config().

◆ certificate_path

std::string kcenon::monitoring::otlp_grpc_config::certificate_path

TLS certificate path.

Definition at line 51 of file otlp_grpc_exporter.h.

◆ endpoint

std::string kcenon::monitoring::otlp_grpc_config::endpoint = "localhost:4317"

◆ headers

std::unordered_map<std::string, std::string> kcenon::monitoring::otlp_grpc_config::headers

◆ initial_backoff

std::chrono::milliseconds kcenon::monitoring::otlp_grpc_config::initial_backoff {100}

Initial retry backoff.

Examples
otlp_export_example.cpp.

Definition at line 48 of file otlp_grpc_exporter.h.

48{100};

Referenced by create_otlp_config(), kcenon::monitoring::otlp_grpc_exporter::send_with_retry(), and TEST_F().

◆ max_backoff

std::chrono::milliseconds kcenon::monitoring::otlp_grpc_config::max_backoff {10000}

Maximum retry backoff.

Examples
otlp_export_example.cpp.

Definition at line 49 of file otlp_grpc_exporter.h.

49{10000};

Referenced by create_otlp_config(), and kcenon::monitoring::otlp_grpc_exporter::send_with_retry().

◆ max_batch_size

std::size_t kcenon::monitoring::otlp_grpc_config::max_batch_size = 512

Maximum spans per batch.

Examples
otlp_export_example.cpp.

Definition at line 45 of file otlp_grpc_exporter.h.

Referenced by create_otlp_config(), demonstrate_batch_export(), TEST_F(), and validate().

◆ max_queue_size

std::size_t kcenon::monitoring::otlp_grpc_config::max_queue_size = 2048

Maximum queued spans.

Examples
otlp_export_example.cpp.

Definition at line 46 of file otlp_grpc_exporter.h.

Referenced by create_otlp_config().

◆ max_retry_attempts

std::size_t kcenon::monitoring::otlp_grpc_config::max_retry_attempts = 3

Maximum retry attempts.

Examples
otlp_export_example.cpp.

Definition at line 47 of file otlp_grpc_exporter.h.

Referenced by create_otlp_config(), kcenon::monitoring::otlp_grpc_exporter::send_with_retry(), and TEST_F().

◆ resource_attributes

std::unordered_map<std::string, std::string> kcenon::monitoring::otlp_grpc_config::resource_attributes

Resource attributes.

Examples
otlp_export_example.cpp.

Definition at line 55 of file otlp_grpc_exporter.h.

Referenced by create_otlp_config(), and kcenon::monitoring::otlp_grpc_exporter::export_spans().

◆ service_name

std::string kcenon::monitoring::otlp_grpc_config::service_name = "monitoring_system"

◆ service_version

std::string kcenon::monitoring::otlp_grpc_config::service_version = "2.0.0"

◆ timeout

std::chrono::milliseconds kcenon::monitoring::otlp_grpc_config::timeout {10000}

Request timeout.

Examples
otlp_export_example.cpp.

Definition at line 43 of file otlp_grpc_exporter.h.

43{10000};

Referenced by create_otlp_config(), kcenon::monitoring::otlp_grpc_exporter::export_spans(), TEST_F(), and validate().

◆ use_tls

bool kcenon::monitoring::otlp_grpc_config::use_tls = false

Enable TLS.

Examples
otlp_export_example.cpp.

Definition at line 50 of file otlp_grpc_exporter.h.

Referenced by create_otlp_config(), and TEST_F().


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