Skip to content

Commit df69525

Browse files
authored
feat(tracing): IPC and custom protocol spans should not have a parent (#1248)
1 parent 80c83db commit df69525

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

.changes/force-ipc-parent-none.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"wry": patch
3+
---
4+
5+
Force the IPC and custom protocol tracing span to have no parent.

src/webview/webkitgtk/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl InnerWebView {
9090
// Connect before registering as recommended by the docs
9191
manager.connect_script_message_received(None, move |_m, msg| {
9292
#[cfg(feature = "tracing")]
93-
let _span = tracing::info_span!("wry::ipc::handle").entered();
93+
let _span = tracing::info_span!(parent: None, "wry::ipc::handle").entered();
9494

9595
if let Some(js) = msg.js_value() {
9696
if let Some(ipc_handler) = &ipc_handler {

src/webview/webkitgtk/web_context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ where
289289
context.register_uri_scheme(name, move |request| {
290290
#[cfg(feature = "tracing")]
291291
let span =
292-
tracing::info_span!("wry::custom_protocol::handle", uri = tracing::field::Empty).entered();
292+
tracing::info_span!(parent: None, "wry::custom_protocol::handle", uri = tracing::field::Empty).entered();
293293

294294
if let Some(uri) = request.uri() {
295295
let uri = uri.as_str();

src/webview/webview2/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ window.addEventListener('mousemove', (e) => window.chrome.webview.postMessage('_
359359

360360
if let Some(ipc_handler) = &ipc_handler {
361361
#[cfg(feature = "tracing")]
362-
let _span = tracing::info_span!("wry::ipc::handle").entered();
362+
let _span = tracing::info_span!(parent: None, "wry::ipc::handle").entered();
363363
ipc_handler(&window, js);
364364
}
365365
}
@@ -518,7 +518,7 @@ window.addEventListener('mousemove', (e) => window.chrome.webview.postMessage('_
518518
&WebResourceRequestedEventHandler::create(Box::new(move |_, args| {
519519
#[cfg(feature = "tracing")]
520520
let span =
521-
tracing::info_span!("wry::custom_protocol::handle", uri = tracing::field::Empty)
521+
tracing::info_span!(parent: None, "wry::custom_protocol::handle", uri = tracing::field::Empty)
522522
.entered();
523523
if let Some(args) = args {
524524
let webview_request = args.Request()?;

src/webview/wkwebview/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl InnerWebView {
9494
// Safety: objc runtime calls are unsafe
9595
unsafe {
9696
#[cfg(feature = "tracing")]
97-
let _span = tracing::info_span!("wry::ipc::handle").entered();
97+
let _span = tracing::info_span!(parent: None, "wry::ipc::handle").entered();
9898

9999
let function = this.get_ivar::<*mut c_void>("function");
100100
if !function.is_null() {
@@ -122,7 +122,7 @@ impl InnerWebView {
122122
extern "C" fn start_task(this: &Object, _: Sel, _webview: id, task: id) {
123123
unsafe {
124124
#[cfg(feature = "tracing")]
125-
let span = tracing::info_span!("wry::custom_protocol::handle", uri = tracing::field::Empty)
125+
let span = tracing::info_span!(parent: None, "wry::custom_protocol::handle", uri = tracing::field::Empty)
126126
.entered();
127127
let function = this.get_ivar::<*mut c_void>("function");
128128
if !function.is_null() {

0 commit comments

Comments
 (0)