Class: Appsignal::Probes::GvlProbe

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/appsignal/probes/gvl.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(appsignal: Appsignal, gvl_tools: ::GVLTools) ⇒ GvlProbe

Returns a new instance of GvlProbe.



21
22
23
24
25
# File 'lib/appsignal/probes/gvl.rb', line 21

def initialize(appsignal: Appsignal, gvl_tools: ::GVLTools)
  Appsignal.logger.debug("Initializing GVL probe")
  @appsignal = appsignal
  @gvl_tools = gvl_tools
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.

Returns:

  • (Boolean)


7
8
9
# File 'lib/appsignal/probes/gvl.rb', line 7

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.

Returns:

  • (Boolean)


12
13
14
# File 'lib/appsignal/probes/gvl.rb', line 12

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.

Returns:

  • (Boolean)


17
18
19
# File 'lib/appsignal/probes/gvl.rb', line 17

def self.ruby_3_2_or_newer?
  Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.2.0")
end

Instance Method Details

#callObject



27
28
29
30
# File 'lib/appsignal/probes/gvl.rb', line 27

def call
  probe_global_timer if @gvl_tools::GlobalTimer.enabled?
  probe_waiting_threads if @gvl_tools::WaitingThreads.enabled?
end