Skip to content

Commit

Permalink
wip - fix issues with profiler state leaking between specs (StackProf)
Browse files Browse the repository at this point in the history
  • Loading branch information
solnic committed Aug 23, 2024
1 parent abd81b2 commit ae6090f
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions sentry-ruby/spec/sentry/rack/capture_exceptions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -681,11 +681,6 @@ def will_be_sampled_by_sdk

shared_examples "a profiled transaction" do
it "collects a profile" do
app = ->(_) do
ProfilerTest::Bar.bar
[200, {}, "ok"]
end

stack = described_class.new(app)
stack.call(env)
event = last_sentry_event
Expand Down Expand Up @@ -729,11 +724,9 @@ def will_be_sampled_by_sdk

describe "profiling with StackProf", when: :stack_prof_installed? do
context "when profiling is enabled" do
before do
perform_basic_setup do |config|
config.traces_sample_rate = 1.0
config.profiles_sample_rate = 1.0
config.release = "test-release"
let(:app) do
->(_) do
[200, {}, "ok"]
end
end

Expand All @@ -745,7 +738,14 @@ def will_be_sampled_by_sdk
end

before do
perform_basic_setup do |config|
config.traces_sample_rate = 1.0
config.profiles_sample_rate = 1.0
config.release = "test-release"
end

StackProf.stop

allow(StackProf).to receive(:results).and_return(stackprof_results)
end

Expand All @@ -755,6 +755,13 @@ def will_be_sampled_by_sdk

describe "profiling with vernier", when: :vernier_installed? do
context "when profiling is enabled" do
let(:app) do
->(_) do
ProfilerTest::Bar.bar
[200, {}, "ok"]
end
end

before do
perform_basic_setup do |config|
config.traces_sample_rate = 1.0
Expand Down

0 comments on commit ae6090f

Please sign in to comment.