mirror of https://github.com/nicolargo/glances
cleanup: containers (plugin) - add `inactive_file` to stats only if present
parent
f640b6b8b4
commit
b303001f58
|
@ -258,6 +258,7 @@ class PluginModel(GlancesPluginModel):
|
|||
|
||||
def memory_usage_no_cache(self, mem):
|
||||
"""Return the 'real' memory usage by removing inactive_file to usage"""
|
||||
# Ref: https://github.com/docker/docker-py/issues/3210
|
||||
return mem['usage'] - (mem['inactive_file'] if 'inactive_file' in mem else 0)
|
||||
|
||||
def update_views(self):
|
||||
|
|
|
@ -133,10 +133,9 @@ class DockerStatsFetcher:
|
|||
|
||||
stats = {field: memory_stats[field] for field in self.MANDATORY_MEMORY_FIELDS}
|
||||
|
||||
# Optional field stats:inactive_file
|
||||
stats['inactive_file'] = 0
|
||||
if 'stats' in memory_stats:
|
||||
stats['inactive_file'] = memory_stats['stats'].get('inactive_file', 0)
|
||||
# Optional field stats: inactive_file
|
||||
if memory_stats.get('stats', {}).get('inactive_file') is not None:
|
||||
stats['inactive_file'] = memory_stats['stats']['inactive_file']
|
||||
|
||||
# Return the stats
|
||||
return stats
|
||||
|
|
Loading…
Reference in New Issue