summaryrefslogtreecommitdiffstats
path: root/rust/src/bin/fatcatd.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src/bin/fatcatd.rs')
-rw-r--r--rust/src/bin/fatcatd.rs12
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();