Browse Source

detection step in matric service and update of t_from \ t_to

pull/85/head
Alexey Velikiy 2 years ago
parent
commit
6b44428586
  1. 5
      server/src/services/analytic_service/detection_runner.rs
  2. 7
      server/src/services/metric_service.rs

5
server/src/services/analytic_service/detection_runner.rs

@ -7,7 +7,6 @@ use crate::services::metric_service::MetricService;
use super::types::{AnalyticServiceMessage, AnalyticUnitRF, DetectionRunnerConfig, ResponseType};
use tokio::time::{sleep, Duration};
const DETECTION_STEP: u64 = 10;
pub struct DetectionRunner {
metric_service: MetricService,
@ -50,7 +49,9 @@ impl DetectionRunner {
// TODO: define window for detection
// TODO: handle case when detection is in the end and continues after "now"
// TODO: update t_from / t_to
let window_size = au.as_ref().read().await.get_detection_window();
let detection_step = ms.get_detection_step();
let mut t_from = from - window_size;
let mut t_to = from;
@ -88,6 +89,8 @@ impl DetectionRunner {
}
sleep(Duration::from_secs(cfg.interval)).await;
t_from += detection_step;
t_to += detection_step;
}
}
}));

7
server/src/services/metric_service.rs

@ -32,4 +32,11 @@ impl MetricService {
}
return Ok(mr);
}
// TODO: it a hack for DetectionRunner: it should vary for different analytic units
// and it's config
pub fn get_detection_step(&self) -> u64 {
return 10;
}
}

Loading…
Cancel
Save