-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added ability to use SentryTracing feature * Update services.php * Rename SentryTracingRequestListener to SentryTracingRequestListener.php * Update services.php added use Symfony\Component\DependencyInjection\ContainerInterface; * Update composer.json Updated sentry/sentry-symfony version (which include tracing feature) * Updated versions and decorator events * php < 8 fix && DI fix * typo fix * fixed namespace * cs-fix && DI * fixed typo * DI fix * CS fix && decoration * Fixed DI * Fixed DI * ci fix * Update src/DependencyInjection/BaldinofRoadRunnerExtension.php
- Loading branch information
1 parent
adf9501
commit 1a4785c
Showing
3 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/Integration/Sentry/SentryTracingRequestListenerDecorator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Baldinof\RoadRunnerBundle\Integration\Sentry; | ||
|
||
use Sentry\SentryBundle\EventListener\TracingRequestListener; | ||
use Sentry\State\HubInterface; | ||
use Symfony\Component\HttpKernel\Event\RequestEvent; | ||
use Symfony\Component\HttpKernel\Event\ResponseEvent; | ||
use Symfony\Component\HttpKernel\Event\TerminateEvent; | ||
|
||
final class SentryTracingRequestListenerDecorator | ||
{ | ||
private TracingRequestListener $innerListener; | ||
private HubInterface $hub; | ||
|
||
public function __construct(TracingRequestListener $innerListener, HubInterface $hub) | ||
{ | ||
$this->innerListener = $innerListener; | ||
$this->hub = $hub; | ||
} | ||
|
||
public function handleKernelRequestEvent(RequestEvent $event): void | ||
{ | ||
$this->innerListener->handleKernelRequestEvent($event); | ||
} | ||
|
||
public function handleKernelResponseEvent(ResponseEvent $event): void | ||
{ | ||
$this->innerListener->handleKernelResponseEvent($event); | ||
$transaction = $this->hub->getTransaction(); | ||
|
||
if (null === $transaction) { | ||
return; | ||
} | ||
|
||
$transaction->finish(); | ||
} | ||
|
||
public function handleKernelTerminateEvent(TerminateEvent $event): void | ||
{ | ||
// do nothing | ||
} | ||
} |