pub struct CustomBinding { /* private fields */ }Expand description
How a binding outside this crate names itself on its spans and in
rpc.server.call.duration.
Implementations§
Source§impl CustomBinding
impl CustomBinding
Sourcepub const fn new(
name: &'static str,
error_status: fn(&ServerError) -> Cow<'static, str>,
) -> CustomBinding
pub const fn new( name: &'static str, error_status: fn(&ServerError) -> Cow<'static, str>, ) -> CustomBinding
A binding whose rpc.system.name is name and which sends
error_status(e) as the status of a call that failed with e.
name should be the binding’s own name in lower case
("slimrpc"): the semantic conventions name only a few RPC systems
and let others use “a custom value”. error_status is recorded as
rpc.status_code and error.type, so it should be the binding’s
error mapping itself rather than a second copy of it, or the metric
can disagree with what the peer received.
Sourcepub const fn with_grpc_server_errors(self) -> CustomBinding
pub const fn with_grpc_server_errors(self) -> CustomBinding
Counts a failure as an error on the span and in the metric — sets
error.type and Error status — only for gRPC’s server-side
statuses (UNKNOWN, DEADLINE_EXCEEDED, UNIMPLEMENTED, INTERNAL,
UNAVAILABLE, DATA_LOSS), as the semantic conventions’ gRPC server
span does, for a binding whose error_status returns gRPC status
names. Any other status is still recorded as rpc.status_code.
Without it every failure is an error, as before this existed.
Sourcepub const fn with_ok_status(self, status: &'static str) -> CustomBinding
pub const fn with_ok_status(self, status: &'static str) -> CustomBinding
The status a successful call sends, for a binding that sends one —
"OK" for one with gRPC’s status codes. Without it a successful
call records no rpc.status_code, as on JSON-RPC.
Trait Implementations§
Source§impl Clone for CustomBinding
impl Clone for CustomBinding
Source§fn clone(&self) -> CustomBinding
fn clone(&self) -> CustomBinding
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CustomBinding
Auto Trait Implementations§
impl Forget for CustomBinding
impl Freeze for CustomBinding
impl Move for CustomBinding
impl RefUnwindSafe for CustomBinding
impl Send for CustomBinding
impl Sync for CustomBinding
impl Unpin for CustomBinding
impl UnsafeUnpin for CustomBinding
impl UnwindSafe for CustomBinding
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].