scs_server: add parameter logging for RepoCreateCommitParams

Summary:
We don't currently log any information about RepoCreateCommit parameters.

Start logging the parents, date, author and number of changes and deletes.

Reviewed By: farnz

Differential Revision: D25021423

fbshipit-source-id: 2723c208643e074861732a21e149c06ad47879f2
This commit is contained in:
Mark Juggurnauth-Thomas 2020-11-18 02:23:08 -08:00 committed by Facebook GitHub Bot
parent 845167c91e
commit e0857ba36f

View File

@ -34,7 +34,35 @@ impl AddScubaParams for BTreeSet<thrift::CommitIdentityScheme> {
impl AddScubaParams for thrift::ListReposParams {}
impl AddScubaParams for thrift::RepoCreateCommitParams {}
impl AddScubaParams for thrift::RepoCreateCommitParams {
fn add_scuba_params(&self, scuba: &mut ScubaSampleBuilder) {
scuba.add(
"param_parents",
self.parents
.iter()
.map(CommitIdExt::to_string)
.collect::<ScubaValue>(),
);
if let Some(date) = self.info.date.as_ref() {
scuba.add("param_date", date.timestamp);
}
scuba.add("param_author", self.info.author.as_str());
let deletes_count = self
.changes
.values()
.filter(|change| {
if let thrift::RepoCreateCommitParamsChange::deleted(_) = change {
true
} else {
false
}
})
.count();
scuba.add("param_changes_count", self.changes.len() - deletes_count);
scuba.add("param_deletes_count", deletes_count);
self.identity_schemes.add_scuba_params(scuba);
}
}
impl AddScubaParams for thrift::RepoCreateBookmarkParams {
fn add_scuba_params(&self, scuba: &mut ScubaSampleBuilder) {