From ca362c302bc82f9b1e26276b56e9ab6d2959db51 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Thu, 13 Mar 2025 15:43:37 +0100 Subject: [PATCH] fix(tvix/store/daemon): don't report NotFound responses as errors Before uploading a blob, a client usually checks whether a blob exists via the stat method. We return a NotFound if it's not present. Our TraceLayer currently considers this an error, logging a message. This gets very noisy. Exclude InvalidArgument and NotFound, this is expected behaviour. Change-Id: I7da22a41fc6f3b8d422521a01530fc9e638e33ba Reviewed-on: https://cl.tvl.fyi/c/depot/+/13257 Tested-by: BuildkiteCI Reviewed-by: edef Autosubmit: flokli --- tvix/store/src/bin/tvix-store.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tvix/store/src/bin/tvix-store.rs b/tvix/store/src/bin/tvix-store.rs index eca703017..e16f7df1c 100644 --- a/tvix/store/src/bin/tvix-store.rs +++ b/tvix/store/src/bin/tvix-store.rs @@ -13,6 +13,7 @@ use std::path::PathBuf; use std::sync::Arc; use tonic::transport::Server; use tower::ServiceBuilder; +use tower_http::classify::{GrpcCode, GrpcErrorsAsFailures, SharedClassifier}; use tower_http::trace::{DefaultMakeSpan, TraceLayer}; use tracing::{debug, info, info_span, instrument, warn, Instrument, Level, Span}; use tracing_indicatif::span_ext::IndicatifSpanExt; @@ -180,7 +181,12 @@ async fn run_cli( let mut server = Server::builder().layer( ServiceBuilder::new() .layer( - TraceLayer::new_for_grpc().make_span_with( + TraceLayer::new(SharedClassifier::new( + GrpcErrorsAsFailures::new() + .with_success(GrpcCode::InvalidArgument) + .with_success(GrpcCode::NotFound), + )) + .make_span_with( DefaultMakeSpan::new() .level(Level::INFO) .include_headers(true),