Instrument a couple more functions

This commit is contained in:
Aode (Lion) 2021-09-25 17:09:55 -05:00
parent 3a651e65de
commit 15dc79d10e
2 changed files with 9 additions and 4 deletions

View file

@ -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());

View file

@ -150,7 +150,7 @@ impl std::fmt::Debug for UploadManager {
type UploadStream<E> = LocalBoxStream<'static, Result<web::Bytes, E>>;
#[derive(Clone)]
#[derive(Clone, Debug)]
pub(crate) struct Serde<T> {
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,