Right now ch-exporter might fail if clickhouse isn't reachable at all.
This should get caught properly and set the health check to unhealthy.
Traceback (most recent call last):
| File "/app/ch_exporter/collectors.py", line 35, in collect
| result = await client.fetch(self.query)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/app/.venv/lib/python3.11/site-packages/aiochclient/client.py", line 258, in fetch
| return [
| ^
| File "/app/.venv/lib/python3.11/site-packages/aiochclient/client.py", line 258, in <listcomp>
| return [
| ^
| File "/app/.venv/lib/python3.11/site-packages/aiochclient/client.py", line 182, in _execute
| names=await response.__anext__(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/app/.venv/lib/python3.11/site-packages/aiochclient/http_clients/aiohttp.py", line 25, in post_return_lines
| async with self._session.post(url=url, params=params, data=data) as resp:
| File "/app/.venv/lib/python3.11/site-packages/aiohttp/client.py", line 1141, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/app/.venv/lib/python3.11/site-packages/aiohttp/client.py", line 536, in _request
| conn = await self._connector.connect(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/app/.venv/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect
| proto = await self._create_connection(req, traces, timeout)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/app/.venv/lib/python3.11/site-packages/aiohttp/connector.py", line 901, in _create_connection
| _, proto = await self._create_direct_connection(req, traces, timeout)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/app/.venv/lib/python3.11/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
| raise last_exc
| File "/app/.venv/lib/python3.11/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
| transp, proto = await self._wrap_create_connection(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/app/.venv/lib/python3.11/site-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
| raise client_error(req.connection_key, exc) from exc
| aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host ch:8123 ssl:default [Connect call failed ('10.50.249.11', 8123)]
+------------------------------------
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f4e69ebe650>