Skip to content

Commit

Permalink
ods: publish number of uploaded bytes to CAS
Browse files Browse the repository at this point in the history
Summary:
ods: publish number of uploaded bytes to CAS

this is required for better tracking of amount of data uploaded

Reviewed By: lmvasquezg

Differential Revision: D60715769

fbshipit-source-id: 00eadc090cd9c4bf9607dee906d45865e0d64dd8
  • Loading branch information
Liubov Dmitrieva authored and facebook-github-bot committed Aug 4, 2024
1 parent c82ee1a commit 9d9af78
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions eden/mononoke/cas_client/client/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,8 @@ impl<'a> CasClient for DummyCasClient<'a> {
) -> Result<Vec<MononokeDigest>, Error> {
Ok(digests.to_vec())
}

fn repo_name(&self) -> &str {
"dummy"
}
}
2 changes: 2 additions & 0 deletions eden/mononoke/cas_client/client/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ pub trait CasClient: Sync + Send {
&self,
digests: &'a [MononokeDigest],
) -> Result<Vec<MononokeDigest>, Error>;
/// Get the name of the repo this client is for.
fn repo_name(&self) -> &str;
}
3 changes: 3 additions & 0 deletions eden/mononoke/cas_client/scm_client/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ define_stats! {
prefix = "mononoke.cas_client";
uploaded_manifests_count: timeseries(Rate, Sum),
uploaded_files_count: timeseries(Rate, Sum),
uploaded_bytes: dynamic_histogram("{}.uploaded_bytes", (repo_name: String); 1_500_000, 0, 150_000_000, Average, Sum, Count; P 5; P 25; P 50; P 75; P 95; P 97; P 99),
}

const MAX_CONCURRENT_UPLOADS_TREES: usize = 200;
Expand Down Expand Up @@ -94,6 +95,7 @@ where
self.client.streaming_upload_blob(&digest, stream).await?;
}
STATS::uploaded_files_count.add_value(1);
STATS::uploaded_bytes.add_value(digest.1 as i64, (self.client.repo_name().to_string(),));
Ok(UploadOutcome::Uploaded(digest.1))
}

Expand Down Expand Up @@ -254,6 +256,7 @@ where
.await?;
}
STATS::uploaded_manifests_count.add_value(1);
STATS::uploaded_bytes.add_value(digest.1 as i64, (self.client.repo_name().to_string(),));
Ok(UploadOutcome::Uploaded(digest.1))
}

Expand Down

0 comments on commit 9d9af78

Please sign in to comment.