Struct prometheus_hyper::Server [−][src]
pub struct Server {}Implementations
Create and run the metrics Server
Arguments
registry- provide theRegistryyou are also registering your metric types to.addr-host:ipto tcp listen on.shutdown- aFuture, once this completes the server will start to shut down. You can use asignalorNotifyfor clean shutdown orpendingto newer shutdown.
Result
hyper::Errorreturns 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 UnwindSafe for Server
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more