Skip to content

Commit

Permalink
Handle stats for STOPPED containers
Browse files Browse the repository at this point in the history
Reported in this PR: #1
  • Loading branch information
raags committed Jun 23, 2021
1 parent f123f4c commit a190ca0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ecs_container_exporter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ def parse_container_metadata(self, docker_stats, task_cpu_limit,
"""
container_metrics_all = []

# ignore stats for containers in STOPPED state
for container_id in list(docker_stats[1].keys()):
if not docker_stats[1][container_id]:
del(docker_stats[0][container_id])
del(docker_stats[1][container_id])
self.log.debug(f'Ignoring null stats for container_id {container_id}')

try:
# CPU metrics
container_metrics_all.append(
Expand Down

0 comments on commit a190ca0

Please sign in to comment.