pub struct RpcServerStackBuilder<T = ()> { /* private fields */ }Expand description
Creates the common server layer once and applies it to every generated Tonic service.
The layer installs authentication, W3C trace extraction, panic recovery, adaptive admission
control, and complete unary/streaming metrics. Add it to tonic::transport::Server before
adding generated services; those services need no per-service interceptors.
Implementations§
Source§impl RpcServerStackBuilder<()>
impl RpcServerStackBuilder<()>
pub fn new(metrics: RpcMetrics) -> Self
Source§impl<T> RpcServerStackBuilder<T>
impl<T> RpcServerStackBuilder<T>
pub fn with_bearer_auth<U>( self, validator: impl Fn(&str) -> Option<U> + Send + Sync + 'static, ) -> RpcServerStackBuilder<U>
pub fn with_load_shedder(self, config: LoadShedderConfig) -> Self
Sourcepub fn with_slow_call_logging(self, logger: Logger, threshold: Duration) -> Self
pub fn with_slow_call_logging(self, logger: Logger, threshold: Duration) -> Self
Logs every completed gRPC call and classifies calls at or above threshold as slow.
Streaming calls are finalized from their trailers so the record contains the final status.
pub fn build(self) -> RpcServerStack<T>
Auto Trait Implementations§
impl<T = ()> !RefUnwindSafe for RpcServerStackBuilder<T>
impl<T = ()> !UnwindSafe for RpcServerStackBuilder<T>
impl<T> Freeze for RpcServerStackBuilder<T>
impl<T> Send for RpcServerStackBuilder<T>
impl<T> Sync for RpcServerStackBuilder<T>
impl<T> Unpin for RpcServerStackBuilder<T>
impl<T> UnsafeUnpin for RpcServerStackBuilder<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request