Crate slog_prometheus

Crate slog_prometheus 

Source
Expand description

Record prometheus metrics for messages logged.

Use the MonitoringDrainBuilder to configure a drain, putting it in an appropriate spot in the slog drain stack.

use slog::{info, Drain};
 
let decorator = slog_term::TermDecorator::new().build();
let drain = slog_term::FullFormat::new(decorator).build().fuse();
let drain = slog_async::Async::new(drain).build();
 
let drain = slog_prometheus::MonitoringDrainBuilder::new(drain)
    .build()
    .expect("Failed configuring setting up prometheus")
    .fuse();
let drain = slog::LevelFilter::new(drain, slog::Level::Info).fuse();
 
let logger = slog::Logger::root(drain, slog::o!());
 
info!(logger, "Finished setting up!");
 

Structs§

MonitoringDrain
The main monitoring struct, implementing slog::Drain
MonitoringDrainBuilder
Helper struct to build the MonitoringDrain conveniently

Enums§

MonitoringDrainError
During build, prometheus might return an error, which requires this crate to return an error.