Sha256: f3253703d356a1ad32e3a2362e31c6775b8ea36af432160a49942d45986ed92d

Contents?: true

Size: 1.08 KB

Versions: 10

Compression:

Stored size: 1.08 KB

Contents

describe Appsignal::Probes::GvlProbe do
  let(:appsignal_mock) { AppsignalMock.new(:hostname => hostname) }
  let(:probe) { described_class.new(:appsignal => appsignal_mock, :gvl_tools => FakeGVLTools) }

  let(:hostname) { "some-host" }

  after(:each) { FakeGVLTools.reset }

  context "with global timer enabled" do
    before(:each) { FakeGVLTools::GlobalTimer.enabled = true }

    it "gauges the global timer delta" do
      FakeGVLTools::GlobalTimer.monotonic_time = 100_000_000
      probe.call

      expect(appsignal_mock.gauges).to be_empty

      FakeGVLTools::GlobalTimer.monotonic_time = 300_000_000
      probe.call

      expect(appsignal_mock.gauges).to eq [
        ["gvl_global_timer", 200, { :hostname => hostname }]
      ]
    end
  end

  context "with waiting threads enabled" do
    before(:each) { FakeGVLTools::WaitingThreads.enabled = true }

    it "gauges the waiting threads count" do
      FakeGVLTools::WaitingThreads.count = 3
      probe.call

      expect(appsignal_mock.gauges).to eq [
        ["gvl_waiting_threads", 3, { :hostname => hostname }]
      ]
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
appsignal-3.3.11-java spec/lib/appsignal/probes/gvl_spec.rb
appsignal-3.3.11 spec/lib/appsignal/probes/gvl_spec.rb
appsignal-3.4.0-java spec/lib/appsignal/probes/gvl_spec.rb
appsignal-3.4.0 spec/lib/appsignal/probes/gvl_spec.rb
appsignal-3.3.10-java spec/lib/appsignal/probes/gvl_spec.rb
appsignal-3.3.10 spec/lib/appsignal/probes/gvl_spec.rb
appsignal-3.3.9-java spec/lib/appsignal/probes/gvl_spec.rb
appsignal-3.3.9 spec/lib/appsignal/probes/gvl_spec.rb
appsignal-3.3.8-java spec/lib/appsignal/probes/gvl_spec.rb
appsignal-3.3.8 spec/lib/appsignal/probes/gvl_spec.rb