fix: fix issue #2 - telemetry not showing in graphs
This commit is contained in:
29
src/app.rs
29
src/app.rs
@@ -422,8 +422,6 @@ pub(crate) struct App {
|
||||
pub(super) metrics_snapshot: MetricsSnapshot,
|
||||
pub(super) metrics_history: VecDeque<MetricsPoint>,
|
||||
last_http_requests: u64,
|
||||
last_kv_read_bytes: u64,
|
||||
last_kv_write_bytes: u64,
|
||||
#[cfg(target_os = "macos")]
|
||||
generation_service: Option<GenerationService>,
|
||||
#[cfg(target_os = "macos")]
|
||||
@@ -650,8 +648,6 @@ impl App {
|
||||
metrics_snapshot,
|
||||
metrics_history: VecDeque::with_capacity(120),
|
||||
last_http_requests: 0,
|
||||
last_kv_read_bytes: 0,
|
||||
last_kv_write_bytes: 0,
|
||||
#[cfg(target_os = "macos")]
|
||||
generation_service,
|
||||
#[cfg(target_os = "macos")]
|
||||
@@ -723,8 +719,6 @@ impl App {
|
||||
metrics_snapshot,
|
||||
metrics_history: VecDeque::with_capacity(120),
|
||||
last_http_requests: 0,
|
||||
last_kv_read_bytes: 0,
|
||||
last_kv_write_bytes: 0,
|
||||
#[cfg(target_os = "macos")]
|
||||
generation_service,
|
||||
#[cfg(target_os = "macos")]
|
||||
@@ -1787,23 +1781,17 @@ impl App {
|
||||
}
|
||||
|
||||
fn sample_metrics(&mut self) {
|
||||
let prefill_tokens_per_second = self.metrics.take_prefill_sample();
|
||||
let (kv_read_bytes, kv_write_bytes) = self.metrics.take_kv_io_sample();
|
||||
let snapshot = self.metrics.snapshot();
|
||||
let http_requests_per_second = snapshot
|
||||
.http_requests
|
||||
.saturating_sub(self.last_http_requests) as f32
|
||||
/ METRICS_SAMPLE_INTERVAL.as_secs_f32();
|
||||
let kv_read_bytes_per_second = snapshot
|
||||
.kv_read_bytes
|
||||
.saturating_sub(self.last_kv_read_bytes) as f32
|
||||
/ METRICS_SAMPLE_INTERVAL.as_secs_f32();
|
||||
let kv_write_bytes_per_second = snapshot
|
||||
.kv_write_bytes
|
||||
.saturating_sub(self.last_kv_write_bytes)
|
||||
as f32
|
||||
/ METRICS_SAMPLE_INTERVAL.as_secs_f32();
|
||||
let kv_read_bytes_per_second = kv_read_bytes as f32 / METRICS_SAMPLE_INTERVAL.as_secs_f32();
|
||||
let kv_write_bytes_per_second =
|
||||
kv_write_bytes as f32 / METRICS_SAMPLE_INTERVAL.as_secs_f32();
|
||||
self.last_http_requests = snapshot.http_requests;
|
||||
self.last_kv_read_bytes = snapshot.kv_read_bytes;
|
||||
self.last_kv_write_bytes = snapshot.kv_write_bytes;
|
||||
self.metrics_history.push_back(MetricsPoint {
|
||||
decode_tokens_per_second: if snapshot.phase == crate::metrics::RuntimePhase::Generating
|
||||
{
|
||||
@@ -1811,12 +1799,7 @@ impl App {
|
||||
} else {
|
||||
0.0
|
||||
},
|
||||
prefill_tokens_per_second: if snapshot.phase == crate::metrics::RuntimePhase::Prefilling
|
||||
{
|
||||
snapshot.prefill_tokens_per_second
|
||||
} else {
|
||||
0.0
|
||||
},
|
||||
prefill_tokens_per_second,
|
||||
http_requests_per_second,
|
||||
kv_read_bytes_per_second,
|
||||
kv_write_bytes_per_second,
|
||||
|
||||
Reference in New Issue
Block a user