[][src]Struct hotmic_prometheus::PrometheusExporter

pub struct PrometheusExporter { /* fields omitted */ }

Exports metrics by exposing a Prometheus exporter endpoint.

Methods

impl PrometheusExporter[src]

pub fn new(controller: Controller, addr: SocketAddr) -> Self[src]

Creates a new PrometheusExporter.

When run/spawned, the exporter will listen at the given socket address, responding to any requests by taking a snapshot and returning it in the text-based Prometheus exposition format.

pub fn run(self)[src]

Runs the exporter synchronously, blocking the calling thread.

You should run this in a dedicated thread:

let addr = "localhost:9090".parse().expect("failed to parse listen address");
let mut exporter = PrometheusExporter::new(controller, addr);
std::thread::spawn(move || exporter.run());

pub fn into_future(self) -> impl Future<Item = (), Error = HyperError> + Send[src]

Converts this exporter into a future that runs the Hyper-based exporter endpoint.

let addr = "localhost:9090".parse().expect("failed to parse listen address");
let exporter = PrometheusExporter::new(controller, addr);
let server = exporter.into_future().map_err(|_| ());
tokio::run(server);

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Erased for T