Skip to content

Commit

Permalink
Add tracing instrumentation to package ops (#789)
Browse files Browse the repository at this point in the history
**Stack**:
- #790
- #783
- #767
- #789⚠️ *Part of a stack created by [spr](https://github.com/ejoffe/spr). Do
not merge manually using the UI - doing so may have unexpected results.*
  • Loading branch information
mkaput authored Oct 11, 2023
1 parent 977945c commit 7475530
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scarb/src/ops/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ enum ArchiveFileContents {
Generated(Box<dyn FnOnce() -> Result<Vec<u8>>>),
}

#[tracing::instrument(level = "debug", skip(opts, ws))]
pub fn package(
packages: &[PackageId],
opts: &PackageOpts,
Expand All @@ -62,6 +63,7 @@ pub fn package(
.collect()
}

#[tracing::instrument(level = "debug", skip(opts, ws))]
pub fn package_list(
packages: &[PackageId],
opts: &PackageOpts,
Expand All @@ -78,6 +80,7 @@ fn before_package(ws: &Workspace<'_>) -> Result<()> {
Ok(())
}

#[tracing::instrument(level = "trace", skip(_opts, ws))]
fn package_one_impl(
pkg_id: PackageId,
_opts: &PackageOpts,
Expand Down Expand Up @@ -192,6 +195,7 @@ fn prepare_archive_recipe(pkg: &Package) -> Result<ArchiveRecipe> {
Ok(recipe)
}

#[tracing::instrument(level = "trace", skip_all)]
fn source_files(pkg: &Package) -> Result<ArchiveRecipe> {
list_source_files(pkg)?
.into_iter()
Expand Down Expand Up @@ -245,6 +249,7 @@ fn sort_recipe(recipe: &mut ArchiveRecipe) {
});
}

#[tracing::instrument(level = "trace", skip_all)]
fn normalize_manifest(pkg: Package) -> Result<Vec<u8>> {
let mut buf = Vec::new();

Expand Down Expand Up @@ -278,6 +283,7 @@ fn normalize_manifest(pkg: Package) -> Result<Vec<u8>> {
/// Compress and package the recipe, and write it into the given file.
///
/// Returns the uncompressed size of the contents of the archive.
#[tracing::instrument(level = "trace", skip_all)]
fn tar(
pkg_id: PackageId,
recipe: ArchiveRecipe,
Expand Down

0 comments on commit 7475530

Please sign in to comment.