You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Investigate how debug files are currently uploaded via chunk uploading. In particular, we should focus on determining which logic is specific to debug files, and which logic is general to chunk uploading.
Document the results in this issue. This will inform #2194.
Investigation results
This diagram summarizes the general process for chunk uploading.
The process for debug files specifically starts with the sentry-cli debug-files upload command, defined here.
The happy code path then calls this function to perform the upload. If chunk uploading is supported by the server, we proceed to the upload_difs_chunked function to perform the upload.
upload_difs_chunked
The first several lines of upload_difs_chunked perform logic specific to uploading debug files. This logic is not really related to chunk uploading.
// Only if DIFs were missing, poll until assembling is complete
let(missing_difs, _) = missing_info;
if !missing_difs.is_empty(){
poll_dif_assemble(&missing_difs, options)
}else{
println!(
"{} Nothing to upload, all files are on the server",
style(">").dim()
);
Ok((Default::default(),false))
}
In the above code snippet, we essentially check whether all of the chunks are on the server by calling the Dif assemble endpoint, then we upload any missing chunks. It is worth looking separately at the try_assemble_difs and upload_missing_chunks functions.
try_assemble_difs
The purpose of try_assemble_difs is to call the dif assemble endpoint to determine which, if any, debug files and chunks need to be uploaded because they are missing from the server.
We first perform the API call to the assemble endpoint:
Next, we iterate through all of the files in the response to find the missing difs and the missing chunks. If the file errored or is still assembling, we add the file to the list of missing difs, but we don't add any of the chunks to the list of missing chunks (since the chunks are on the server). If the dif is not found, we add all of the chunks that are missing to the missing chunks list, and we add the dif to the missing difs list (unless there are no missing chunks, e.g. in case of an empty file). For difs that have neither errored, are not assembling, and which are not in a not found state, we assume the file is successfully uploaded.
If so, we call upload_chunks to perform the actual upload. Since upload_chunks is already generalized to chunks of any type (not specific to debug files), we don't need to investigate its internal workings.
Investigate how debug files are currently uploaded via chunk uploading. In particular, we should focus on determining which logic is specific to debug files, and which logic is general to chunk uploading.
Document the results in this issue. This will inform #2194.
Investigation results
This diagram summarizes the general process for chunk uploading.
The process for debug files specifically starts with the
sentry-cli debug-files upload
command, defined here.The happy code path then calls this function to perform the upload. If chunk uploading is supported by the server, we proceed to the
upload_difs_chunked
function to perform the upload.upload_difs_chunked
The first several lines of
upload_difs_chunked
perform logic specific to uploading debug files. This logic is not really related to chunk uploading.sentry-cli/src/utils/dif_upload.rs
Lines 1579 to 1599 in 6d0729d
The first chunk uploading logic comes here, where we split each of the DifMatch objects into chunks. We can likely generalize this logic.
sentry-cli/src/utils/dif_upload.rs
Lines 1601 to 1604 in 6d0729d
The rest of the function combines debug file and chunk upload related logic:
sentry-cli/src/utils/dif_upload.rs
Lines 1606 to 1621 in 6d0729d
In the above code snippet, we essentially check whether all of the chunks are on the server by calling the Dif assemble endpoint, then we upload any missing chunks. It is worth looking separately at the
try_assemble_difs
andupload_missing_chunks
functions.try_assemble_difs
The purpose of
try_assemble_difs
is to call thedif
assemble endpoint to determine which, if any, debug files and chunks need to be uploaded because they are missing from the server.We first perform the API call to the assemble endpoint:
sentry-cli/src/utils/dif_upload.rs
Lines 1275 to 1281 in 99c0991
Next, we iterate through all of the files in the response to find the missing difs and the missing chunks. If the file errored or is still assembling, we add the file to the list of missing difs, but we don't add any of the chunks to the list of missing chunks (since the chunks are on the server). If the dif is not found, we add all of the chunks that are missing to the missing chunks list, and we add the dif to the missing difs list (unless there are no missing chunks, e.g. in case of an empty file). For difs that have neither errored, are not assembling, and which are not in a not found state, we assume the file is successfully uploaded.
sentry-cli/src/utils/dif_upload.rs
Lines 1294 to 1339 in 99c0991
Lastly, we return the two constructed lists:
sentry-cli/src/utils/dif_upload.rs
Line 1341 in 99c0991
try_assemble_difs
should be generalizable to file types other than debug files.upload_missing_chunks
upload_missing_chunks
is actually quite simple. We first check whether there are actually any missing chunks that we still need to upload:sentry-cli/src/utils/dif_upload.rs
Lines 1357 to 1359 in 99c0991
If so, we call
upload_chunks
to perform the actual upload. Sinceupload_chunks
is already generalized to chunks of any type (not specific to debug files), we don't need to investigate its internal workings.sentry-cli/src/utils/dif_upload.rs
Line 1369 in 99c0991
The function also contains some logic to output information about the upload and to display a progress bar.
We can likely easily generalize this code to any file type.
The text was updated successfully, but these errors were encountered: