Skip to content

Commit 12e3d77

Browse files
authored
improve the Application::bootstrapWith hook to find Laravel's application name (#3036)
1 parent 52336c9 commit 12e3d77

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/DDTrace/Integrations/Laravel/LaravelIntegration.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ function ($app) use ($integration) {
9191
$configPath = realpath($app->configPath());
9292
if (file_exists($configPath . '/app.php')) {
9393
$config = require $configPath . '/app.php';
94-
$integration->serviceName = $config['name'];
94+
if (isset($config['name'])) {
95+
$integration->serviceName = $config['name'];
96+
}
97+
}
98+
if (empty($integration->serviceName)) {
99+
$integration->serviceName = isset($_ENV['APP_NAME']) ? $_ENV['APP_NAME'] : 'Laravel';
95100
}
96101
}
97102
}

0 commit comments

Comments
 (0)