Wait for docker containers to exist before starting recording.

This enables us to capture the full life of the container since the script can now be kicked off before the container is launched.
This commit is contained in:
Tom Alexander 2024-10-18 08:32:02 -04:00
parent 927c14d238
commit 561bfa40ab
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -30,6 +30,12 @@ def main():
logging.basicConfig(level=logging.INFO)
samples: list[Sample] = []
labels: dict[ContainerId, ContainerName] = {}
# First wait for any docker container to exist.
while True:
sample, labels_in_sample = take_sample()
if labels_in_sample:
break
# And then record memory until no containers exist.
while True:
sample, labels_in_sample = take_sample()
if not labels_in_sample: