Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

git: Annotate more functions and blocks with tracing spans (#46642)

Jakub Konka6d3ea102eca3
diff --git a/Cargo.lock b/Cargo.lock
index 5d6cdb83cfb..afc8dd408e9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -7095,6 +7095,7 @@ dependencies = [
"urlencoding",
"util",
"uuid",
+ "ztracing",
]
[[package]]
diff --git a/crates/editor/src/git/blame.rs b/crates/editor/src/git/blame.rs
index 0546ae6143c..f8197d047d1 100644
--- a/crates/editor/src/git/blame.rs
+++ b/crates/editor/src/git/blame.rs
@@ -489,6 +489,7 @@ impl GitBlame {
}
}
+ #[ztracing::instrument(skip_all)]
fn generate(&mut self, cx: &mut Context<Self>) {
if !self.focused {
self.changed_while_blurred = true;
@@ -511,6 +512,8 @@ impl GitBlame {
let mut all_errors = Vec::new();
for buffers in buffers_to_blame.chunks(4) {
+ let span = ztracing::debug_span!("for each chunk of buffers");
+ let _enter = span.enter();
let blame = cx.update(|cx| {
buffers
.iter()
diff --git a/crates/git/Cargo.toml b/crates/git/Cargo.toml
index 0a99b0ad27a..39b68758744 100644
--- a/crates/git/Cargo.toml
+++ b/crates/git/Cargo.toml
@@ -41,6 +41,7 @@ urlencoding.workspace = true
util.workspace = true
uuid.workspace = true
futures.workspace = true
+ztracing.workspace = true
[dev-dependencies]
pretty_assertions.workspace = true
diff --git a/crates/git/src/blame.rs b/crates/git/src/blame.rs
index d6011de98b8..548aa321ffd 100644
--- a/crates/git/src/blame.rs
+++ b/crates/git/src/blame.rs
@@ -58,18 +58,22 @@ async fn run_git_blame(
contents: &Rope,
line_ending: LineEnding,
) -> Result<String> {
- let mut child = util::command::new_smol_command(git_binary)
- .current_dir(working_directory)
- .arg("blame")
- .arg("--incremental")
- .arg("--contents")
- .arg("-")
- .arg(path.as_unix_str())
- .stdin(Stdio::piped())
- .stdout(Stdio::piped())
- .stderr(Stdio::piped())
- .spawn()
- .context("starting git blame process")?;
+ let mut child = {
+ let span = ztracing::debug_span!("spawning git-blame command", path = path.as_unix_str());
+ let _enter = span.enter();
+ util::command::new_smol_command(git_binary)
+ .current_dir(working_directory)
+ .arg("blame")
+ .arg("--incremental")
+ .arg("--contents")
+ .arg("-")
+ .arg(path.as_unix_str())
+ .stdin(Stdio::piped())
+ .stdout(Stdio::piped())
+ .stderr(Stdio::piped())
+ .spawn()
+ .context("starting git blame process")?
+ };
let stdin = child
.stdin