From 17a2e71a5ab5d18a8197819931b4e02bd709db3c Mon Sep 17 00:00:00 2001 From: Devdutt Shenoi Date: Thu, 9 May 2024 15:45:28 +0530 Subject: [PATCH] fix: duration in seconds missing fractions --- uplink/src/base/monitor/mod.rs | 2 ++ uplink/src/base/serializer/metrics.rs | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/uplink/src/base/monitor/mod.rs b/uplink/src/base/monitor/mod.rs index d3bf75318..41612ab90 100644 --- a/uplink/src/base/monitor/mod.rs +++ b/uplink/src/base/monitor/mod.rs @@ -80,7 +80,9 @@ impl Monitor { continue; } serializer_stream_metrics.push(o); + dbg!(&serializer_stream_metrics); let v = serde_json::to_string(&serializer_stream_metrics).unwrap(); + dbg!(&v); serializer_stream_metrics.clear(); self.client.publish(&serializer_stream_metrics_topic, QoS::AtLeastOnce, false, v).await.unwrap(); } diff --git a/uplink/src/base/serializer/metrics.rs b/uplink/src/base/serializer/metrics.rs index 9b1f67a65..12eea18aa 100644 --- a/uplink/src/base/serializer/metrics.rs +++ b/uplink/src/base/serializer/metrics.rs @@ -1,7 +1,7 @@ use std::time::Duration; use serde::Serialize; -use serde_with::{serde_as, DurationSeconds}; +use serde_with::{serde_as, DurationSecondsWithFrac}; use crate::base::clock; @@ -113,15 +113,15 @@ pub struct StreamMetrics { pub compressed_data_size: usize, #[serde(skip)] pub serializations: u32, - #[serde_as(as = "DurationSeconds")] + #[serde_as(as = "DurationSecondsWithFrac")] pub total_serialization_time: Duration, - #[serde_as(as = "DurationSeconds")] + #[serde_as(as = "DurationSecondsWithFrac")] pub avg_serialization_time: Duration, #[serde(skip)] pub compressions: u32, - #[serde_as(as = "DurationSeconds")] + #[serde_as(as = "DurationSecondsWithFrac")] pub total_compression_time: Duration, - #[serde_as(as = "DurationSeconds")] + #[serde_as(as = "DurationSecondsWithFrac")] pub avg_compression_time: Duration, }