-
Notifications
You must be signed in to change notification settings - Fork 12
Collect telemetry for upload path #34
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
base: main
Are you sure you want to change the base?
Conversation
0f05b62
to
b08974a
Compare
Get the telemetry data to the py layer. This will be sent over the telemetry endpoint later. Related to STO-7
b08974a
to
bd328fd
Compare
@@ -42,7 +42,7 @@ pub trait UploadClient { | |||
#[async_trait] | |||
pub trait ReconstructionClient { | |||
/// Get a entire file by file hash. | |||
async fn get_file(&self, hash: &MerkleHash, writer: &mut Box<dyn Write + Send>) -> Result<()>; | |||
async fn get_file(&self, hash: &MerkleHash, writer: &mut Box<dyn Write + Send>) -> Result<u64>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a comment for what this return value is, presumably amount written to writer
@@ -215,7 +215,8 @@ impl RemoteClient { | |||
.map_err(|e| CasClientError::InternalError(anyhow!("join error {e}")))??; | |||
writer.write_all(&piece)?; | |||
} | |||
Ok(total_len as usize) | |||
// Todo: return the bytes which were read from the cache for telemetry | |||
Ok(total_len as u64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this total len is the uncompressed length of the section, not the number of bytes over the network which is what I think you're attempting to track that number should be the difference in the url_range end - start for each piece.
@@ -283,29 +288,37 @@ pub(crate) async fn register_new_cas_block( | |||
cas_data.chunks.clear(); | |||
cas_data.pending_file_info.clear(); | |||
|
|||
Ok(cas_hash) | |||
Ok((cas_hash, compressed_bytes_len as u64)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: using compressed_bytes_len
from client side is unreliable, people can inject any number here and that does not impact clean process correctness.
@@ -577,13 +585,14 @@ impl Cleaner { | |||
if cas_data_accumulator.data.len() >= TARGET_CAS_BLOCK_SIZE { | |||
let mut new_cas_data = take(cas_data_accumulator.deref_mut()); | |||
drop(cas_data_accumulator); // Release the lock. | |||
register_new_cas_block( | |||
let (_cas_hash, compressed_bytes) = register_new_cas_block( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This compressed_bytes
- doesn't include all bytes produced by this file after dedup: they are also produced in
fn dedup(...)
. I noticed you modified that function but the return value is not used? - data in this
cas_data_accumulator
may also include bytes produced by other files cleaned before this file using the same PointerFileTranslator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic to count bytes produced by one file after dedup doesn't seem correct.
Get the telemetry data to the py layer. This will be sent over the telemetry endpoint later.
Related to STO-7