@@ -233,10 +233,19 @@ static char* nr_laravel_queue_job_txn_name(zval* job TSRMLS_DC) {
233
233
}
234
234
235
235
/*
236
- * Handle:
237
- * Illuminate\\Queue\\SyncQueue::raiseBeforeJobEvent(Job $job):void
236
+ * Handle: Illuminate\Queue\SyncQueue::executeJob
237
+ * /**
238
+ * Execute a given job synchronously.
239
+ *
240
+ * @param string $job
241
+ * @param mixed $data
242
+ * @param string|null $queue
243
+ * @return int
244
+ *
245
+ * @throws \Throwable
246
+ protected function executeJob($job, $data = '', $queue = null)
238
247
*/
239
- NR_PHP_WRAPPER (nr_laravel_queue_syncqueue_raiseBeforeJobEvent_before ) {
248
+ NR_PHP_WRAPPER (nr_laravel_queue_syncqueue_executeJob_before ) {
240
249
zval * job = NULL ;
241
250
242
251
NR_UNUSED_SPECIALFN ;
@@ -283,10 +292,15 @@ NR_PHP_WRAPPER_END
283
292
284
293
/*
285
294
* Handle:
286
- * Illuminate\\Queue\\Worker::raiseBeforeJobEvent(string $connectionName, Job
287
- * $job):void
295
+ * Illuminate\\Queue\\Worker::process
296
+ * @param string $connectionName
297
+ * @param \Illuminate\Contracts\Queue\Job $job
298
+ * @param \Illuminate\Queue\WorkerOptions $options
299
+ * @return void
300
+ *
301
+ * @throws \Throwable
288
302
*/
289
- NR_PHP_WRAPPER (nr_laravel_queue_worker_raiseBeforeJobEvent_after ) {
303
+ NR_PHP_WRAPPER (nr_laravel_queue_worker_process_before ) {
290
304
zval * job = NULL ;
291
305
292
306
NR_UNUSED_SPECIALFN ;
@@ -300,7 +314,7 @@ NR_PHP_WRAPPER(nr_laravel_queue_worker_raiseBeforeJobEvent_after) {
300
314
nr_php_txn_end (1 , 0 TSRMLS_CC );
301
315
302
316
/*
303
- * Laravel 7 and later passes Job as the second parameter.
317
+ * Job is the second parameter.
304
318
*/
305
319
char * txn_name = NULL ;
306
320
@@ -330,27 +344,22 @@ NR_PHP_WRAPPER(nr_laravel_queue_worker_raiseBeforeJobEvent_after) {
330
344
NR_PHP_WRAPPER_END
331
345
332
346
/*
333
- * Handle :
334
- * Illuminate\\Queue\\Worker::raiseAfterJobEvent(string $connectionName, Job
335
- * $job):void Illuminate\\Queue\\SyncQueue::raiseAfterJobEvent(Job $job):void
347
+ * Handles :
348
+ * Illuminate\\Queue\\Worker::process
349
+ * Illuminate\\Queue\\SyncQueue::executeJob
336
350
*/
337
- NR_PHP_WRAPPER (nr_laravel_queue_worker_raiseAfterJobEvent_before ) {
351
+
352
+ NR_PHP_WRAPPER (nr_laravel_queue_worker_after ) {
338
353
NR_UNUSED_SPECIALFN ;
339
354
(void )wraprec ;
340
355
341
356
NR_PHP_WRAPPER_REQUIRE_FRAMEWORK (NR_FW_LARAVEL );
342
357
343
- /*
344
- * If we made it here, we are assured there are no uncaught exceptions (as it
345
- * would be noticed with the oapi exception handling before calling this
346
- * callback so no need to check before ending the txn.
347
- */
348
-
349
358
/*
350
359
* End the real transaction and then start a new transaction so our
351
360
* instrumentation continues to fire, knowing that we'll ignore that
352
- * transaction either when Worker::process() is called again or when
353
- * WorkCommand::handle() exits.
361
+ * transaction either when Illuminate\\Queue\\ Worker::process or
362
+ * Illuminate\\Queue\\SyncQueue::executeJob is called again
354
363
*/
355
364
nr_php_txn_end (0 , 0 TSRMLS_CC );
356
365
nr_php_txn_begin (NULL , NULL TSRMLS_CC );
@@ -854,23 +863,24 @@ void nr_laravel_queue_enable(TSRMLS_D) {
854
863
* that is executed, but don't want to record a transaction for the actual
855
864
* queue:work command, since it spends most of its time sleeping.
856
865
*
857
- * We use the raiseBeforeJobEvent and raiseAfterJobEvent listeners which we
866
+ * We use the process and executeJob functions which we
858
867
* can use to name the Laravel Job and capture the true time that the job
859
868
* took.
860
869
*/
861
870
871
+ /*
872
+ * Wrap:
873
+ * Illuminate\\Queue\\Worker::process
874
+ * Illuminate\\Queue\\SyncQueue::executeJob
875
+ */
862
876
nr_php_wrap_user_function_before_after_clean (
863
- NR_PSTR ("Illuminate\\Queue\\Worker::raiseBeforeJobEvent" ), NULL ,
864
- nr_laravel_queue_worker_raiseBeforeJobEvent_after , NULL );
865
- nr_php_wrap_user_function_before_after_clean (
866
- NR_PSTR ("Illuminate\\Queue\\Worker::raiseAfterJobEvent" ),
867
- nr_laravel_queue_worker_raiseAfterJobEvent_before , NULL , NULL );
868
- nr_php_wrap_user_function_before_after_clean (
869
- NR_PSTR ("Illuminate\\Queue\\SyncQueue::raiseBeforeJobEvent" ),
870
- nr_laravel_queue_syncqueue_raiseBeforeJobEvent_before , NULL , NULL );
877
+ NR_PSTR ("Illuminate\\Queue\\SyncQueue::executeJob" ),
878
+ nr_laravel_queue_syncqueue_executeJob_before ,
879
+ nr_laravel_queue_worker_after , nr_laravel_queue_worker_after );
871
880
nr_php_wrap_user_function_before_after_clean (
872
- NR_PSTR ("Illuminate\\Queue\\SyncQueue::raiseAfterJobEvent" ),
873
- nr_laravel_queue_worker_raiseAfterJobEvent_before , NULL , NULL );
881
+ NR_PSTR ("Illuminate\\Queue\\Worker::process" ),
882
+ nr_laravel_queue_worker_process_before , nr_laravel_queue_worker_after ,
883
+ nr_laravel_queue_worker_after );
874
884
875
885
#else
876
886
@@ -883,8 +893,9 @@ void nr_laravel_queue_enable(TSRMLS_D) {
883
893
* aren't executed if we're not actually in a transaction.
884
894
*
885
895
* So instead, what we'll do is to keep recording, but ensure that we ignore
886
- * the transaction after WorkCommand::handle() has finished executing, at
887
- * which point no more jobs can be run.
896
+ * the transaction before and after
897
+ * Illuminate\\Queue\\Worker::process
898
+ * Illuminate\\Queue\\SyncQueue::executeJob
888
899
*/
889
900
890
901
nr_php_wrap_user_function (
0 commit comments