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(js): Temporarily sample failing lookups with debug ids #1607

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
130 changes: 106 additions & 24 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/symbolicator-js/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ futures = "0.3.12"
humantime = "2.1.0"
moka = { version = "0.12.8", features = ["future", "sync"] }
once_cell = "1.17.1"
rand = "0.9.0"
regex = "1.5.5"
reqwest = { workspace = true, features = [
"gzip",
Expand Down
32 changes: 31 additions & 1 deletion crates/symbolicator-js/src/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use std::fmt::{self, Write};
use std::sync::Arc;
use std::time::SystemTime;

use rand::prelude::*;
use reqwest::Url;
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
Expand Down Expand Up @@ -560,14 +561,31 @@ impl ArtifactFetcher {
CachedFileEntry,
Option<CachedFileEntry<OwnedSourceMapCache>>,
) {
let mut rng = rand::rng();

// First, check if we have already cached / created the `SourceMapCache`.
let key = FileKey::MinifiedSource { abs_path, debug_id };
let key = FileKey::MinifiedSource {
abs_path: abs_path.clone(),
debug_id,
};

// Fetch the minified file first
let minified_source = self.get_file(&key).await;
if minified_source.entry.is_err() {
self.metrics
.record_not_found(SourceFileType::Source, debug_id.is_some());

// Temporarily sample cases of a file not being found even though it has a debug id.
if let Some(debug_id) = debug_id {
if rng.random::<f64>() < 0.0001 {
tracing::error!(
source_url = %self.source.url,
abs_path,
%debug_id,
"Failed to fetch source with debug id"
);
}
}
}

// Then fetch the corresponding sourcemap reference and debug_id
Expand Down Expand Up @@ -622,6 +640,18 @@ impl ArtifactFetcher {
} else if sourcemap.entry.is_err() {
self.metrics
.record_not_found(SourceFileType::SourceMap, debug_id.is_some());

// Temporarily sample cases of a file not being found even though it has a debug id.
if let Some(debug_id) = debug_id {
if rng.random::<f64>() < 0.0001 {
tracing::error!(
source_url = %self.source.url,
abs_path,
%debug_id,
"Failed to fetch sourcemap with debug id"
);
}
}
}

// Now that we (may) have both files, we can create a `SourceMapCache` for it
Expand Down
Loading