mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 14:28:17 +03:00
instrument streaming clone
Summary: instrument streaming clone with client request info Reviewed By: mitrandir77 Differential Revision: D50927546 fbshipit-source-id: c7e1ce4f5e0d352ebc26f843a29bb0395eeb3202
This commit is contained in:
parent
0d01b7cd18
commit
c0d5868531
@ -13,6 +13,7 @@ blake2 = "0.10"
|
||||
blobstore = { version = "0.1.0", path = "../blobstore" }
|
||||
borrowed = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
|
||||
clap = { version = "4.3.5", features = ["derive", "env", "string", "unicode", "wrap_help"] }
|
||||
clientinfo = { version = "0.1.0", path = "../../scm/lib/clientinfo" }
|
||||
context = { version = "0.1.0", path = "../server/context" }
|
||||
facet = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
|
||||
fbinit = { version = "0.1.2", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
|
||||
|
@ -24,5 +24,6 @@ rust_binary(
|
||||
"//eden/mononoke/repo_attributes/repo_identity:repo_identity",
|
||||
"//eden/mononoke/repo_client:streaming_clone",
|
||||
"//eden/mononoke/server/context:context",
|
||||
"//eden/scm/lib/clientinfo:clientinfo",
|
||||
],
|
||||
)
|
||||
|
@ -22,6 +22,8 @@ use clap::builder::NonEmptyStringValueParser;
|
||||
use clap::Args;
|
||||
use clap::Parser;
|
||||
use clap::Subcommand;
|
||||
use clientinfo::ClientEntryPoint;
|
||||
use clientinfo::ClientInfo;
|
||||
use context::CoreContext;
|
||||
use fbinit::FacebookInit;
|
||||
use futures::future;
|
||||
@ -166,7 +168,11 @@ fn build_context(
|
||||
logger.new(o!("repo" => repo.repo_identity().name().to_string()))
|
||||
};
|
||||
|
||||
CoreContext::new_with_logger(fb, logger)
|
||||
CoreContext::new_with_logger_and_client_info(
|
||||
fb,
|
||||
logger,
|
||||
ClientInfo::default_with_entry_point(ClientEntryPoint::StreamingClone),
|
||||
)
|
||||
}
|
||||
|
||||
// Returns how many chunks were inserted
|
||||
|
@ -131,6 +131,7 @@ pub enum ClientEntryPoint {
|
||||
MononokeHgSync,
|
||||
CurlTest,
|
||||
MirrorHgCommits,
|
||||
StreamingClone,
|
||||
}
|
||||
|
||||
impl ClientRequestInfo {
|
||||
@ -204,6 +205,7 @@ impl Display for ClientEntryPoint {
|
||||
ClientEntryPoint::MononokeHgSync => "hg_sync",
|
||||
ClientEntryPoint::CurlTest => "curl_test",
|
||||
ClientEntryPoint::MirrorHgCommits => "mirror_hg_commits",
|
||||
ClientEntryPoint::StreamingClone => "streaming_clone",
|
||||
};
|
||||
write!(f, "{}", out)
|
||||
}
|
||||
@ -236,6 +238,7 @@ impl TryFrom<&str> for ClientEntryPoint {
|
||||
"hg_sync" => Ok(ClientEntryPoint::MononokeHgSync),
|
||||
"curl_test" => Ok(ClientEntryPoint::CurlTest),
|
||||
"mirror_hg_commits" => Ok(ClientEntryPoint::MirrorHgCommits),
|
||||
"streaming_clone" => Ok(ClientEntryPoint::StreamingClone),
|
||||
_ => Err(anyhow!("Invalid client entry point")),
|
||||
}
|
||||
}
|
||||
@ -375,5 +378,10 @@ mod tests {
|
||||
Some(ClientEntryPoint::MirrorHgCommits),
|
||||
ClientEntryPoint::try_from(ClientEntryPoint::MirrorHgCommits.to_string().as_ref()).ok()
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
Some(ClientEntryPoint::StreamingClone),
|
||||
ClientEntryPoint::try_from(ClientEntryPoint::StreamingClone.to_string().as_ref()).ok()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user