Skip to content

Commit

Permalink
Log method variants to Scuba as a normvector
Browse files Browse the repository at this point in the history
Summary: Normvectors simplify operations like "any", "all" while being independent of order and case. They are a perfect fit for most vectors and sets.

Reviewed By: RajivTS

Differential Revision: D68889115

fbshipit-source-id: dd2451b15346c33bea3fd5ca1a90a11a0f6f1fe0
  • Loading branch information
andreacampi authored and facebook-github-bot committed Jan 30, 2025
1 parent 8e75975 commit a11578d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions eden/mononoke/git_server/src/model/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ impl GitMethodInfo {
variants.join(",")
}

pub fn variants_to_string_vector(&self) -> Vec<String> {
let mut variants = self
.variants
.iter()
.map(|v| v.to_string())
.collect::<Vec<String>>();
variants.sort();
variants
}

pub fn standard(repo: String, method: GitMethod) -> Self {
Self {
repo,
Expand Down
4 changes: 4 additions & 0 deletions eden/mononoke/git_server/src/scuba.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ impl ScubaHandler for MononokeGitScubaHandler {
MononokeGitScubaKey::MethodVariants,
info.variants_to_string(),
);
scuba.add(
MononokeGitScubaKey::MethodVariants,
info.variants_to_string_vector(),
);
}

if let Some(ctx) = self.request_context {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,15 @@
"poll_time_us": *, (glob)
"poll_count": *, (glob)
"poll_time_us": *, (glob)

# Verify the method variants in scuba as a normvector
$ jq .normvector.method_variants "$SCUBA"
[
"standard"
]
[
"standard"
]
[
"standard"
]

0 comments on commit a11578d

Please sign in to comment.