|
6 | 6 |
|
7 | 7 | use Illuminate\Contracts\Foundation\Application as ApplicationContract; |
8 | 8 | use Illuminate\Foundation\Application as FoundationalApplication; |
9 | | -use OpenTelemetry\Contrib\Instrumentation\Laravel\Hooks\LaravelHook; |
10 | | -use OpenTelemetry\Contrib\Instrumentation\Laravel\Hooks\LaravelHookTrait; |
| 9 | +use OpenTelemetry\API\Instrumentation\AutoInstrumentation\HookManager; |
| 10 | +use OpenTelemetry\API\Logs\LoggerInterface; |
| 11 | +use OpenTelemetry\API\Metrics\MeterInterface; |
| 12 | +use OpenTelemetry\API\Trace\TracerInterface; |
| 13 | +use OpenTelemetry\Contrib\Instrumentation\Laravel\Hooks\Hook; |
| 14 | +use OpenTelemetry\Contrib\Instrumentation\Laravel\LaravelConfiguration; |
11 | 15 | use OpenTelemetry\Contrib\Instrumentation\Laravel\Watchers\CacheWatcher; |
12 | 16 | use OpenTelemetry\Contrib\Instrumentation\Laravel\Watchers\ClientRequestWatcher; |
13 | 17 | use OpenTelemetry\Contrib\Instrumentation\Laravel\Watchers\ExceptionWatcher; |
14 | 18 | use OpenTelemetry\Contrib\Instrumentation\Laravel\Watchers\LogWatcher; |
15 | 19 | use OpenTelemetry\Contrib\Instrumentation\Laravel\Watchers\QueryWatcher; |
16 | 20 | use OpenTelemetry\Contrib\Instrumentation\Laravel\Watchers\Watcher; |
17 | | -use function OpenTelemetry\Instrumentation\hook; |
18 | 21 | use Throwable; |
19 | 22 |
|
20 | | -class Application implements LaravelHook |
| 23 | +class Application implements Hook |
21 | 24 | { |
22 | | - use LaravelHookTrait; |
23 | | - |
24 | | - public function instrument(): void |
25 | | - { |
26 | | - hook( |
| 25 | + public function instrument( |
| 26 | + HookManager $hookManager, |
| 27 | + LaravelConfiguration $configuration, |
| 28 | + LoggerInterface $logger, |
| 29 | + MeterInterface $meter, |
| 30 | + TracerInterface $tracer, |
| 31 | + ): void { |
| 32 | + $hookManager->hook( |
27 | 33 | FoundationalApplication::class, |
28 | 34 | '__construct', |
29 | | - post: function (FoundationalApplication $application, array $params, mixed $returnValue, ?Throwable $exception) { |
| 35 | + postHook: function (FoundationalApplication $application, array $params, mixed $returnValue, ?Throwable $exception) use ($tracer) { |
30 | 36 | $this->registerWatchers($application, new CacheWatcher()); |
31 | | - $this->registerWatchers($application, new ClientRequestWatcher($this->instrumentation)); |
| 37 | + $this->registerWatchers($application, new ClientRequestWatcher($tracer)); |
32 | 38 | $this->registerWatchers($application, new ExceptionWatcher()); |
33 | 39 | $this->registerWatchers($application, new LogWatcher()); |
34 | | - $this->registerWatchers($application, new QueryWatcher($this->instrumentation)); |
| 40 | + $this->registerWatchers($application, new QueryWatcher($tracer)); |
35 | 41 | }, |
36 | 42 | ); |
37 | 43 | } |
|
0 commit comments