From c944568ddadda93fcca1a9d24c5b2b0ae2e11ac6 Mon Sep 17 00:00:00 2001 From: Sebastian Zivota Date: Wed, 14 Jun 2023 14:45:02 +0200 Subject: [PATCH] feat(js): Record scraping hosts in transaction (#1205) --- Cargo.lock | 41 ++++++++++--------- crates/symbolicator-service/Cargo.toml | 2 +- .../src/services/sourcemap_lookup.rs | 14 +++++++ 3 files changed, 36 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d1a45f875..888c06c02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3556,9 +3556,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sentry" -version = "0.31.0" +version = "0.31.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c3d7f8bf7373e75222452fcdd9347d857452a92d0eec738f941bc4656c5b5df" +checksum = "9e0bd2cbc3398be701a933e5b7357a4b6b1f94038d2054f118cba90b481a9fbe" dependencies = [ "httpdate", "native-tls", @@ -3577,9 +3577,9 @@ dependencies = [ [[package]] name = "sentry-anyhow" -version = "0.31.0" +version = "0.31.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef7f47c57a1146d553b4976f20e8bba370195a88858bdf6945a63c529549236" +checksum = "0ca1d058e1d8b7e83cf9a38b7353114623f064ac7442766619147526f3f7018a" dependencies = [ "anyhow", "sentry-backtrace", @@ -3588,9 +3588,9 @@ dependencies = [ [[package]] name = "sentry-backtrace" -version = "0.31.0" +version = "0.31.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b7cdefbdca51f1146f0f24a3cb4ecb6428951f030ff5c720cfb5c60bd174c0" +checksum = "9cf043f9bcb6c9ae084b7f10fb363a697c924badcbe7dac2dbeecea31271ed0c" dependencies = [ "backtrace", "once_cell", @@ -3600,9 +3600,9 @@ dependencies = [ [[package]] name = "sentry-contexts" -version = "0.31.0" +version = "0.31.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6af4cb29066e0e8df0cc3111211eb93543ccb09e1ccbe71de6d88b4bb459a2b1" +checksum = "16bde19e361cff463253371dbabee51dab416c6f9285d6e62106539f96d12079" dependencies = [ "hostname", "libc", @@ -3614,9 +3614,9 @@ dependencies = [ [[package]] name = "sentry-core" -version = "0.31.0" +version = "0.31.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e781b55761e47a60d1ff326ae8059de22b0e6b0cee68eab1c5912e4fb199a76" +checksum = "fe345c342f17e48b65451f424ce0848405b6b3a84fa0007ba444b84754bf760a" dependencies = [ "once_cell", "rand", @@ -3627,9 +3627,9 @@ dependencies = [ [[package]] name = "sentry-debug-images" -version = "0.31.0" +version = "0.31.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e758030b31ee2cd97424a980dfa34a12dcd8477424861cf81ae3aa1f9f616a8c" +checksum = "be9460cda9409f799f839510ff3b2ab8db6e457f3085298e18eefc463948e157" dependencies = [ "findshlibs", "once_cell", @@ -3638,9 +3638,9 @@ dependencies = [ [[package]] name = "sentry-panic" -version = "0.31.0" +version = "0.31.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0b877981990d9e84ae6916df61993d188fdf76afb59521f0aeaf9b8e6d26d0" +checksum = "063ac270f11157e435f8b133a007669a3e1a7920e23374485357a8692996188f" dependencies = [ "sentry-backtrace", "sentry-core", @@ -3648,9 +3648,9 @@ dependencies = [ [[package]] name = "sentry-tower" -version = "0.31.0" +version = "0.31.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e934c257597464ec8fb9067e44d29bd93d55056ef638931b46c80a3be8793562" +checksum = "e8f072d2c688f09d2cb55e8911aa0ae4562792d6027ea951f1f1a283b2299b22" dependencies = [ "http", "pin-project", @@ -3662,10 +3662,11 @@ dependencies = [ [[package]] name = "sentry-tracing" -version = "0.31.0" +version = "0.31.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4692bfc5bf69a8a41ccb0ce96612686eddb2406e32f7113f536efa15949af8" +checksum = "dc167b6746500ea4bb86c2c13afe7ca6f75f2ed1bcfd84243e870780b8ced529" dependencies = [ + "sentry-backtrace", "sentry-core", "tracing-core", "tracing-subscriber", @@ -3673,9 +3674,9 @@ dependencies = [ [[package]] name = "sentry-types" -version = "0.31.0" +version = "0.31.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d642a04657cc77d8de52ae7c6d93a15cb02284eb219344a89c1e2b26bbaf578c" +checksum = "62d10a5962144f5fb65bb1290551623e6b976f442cb2fcb4e1dfe9fe6f8e8df4" dependencies = [ "debugid", "getrandom", diff --git a/crates/symbolicator-service/Cargo.toml b/crates/symbolicator-service/Cargo.toml index 689d7ec30..d011369cb 100644 --- a/crates/symbolicator-service/Cargo.toml +++ b/crates/symbolicator-service/Cargo.toml @@ -37,7 +37,7 @@ once_cell = "1.17.1" parking_lot = "0.12.0" regex = "1.5.5" reqwest = { version = "0.11.0", features = ["gzip", "brotli", "deflate", "json", "stream", "trust-dns"] } -sentry = { version = "0.31.0", features = ["tracing"] } +sentry = { version = "0.31.4", features = ["tracing"] } serde = { version = "1.0.137", features = ["derive", "rc"] } serde_json = "1.0.81" serde_yaml = "0.9.14" diff --git a/crates/symbolicator-service/src/services/sourcemap_lookup.rs b/crates/symbolicator-service/src/services/sourcemap_lookup.rs index 07e648b84..fd22e59b2 100644 --- a/crates/symbolicator-service/src/services/sourcemap_lookup.rs +++ b/crates/symbolicator-service/src/services/sourcemap_lookup.rs @@ -749,6 +749,19 @@ impl ArtifactFetcher { } self.scraped_files += 1; + + let span = sentry::configure_scope(|scope| scope.get_span()); + let ctx = sentry::TransactionContext::continue_from_span( + "scrape_js_file", + "scrape_js_file", + span, + ); + let transaction = sentry::start_transaction(ctx); + sentry::configure_scope(|scope| { + scope.set_span(Some(transaction.clone().into())); + scope.set_tag("host", url.host_str().unwrap_or("")); + }); + let mut remote_file = HttpRemoteFile::from_url(url.to_owned()); remote_file.headers.extend( self.scraping @@ -763,6 +776,7 @@ impl ArtifactFetcher { .fetch_file(&self.scope, remote_file) .await; + transaction.finish(); CachedFileEntry { uri, entry: scraped_file.map(|contents| {