Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tracing): IPC and custom protocol spans should not have a parent #1248

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading