pub struct DMSCPrometheusExporter { /* 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 DMSCPrometheusExporter
impl DMSCPrometheusExporter
Sourcepub fn new() -> DMSCResult<Self>
pub fn new() -> DMSCResult<Self>
Creates a new Prometheus exporter instance.
§Returns
A new DMSCPrometheusExporter instance wrapped in DMSCResult
Sourcepub fn register_counter(&self, name: &str, help: &str) -> DMSCResult<()>
pub fn register_counter(&self, name: &str, help: &str) -> DMSCResult<()>
Sourcepub fn increment_counter(&self, name: &str, value: f64) -> DMSCResult<()>
pub fn increment_counter(&self, name: &str, value: f64) -> DMSCResult<()>
Sourcepub fn register_gauge(&self, name: &str, help: &str) -> DMSCResult<()>
pub fn register_gauge(&self, name: &str, help: &str) -> DMSCResult<()>
Sourcepub fn register_histogram(
&self,
name: &str,
help: &str,
buckets: Vec<f64>,
) -> DMSCResult<()>
pub fn register_histogram( &self, name: &str, help: &str, buckets: Vec<f64>, ) -> DMSCResult<()>
Sourcepub fn observe_histogram(&self, name: &str, value: f64) -> DMSCResult<()>
pub fn observe_histogram(&self, name: &str, value: f64) -> DMSCResult<()>
Sourcepub fn render(&self) -> DMSCResult<String>
pub fn render(&self) -> DMSCResult<String>
Renders all metrics in Prometheus text format.
§Returns
A string containing all metrics in Prometheus text format wrapped in DMSCResult
Sourcepub fn add_counter_panel(
&self,
dashboard: &mut DMSCGrafanaDashboard,
title: &str,
query: &str,
) -> DMSCResult<()>
pub fn add_counter_panel( &self, dashboard: &mut DMSCGrafanaDashboard, title: &str, query: &str, ) -> DMSCResult<()>
Sourcepub fn add_gauge_panel(
&self,
dashboard: &mut DMSCGrafanaDashboard,
title: &str,
query: &str,
) -> DMSCResult<()>
pub fn add_gauge_panel( &self, dashboard: &mut DMSCGrafanaDashboard, title: &str, query: &str, ) -> DMSCResult<()>
Sourcepub fn add_stat_panel(
&self,
dashboard: &mut DMSCGrafanaDashboard,
title: &str,
query: &str,
) -> DMSCResult<()>
pub fn add_stat_panel( &self, dashboard: &mut DMSCGrafanaDashboard, title: &str, query: &str, ) -> DMSCResult<()>
Sourcepub fn generate_dashboard(
&self,
title: &str,
) -> DMSCResult<DMSCGrafanaDashboard>
pub fn generate_dashboard( &self, title: &str, ) -> DMSCResult<DMSCGrafanaDashboard>
Sourcepub fn generate_default_dashboard(&self) -> DMSCResult<DMSCGrafanaDashboard>
pub fn generate_default_dashboard(&self) -> DMSCResult<DMSCGrafanaDashboard>
Generates a default Grafana dashboard with “DMSC Metrics Dashboard” title.
§Returns
A default Grafana dashboard wrapped in DMSCResult
Trait Implementations§
Source§impl Clone for DMSCPrometheusExporter
impl Clone for DMSCPrometheusExporter
Source§fn clone(&self) -> DMSCPrometheusExporter
fn clone(&self) -> DMSCPrometheusExporter
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 DMSCPrometheusExporter
impl !RefUnwindSafe for DMSCPrometheusExporter
impl Send for DMSCPrometheusExporter
impl Sync for DMSCPrometheusExporter
impl Unpin for DMSCPrometheusExporter
impl !UnwindSafe for DMSCPrometheusExporter
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