Skip to content

Commit c0b1bf4

Browse files
committed
fix(queues): skip unsampled optional telemetry
1 parent 755de16 commit c0b1bf4

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

‎sentry-rails/spec/active_job/test_adapter_spec.rb‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,30 @@
3232
end
3333
end
3434

35+
context "when the transaction is unsampled" do
36+
let(:configure_sentry) { proc { |config| config.traces_sample_rate = 0.0 } }
37+
38+
it "enqueues and performs without encoding optional body size" do
39+
performed_arguments = []
40+
recording_job = job_fixture do
41+
define_method(:perform) { |argument| performed_arguments << argument }
42+
end
43+
serializations = 0
44+
serializer = TracePoint.new(:call) do |call|
45+
serializations += 1 if call.self.equal?(JSON) && call.method_id == :generate
46+
end
47+
48+
serializer.enable do
49+
within_parent_transaction { recording_job.perform_later("hello") }
50+
drain
51+
end
52+
53+
expect(performed_arguments).to eq(["hello"])
54+
expect(serializations).to eq(0)
55+
expect(transactions).to be_empty
56+
end
57+
end
58+
3559
context "when tracing is disabled" do
3660
it "reports job errors without messaging.message.body.size" do
3761
expect do

0 commit comments

Comments
 (0)