Browse Source

perf: skip large `Window` and `AppHandle` fields on traces (#8318)

* perf: Skip large Window and AppHandle fields on traces

These contain large fields like image buffers, causing spans/events to be very large when serialized.

Especially the `window::emit::eval` one which is in a hot code path.

* fix: MSRV issues
Robin van Boven 1 year ago
parent
commit
c4b5df12bb
3 changed files with 5 additions and 2 deletions
  1. 3 0
      .github/workflows/test-core.yml
  2. 1 1
      core/tauri/src/plugin.rs
  3. 1 1
      core/tauri/src/window.rs

+ 3 - 0
.github/workflows/test-core.yml

@@ -115,6 +115,9 @@ jobs:
           cargo update -p bstr --precise 1.6.2
           cargo update -p backtrace --precise 0.3.68
           cargo update -p blocking --precise 1.4.1
+          cargo update -p ignore --precise 0.4.18
+          cargo update -p regex --precise 1.9.6
+          cargo update -p globset --precise 0.4.13
 
       - name: test
         run: cargo test --target ${{ matrix.platform.target }} ${{ matrix.features.args }}

+ 1 - 1
core/tauri/src/plugin.rs

@@ -664,7 +664,7 @@ impl<R: Runtime> PluginStore<R> {
   }
 }
 
-#[cfg_attr(feature = "tracing", tracing::instrument(name = "plugin::hooks::initialize", skip(plugin), fields(name = plugin.name())))]
+#[cfg_attr(feature = "tracing", tracing::instrument(name = "plugin::hooks::initialize", skip(plugin, app), fields(name = plugin.name())))]
 fn initialize<R: Runtime>(
   plugin: &mut Box<dyn Plugin<R>>,
   app: &AppHandle<R>,

+ 1 - 1
core/tauri/src/window.rs

@@ -1804,7 +1804,7 @@ impl<R: Runtime> Window<R> {
 
   #[cfg_attr(feature = "tracing", tracing::instrument(
     "window::emit::eval",
-    skip(emit_args),
+    skip(self, emit_args),
     fields(
       event = emit_args.event,
       source_window = emit_args.source_window_label,