From 3429a09629db49bae0f71648686f336c77a161e0 Mon Sep 17 00:00:00 2001 From: Valerio Barbera Date: Wed, 3 Jul 2024 17:28:25 +0200 Subject: [PATCH] transaction custom type --- composer.json | 2 +- src/InspectorServiceProvider.php | 2 +- src/Middleware/WebRequestMonitoring.php | 5 +---- src/Providers/CommandServiceProvider.php | 1 + src/Providers/JobServiceProvider.php | 1 + 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index c2aa606..5295c0a 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "illuminate/console": "^5.5|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", "illuminate/contracts": "^5.5|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", "illuminate/support": "^5.5|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", - "inspector-apm/inspector-php": "^3.7.18" + "inspector-apm/inspector-php": "^3.8.0" }, "autoload": { "psr-4": { diff --git a/src/InspectorServiceProvider.php b/src/InspectorServiceProvider.php index 37787d1..c535a23 100644 --- a/src/InspectorServiceProvider.php +++ b/src/InspectorServiceProvider.php @@ -29,7 +29,7 @@ class InspectorServiceProvider extends ServiceProvider * * @var string */ - const VERSION = '4.8.7'; + const VERSION = '4.9.0'; /** * Booting of services. diff --git a/src/Middleware/WebRequestMonitoring.php b/src/Middleware/WebRequestMonitoring.php index 18c205d..2be6ebf 100644 --- a/src/Middleware/WebRequestMonitoring.php +++ b/src/Middleware/WebRequestMonitoring.php @@ -60,10 +60,7 @@ protected function startTransaction($request) $this->buildTransactionName($request) ); - // todo: add an argument to the Transaction __constructor - $transaction->type = Transaction::TYPE_REQUEST; - - $transaction->addContext( + $transaction->markAsRequest()->addContext( 'Request Body', Filters::hideParameters( $request->request->all(), diff --git a/src/Providers/CommandServiceProvider.php b/src/Providers/CommandServiceProvider.php index be10307..ce9422e 100644 --- a/src/Providers/CommandServiceProvider.php +++ b/src/Providers/CommandServiceProvider.php @@ -32,6 +32,7 @@ public function boot() if (Inspector::needTransaction()) { Inspector::startTransaction($event->command) + ->setType('artisan') ->addContext('Command', [ 'arguments' => $event->input->getArguments(), 'options' => $event->input->getOptions(), diff --git a/src/Providers/JobServiceProvider.php b/src/Providers/JobServiceProvider.php index 8b3104c..3acfe34 100644 --- a/src/Providers/JobServiceProvider.php +++ b/src/Providers/JobServiceProvider.php @@ -119,6 +119,7 @@ protected function handleJobStart(Job $job) { if (Inspector::needTransaction()) { Inspector::startTransaction($job->resolveName()) + ->setType('job') ->addContext('Payload', $job->payload()); } elseif (Inspector::canAddSegments()) { $this->initializeSegment($job);