Allow profiling tests with tracing instrumentation (#2957)

To get more insights into test performance, allow instrumenting tests
with tracing-durations-export.

Usage:

```shell
# A single test
TRACING_DURATIONS_TEST_ROOT=$(pwd)/target/test-traces cargo test --features tracing-durations-export --test pip_install_scenarios no_binary -- --exact
# All tests
TRACING_DURATIONS_TEST_ROOT=$(pwd)/target/test-traces cargo nextest run --features tracing-durations-export
```

Then we can e.g. look at
`target/test-traces/pip_install_scenarios::no_binary.svg` and see the
builds it performs:


![image](40b4e094-debc-4b22-8aa3-9471998674af)
This commit is contained in:
konsti 2024-04-10 12:15:27 +02:00 committed by GitHub
parent c4472ebbb9
commit 15f0be8f04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 63 additions and 24 deletions

View file

@ -1063,7 +1063,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
/// Build a source distribution, storing the built wheel in the cache.
///
/// Returns the un-normalized disk filename, the parsed, normalized filename and the metadata
#[instrument(skip_all, fields(dist))]
#[instrument(skip_all, fields(dist = %source))]
async fn build_distribution(
&self,
source: &BuildableSource<'_>,
@ -1116,7 +1116,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
}
/// Build the metadata for a source distribution.
#[instrument(skip_all, fields(dist))]
#[instrument(skip_all, fields(dist = %source))]
async fn build_metadata(
&self,
source: &BuildableSource<'_>,