Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion crates/rpc/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use tokio::net::TcpListener;
use tokio_stream::wrappers::TcpListenerStream;
use tonic_reflection::server;
use tonic_web::GrpcWebLayer;
use tower_http::classify::{GrpcCode, GrpcErrorsAsFailures, SharedClassifier};
use tower_http::trace::TraceLayer;
use tracing::info;
use url::Url;
Expand Down Expand Up @@ -74,7 +75,17 @@ impl Rpc {
.timeout(self.grpc_options.request_timeout)
.layer(CatchPanicLayer::custom(catch_panic_layer_fn))
.layer(grpc::connect_info_layer())
.layer(TraceLayer::new_for_grpc().make_span_with(grpc_trace_fn))
.layer(
TraceLayer::new(SharedClassifier::new(
GrpcErrorsAsFailures::new()
.with_success(GrpcCode::InvalidArgument)
.with_success(GrpcCode::NotFound)
.with_success(GrpcCode::ResourceExhausted)
.with_success(GrpcCode::Unimplemented)
.with_success(GrpcCode::Unknown),
))
.make_span_with(grpc_trace_fn),
)
.layer(HealthCheckLayer)
.layer(grpc::rate_limit_concurrent_connections(self.grpc_options))
.layer(grpc::rate_limit_per_ip(self.grpc_options)?)
Expand Down
Loading