From f7f919cee1b4e25c57dd604b6b28f006b5d90571 Mon Sep 17 00:00:00 2001 From: LSmyrnaios Date: Tue, 16 May 2023 12:24:14 +0300 Subject: [PATCH] - Make sure we set the "hasShutdown" to "false", for each known worker which was restarted. - Fix markdown of urls in prometheus' readme. --- prometheus/README.md | 8 ++++---- prometheus/prometheus.yml | 2 +- .../urls_controller/controllers/UrlsController.java | 5 +++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/prometheus/README.md b/prometheus/README.md index d40a6ba..4ac6f11 100644 --- a/prometheus/README.md +++ b/prometheus/README.md @@ -6,16 +6,16 @@ ### Check the metrics -- To check the raw metrics hit this url in your browser: http://:1880/api/actuator/prometheus -- To check the metrics though GUI, with some graphs, hit: http://:9090 +- To check the raw metrics check the output of this url, in your browser: http://\:1880/api/actuator/prometheus +- To check the metrics though GUI, with some graphs, check: http://\:9090 ### Visualize metrics in Grafana -- Access grafana in: http://:3000/ +- Access grafana in: http://\:3000/ - Give the default username and password: "admin" (for both). - Specify the new password. - Then, add a "Prometheus" datasource. -- Specify the prometheus url: http://:9090 +- Specify the prometheus url: http://\:9090 - Save the datasource. - Go to "dashboards", click "import", add the number "12900" in the input and click "load" and "next". - Then select the "prometheus" datasource and click "import". diff --git a/prometheus/prometheus.yml b/prometheus/prometheus.yml index 72101e3..c8bd3b0 100644 --- a/prometheus/prometheus.yml +++ b/prometheus/prometheus.yml @@ -14,5 +14,5 @@ scrape_configs: metrics_path: '/api/actuator/prometheus' # Job to scrape application metrics scrape_interval: 15s scrape_timeout: 10s - static_configs: # TODO - Find a way to automatically apply the publicIP of the host machine it is running on. + static_configs: # TODO - Check if there is a way to automatically apply the publicIP of the host machine it is running on. - targets: [ ':1880' ] diff --git a/src/main/java/eu/openaire/urls_controller/controllers/UrlsController.java b/src/main/java/eu/openaire/urls_controller/controllers/UrlsController.java index 0de7c2d..b003d72 100644 --- a/src/main/java/eu/openaire/urls_controller/controllers/UrlsController.java +++ b/src/main/java/eu/openaire/urls_controller/controllers/UrlsController.java @@ -91,6 +91,11 @@ public class UrlsController { if ( savedWorkerIp.equals(remoteAddr) ) { logger.warn("The worker with id \"" + workerId + "\" has changed IP from \"" + savedWorkerIp + "\" to \"" + remoteAddr + "\"."); workerInfo.setWorkerIP(remoteAddr); // Set the new IP. The update will be reflected in the map. + } // In this case, the worker may has previously informed the Controller it has shutdown or it may have crashed. + + if ( workerInfo.getHasShutdown() ) { + logger.info("The worker with id \"" + workerId + "\" was restarted."); + workerInfo.setHasShutdown(false); } } else { logger.info("The worker \"" + workerId + "\" is requesting assignments for the first time. Going to store its IP and create the remote parquet subdirectories (in HDFS).");