diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-10 21:39:25 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-10 21:39:25 -0800 |
commit | 9a83067d04c9648416b92fc8d7b8a542b0b9aa96 (patch) | |
tree | 4622455b0f694262db5aa77314a3941ab37419fc /rust/src/bin/fatcatd.rs | |
parent | b75aa46db21c6f7a22b6fbbbd00b1e5d93e1d1ae (diff) | |
download | fatcat-9a83067d04c9648416b92fc8d7b8a542b0b9aa96.tar.gz fatcat-9a83067d04c9648416b92fc8d7b8a542b0b9aa96.zip |
code docs/comments and rustfmt
Diffstat (limited to 'rust/src/bin/fatcatd.rs')
-rw-r--r-- | rust/src/bin/fatcatd.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/rust/src/bin/fatcatd.rs b/rust/src/bin/fatcatd.rs index 816ea1f0..75a6f000 100644 --- a/rust/src/bin/fatcatd.rs +++ b/rust/src/bin/fatcatd.rs @@ -5,6 +5,8 @@ extern crate slog; #[macro_use] extern crate hyper; +use cadence::prelude::*; +use cadence::{BufferedUdpMetricSink, QueuingMetricSink, StatsdClient}; use clap::{App, Arg}; use fatcat::errors::Result; use fatcat::server; @@ -15,8 +17,6 @@ use iron_slog::{DefaultLogFormatter, LoggerMiddleware}; use sentry::integrations::panic; use slog::{Drain, Logger}; use std::env; -use cadence::{StatsdClient, QueuingMetricSink, BufferedUdpMetricSink}; -use cadence::prelude::*; use std::net::UdpSocket; // HTTP header middleware @@ -32,7 +32,6 @@ impl AfterMiddleware for XClacksOverheadMiddleware { } } - /// Create custom server, wire it to the autogenerated router, /// and pass it to the web server. fn main() -> Result<()> { @@ -70,7 +69,7 @@ fn main() -> Result<()> { match env::var("FATCAT_STATSD_HOST") { Err(_) => { info!(logger, "no metrics recipient configured"); - }, + } Ok(host) => { let port: u16 = match env::var("FATCAT_STATSD_PORT") { Err(_) => cadence::DEFAULT_PORT, @@ -80,7 +79,10 @@ fn main() -> Result<()> { socket.set_nonblocking(true).unwrap(); let udp_sink = BufferedUdpMetricSink::from((host.as_ref(), port), socket).unwrap(); let queuing_sink = QueuingMetricSink::from(udp_sink); - info!(logger, "sending statsd metrics via UDP to: {}:{}", host, port); + info!( + logger, + "sending statsd metrics via UDP to: {}:{}", host, port + ); server.metrics = StatsdClient::from_sink("fatcat.api", queuing_sink); //server.metrics = StatsdClient::from_udp_host("fatcat.api", (host.as_ref(), port))?; server.metrics.incr("restart").unwrap(); |