Sha256: 819ebf7a5a3633b9531aa9cd80420b58028e0760ffb25ea80a60573edafc9016
Contents?: true
Size: 758 Bytes
Versions: 5
Compression:
Stored size: 758 Bytes
Contents
module Appsignal module System def self.container? heroku? || Container.id end def self.heroku? ENV.key? "DYNO".freeze end module Container CGROUP_FILE = "/proc/self/cgroup".freeze class << self def id case cgroups when %r{docker[-|/]([0-9a-f]+)} $1 when %r{lxc/([0-9a-f-]+)$} # LXC / Heroku $1 end end private def cgroups file = CGROUP_FILE return unless File.exist? file File.read(file) rescue SystemCallError => e Appsignal.logger.debug "Unable to read '#{file}' to determine cgroup" Appsignal.logger.debug e end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems