Skip to content
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

Fix import of secondary integrations in Laravel and move appropriate tracing logic from register to boot method #127

Merged
merged 1 commit into from
Nov 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions src/DDTrace/Integrations/Laravel/V5/LaravelProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

use DDTrace;
use DDTrace\Encoders\Json;
use DDTrace\Integrations\Eloquent\EloquentIntegration;
use DDTrace\Integrations\Memcached\MemcachedIntegration;
use DDTrace\Integrations\PDO\PDOIntegration;
use DDTrace\Integrations\Predis\PredisIntegration;
use DDTrace\Tags;
use DDTrace\Tracer;
use DDTrace\Types;
Expand Down Expand Up @@ -34,6 +38,7 @@
*/
class LaravelProvider extends ServiceProvider
{
/** @inheritdoc */
public function register()
{
if (!extension_loaded('ddtrace')) {
Expand All @@ -52,6 +57,12 @@ public function register()
// container for easy Laravel-specific use.
GlobalTracer::set($tracer);
$this->app->instance(Tracer::class, $tracer);
}

/** @inheritdoc */
public function boot()
{
$tracer = GlobalTracer::get();

// Trace middleware
dd_trace(Pipeline::class, 'through', function ($pipes) {
Expand Down Expand Up @@ -135,13 +146,13 @@ public function register()
});

// Enable extension integrations
Eloquent::load();
EloquentIntegration::load();
if (class_exists('Memcached')) {
Memcached::load();
MemcachedIntegration::load();
}
PDO::load();
PDOIntegration::load();
if (class_exists('Predis\Client')) {
Predis::load();
PredisIntegration::load();
}

// Flushes traces to agent.
Expand Down