Skip to content

Commit 80a7894

Browse files
committed
add more performance tracing to our storage
1 parent 66bc9d0 commit 80a7894

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/storage/archive_index.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use crate::storage::{compression::CompressionAlgorithm, FileRange};
33
use anyhow::{bail, Context as _};
44
use rusqlite::{Connection, OpenFlags, OptionalExtension};
55
use std::{fs, io, path::Path};
6+
use tracing::instrument;
67

78
#[derive(PartialEq, Eq, Debug)]
89
pub(crate) struct FileInfo {
@@ -99,7 +100,8 @@ fn find_in_sqlite_index(conn: &Connection, search_for: &str) -> Result<Option<Fi
99100
.context("error fetching SQLite data")
100101
}
101102

102-
pub(crate) fn find_in_file<P: AsRef<Path>>(
103+
#[instrument]
104+
pub(crate) fn find_in_file<P: AsRef<Path> + std::fmt::Debug>(
103105
archive_index_path: P,
104106
search_for: &str,
105107
) -> Result<Option<FileInfo>> {

src/storage/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::{
2525
sync::Arc,
2626
};
2727
use tokio::{io::AsyncWriteExt, runtime::Runtime};
28-
use tracing::{error, info_span, instrument, trace, Instrument};
28+
use tracing::{error, instrument, trace};
2929

3030
type FileRange = RangeInclusive<u64>;
3131

@@ -249,6 +249,7 @@ impl AsyncStorage {
249249
})
250250
}
251251

252+
#[instrument]
252253
pub(crate) async fn exists_in_archive(
253254
&self,
254255
archive_path: &str,
@@ -311,6 +312,7 @@ impl AsyncStorage {
311312
Ok(blob)
312313
}
313314

315+
#[instrument]
314316
pub(super) async fn download_archive_index(
315317
&self,
316318
archive_path: &str,
@@ -361,14 +363,11 @@ impl AsyncStorage {
361363
}
362364
let index_filename = self
363365
.download_archive_index(archive_path, latest_build_id)
364-
.instrument(info_span!("download archive index"))
365366
.await?;
366367

367368
let info = {
368369
let path = path.to_owned();
369-
spawn_blocking(move || archive_index::find_in_file(index_filename, &path))
370-
.instrument(info_span!("find path in index"))
371-
.await
370+
spawn_blocking(move || archive_index::find_in_file(index_filename, &path)).await
372371
}?
373372
.ok_or(PathNotFoundError)?;
374373

0 commit comments

Comments
 (0)