File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -126,8 +126,7 @@ def record_producer_span(job, &enqueue)
126126 {
127127 system : messaging_system ( job ) ,
128128 message_id : job . job_id ,
129- destination : job . queue_name ,
130- body_size : body_size { job . serialize }
129+ destination : job . queue_name
131130 } . compact
132131 } ,
133132 default_retry_count : -> { executions ( job ) } ,
Original file line number Diff line number Diff line change 2424 expect ( publish_span [ :timestamp ] ) . not_to be_nil
2525 end
2626
27- it "records messaging.message.body.size as the JSON byte length of the serialized job, arguments included" do
28- short_greeting = "hi"
29- long_greeting = "héllo wörld"
30-
31- within_parent_transaction do
32- greeting_job . perform_later ( short_greeting )
33- greeting_job . perform_later ( long_greeting )
34- end
35-
36- parent = transactions . find { |t | t . contexts . dig ( :trace , :op ) == "test" }
37- body_sizes = parent . spans . select { |s | s [ :op ] == "queue.publish" } . map { |s | s [ :data ] [ "messaging.message.body.size" ] }
38- expect ( body_sizes ) . to all ( be_an ( Integer ) )
39- expect ( body_sizes . last - body_sizes . first )
40- . to eq ( JSON . generate ( long_greeting ) . bytesize - JSON . generate ( short_greeting ) . bytesize )
41- end
42-
4327 it "records the same messaging.system on the producer span and the consumer transaction" do
4428 within_parent_transaction do
4529 successful_job . perform_later
Original file line number Diff line number Diff line change 99 it_behaves_like "a Sentry-instrumented ActiveJob backend"
1010 it_behaves_like "an ActiveJob backend that supports distributed tracing"
1111
12+ context "when a custom serializer changes the job payload" do
13+ let ( :configure_sentry ) { proc { |config | config . traces_sample_rate = 1.0 } }
14+
15+ it "enqueues the same custom payload with and without a sampled parent" do
16+ custom_job = job_fixture do
17+ def serialize
18+ @serialization_count = ( @serialization_count || 0 ) + 1
19+ super . merge ( "serialization_count" => @serialization_count )
20+ end
21+
22+ def perform ; end
23+ end
24+
25+ custom_job . perform_later
26+ untraced_count = last_enqueued_payload [ "serialization_count" ]
27+ within_parent_transaction { custom_job . perform_later }
28+
29+ expect ( untraced_count ) . to eq ( 1 )
30+ expect ( last_enqueued_payload [ "serialization_count" ] ) . to eq ( untraced_count )
31+ end
32+ end
33+
1234 context "when the job data cannot be encoded as JSON" do
1335 let ( :configure_sentry ) { proc { |config | config . traces_sample_rate = 1.0 } }
1436 let ( :unencodable_argument ) { "\xFF " . dup . force_encoding ( Encoding ::UTF_8 ) }
You can’t perform that action at this time.
0 commit comments