Class: Appsignal::Probes::GvlProbe
- Includes:
- Helpers
- Defined in:
- lib/appsignal/probes/gvl.rb
Class Method Summary collapse
- .dependencies_present? ⇒ Boolean private
- .gvltools_0_2_or_newer? ⇒ Boolean private
- .ruby_3_2_or_newer? ⇒ Boolean private
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(appsignal: Appsignal, gvl_tools: ::GVLTools) ⇒ GvlProbe
constructor
A new instance of GvlProbe.
Constructor Details
#initialize(appsignal: Appsignal, gvl_tools: ::GVLTools) ⇒ GvlProbe
Returns a new instance of GvlProbe.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/appsignal/probes/gvl.rb', line 24 def initialize(appsignal: Appsignal, gvl_tools: ::GVLTools) Appsignal.internal_logger.debug("Initializing GVL probe") @appsignal = appsignal @gvl_tools = gvl_tools # Store the process name and ID at initialization time # to avoid picking up changes to the process name at runtime @process_name = File.basename($PROGRAM_NAME).split.first || "[unknown process]" @process_id = Process.pid end |
Class Method Details
.dependencies_present? ⇒ 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.
9 10 11 12 |
# File 'lib/appsignal/probes/gvl.rb', line 9 def self.dependencies_present? defined?(::GVLTools) && gvltools_0_2_or_newer? && ruby_3_2_or_newer? && !Appsignal::System.jruby? end |
.gvltools_0_2_or_newer? ⇒ 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.
15 16 17 |
# File 'lib/appsignal/probes/gvl.rb', line 15 def self.gvltools_0_2_or_newer? Gem::Version.new(::GVLTools::VERSION) >= Gem::Version.new("0.2.0") end |
.ruby_3_2_or_newer? ⇒ 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.
20 21 22 |
# File 'lib/appsignal/probes/gvl.rb', line 20 def self.ruby_3_2_or_newer? Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.2.0") end |
Instance Method Details
#call ⇒ Object
35 36 37 38 |
# File 'lib/appsignal/probes/gvl.rb', line 35 def call probe_global_timer probe_waiting_threads if @gvl_tools::WaitingThreads.enabled? end |