Docker Community Forums

Share and learn in the Docker community.

Pace of container.stats() stream is inconsistent

Mostly an observation, but a little annoying…

The scheduler that drives stats collection / publishing is very inconsistent on its interval - up to 9%, usually longer than 1 second intervals, but sometimes shorter.

container = client.containers.get(containerID)
for stats in container.stats(decode=True):
    print(time.time())

A little jitter, I’d get, but it behaves more like it’s doing a sleep(1) after a variable runtime. So, you end up with something closer to 58 updates a minute, but varying +3/-2 updates.

I’m doing my own collection and reporting, so I can work around it, but it really could / should be better than this without much complexity.

Presuming this is worth tending to, where’s the best place to file the issue? It seems likely to be more of an engine behavior than a Mac-specific issue.

Desktop v2.2.0.0 (Engine 19.03.5)