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

Storage configuration. More...

#include <storage_backends.h>

Collaboration diagram for kcenon::monitoring::storage_config:
Collaboration graph

Public Member Functions

common::Result< bool > validate () const
 Validate configuration.
 

Public Attributes

storage_backend_type type {storage_backend_type::memory_buffer}
 
std::string path
 
std::string data_directory
 
compression_algorithm compression {compression_algorithm::none}
 
size_t max_size_mb {100}
 
bool auto_flush {true}
 
std::chrono::milliseconds flush_interval {std::chrono::milliseconds(5000)}
 
size_t max_capacity {1000}
 
size_t batch_size {100}
 
std::string table_name
 
std::string host
 
uint16_t port {0}
 
std::string database_name
 
std::string username
 
std::string password
 

Detailed Description

Storage configuration.

Examples
basic_monitoring_example.cpp, production_monitoring_example.cpp, and storage_example.cpp.

Definition at line 56 of file storage_backends.h.

Member Function Documentation

◆ validate()

common::Result< bool > kcenon::monitoring::storage_config::validate ( ) const
inline

Validate configuration.

Returns
common::Result<bool> indicating validation success or failure

Definition at line 79 of file storage_backends.h.

79 {
80 // Memory buffer doesn't require path
82 if (path.empty() && host.empty()) {
83 return common::Result<bool>::err(error_info(monitoring_error_code::invalid_configuration, "Path or host required for non-memory storage").to_common_error());
84 }
85 }
86
87 if (max_capacity == 0) {
88 return common::Result<bool>::err(error_info(monitoring_error_code::invalid_capacity, "Capacity must be greater than 0").to_common_error());
89 }
90
91 if (batch_size == 0) {
92 return common::Result<bool>::err(error_info(monitoring_error_code::invalid_configuration, "Batch size must be greater than 0").to_common_error());
93 }
94
96 return common::Result<bool>::err(error_info(monitoring_error_code::invalid_configuration, "Batch size cannot exceed capacity").to_common_error());
97 }
98
99 return common::ok(true);
100 }

References batch_size, host, kcenon::monitoring::invalid_capacity, kcenon::monitoring::invalid_configuration, max_capacity, kcenon::monitoring::memory_buffer, path, and type.

Referenced by TEST_F().

Here is the caller graph for this function:

Member Data Documentation

◆ auto_flush

bool kcenon::monitoring::storage_config::auto_flush {true}

Definition at line 62 of file storage_backends.h.

62{true};

◆ batch_size

size_t kcenon::monitoring::storage_config::batch_size {100}

Definition at line 67 of file storage_backends.h.

67{100};

Referenced by TEST_F(), and validate().

◆ compression

compression_algorithm kcenon::monitoring::storage_config::compression {compression_algorithm::none}

◆ data_directory

std::string kcenon::monitoring::storage_config::data_directory
Examples
storage_example.cpp.

Definition at line 59 of file storage_backends.h.

Referenced by main().

◆ database_name

std::string kcenon::monitoring::storage_config::database_name

Definition at line 71 of file storage_backends.h.

Referenced by TEST_F().

◆ flush_interval

std::chrono::milliseconds kcenon::monitoring::storage_config::flush_interval {std::chrono::milliseconds(5000)}

Definition at line 63 of file storage_backends.h.

63{std::chrono::milliseconds(5000)};

◆ host

std::string kcenon::monitoring::storage_config::host

Definition at line 69 of file storage_backends.h.

Referenced by TEST_F(), and validate().

◆ max_capacity

◆ max_size_mb

size_t kcenon::monitoring::storage_config::max_size_mb {100}

Definition at line 61 of file storage_backends.h.

61{100};

◆ password

std::string kcenon::monitoring::storage_config::password

Definition at line 73 of file storage_backends.h.

Referenced by TEST_F().

◆ path

◆ port

uint16_t kcenon::monitoring::storage_config::port {0}

Definition at line 70 of file storage_backends.h.

70{0};

Referenced by TEST_F().

◆ table_name

std::string kcenon::monitoring::storage_config::table_name

Definition at line 68 of file storage_backends.h.

Referenced by kcenon::monitoring::create_database_storage(), and TEST_F().

◆ type

◆ username

std::string kcenon::monitoring::storage_config::username

Definition at line 72 of file storage_backends.h.

Referenced by TEST_F().


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