Skip to content

Commit

Permalink
Add alive/total connections status to graphite
Browse files Browse the repository at this point in the history
  • Loading branch information
sorz committed Nov 19, 2018
1 parent 945c319 commit c690dd2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/monitor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ fn send_metrics(monitor: Monitor, handle: Handle)
server.score().map(|s| r("score", s as u64)),
Some(r("tx_bytes", traffic.tx_bytes as u64)),
Some(r("rx_bytes", traffic.rx_bytes as u64)),
Some(r("conns.total", server.conn_total() as u64)),
Some(r("conns.alive", server.conn_alive() as u64)),
]
}).filter_map(|v| v);
let mut buf = Vec::new();
Expand Down
8 changes: 8 additions & 0 deletions src/proxy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@ impl ProxyServer {
self.status().score
}

pub fn conn_alive(&self) -> u32 {
self.status().conn_alive
}

pub fn conn_total(&self) -> u32 {
self.status().conn_total
}

pub fn set_delay(&self, delay: Option<Duration>) {
self.status().delay = delay;
self.status().score =
Expand Down

0 comments on commit c690dd2

Please sign in to comment.