async fn write(
        &self,
        namespace: &DatabaseName<'static>,
        input: Self::WriteInput,
        span_ctx: Option<SpanContext>,
    ) -> Result<Self::WriteOutput, Self::WriteError> {
        let t = self.time_provider.now();

        // Create a tracing span for this handler.
        let mut span_recorder =
            SpanRecorder::new(span_ctx.clone().map(|parent| parent.child(self.name)));

        let res = self.inner.write(namespace, input, span_ctx).await;

        // Avoid exploding if time goes backwards - simply drop the measurement
        // if it happens.
        if let Some(delta) = self.time_provider.now().checked_duration_since(t) {
            match &res {
                Ok(_) => {
                    span_recorder.ok("success");
                    self.write_success.record(delta.as_millis() as _)
                }
                Err(e) => {
                    span_recorder.error(e.to_string());
                    self.write_error.record(delta.as_millis() as _)
                }
            };
        }

        res
    }
/// Call the inner `write` method and record the call latency.
Call the inner `write` method and record the call latency.
Call the inner ` write ` method and record the call latency .
async fn write(
        &self,
        namespace: &DatabaseName<'static>,
        input: Self::WriteInput,
        span_ctx: Option<SpanContext>,
    ) -> Result<Self::WriteOutput, Self::WriteError> {
        let t = self.time_provider.now();
        // Create a tracing span for this handler.
        let mut span_recorder =
            SpanRecorder::new(span_ctx.clone().map(|parent| parent.child(self.name)));
        let res = self.inner.write(namespace, input, span_ctx).await;
        // Avoid exploding if time goes backwards - simply drop the measurement
        // if it happens.
        if let Some(delta) = self.time_provider.now().checked_duration_since(t) {
            match &res {
                Ok(_) => {
                    span_recorder.ok("success");
                    self.write_success.record(delta.as_millis() as _)
                }
                Err(e) => {
                    span_recorder.error(e.to_string());
                    self.write_error.record(delta.as_millis() as _)
                }
            };
        }
        res
    }
async fn write ( & self , namespace : & DatabaseName < ' static > , input : Self :: WriteInput , span_ctx : Option < SpanContext > , ) -> Result < Self :: WriteOutput , Self :: WriteError > { let t = self . time_provider . now ( ) ; // Create a tracing span for this handler. let mut span_recorder = SpanRecorder :: new ( span_ctx . clone ( ) . map ( | parent | parent . child ( self . name ) ) ) ; let res = self . inner . write ( namespace , input , span_ctx ) . await ; // Avoid exploding if time goes backwards - simply drop the measurement // if it happens. if let Some ( delta ) = self . time_provider . now ( ) . checked_duration_since ( t ) { match & res { Ok ( _ ) => { span_recorder . ok ( " " ) ; self . write_success . record ( delta . as_millis ( ) as _ ) } Err ( e ) => { span_recorder . error ( e . to_string ( ) ) ; self . write_error . record ( delta . as_millis ( ) as _ ) } } ; } res }
Call the inner `write` method and record the call latency.
Call the inner ` write ` method and record the call latency .
&self
namespace
&DatabaseName<'static>
input
Self::WriteInput
span_ctx
Option<SpanContext>
&self
namespace
&DatabaseName<'static>
input
Self::WriteInput
span_ctx
Option<SpanContext>