forked from opentelemetry-php/contrib-auto-laravel
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dkudrin
committed
Apr 3, 2024
1 parent
83f0504
commit 5664521
Showing
16 changed files
with
73 additions
and
108 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
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
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
This file was deleted.
Oops, something went wrong.
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,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Contrib\Instrumentation\Lumen; | ||
|
||
use Illuminate\Contracts\Foundation\Application; | ||
use OpenTelemetry\API\Instrumentation\CachedInstrumentation; | ||
use OpenTelemetry\Contrib\Instrumentation\Lumen\Watchers\CacheWatcher; | ||
use OpenTelemetry\Contrib\Instrumentation\Lumen\Watchers\ClientRequestWatcher; | ||
use OpenTelemetry\Contrib\Instrumentation\Lumen\Watchers\ExceptionWatcher; | ||
use OpenTelemetry\Contrib\Instrumentation\Lumen\Watchers\LogWatcher; | ||
use OpenTelemetry\Contrib\Instrumentation\Lumen\Watchers\QueryWatcher; | ||
use OpenTelemetry\Contrib\Instrumentation\Lumen\Watchers\RequestWatcher; | ||
use OpenTelemetry\Contrib\Instrumentation\Lumen\Watchers\Watcher; | ||
use function OpenTelemetry\Instrumentation\hook; | ||
use Throwable; | ||
|
||
class LumenInstrumentation | ||
{ | ||
public const NAME = 'lumen'; | ||
|
||
public static function registerWatchers(Application $app, Watcher $watcher) | ||
{ | ||
$watcher->register($app); | ||
} | ||
|
||
public static function register(): void | ||
{ | ||
$instrumentation = new CachedInstrumentation('io.opentelemetry.contrib.php.lumen'); | ||
|
||
hook( | ||
Application::class, | ||
'__construct', | ||
post: static function (Application $application, array $params, mixed $returnValue, ?Throwable $exception) use ($instrumentation) { | ||
self::registerWatchers($application, new CacheWatcher()); | ||
self::registerWatchers($application, new ClientRequestWatcher($instrumentation)); | ||
self::registerWatchers($application, new ExceptionWatcher()); | ||
self::registerWatchers($application, new LogWatcher()); | ||
self::registerWatchers($application, new QueryWatcher($instrumentation)); | ||
self::registerWatchers($application, new RequestWatcher()); | ||
}, | ||
); | ||
|
||
ConsoleInstrumentation::register($instrumentation); | ||
HttpInstrumentation::register($instrumentation); | ||
} | ||
} |
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
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
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
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