diff --git a/crates/backend/src/opendal.rs b/crates/backend/src/opendal.rs index ce022f3df..a948218dd 100644 --- a/crates/backend/src/opendal.rs +++ b/crates/backend/src/opendal.rs @@ -235,6 +235,7 @@ impl ReadBackend for OpenDALBackend { impl WriteBackend for OpenDALBackend { /// Create a repository on the backend. + #[tracing::instrument(skip(self))] fn create(&self) -> Result<()> { trace!("creating repo at {:?}", self.location()); diff --git a/crates/backend/src/rclone.rs b/crates/backend/src/rclone.rs index b8556088f..46d854d8b 100644 --- a/crates/backend/src/rclone.rs +++ b/crates/backend/src/rclone.rs @@ -127,6 +127,7 @@ impl RcloneBackend { /// /// If the rclone command is not found. // TODO: This should be an error, not a panic. + #[tracing::instrument(skip(url))] pub fn new(url: impl AsRef, options: HashMap) -> Result { let rclone_command = options.get("rclone-command"); let use_password = options diff --git a/crates/backend/src/rest.rs b/crates/backend/src/rest.rs index ad03feb5e..3acf86564 100644 --- a/crates/backend/src/rest.rs +++ b/crates/backend/src/rest.rs @@ -245,6 +245,7 @@ impl ReadBackend for RestBackend { /// A vector of tuples containing the id and size of the files. /// /// [`RestErrorKind::JoiningUrlFailed`]: RestErrorKind::JoiningUrlFailed + #[tracing::instrument(skip(self))] fn list_with_size(&self, tpe: FileType) -> Result> { // format which is delivered by the REST-service #[derive(Deserialize)] @@ -313,6 +314,7 @@ impl ReadBackend for RestBackend { /// * [`RestErrorKind::BackoffError`] - If the backoff failed. /// /// [`RestErrorKind::BackoffError`]: RestErrorKind::BackoffError + #[tracing::instrument(skip(self))] fn read_full(&self, tpe: FileType, id: &Id) -> Result { trace!("reading tpe: {tpe:?}, id: {id}"); let url = self.url(tpe, id)?; @@ -346,6 +348,7 @@ impl ReadBackend for RestBackend { /// * [`RestErrorKind::BackoffError`] - If the backoff failed. /// /// [`RestErrorKind::BackoffError`]: RestErrorKind::BackoffError + #[tracing::instrument(skip(self, _cacheable))] fn read_partial( &self, tpe: FileType, @@ -383,6 +386,7 @@ impl WriteBackend for RestBackend { /// * [`RestErrorKind::BackoffError`] - If the backoff failed. /// /// [`RestErrorKind::BackoffError`]: RestErrorKind::BackoffError + #[tracing::instrument(skip(self))] fn create(&self) -> Result<()> { let url = self .url @@ -413,6 +417,7 @@ impl WriteBackend for RestBackend { /// * [`RestErrorKind::BackoffError`] - If the backoff failed. /// /// [`RestErrorKind::BackoffError`]: RestErrorKind::BackoffError + #[tracing::instrument(skip(self, _cacheable))] fn write_bytes(&self, tpe: FileType, id: &Id, _cacheable: bool, buf: Bytes) -> Result<()> { trace!("writing tpe: {:?}, id: {}", &tpe, &id); let req_builder = self.client.post(self.url(tpe, id)?).body(buf); @@ -441,6 +446,7 @@ impl WriteBackend for RestBackend { /// * [`RestErrorKind::BackoffError`] - If the backoff failed. /// /// [`RestErrorKind::BackoffError`]: RestErrorKind::BackoffError + #[tracing::instrument(skip(self, _cacheable))] fn remove(&self, tpe: FileType, id: &Id, _cacheable: bool) -> Result<()> { trace!("removing tpe: {:?}, id: {}", &tpe, &id); let url = self.url(tpe, id)?; diff --git a/crates/core/src/archiver.rs b/crates/core/src/archiver.rs index 486ee411c..0254b13da 100644 --- a/crates/core/src/archiver.rs +++ b/crates/core/src/archiver.rs @@ -121,6 +121,7 @@ impl<'a, BE: DecryptFullBackend, I: ReadGlobalIndex> Archiver<'a, BE, I> { /// [`PackerErrorKind::SendingCrossbeamMessageFailed`]: crate::error::PackerErrorKind::SendingCrossbeamMessageFailed /// [`CryptBackendErrorKind::SerializingToJsonByteVectorFailed`]: crate::error::CryptBackendErrorKind::SerializingToJsonByteVectorFailed /// [`SnapshotFileErrorKind::OutOfRange`]: crate::error::SnapshotFileErrorKind::OutOfRange + #[tracing::instrument(skip(self, src, p))] pub fn archive( mut self, src: &R, diff --git a/crates/core/src/backend/decrypt.rs b/crates/core/src/backend/decrypt.rs index e90d6f86d..207050472 100644 --- a/crates/core/src/backend/decrypt.rs +++ b/crates/core/src/backend/decrypt.rs @@ -161,6 +161,7 @@ pub trait DecryptReadBackend: ReadBackend + Clone + 'static { /// # Errors /// /// If the files could not be read. + #[tracing::instrument(skip(self, p))] fn stream_list(&self, list: &[Id], p: &impl Progress) -> StreamResult { p.set_length(list.len() as u64); let (tx, rx) = unbounded(); @@ -279,6 +280,7 @@ pub trait DecryptWriteBackend: WriteBackend + Clone + 'static { /// # Errors /// /// * [`CryptBackendErrorKind::SerializingToJsonByteVectorFailed`] - If the file could not be serialized to json. + #[tracing::instrument(skip(self, list, p))] fn save_list<'a, F: RepoFile, I: ExactSizeIterator + Send>( &self, list: I, @@ -306,6 +308,7 @@ pub trait DecryptWriteBackend: WriteBackend + Clone + 'static { /// # Panics /// /// If the files could not be deleted. + #[tracing::instrument(skip(self, list, p))] fn delete_list<'a, ID: RepoId, I: ExactSizeIterator + Send>( &self, cacheable: bool, diff --git a/crates/core/src/blob/packer.rs b/crates/core/src/blob/packer.rs index f30d9c055..1ccd26646 100644 --- a/crates/core/src/blob/packer.rs +++ b/crates/core/src/blob/packer.rs @@ -194,6 +194,7 @@ impl Packer { /// [`PackerErrorKind::SendingCrossbeamMessageFailed`]: crate::error::PackerErrorKind::SendingCrossbeamMessageFailed /// [`PackerErrorKind::IntConversionFailed`]: crate::error::PackerErrorKind::IntConversionFailed #[allow(clippy::unnecessary_wraps)] + #[tracing::instrument(skip(be, indexer))] pub fn new( be: BE, blob_type: BlobType, @@ -295,6 +296,7 @@ impl Packer { /// * [`PackerErrorKind::SendingCrossbeamMessageFailed`] - If sending the message to the raw packer fails. /// /// [`PackerErrorKind::SendingCrossbeamMessageFailed`]: crate::error::PackerErrorKind::SendingCrossbeamMessageFailed + #[tracing::instrument(skip(self))] fn add_with_sizelimit( &self, data: Bytes, @@ -602,6 +604,7 @@ impl RawPacker { /// /// [`PackerErrorKind::IntConversionFailed`]: crate::error::PackerErrorKind::IntConversionFailed /// [`PackFileErrorKind::WritingBinaryRepresentationFailed`]: crate::error::PackFileErrorKind::WritingBinaryRepresentationFailed + #[tracing::instrument(skip(self))] fn save(&mut self) -> RusticResult<()> { if self.size == 0 { return Ok(()); @@ -677,6 +680,7 @@ impl Actor { /// * `fwh` - The file writer handle. /// * `queue_len` - The length of the queue. /// * `par` - The number of parallel threads. + #[tracing::instrument(skip(fwh, _par))] fn new( fwh: FileWriterHandle, queue_len: usize, @@ -718,6 +722,7 @@ impl Actor { /// # Errors /// /// If sending the message to the actor fails. + #[tracing::instrument(skip(self))] fn send(&self, load: (Bytes, IndexPack)) -> RusticResult<()> { self.sender .send(load) diff --git a/crates/core/src/blob/tree.rs b/crates/core/src/blob/tree.rs index ffd035779..1e7847cc9 100644 --- a/crates/core/src/blob/tree.rs +++ b/crates/core/src/blob/tree.rs @@ -671,6 +671,7 @@ impl TreeStreamerOnce

{ /// * [`TreeErrorKind::SendingCrossbeamMessageFailed`] - If sending the message fails. /// /// [`TreeErrorKind::SendingCrossbeamMessageFailed`]: crate::error::TreeErrorKind::SendingCrossbeamMessageFailed + #[tracing::instrument(skip(be, index, p))] pub fn new( be: &BE, index: &I, @@ -733,6 +734,7 @@ impl TreeStreamerOnce

{ /// * [`TreeErrorKind::SendingCrossbeamMessageFailed`] - If sending the message fails. /// /// [`TreeErrorKind::SendingCrossbeamMessageFailed`]: crate::error::TreeErrorKind::SendingCrossbeamMessageFailed + #[tracing::instrument(skip(self))] fn add_pending(&mut self, path: PathBuf, id: TreeId, count: usize) -> RusticResult { if self.visited.insert(id) { self.queue_in diff --git a/crates/core/src/commands/check.rs b/crates/core/src/commands/check.rs index 5978fd915..fd8bfe6f2 100644 --- a/crates/core/src/commands/check.rs +++ b/crates/core/src/commands/check.rs @@ -202,6 +202,7 @@ pub struct CheckOptions { /// # Panics /// // TODO: Add panics +#[tracing::instrument(skip(repo))] pub(crate) fn check_repository( repo: &Repository, opts: CheckOptions, @@ -350,6 +351,7 @@ fn check_hot_files( /// # Errors /// /// If a file is missing or has a different size +#[tracing::instrument(skip(be, p, _concurrency))] fn check_cache_files( _concurrency: usize, cache: &Cache, diff --git a/crates/core/src/commands/copy.rs b/crates/core/src/commands/copy.rs index ff0d063ef..1369e5e94 100644 --- a/crates/core/src/commands/copy.rs +++ b/crates/core/src/commands/copy.rs @@ -41,6 +41,7 @@ pub struct CopySnapshot { /// # Errors /// // TODO: Document errors +#[tracing::instrument(skip(repo, repo_dest, snapshots))] pub(crate) fn copy<'a, Q, R: IndexedFull, P: ProgressBars, S: IndexedIds>( repo: &Repository, repo_dest: &Repository, diff --git a/crates/core/src/commands/prune.rs b/crates/core/src/commands/prune.rs index 40a7cd764..2624a63a1 100644 --- a/crates/core/src/commands/prune.rs +++ b/crates/core/src/commands/prune.rs @@ -1182,6 +1182,7 @@ impl PrunePlan { /// TODO! In weird circumstances, should be fixed. #[allow(clippy::significant_drop_tightening)] #[allow(clippy::too_many_lines)] +#[tracing::instrument(skip(repo))] pub(crate) fn prune_repository( repo: &Repository, opts: &PruneOptions, diff --git a/crates/core/src/index/binarysorted.rs b/crates/core/src/index/binarysorted.rs index 7d0470fc3..0dc2370c8 100644 --- a/crates/core/src/index/binarysorted.rs +++ b/crates/core/src/index/binarysorted.rs @@ -120,6 +120,7 @@ impl IndexCollector { } // Turns Collector into an index by sorting the entries by ID. + #[tracing::instrument(skip(self))] #[must_use] pub fn into_index(self) -> Index { Index(self.0.map(|_, mut tc| { @@ -223,6 +224,7 @@ impl IntoIterator for Index { type IntoIter = PackIndexes; // Turns Collector into an iterator yielding PackIndex by sorting the entries by pack. + #[tracing::instrument(skip(self))] fn into_iter(mut self) -> Self::IntoIter { for tc in self.0.values_mut() { if let EntriesVariants::FullEntries(entries) = &mut tc.entries { diff --git a/crates/core/src/repository/warm_up.rs b/crates/core/src/repository/warm_up.rs index 99bd172e6..3dbafc44d 100644 --- a/crates/core/src/repository/warm_up.rs +++ b/crates/core/src/repository/warm_up.rs @@ -119,6 +119,7 @@ fn warm_up_command( /// * [`RepositoryErrorKind::FromThreadPoolbilderError`] - If the thread pool could not be created. /// /// [`RepositoryErrorKind::FromThreadPoolbilderError`]: crate::error::RepositoryErrorKind::FromThreadPoolbilderError +#[tracing::instrument(skip(repo, packs))] fn warm_up_repo( repo: &Repository, packs: impl ExactSizeIterator, diff --git a/crates/core/src/vfs/webdavfs.rs b/crates/core/src/vfs/webdavfs.rs index 1813b612f..d0014ac68 100644 --- a/crates/core/src/vfs/webdavfs.rs +++ b/crates/core/src/vfs/webdavfs.rs @@ -132,10 +132,12 @@ impl Clone for WebDavFS { impl DavFileSystem for WebDavFS { + #[tracing::instrument(skip(self))] fn metadata<'a>(&'a self, davpath: &'a DavPath) -> FsFuture<'_, Box> { self.symlink_metadata(davpath) } + #[tracing::instrument(skip(self))] fn symlink_metadata<'a>(&'a self, davpath: &'a DavPath) -> FsFuture<'_, Box> { async move { let node = self.node_from_path(davpath)?; @@ -145,6 +147,7 @@ impl( &'a self, davpath: &'a DavPath, @@ -162,6 +165,7 @@ impl( &'a self, path: &'a DavPath, @@ -204,6 +208,7 @@ impl FsFuture<'_, Box> { async move { let meta: Box = Box::new(DavFsMetaData(self.0.clone())); @@ -213,11 +218,13 @@ impl DavDirEntry for DavFsDirEntry { } #[cfg(not(windows))] + #[tracing::instrument(skip(self))] fn name(&self) -> Vec { self.0.name().as_bytes().to_vec() } #[cfg(windows)] + #[tracing::instrument(skip(self))] fn name(&self) -> Vec { self.0 .name() @@ -252,6 +259,7 @@ impl Debug for DavFsFile { } impl DavFile for DavFsFile { + #[tracing::instrument(skip(self))] fn metadata(&mut self) -> FsFuture<'_, Box> { async move { let meta: Box = Box::new(DavFsMetaData(self.node.clone())); @@ -260,14 +268,17 @@ impl DavFile for D .boxed() } + #[tracing::instrument(skip(self, _buf))] fn write_bytes(&mut self, _buf: Bytes) -> FsFuture<'_, ()> { async move { Err(FsError::Forbidden) }.boxed() } + #[tracing::instrument(skip(self, _buf))] fn write_buf(&mut self, _buf: Box) -> FsFuture<'_, ()> { async move { Err(FsError::Forbidden) }.boxed() } + #[tracing::instrument(skip(self))] fn read_bytes(&mut self, count: usize) -> FsFuture<'_, Bytes> { async move { let data = self @@ -281,6 +292,7 @@ impl DavFile for D .boxed() } + #[tracing::instrument(skip(self))] fn seek(&mut self, pos: SeekFrom) -> FsFuture<'_, u64> { async move { match pos { @@ -306,6 +318,7 @@ impl DavFile for D .boxed() } + #[tracing::instrument(skip(self))] fn flush(&mut self) -> FsFuture<'_, ()> { async move { Ok(()) }.boxed() }