From 1f5e6dbff65a061623756afd2f7374f4d05991e2 Mon Sep 17 00:00:00 2001 From: J M <2364004+Blu-J@users.noreply.github.com> Date: Mon, 20 Jun 2022 16:22:19 -0600 Subject: [PATCH] chore: Add tracing for debuging the js procedure slowness (#1552) * chore: Add tracing for debuging the js procedure slowness * chore: Make the display to reduce vertical clutter --- backend/src/procedure/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/src/procedure/mod.rs b/backend/src/procedure/mod.rs index 7e007976d..108d54012 100644 --- a/backend/src/procedure/mod.rs +++ b/backend/src/procedure/mod.rs @@ -64,6 +64,7 @@ impl PackageProcedure { allow_inject: bool, timeout: Option, ) -> Result, Error> { + tracing::trace!("Procedure execute {} {} - {:?}", self, pkg_id, name); match self { PackageProcedure::Docker(procedure) => { procedure @@ -106,6 +107,7 @@ impl PackageProcedure { timeout: Option, name: ProcedureName, ) -> Result, Error> { + tracing::trace!("Procedure sandboxed {} {} - {:?}", self, pkg_id, name); match self { PackageProcedure::Docker(procedure) => { procedure @@ -122,6 +124,15 @@ impl PackageProcedure { } } +impl std::fmt::Display for PackageProcedure { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + PackageProcedure::Docker(_) => write!(f, "Docker")?, + PackageProcedure::Script(_) => write!(f, "JS")?, + } + Ok(()) + } +} #[derive(Debug)] pub struct NoOutput; impl<'de> Deserialize<'de> for NoOutput {