Add SHOW CLIENTS / SHOW SERVERS + Stats refactor and tests (#159)

* wip

* Main Thread Panic when swarmed with clients

* fix

* fix

* 1024

* fix

* remove test

* Add SHOW CLIENTS

* revert

* fmt

* Refactor + tests

* fmt

* add test

* Add SHOW SERVERS + Make PR unreviewable

* prometheus

* add state to clients and servers

* fmt

* Add application_name to server stats

* Add tests for waiting clients

* Docs

* remove comment

* comments

* typo

* cleanup

* CI
This commit is contained in:
Mostafa Abdelraouf
2022-09-14 10:20:41 -05:00
committed by GitHub
parent 075167431d
commit 4ae1bc8d32
9 changed files with 1259 additions and 428 deletions

View File

@@ -8,7 +8,7 @@ use std::net::SocketAddr;
use crate::config::Address;
use crate::pool::get_all_pools;
use crate::stats::get_stats;
use crate::stats::get_address_stats;
struct MetricHelpType {
help: &'static str,
@@ -164,7 +164,7 @@ impl PrometheusMetric {
async fn prometheus_stats(request: Request<Body>) -> Result<Response<Body>, hyper::http::Error> {
match (request.method(), request.uri().path()) {
(&Method::GET, "/metrics") => {
let stats = get_stats();
let stats: HashMap<usize, HashMap<String, i64>> = get_address_stats();
let mut lines = Vec::new();
for (_, pool) in get_all_pools() {