-
Notifications
You must be signed in to change notification settings - Fork 118
👷 Laravel instrumentation 1.1.x #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 10 commits
4c7f2c9
e2e039a
65e413e
1deb2b4
98af07f
1ba04c2
f3428c5
bb09763
c1ed471
3d9beb3
9788fdd
60ba83a
d5cdeca
e494ac2
ea2e4bb
4231acd
ea05ad4
d67da56
190f628
7412881
d2887bc
cf6deaf
c53a6db
3eec435
45a6932
ee8cebe
a6a677e
6a8d0ef
60fc781
0d7dcf4
16dc809
fc1df3f
c9a83fe
44440df
a3cf950
504796e
f18ab42
b0d6da3
b5b053a
fee0f01
828dca2
1513e1b
d65a213
1c65531
b30d150
709dd6c
6ce15a7
70a5996
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
<?php | ||
/** | ||
* This file must *only* be used to register SPI components, as it | ||
* will be pruned automatically via the tbachert/spi plugin. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use Nevay\SPI\ServiceLoader; | ||
use OpenTelemetry\API\Instrumentation\AutoInstrumentation\Instrumentation; | ||
use OpenTelemetry\Contrib\Instrumentation\Laravel\Hooks; | ||
use OpenTelemetry\Contrib\Instrumentation\Laravel\LaravelInstrumentation; | ||
use OpenTelemetry\SDK\Sdk; | ||
|
||
if (class_exists(Sdk::class) && Sdk::isInstrumentationDisabled(LaravelInstrumentation::NAME) === true) { | ||
return; | ||
} | ||
ServiceLoader::register(Instrumentation::class, LaravelInstrumentation::class); | ||
|
||
if (extension_loaded('opentelemetry') === false) { | ||
trigger_error('The opentelemetry extension must be loaded in order to autoload the OpenTelemetry Laravel auto-instrumentation', E_USER_WARNING); | ||
ServiceLoader::register(Hooks\Hook::class, Hooks\Illuminate\Console\Command::class); | ||
|
||
return; | ||
} | ||
ServiceLoader::register(Hooks\Hook::class, Hooks\Illuminate\Contracts\Console\Kernel::class); | ||
ServiceLoader::register(Hooks\Hook::class, Hooks\Illuminate\Contracts\Http\Kernel::class); | ||
ServiceLoader::register(Hooks\Hook::class, Hooks\Illuminate\Contracts\Queue\Queue::class); | ||
|
||
LaravelInstrumentation::register(); | ||
ServiceLoader::register(Hooks\Hook::class, Hooks\Illuminate\Foundation\Console\ServeCommand::class); | ||
ServiceLoader::register(Hooks\Hook::class, Hooks\Illuminate\Foundation\Application::class); | ||
|
||
ServiceLoader::register(Hooks\Hook::class, Hooks\Illuminate\Queue\Queue::class); | ||
ServiceLoader::register(Hooks\Hook::class, Hooks\Illuminate\Queue\SyncQueue::class); | ||
ServiceLoader::register(Hooks\Hook::class, Hooks\Illuminate\Queue\Worker::class); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,18 +9,16 @@ | |
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"require": { | ||
"php": "^8.0", | ||
"php": "^8.1", | ||
"ext-json": "*", | ||
"ext-opentelemetry": "*", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed based on similar issue raised for PDO instrumentation. |
||
"laravel/framework": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0", | ||
"open-telemetry/api": "^1.0", | ||
"open-telemetry/sem-conv": "^1.24" | ||
ChrisLightfootWild marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
"laravel/framework": "^10.0 || ^11.0", | ||
"open-telemetry/opentelemetry": "dev-auto-instrumentation-registration" | ||
}, | ||
"require-dev": { | ||
"friendsofphp/php-cs-fixer": "^3.50", | ||
"guzzlehttp/guzzle": "*", | ||
"nunomaduro/collision": "*", | ||
"open-telemetry/sdk": "^1.0", | ||
"orchestra/testbench": ">=7.41.3", | ||
"phan/phan": "^5.0", | ||
"php-http/mock-client": "*", | ||
|
@@ -44,11 +42,28 @@ | |
"OpenTelemetry\\Tests\\Contrib\\Instrumentation\\Laravel\\": "tests/" | ||
} | ||
}, | ||
"extra": { | ||
"spi-config": { | ||
"autoload-files": true | ||
}, | ||
"spi": { | ||
"OpenTelemetry\\Config\\SDK\\Configuration\\ComponentProvider": [ | ||
"OpenTelemetry\\Contrib\\Instrumentation\\Laravel\\LaravelComponentProvider" | ||
] | ||
} | ||
}, | ||
"repositories": [ | ||
{ | ||
"type": "vcs", | ||
"url": "https://github.com/brettmc/opentelemetry-php" | ||
} | ||
], | ||
"config": { | ||
"lock": false, | ||
"sort-packages": true, | ||
"allow-plugins": { | ||
"php-http/discovery": false | ||
"php-http/discovery": false, | ||
"tbachert/spi": true | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Contrib\Instrumentation\Laravel\Hooks; | ||
|
||
use OpenTelemetry\API\Instrumentation\AutoInstrumentation\HookManager; | ||
use OpenTelemetry\API\Logs\LoggerInterface; | ||
use OpenTelemetry\API\Metrics\MeterInterface; | ||
use OpenTelemetry\API\Trace\TracerInterface; | ||
use OpenTelemetry\Contrib\Instrumentation\Laravel\LaravelConfiguration; | ||
|
||
interface Hook | ||
{ | ||
public function instrument( | ||
HookManager $hookManager, | ||
LaravelConfiguration $configuration, | ||
LoggerInterface $logger, | ||
MeterInterface $meter, | ||
TracerInterface $tracer, | ||
|
||
): void; | ||
} |
Uh oh!
There was an error while loading. Please reload this page.