pub struct RiPrometheusExporter { /* private fields */ }Expand description
Prometheus exporter for managing metrics and generating Grafana dashboards.
This struct provides methods for registering and updating Prometheus metrics, as well as generating Grafana dashboards from these metrics.
Implementations§
Source§impl RiPrometheusExporter
impl RiPrometheusExporter
Sourcepub fn new() -> RiResult<Self>
pub fn new() -> RiResult<Self>
Creates a new Prometheus exporter instance.
§Returns
A new RiPrometheusExporter instance wrapped in RiResult
Sourcepub fn register_histogram(
&self,
name: &str,
help: &str,
buckets: Vec<f64>,
) -> RiResult<()>
pub fn register_histogram( &self, name: &str, help: &str, buckets: Vec<f64>, ) -> RiResult<()>
Sourcepub fn render(&self) -> RiResult<String>
pub fn render(&self) -> RiResult<String>
Renders all metrics in Prometheus text format.
§Returns
A string containing all metrics in Prometheus text format wrapped in RiResult
Sourcepub fn add_counter_panel(
&self,
dashboard: &mut RiGrafanaDashboard,
title: &str,
query: &str,
) -> RiResult<()>
pub fn add_counter_panel( &self, dashboard: &mut RiGrafanaDashboard, title: &str, query: &str, ) -> RiResult<()>
Sourcepub fn add_gauge_panel(
&self,
dashboard: &mut RiGrafanaDashboard,
title: &str,
query: &str,
) -> RiResult<()>
pub fn add_gauge_panel( &self, dashboard: &mut RiGrafanaDashboard, title: &str, query: &str, ) -> RiResult<()>
Sourcepub fn add_stat_panel(
&self,
dashboard: &mut RiGrafanaDashboard,
title: &str,
query: &str,
) -> RiResult<()>
pub fn add_stat_panel( &self, dashboard: &mut RiGrafanaDashboard, title: &str, query: &str, ) -> RiResult<()>
Sourcepub fn generate_dashboard(&self, title: &str) -> RiResult<RiGrafanaDashboard>
pub fn generate_dashboard(&self, title: &str) -> RiResult<RiGrafanaDashboard>
Sourcepub fn generate_default_dashboard(&self) -> RiResult<RiGrafanaDashboard>
pub fn generate_default_dashboard(&self) -> RiResult<RiGrafanaDashboard>
Generates a default Grafana dashboard with “Ri Metrics Dashboard” title.
§Returns
A default Grafana dashboard wrapped in RiResult
Trait Implementations§
Source§impl Clone for RiPrometheusExporter
impl Clone for RiPrometheusExporter
Source§fn clone(&self) -> RiPrometheusExporter
fn clone(&self) -> RiPrometheusExporter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RiPrometheusExporter
impl !RefUnwindSafe for RiPrometheusExporter
impl Send for RiPrometheusExporter
impl Sync for RiPrometheusExporter
impl Unpin for RiPrometheusExporter
impl UnsafeUnpin for RiPrometheusExporter
impl !UnwindSafe for RiPrometheusExporter
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
Converts
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>
Converts
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 moreSource§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