24#include <unordered_map>
97class metrics_provider;
160 auto name() const -> std::string_view
override {
return "temperature"; }
161 auto collect() -> std::vector<metric>
override;
162 auto interval() const -> std::chrono::milliseconds
override {
return std::chrono::seconds(5); }
169 .description =
"Hardware temperature metrics from thermal sensors",
173 .requires_platform_support =
true
210 const std::string& unit =
"")
const;
Pure virtual interface for metric collector plugins.
Hardware temperature monitoring collector implementing collector_plugin interface.
std::unique_ptr< temperature_info_collector > collector_
auto name() const -> std::string_view override
Get the unique name of this plugin.
void shutdown() override
Shutdown plugin and release resources.
std::atomic< size_t > collection_count_
temperature_collector & operator=(const temperature_collector &)=delete
temperature_collector(temperature_collector &&)=delete
bool is_thermal_available() const
auto get_metric_types() const -> std::vector< std::string > override
Get supported metric types.
std::vector< temperature_reading > get_last_readings() const
std::vector< temperature_reading > last_readings_
auto interval() const -> std::chrono::milliseconds override
Get the collection interval for this plugin.
std::atomic< size_t > collection_errors_
std::atomic< size_t > sensors_found_
auto collect() -> std::vector< metric > override
Collect current metrics from this plugin.
void add_sensor_metrics(std::vector< metric > &metrics, const temperature_reading &reading)
~temperature_collector() override=default
auto get_metadata() const -> plugin_metadata override
Get plugin metadata.
metric create_metric(const std::string &name, double value, const temperature_reading &reading, const std::string &unit="") const
auto initialize(const config_map &config) -> bool override
Initialize plugin with configuration.
temperature_collector & operator=(temperature_collector &&)=delete
temperature_collector(const temperature_collector &)=delete
auto get_statistics() const -> stats_map override
Get plugin statistics.
auto is_available() const -> bool override
Check if this plugin is available on the current system.
Temperature data collector using platform abstraction layer.
std::vector< temperature_sensor_info > enumerate_sensors()
~temperature_info_collector()
temperature_info_collector(temperature_info_collector &&)=delete
temperature_info_collector(const temperature_info_collector &)=delete
temperature_info_collector & operator=(const temperature_info_collector &)=delete
std::vector< temperature_reading > read_all_temperatures()
temperature_info_collector()
std::unique_ptr< platform::metrics_provider > provider_
bool is_thermal_available() const
temperature_info_collector & operator=(temperature_info_collector &&)=delete
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.
std::string sensor_type_to_string(sensor_type type)
Convert sensor_type to string representation.
@ hardware
Hardware sensors (GPU, temperature, battery, power)
std::unordered_map< std::string, std::string > config_map
Type alias for configuration map.
sensor_type
Type of temperature sensor.
@ gpu
GPU temperature sensor.
@ motherboard
Motherboard/chipset sensor.
@ other
Other sensor type.
@ unknown
Unknown sensor type.
@ cpu
CPU temperature sensor.
@ storage
Storage device sensor.
@ ambient
Ambient/case temperature.
@ platform
Platform/system power domain.
@ cpu
CPU power domain (RAPL)
Basic metric structure for interface compatibility.
A single temperature reading from a sensor.
double critical_threshold_celsius
Critical temperature threshold (if available)
std::chrono::system_clock::time_point timestamp
Reading timestamp.
bool thresholds_available
Whether thresholds are available.
double warning_threshold_celsius
Warning threshold (if available)
bool is_warning
True if temperature exceeds warning threshold.
double temperature_celsius
Current temperature in Celsius.
temperature_sensor_info sensor
Sensor information.
bool is_critical
True if temperature exceeds critical threshold.
Information about a temperature sensor.
sensor_type type
Sensor type classification.
std::string zone_path
Platform-specific path (e.g., /sys/class/thermal/thermal_zone0)
std::string id
Unique sensor identifier.
std::string name
Human-readable sensor name.