Skip to content
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: 4 additions & 1 deletion crates/symbolicator-native/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ pub enum AttachmentFile {
/// The attachment has been stored on the local system already.
Local(File),
/// The attachment needs to be fetched from the remote url.
Remote(String),
Remote {
storage_url: String,
storage_token: Option<String>,
},
}

/// A request to process (stackwalk + symbolicate) a minidump.
Expand Down
15 changes: 10 additions & 5 deletions crates/symbolicator-native/src/symbolication/attachments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,24 @@ pub async fn download_attachment(
download_svc: &DownloadService,
file: AttachmentFile,
) -> anyhow::Result<File> {
let storage_url = match file {
let (storage_url, storage_token) = match file {
AttachmentFile::Local(file) => return Ok(file),
AttachmentFile::Remote(url) => url,
AttachmentFile::Remote {
storage_url,
storage_token,
} => (storage_url, storage_token),
};

// TODO: maybe its worth using the actual `DownloadService` instead of straight going to the `trusted_client`.
// Doing so would in theory allow us to have retries and error report, as well as being able to
// download files in multiple chunks concurrently, but I don’t think our `objecstore` server currently
// supports range requests, and those would also mess with streaming decompression.
// Not to mention that using the `DownloadService` is not that straight forward.
let stream = download_svc
.trusted_client
.get(storage_url)
let mut request = download_svc.trusted_client.get(storage_url);
if let Some(token) = storage_token {
request = request.bearer_auth(token);
}
let stream = request
.send()
.await?
.error_for_status()?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ async fn test_minidump_attachment_download() {
.process_minidump(ProcessMinidump {
platform: None,
scope: Scope::Global,
minidump_file: AttachmentFile::Remote(
attachment_server.url("/the_minidump.dmp").to_string(),
),
minidump_file: AttachmentFile::Remote {
storage_url: attachment_server.url("/the_minidump.dmp").to_string(),
storage_token: None,
},
sources: Arc::new([source]),
scraping: Default::default(),
rewrite_first_module: Default::default(),
Expand Down
31 changes: 21 additions & 10 deletions crates/symbolicator/src/endpoints/symbolicate_any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ pub struct SymbolicateAnyRequestBody {
pub enum SymbolicationRequest {
Minidump {
storage_url: String,
storage_token: Option<String>,
rewrite_first_module: RewriteRules,
},
AppleCrashreport {
storage_url: String,
storage_token: Option<String>,
},
// TODO: it should be possible to also support native, js and jvm requests here as well
}
Expand All @@ -60,27 +62,36 @@ pub async fn symbolicate_any(
let request_id = match body.symbolicate {
SymbolicationRequest::Minidump {
storage_url,
storage_token,
rewrite_first_module,
} => service.process_minidump(
ProcessMinidump {
platform: body.platform,
scope: params.scope,
minidump_file: AttachmentFile::Remote(storage_url),
minidump_file: AttachmentFile::Remote {
storage_url,
storage_token,
},
sources: body.sources,
scraping: body.scraping,
rewrite_first_module,
},
body.options,
)?,
SymbolicationRequest::AppleCrashreport { storage_url } => service
.process_apple_crash_report(
body.platform,
params.scope,
AttachmentFile::Remote(storage_url),
body.sources,
body.scraping,
body.options,
)?,
SymbolicationRequest::AppleCrashreport {
storage_url,
storage_token,
} => service.process_apple_crash_report(
body.platform,
params.scope,
AttachmentFile::Remote {
storage_url,
storage_token,
},
body.sources,
body.scraping,
body.options,
)?,
};

match service.get_response(request_id, params.timeout).await {
Expand Down
Loading