moduleGitlabmoduleMetrics# Module for gathering system/process statistics such as the memory usage.## This module relies on the /proc filesystem being available. If /proc is# not available the methods of this module will be stubbed.moduleSystemifFile.exist?('/proc')# Returns the current process' memory usage in bytes.defself.memory_usagemem=0match=File.read('/proc/self/status').match(/VmRSS:\s+(\d+)/)ifmatchandmatch[1]mem=match[1].to_f*1024endmemenddefself.file_descriptor_countDir.glob('/proc/self/fd/*').lengthendelsedefself.memory_usage0.0enddefself.file_descriptor_count0endendendendend