26#include <unordered_map>
50class metrics_provider;
84 std::unique_ptr<platform::metrics_provider>
provider_;
106 auto name() const -> std::string_view
override {
return "uptime"; }
107 auto collect() -> std::vector<metric>
override;
108 auto interval() const -> std::chrono::milliseconds
override {
return std::chrono::seconds(30); }
115 .description =
"System uptime metrics (boot time, uptime duration)",
119 .requires_platform_support =
true
Pure virtual interface for metric collector plugins.
System uptime monitoring collector implementing collector_plugin interface.
uptime_metrics last_metrics_
auto collect() -> std::vector< metric > override
Collect current metrics from this plugin.
uptime_metrics get_last_metrics() const
bool is_uptime_monitoring_available() const
std::atomic< size_t > collection_errors_
auto is_available() const -> bool override
Check if this plugin is available on the current system.
std::unique_ptr< uptime_info_collector > collector_
uptime_collector & operator=(uptime_collector &&)=delete
auto initialize(const config_map &config) -> bool override
auto get_metric_types() const -> std::vector< std::string > override
Get supported metric types.
uptime_collector & operator=(const uptime_collector &)=delete
uptime_collector(uptime_collector &&)=delete
auto get_metadata() const -> plugin_metadata override
Get plugin metadata.
std::atomic< size_t > collection_count_
auto name() const -> std::string_view override
Get the unique name of this plugin.
uptime_collector(const uptime_collector &)=delete
auto interval() const -> std::chrono::milliseconds override
Get the collection interval for this plugin.
auto get_statistics() const -> stats_map override
void add_uptime_metrics(std::vector< metric > &metrics, const uptime_metrics &uptime_data)
~uptime_collector() override=default
Uptime data collector using platform abstraction layer.
uptime_info_collector(uptime_info_collector &&)=delete
uptime_info_collector & operator=(const uptime_info_collector &)=delete
bool is_uptime_monitoring_available() const
uptime_info_collector(const uptime_info_collector &)=delete
uptime_metrics collect_metrics()
uptime_info_collector & operator=(uptime_info_collector &&)=delete
std::unique_ptr< platform::metrics_provider > provider_
Plugin interface for metric collectors.
Adapter for metric types to support interface definitions.
std::unordered_map< std::string, double > stats_map
Type alias for statistics map.
@ platform
Platform-specific (VM, uptime, interrupts)
std::unordered_map< std::string, std::string > config_map
Type alias for configuration map.
@ platform
Platform/system power domain.
Aggregated uptime metrics for the system.
std::chrono::system_clock::time_point timestamp
Reading timestamp.
double uptime_seconds
Time since boot in seconds (gauge)
int64_t boot_timestamp
Unix timestamp of last boot (gauge)
double idle_seconds
Total idle time in seconds (Linux only)
bool metrics_available
Whether metrics are available.