refactor(tvix): make indicatif.pb_show=1 more explicit
This pushes generating spans with pb_show up to the caller. They usually have more context on how to present things, if at all. Change-Id: Icfcaa64a8a57dce50c0261f2d06e7c051e3946c2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12657 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
This commit is contained in:
parent
3fda90602d
commit
d52d889f2b
3 changed files with 125 additions and 46 deletions
|
|
@ -6,8 +6,7 @@ use nix_compat::nar::writer::r#async as nar_writer;
|
|||
use sha2::{Digest, Sha256};
|
||||
use tokio::io::{self, AsyncWrite, BufReader};
|
||||
use tonic::async_trait;
|
||||
use tracing::{instrument, Span};
|
||||
use tracing_indicatif::span_ext::IndicatifSpanExt;
|
||||
use tracing::instrument;
|
||||
use tvix_castore::{blobservice::BlobService, directoryservice::DirectoryService, Node};
|
||||
|
||||
pub struct SimpleRenderer<BS, DS> {
|
||||
|
|
@ -46,7 +45,7 @@ where
|
|||
|
||||
/// Invoke [write_nar], and return the size and sha256 digest of the produced
|
||||
/// NAR output.
|
||||
#[instrument(skip_all, fields(indicatif.pb_show=1))]
|
||||
#[instrument(skip_all)]
|
||||
pub async fn calculate_size_and_sha256<BS, DS>(
|
||||
root_node: &Node,
|
||||
blob_service: BS,
|
||||
|
|
@ -59,10 +58,6 @@ where
|
|||
let mut h = Sha256::new();
|
||||
let mut cw = CountWrite::from(&mut h);
|
||||
|
||||
let span = Span::current();
|
||||
span.pb_set_message("Calculating NAR");
|
||||
span.pb_start();
|
||||
|
||||
write_nar(
|
||||
// The hasher doesn't speak async. It doesn't
|
||||
// actually do any I/O, so it's fine to wrap.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue