Struct background_jobs::metrics::StatsRecorder
source · pub struct StatsRecorder { /* private fields */ }
Expand description
Recorder type for recording background jobs metrics
Implementations§
source§impl StatsRecorder
impl StatsRecorder
sourcepub fn install() -> Result<StatsHandle, SetRecorderError<StatsRecorder>>
pub fn install() -> Result<StatsHandle, SetRecorderError<StatsRecorder>>
Install the stats recorder into the process
StatsRecorder::install().expect("Failed to install recorder");
sourcepub fn build() -> (StatsRecorder, StatsHandle)
pub fn build() -> (StatsRecorder, StatsHandle)
Build the stats recorder and fetch the handle.
This can be used in conjunction with metrics_util::layers::FanoutBuilder
to add it in
addition to another recorder
let (jobs_recorder, handle) = StatsRecorder::build();
let recorder = metrics_util::layers::FanoutBuilder::default()
.add_recorder(jobs_recorder)
.build();
metrics::set_global_recorder(recorder).expect("Failed to set recorder");
println!("{:?}", handle.get());
Trait Implementations§
source§impl Recorder for StatsRecorder
impl Recorder for StatsRecorder
source§fn describe_counter(&self, _: KeyName, _: Option<Unit>, _: Cow<'static, str>)
fn describe_counter(&self, _: KeyName, _: Option<Unit>, _: Cow<'static, str>)
Describes a counter. Read more
source§fn describe_gauge(&self, _: KeyName, _: Option<Unit>, _: Cow<'static, str>)
fn describe_gauge(&self, _: KeyName, _: Option<Unit>, _: Cow<'static, str>)
Describes a gauge. Read more
source§fn describe_histogram(&self, _: KeyName, _: Option<Unit>, _: Cow<'static, str>)
fn describe_histogram(&self, _: KeyName, _: Option<Unit>, _: Cow<'static, str>)
Describes a histogram. Read more
source§fn register_counter(&self, key: &Key, _: &Metadata<'_>) -> Counter
fn register_counter(&self, key: &Key, _: &Metadata<'_>) -> Counter
Registers a counter.
source§fn register_gauge(&self, key: &Key, _: &Metadata<'_>) -> Gauge
fn register_gauge(&self, key: &Key, _: &Metadata<'_>) -> Gauge
Registers a gauge.
source§fn register_histogram(&self, key: &Key, _: &Metadata<'_>) -> Histogram
fn register_histogram(&self, key: &Key, _: &Metadata<'_>) -> Histogram
Registers a histogram.
Auto Trait Implementations§
impl RefUnwindSafe for StatsRecorder
impl Send for StatsRecorder
impl Sync for StatsRecorder
impl Unpin for StatsRecorder
impl UnwindSafe for StatsRecorder
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
§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>
§impl<T> IntoSql for T
impl<T> IntoSql for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T, Conn> RunQueryDsl<Conn> for T
impl<T, Conn> RunQueryDsl<Conn> for T
§fn execute<'query, 'conn>(
self,
conn: &'conn mut Conn
) -> <Conn as AsyncConnection>::ExecuteFuture<'conn, 'query>where
Conn: AsyncConnection + Send,
Self: ExecuteDsl<Conn> + 'query,
fn execute<'query, 'conn>(
self,
conn: &'conn mut Conn
) -> <Conn as AsyncConnection>::ExecuteFuture<'conn, 'query>where
Conn: AsyncConnection + Send,
Self: ExecuteDsl<Conn> + 'query,
Executes the given command, returning the number of rows affected. Read more
§fn load<'query, U, 'conn>(
self,
conn: &'conn mut Conn
) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>, fn(_: Self::Stream<'conn>) -> TryCollect<Self::Stream<'conn>, Vec<U>>>where
U: Send,
Conn: AsyncConnection,
Self: LoadQuery<'query, Conn, U> + 'query,
fn load<'query, U, 'conn>(
self,
conn: &'conn mut Conn
) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>, fn(_: Self::Stream<'conn>) -> TryCollect<Self::Stream<'conn>, Vec<U>>>where
U: Send,
Conn: AsyncConnection,
Self: LoadQuery<'query, Conn, U> + 'query,
§fn load_stream<'conn, 'query, U>(
self,
conn: &'conn mut Conn
) -> Self::LoadFuture<'conn>where
Conn: AsyncConnection,
U: 'conn,
Self: LoadQuery<'query, Conn, U> + 'query,
fn load_stream<'conn, 'query, U>(
self,
conn: &'conn mut Conn
) -> Self::LoadFuture<'conn>where
Conn: AsyncConnection,
U: 'conn,
Self: LoadQuery<'query, Conn, U> + 'query,
Executes the given query, returning a [
Stream
] with the returned rows. Read more§fn get_result<'query, 'conn, U>(
self,
conn: &'conn mut Conn
) -> AndThen<Self::LoadFuture<'conn>, Map<StreamFuture<Pin<Box<Self::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<Self::Stream<'conn>>>)) -> Result<U, Error>>, fn(_: Self::Stream<'conn>) -> Map<StreamFuture<Pin<Box<Self::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<Self::Stream<'conn>>>)) -> Result<U, Error>>>where
U: Send + 'conn,
Conn: AsyncConnection,
Self: LoadQuery<'query, Conn, U> + 'query,
fn get_result<'query, 'conn, U>(
self,
conn: &'conn mut Conn
) -> AndThen<Self::LoadFuture<'conn>, Map<StreamFuture<Pin<Box<Self::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<Self::Stream<'conn>>>)) -> Result<U, Error>>, fn(_: Self::Stream<'conn>) -> Map<StreamFuture<Pin<Box<Self::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<Self::Stream<'conn>>>)) -> Result<U, Error>>>where
U: Send + 'conn,
Conn: AsyncConnection,
Self: LoadQuery<'query, Conn, U> + 'query,
Runs the command, and returns the affected row. Read more
§fn get_results<'query, U, 'conn>(
self,
conn: &'conn mut Conn
) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>, fn(_: Self::Stream<'conn>) -> TryCollect<Self::Stream<'conn>, Vec<U>>>where
U: Send,
Conn: AsyncConnection,
Self: LoadQuery<'query, Conn, U> + 'query,
fn get_results<'query, U, 'conn>(
self,
conn: &'conn mut Conn
) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>, fn(_: Self::Stream<'conn>) -> TryCollect<Self::Stream<'conn>, Vec<U>>>where
U: Send,
Conn: AsyncConnection,
Self: LoadQuery<'query, Conn, U> + 'query,
Runs the command, returning an
Vec
with the affected rows. Read more§fn first<'query, 'conn, U>(
self,
conn: &'conn mut Conn
) -> AndThen<<Self::Output as LoadQuery<'query, Conn, U>>::LoadFuture<'conn>, Map<StreamFuture<Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>)) -> Result<U, Error>>, fn(_: <Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>) -> Map<StreamFuture<Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>)) -> Result<U, Error>>>
fn first<'query, 'conn, U>( self, conn: &'conn mut Conn ) -> AndThen<<Self::Output as LoadQuery<'query, Conn, U>>::LoadFuture<'conn>, Map<StreamFuture<Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>)) -> Result<U, Error>>, fn(_: <Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>) -> Map<StreamFuture<Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>>, fn(_: (Option<Result<U, Error>>, Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>)) -> Result<U, Error>>>
Attempts to load a single record. Read more