Add Prometheus /metrics HTTP endpoint
Wire up unused metrics_port/metrics_whitelist config into working HTTP server exposing proxy stats in Prometheus text format.
This commit is contained in:
@@ -16,6 +16,7 @@ mod config;
|
||||
mod crypto;
|
||||
mod error;
|
||||
mod ip_tracker;
|
||||
mod metrics;
|
||||
mod protocol;
|
||||
mod proxy;
|
||||
mod stats;
|
||||
@@ -707,6 +708,14 @@ match crate::transport::middle_proxy::fetch_proxy_secret(proxy_secret_path).awai
|
||||
.reload(runtime_filter)
|
||||
.expect("Failed to switch log filter");
|
||||
|
||||
if let Some(port) = config.server.metrics_port {
|
||||
let stats = stats.clone();
|
||||
let whitelist = config.server.metrics_whitelist.clone();
|
||||
tokio::spawn(async move {
|
||||
metrics::serve(port, stats, whitelist).await;
|
||||
});
|
||||
}
|
||||
|
||||
for listener in listeners {
|
||||
let config = config.clone();
|
||||
let stats = stats.clone();
|
||||
|
||||
Reference in New Issue
Block a user