improvements
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user