improvements

This commit is contained in:
2026-02-04 18:53:05 -08:00
parent 50894fd0e1
commit c22ad764e6
12 changed files with 408 additions and 305 deletions
+7 -7
View File
@@ -6,7 +6,7 @@ use tokio_util::sync::CancellationToken;
use tracing::{debug, error, info, warn};
use crate::{
ChimemonSource, ChimemonSourceChannel, MetricTags, SourceMetric, SourceReport,
ChimemonSource, ChimemonSourceChannel, MetricTags, SourceMetric, SourceMetricSet, SourceReport,
SourceReportDetails, SourceStatus, config::HwmonConfig,
};
@@ -73,14 +73,13 @@ impl SourceReportDetails for HwmonReport {
//self.alarms.iter().any(|(_sensor, alarm)| *alarm)
true
}
fn to_metrics(&self) -> Vec<SourceMetric> {
fn to_metrics(&self) -> Vec<SourceMetricSet> {
let mut metrics = Vec::new();
for (sensor, value) in &self.values {
metrics.push(SourceMetric::new_float(
"hwmon_value",
*value,
sensor.tags.clone(),
))
metrics.push(SourceMetricSet {
tags: sensor.tags.clone(),
metrics: vec![SourceMetric::new_float("hwmon_value", *value)],
})
}
// for (sensor, alarm) in &self.alarms {
// metrics.push(SourceMetric::new_bool(
@@ -105,6 +104,7 @@ impl HwmonSource {
#[async_trait]
impl ChimemonSource for HwmonSource {
type Config = HwmonConfig;
const TASK_NAME: &'static str = "hwmon-task";
fn new(name: &str, config: Self::Config) -> Self {
let sensors = config
.sensors