Add a few more events to the structured logger

This commit is contained in:
Jonathan Kelley committed 2025-08-11 15:32:43 -07:00
1 parent 9a98abe5ad
commit 82f3778558
3 files changed
+41 -3

No files matched your search

+34 -2
View File
@@ -834,6 +834,8 @@ impl BuildRequest {
} }
pub(crate) async fn build(&self, ctx: &BuildContext) -> Result<BuildArtifacts> { pub(crate) async fn build(&self, ctx: &BuildContext) -> Result<BuildArtifacts> {
let time_start = SystemTime::now();
// If we forget to do this, then we won't get the linker args since rust skips the full build // If we forget to do this, then we won't get the linker args since rust skips the full build
// We need to make sure to not react to this though, so the filemap must cache it // We need to make sure to not react to this though, so the filemap must cache it
_ = self.bust_fingerprint(ctx); _ = self.bust_fingerprint(ctx);
@@ -887,6 +889,28 @@ impl BuildRequest {
artifacts.patch_cache = Some(Arc::new(self.create_patch_cache(&artifacts.exe).await?)); artifacts.patch_cache = Some(Arc::new(self.create_patch_cache(&artifacts.exe).await?));
} }
// Calculate some final metadata for logging
let time_taken = SystemTime::now()
.duration_since(time_start)
.map(|d| d.as_millis())
.unwrap_or_default();
tracing::debug!(
telemetry = %serde_json::json!({
"event": "build_and_bundle_complete",
"time_taken": time_taken,
"mode": match ctx.mode {
BuildMode::Base { .. } => "base",
BuildMode::Fat => "fat",
BuildMode::Thin { .. } => "thin",
},
"blah": 123,
"triple": self.triple.to_string(),
"format": self.bundle.to_string(),
"num_dependencies": self.workspace.krates.len(),
}),
"Build completed in {time_taken}ms",
);
Ok(artifacts) Ok(artifacts)
} }
@@ -1511,7 +1535,11 @@ impl BuildRequest {
if !res.stderr.is_empty() { if !res.stderr.is_empty() {
let errs = String::from_utf8_lossy(&res.stderr); let errs = String::from_utf8_lossy(&res.stderr);
if !self.patch_exe(artifacts.time_start).exists() || !res.status.success() { if !self.patch_exe(artifacts.time_start).exists() || !res.status.success() {
tracing::error!("Failed to generate patch: {}", errs.trim()); tracing::error!(
telemetry = %serde_json::json!({ "event": "hotpatch_linker_failed" }),
"Failed to generate patch: {}",
errs.trim()
);
} else { } else {
tracing::trace!("Linker output during thin linking: {}", errs.trim()); tracing::trace!("Linker output during thin linking: {}", errs.trim());
} }
@@ -2029,7 +2057,11 @@ impl BuildRequest {
if !res.stderr.is_empty() { if !res.stderr.is_empty() {
let errs = String::from_utf8_lossy(&res.stderr); let errs = String::from_utf8_lossy(&res.stderr);
if !res.status.success() { if !res.status.success() {
tracing::error!("Failed to generate fat binary: {}", errs.trim()); tracing::error!(
telemetry = %serde_json::json!({ "event": "hotpatch_fat_binary_generation_failed" }),
"Failed to generate fat binary: {}",
errs.trim()
);
} else { } else {
tracing::trace!("Warnings during fat linking: {}", errs.trim()); tracing::trace!("Warnings during fat linking: {}", errs.trim());
} }
+6 -1
View File
@@ -57,7 +57,12 @@ impl RunArgs {
_ = builder _ = builder
.open(&bundle, &mut devserver) .open(&bundle, &mut devserver)
.await .await
.inspect_err(|e| tracing::error!("Failed to open app: {}", e)); .inspect_err(|e| {
tracing::error!(
telemetry = %serde_json::json!({ "event": "failed_to_open_app_run" }),
"Failed to open app: {e}"
);
});
if bundle_format == BundleFormat::Web { if bundle_format == BundleFormat::Web {
tracing::info!( tracing::info!(
+1
View File
@@ -111,6 +111,7 @@ impl WasmOpt {
if !res.status.success() { if !res.status.success() {
let err = String::from_utf8_lossy(&res.stderr); let err = String::from_utf8_lossy(&res.stderr);
tracing::error!( tracing::error!(
telemetry = %serde_json::json!({ "event": "wasm_opt_failed" }),
"wasm-opt failed with status code {}\nstderr: {}\nstdout: {}", "wasm-opt failed with status code {}\nstderr: {}\nstdout: {}",
res.status, res.status,
err, err,