Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: duration in seconds missing fractions #342

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions uplink/src/base/monitor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
10 changes: 5 additions & 5 deletions uplink/src/base/serializer/metrics.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -113,15 +113,15 @@ pub struct StreamMetrics {
pub compressed_data_size: usize,
#[serde(skip)]
pub serializations: u32,
#[serde_as(as = "DurationSeconds<f64>")]
#[serde_as(as = "DurationSecondsWithFrac<f64>")]
pub total_serialization_time: Duration,
#[serde_as(as = "DurationSeconds<f64>")]
#[serde_as(as = "DurationSecondsWithFrac<f64>")]
pub avg_serialization_time: Duration,
#[serde(skip)]
pub compressions: u32,
#[serde_as(as = "DurationSeconds<f64>")]
#[serde_as(as = "DurationSecondsWithFrac<f64>")]
pub total_compression_time: Duration,
#[serde_as(as = "DurationSeconds<f64>")]
#[serde_as(as = "DurationSecondsWithFrac<f64>")]
pub avg_compression_time: Duration,
}

Expand Down
Loading