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 <edef@edef.eu>
Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
Florian Klink 2025-03-13 15:43:37 +01:00 committed by clbot
parent 4415afa9de
commit ca362c302b

View file

@ -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),