From 15dc79d10ece542ea6cea39e388a03935a7a2cff Mon Sep 17 00:00:00 2001 From: "Aode (Lion)" Date: Sat, 25 Sep 2021 17:09:55 -0500 Subject: [PATCH] Instrument a couple more functions --- src/main.rs | 7 +++++-- src/upload_manager.rs | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 8d80686..9a87041 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,7 +25,6 @@ use std::{ time::SystemTime, }; use structopt::StructOpt; -use tracing_awc::Propagate; use tokio::{ io::{AsyncReadExt, AsyncWriteExt}, sync::{ @@ -35,6 +34,7 @@ use tokio::{ }; use tracing::{debug, error, info, instrument, subscriber::set_global_default, Span}; use tracing_actix_web::TracingLogger; +use tracing_awc::Propagate; use tracing_error::ErrorLayer; use tracing_futures::Instrument; use tracing_log::LogTracer; @@ -485,7 +485,10 @@ async fn process( prepare_process(query, ext.as_str(), &manager, &whitelist).await?; // If the thumbnail doesn't exist, we need to create it - let thumbnail_exists = if let Err(e) = tokio::fs::metadata(&thumbnail_path).await { + let thumbnail_exists = if let Err(e) = tokio::fs::metadata(&thumbnail_path) + .instrument(tracing::info_span!("Get thumbnail metadata")) + .await + { if e.kind() != std::io::ErrorKind::NotFound { error!("Error looking up processed image, {}", e); return Err(e.into()); diff --git a/src/upload_manager.rs b/src/upload_manager.rs index 393b31a..6cab900 100644 --- a/src/upload_manager.rs +++ b/src/upload_manager.rs @@ -150,7 +150,7 @@ impl std::fmt::Debug for UploadManager { type UploadStream = LocalBoxStream<'static, Result>; -#[derive(Clone)] +#[derive(Clone, Debug)] pub(crate) struct Serde { inner: T, } @@ -192,7 +192,7 @@ where } } -#[derive(Clone, serde::Deserialize, serde::Serialize)] +#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] pub(crate) struct Details { width: usize, height: usize, @@ -338,6 +338,7 @@ impl UploadManager { } /// Get the image details for a given variant + #[instrument(skip(self))] pub(crate) async fn variant_details( &self, path: PathBuf, @@ -366,6 +367,7 @@ impl UploadManager { Ok(opt) } + #[instrument(skip(self))] pub(crate) async fn store_variant_details( &self, path: PathBuf,