Module: Appsignal::System Private
- Defined in:
- lib/appsignal/system.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
System environment detection module.
Provides useful methods to find out more about the host system.
Constant Summary collapse
- MUSL_TARGET =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"linux-musl".freeze
- GEM_EXT_PATH =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
File.("../../../ext", __FILE__).freeze
Class Method Summary collapse
-
.agent_platform ⇒ String
private
Detect agent and extension platform build.
- .heroku? ⇒ Boolean private
-
.installed_agent_architecture ⇒ String
private
Returns the architecture for which the agent was installed.
- .jruby? ⇒ Boolean private
- .ldd_version_output ⇒ Object private
- .versionify(version) ⇒ Object private
Class Method Details
.agent_platform ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Detect agent and extension platform build
Used by ext/extconf.rb
to select which build it should download and
install.
Use export APPSIGNAL_BUILD_FOR_MUSL=1
if the detection doesn't work
and to force selection of the musl build.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/appsignal/system.rb', line 40 def self.agent_platform return MUSL_TARGET if ENV["APPSIGNAL_BUILD_FOR_MUSL"] host_os = RbConfig::CONFIG["host_os"].downcase local_os = case host_os when /linux/ "linux" when /darwin/ "darwin" when /freebsd/ "freebsd" else host_os end if local_os =~ /linux/ ldd_output = ldd_version_output return MUSL_TARGET if ldd_output.include? "musl" ldd_version = ldd_output.match(/\d+\.\d+/) if ldd_version && versionify(ldd_version[0]) < versionify("2.15") return MUSL_TARGET end end local_os end |
.heroku? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/appsignal/system.rb', line 11 def self.heroku? ENV.key? "DYNO".freeze end |
.installed_agent_architecture ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the architecture for which the agent was installed.
This value is saved when the gem is installed in ext/extconf.rb
.
We use this value to build the diagnose report with the installed
CPU type and platform, rather than the detected architecture in
agent_platform during the diagnose run.
24 25 26 27 28 |
# File 'lib/appsignal/system.rb', line 24 def self.installed_agent_architecture architecture_file = File.join(GEM_EXT_PATH, "appsignal.architecture") return unless File.exist?(architecture_file) File.read(architecture_file) end |
.jruby? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
77 78 79 |
# File 'lib/appsignal/system.rb', line 77 def self.jruby? RUBY_PLATFORM == "java" end |
.ldd_version_output ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
73 74 75 |
# File 'lib/appsignal/system.rb', line 73 def self.ldd_version_output `ldd --version 2>&1` end |
.versionify(version) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
68 69 70 |
# File 'lib/appsignal/system.rb', line 68 def self.versionify(version) Gem::Version.new(version) end |