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 be61cb8 commit 4c88c66
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changes/force-ipc-span-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 spans to have no parent.
4 changes: 2 additions & 2 deletions src/android/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ fn handle_request(
if let Some(handler) = REQUEST_HANDLER.get() {
#[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();

let mut request_builder = Request::builder();

Expand Down Expand Up @@ -309,7 +309,7 @@ pub unsafe fn ipc(mut env: JNIEnv, _: JClass, url: JString, body: JString) {
match (env.get_string(&url), env.get_string(&body)) {
(Ok(url), Ok(body)) => {
#[cfg(feature = "tracing")]
let _span = tracing::info_span!("wry::ipc::handle").entered();
let _span = tracing::info_span!(parent: None, "wry::ipc::handle").entered();

let url = url.to_string_lossy().to_string();
let body = body.to_string_lossy().to_string();
Expand Down
2 changes: 1 addition & 1 deletion src/webkitgtk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,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
3 changes: 1 addition & 2 deletions src/webkitgtk/web_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +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();
let span = 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/webview2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ impl InnerWebView {
};

#[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(Request::builder().uri(url).body(js).unwrap());

Ok(())
Expand Down Expand Up @@ -785,7 +785,7 @@ impl InnerWebView {
};

#[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();

// Request uri
Expand Down
4 changes: 2 additions & 2 deletions src/wkwebview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,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 @@ -179,7 +179,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 webview_id = *this.get_ivar::<u32>("webview_id");

Expand Down

0 comments on commit 4c88c66

Please sign in to comment.