Collect simple stats about engine usage (#5823)

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-03-18 16:19:24 +13:00
committed by GitHub
parent 0688ce7fe9
commit 988a068d6d
8 changed files with 67 additions and 7 deletions

View File

@ -16,7 +16,7 @@ use kittycad_modeling_cmds::{self as kcmc};
use tokio::sync::RwLock;
use uuid::Uuid;
use super::ExecutionKind;
use super::{EngineStats, ExecutionKind};
use crate::{
errors::KclError,
exec::DefaultPlanes,
@ -32,6 +32,7 @@ pub struct EngineConnection {
execution_kind: Arc<RwLock<ExecutionKind>>,
/// The default planes for the scene.
default_planes: Arc<RwLock<Option<DefaultPlanes>>>,
stats: EngineStats,
}
impl EngineConnection {
@ -42,6 +43,7 @@ impl EngineConnection {
artifact_commands: Arc::new(RwLock::new(Vec::new())),
execution_kind: Default::default(),
default_planes: Default::default(),
stats: Default::default(),
})
}
}
@ -60,6 +62,10 @@ impl crate::engine::EngineManager for EngineConnection {
Arc::new(RwLock::new(IndexMap::new()))
}
fn stats(&self) -> &EngineStats {
&self.stats
}
fn artifact_commands(&self) -> Arc<RwLock<Vec<ArtifactCommand>>> {
self.artifact_commands.clone()
}