|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Thread-safe time series data storage. More...
#include <time_series.h>

Public Member Functions | |
| common::VoidResult | add_point (double value, std::chrono::system_clock::time_point timestamp=std::chrono::system_clock::now()) |
| Add a data point. | |
| common::VoidResult | add_points (const std::vector< time_point_data > &points) |
| Add multiple data points. | |
| common::Result< aggregation_result > | query (const time_series_query &query) const |
| Query data for a time range. | |
| size_t | size () const |
| Get current number of data points. | |
| bool | empty () const |
| Check if series is empty. | |
| const std::string & | name () const noexcept |
| Get series name. | |
| const time_series_config & | get_config () const noexcept |
| Get configuration. | |
| void | clear () |
| Clear all data. | |
| common::Result< double > | get_latest_value () const |
| Get latest value. | |
| size_t | memory_footprint () const |
| Get memory footprint in bytes. | |
Static Public Member Functions | |
| static common::Result< std::unique_ptr< time_series > > | create (const std::string &name, const time_series_config &config={}) |
| Factory method to create time_series with validation. | |
Private Member Functions | |
| void | cleanup_old_data () |
| Cleanup old data points. | |
| void | compress_data () |
| Compress data if enabled. | |
| void | enforce_size_limit () |
| Ensure data size doesn't exceed maximum. | |
| time_series (const std::string &name, const time_series_config &config) | |
| Private constructor (use create() factory method) | |
Private Attributes | |
| std::mutex | mutex_ |
| std::vector< time_point_data > | data_ |
| time_series_config | config_ |
| std::string | series_name_ |
| size_t | insertion_count_ = 0 |
Thread-safe time series data storage.
Definition at line 209 of file time_series.h.
|
inlineprivate |
Private constructor (use create() factory method)
Definition at line 282 of file time_series.h.
References config_, data_, and kcenon::monitoring::time_series_config::max_points.
Referenced by memory_footprint().

|
inline |
Add a data point.
Definition at line 308 of file time_series.h.
References cleanup_old_data(), compress_data(), data_, enforce_size_limit(), insertion_count_, mutex_, and kcenon::monitoring::time_point_data::timestamp.

|
inline |
Add multiple data points.
Definition at line 342 of file time_series.h.
References cleanup_old_data(), compress_data(), data_, enforce_size_limit(), and mutex_.

|
inlineprivate |
Cleanup old data points.
Definition at line 220 of file time_series.h.
References config_, data_, and kcenon::monitoring::time_series_config::retention_period.
Referenced by add_point(), and add_points().

|
inline |
|
inlineprivate |
Compress data if enabled.
Definition at line 234 of file time_series.h.
References kcenon::monitoring::time_series_config::compression_threshold, config_, data_, and kcenon::monitoring::time_series_config::enable_compression.
Referenced by add_point(), and add_points().

|
inlinestatic |
Factory method to create time_series with validation.
Definition at line 291 of file time_series.h.
Referenced by demonstrate_aggregations(), demonstrate_basic_operations(), demonstrate_batch_operations(), demonstrate_retention_and_downsampling(), kcenon::monitoring::metric_storage::get_or_create_series(), TEST_F(), and TEST_F().

|
inline |
|
inlineprivate |
Ensure data size doesn't exceed maximum.
Definition at line 272 of file time_series.h.
References config_, data_, and kcenon::monitoring::time_series_config::max_points.
Referenced by add_point(), and add_points().

|
inlinenoexcept |
|
inline |
Get latest value.
Definition at line 476 of file time_series.h.
References kcenon::monitoring::collection_failed, data_, and mutex_.
|
inline |
Get memory footprint in bytes.
Definition at line 491 of file time_series.h.
References data_, mutex_, series_name_, and time_series().

|
inlinenoexcept |
|
inline |
Query data for a time range.
Definition at line 370 of file time_series.h.
References data_, kcenon::monitoring::invalid_argument, kcenon::monitoring::time_point_data::merge(), mutex_, kcenon::monitoring::aggregation_result::points, query(), kcenon::monitoring::aggregation_result::query_end, kcenon::monitoring::aggregation_result::query_start, kcenon::monitoring::time_point_data::timestamp, kcenon::monitoring::error_info::to_common_error(), and kcenon::monitoring::aggregation_result::total_samples.
Referenced by query().


|
inline |
|
private |
Definition at line 213 of file time_series.h.
Referenced by cleanup_old_data(), compress_data(), enforce_size_limit(), get_config(), and time_series().
|
private |
Definition at line 212 of file time_series.h.
Referenced by add_point(), add_points(), cleanup_old_data(), clear(), compress_data(), empty(), enforce_size_limit(), get_latest_value(), memory_footprint(), query(), size(), and time_series().
|
private |
Definition at line 215 of file time_series.h.
Referenced by add_point().
|
mutableprivate |
Definition at line 211 of file time_series.h.
Referenced by add_point(), add_points(), clear(), empty(), get_latest_value(), memory_footprint(), query(), and size().
|
private |
Definition at line 214 of file time_series.h.
Referenced by memory_footprint(), and name().