From c8506a4134240b156abc63acd6d9bf94e649225c Mon Sep 17 00:00:00 2001 From: SantiagoPittella Date: Mon, 23 Dec 2024 16:19:51 -0300 Subject: [PATCH] review: use always localhost for metrics host --- bin/tx-prover/README.md | 4 +++- bin/tx-prover/src/commands/mod.rs | 3 --- bin/tx-prover/src/commands/proxy.rs | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/bin/tx-prover/README.md b/bin/tx-prover/README.md index 9f3a695a1..9a5fc6882 100644 --- a/bin/tx-prover/README.md +++ b/bin/tx-prover/README.md @@ -61,6 +61,8 @@ max_retries_per_request = 1 max_req_per_sec = 5 # Interval to check the health of the workers health_check_interval_secs = 1 +# Port of the metrics server +prometheus_port = 6192 ``` Then, to start the proxy service, you will need to run: @@ -122,7 +124,7 @@ If Docker is not an option, Jaeger can also be set up directly on your machine o ## Metrics -The proxy includes a service that provides metrics for [Prometheus](https://prometheus.io/docs/introduction/overview/). This service is always enabled and uses the host and port defined in the configuration file. The metrics are available at the `/metrics` endpoint. +The proxy includes a service that provides metrics for [Prometheus](https://prometheus.io/docs/introduction/overview/). This service is always enabled and uses the port defined in the configuration file. The metrics are available at the `/metrics` endpoint. To consume and display the metrics, you can use Prometheus and Grafana. The simplest way to install Prometheus and Grafana is by using Docker containers. To do so, run: diff --git a/bin/tx-prover/src/commands/mod.rs b/bin/tx-prover/src/commands/mod.rs index 68c23e824..caff3dc44 100644 --- a/bin/tx-prover/src/commands/mod.rs +++ b/bin/tx-prover/src/commands/mod.rs @@ -42,8 +42,6 @@ pub struct ProxyConfig { pub available_workers_polling_time_ms: u64, /// Health check interval in seconds. pub health_check_interval_secs: u64, - /// Prometheus metrics host. - pub prometheus_host: String, /// Prometheus metrics port. pub prometheus_port: u16, } @@ -60,7 +58,6 @@ impl Default for ProxyConfig { max_req_per_sec: 5, available_workers_polling_time_ms: 20, health_check_interval_secs: 1, - prometheus_host: "0.0.0.0".into(), prometheus_port: 6192, } } diff --git a/bin/tx-prover/src/commands/proxy.rs b/bin/tx-prover/src/commands/proxy.rs index 01015fc33..8880b9285 100644 --- a/bin/tx-prover/src/commands/proxy.rs +++ b/bin/tx-prover/src/commands/proxy.rs @@ -68,9 +68,8 @@ impl StartProxy { // Enable Prometheus metrics let mut prometheus_service_http = pingora::services::listening::Service::prometheus_http_service(); - prometheus_service_http.add_tcp( - format!("{}:{}", proxy_config.prometheus_host, proxy_config.prometheus_port).as_str(), - ); + prometheus_service_http + .add_tcp(format!("{}:{}", "127.0.0.1", proxy_config.prometheus_port).as_str()); server.add_service(prometheus_service_http); server.add_service(health_check_service);