diff --git a/tvix/store/src/lib.rs b/tvix/store/src/lib.rs index e1517609d..5f1642ce2 100644 --- a/tvix/store/src/lib.rs +++ b/tvix/store/src/lib.rs @@ -9,6 +9,9 @@ pub mod utils; #[cfg(test)] mod tests; +// Used as user agent in various HTTP Clients +const USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")); + // That's what the rstest_reuse README asks us do, and fails about being unable // to find rstest_reuse in crate root. #[cfg(test)] diff --git a/tvix/store/src/pathinfoservice/nix_http.rs b/tvix/store/src/pathinfoservice/nix_http.rs index e9b83dcf3..a9e3e4b36 100644 --- a/tvix/store/src/pathinfoservice/nix_http.rs +++ b/tvix/store/src/pathinfoservice/nix_http.rs @@ -54,9 +54,14 @@ impl NixHTTPPathInfoService { Self { instance_name, base_url, - http_client: reqwest_middleware::ClientBuilder::new(reqwest::Client::new()) - .with(tvix_tracing::propagate::reqwest::tracing_middleware()) - .build(), + http_client: reqwest_middleware::ClientBuilder::new( + reqwest::Client::builder() + .user_agent(crate::USER_AGENT) + .build() + .expect("Client::new()"), + ) + .with(tvix_tracing::propagate::reqwest::tracing_middleware()) + .build(), blob_service, directory_service,