-
Notifications
You must be signed in to change notification settings - Fork 91
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
Laravel Instrumentation #184
Laravel Instrumentation #184
Conversation
Thanks for opening your first pull request! If you haven't yet signed our Contributor License Agreement (CLA), then please do so that we can accept your contribution. A link should appear shortly in this PR if you have not already signed one. |
Are all tests passing? |
Hook into `\Illuminate\Contracts\Foundation\Application`. Allows for watcher registration in console Kernel contexts.
…instrumentation.
38b4f05
to
cb5eea9
Compare
@@ -4,8 +4,8 @@ | |||
|
|||
namespace OpenTelemetry\Contrib\Instrumentation\Laravel; | |||
|
|||
use Illuminate\Foundation\Application; | |||
use Illuminate\Foundation\Http\Kernel; | |||
use Illuminate\Contracts\Foundation\Application; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each Watcher is already typed against \Illuminate\Contracts\Foundation\Application
, so this maintains that type for consistency.
The existing ones do. I'm looking to write some which target the console but just need to figure out what that instrumentation should look like. |
Codecov Report
@@ Coverage Diff @@
## main #184 +/- ##
============================================
+ Coverage 28.60% 34.81% +6.20%
- Complexity 472 811 +339
============================================
Files 47 72 +25
Lines 1755 3091 +1336
============================================
+ Hits 502 1076 +574
- Misses 1253 2015 +762
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
|
This looks pretty good to me. There's a linting error to fix to make the build green. I also think it's worth waiting on #184 to be merged, and then ensuring your changes work back to Laravel 6.x |
Thanks @brettmc. I think I've got the linting one sorted now. This is #184, did you mean this should go in after another that's in queue? 😄 Is there a reference/documented test strategy for this? Or do you tend to just go and manually create Laravel projects and test instrumentation that way? Happy to investigate this either way, all part of familiarising myself with the ecosystem. Thanks! |
Sorry, #185 (which has just been merged) is for Laravel too. Can you incorporate those changes into your branch. It looks like we can support back to Laravel v6.x
Just the existing integration tests, but verifying against a real Laravel app is also encouraged. If you do come across issues, please try to replicate them in a test. I'm very open to any improvements you can imagine :) |
Thanks, I've merged main into this branch to reflect those changes. I think I fixed the import error on the last build too; IDE and php-cs-fixer in slight disagreement over what sorting the imports should look like! |
I'm keeping this in draft still as I'm not happy with how it instruments the commands currently. Will continue testing this through the coming evenings to better refine it. |
…nd execute pre-hook.
I'm about to push my latest changes (which currently have a failing test); I am still trying to get the artisan handle to be recorded as the first span in the trace in the tests but falling over with it currently. -- I've used the following test route to produce a trace in Zipkin: Route::get('/test', function () {
\Illuminate\Support\Facades\Artisan::call('optimize');
\Illuminate\Support\Facades\Artisan::call('optimize:clear');
}); |
Hello 👋
I'm opening this as a draft, while I test it locally. This PR moves watcher registration from the Http Kernel into the Application contract.
This should allows for watcher registration in console Kernel contexts, such as commands that are configured to run in the Kernel scheduler.
I have tested this locally in Laravel 10 only so far.