Skip to content

Commit

Permalink
feat(tracing): IPC and custom protocol spans should not have a parent (
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored May 9, 2024
1 parent 80c83db commit df69525
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changes/force-ipc-parent-none.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Force the IPC and custom protocol tracing span to have no parent.
2 changes: 1 addition & 1 deletion src/webview/webkitgtk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl InnerWebView {
// Connect before registering as recommended by the docs
manager.connect_script_message_received(None, move |_m, msg| {
#[cfg(feature = "tracing")]
let _span = tracing::info_span!("wry::ipc::handle").entered();
let _span = tracing::info_span!(parent: None, "wry::ipc::handle").entered();

if let Some(js) = msg.js_value() {
if let Some(ipc_handler) = &ipc_handler {
Expand Down
2 changes: 1 addition & 1 deletion src/webview/webkitgtk/web_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ where
context.register_uri_scheme(name, move |request| {
#[cfg(feature = "tracing")]
let span =
tracing::info_span!("wry::custom_protocol::handle", uri = tracing::field::Empty).entered();
tracing::info_span!(parent: None, "wry::custom_protocol::handle", uri = tracing::field::Empty).entered();

if let Some(uri) = request.uri() {
let uri = uri.as_str();
Expand Down
4 changes: 2 additions & 2 deletions src/webview/webview2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ window.addEventListener('mousemove', (e) => window.chrome.webview.postMessage('_

if let Some(ipc_handler) = &ipc_handler {
#[cfg(feature = "tracing")]
let _span = tracing::info_span!("wry::ipc::handle").entered();
let _span = tracing::info_span!(parent: None, "wry::ipc::handle").entered();
ipc_handler(&window, js);
}
}
Expand Down Expand Up @@ -518,7 +518,7 @@ window.addEventListener('mousemove', (e) => window.chrome.webview.postMessage('_
&WebResourceRequestedEventHandler::create(Box::new(move |_, args| {
#[cfg(feature = "tracing")]
let span =
tracing::info_span!("wry::custom_protocol::handle", uri = tracing::field::Empty)
tracing::info_span!(parent: None, "wry::custom_protocol::handle", uri = tracing::field::Empty)
.entered();
if let Some(args) = args {
let webview_request = args.Request()?;
Expand Down
4 changes: 2 additions & 2 deletions src/webview/wkwebview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl InnerWebView {
// Safety: objc runtime calls are unsafe
unsafe {
#[cfg(feature = "tracing")]
let _span = tracing::info_span!("wry::ipc::handle").entered();
let _span = tracing::info_span!(parent: None, "wry::ipc::handle").entered();

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

0 comments on commit df69525

Please sign in to comment.