Sha256: f4d1c1a0c117f53645ae183bd221676f7bb821624de95f73153c0a30a13d4fac
Contents?: true
Size: 704 Bytes
Versions: 13
Compression:
Stored size: 704 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 def self.id case cgroups when %r{docker[-|/]([0-9a-f]+)} $1 when %r{lxc/([0-9a-f-]+)$} # LXC / Heroku $1 end end private def self.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
Version data entries
13 entries across 13 versions & 1 rubygems