-
Notifications
You must be signed in to change notification settings - Fork 160
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
How to integrate with Laravel 5.3 #301
Comments
Hi @tristanjahier, please refer to the upgrade guide. Basically (unless you are doing some manual instrumentation):
This is enough if you don't require manual instrumentation. |
Hi @tristanjahier any luck with this? :) |
I'm sorry that was not clear but I was already trying to do a fresh install with So if I understand correctly, the minimal setup does not require anything to be done on the app level? No composer package to require, only a PHP extension? |
Hi, that is correct. You only have to install the PHP extension. Please note that we test for 5.7 (not 5.3) so if you notice unexpected behaviors or any error please notify us and we will add integration tests for this version. Let me know how it goes! |
Thank you @labbati! But if I need to do manual instrumentation, what is the proper way to integrate this package into Laravel (apart from requiring The official documentation says: // Add the PHP tracer bootstrap
require '<APP_ROOT>/vendor/datadog/dd-trace/bridge/dd_init.php';
// Create the first span in the trace
\DDTrace\GlobalTracer::get()->startRootSpan('web.request'); but I feel like there must be a better way to integrate with a Laravel environment. |
Hi @tristanjahier! let's assume for a moment that you don't need to do manual instrumentation, then just installing the PHP extension (and adding nothing to composer) you already would have a bunch of things from Laravel without the snipped you wrote above. So first of all I would take a look at what you get, because a few things from Laravel (e.g. Pipelines) are already traced. Now, if you want to do manual instrumentation is because you have specific method (either from laravel or from your own code) that you want to instrument. Please note, though, that the manual instrumentation that you do "adds to" and won't "replace" the spans created by the default auto-instrumentation. If you need to "replace" instead, this is a more advanced topic and deserves a separate thread. How If this is true you have two options:
In either case, you are NOT doing Where It depends. In general you have multiple options to add manual tracing. For example you can create your own provider and register it before the other providers. Then in the
The one above would be my recommended method. But keep in mind that the Alternatively, if you don't mind depending on datadog (or open tracing) in your code, you can do this directly in the method (but we don't recommend it)
Does this address your doubts? |
Wow thank you for this extensive and clear answer @labbati! I think you answered my questions entirely. 👍 |
Hi,
I'm trying to integrate this in a Laravel 5.3 application, but I'm confused about how I am supposed to do it.
In previous releases, this package used to have a
LaravelProvider
class that I had to register inconfig/app.php
. But it cannot work anymore because theDDTrace\Integrations\Laravel\V5\LaravelProvider
class does not exist anymore. And I've read that this is deprecated.If I understood correctly I have to use
DDTrace\Integrations\Laravel\LaravelIntegration
but I'm confused about how to use it.Do I have to call
in my
AppServiceProvider
for example?The text was updated successfully, but these errors were encountered: