Skip to content

Commit

Permalink
feat(js): Record scraping hosts in transaction (#1205)
Browse files Browse the repository at this point in the history
  • Loading branch information
loewenheim authored Jun 14, 2023
1 parent ef897f3 commit c944568
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 21 deletions.
41 changes: 21 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/symbolicator-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 14 additions & 0 deletions crates/symbolicator-service/src/services/sourcemap_lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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("<unknown>"));
});

let mut remote_file = HttpRemoteFile::from_url(url.to_owned());
remote_file.headers.extend(
self.scraping
Expand All @@ -763,6 +776,7 @@ impl ArtifactFetcher {
.fetch_file(&self.scope, remote_file)
.await;

transaction.finish();
CachedFileEntry {
uri,
entry: scraped_file.map(|contents| {
Expand Down

0 comments on commit c944568

Please sign in to comment.