fix(snix/tracing): fix clippy::result_large_err lint

We still need to unbox before calling ::with_interceptor, the proper fix
will be in https://github.com/hyperium/tonic/issues/2253.

Change-Id: I6de13de79e8ffd9d2f75268b7b232c2f6c91202d
Reviewed-on: https://cl.snix.dev/c/snix/+/30632
Tested-by: besadii
Autosubmit: Florian Klink <flokli@flokli.de>
Reviewed-by: Ryan Lahfa <ryan@lahfa.xyz>
This commit is contained in:
Florian Klink 2025-07-31 15:22:13 +02:00 committed by clbot
parent 74264569ee
commit c32a23bf63
4 changed files with 12 additions and 4 deletions

View file

@ -217,7 +217,9 @@ impl ServiceBuilder for GRPCBlobServiceConfig {
) -> Result<Arc<dyn BlobService>, Box<dyn std::error::Error + Send + Sync + 'static>> {
let client = proto::blob_service_client::BlobServiceClient::with_interceptor(
crate::tonic::channel_from_url(&self.url.parse()?).await?,
snix_tracing::propagate::tonic::send_trace,
// tonic::service::Interceptor wants an unboxed Status as return type.
// https://github.com/hyperium/tonic/issues/2253
|rq| snix_tracing::propagate::tonic::send_trace(rq).map_err(|e| *e),
);
Ok(Arc::new(GRPCBlobService::from_client(
instance_name.to_string(),

View file

@ -245,7 +245,9 @@ impl ServiceBuilder for GRPCDirectoryServiceConfig {
) -> Result<Arc<dyn DirectoryService>, Box<dyn std::error::Error + Send + Sync + 'static>> {
let client = proto::directory_service_client::DirectoryServiceClient::with_interceptor(
crate::tonic::channel_from_url(&self.url.parse()?).await?,
snix_tracing::propagate::tonic::send_trace,
// tonic::service::Interceptor wants an unboxed Status as return type.
// https://github.com/hyperium/tonic/issues/2253
|rq| snix_tracing::propagate::tonic::send_trace(rq).map_err(|e| *e),
);
Ok(Arc::new(GRPCDirectoryService::from_client(
instance_name.to_string(),

View file

@ -175,7 +175,9 @@ impl ServiceBuilder for GRPCPathInfoServiceConfig {
) -> Result<Arc<dyn PathInfoService>, Box<dyn std::error::Error + Send + Sync + 'static>> {
let client = proto::path_info_service_client::PathInfoServiceClient::with_interceptor(
snix_castore::tonic::channel_from_url(&self.url.parse()?).await?,
snix_tracing::propagate::tonic::send_trace,
// tonic::service::Interceptor wants an unboxed Status as return type.
// https://github.com/hyperium/tonic/issues/2253
|rq| snix_tracing::propagate::tonic::send_trace(rq).map_err(|e| *e),
);
Ok(Arc::new(GRPCPathInfoService::from_client(
instance_name.to_string(),

View file

@ -45,7 +45,9 @@ impl Injector for MetadataInjector<'_> {
/// Trace context propagation: send the trace context by injecting it into the metadata of the given
/// request. This only injects the current span if the otlp feature is also enabled.
#[allow(unused_mut)]
pub fn send_trace<T>(mut request: tonic::Request<T>) -> Result<tonic::Request<T>, tonic::Status> {
pub fn send_trace<T>(
mut request: tonic::Request<T>,
) -> Result<tonic::Request<T>, Box<tonic::Status>> {
#[cfg(feature = "otlp")]
{
global::get_text_map_propagator(|propagator| {