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:
parent
74264569ee
commit
c32a23bf63
4 changed files with 12 additions and 4 deletions
|
|
@ -217,7 +217,9 @@ impl ServiceBuilder for GRPCBlobServiceConfig {
|
||||||
) -> Result<Arc<dyn BlobService>, Box<dyn std::error::Error + Send + Sync + 'static>> {
|
) -> Result<Arc<dyn BlobService>, Box<dyn std::error::Error + Send + Sync + 'static>> {
|
||||||
let client = proto::blob_service_client::BlobServiceClient::with_interceptor(
|
let client = proto::blob_service_client::BlobServiceClient::with_interceptor(
|
||||||
crate::tonic::channel_from_url(&self.url.parse()?).await?,
|
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(
|
Ok(Arc::new(GRPCBlobService::from_client(
|
||||||
instance_name.to_string(),
|
instance_name.to_string(),
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,9 @@ impl ServiceBuilder for GRPCDirectoryServiceConfig {
|
||||||
) -> Result<Arc<dyn DirectoryService>, Box<dyn std::error::Error + Send + Sync + 'static>> {
|
) -> Result<Arc<dyn DirectoryService>, Box<dyn std::error::Error + Send + Sync + 'static>> {
|
||||||
let client = proto::directory_service_client::DirectoryServiceClient::with_interceptor(
|
let client = proto::directory_service_client::DirectoryServiceClient::with_interceptor(
|
||||||
crate::tonic::channel_from_url(&self.url.parse()?).await?,
|
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(
|
Ok(Arc::new(GRPCDirectoryService::from_client(
|
||||||
instance_name.to_string(),
|
instance_name.to_string(),
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,9 @@ impl ServiceBuilder for GRPCPathInfoServiceConfig {
|
||||||
) -> Result<Arc<dyn PathInfoService>, Box<dyn std::error::Error + Send + Sync + 'static>> {
|
) -> Result<Arc<dyn PathInfoService>, Box<dyn std::error::Error + Send + Sync + 'static>> {
|
||||||
let client = proto::path_info_service_client::PathInfoServiceClient::with_interceptor(
|
let client = proto::path_info_service_client::PathInfoServiceClient::with_interceptor(
|
||||||
snix_castore::tonic::channel_from_url(&self.url.parse()?).await?,
|
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(
|
Ok(Arc::new(GRPCPathInfoService::from_client(
|
||||||
instance_name.to_string(),
|
instance_name.to_string(),
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,9 @@ impl Injector for MetadataInjector<'_> {
|
||||||
/// Trace context propagation: send the trace context by injecting it into the metadata of the given
|
/// 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.
|
/// request. This only injects the current span if the otlp feature is also enabled.
|
||||||
#[allow(unused_mut)]
|
#[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")]
|
#[cfg(feature = "otlp")]
|
||||||
{
|
{
|
||||||
global::get_text_map_propagator(|propagator| {
|
global::get_text_map_propagator(|propagator| {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue