Skip to content

Commit

Permalink
fix var usage and sample rand stub
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitch Hartweg committed Jan 3, 2025
1 parent db2f396 commit e8e5e65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/scout_apm/sampling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ def sample_uri?(uri)

def ignore_job?(job_name)
return false if ignore_jobs.nil?
@ignored_jobs.include?(job_name)
ignore_jobs.include?(job_name)
end

def sample_job?(job_name)
return false if sample_jobs.nil?
@sample_jobs.has_key?(job_name)
sample_jobs.has_key?(job_name)
end

def sample?(rate)
Expand Down
4 changes: 2 additions & 2 deletions test/unit/sampling_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ def test_job_sample

def test_sample
sampling = ScoutApm::Sampling.new(@global_sample_config)
sampling.stub(:rand, 1) do
sampling.stub(:rand, 0.01) do
assert_equal(false, sampling.sample?(50))
end
sampling.stub(:rand, 99) do
sampling.stub(:rand, 0.99) do
assert_equal(true, sampling.sample?(50))
end
end
Expand Down

0 comments on commit e8e5e65

Please sign in to comment.