[−][src]Struct hotmic_prometheus::PrometheusExporter
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
impl Send for PrometheusExporter
impl Sync for PrometheusExporter
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.