diff --git a/crates/install-wheel-rs/src/linker.rs b/crates/install-wheel-rs/src/linker.rs
index fed7189f4..07f335b8a 100644
--- a/crates/install-wheel-rs/src/linker.rs
+++ b/crates/install-wheel-rs/src/linker.rs
@@ -6,7 +6,7 @@ use std::path::Path;
use configparser::ini::Ini;
use fs_err as fs;
use fs_err::File;
-use tracing::{debug, span, Level};
+use tracing::{debug, info_span};
use pypi_types::DirectUrl;
@@ -51,7 +51,7 @@ pub fn install_wheel(
let metadata = dist_info_metadata(&dist_info_prefix, &wheel)?;
let (name, _version) = parse_metadata(&dist_info_prefix, &metadata)?;
- let _my_span = span!(Level::DEBUG, "install_wheel", name);
+ let _my_span = info_span!("install_wheel", name);
// We're going step by step though
// https://packaging.python.org/en/latest/specifications/binary-distribution-format/#installing-a-wheel-distribution-1-0-py32-none-any-whl
diff --git a/crates/install-wheel-rs/src/wheel.rs b/crates/install-wheel-rs/src/wheel.rs
index 6edc50b18..def4e6e5a 100644
--- a/crates/install-wheel-rs/src/wheel.rs
+++ b/crates/install-wheel-rs/src/wheel.rs
@@ -13,7 +13,7 @@ use mailparse::MailHeaderMap;
use rustc_hash::{FxHashMap, FxHashSet};
use sha2::{Digest, Sha256};
use tempfile::tempdir;
-use tracing::{debug, error, span, warn, Level};
+use tracing::{debug, error, instrument, warn};
use walkdir::WalkDir;
use zip::result::ZipError;
use zip::write::FileOptions;
@@ -894,6 +894,7 @@ pub fn parse_key_value_file(
///
/// Wheel 1.0:
#[allow(clippy::too_many_arguments)]
+#[instrument(skip_all, fields(name = %filename.name))]
pub fn install_wheel(
location: &InstallLocation,
reader: impl Read + Seek,
@@ -907,7 +908,6 @@ pub fn install_wheel(
sys_executable: impl AsRef,
) -> Result {
let name = &filename.name;
- let _my_span = span!(Level::DEBUG, "install_wheel", name = name.as_ref());
let base_location = location.venv_root();
diff --git a/crates/puffin-build/src/lib.rs b/crates/puffin-build/src/lib.rs
index 226260e10..372d4ed13 100644
--- a/crates/puffin-build/src/lib.rs
+++ b/crates/puffin-build/src/lib.rs
@@ -24,7 +24,7 @@ use tempfile::{tempdir, tempdir_in, TempDir};
use thiserror::Error;
use tokio::process::Command;
use tokio::sync::Mutex;
-use tracing::{debug, info_span, instrument};
+use tracing::{debug, info_span, instrument, Instrument};
use pep508_rs::Requirement;
use puffin_extract::extract_source;
@@ -390,11 +390,12 @@ impl SourceBuild {
};
let span = info_span!(
"run_python_script",
- name="prepare_metadata_for_build_wheel",
+ script="prepare_metadata_for_build_wheel",
python_version = %self.venv.interpreter().version()
);
- let output = run_python_script(&self.venv, &script, &self.source_tree).await?;
- drop(span);
+ let output = run_python_script(&self.venv, &script, &self.source_tree)
+ .instrument(span)
+ .await?;
if !output.status.success() {
return Err(Error::from_command_output(
"Build backend failed to determine metadata through `prepare_metadata_for_build_wheel`".to_string(),
@@ -432,7 +433,7 @@ impl SourceBuild {
/// dir.
///
///
- #[instrument(skip(self, wheel_dir), fields(package_id = self.package_id))]
+ #[instrument(skip_all, fields(package_id = self.package_id))]
pub async fn build(&self, wheel_dir: &Path) -> Result {
// The build scripts run with the extracted root as cwd, so they need the absolute path.
let wheel_dir = fs::canonicalize(wheel_dir)?;
@@ -452,10 +453,16 @@ impl SourceBuild {
}
// We checked earlier that setup.py exists.
let python_interpreter = self.venv.python_executable();
+ let span = info_span!(
+ "run_python_script",
+ script="setup.py bdist_wheel",
+ python_version = %self.venv.interpreter().version()
+ );
let output = Command::new(&python_interpreter)
.args(["setup.py", "bdist_wheel"])
.current_dir(&self.source_tree)
.output()
+ .instrument(span)
.await
.map_err(|err| Error::CommandFailed(python_interpreter, err))?;
if !output.status.success() {
@@ -508,11 +515,12 @@ impl SourceBuild {
};
let span = info_span!(
"run_python_script",
- name=format!("build_{}", self.build_kind),
+ script=format!("build_{}", self.build_kind),
python_version = %self.venv.interpreter().version()
);
- let output = run_python_script(&self.venv, &script, &self.source_tree).await?;
- drop(span);
+ let output = run_python_script(&self.venv, &script, &self.source_tree)
+ .instrument(span)
+ .await?;
if !output.status.success() {
return Err(Error::from_command_output(
format!(
@@ -585,11 +593,12 @@ async fn create_pep517_build_environment(
};
let span = info_span!(
"get_requires_for_build_wheel",
- name="build_wheel",
+ script="build_wheel",
python_version = %venv.interpreter().version()
);
- let output = run_python_script(venv, &script, source_tree).await?;
- drop(span);
+ let output = run_python_script(venv, &script, source_tree)
+ .instrument(span)
+ .await?;
if !output.status.success() {
return Err(Error::from_command_output(
format!("Build backend failed to determine extra requires with `build_{build_kind}()`"),
diff --git a/crates/puffin-client/src/cached_client.rs b/crates/puffin-client/src/cached_client.rs
index 334ceb4fd..55f243c36 100644
--- a/crates/puffin-client/src/cached_client.rs
+++ b/crates/puffin-client/src/cached_client.rs
@@ -6,7 +6,7 @@ use reqwest::{Request, Response};
use reqwest_middleware::ClientWithMiddleware;
use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};
-use tracing::{debug, trace, warn};
+use tracing::{debug, info_span, instrument, trace, warn, Instrument};
use puffin_cache::CacheEntry;
use puffin_fs::write_atomic;
@@ -86,6 +86,7 @@ impl CachedClient {
/// response is passed through `response_callback` and only the result is cached and returned.
/// The `response_callback` is allowed to make subsequent requests, e.g. through the uncached
/// client.
+ #[instrument(skip_all)]
pub async fn get_cached_with_callback<
Payload: Serialize + DeserializeOwned,
CallBackError,
@@ -101,8 +102,18 @@ impl CachedClient {
Callback: FnOnce(Response) -> CallbackReturn,
CallbackReturn: Future