From 4680f9c3aa7b4f61b9c98060c46e955a54cbc70c Mon Sep 17 00:00:00 2001 From: asonix Date: Sat, 8 Jul 2023 10:42:03 -0500 Subject: [PATCH] Instrument repo and store build methods --- src/repo.rs | 1 + src/repo/old.rs | 1 + src/repo/sled.rs | 1 + src/store/file_store.rs | 7 +++---- src/store/object_store.rs | 1 + 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/repo.rs b/src/repo.rs index 1dc83e4..ae9f2eb 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -461,6 +461,7 @@ where } impl Repo { + #[tracing::instrument] pub(crate) fn open(config: config::Repo) -> color_eyre::Result { match config { config::Repo::Sled(config::Sled { diff --git a/src/repo/old.rs b/src/repo/old.rs index e99febf..a87c6fa 100644 --- a/src/repo/old.rs +++ b/src/repo/old.rs @@ -44,6 +44,7 @@ pub(super) struct Old { } impl Old { + #[tracing::instrument] pub(super) fn open(path: PathBuf) -> color_eyre::Result> { if let Some(db) = migrate::LatestDb::exists(path).migrate()? { Ok(Some(Self { diff --git a/src/repo/sled.rs b/src/repo/sled.rs index de4e4d6..d9cf320 100644 --- a/src/repo/sled.rs +++ b/src/repo/sled.rs @@ -71,6 +71,7 @@ pub(crate) struct SledRepo { } impl SledRepo { + #[tracing::instrument(skip(db))] pub(crate) fn new(db: Db) -> Result { Ok(SledRepo { healthz_count: Arc::new(AtomicU64::new(0)), diff --git a/src/store/file_store.rs b/src/store/file_store.rs index d091477..90e07a0 100644 --- a/src/store/file_store.rs +++ b/src/store/file_store.rs @@ -162,12 +162,11 @@ impl Store for FileStore { } impl FileStore { - pub(crate) async fn build(root_dir: PathBuf, repo: Repo) -> Result { + #[tracing::instrument(skip(repo))] + pub(crate) async fn build(root_dir: PathBuf, repo: Repo) -> color_eyre::Result { let path_gen = init_generator(&repo).await?; - tokio::fs::create_dir_all(&root_dir) - .await - .map_err(FileError::from)?; + tokio::fs::create_dir_all(&root_dir).await?; Ok(FileStore { root_dir, diff --git a/src/store/object_store.rs b/src/store/object_store.rs index 1b5bdc9..0674b47 100644 --- a/src/store/object_store.rs +++ b/src/store/object_store.rs @@ -428,6 +428,7 @@ impl Store for ObjectStore { impl ObjectStore { #[allow(clippy::too_many_arguments)] + #[tracing::instrument(skip(access_key, secret_key, session_token, repo))] pub(crate) async fn build( endpoint: Url, bucket_name: String,