@@ -36,6 +36,7 @@ class QueueIntegration extends Feature
36
36
37
37
private const QUEUE_PAYLOAD_BAGGAGE_DATA = 'sentry_baggage_data ' ;
38
38
private const QUEUE_PAYLOAD_TRACE_PARENT_DATA = 'sentry_trace_parent_data ' ;
39
+ private const QUEUE_PAYLOAD_PUBLISH_TIME = 'sentry_publish_time ' ;
39
40
40
41
public function isApplicable (): bool
41
42
{
@@ -78,6 +79,7 @@ public function onBoot(Dispatcher $events): void
78
79
if ($ payload !== null ) {
79
80
$ payload [self ::QUEUE_PAYLOAD_BAGGAGE_DATA ] = getBaggage ();
80
81
$ payload [self ::QUEUE_PAYLOAD_TRACE_PARENT_DATA ] = getTraceparent ();
82
+ $ payload [self ::QUEUE_PAYLOAD_PUBLISH_TIME ] = microtime (true );
81
83
}
82
84
83
85
return $ payload ;
@@ -103,9 +105,6 @@ public function handleJobQueueingEvent(JobQueueing $event): void
103
105
}
104
106
105
107
$ currentSpan
106
- ->setData ([
107
- 'messaging.laravel.job ' => $ jobName ,
108
- ])
109
108
->setDescription ($ jobName );
110
109
}
111
110
@@ -181,12 +180,22 @@ public function handleJobProcessingQueueEvent(JobProcessing $event): void
181
180
182
181
$ resolvedJobName = $ event ->job ->resolveName ();
183
182
183
+ $ receiveLatency = null ;
184
+ if ($ event ->job ->payload ()[self ::QUEUE_PAYLOAD_PUBLISH_TIME ] !== null ) {
185
+ $ receiveLatency = microtime (true ) - $ event ->job ->payload ()[self ::QUEUE_PAYLOAD_PUBLISH_TIME ];
186
+ }
187
+
184
188
$ job = [
185
- 'job ' => $ event ->job ->getName (),
186
- 'queue ' => $ event ->job ->getQueue (),
187
- 'resolved ' => $ resolvedJobName ,
188
- 'attempts ' => $ event ->job ->attempts (),
189
- 'connection ' => $ event ->connectionName ,
189
+ 'messaging.system ' => 'laravel ' ,
190
+
191
+ 'messaging.destination.name ' => $ event ->job ->getQueue (),
192
+ 'messaging.destination.connection ' => $ event ->connectionName ,
193
+
194
+ 'messaging.message.id ' => (string ) $ event ->job ->getJobId (),
195
+ 'messaging.message.envelope.size ' => strlen ($ event ->job ->getRawBody ()),
196
+ 'messaging.message.body.size ' => strlen (json_encode ($ event ->job ->payload ()['data ' ])),
197
+ 'messaging.message.retry.count ' => $ event ->job ->attempts (),
198
+ 'messaging.message.receive.latency ' => $ receiveLatency ,
190
199
];
191
200
192
201
if ($ context instanceof TransactionContext) {
0 commit comments