Measure sampling, transport volume and bounded exporter losses with reproducible incidents

This commit is contained in:
2026-11-16 02:54:30 +03:00
parent 2701db5106
commit 6bb252efbd
8 changed files with 447 additions and 16 deletions
+5 -1
View File
@@ -58,7 +58,11 @@ def cgroups(services):
for service in services:
for container in compose('ps', '-q', service).split():
inspect = json.loads(subprocess.check_output(['docker', 'inspect', container]))[0]
stats = subprocess.check_output(['docker', 'exec', container, 'sh', '-c', 'cat /sys/fs/cgroup/memory.current /sys/fs/cgroup/memory.peak; cat /sys/fs/cgroup/memory.events'], text=True)
# Read only this container's cgroup through a nonprivileged helper;
# Collector's minimal image intentionally has no shell/python.
pid = str(inspect['State']['Pid'])
script = 'p=$(cut -d: -f3 /proc/' + pid + '/cgroup); cat /sys/fs/cgroup$p/memory.current /sys/fs/cgroup$p/memory.peak; cat /sys/fs/cgroup$p/memory.events'
stats = subprocess.check_output(['docker', 'run', '--rm', '--network=none', '--read-only', '--cap-drop=ALL', '--pid=host', '--cgroupns=host', '--entrypoint', 'sh', 'postgres:17.10-alpine', '-c', script], text=True)
lines = stats.splitlines()
result.append({'service': service, 'container': container,
'current_bytes': int(lines[0]), 'peak_bytes': int(lines[1]),