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

@ -11,7 +11,7 @@ use uuid::Uuid;
use wasm_bindgen::prelude::*;
use crate::{
engine::ExecutionKind,
engine::{EngineStats, ExecutionKind},
errors::{KclError, KclErrorDetails},
execution::{ArtifactCommand, DefaultPlanes, IdGenerator},
SourceRange,
@ -45,6 +45,7 @@ pub struct EngineConnection {
execution_kind: Arc<RwLock<ExecutionKind>>,
/// The default planes for the scene.
default_planes: Arc<RwLock<Option<DefaultPlanes>>>,
stats: EngineStats,
}
// Safety: WebAssembly will only ever run in a single-threaded context.
@ -62,6 +63,7 @@ impl EngineConnection {
artifact_commands: Arc::new(RwLock::new(Vec::new())),
execution_kind: Default::default(),
default_planes: Default::default(),
stats: Default::default(),
})
}
@ -141,6 +143,10 @@ impl crate::engine::EngineManager for EngineConnection {
self.responses.clone()
}
fn stats(&self) -> &EngineStats {
&self.stats
}
fn artifact_commands(&self) -> Arc<RwLock<Vec<ArtifactCommand>>> {
self.artifact_commands.clone()
}