From 4c5482b3a8fc48dbad0ea2b07756193f756e5fb2 Mon Sep 17 00:00:00 2001 From: "Aode (lion)" Date: Wed, 13 Oct 2021 20:31:40 -0500 Subject: [PATCH] Add more instrumentation --- src/magick.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/magick.rs b/src/magick.rs index 40fc55c..eb04ee9 100644 --- a/src/magick.rs +++ b/src/magick.rs @@ -18,6 +18,7 @@ pub(crate) enum ValidInputType { Webp, } +#[derive(Debug)] pub(crate) struct Details { pub(crate) mime_type: mime::Mime, pub(crate) width: usize, @@ -30,6 +31,7 @@ pub(crate) fn clear_metadata_bytes_read(input: Bytes) -> std::io::Result Result { let process = Process::run( "magick", @@ -133,6 +135,7 @@ fn parse_details(s: std::borrow::Cow<'_, str>) -> Result { }) } +#[instrument(name = "Getting input type from bytes", skip(input))] pub(crate) async fn input_type_bytes(input: Bytes) -> Result { details_bytes(input).await?.validate_input() } @@ -158,6 +161,7 @@ pub(crate) fn process_image_file_read( } impl Details { + #[instrument(name = "Validating input type")] fn validate_input(&self) -> Result { if self.width > crate::CONFIG.max_width() || self.height > crate::CONFIG.max_height() { return Err(UploadError::Dimensions.into());