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

measure and log poc durations #451

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions src/beaconer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,13 @@ impl Beaconer {
&self,
packet: PacketUp,
) -> Result<poc_lora::LoraWitnessReportReqV1> {
let mut total_duration = Duration::new(0, 0);
let start = Instant::now();
let mut report = poc_lora::LoraWitnessReportReqV1::try_from(packet)?;
report.pub_key = self.keypair.public_key().to_vec();
report.signature = sign(self.keypair.clone(), report.encode_to_vec()).await?;
total_duration += start.elapsed();
info!("signing took {:?}", total_duration);
Ok(report)
}

Expand Down Expand Up @@ -252,11 +256,15 @@ impl Beaconer {
match tokio::try_join!(report_fut, service_fut) {
Ok((report, mut poc_service)) => {
let beacon_id = report.data.to_b64();
let mut total_duration = Duration::new(0, 0);
let start = Instant::now();
let _ = poc_service
.submit_witness(report)
.inspect_err(|err| warn!(beacon_id, %err, "submit poc witness report"))
.inspect_ok(|_| info!(beacon_id, "poc witness report submitted"))
.await;
total_duration += start.elapsed();
info!("poc submission took {:?}", total_duration);
}
Err(err) => {
warn!(%err, "poc witness report");
Expand Down