Fix kolla_container_facts performance

If a container has been running for some time,
it will accumulate MBs worth of healthcheck logs
that kolla_container_facts module will forward
to ansible when action "get_container" is called.
That causes the execution of this module to
slow down considerably.

Change-Id: I6b11672ba093c65cef4d20f8ef716e459c2a92c3
Signed-off-by: Roman Krček <roman.krcek@tietoevry.com>
This commit is contained in:
Roman Krček
2025-02-14 14:26:26 +00:00
parent b076618aae
commit 2e99f85538

View File

@@ -120,6 +120,9 @@ class ContainerFactsWorker():
container_name = container.name
if names and container_name not in names:
continue
# NOTE(r-krcek): For performance reasons don't include
# healthcheck logs. It can contain MBs worth of data!
container.attrs["State"].get("Health", dict()).pop("Log", None)
self.result['containers'][container_name] = container.attrs
def get_containers_state(self):