From 3fb42f0c7dfde1252e786d676b261730351ec954 Mon Sep 17 00:00:00 2001 From: Santiago Mola Date: Mon, 7 Aug 2023 12:21:37 +0200 Subject: [PATCH] Less verbose curl health checks Cleaner logs. Before: ``` 08:08:13.947 DEBUG Healthcheck #12: ExecResult(exit_code=7, output=b' % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\ncurl: (7) Failed to connect to localhost port 7777 after 0 ms: Connection refused\n') 08:08:24.943 DEBUG Healthcheck #13: ExecResult(exit_code=22, output=b' % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- 0:00:04 --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- 0:00:05 --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- 0:00:06 --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- 0:00:07 --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- 0:00:08 --:--:-- 0\r 0 0 0 0 0 0 0 0 --:--:-- 0:00:09 --:--:-- 0\r 0 1046 0 0 0 0 0 0 --:--:-- 0:00:09 --:--:-- 0\ncurl: (22) The requested URL returned error: 404\n') ``` After: ``` 12:21:01.169 DEBUG Healthcheck #5: ExecResult(exit_code=7, output=b'curl: (7) Failed to connect to localhost port 7777 after 0 ms: Connection refused\n') 12:21:07.115 DEBUG Healthcheck #6: ExecResult(exit_code=22, output=b'curl: (22) The requested URL returned error: 404\n') ``` --- utils/_context/containers.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/utils/_context/containers.py b/utils/_context/containers.py index b009580a12d..2f4d428dfed 100644 --- a/utils/_context/containers.py +++ b/utils/_context/containers.py @@ -283,7 +283,10 @@ def __init__(self, host_log_folder, use_proxy=True) -> None: name="agent", host_log_folder=host_log_folder, environment=environment, - healthcheck={"test": f"curl --fail http://localhost:{self.agent_port}/info", "retries": 60}, + healthcheck={ + "test": f"curl --fail --silent --show-error http://localhost:{self.agent_port}/info", + "retries": 60, + }, ports={self.agent_port: f"{self.agent_port}/tcp"}, ) @@ -334,7 +337,7 @@ def __init__( # ddprof's perf event open is blocked by default by docker's seccomp profile # This is worse than the line above though prevents mmap bugs locally security_opt=["seccomp=unconfined"], - healthcheck={"test": f"curl --fail localhost:{weblog.port}", "retries": 60}, + healthcheck={"test": f"curl --fail --silent --show-error localhost:{weblog.port}", "retries": 60}, ports={"7777/tcp": weblog.port, "7778/tcp": weblog._grpc_port}, )