From 6068d044b337eb56ed82636b8d1a48eb34701568 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 9 Dec 2024 22:14:08 +0200 Subject: [PATCH] feat(tvix/nix-daemon): instrument for TvixDaemon This makes it easier to see what's being communicated, by setting `RUST_LOG=nix_daemon=debug`. Change-Id: Ifcd89ff6c5c1727e97569e29d4f63993cc37ed8e Reviewed-on: https://cl.tvl.fyi/c/depot/+/12884 Tested-by: BuildkiteCI Reviewed-by: Vladimir Kryachko Autosubmit: flokli Reviewed-by: flokli --- tvix/nix-daemon/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tvix/nix-daemon/src/lib.rs b/tvix/nix-daemon/src/lib.rs index 5be8a0af7..59d29848d 100644 --- a/tvix/nix-daemon/src/lib.rs +++ b/tvix/nix-daemon/src/lib.rs @@ -11,7 +11,7 @@ use nix_compat::{ nixbase32, store_path::{build_ca_path, StorePath}, }; -use tracing::warn; +use tracing::{instrument, warn}; use tvix_castore::{blobservice::BlobService, directoryservice::DirectoryService}; use tvix_store::{nar::ingest_nar_and_hash, path_info::PathInfo, pathinfoservice::PathInfoService}; @@ -38,6 +38,7 @@ impl TvixDaemon { /// Implements [NixDaemonIO] backed by tvix services. impl NixDaemonIO for TvixDaemon { + #[instrument(skip_all, fields(path), level = "debug", ret(Debug))] async fn query_path_info( &self, path: &StorePath, @@ -50,6 +51,7 @@ impl NixDaemonIO for TvixDaemon { Ok(None) } + #[instrument(skip_all, fields(hash=nix_compat::nixbase32::encode(hash)), level = "debug", ret(Debug))] async fn query_path_from_hash_part(&self, hash: &[u8]) -> Result> { let digest = hash .try_into() @@ -60,6 +62,7 @@ impl NixDaemonIO for TvixDaemon { } } + #[instrument(skip_all, fields(request), level = "debug", ret(Debug))] async fn add_to_store_nar(&self, request: AddToStoreNarRequest, reader: &mut R) -> Result<()> where R: tokio::io::AsyncRead + Send + Unpin,