Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 reduce noisy logs in director-v2 #5300

Merged

Conversation

GitHK
Copy link
Contributor

@GitHK GitHK commented Feb 5, 2024

What do these changes do?

When the method attempt_pod_removal_and_data_saving is called, it is not guaranteed that the dynamic-sidecar is present. The service_free_reserved_disk_space was not taking this into account. It is now in line with service_remove_containers.

Removes these not so useful tracebacks from director-v2

Click to see error traceback sample
"2024-02-05T05:30:32.937Z","ops2","log_level=ERROR | log_timestamp=2024-02-05 05:30:32,936 | log_source=asyncio:run(44) | log_uid=None | log_msg=Task exception was never retrieved
future: <Task finished name='simcore_service_director_v2.modules.dynamic_sidecar.scheduler._core._scheduler.observe_dy-sidecar_7aff1391-1e91-5eb4-b6af-92c4d387915d' coro=<observing_single_service() done, defined at /home/scu/.venv/lib/python3.10/site-packages/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_observer.py:85> exception=ClientHttpError()>
Traceback (most recent call last):
  File ""/home/scu/.venv/lib/python3.10/site-packages/anyio/_core/_sockets.py"", line 189, in connect_tcp
    addr_obj = ip_address(remote_host)
  File ""/usr/local/lib/python3.10/ipaddress.py"", line 54, in ip_address
    raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 address')
ValueError: 'dy-sidecar_7aff1391-1e91-5eb4-b6af-92c4d387915d' does not appear to be an IPv4 or IPv6 address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpcore/_exceptions.py"", line 10, in map_exceptions
    yield
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpcore/_backends/anyio.py"", line 114, in connect_tcp
    stream: anyio.abc.ByteStream = await anyio.connect_tcp(
  File ""/home/scu/.venv/lib/python3.10/site-packages/anyio/_core/_sockets.py"", line 192, in connect_tcp
    gai_res = await getaddrinfo(
socket.gaierror: [Errno -2] Name or service not known

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpx/_transports/default.py"", line 60, in map_httpcore_exceptions
    yield
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpx/_transports/default.py"", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpcore/_async/connection_pool.py"", line 262, in handle_async_request
    raise exc
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpcore/_async/connection_pool.py"", line 245, in handle_async_request
    response = await connection.handle_async_request(request)
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpcore/_async/connection.py"", line 92, in handle_async_request
    raise exc
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpcore/_async/connection.py"", line 69, in handle_async_request
    stream = await self._connect(request)
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpcore/_async/connection.py"", line 117, in _connect
    stream = await self._network_backend.connect_tcp(**kwargs)
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpcore/_backends/auto.py"", line 31, in connect_tcp
    return await self._backend.connect_tcp(
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpcore/_backends/anyio.py"", line 112, in connect_tcp
    with map_exceptions(exc_map):
  File ""/usr/local/lib/python3.10/contextlib.py"", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpcore/_exceptions.py"", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectError: [Errno -2] Name or service not known

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File ""/home/scu/.venv/lib/python3.10/site-packages/servicelib/fastapi/http_client_thin.py"", line 133, in request_wrapper
    async for attempt in AsyncRetrying(
  File ""/home/scu/.venv/lib/python3.10/site-packages/tenacity/_asyncio.py"", line 71, in __anext__
    do = self.iter(retry_state=self._retry_state)
  File ""/home/scu/.venv/lib/python3.10/site-packages/tenacity/__init__.py"", line 325, in iter
    raise retry_exc.reraise()
  File ""/home/scu/.venv/lib/python3.10/site-packages/tenacity/__init__.py"", line 158, in reraise
    raise self.last_attempt.result()
  File ""/usr/local/lib/python3.10/concurrent/futures/_base.py"", line 451, in result
    return self.__get_result()
  File ""/usr/local/lib/python3.10/concurrent/futures/_base.py"", line 403, in __get_result
    raise self._exception
  File ""/home/scu/.venv/lib/python3.10/site-packages/servicelib/fastapi/http_client_thin.py"", line 142, in request_wrapper
    r: Response = await request_func(zelf, *args, **kwargs)
  File ""/home/scu/.venv/lib/python3.10/site-packages/servicelib/fastapi/http_client_thin.py"", line 170, in request_wrapper
    response = await request_func(zelf, *args, **kwargs)
  File ""/home/scu/.venv/lib/python3.10/site-packages/simcore_service_director_v2/modules/dynamic_sidecar/api_client/_thin.py"", line 286, in post_disk_reserved_free
    return await self.client.post(url)
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpx/_client.py"", line 1848, in post
    return await self.request(
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpx/_client.py"", line 1530, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpx/_client.py"", line 1617, in send
    response = await self._send_handling_auth(
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpx/_client.py"", line 1645, in _send_handling_auth
    response = await self._send_handling_redirects(
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpx/_client.py"", line 1682, in _send_handling_redirects
    response = await self._send_single_request(request)
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpx/_client.py"", line 1719, in _send_single_request
    response = await transport.handle_async_request(request)
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpx/_transports/default.py"", line 352, in handle_async_request
    with map_httpcore_exceptions():
  File ""/usr/local/lib/python3.10/contextlib.py"", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File ""/home/scu/.venv/lib/python3.10/site-packages/httpx/_transports/default.py"", line 77, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError: [Errno -2] Name or service not known

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File ""/home/scu/.venv/lib/python3.10/site-packages/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_observer.py"", line 133, in observing_single_service
    await attempt_pod_removal_and_data_saving(app, scheduler_data)
  File ""/home/scu/.venv/lib/python3.10/site-packages/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_utils.py"", line 291, in attempt_pod_removal_and_data_saving
    await service_free_reserved_disk_space(
  File ""/home/scu/.venv/lib/python3.10/site-packages/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_utils.py"", line 135, in service_free_reserved_disk_space
    await sidecars_client.free_reserved_disk_space(scheduler_data.endpoint)
  File ""/home/scu/.venv/lib/python3.10/site-packages/simcore_service_director_v2/modules/dynamic_sidecar/api_client/_public.py"", line 470, in free_reserved_disk_space
    await self._thin_client.post_disk_reserved_free(dynamic_sidecar_endpoint)
  File ""/home/scu/.venv/lib/python3.10/site-packages/servicelib/fastapi/http_client_thin.py"", line 147, in request_wrapper
    raise ClientHttpError(error=e) from e
servicelib.fastapi.http_client_thin.ClientHttpError: Received httpx.HTTPError: [Errno -2] Name or service not known",

Related issue/s

How to test

Dev Checklist

DevOps Checklist

@GitHK GitHK self-assigned this Feb 5, 2024
@GitHK GitHK added this to the This is Sparta! milestone Feb 5, 2024
@GitHK GitHK added the a:director-v2 issue related with the director-v2 service label Feb 5, 2024
@GitHK GitHK marked this pull request as ready for review February 5, 2024 15:09
Copy link

codecov bot commented Feb 5, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (e211608) 83.0% compared to head (6cbbe50) 65.1%.

❗ Current head 6cbbe50 differs from pull request most recent head 2b54b55. Consider uploading reports for the commit 2b54b55 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #5300      +/-   ##
=========================================
- Coverage    83.0%   65.1%   -18.0%     
=========================================
  Files        1239     542     -697     
  Lines       50972   27146   -23826     
  Branches     1127     202     -925     
=========================================
- Hits        42356   17696   -24660     
- Misses       8376    9400    +1024     
+ Partials      240      50     -190     
Flag Coverage Δ
integrationtests 65.1% <50.0%> (+1.3%) ⬆️
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...s/dynamic_sidecar/scheduler/_core/_events_utils.py 91.5% <50.0%> (-2.3%) ⬇️

... and 971 files with indirect coverage changes

Copy link

sonarcloud bot commented Feb 5, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@GitHK GitHK requested a review from pcrespov February 5, 2024 16:45
Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx

@GitHK GitHK merged commit 2240f7b into ITISFoundation:master Feb 6, 2024
50 checks passed
@GitHK GitHK deleted the pr-osparc-dv2-logs-noise-reduction branch February 6, 2024 06:41
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Feb 14, 2024
39 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:director-v2 issue related with the director-v2 service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants