Struct prometheus_hyper::Server [−][src]
Implementations
impl Server
[src]
pub async fn run<S, F>(
registry: Arc<Registry>,
addr: S,
shutdown: F
) -> Result<(), Error> where
S: Into<SocketAddr>,
F: Future<Output = ()>,
[src]
registry: Arc<Registry>,
addr: S,
shutdown: F
) -> Result<(), Error> where
S: Into<SocketAddr>,
F: Future<Output = ()>,
Create and run the metrics Server
Arguments
registry
- provide theRegistry
you are also registering your metric types to.addr
-host:ip
to tcp listen on.shutdown
- aFuture
, once this completes the server will start to shut down. You can use asignal
orNotify
for clean shutdown orpending
to newer shutdown.
Result
hyper::Error
returns the result if the shutdown was successful.
Examples
use prometheus::Registry; use prometheus_hyper::Server; use std::{net::SocketAddr, sync::Arc}; let registry = Arc::new(Registry::new()); // Start Server endlessly tokio::spawn(async move { Server::run( Arc::clone(®istry), SocketAddr::from(([0; 4], 8080)), futures_util::future::pending(), ) .await });
Auto Trait Implementations
impl RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnwindSafe for Server
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,