fix(tvix/castore/fs): use record to add fields to current span
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
This commit is contained in:
parent
ff5835008f
commit
34d9d54aae
1 changed files with 11 additions and 19 deletions
|
@ -12,6 +12,12 @@ pub mod virtiofs;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
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::proto as castorepb;
|
||||||
use crate::{
|
use crate::{
|
||||||
blobservice::{BlobReader, BlobService},
|
blobservice::{BlobReader, BlobService},
|
||||||
|
@ -39,14 +45,7 @@ use tokio::{
|
||||||
io::{AsyncReadExt, AsyncSeekExt},
|
io::{AsyncReadExt, AsyncSeekExt},
|
||||||
sync::mpsc,
|
sync::mpsc,
|
||||||
};
|
};
|
||||||
use tracing::{debug, info_span, instrument, warn};
|
use tracing::{debug, instrument, warn, Span};
|
||||||
|
|
||||||
pub use self::root_nodes::RootNodes;
|
|
||||||
use self::{
|
|
||||||
file_attr::{gen_file_attr, ROOT_FILE_ATTR},
|
|
||||||
inode_tracker::InodeTracker,
|
|
||||||
inodes::{DirectoryInodeData, InodeData},
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This implements a read-only FUSE filesystem for a tvix-store
|
/// This implements a read-only FUSE filesystem for a tvix-store
|
||||||
/// with the passed [BlobService], [DirectoryService] and [RootNodes].
|
/// with the passed [BlobService], [DirectoryService] and [RootNodes].
|
||||||
|
@ -359,9 +358,7 @@ where
|
||||||
// We already know that inode 42 must be a directory.
|
// We already know that inode 42 must be a directory.
|
||||||
let (parent_digest, children) = self.get_directory_children(parent)?;
|
let (parent_digest, children) = self.get_directory_children(parent)?;
|
||||||
|
|
||||||
let span = info_span!("lookup", directory.digest = %parent_digest);
|
Span::current().record("directory.digest", parent_digest.to_string());
|
||||||
let _enter = span.enter();
|
|
||||||
|
|
||||||
// Search for that name in the list of children and return the FileAttrs.
|
// Search for that name in the list of children and return the FileAttrs.
|
||||||
|
|
||||||
// in the children, find the one with the desired name.
|
// 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.
|
// 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 (parent_digest, children) = self.get_directory_children(inode)?;
|
||||||
|
Span::current().record("directory.digest", parent_digest.to_string());
|
||||||
let span = info_span!("lookup", directory.digest = %parent_digest);
|
|
||||||
let _enter = span.enter();
|
|
||||||
|
|
||||||
for (i, (ino, child_node)) in children.iter().skip(offset as usize).enumerate() {
|
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.
|
// 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.
|
// 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 (parent_digest, children) = self.get_directory_children(inode)?;
|
||||||
|
Span::current().record("directory.digest", parent_digest.to_string());
|
||||||
let span = info_span!("lookup", directory.digest = %parent_digest);
|
|
||||||
let _enter = span.enter();
|
|
||||||
|
|
||||||
for (i, (ino, child_node)) in children.iter().skip(offset as usize).enumerate() {
|
for (i, (ino, child_node)) in children.iter().skip(offset as usize).enumerate() {
|
||||||
let inode_data: InodeData = child_node.into();
|
let inode_data: InodeData = child_node.into();
|
||||||
|
@ -709,8 +702,7 @@ where
|
||||||
Err(io::Error::from_raw_os_error(libc::EISDIR))
|
Err(io::Error::from_raw_os_error(libc::EISDIR))
|
||||||
}
|
}
|
||||||
InodeData::Regular(ref blob_digest, _blob_size, _) => {
|
InodeData::Regular(ref blob_digest, _blob_size, _) => {
|
||||||
let span = info_span!("read", blob.digest = %blob_digest);
|
Span::current().record("blob.digest", blob_digest.to_string());
|
||||||
let _enter = span.enter();
|
|
||||||
|
|
||||||
match self.tokio_handle.block_on({
|
match self.tokio_handle.block_on({
|
||||||
let blob_service = self.blob_service.clone();
|
let blob_service = self.blob_service.clone();
|
||||||
|
|
Loading…
Add table
Reference in a new issue