about summary refs log tree commit diff
path: root/tvix/castore/src/fs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-04-15T11·05+0300
committerflokli <flokli@flokli.de>2024-04-15T13·23+0000
commit34d9d54aae4b5ff2b6a231ca986c987568a03bda (patch)
tree57b4604ca3dae60a59663bd3a7a403cbfe5e5101 /tvix/castore/src/fs
parentff5835008f0dfc256ae3690dea773cf47f65ba17 (diff)
fix(tvix/castore/fs): use record to add fields to current span r/7918
Instead of creating another child span, we can use
`tracing::Span::current().record(k,v)` to add an additional field to the
current span.

Change-Id: I337faac0e73a0da6eb0a52cb75c2e8c026eff774
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11428
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/castore/src/fs')
-rw-r--r--tvix/castore/src/fs/mod.rs30
1 files changed, 11 insertions, 19 deletions
diff --git a/tvix/castore/src/fs/mod.rs b/tvix/castore/src/fs/mod.rs
index 3f8a211cc399..3113d1e384ea 100644
--- a/tvix/castore/src/fs/mod.rs
+++ b/tvix/castore/src/fs/mod.rs
@@ -12,6 +12,12 @@ pub mod virtiofs;
 #[cfg(test)]
 mod tests;
 
+pub use self::root_nodes::RootNodes;
+use self::{
+    file_attr::{gen_file_attr, ROOT_FILE_ATTR},
+    inode_tracker::InodeTracker,
+    inodes::{DirectoryInodeData, InodeData},
+};
 use crate::proto as castorepb;
 use crate::{
     blobservice::{BlobReader, BlobService},
@@ -39,14 +45,7 @@ use tokio::{
     io::{AsyncReadExt, AsyncSeekExt},
     sync::mpsc,
 };
-use tracing::{debug, info_span, instrument, warn};
-
-pub use self::root_nodes::RootNodes;
-use self::{
-    file_attr::{gen_file_attr, ROOT_FILE_ATTR},
-    inode_tracker::InodeTracker,
-    inodes::{DirectoryInodeData, InodeData},
-};
+use tracing::{debug, instrument, warn, Span};
 
 /// This implements a read-only FUSE filesystem for a tvix-store
 /// with the passed [BlobService], [DirectoryService] and [RootNodes].
@@ -359,9 +358,7 @@ where
         // We already know that inode 42 must be a directory.
         let (parent_digest, children) = self.get_directory_children(parent)?;
 
-        let span = info_span!("lookup", directory.digest = %parent_digest);
-        let _enter = span.enter();
-
+        Span::current().record("directory.digest", parent_digest.to_string());
         // Search for that name in the list of children and return the FileAttrs.
 
         // in the children, find the one with the desired name.
@@ -507,9 +504,7 @@ where
 
         // Non root-node case: lookup the children, or return an error if it's not a directory.
         let (parent_digest, children) = self.get_directory_children(inode)?;
-
-        let span = info_span!("lookup", directory.digest = %parent_digest);
-        let _enter = span.enter();
+        Span::current().record("directory.digest", parent_digest.to_string());
 
         for (i, (ino, child_node)) in children.iter().skip(offset as usize).enumerate() {
             // the second parameter will become the "offset" parameter on the next call.
@@ -623,9 +618,7 @@ where
 
         // Non root-node case: lookup the children, or return an error if it's not a directory.
         let (parent_digest, children) = self.get_directory_children(inode)?;
-
-        let span = info_span!("lookup", directory.digest = %parent_digest);
-        let _enter = span.enter();
+        Span::current().record("directory.digest", parent_digest.to_string());
 
         for (i, (ino, child_node)) in children.iter().skip(offset as usize).enumerate() {
             let inode_data: InodeData = child_node.into();
@@ -709,8 +702,7 @@ where
                 Err(io::Error::from_raw_os_error(libc::EISDIR))
             }
             InodeData::Regular(ref blob_digest, _blob_size, _) => {
-                let span = info_span!("read", blob.digest = %blob_digest);
-                let _enter = span.enter();
+                Span::current().record("blob.digest", blob_digest.to_string());
 
                 match self.tokio_handle.block_on({
                     let blob_service = self.blob_service.clone();