From 9cc141e2274c8065149fb5f5ddbd3060610b51d5 Mon Sep 17 00:00:00 2001 From: Olivier Date: Sat, 8 Jan 2022 16:41:15 +0000 Subject: [PATCH] Send the requests to the loader and render them --- bare-metrics-gui/src/background_loader.rs | 5 ++++- bare-metrics-gui/src/main.rs | 12 +++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/bare-metrics-gui/src/background_loader.rs b/bare-metrics-gui/src/background_loader.rs index 972495a..3b0e07b 100644 --- a/bare-metrics-gui/src/background_loader.rs +++ b/bare-metrics-gui/src/background_loader.rs @@ -190,6 +190,7 @@ pub enum MetricsLogReaderMessage { LoadNewWindow { new_time_range: RangeInclusive, new_wanted_time_points: u32, + requests: Vec, }, } @@ -527,6 +528,7 @@ impl MetricsLogReaderManager { new_window.points.push((next_val.0, rate)); last_val = *next_val; } + new_window.summarise_in_place(); metrics_window.scalars.insert(request, new_window); } } @@ -703,6 +705,7 @@ impl MetricsLogReaderManager { MetricsLogReaderMessage::LoadNewWindow { new_time_range, new_wanted_time_points, + requests, } => { debug!( "Requested new window; time range {:?}, № points {}", @@ -755,7 +758,7 @@ impl MetricsLogReaderManager { UnixTimestampMilliseconds(start), UnixTimestampMilliseconds(end), new_wanted_time_points, - Default::default(), // TODO + requests, )?; debug!("METRIC WINDOW {:#?}", metric_window); diff --git a/bare-metrics-gui/src/main.rs b/bare-metrics-gui/src/main.rs index 85aee8b..ee91ec7 100644 --- a/bare-metrics-gui/src/main.rs +++ b/bare-metrics-gui/src/main.rs @@ -10,7 +10,7 @@ use eframe::epi::{App, Frame, Storage}; use eframe::NativeOptions; use env_logger::Env; use log::{debug, info, warn}; -use std::collections::{BTreeMap}; +use std::collections::BTreeMap; use std::fs::File; use std::path::PathBuf; use std::str::FromStr; @@ -71,6 +71,7 @@ impl App for MetricsGui { .send(MetricsLogReaderMessage::LoadNewWindow { new_time_range: f64::NEG_INFINITY..=f64::INFINITY, new_wanted_time_points: 512, + requests: Vec::with_capacity(0), }) .unwrap(); } @@ -113,6 +114,15 @@ impl MetricsGui { } else { // TODO Build some stuff automatically based on alphabetical ordering } + + self.requester + .tx + .send(MetricsLogReaderMessage::LoadNewWindow { + new_time_range: f64::NEG_INFINITY..=f64::INFINITY, + new_wanted_time_points: 512, + requests: self.graph_requests.clone(), + }) + .unwrap(); } }