about summary refs log tree commit diff
path: root/tvix/store/src/nar
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-06-16T19·40+0300
committerflokli <flokli@flokli.de>2024-06-17T09·47+0000
commitcfab953094c6da5a919ea968f2bd7753035005c7 (patch)
tree120b070015a7660d619ee9f3ae0cf488c4857106 /tvix/store/src/nar
parent71a29ceff42dd8e0266dec3811b242b3f5b4cb2f (diff)
feat(tvix/store): display progress for NAR calculation r/8288
This is currently still taking a noticeable amount of time, so make sure
we show it is happening.

Change-Id: I13d18785fbf41ae4479e1ea58d61ece1d7485719
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11847
Reviewed-by: Simon Hauser <simon.hauser@helsinki-systems.de>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/store/src/nar')
-rw-r--r--tvix/store/src/nar/renderer.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/tvix/store/src/nar/renderer.rs b/tvix/store/src/nar/renderer.rs
index efd67671db70..e3cb54dd229f 100644
--- a/tvix/store/src/nar/renderer.rs
+++ b/tvix/store/src/nar/renderer.rs
@@ -6,6 +6,8 @@ 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 tvix_castore::{
     blobservice::BlobService,
     directoryservice::DirectoryService,
@@ -48,6 +50,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))]
 pub async fn calculate_size_and_sha256<BS, DS>(
     root_node: &castorepb::node::Node,
     blob_service: BS,
@@ -60,6 +63,10 @@ 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.