mirror of
https://git.asonix.dog/asonix/pict-rs.git
synced 2024-11-25 02:51:17 +00:00
Instrument a couple more functions
This commit is contained in:
parent
3a651e65de
commit
15dc79d10e
2 changed files with 9 additions and 4 deletions
|
@ -25,7 +25,6 @@ use std::{
|
||||||
time::SystemTime,
|
time::SystemTime,
|
||||||
};
|
};
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
use tracing_awc::Propagate;
|
|
||||||
use tokio::{
|
use tokio::{
|
||||||
io::{AsyncReadExt, AsyncWriteExt},
|
io::{AsyncReadExt, AsyncWriteExt},
|
||||||
sync::{
|
sync::{
|
||||||
|
@ -35,6 +34,7 @@ use tokio::{
|
||||||
};
|
};
|
||||||
use tracing::{debug, error, info, instrument, subscriber::set_global_default, Span};
|
use tracing::{debug, error, info, instrument, subscriber::set_global_default, Span};
|
||||||
use tracing_actix_web::TracingLogger;
|
use tracing_actix_web::TracingLogger;
|
||||||
|
use tracing_awc::Propagate;
|
||||||
use tracing_error::ErrorLayer;
|
use tracing_error::ErrorLayer;
|
||||||
use tracing_futures::Instrument;
|
use tracing_futures::Instrument;
|
||||||
use tracing_log::LogTracer;
|
use tracing_log::LogTracer;
|
||||||
|
@ -485,7 +485,10 @@ async fn process(
|
||||||
prepare_process(query, ext.as_str(), &manager, &whitelist).await?;
|
prepare_process(query, ext.as_str(), &manager, &whitelist).await?;
|
||||||
|
|
||||||
// If the thumbnail doesn't exist, we need to create it
|
// 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 {
|
if e.kind() != std::io::ErrorKind::NotFound {
|
||||||
error!("Error looking up processed image, {}", e);
|
error!("Error looking up processed image, {}", e);
|
||||||
return Err(e.into());
|
return Err(e.into());
|
||||||
|
|
|
@ -150,7 +150,7 @@ impl std::fmt::Debug for UploadManager {
|
||||||
|
|
||||||
type UploadStream<E> = LocalBoxStream<'static, Result<web::Bytes, E>>;
|
type UploadStream<E> = LocalBoxStream<'static, Result<web::Bytes, E>>;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub(crate) struct Serde<T> {
|
pub(crate) struct Serde<T> {
|
||||||
inner: 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 {
|
pub(crate) struct Details {
|
||||||
width: usize,
|
width: usize,
|
||||||
height: usize,
|
height: usize,
|
||||||
|
@ -338,6 +338,7 @@ impl UploadManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the image details for a given variant
|
/// Get the image details for a given variant
|
||||||
|
#[instrument(skip(self))]
|
||||||
pub(crate) async fn variant_details(
|
pub(crate) async fn variant_details(
|
||||||
&self,
|
&self,
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
|
@ -366,6 +367,7 @@ impl UploadManager {
|
||||||
Ok(opt)
|
Ok(opt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[instrument(skip(self))]
|
||||||
pub(crate) async fn store_variant_details(
|
pub(crate) async fn store_variant_details(
|
||||||
&self,
|
&self,
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
|
|
Loading…
Reference in a new issue